merged docvwmdi sample into docview one to avoid having 2 almost identical samples; and modernized and cleaned up the code in the process

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56053 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-10-03 15:16:01 +00:00
parent 73eca6fd4b
commit 2d1df0fc58
39 changed files with 1229 additions and 9299 deletions

49
samples/docview/chart.xpm Normal file
View File

@@ -0,0 +1,49 @@
/* XPM */
static char *chart[] = {
/* columns rows colors chars-per-pixel */
"32 32 11 1",
" c black",
". c red",
"X c #00BF00",
"o c green",
"O c yellow",
"+ c blue",
"@ c #00BFBF",
"# c #808080",
"$ c #C0C0C0",
"% c gray100",
"& c None",
/* pixels */
"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&",
"&& &&&&&&",
"&& ###################### &&&&&&",
"&& &&&&&&",
"&& %%%%%%%%%%%%%%%%%%%%%% &&&&&&",
"&& %%%%%%%.....%%%%%%%%%% &&&&&&",
"&& %%%%%%.......%%%%%%%%% &&&&&&",
"&& %%%%%........+%%%%%%%% &&&&&&",
"&& %%%%........+++%%%%%%% &&&&&&",
"&& %%%%.......++++%%%%%%% &&&&&&",
"&& %%%.......++++++%%%%%% &&&&&&",
"&& %%%.... ",
"&& %%%.... #################### ",
"&& %%%%... ",
"&& %%%%... %%%%%%%%%%%%%%%%%%%% ",
"&& %%%%%.. %%#%%++%%%%%%%%%%%%% ",
"&& %%%%%%. %%#%%++%%$$%%%%%%%%% ",
"&& %%%%%%% %%#%%++%%$$%%%%%%%%% ",
"&& %%%%%%% %%#oo++%%$$%%%% %%% ",
"&& %%%%%%% %%#oo++%%$$%%%% %%% ",
"&& %%#oo++%%$$%%%% %%% ",
"&&&&&&&&&& %%#oo++OO$$%%XX %%% ",
"&&&&&&&&&& %%#oo++OO$$%%XX %%% ",
"&&&&&&&&&& %%#oo++OO$$@@XX %%% ",
"&&&&&&&&&& %%#oo++OO$$@@XX %%% ",
"&&&&&&&&&& %%#oo++OO$$@@XX %%% ",
"&&&&&&&&&& %%#oo++OO$$@@XX %%% ",
"&&&&&&&&&& %%#################% ",
"&&&&&&&&&& %%%%%%%%%%%%%%%%%%%% ",
"&&&&&&&&&& %%%%%%%%%%%%%%%%%%%% ",
"&&&&&&&&&& ",
"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"
};

View File

@@ -1,26 +1,32 @@
/////////////////////////////////////////////////////////////////////////////
// Name: doc.cpp
// Name: samples/docview/doc.cpp
// Purpose: Implements document functionality
// Author: Julian Smart
// Modified by:
// Modified by: Vadim Zeitlin: merge with the MDI version and general cleanup
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Copyright: (c) 1998 Julian Smart
// (c) 2008 Vadim Zeitlin
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#pragma hdrstop
#endif
#if !wxUSE_DOC_VIEW_ARCHITECTURE
#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#ifdef __WXMAC__
#include "wx/filename.h"
#include "wx/wx.h"
#endif
#if wxUSE_STD_IOSTREAM
@@ -29,345 +35,166 @@
#include "wx/txtstrm.h"
#endif
#if !wxUSE_DOC_VIEW_ARCHITECTURE
#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
#endif
#include "doc.h"
#include "view.h"
// ----------------------------------------------------------------------------
// DrawingDocument implementation
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(DrawingDocument, wxDocument)
DrawingDocument::~DrawingDocument(void)
{
WX_CLEAR_LIST(wxList, m_doodleSegments)
}
#if wxUSE_STD_IOSTREAM
wxSTD ostream& DrawingDocument::SaveObject(wxSTD ostream& stream)
DocumentOstream& DrawingDocument::SaveObject(DocumentOstream& stream)
{
wxDocument::SaveObject(stream);
wxInt32 n = m_doodleSegments.GetCount();
stream << n << '\n';
const wxInt32 count = m_doodleSegments.size();
stream << count << '\n';
wxList::compatibility_iterator node = m_doodleSegments.GetFirst();
while (node)
for ( int n = 0; n < count; n++ )
{
DoodleSegment *segment = (DoodleSegment *)node->GetData();
segment->SaveObject(stream);
m_doodleSegments[n].SaveObject(stream);
stream << '\n';
node = node->GetNext();
}
return stream;
}
#else
wxOutputStream& DrawingDocument::SaveObject(wxOutputStream& stream)
{
wxDocument::SaveObject(stream);
wxTextOutputStream text_stream( stream );
wxInt32 n = m_doodleSegments.GetCount();
text_stream << n << '\n';
wxList::compatibility_iterator node = m_doodleSegments.GetFirst();
while (node)
{
DoodleSegment *segment = (DoodleSegment *)node->GetData();
segment->SaveObject(stream);
text_stream << '\n';
node = node->GetNext();
}
return stream;
}
#endif
#if wxUSE_STD_IOSTREAM
wxSTD istream& DrawingDocument::LoadObject(wxSTD istream& stream)
DocumentIstream& DrawingDocument::LoadObject(DocumentIstream& stream)
{
wxDocument::LoadObject(stream);
wxInt32 n = 0;
stream >> n;
wxInt32 count = 0;
stream >> count;
for (int i = 0; i < n; i++)
for ( int n = 0; n < count; n++ )
{
DoodleSegment *segment = new DoodleSegment;
segment->LoadObject(stream);
m_doodleSegments.Append(segment);
DoodleSegment segment;
segment.LoadObject(stream);
m_doodleSegments.push_back(segment);
}
return stream;
}
#else
wxInputStream& DrawingDocument::LoadObject(wxInputStream& stream)
void DrawingDocument::DoUpdate()
{
wxDocument::LoadObject(stream);
wxTextInputStream text_stream( stream );
wxInt32 n = 0;
text_stream >> n;
for (int i = 0; i < n; i++)
{
DoodleSegment *segment = new DoodleSegment;
segment->LoadObject(stream);
m_doodleSegments.Append(segment);
}
return stream;
}
#endif
DoodleSegment::DoodleSegment(const DoodleSegment& seg):wxObject()
{
wxList::compatibility_iterator node = seg.m_lines.GetFirst();
while (node)
{
DoodleLine *line = (DoodleLine *)node->GetData();
DoodleLine *newLine = new DoodleLine;
newLine->x1 = line->x1;
newLine->y1 = line->y1;
newLine->x2 = line->x2;
newLine->y2 = line->y2;
m_lines.Append(newLine);
node = node->GetNext();
}
Modify(true);
UpdateAllViews();
}
DoodleSegment::~DoodleSegment(void)
void DrawingDocument::AddDoodleSegment(const DoodleSegment& segment)
{
WX_CLEAR_LIST(wxList, m_lines)
m_doodleSegments.push_back(segment);
DoUpdate();
}
#if wxUSE_STD_IOSTREAM
wxSTD ostream& DoodleSegment::SaveObject(wxSTD ostream& stream)
bool DrawingDocument::PopLastSegment(DoodleSegment *segment)
{
wxInt32 n = m_lines.GetCount();
stream << n << '\n';
if ( m_doodleSegments.empty() )
return false;
wxList::compatibility_iterator node = m_lines.GetFirst();
while (node)
{
DoodleLine *line = (DoodleLine *)node->GetData();
stream << line->x1 << " " <<
line->y1 << " " <<
line->x2 << " " <<
line->y2 << "\n";
node = node->GetNext();
}
if ( segment )
*segment = m_doodleSegments.back();
return stream;
}
#else
wxOutputStream &DoodleSegment::SaveObject(wxOutputStream& stream)
{
wxTextOutputStream text_stream( stream );
m_doodleSegments.pop_back();
wxInt32 n = m_lines.GetCount();
text_stream << n << wxT("\n");
DoUpdate();
wxList::compatibility_iterator node = m_lines.GetFirst();
while (node)
{
DoodleLine* line = (DoodleLine*)node->GetData();
text_stream << line->x1 << wxT(" ") <<
line->y1 << wxT(" ") <<
line->x2 << wxT(" ") <<
line->y2 << wxT("\n");
node = node->GetNext();
}
return stream;
}
#endif
#if wxUSE_STD_IOSTREAM
wxSTD istream& DoodleSegment::LoadObject(wxSTD istream& stream)
{
wxInt32 n = 0;
stream >> n;
for (int i = 0; i < n; i++)
{
DoodleLine *line = new DoodleLine;
stream >> line->x1 >>
line->y1 >>
line->x2 >>
line->y2;
m_lines.Append(line);
}
return stream;
}
#else
wxInputStream &DoodleSegment::LoadObject(wxInputStream& stream)
{
wxTextInputStream text_stream( stream );
wxInt32 n = 0;
text_stream >> n;
for (int i = 0; i < n; i++)
{
DoodleLine *line = new DoodleLine;
text_stream >> line->x1 >>
line->y1 >>
line->x2 >>
line->y2;
m_lines.Append(line);
}
return stream;
}
#endif
void DoodleSegment::Draw(wxDC *dc)
{
wxList::compatibility_iterator node = m_lines.GetFirst();
while (node)
{
DoodleLine *line = (DoodleLine *)node->GetData();
dc->DrawLine(line->x1, line->y1, line->x2, line->y2);
node = node->GetNext();
}
}
/*
* Implementation of drawing command
*/
DrawingCommand::DrawingCommand(const wxString& name, int command, DrawingDocument* doc, DoodleSegment* seg) :
wxCommand(true, name)
{
m_doc = doc;
m_segment = seg;
m_cmd = command;
}
DrawingCommand::~DrawingCommand(void)
{
if (m_segment)
delete m_segment;
}
bool DrawingCommand::Do(void)
{
switch (m_cmd)
{
case DOODLE_CUT:
{
// Cut the last segment
if (m_doc->GetDoodleSegments().GetCount() > 0)
{
wxList::compatibility_iterator node = m_doc->GetDoodleSegments().GetLast();
if (m_segment)
delete m_segment;
m_segment = (DoodleSegment*)node->GetData();
m_doc->GetDoodleSegments().Erase(node);
m_doc->Modify(true);
m_doc->UpdateAllViews();
}
break;
}
case DOODLE_ADD:
{
m_doc->GetDoodleSegments().Append(new DoodleSegment(*m_segment));
m_doc->Modify(true);
m_doc->UpdateAllViews();
break;
}
}
return true;
}
bool DrawingCommand::Undo(void)
{
switch (m_cmd)
{
case DOODLE_CUT:
{
// Paste the segment
if (m_segment)
{
m_doc->GetDoodleSegments().Append(m_segment);
m_doc->Modify(true);
m_doc->UpdateAllViews();
m_segment = NULL;
}
m_doc->Modify(true);
m_doc->UpdateAllViews();
break;
}
case DOODLE_ADD:
{
// Cut the last segment
if (m_doc->GetDoodleSegments().GetCount() > 0)
{
wxList::compatibility_iterator node = m_doc->GetDoodleSegments().GetLast();
DoodleSegment* seg = (DoodleSegment*)node->GetData();
delete seg;
m_doc->GetDoodleSegments().Erase(node);
// ----------------------------------------------------------------------------
// DoodleSegment implementation
// ----------------------------------------------------------------------------
m_doc->Modify(true);
m_doc->UpdateAllViews();
}
}
DocumentOstream& DoodleSegment::SaveObject(DocumentOstream& ostream)
{
#if wxUSE_STD_IOSTREAM
DocumentOstream& stream = ostream;
#else
wxTextOutputStream stream(ostream);
#endif
const wxInt32 count = m_lines.size();
stream << count << '\n';
for ( int n = 0; n < count; n++ )
{
const DoodleLine& line = m_lines[n];
stream
<< line.x1 << ' '
<< line.y1 << ' '
<< line.x2 << ' '
<< line.y2 << '\n';
}
return true;
return stream;
}
DocumentIstream& DoodleSegment::LoadObject(DocumentIstream& istream)
{
#if wxUSE_STD_IOSTREAM
DocumentIstream& stream = istream;
#else
wxTextInputStream stream(istream);
#endif
wxInt32 count = 0;
stream >> count;
for ( int n = 0; n < count; n++ )
{
DoodleLine line;
stream
>> line.x1
>> line.y1
>> line.x2
>> line.y2;
m_lines.push_back(line);
}
return stream;
}
// ----------------------------------------------------------------------------
// TextEditDocument implementation
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(TextEditDocument, wxDocument)
// Since text windows have their own method for saving to/loading from files,
// we override DoSave/OpenDocument instead of Save/LoadObject
bool TextEditDocument::DoSaveDocument(const wxString& filename)
{
TextEditView* view = GetFirstView();
if (!view->m_textsw->SaveFile(filename))
return false;
return true;
return GetFirstView()->GetText()->SaveFile(filename);
}
bool TextEditDocument::DoOpenDocument(const wxString& filename)
{
TextEditView* view = GetFirstView();
if (!view->m_textsw->LoadFile(filename))
return false;
return true;
return GetFirstView()->GetText()->LoadFile(filename);
}
bool TextEditDocument::IsModified(void) const
bool TextEditDocument::IsModified() const
{
TextEditView* view = GetFirstView();
return (wxDocument::IsModified() || (view && view->m_textsw->IsModified()));
return wxDocument::IsModified() || (view && view->GetText()->IsModified());
}
void TextEditDocument::Modify(bool mod)
void TextEditDocument::Modify(bool modified)
{
TextEditView* view = GetFirstView();
wxDocument::Modify(mod);
wxDocument::Modify(modified);
if (!mod && view && view->m_textsw)
view->m_textsw->DiscardEdits();
if ( !modified && view && view->GetText() )
view->GetText()->DiscardEdits();
}
TextEditView* TextEditDocument::GetFirstView() const
{
wxView* view = wxDocument::GetFirstView();
return view ? wxStaticCast(view, TextEditView) : NULL;
wxView* view = wxDocument::GetFirstView();
return view ? wxStaticCast(view, TextEditView) : NULL;
}

View File

@@ -1,107 +1,179 @@
/////////////////////////////////////////////////////////////////////////////
// Name: doc.h
// Name: samples/docview/doc.h
// Purpose: Document classes
// Author: Julian Smart
// Modified by:
// Modified by: Vadim Zeitlin: merge with the MDI version and general cleanup
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Copyright: (c) 1998 Julian Smart
// (c) 2008 Vadim Zeitlin
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __DOC_H__
#define __DOC_H__
#ifndef _WX_SAMPLES_DOCVIEW_DOC_H_
#define _WX_SAMPLES_DOCVIEW_DOC_H_
#include "wx/docview.h"
#include "wx/cmdproc.h"
#include "wx/vector.h"
// Plots a line from one point to the other
class DoodleLine : public wxObject
// This sample is written to build both with wxUSE_STD_IOSTREAM==0 and 1, which
// somewhat complicates its code but is necessary in order to support building
// it under all platforms and in all build configurations
//
// In your own code you would normally use std::stream classes only and so
// wouldn't need these typedefs
#if wxUSE_STD_IOSTREAM
typedef wxSTD istream DocumentIstream;
typedef wxSTD ostream DocumentOstream;
#else // !wxUSE_STD_IOSTREAM
typedef wxInputStream DocumentIstream;
typedef wxOutputStream DocumentOstream;
#endif // wxUSE_STD_IOSTREAM/!wxUSE_STD_IOSTREAM
// ----------------------------------------------------------------------------
// The document class and its helpers
// ----------------------------------------------------------------------------
// Represents a line from one point to the other
struct DoodleLine
{
public:
DoodleLine() { /* leave fields uninitialized */ }
DoodleLine(const wxPoint& pt1, const wxPoint& pt2)
: x1(pt1.x), y1(pt1.y), x2(pt2.x), y2(pt2.y)
{
}
wxInt32 x1;
wxInt32 y1;
wxInt32 x2;
wxInt32 y2;
};
typedef wxVector<DoodleLine> DoodleLines;
// Contains a list of lines: represents a mouse-down doodle
class DoodleSegment : public wxObject
class DoodleSegment
{
public:
wxList m_lines;
DocumentOstream& SaveObject(DocumentOstream& stream);
DocumentIstream& LoadObject(DocumentIstream& stream);
DoodleSegment() : wxObject() {}
DoodleSegment(const DoodleSegment& seg);
virtual ~DoodleSegment();
void Draw(wxDC *dc);
#if wxUSE_STD_IOSTREAM
wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
wxSTD istream& LoadObject(wxSTD istream& text_stream);
#else
wxOutputStream& SaveObject(wxOutputStream& stream);
wxInputStream& LoadObject(wxInputStream& stream);
#endif
bool IsEmpty() const { return m_lines.empty(); }
void AddLine(const wxPoint& pt1, const wxPoint& pt2)
{
m_lines.push_back(DoodleLine(pt1, pt2));
}
const DoodleLines& GetLines() const { return m_lines; }
private:
DoodleLines m_lines;
};
typedef wxVector<DoodleSegment> DoodleSegments;
// The drawing document (model) class itself
class DrawingDocument : public wxDocument
{
DECLARE_DYNAMIC_CLASS(DrawingDocument)
private:
public:
wxList m_doodleSegments;
DrawingDocument() : wxDocument() { }
DrawingDocument() : wxDocument() {}
virtual ~DrawingDocument();
DocumentOstream& SaveObject(DocumentOstream& stream);
DocumentIstream& LoadObject(DocumentIstream& stream);
#if wxUSE_STD_IOSTREAM
wxSTD ostream& SaveObject(wxSTD ostream& text_stream);
wxSTD istream& LoadObject(wxSTD istream& text_stream);
#else
wxOutputStream& SaveObject(wxOutputStream& stream);
wxInputStream& LoadObject(wxInputStream& stream);
#endif
// add a new segment to the document
void AddDoodleSegment(const DoodleSegment& segment);
inline wxList& GetDoodleSegments() const { return (wxList&) m_doodleSegments; };
// remove the last segment, if any, and copy it in the provided pointer if
// not NULL and return true or return false and do nothing if there are no
// segments
bool PopLastSegment(DoodleSegment *segment);
// get direct access to our segments (for DrawingView)
const DoodleSegments& GetSegments() const { return m_doodleSegments; }
private:
void DoUpdate();
DoodleSegments m_doodleSegments;
DECLARE_DYNAMIC_CLASS(DrawingDocument)
};
#define DOODLE_CUT 1
#define DOODLE_ADD 2
// ----------------------------------------------------------------------------
// Some operations (which can be done and undone by the view) on the document:
// ----------------------------------------------------------------------------
// Base class for all operations on DrawingDocument
class DrawingCommand : public wxCommand
{
protected:
DoodleSegment* m_segment;
DrawingDocument* m_doc;
int m_cmd;
public:
DrawingCommand(const wxString& name, int cmd, DrawingDocument*, DoodleSegment*);
virtual ~DrawingCommand();
DrawingCommand(DrawingDocument *doc,
const wxString& name,
const DoodleSegment& segment = DoodleSegment())
: wxCommand(true, name),
m_doc(doc),
m_segment(segment)
{
}
bool Do(void);
bool Undo(void);
protected:
bool DoAdd() { m_doc->AddDoodleSegment(m_segment); return true; }
bool DoRemove() { return m_doc->PopLastSegment(&m_segment); }
private:
DrawingDocument * const m_doc;
DoodleSegment m_segment;
};
// The command for adding a new segment
class DrawingAddSegmentCommand : public DrawingCommand
{
public:
DrawingAddSegmentCommand(DrawingDocument *doc, const DoodleSegment& segment)
: DrawingCommand(doc, "Add new segment", segment)
{
}
virtual bool Do() { return DoAdd(); }
virtual bool Undo() { return DoRemove(); }
};
// The command for removing the last segment
class DrawingRemoveSegmentCommand : public DrawingCommand
{
public:
DrawingRemoveSegmentCommand(DrawingDocument *doc)
: DrawingCommand(doc, "Remove last segment")
{
}
virtual bool Do() { return DoRemove(); }
virtual bool Undo() { return DoAdd(); }
};
// ----------------------------------------------------------------------------
// A simple text document class
// ----------------------------------------------------------------------------
class TextEditView;
class TextEditDocument : public wxDocument
{
DECLARE_DYNAMIC_CLASS(TextEditDocument)
public:
TextEditDocument() : wxDocument() {}
virtual ~TextEditDocument() {}
/*
wxSTD ostream& SaveObject(wxSTD ostream&);
wxSTD istream& LoadObject(wxSTD istream&);
*/
TextEditView* GetFirstView() const;
TextEditDocument() : wxDocument() { }
TextEditView *GetFirstView() const;
virtual bool DoSaveDocument(const wxString& filename);
virtual bool DoOpenDocument(const wxString& filename);
virtual bool IsModified(void) const;
virtual bool IsModified() const;
virtual void Modify(bool mod);
DECLARE_NO_COPY_CLASS(TextEditDocument)
DECLARE_DYNAMIC_CLASS(TextEditDocument)
};
#endif
#endif // _WX_SAMPLES_DOCVIEW_DOC_H_

43
samples/docview/doc.xpm Normal file
View File

@@ -0,0 +1,43 @@
/* XPM */
static char *doc[] = {
/* columns rows colors chars-per-pixel */
"32 32 5 1",
" c black",
". c #808080",
"X c #C0C0C0",
"o c gray100",
"O c None",
/* pixels */
"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
"OOOOOOOOOXXXXXXXXXXXXXXXXXXXOOOO",
"OOOOOOOOOXoooooooooooooooooX.OOO",
"OOOOOOOOOXoooooooooooooooooX.OOO",
"OOOOOOXXXXXXXXXXXXXXXXXXXooX.OOO",
"OOOOOOXoooooooooooooooooXooX.OOO",
"OOOOOOXoooooooooooooooooXooX.OOO",
"OOOXXXXXXXXXXXXXXXXXXXooXooX.OOO",
"OOOXoooooooooooooooooXooXooX.OOO",
"OOOXoooooooooooooooooXooXooX.OOO",
"OOOXoo .. . ooXooXooX.OOO",
"OOOXoooooooooooooooooXooXooX.OOO",
"OOOXoooooooooooooooooXooXooX.OOO",
"OOOXoo oooooooooXooXooX.OOO",
"OOOXoooooooooooooooooXooXooX.OOO",
"OOOXoooooooooooooooooXooXooX.OOO",
"OOOXoo . ooooXooXooX.OOO",
"OOOXoooooooooooooooooXooXooX.OOO",
"OOOXoooooooooooooooooXooXooX.OOO",
"OOOXoo . oooooXooXooX.OOO",
"OOOXoooooooooooooooooXooXooX.OOO",
"OOOXoooooooooooooooooXooXooX.OOO",
"OOOXoo . . ooXooXooX.OOO",
"OOOXoooooooooooooooooXooXXXX.OOO",
"OOOXoooooooooooooooooXooX....OOO",
"OOOXoo . . oXooX.OOOOOO",
"OOOXoooooooooooooooooXXXX.OOOOOO",
"OOOXoooooooooooooooooX....OOOOOO",
"OOOXoooooooooooooooooX.OOOOOOOOO",
"OOOXXXXXXXXXXXXXXXXXXX.OOOOOOOOO",
"OOOOO..................OOOOOOOOO",
"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"
};

View File

@@ -1,161 +1,226 @@
/////////////////////////////////////////////////////////////////////////////
// Name: docview.cpp
// Name: samples/docview/docview.cpp
// Purpose: Document/view demo
// Author: Julian Smart
// Modified by:
// Modified by: Vadim Zeitlin: merge with the MDI version and general cleanup
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Copyright: (c) 1998 Julian Smart
// (c) 2008 Vadim Zeitlin
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/*
* Purpose: Document/view architecture demo for wxWidgets class library
* Run with no arguments for multiple top-level windows, -single
* for a single window.
*/
This sample show document/view support in wxWidgets.
It can be run in several ways:
* With "--mdi" command line option to use multiple MDI child frames
for the multiple documents (this is the default).
* With "--sdi" command line option to use multiple top level windows
for the multiple documents
* With "--single" command line option to support opening a single
document only
Notice that doing it like this somewhat complicates the code, you could
make things much simpler in your own programs by using either
wxDocParentFrame or wxDocMDIParentFrame unconditionally (and never using
the single mode) instead of supporting all of them as this sample does.
*/
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/wx.h"
#include "wx/stockitem.h"
#endif
#if !wxUSE_DOC_VIEW_ARCHITECTURE
#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
#endif
#include "wx/docview.h"
#include "wx/docmdi.h"
#include "docview.h"
#include "doc.h"
#include "view.h"
#include "wx/cmdline.h"
#ifdef __WXMAC__
#include "wx/filename.h"
#include "wx/filename.h"
#endif
#include "wx/stockitem.h"
static MyFrame* frame = NULL;
#if !defined(__WXMSW__) && !defined(__WXPM__)
#include "doc.xpm"
#include "chart.xpm"
#include "notepad.xpm"
#endif
// In single window mode, don't have any child windows; use
// main window.
bool singleWindowMode = false;
// ----------------------------------------------------------------------------
// MyApp implementation
// ----------------------------------------------------------------------------
IMPLEMENT_APP(MyApp)
MyApp::MyApp(void)
BEGIN_EVENT_TABLE(MyApp, wxApp)
EVT_MENU(wxID_ABOUT, MyApp::OnAbout)
END_EVENT_TABLE()
MyApp::MyApp()
{
m_docManager = NULL;
#if wxUSE_MDI_ARCHITECTURE
m_mode = Mode_MDI;
#else
m_mode = Mode_SDI;
#endif
m_canvas = NULL;
m_menuEdit = NULL;
}
bool MyApp::OnInit(void)
// constants for the command line options names
namespace CmdLineOption
{
const char * const MDI = "mdi";
const char * const SDI = "sdi";
const char * const SINGLE = "single";
} // namespace CmdLineOption
void MyApp::OnInitCmdLine(wxCmdLineParser& parser)
{
wxApp::OnInitCmdLine(parser);
parser.AddSwitch("", CmdLineOption::MDI,
"run in MDI mode: multiple documents, single window");
parser.AddSwitch("", CmdLineOption::SDI,
"run in SDI mode: multiple documents, multiple windows");
parser.AddSwitch("", CmdLineOption::SINGLE,
"run in single document mode");
}
bool MyApp::OnCmdLineParsed(wxCmdLineParser& parser)
{
int numModeOptions = 0;
#if wxUSE_MDI_ARCHITECTURE
if ( parser.Found(CmdLineOption::MDI) )
{
m_mode = Mode_MDI;
numModeOptions++;
}
#endif // wxUSE_MDI_ARCHITECTURE
if ( parser.Found(CmdLineOption::SDI) )
{
m_mode = Mode_SDI;
numModeOptions++;
}
if ( parser.Found(CmdLineOption::SINGLE) )
{
m_mode = Mode_Single;
numModeOptions++;
}
if ( numModeOptions > 1 )
{
wxLogError("Only a single option choosing the mode can be given.");
return false;
}
return wxApp::OnCmdLineParsed(parser);
}
bool MyApp::OnInit()
{
if ( !wxApp::OnInit() )
return false;
SetAppName(wxT("DocView Demo"));
//// Find out if we're:
//// multiple window: multiple windows, each view in a separate frame
//// single window: one view (within the main frame) and one document at a time, as in Windows Write.
//// In single window mode, we only allow one document type
if (argc > 1)
{
if (wxStrcmp(argv[1], wxT("-single")) == 0)
{
singleWindowMode = true;
}
}
SetAppName("DocView Sample");
//// Create a document manager
m_docManager = new wxDocManager;
wxDocManager *docManager = new wxDocManager;
//// Create a template relating drawing documents to their views
new wxDocTemplate(m_docManager, wxT("Drawing"), wxT("*.drw"), wxT(""), wxT("drw"), wxT("Drawing Doc"), wxT("Drawing View"),
CLASSINFO(DrawingDocument), CLASSINFO(DrawingView));
new wxDocTemplate(docManager, "Drawing", "*.drw", "", "drw",
"Drawing Doc", "Drawing View",
CLASSINFO(DrawingDocument), CLASSINFO(DrawingView));
#ifdef __WXMAC__
wxFileName::MacRegisterDefaultTypeAndCreator( wxT("drw") , 'WXMB' , 'WXMA' ) ;
wxFileName::MacRegisterDefaultTypeAndCreator("drw" , 'WXMB' , 'WXMA');
#endif
if (singleWindowMode)
if ( m_mode == Mode_Single )
{
// If we've only got one window, we only get to edit
// one document at a time. Therefore no text editing, just
// doodling.
m_docManager->SetMaxDocsOpen(1);
// If we've only got one window, we only get to edit one document at a
// time. Therefore no text editing, just doodling.
docManager->SetMaxDocsOpen(1);
}
else // multiple documents mode: allow documents of different types
{
// Create a template relating text documents to their views
new wxDocTemplate(docManager, "Text", "*.txt;*.text", "", "txt;text",
"Text Doc", "Text View",
CLASSINFO(TextEditDocument), CLASSINFO(TextEditView));
#ifdef __WXMAC__
wxFileName::MacRegisterDefaultTypeAndCreator("txt" , 'TEXT' , 'WXMA');
#endif
}
// create the main frame window
wxFrame *frame;
#if wxUSE_MDI_ARCHITECTURE
if ( m_mode == Mode_MDI )
{
frame = new wxDocMDIParentFrame(docManager, NULL, wxID_ANY,
GetAppDisplayName(),
wxDefaultPosition,
wxSize(500, 400));
}
else
#endif // wxUSE_MDI_ARCHITECTURE
{
//// Create a template relating text documents to their views
new wxDocTemplate(m_docManager, wxT("Text"), wxT("*.txt;*.text"), wxT(""), wxT("txt;text"), wxT("Text Doc"), wxT("Text View"),
CLASSINFO(TextEditDocument), CLASSINFO(TextEditView));
#ifdef __WXMAC__
wxFileName::MacRegisterDefaultTypeAndCreator( wxT("txt") , 'TEXT' , 'WXMA' ) ;
#endif
frame = new wxDocParentFrame(docManager, NULL, wxID_ANY,
GetAppDisplayName(),
wxDefaultPosition,
wxSize(500, 400));
}
//// Create the main frame window
frame = new MyFrame(m_docManager, NULL, wxID_ANY, GetAppDisplayName(), wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE);
// and its menu bar
wxMenu *menuFile = new wxMenu;
//// Give it an icon (this is ignored in MDI mode: uses resources)
#ifdef __WXMSW__
frame->SetIcon(wxIcon(wxT("doc_icn")));
#endif
menuFile->Append(wxID_NEW);
menuFile->Append(wxID_OPEN);
//// Make a menubar
wxMenu *file_menu = new wxMenu;
wxMenu *edit_menu = NULL;
if ( m_mode == Mode_Single )
AppendDocumentFileCommands(menuFile, true);
file_menu->Append(wxID_NEW);
file_menu->Append(wxID_OPEN);
if (singleWindowMode)
{
file_menu->Append(wxID_CLOSE);
file_menu->Append(wxID_SAVE);
file_menu->Append(wxID_SAVEAS);
file_menu->AppendSeparator();
file_menu->Append(wxID_PRINT);
file_menu->Append(wxID_PRINT_SETUP, wxT("Print &Setup..."));
file_menu->Append(wxID_PREVIEW);
edit_menu = new wxMenu;
edit_menu->Append(wxID_UNDO);
edit_menu->Append(wxID_REDO);
edit_menu->AppendSeparator();
edit_menu->Append(DOCVIEW_CUT, wxT("&Cut last segment"));
frame->m_editMenu = edit_menu;
}
file_menu->AppendSeparator();
file_menu->Append(wxID_EXIT);
menuFile->AppendSeparator();
menuFile->Append(wxID_EXIT);
// A nice touch: a history of files visited. Use this menu.
m_docManager->FileHistoryUseMenu(file_menu);
docManager->FileHistoryUseMenu(menuFile);
wxMenu *help_menu = new wxMenu;
help_menu->Append(DOCVIEW_ABOUT);
if ( m_mode == Mode_Single )
{
m_canvas = new MyCanvas(NULL, frame);
m_menuEdit = CreateDrawingEditMenu();
}
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, wxGetStockLabel(wxID_FILE));
if (edit_menu)
menu_bar->Append(edit_menu, wxGetStockLabel(wxID_EDIT));
menu_bar->Append(help_menu, wxGetStockLabel(wxID_HELP));
if (singleWindowMode)
frame->m_canvas = frame->CreateCanvas(NULL, frame);
//// Associate the menu bar with the frame
frame->SetMenuBar(menu_bar);
CreateMenuBarForFrame(frame, menuFile, m_menuEdit);
frame->SetIcon(wxICON(doc));
frame->Centre(wxBOTH);
frame->Show(true);
@@ -163,131 +228,153 @@ bool MyApp::OnInit(void)
return true;
}
int MyApp::OnExit(void)
int MyApp::OnExit()
{
delete m_docManager;
return 0;
delete wxDocManager::GetDocumentManager();
return wxApp::OnExit();
}
/*
* Centralised code for creating a document frame.
* Called from view.cpp, when a view is created, but not used at all
* in 'single window' mode.
*/
void MyApp::AppendDocumentFileCommands(wxMenu *menu, bool supportsPrinting)
{
menu->Append(wxID_CLOSE);
menu->Append(wxID_SAVE);
menu->Append(wxID_SAVEAS);
if ( supportsPrinting )
{
menu->AppendSeparator();
menu->Append(wxID_PRINT);
menu->Append(wxID_PRINT_SETUP, "Print &Setup...");
menu->Append(wxID_PREVIEW);
}
}
wxMenu *MyApp::CreateDrawingEditMenu()
{
wxMenu * const menu = new wxMenu;
menu->Append(wxID_UNDO);
menu->Append(wxID_REDO);
menu->AppendSeparator();
menu->Append(wxID_CUT, "&Cut last segment");
return menu;
}
void MyApp::CreateMenuBarForFrame(wxFrame *frame, wxMenu *file, wxMenu *edit)
{
wxMenuBar *menubar = new wxMenuBar;
menubar->Append(file, wxGetStockLabel(wxID_FILE));
if ( edit )
menubar->Append(edit, wxGetStockLabel(wxID_EDIT));
wxMenu *help= new wxMenu;
help->Append(wxID_ABOUT);
menubar->Append(help, wxGetStockLabel(wxID_HELP));
frame->SetMenuBar(menubar);
}
wxFrame *MyApp::CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas)
{
//// Make a child frame
wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, GetMainFrame(), wxID_ANY, wxT("Child Frame"),
wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE);
#ifdef __WXMSW__
subframe->SetIcon(wxString(isCanvas ? wxT("chrt_icn") : wxT("notepad_icn")));
#endif
//// Make a menubar
wxMenu *file_menu = new wxMenu;
file_menu->Append(wxID_NEW);
file_menu->Append(wxID_OPEN);
file_menu->Append(wxID_CLOSE);
file_menu->Append(wxID_SAVE);
file_menu->Append(wxID_SAVEAS);
if (isCanvas)
// create a child frame of appropriate class for the current mode
wxFrame *subframe;
#if wxUSE_MDI_ARCHITECTURE
if ( GetMode() == Mode_MDI )
{
file_menu->AppendSeparator();
file_menu->Append(wxID_PRINT);
file_menu->Append(wxID_PRINT_SETUP, wxT("Print &Setup..."));
file_menu->Append(wxID_PREVIEW);
}
wxMenu *edit_menu = new wxMenu;
if (isCanvas)
{
edit_menu->Append(wxID_UNDO);
edit_menu->Append(wxID_REDO);
edit_menu->AppendSeparator();
edit_menu->Append(DOCVIEW_CUT, wxT("&Cut last segment"));
doc->GetCommandProcessor()->SetEditMenu(edit_menu);
subframe = new wxDocMDIChildFrame
(
doc,
view,
wxStaticCast(GetTopWindow(), wxDocMDIParentFrame),
wxID_ANY,
"Child Frame",
wxDefaultPosition,
wxSize(300, 300)
);
}
else
#endif // wxUSE_MDI_ARCHITECTURE
{
edit_menu->Append(wxID_COPY);
edit_menu->Append(wxID_PASTE);
edit_menu->Append(wxID_SELECTALL);
subframe = new wxDocChildFrame
(
doc,
view,
wxStaticCast(GetTopWindow(), wxDocParentFrame),
wxID_ANY,
"Child Frame",
wxDefaultPosition,
wxSize(300, 300)
);
subframe->Centre(wxBOTH);
}
wxMenu *help_menu = new wxMenu;
help_menu->Append(DOCVIEW_ABOUT);
wxMenu *menuFile = new wxMenu;
wxMenuBar *menu_bar = new wxMenuBar;
menuFile->Append(wxID_NEW);
menuFile->Append(wxID_OPEN);
AppendDocumentFileCommands(menuFile, isCanvas);
menuFile->AppendSeparator();
menuFile->Append(wxID_EXIT);
menu_bar->Append(file_menu, wxGetStockLabel(wxID_FILE));
menu_bar->Append(edit_menu, wxGetStockLabel(wxID_EDIT));
menu_bar->Append(help_menu, wxGetStockLabel(wxID_HELP));
wxMenu *menuEdit;
if ( isCanvas )
{
menuEdit = CreateDrawingEditMenu();
//// Associate the menu bar with the frame
subframe->SetMenuBar(menu_bar);
doc->GetCommandProcessor()->SetEditMenu(menuEdit);
doc->GetCommandProcessor()->Initialize();
}
else // text frame
{
menuEdit = new wxMenu;
menuEdit->Append(wxID_COPY);
menuEdit->Append(wxID_PASTE);
menuEdit->Append(wxID_SELECTALL);
}
subframe->Centre(wxBOTH);
CreateMenuBarForFrame(subframe, menuFile, menuEdit);
subframe->SetIcon(isCanvas ? wxICON(chrt) : wxICON(notepad));
return subframe;
}
/*
* This is the top-level window of the application.
*/
IMPLEMENT_CLASS(MyFrame, wxDocParentFrame)
BEGIN_EVENT_TABLE(MyFrame, wxDocParentFrame)
EVT_MENU(DOCVIEW_ABOUT, MyFrame::OnAbout)
END_EVENT_TABLE()
MyFrame::MyFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size, const long type):
wxDocParentFrame(manager, frame, id, title, pos, size, type)
void MyApp::OnAbout(wxCommandEvent& WXUNUSED(event))
{
// This pointer only needed if in single window mode
m_canvas = NULL;
m_editMenu = NULL;
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event) )
{
wxMessageBox(wxT("DocView Demo\nAuthor: Julian Smart\nUsage: docview.exe [-single]"), wxT("About DocView"));
/*
Better, but brings in adv lib
wxAboutDialogInfo info;
info.SetName(wxTheApp->GetAppDisplayName());
info.AddDeveloper(wxT("Julian Smart"));
wxAboutBox(info);
*/
}
// Creates a canvas. Called either from view.cc when a new drawing
// view is created, or in OnInit as a child of the main window,
// if in 'single window' mode.
MyCanvas *MyFrame::CreateCanvas(DrawingView* view, wxFrame *parent)
{
wxSize size = parent->GetClientSize();
// Non-retained canvas
MyCanvas* canvas = new MyCanvas(view, parent, wxPoint(0, 0), size, 0);
canvas->SetCursor(wxCursor(wxCURSOR_PENCIL));
// Give it scrollbars
canvas->SetScrollbars(20, 20, 50, 50);
canvas->SetBackgroundColour(*wxWHITE);
canvas->ClearBackground();
return canvas;
}
MyFrame *GetMainFrame(void)
{
return frame;
wxString modeName;
switch ( m_mode )
{
#if wxUSE_MDI_ARCHITECTURE
case Mode_MDI:
modeName = "MDI";
break;
#endif // wxUSE_MDI_ARCHITECTURE
case Mode_SDI:
modeName = "SDI";
break;
case Mode_Single:
modeName = "single document";
break;
default:
wxFAIL_MSG( "unknown mode ");
}
wxLogMessage
(
"This is the wxWidgets Document/View Sample\n"
"running in %s mode.\n"
"\n"
"Authors: Julian Smart, Vadim Zeitlin\n"
"\n"
"Usage: docview [--{mdi,sdi,single}]",
modeName
);
}

View File

@@ -1,64 +1,88 @@
/////////////////////////////////////////////////////////////////////////////
// Name: docview.h
// Name: samples/docview/docview.h
// Purpose: Document/view demo
// Author: Julian Smart
// Modified by:
// Modified by: Vadim Zeitlin: merge with the MDI version and general cleanup
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Copyright: (c) 1998 Julian Smart
// (c) 2008 Vadim Zeitlin
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __DOCVIEW_H__
#define __DOCVIEW_H__
#ifndef _WX_SAMPLES_DOCVIEW_DOCVIEW_H_
#define _WX_SAMPLES_DOCVIEW_DOCVIEW_H_
#include "wx/docview.h"
class wxDocManager;
class MyFrame;
class MyCanvas;
class DrawingView;
// Define a new application
class MyApp : public wxApp
{
public:
MyApp(void);
bool OnInit(void);
int OnExit(void);
// this sample can be launched in several different ways:
enum Mode
{
#if wxUSE_MDI_ARCHITECTURE
Mode_MDI, // MDI mode: multiple documents, single top level window
#endif // wxUSE_MDI_ARCHITECTURE
Mode_SDI, // SDI mode: multiple documents, multiple top level windows
Mode_Single // single document mode (and hence single top level window)
};
MyApp();
// override some wxApp virtual methods
virtual bool OnInit();
virtual int OnExit();
virtual void OnInitCmdLine(wxCmdLineParser& parser);
virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
// our specific methods
Mode GetMode() const { return m_mode; }
wxFrame *CreateChildFrame(wxDocument *doc, wxView *view, bool isCanvas);
protected:
wxDocManager* m_docManager;
// these accessors should only be called in single document mode, otherwise
// the pointers are NULL and an assert is triggered
MyCanvas *GetMainWindowCanvas() const
{ wxASSERT(m_canvas); return m_canvas; }
wxMenu *GetMainWindowEditMenu() const
{ wxASSERT(m_menuEdit); return m_menuEdit; }
private:
// append the standard document-oriented menu commands to this menu
void AppendDocumentFileCommands(wxMenu *menu, bool supportsPrinting);
// create the edit menu for drawing documents
wxMenu *CreateDrawingEditMenu();
// create and associate with the given frame the menu bar containing the
// given file and edit (possibly NULL) menus as well as the standard help
// one
void CreateMenuBarForFrame(wxFrame *frame, wxMenu *file, wxMenu *edit);
// show the about box: as we can have different frames it's more
// convenient, even if somewhat less usual, to handle this in the
// application object itself
void OnAbout(wxCommandEvent& event);
// the currently used mode
Mode m_mode;
// only used if m_mode == Mode_Single
MyCanvas *m_canvas;
wxMenu *m_menuEdit;
DECLARE_EVENT_TABLE()
DECLARE_NO_COPY_CLASS(MyApp)
};
DECLARE_APP(MyApp)
// Define a new frame
class MyCanvas;
class DrawingView;
class MyFrame : public wxDocParentFrame
{
DECLARE_CLASS(MyFrame)
public:
wxMenu* m_editMenu;
// This pointer only needed if in single window mode
MyCanvas* m_canvas;
MyFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size,
const long type);
MyCanvas* CreateCanvas(DrawingView*, wxFrame *parent);
protected:
void OnAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
extern MyFrame *GetMainFrame();
#define DOCVIEW_CUT 1
#define DOCVIEW_ABOUT wxID_ABOUT
extern bool singleWindowMode;
#endif
#endif // _WX_SAMPLES_DOCVIEW_DOCVIEW_H_

View File

@@ -1,5 +1,6 @@
doc_icn ICON "doc.ico"
chrt_icn ICON "chart.ico"
notepad_icn ICON "notepad.ico"
#include "wx/msw/wx.rc"
doc ICON "doc.ico"
chrt ICON "chart.ico"
notepad ICON "notepad.ico"

View File

@@ -1,11 +1,4 @@
<?xml version="1.0" ?>
<!--
This makefile was generated by
Bakefile 0.2.3 (http://www.bakefile.org)
Do not modify, all changes will be overwritten!
-->
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
@@ -22,74 +15,64 @@
IntermediateDirectory="vc_mswunivudll\docview"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCIDLTool"/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions=""
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswunivu;.\..\..\include;.;.\..\..\samples"
MinimalRebuild="false"
ExceptionHandling="1"
AdditionalOptions=""
RuntimeLibrary="2"
PreprocessorDefinitions="__WXMSW__;__WXUNIVERSAL__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"
MinimalRebuild="FALSE"
ExceptionHandling="TRUE"
BasicRuntimeChecks="3"
DebugInformationFormat="3"
Detect64BitPortabilityProblems="true"
RuntimeTypeInfo="true"
RuntimeLibrary="2"
RuntimeTypeInfo="TRUE"
AssemblerListingLocation="vc_mswunivudll\docview\"
ObjectFile="vc_mswunivudll\docview\"
ProgramDataBaseFileName="vc_mswunivudll\docview.pdb"
WarningLevel="4"
SuppressStartupBanner="true"/>
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
Name="VCCustomBuildTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswunivu;.\..\..\include;.;.\..\..\samples"
PreprocessorDefinitions="__WXMSW__;__WXUNIVERSAL__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"/>
Name="VCLinkerTool"
AdditionalOptions=""
AdditionalDependencies="wxmswuniv29u_core.lib wxbase29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
OutputFile="vc_mswunivudll\docview.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=".\..\..\lib\vc_dll"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="vc_mswunivudll\docview.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wxmswuniv29u_core.lib wxbase29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
AdditionalOptions=""
OutputFile="vc_mswunivudll\docview.exe"
LinkIncremental="2"
SubSystem="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=".\..\..\lib\vc_dll"
GenerateDebugInformation="true"
ProgramDatabaseFile="vc_mswunivudll\docview.pdb"
TargetMachine="1"/>
Name="VCResourceCompilerTool"
PreprocessorDefinitions="__WXMSW__;__WXUNIVERSAL__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswunivu;.\..\..\include;.;.\..\..\samples"/>
<Tool
Name="VCALinkTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"
OutputFile="vc_mswunivudll\docview_vc7.bsc"
SuppressStartupBanner="true"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCPostBuildEventTool"/>
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="DLL Universal Debug|Win32"
@@ -97,74 +80,64 @@
IntermediateDirectory="vc_mswunivuddll\docview"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCIDLTool"/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions=""
Optimization="0"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswunivud;.\..\..\include;.;.\..\..\samples"
MinimalRebuild="true"
ExceptionHandling="1"
AdditionalOptions=""
RuntimeLibrary="3"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXUNIVERSAL__;__WXDEBUG__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"
MinimalRebuild="TRUE"
ExceptionHandling="TRUE"
BasicRuntimeChecks="3"
DebugInformationFormat="3"
Detect64BitPortabilityProblems="true"
RuntimeTypeInfo="true"
RuntimeLibrary="3"
RuntimeTypeInfo="TRUE"
AssemblerListingLocation="vc_mswunivuddll\docview\"
ObjectFile="vc_mswunivuddll\docview\"
ProgramDataBaseFileName="vc_mswunivuddll\docview.pdb"
WarningLevel="4"
SuppressStartupBanner="true"/>
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
Name="VCCustomBuildTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswunivud;.\..\..\include;.;.\..\..\samples"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXUNIVERSAL__;__WXDEBUG__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"/>
Name="VCLinkerTool"
AdditionalOptions=""
AdditionalDependencies="wxmswuniv29ud_core.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
OutputFile="vc_mswunivuddll\docview.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=".\..\..\lib\vc_dll"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="vc_mswunivuddll\docview.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wxmswuniv29ud_core.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
AdditionalOptions=""
OutputFile="vc_mswunivuddll\docview.exe"
LinkIncremental="2"
SubSystem="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=".\..\..\lib\vc_dll"
GenerateDebugInformation="true"
ProgramDatabaseFile="vc_mswunivuddll\docview.pdb"
TargetMachine="1"/>
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXUNIVERSAL__;__WXDEBUG__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswunivud;.\..\..\include;.;.\..\..\samples"/>
<Tool
Name="VCALinkTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"
OutputFile="vc_mswunivuddll\docview_vc7.bsc"
SuppressStartupBanner="true"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCPostBuildEventTool"/>
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="DLL Release|Win32"
@@ -172,74 +145,64 @@
IntermediateDirectory="vc_mswudll\docview"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCIDLTool"/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions=""
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswu;.\..\..\include;.;.\..\..\samples"
MinimalRebuild="false"
ExceptionHandling="1"
AdditionalOptions=""
RuntimeLibrary="2"
PreprocessorDefinitions="__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"
MinimalRebuild="FALSE"
ExceptionHandling="TRUE"
BasicRuntimeChecks="3"
DebugInformationFormat="3"
Detect64BitPortabilityProblems="true"
RuntimeTypeInfo="true"
RuntimeLibrary="2"
RuntimeTypeInfo="TRUE"
AssemblerListingLocation="vc_mswudll\docview\"
ObjectFile="vc_mswudll\docview\"
ProgramDataBaseFileName="vc_mswudll\docview.pdb"
WarningLevel="4"
SuppressStartupBanner="true"/>
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
Name="VCCustomBuildTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswu;.\..\..\include;.;.\..\..\samples"
PreprocessorDefinitions="__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"/>
Name="VCLinkerTool"
AdditionalOptions=""
AdditionalDependencies="wxmsw29u_core.lib wxbase29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
OutputFile="vc_mswudll\docview.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=".\..\..\lib\vc_dll"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="vc_mswudll\docview.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wxmsw29u_core.lib wxbase29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
AdditionalOptions=""
OutputFile="vc_mswudll\docview.exe"
LinkIncremental="2"
SubSystem="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=".\..\..\lib\vc_dll"
GenerateDebugInformation="true"
ProgramDatabaseFile="vc_mswudll\docview.pdb"
TargetMachine="1"/>
Name="VCResourceCompilerTool"
PreprocessorDefinitions="__WXMSW__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswu;.\..\..\include;.;.\..\..\samples"/>
<Tool
Name="VCALinkTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"
OutputFile="vc_mswudll\docview_vc7.bsc"
SuppressStartupBanner="true"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCPostBuildEventTool"/>
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="DLL Debug|Win32"
@@ -247,74 +210,64 @@
IntermediateDirectory="vc_mswuddll\docview"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCIDLTool"/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions=""
Optimization="0"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswud;.\..\..\include;.;.\..\..\samples"
MinimalRebuild="true"
ExceptionHandling="1"
AdditionalOptions=""
RuntimeLibrary="3"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXDEBUG__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"
MinimalRebuild="TRUE"
ExceptionHandling="TRUE"
BasicRuntimeChecks="3"
DebugInformationFormat="3"
Detect64BitPortabilityProblems="true"
RuntimeTypeInfo="true"
RuntimeLibrary="3"
RuntimeTypeInfo="TRUE"
AssemblerListingLocation="vc_mswuddll\docview\"
ObjectFile="vc_mswuddll\docview\"
ProgramDataBaseFileName="vc_mswuddll\docview.pdb"
WarningLevel="4"
SuppressStartupBanner="true"/>
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
Name="VCCustomBuildTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswud;.\..\..\include;.;.\..\..\samples"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXDEBUG__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"/>
Name="VCLinkerTool"
AdditionalOptions=""
AdditionalDependencies="wxmsw29ud_core.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
OutputFile="vc_mswuddll\docview.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=".\..\..\lib\vc_dll"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="vc_mswuddll\docview.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wxmsw29ud_core.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
AdditionalOptions=""
OutputFile="vc_mswuddll\docview.exe"
LinkIncremental="2"
SubSystem="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=".\..\..\lib\vc_dll"
GenerateDebugInformation="true"
ProgramDatabaseFile="vc_mswuddll\docview.pdb"
TargetMachine="1"/>
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXDEBUG__;_UNICODE;WXUSINGDLL;_WINDOWS;NOPCH"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_dll\mswud;.\..\..\include;.;.\..\..\samples"/>
<Tool
Name="VCALinkTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"
OutputFile="vc_mswuddll\docview_vc7.bsc"
SuppressStartupBanner="true"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCPostBuildEventTool"/>
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Universal Release|Win32"
@@ -322,74 +275,64 @@
IntermediateDirectory="vc_mswunivu\docview"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCIDLTool"/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions=""
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswunivu;.\..\..\include;.;.\..\..\samples"
MinimalRebuild="false"
ExceptionHandling="1"
AdditionalOptions=""
RuntimeLibrary="2"
PreprocessorDefinitions="__WXMSW__;__WXUNIVERSAL__;_UNICODE;_WINDOWS;NOPCH"
MinimalRebuild="FALSE"
ExceptionHandling="TRUE"
BasicRuntimeChecks="3"
DebugInformationFormat="3"
Detect64BitPortabilityProblems="true"
RuntimeTypeInfo="true"
RuntimeLibrary="2"
RuntimeTypeInfo="TRUE"
AssemblerListingLocation="vc_mswunivu\docview\"
ObjectFile="vc_mswunivu\docview\"
ProgramDataBaseFileName="vc_mswunivu\docview.pdb"
WarningLevel="4"
SuppressStartupBanner="true"/>
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
Name="VCCustomBuildTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswunivu;.\..\..\include;.;.\..\..\samples"
PreprocessorDefinitions="__WXMSW__;__WXUNIVERSAL__;_UNICODE;_WINDOWS;NOPCH"/>
Name="VCLinkerTool"
AdditionalOptions=""
AdditionalDependencies="wxmswuniv29u_core.lib wxbase29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
OutputFile="vc_mswunivu\docview.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=".\..\..\lib\vc_lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="vc_mswunivu\docview.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wxmswuniv29u_core.lib wxbase29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
AdditionalOptions=""
OutputFile="vc_mswunivu\docview.exe"
LinkIncremental="2"
SubSystem="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=".\..\..\lib\vc_lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="vc_mswunivu\docview.pdb"
TargetMachine="1"/>
Name="VCResourceCompilerTool"
PreprocessorDefinitions="__WXMSW__;__WXUNIVERSAL__;_UNICODE;_WINDOWS;NOPCH"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswunivu;.\..\..\include;.;.\..\..\samples"/>
<Tool
Name="VCALinkTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"
OutputFile="vc_mswunivu\docview_vc7.bsc"
SuppressStartupBanner="true"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCPostBuildEventTool"/>
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Universal Debug|Win32"
@@ -397,74 +340,64 @@
IntermediateDirectory="vc_mswunivud\docview"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCIDLTool"/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions=""
Optimization="0"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswunivud;.\..\..\include;.;.\..\..\samples"
MinimalRebuild="true"
ExceptionHandling="1"
AdditionalOptions=""
RuntimeLibrary="3"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXUNIVERSAL__;__WXDEBUG__;_UNICODE;_WINDOWS;NOPCH"
MinimalRebuild="TRUE"
ExceptionHandling="TRUE"
BasicRuntimeChecks="3"
DebugInformationFormat="3"
Detect64BitPortabilityProblems="true"
RuntimeTypeInfo="true"
RuntimeLibrary="3"
RuntimeTypeInfo="TRUE"
AssemblerListingLocation="vc_mswunivud\docview\"
ObjectFile="vc_mswunivud\docview\"
ProgramDataBaseFileName="vc_mswunivud\docview.pdb"
WarningLevel="4"
SuppressStartupBanner="true"/>
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
Name="VCCustomBuildTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswunivud;.\..\..\include;.;.\..\..\samples"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXUNIVERSAL__;__WXDEBUG__;_UNICODE;_WINDOWS;NOPCH"/>
Name="VCLinkerTool"
AdditionalOptions=""
AdditionalDependencies="wxmswuniv29ud_core.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
OutputFile="vc_mswunivud\docview.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=".\..\..\lib\vc_lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="vc_mswunivud\docview.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wxmswuniv29ud_core.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
AdditionalOptions=""
OutputFile="vc_mswunivud\docview.exe"
LinkIncremental="2"
SubSystem="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=".\..\..\lib\vc_lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="vc_mswunivud\docview.pdb"
TargetMachine="1"/>
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXUNIVERSAL__;__WXDEBUG__;_UNICODE;_WINDOWS;NOPCH"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswunivud;.\..\..\include;.;.\..\..\samples"/>
<Tool
Name="VCALinkTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"
OutputFile="vc_mswunivud\docview_vc7.bsc"
SuppressStartupBanner="true"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCPostBuildEventTool"/>
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
@@ -472,74 +405,64 @@
IntermediateDirectory="vc_mswu\docview"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCIDLTool"/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions=""
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswu;.\..\..\include;.;.\..\..\samples"
MinimalRebuild="false"
ExceptionHandling="1"
AdditionalOptions=""
RuntimeLibrary="2"
PreprocessorDefinitions="__WXMSW__;_UNICODE;_WINDOWS;NOPCH"
MinimalRebuild="FALSE"
ExceptionHandling="TRUE"
BasicRuntimeChecks="3"
DebugInformationFormat="3"
Detect64BitPortabilityProblems="true"
RuntimeTypeInfo="true"
RuntimeLibrary="2"
RuntimeTypeInfo="TRUE"
AssemblerListingLocation="vc_mswu\docview\"
ObjectFile="vc_mswu\docview\"
ProgramDataBaseFileName="vc_mswu\docview.pdb"
WarningLevel="4"
SuppressStartupBanner="true"/>
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
Name="VCCustomBuildTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswu;.\..\..\include;.;.\..\..\samples"
PreprocessorDefinitions="__WXMSW__;_UNICODE;_WINDOWS;NOPCH"/>
Name="VCLinkerTool"
AdditionalOptions=""
AdditionalDependencies="wxmsw29u_core.lib wxbase29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
OutputFile="vc_mswu\docview.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=".\..\..\lib\vc_lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="vc_mswu\docview.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wxmsw29u_core.lib wxbase29u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
AdditionalOptions=""
OutputFile="vc_mswu\docview.exe"
LinkIncremental="2"
SubSystem="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=".\..\..\lib\vc_lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="vc_mswu\docview.pdb"
TargetMachine="1"/>
Name="VCResourceCompilerTool"
PreprocessorDefinitions="__WXMSW__;_UNICODE;_WINDOWS;NOPCH"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswu;.\..\..\include;.;.\..\..\samples"/>
<Tool
Name="VCALinkTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"
OutputFile="vc_mswu\docview_vc7.bsc"
SuppressStartupBanner="true"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCPostBuildEventTool"/>
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
@@ -547,101 +470,91 @@
IntermediateDirectory="vc_mswud\docview"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="1">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCIDLTool"/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswud;.\..\..\include;.;.\..\..\samples"
MinimalRebuild="true"
ExceptionHandling="1"
AdditionalOptions=""
RuntimeLibrary="3"
Optimization="0"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswud;.\..\..\include;.;.\..\..\samples"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXDEBUG__;_UNICODE;_WINDOWS;NOPCH"
MinimalRebuild="TRUE"
ExceptionHandling="TRUE"
BasicRuntimeChecks="3"
DebugInformationFormat="3"
Detect64BitPortabilityProblems="true"
RuntimeTypeInfo="true"
RuntimeLibrary="3"
RuntimeTypeInfo="TRUE"
AssemblerListingLocation="vc_mswud\docview\"
ObjectFile="vc_mswud\docview\"
ProgramDataBaseFileName="vc_mswud\docview.pdb"
WarningLevel="4"
SuppressStartupBanner="true"/>
SuppressStartupBanner="TRUE"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
Name="VCCustomBuildTool"/>
<Tool
Name="VCResourceCompilerTool"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswud;.\..\..\include;.;.\..\..\samples"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXDEBUG__;_UNICODE;_WINDOWS;NOPCH"/>
Name="VCLinkerTool"
AdditionalOptions=""
AdditionalDependencies="wxmsw29ud_core.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
OutputFile="vc_mswud\docview.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=".\..\..\lib\vc_lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="vc_mswud\docview.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="wxmsw29ud_core.lib wxbase29ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib"
AdditionalOptions=""
OutputFile="vc_mswud\docview.exe"
LinkIncremental="2"
SubSystem="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories=".\..\..\lib\vc_lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="vc_mswud\docview.pdb"
TargetMachine="1"/>
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;__WXMSW__;__WXDEBUG__;_UNICODE;_WINDOWS;NOPCH"
Culture="1033"
AdditionalIncludeDirectories=".\..\..\lib\vc_lib\mswud;.\..\..\include;.;.\..\..\samples"/>
<Tool
Name="VCALinkTool"/>
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"
OutputFile="vc_mswud\docview_vc7.bsc"
SuppressStartupBanner="true"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCPostBuildEventTool"/>
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx">
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\doc.cpp"/>
RelativePath=".\doc.cpp">
</File>
<File
RelativePath=".\docview.cpp"/>
RelativePath=".\docview.cpp">
</File>
<File
RelativePath=".\view.cpp"/>
RelativePath=".\view.cpp">
</File>
</Filter>
<Filter
Name="Resource Files"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav">
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
<File
RelativePath=".\docview.rc"/>
RelativePath=".\docview.rc">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,43 @@
/* XPM */
static char *notepad[] = {
/* columns rows colors chars-per-pixel */
"32 32 5 1",
" c black",
". c #808080",
"X c #C0C0C0",
"o c gray100",
"O c None",
/* pixels */
"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
"OOOOOOOOO.OO.OO.OO.OO.OOOOOOOOOO",
"OOOOOOXXX.XX.XX.XX.XX.XXXOOOOOOO",
"OOOOOOXoo.oo.oo.oo.oo.ooXOOOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoo .. . ooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoo oooooooooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoo . ooooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoo . oooooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoo . . ooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoo . . oX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXoooooooooooooooooX.OOOOOO",
"OOOOOOXXXXXXXXXXXXXXXXXXX.OOOOOO",
"OOOOOOOO..................OOOOOO",
"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"
};

View File

@@ -1,11 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: view.cpp
// Purpose: View classes
// Name: samples/docview/view.cpp
// Purpose: View classes implementation
// Author: Julian Smart
// Modified by:
// Modified by: Vadim Zeitlin: merge with the MDI version and general cleanup
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Copyright: (c) 1998 Julian Smart
// (c) 2008 Vadim Zeitlin
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
@@ -13,56 +14,51 @@
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/wx.h"
#endif
#if !wxUSE_DOC_VIEW_ARCHITECTURE
#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in setup.h!
#endif
#include "docview.h"
#include "doc.h"
#include "view.h"
// ----------------------------------------------------------------------------
// DrawingView implementation
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(DrawingView, wxView)
// For drawing lines in a canvas
static float xpos = -1;
static float ypos = -1;
BEGIN_EVENT_TABLE(DrawingView, wxView)
EVT_MENU(DOODLE_CUT, DrawingView::OnCut)
EVT_MENU(wxID_CUT, DrawingView::OnCut)
END_EVENT_TABLE()
// What to do when a view is created. Creates actual
// windows for displaying the view.
bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
{
if (!singleWindowMode)
MyApp& app = wxGetApp();
if ( app.GetMode() != MyApp::Mode_Single )
{
// Multiple windows
m_frame = wxGetApp().CreateChildFrame(doc, this, true);
m_frame->SetTitle(wxT("DrawingView"));
// create a new window and canvas inside it
m_frame = app.CreateChildFrame(doc, this, true);
m_frame->SetTitle("Drawing View");
m_canvas = GetMainFrame()->CreateCanvas(this, m_frame);
#ifdef __X__
// X seems to require a forced resize
int x, y;
m_frame->GetSize(&x, &y);
m_frame->SetSize(wxDefaultCoord, wxDefaultCoord, x, y);
#endif
m_canvas = new MyCanvas(this, m_frame);
m_frame->Show(true);
}
else
else // single document mode
{
// Single-window mode
m_frame = GetMainFrame();
m_canvas = GetMainFrame()->m_canvas;
m_canvas->m_view = this;
// reuse the existing window and canvas
m_frame = wxStaticCast(app.GetTopWindow(), wxFrame);
m_canvas = app.GetMainWindowCanvas();
m_canvas->SetView(this);
// Associate the appropriate frame with this view.
SetFrame(m_frame);
@@ -72,26 +68,34 @@ bool DrawingView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
Activate(true);
// Initialize the edit menu Undo and Redo items
doc->GetCommandProcessor()->SetEditMenu(((MyFrame*)m_frame)->m_editMenu);
doc->GetCommandProcessor()->SetEditMenu(app.GetMainWindowEditMenu());
doc->GetCommandProcessor()->Initialize();
}
return true;
}
// Sneakily gets used for default print/preview
// as well as drawing on the screen.
// Sneakily gets used for default print/preview as well as drawing on the
// screen.
void DrawingView::OnDraw(wxDC *dc)
{
dc->SetFont(*wxNORMAL_FONT);
dc->SetPen(*wxBLACK_PEN);
wxList::compatibility_iterator node = GetDocument()->GetDoodleSegments().GetFirst();
while (node)
// simply draw all lines of all segments
const DoodleSegments& segments = GetDocument()->GetSegments();
for ( DoodleSegments::const_iterator i = segments.begin();
i != segments.end();
++i )
{
DoodleSegment *seg = (DoodleSegment *)node->GetData();
seg->Draw(dc);
node = node->GetNext();
const DoodleLines& lines = i->GetLines();
for ( DoodleLines::const_iterator j = lines.begin();
j != lines.end();
++j )
{
const DoodleLine& line = *j;
dc->DrawLine(line.x1, line.y1, line.x2, line.y2);
}
}
}
@@ -102,58 +106,50 @@ DrawingDocument* DrawingView::GetDocument()
void DrawingView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint))
{
if (m_canvas)
if ( m_canvas )
m_canvas->Refresh();
/* Is the following necessary?
#ifdef __WXMSW__
if (canvas)
canvas->Refresh();
#else
if (canvas)
{
wxClientDC dc(canvas);
dc.Clear();
OnDraw(& dc);
}
#endif
*/
}
// Clean up windows used for displaying the view.
bool DrawingView::OnClose(bool deleteWindow)
{
if (!GetDocument()->Close())
if ( !GetDocument()->Close() )
return false;
// Clear the canvas in case we're in single-window mode,
// and the canvas stays.
m_canvas->ClearBackground();
m_canvas->m_view = NULL;
m_canvas = NULL;
wxString s(wxTheApp->GetAppDisplayName());
if (m_frame)
m_frame->SetTitle(s);
SetFrame(NULL);
Activate(false);
if (deleteWindow && !singleWindowMode)
// Clear the canvas in single-window mode in which it stays alive
if ( wxGetApp().GetMode() == MyApp::Mode_Single )
{
delete m_frame;
return true;
m_canvas->ClearBackground();
m_canvas->ResetView();
m_canvas = NULL;
if ( m_frame )
m_frame->SetTitle(wxTheApp->GetAppDisplayName());
}
else // not single window mode
{
if ( deleteWindow )
wxDELETE(m_frame);
}
SetFrame(NULL);
return true;
}
void DrawingView::OnCut(wxCommandEvent& WXUNUSED(event) )
{
DrawingDocument* doc = GetDocument();
doc->GetCommandProcessor()->Submit(new DrawingCommand(wxT("Cut Last Segment"), DOODLE_CUT, doc, NULL));
DrawingDocument * const doc = GetDocument();
doc->GetCommandProcessor()->Submit(new DrawingRemoveSegmentCommand(doc));
}
// ----------------------------------------------------------------------------
// TextEditView implementation
// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(TextEditView, wxView)
BEGIN_EVENT_TABLE(TextEditView, wxView)
@@ -162,130 +158,127 @@ BEGIN_EVENT_TABLE(TextEditView, wxView)
EVT_MENU(wxID_SELECTALL, TextEditView::OnSelectAll)
END_EVENT_TABLE()
bool TextEditView::OnCreate(wxDocument *doc, long WXUNUSED(flags) )
bool TextEditView::OnCreate(wxDocument *doc, long WXUNUSED(flags))
{
m_frame = wxGetApp().CreateChildFrame(doc, this, false);
m_text = new wxTextCtrl(m_frame, wxID_ANY, "",
wxPoint(0, 0), m_frame->GetClientSize(),
wxTE_MULTILINE);
wxSize size = m_frame->GetClientSize();
m_textsw = new MyTextWindow(this, m_frame, wxPoint(0, 0), size, wxTE_MULTILINE);
m_frame->SetTitle(wxT("TextEditView"));
#ifdef __X__
// X seems to require a forced resize
int x, y;
m_frame->GetSize(&x, &y);
m_frame->SetSize(wxDefaultCoord, wxDefaultCoord, x, y);
#endif
m_frame->SetTitle("Text View");
m_frame->Show(true);
Activate(true);
return true;
}
// Handled by wxTextWindow
void TextEditView::OnDraw(wxDC *WXUNUSED(dc) )
{
}
void TextEditView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
void TextEditView::OnDraw(wxDC *WXUNUSED(dc))
{
// nothing to do here, wxTextCtrl draws itself
}
bool TextEditView::OnClose(bool deleteWindow)
{
if (!GetDocument()->Close())
if ( !GetDocument()->Close() )
return false;
Activate(false);
if (deleteWindow)
if ( wxGetApp().GetMode() == MyApp::Mode_Single )
{
wxDELETE(m_frame);
m_text->Clear();
}
else // not single window mode
{
if ( deleteWindow )
wxDELETE(m_frame);
}
return true;
}
/*
* Window implementations
*/
// ----------------------------------------------------------------------------
// MyCanvas implementation
// ----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent)
END_EVENT_TABLE()
// Define a constructor for my canvas
MyCanvas::MyCanvas(DrawingView* view, wxFrame* frame, const wxPoint& pos, const wxSize& size, const long style):
wxScrolledWindow(frame, wxID_ANY, pos, size, style)
MyCanvas::MyCanvas(wxView *view, wxWindow *parent)
: wxScrolledWindow(parent, wxID_ANY, wxPoint(0, 0), parent->GetClientSize())
{
m_view = view;
m_currentSegment = NULL;
m_lastMousePos = wxDefaultPosition;
SetCursor(wxCursor(wxCURSOR_PENCIL));
// this is completely arbitrary and is done just for illustration purposes
SetVirtualSize(1000, 1000);
SetScrollRate(20, 20);
SetBackgroundColour(*wxWHITE);
}
MyCanvas::~MyCanvas()
{
delete m_currentSegment;
}
// Define the repainting behaviour
void MyCanvas::OnDraw(wxDC& dc)
{
if (m_view)
if ( m_view )
m_view->OnDraw(& dc);
}
// This implements a tiny doodling program. Drag the mouse using
// the left button.
// This implements a tiny doodling program. Drag the mouse using the left
// button.
void MyCanvas::OnMouseEvent(wxMouseEvent& event)
{
if (!m_view)
if ( !m_view )
return;
static DoodleSegment *currentSegment = NULL;
wxClientDC dc(this);
PrepareDC(dc);
dc.SetPen(*wxBLACK_PEN);
wxPoint pt(event.GetLogicalPosition(dc));
const wxPoint pt(event.GetLogicalPosition(dc));
if (currentSegment && event.LeftUp())
// is this the end of the current segment?
if ( m_currentSegment && event.LeftUp() )
{
if (currentSegment->m_lines.GetCount() == 0)
{
delete currentSegment;
currentSegment = NULL;
}
else
if ( !m_currentSegment->IsEmpty() )
{
// We've got a valid segment on mouse left up, so store it.
DrawingDocument* doc = m_view->GetDocument();
DrawingDocument * const
doc = wxStaticCast(m_view->GetDocument(), DrawingDocument);
doc->GetCommandProcessor()->Submit(new DrawingCommand(wxT("Add Segment"), DOODLE_ADD, doc, currentSegment));
doc->GetCommandProcessor()->Submit(
new DrawingAddSegmentCommand(doc, *m_currentSegment));
m_view->GetDocument()->Modify(true);
currentSegment = NULL;
doc->Modify(true);
}
delete m_currentSegment;
m_currentSegment = NULL;
}
if ( (xpos > -1) && (ypos > -1) && event.Dragging())
// is this the start of a new segment?
if ( m_lastMousePos != wxDefaultPosition && event.Dragging() )
{
if (!currentSegment)
currentSegment = new DoodleSegment;
if ( !m_currentSegment )
m_currentSegment = new DoodleSegment;
DoodleLine *newLine = new DoodleLine;
newLine->x1 = (long)xpos;
newLine->y1 = (long)ypos;
newLine->x2 = pt.x;
newLine->y2 = pt.y;
currentSegment->m_lines.Append(newLine);
m_currentSegment->AddLine(m_lastMousePos, pt);
dc.DrawLine( (long)xpos, (long)ypos, pt.x, pt.y);
dc.DrawLine(m_lastMousePos, pt);
}
xpos = pt.x;
ypos = pt.y;
m_lastMousePos = pt;
}
// Define a constructor for my text subwindow
MyTextWindow::MyTextWindow(wxView* view, wxFrame* frame, const wxPoint& pos, const wxSize& size, const long style):
wxTextCtrl(frame, wxID_ANY, wxEmptyString, pos, size, style)
{
m_view = view;
}

View File

@@ -1,49 +1,73 @@
/////////////////////////////////////////////////////////////////////////////
// Name: view.h
// Name: samples/docview/view.h
// Purpose: View classes
// Author: Julian Smart
// Modified by:
// Modified by: Vadim Zeitlin: merge with the MDI version and general cleanup
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Copyright: (c) 1998 Julian Smart
// (c) 2008 Vadim Zeitlin
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef __VIEW_H__
#define __VIEW_H__
#ifndef _WX_SAMPLES_DOCVIEW_VIEW_H_
#define _WX_SAMPLES_DOCVIEW_VIEW_H_
#include "wx/docview.h"
class DrawingView;
// ----------------------------------------------------------------------------
// Drawing view classes
// ----------------------------------------------------------------------------
// The window showing the drawing itself
class MyCanvas : public wxScrolledWindow
{
public:
DrawingView* m_view;
// view may be NULL if we're not associated with one yet, but parent must
// be a valid pointer
MyCanvas(wxView *view, wxWindow *parent);
virtual ~MyCanvas();
MyCanvas(DrawingView*, wxFrame*, const wxPoint& pos, const wxSize& size, const long style);
virtual void OnDraw(wxDC& dc);
protected:
// in a normal multiple document application a canvas is associated with
// one view from the beginning until the end, but to support the single
// document mode in which all documents reuse the same MyApp::GetCanvas()
// we need to allow switching the canvas from one view to another one
void SetView(wxView *view)
{
wxASSERT_MSG( !m_view, "shouldn't be already associated with a view" );
m_view = view;
}
void ResetView()
{
wxASSERT_MSG( m_view, "should be associated with a view" );
m_view = NULL;
}
private:
void OnMouseEvent(wxMouseEvent& event);
wxView *m_view;
// the segment being currently drawn or NULL if none
DoodleSegment *m_currentSegment;
// the last mouse press position
wxPoint m_lastMousePos;
DECLARE_EVENT_TABLE()
};
class MyTextWindow: public wxTextCtrl
{
public:
wxView* m_view;
MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style);
};
// The view using MyCanvas to show its contents
class DrawingView : public wxView
{
public:
wxFrame* m_frame;
MyCanvas* m_canvas;
DrawingView() { m_canvas = NULL; m_frame = NULL; };
virtual ~DrawingView() {};
DrawingView() { m_canvas = NULL; m_frame = NULL; }
virtual bool OnCreate(wxDocument *doc, long flags);
virtual void OnDraw(wxDC *dc);
@@ -52,35 +76,42 @@ public:
DrawingDocument* GetDocument();
protected:
private:
void OnCut(wxCommandEvent& event);
private:
wxFrame *m_frame;
MyCanvas *m_canvas;
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(DrawingView)
};
// ----------------------------------------------------------------------------
// Text view classes
// ----------------------------------------------------------------------------
// The view using a standard wxTextCtrl to show its contents
class TextEditView : public wxView
{
public:
wxFrame* m_frame;
MyTextWindow* m_textsw;
TextEditView(): wxView() { m_frame = NULL; m_textsw = NULL; }
virtual ~TextEditView() {}
TextEditView() : wxView() { m_frame = NULL; m_text = NULL; }
virtual bool OnCreate(wxDocument *doc, long flags);
virtual void OnDraw(wxDC *dc);
virtual void OnUpdate(wxView *sender, wxObject *hint = NULL);
virtual bool OnClose(bool deleteWindow = true);
wxTextCtrl *GetText() const { return m_text; }
private:
void OnCopy(wxCommandEvent& WXUNUSED(event)) { m_textsw->Copy(); }
void OnPaste(wxCommandEvent& WXUNUSED(event)) { m_textsw->Paste(); }
void OnSelectAll(wxCommandEvent& WXUNUSED(event)) { m_textsw->SelectAll(); }
void OnCopy(wxCommandEvent& WXUNUSED(event)) { m_text->Copy(); }
void OnPaste(wxCommandEvent& WXUNUSED(event)) { m_text->Paste(); }
void OnSelectAll(wxCommandEvent& WXUNUSED(event)) { m_text->SelectAll(); }
wxFrame *m_frame;
wxTextCtrl *m_text;
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(TextEditView)
};
#endif
#endif // _WX_SAMPLES_DOCVIEW_VIEW_H_