Removed utils/ogl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6328 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2000-02-28 11:45:38 +00:00
parent 2d08140fdb
commit f9566e1007
238 changed files with 0 additions and 33868 deletions

View File

@@ -1,6 +0,0 @@
all:
cd src; make
clean:
cd src; make clean

View File

@@ -1,43 +0,0 @@
utils/ogl/src/*.cpp
utils/ogl/src/*.h
utils/ogl/src/*.rc
utils/ogl/src/*.def
utils/ogl/src/*.xbm
utils/ogl/src/*.xpm
utils/ogl/src/makefile*
utils/ogl/src/*.txt
utils/ogl/src/*.ico
utils/ogl/src/*.bmp
utils/ogl/samples/ogledit/*.cpp
utils/ogl/samples/ogledit/*.h
utils/ogl/samples/ogledit/*.rc
utils/ogl/samples/ogledit/*.def
utils/ogl/samples/ogledit/*.xbm
utils/ogl/samples/ogledit/makefile*
utils/ogl/samples/ogledit/*.txt
utils/ogl/samples/ogledit/*.ico
utils/ogl/samples/ogledit/*.bmp
utils/ogl/samples/ogledit/*.xpm
utils/ogl/samples/ogledit/bitmaps/*.bmp
utils/ogl/samples/ogledit/bitmaps/*.gif
utils/ogl/samples/ogledit/bitmaps/*.xbm
utils/ogl/samples/ogledit/bitmaps/*.xpm
utils/ogl/distrib/*.rsp
utils/ogl/distrib/*.bat
utils/ogl/docs/*.txt
utils/ogl/docs/*.tex
utils/ogl/docs/*.ini
utils/ogl/docs/*.hpj
utils/ogl/docs/*.ps
utils/ogl/docs/*.eps
utils/ogl/docs/*.bmp
utils/ogl/docs/*.gif
docs/html/ogl/*.*
docs/winhelp/ogl.hlp
docs/winhelp/ogl.cnt
docs/pdf/ogl.pdf

View File

@@ -1,48 +0,0 @@
@echo off
rem Tar up an external distribution of OGL
if "%1" == "" goto usage
if "%2" == "" goto usage
echo About to archive an external OGL distribution:
echo From %1
echo To %2\ogl.tgz
echo CTRL-C if this is not correct.
inkey /W4 `Press any key to continue...` %%input
erase %2\ogl.tgz
cd %1
rem First, expand the wildcards in the ogl.rsp file
rem Create empty list file
erase %1\distrib\ogl.lis
c:\bin\touch %1\distrib\ogl.lis
rem Create a .rsp file with backslashes instead
rem of forward slashes
rem No need if using ls2 (from UNIX95 distribution)
rem sed -e "s/\//\\/g" %1\distrib\ogl.rsp > %1\distrib\ogl.rs2
set len=%@LINES[%1\distrib\ogl.rsp]
rem set len=%@DEC[%len]
do i = 0 to %len by 1
set line=%@LINE[%1\distrib\ogl.rsp,%i]
if NOT "%line" == "" ls2 -1 %line >> %1\distrib\ogl.lis
enddo
tar -c -T %1\distrib\ogl.lis
move archive.tar ogl.tar
gzip ogl.tar
move ogl.taz %2\ogl.tgz
echo OGL archived.
goto end
:usage
echo DOS OGL distribution.
echo Usage: tarogl source destination
echo e.g. tarogl c:\wx\utils\ogl c:\wx\utils\ogl\deliver
:end

View File

@@ -1,30 +0,0 @@
@echo off
rem Zip up an external distribution of OGL
set src=d:\wx2\wxWindows
set dest=%src\utils\ogl\deliver
if "%src" == "" goto usage
if "%dest" == "" goto usage
echo About to archive an external OGL distribution:
echo From %src
echo To %dest\ogl3.zip
echo CTRL-C if this is not correct.
inkey /W4 `Press any key to continue...` %%input
erase %dest\ogl3.zip
cd %src
zip32 -@ %dest\ogl3.zip < %src\utils\ogl\distrib\ogl.rsp
cd %dest
echo OGL archived.
goto end
:usage
echo DOS OGL distribution.
echo Usage: zipogl source destination
echo e.g. zipogl d:\wx2\wxWindows d:\wx2\wxWindows\utils\ogl\deliver
:end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1,11 +0,0 @@
\chapter{Bugs}\label{bugs}%
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}
These are the known bugs.
\begin{itemize}\itemsep=0pt
\item In the OGLEdit sample, .dia files are output double-spaced
due to an unidentified bug in the way a stream is converted to a file.
\end{itemize}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 B

View File

@@ -1,19 +0,0 @@
\chapter{Change log}
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}
Version 3.0, September 8th 1998
\begin{itemize}\itemsep=0pt
\item Version for wxWindows 2.0.
\item Various enhancements especially to wxDrawnShape
(multiple metafiles, for different orientations).
\item More ability to override functions e.g. OnSizeDragLeft, so events can be
intercepted for Do/Undo.
\end{itemize}
Version 2.0, June 1st 1996
\begin{itemize}\itemsep=0pt
\item First publicly released version.
\end{itemize}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

View File

@@ -1,47 +0,0 @@
\chapter{Introduction}
\pagenumbering{arabic}%
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}
Object Graphics Library (\ogl) is a C++ library supporting the creation and
manipulation of simple and complex graphic images on a canvas.
It can be found in the directory {\tt utils/ogl/src} in the
wxWindows distribution. The file {\tt ogl.h} must be included to make use
of the library.
Please see \helpref{OGL overview}{ogloverview} for a general description how the object library works. For details,
please see the \helpref{class reference}{classref}.
\section{File structure}
These are the files that comprise the \ogl\ library.
\begin{description}\itemsep=0pt
\item[basic.h] Header for basic objects such as wxShape and wxRectangleShape.
\item[basic.cpp] Basic objects implementation (1).
\item[basic2.cpp] Basic objects implementation (2).
\item[bmpshape.h] wxBitmapShape class header.
\item[bmpshape.cpp] wxBitmapShape implementation.
\item[canvas.h] wxShapeCanvas class header.
\item[canvas.cpp] wxShapeCanvas class implementation.
\item[composit.h] Composite object class header.
\item[composit.cpp] Composite object class implementation.
\item[constrnt.h] Constraint classes header.
\item[constrnt.cpp] Constraint classes implementation.
\item[divided.h] Divided object class header.
\item[divided.cpp] Divided object class implementation.
\item[drawn.h] Drawn (metafile) object class header.
\item[drawn.cpp] Drawn (metafile) object class implementation.
\item[graphics.h] Main include file.
\item[lines.h] wxLineShape class header.
\item[lines.cpp] wxLineShape class implementation.
\item[misc.h] Miscellaneous graphics functions header.
\item[misc.cpp] Miscellaneous graphics functions implementation.
\item[ogldiag.h] wxDiagram class header.
\item[ogldiag.cpp] wxDiagram implementation.
\item[mfutils.h] Metafile utilities header.
\item[mfutils.cpp] Metafile utilities implementation.
\end{description}

View File

@@ -1,17 +0,0 @@
[OPTIONS]
BMROOT=d:\wx2\wxwind~1\utils\ogl\docs ; Assume that bitmaps are where the source is
TITLE=OGL Manual
CONTENTS=Contents
COMPRESS=HIGH
[FILES]
ogl.rtf
[CONFIG]
CreateButton("Up", "&Up", "JumpId(`ogl.hlp', `Contents')")
BrowseButtons()
[MAP]
[BITMAPS]

View File

@@ -1,46 +0,0 @@
\documentstyle[a4,makeidx,verbatim,texhelp,fancyhea,mysober,mytitle]{report}
\newcommand{\ogl}[0]{{OGL}}%
\definecolour{black}{0}{0}{0}%
\definecolour{cyan}{0}{255}{255}%
\definecolour{green}{0}{255}{0}%
\definecolour{magenta}{255}{0}{255}%
\definecolour{red}{255}{0}{0}%
\definecolour{blue}{0}{0}{200}%
\definecolour{yellow}{255}{255}{0}%
\definecolour{white}{255}{255}{255}%
\input psbox.tex
\parindent 0pt
\parskip 11pt
\title{Object Graphics Library 3.0}
\author{Julian Smart}
\date{September 1998}
\makeindex
\begin{document}
\maketitle
\pagestyle{fancyplain}
\bibliographystyle{plain}
\pagenumbering{roman}
\setheader{{\it CONTENTS}}{}{}{}{}{{\it CONTENTS}}
\setfooter{\thepage}{}{}{}{}{\thepage}
\tableofcontents%
\input{intro.tex}
%
\input{sample.tex}
%
\input{classes.tex}
%
\input{topics.tex}
%
\input{bugs.tex}
%
\input{changes.tex}
%
\addcontentsline{toc}{chapter}{Index}
\setheader{{\it INDEX}}{}{}{}{}{{\it INDEX}}
\setfooter{\thepage}{}{}{}{}{\thepage}%
\printindex
\end{document}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -1,87 +0,0 @@
\chapter{OGLEdit: a sample OGL application}\label{ogledit}%
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}
OGLEdit is a sample OGL application that allows the user to draw, edit,
save and load a few shapes. It should clarify aspects of OGL usage, and
can act as a template for similar applications. OGLEdit can be found in\rtfsp
{\tt samples/ogledit} in the OGL distribution.
$$\image{10cm;0cm}{ogledit.eps}$$\par
The wxWindows document/view model has been used in OGL, to reduce the amount of
housekeeping logic required to get it up and running. OGLEdit also provides
a demonstration of the Undo/Redo capability supported by the document/view classes,
and how a typical application might implement this feature.
\section{OGLEdit files}
OGLEdit comprises the following source files.
\begin{itemize}\itemsep=0pt
\item doc.h, doc.cpp: MyDiagram, DiagramDocument, DiagramCommand, MyEvtHandler
classes related to diagram functionality and documents.
\item view.h, view.cpp: MyCanvas, DiagramView classes related to visualisation of
the diagram.
\item ogledit.h, ogledit.cpp: MyFrame, MyApp classes related to the overall application.
\item palette.h, palette.cpp: EditorToolPalette implementing the shape palette.
\end{itemize}
\section{How OGLEdit works}
OGLEdit defines a DiagramDocument class, each of instance of which holds a MyDiagram
member which itself contains the shapes.
In order to implement specific mouse behaviour for shapes, a class MyEvtHandler is
defined which is `plugged into' each shape when it is created, instead of overriding each shape class
individually. This event handler class also holds a label string.
The DiagramCommand class is the key to implementing Undo/Redo. Each instance of DiagramCommand
stores enough information about an operation (create, delete, change colour etc.) to allow
it to carry out (or undo) its command. In DiagramView::OnMenuCommand, when the user initiates the
command, a new DiagramCommand instance is created which is then sent to the document's
command processor (see wxWindows manual for more information about doc/view and command
processing).
Apart from menu commands, another way commands are initiated is by the user left-clicking on
the canvas or right-dragging on a node. MyCanvas::OnLeftClick in view.cpp shows how
the appropriate wxClassInfo is passed to a DiagramCommand, to allow DiagramCommand::Do
to create a new shape given the wxClassInfo.
The MyEvtHandler right-drag methods in doc.cpp implement drawing a line between
two shapes, detecting where the right mouse button was released and looking for a second
shape. Again, a new DiagramCommand instance is created and passed to the command
processor to carry out the command.
DiagramCommand::Do and DiagramCommand::Undo embody much of the
interesting interaction with the OGL library. A complication of note
when implementing undo is the problem of deleting a node shape which has
one or more arcs attached to it. If you delete the node, the arc(s)
should be deleted too. But multiple arc deletion represents more information
that can be incorporated in the existing DiagramCommand scheme. OGLEdit
copes with this by treating each arc deletion as a separate command, and
sending Cut commands recursively, providing an undo path. Undoing such a
Cut will only undo one command at a time - not a one to one
correspondence with the original command - but it's a reasonable
compromise and preserves Do/Undo whilst keeping our DiagramCommand class
simple.
\section{Possible enhancements}
OGLEdit is very simplistic and does not employ the more advanced features
of OGL, such as:
\begin{itemize}\itemsep=0pt
\item attachment points (arcs are drawn to particular points on a shape)
\item metafile and bitmaps shapes
\item divided rectangles
\item composite shapes, and constraints
\item creating labels in shape regions
\item arc labels (OGL has support for three movable labels per arc)
\item spline and multiple-segment line arcs
\item adding annotations to node and arc shapes
\item line-straightening (supported by OGL) and alignment (not supported directly by OGL)
\end{itemize}
These could be added to OGLEdit, at the risk of making it a less
useful example for beginners.

View File

@@ -1,35 +0,0 @@
; Last change: JS 8 Sep 98 2:54 pm
runTwice = yes
titleFontSize = 12
authorFontSize = 10
chapterFontSize = 12
sectionFontSize = 12
subsectionFontSize = 12
headerRule = yes
footerRule = yes
useHeadingStyles = yes
listItemIndent=40
generateHPJ = no
htmlBrowseButtons = bitmap
winHelpVersion = 3
winHelpContents = yes
winHelpTitle = "OGL Manual"
truncateFilenames = yes
combineSubSections = yes
\overview [2] {\rtfonly{See also }\settransparency{on}\sethotspotcolour{off}\sethotspotunderline{on}\winhelponly{\image{}{books.bmp}\settransparency{off}}
\htmlonly{\image{}{books.gif}}\helpref{#1}{#2}
\sethotspotcolour{on}\sethotspotunderline{on}}
\docparam [2]{\parskip{0}{\it #1}\htmlignore{\par}\parskip{10}\indented{1cm}{#2}}
\wxheading [1]{{\bf \htmlignore{\fcol{blue}{#1}}\htmlonly{\fcol{red}{#1}}}}
\const [0] {{\bf const}}
\constfunc [3] {{\bf #1} {\bf #2}(#3) {\bf const}\index{#2}}
\windowstyle [1] {{\bf #1}\index{#1}}
;;
;; These two are for generating MS HTML Help project, contents and index files.
;;
htmlWorkshopFiles = true
htmlIndex = true
\pythonnote [1] {{\bf \fcol{blue}{wxPython note:}} #1}
%\pythonnote [1] {}

View File

@@ -1,298 +0,0 @@
% LaTeX style file
% Name: texhelp.sty
% Author: Julian Smart
%
% Purpose
% -------
% Style file to enable the simultaneous preparation of printed LaTeX and on-line
% hypertext manuals.
% Use in conjunction with Tex2RTF (see Tex2RTF documentation).
%
% Note that if a non-ASCII character starts a newline and there should be a space
% between the last word on the previous line and the first word on this line,
% you need to use \rtfsp to generate a space in Windows Help. \rtfsp is ignored
% in all other formats.
%
% Julian Smart
% Artificial Intelligence Applications Institute
%
%
% ============== C++/CLIPS Documentation Facilities ==============
%
% Each class definition should be typeset with e.g.
%
% \section{\class{Name}: Parent}
%
% followed by a description of the class.
% Each member should follow:
%
% \membersection{wxName::Member}
%
% with a description of what this member does.
% Then, one (or more if overloaded) member (function) in detail:
%
% \func{return type}{name}{args}
% or
% \member{type}{name}
%
% where args is a list of \param{type}{name}, ...
% Function, e.g.
% e.g. to typeset
%
% void DoIt(char *string);
%
% write:
%
% \func{void}{DoIt}{\param{char *}{string}}
%
\newcommand{\func}[3]{\hangafter=1\noindent\hangindent=10mm
{{\it #1} {\bf #2}\index{#2}}(#3)}
% For function/type definition where the name is a pointer,
% e.g. to typeset
%
% typedef void (*wxFunction)(wxObject&)
%
% write:
%
% \pfunc{typedef void}{wxFunction}{param{wxObject&}}
\newcommand{\pfunc}[3]{\hangafter=1\noindent\hangindent=10mm
{{\it #1} ({\bf *#2})\index{#2}}(#3)}
% Use an ordinary \section command for class name definitions.
% This is used for a member, such as wxBitmap: GetDepth
\newcommand{\membersection}[1]{\subsection*{#1}\index{#1}}
% CLIPS function
\newcommand{\clipsfunc}[3]{\hangafter=1\noindent\hangindent=10mm
{{\bf #1} ({\bf #2}\index{#2}}#3)}
\newcommand{\clipssection}[1]{\chapter{#1}}
% This is used for a CLIPS function name
\newcommand{\functionsection}[1]{\subsection*{#1}}
% Member: a type and a name
\newcommand{\member}[2]{{\bf #1 \it #2}}
% C++ Parameter: a type and a name (no intervening space)
\newcommand{\param}[2]{{\it #1}{\bf #2}}
% CLIPS Parameter: a type and a name (one intervening space)
\newcommand{\cparam}[2]{{\bf #1} {\it #2}}
% Class: puts in index
\newcommand{\class}[1]{#1\index{#1}}
%\newcommand{\docparam}[2]{\parskip=0pt {\it #1}\par\parskip=10pt\begin{indented}{1cm}{#2}\end{indented}}
% Void type
\newcommand{\void}{{\it void}}
% Typeset destructor
\newcommand{\destruct}[1]{{$\sim$}#1}
% Typeset insert/extract operators
\newcommand{\cinsert}{$<<$}
\newcommand{\cextract}{$>>$}
% =================== Hypertext facilities ===================
%
% To insert hyperlinks (or references, in Latex), \label the sections
% or membersections \label{ref-label} immediately after the section, on the same line,
% and use \helpref{text-to-show}{ref-label} to make a reference.
%
% Type text with section reference
\newcommand{\helpref}[2]{{\it #1} (p.\ \pageref{#2}) }
% Type text with URL in verbatim mode
\newcommand{\urlref}[2]{#1 (\verb$#2$)}
% Don't typeset section number in LaTeX
\newcommand{\helprefn}[2]{{\it #1}}
% Like helpref, but popup text in WinHelp instead of hyperlinked
\newcommand{\popref}[2]{{\it #1}}
% Like footnote, but popup text.
\newcommand{\footnotepopup}[2]{{\it #1}\footnote{#2}}
% =================== On-line help specific macros ===================
%
% Global document font size/family, help only.
\newcommand{\helpfontsize}[1]{}
\newcommand{\helpfontfamily}[1]{}
% Ignore in all on-line help
\newcommand{\helpignore}[1]{#1}
% Only print in all on-line help
\newcommand{\helponly}[1]{}
% Ignore in LaTeX
\newcommand{\latexignore}[1]{}
% Only print in LaTeX
\newcommand{\latexonly}[1]{#1}
% Ignore in linear RTF
\newcommand{\rtfignore}[1]{#1}
% Only print in linear RTF
\newcommand{\rtfonly}[1]{}
% Ignore in WinHelp RTF
\newcommand{\winhelpignore}[1]{#1}
% Only print in WinHelp RTF
\newcommand{\winhelponly}[1]{}
% Ignore in wxHelp
\newcommand{\xlpignore}[1]{#1}
% Only print in wxHelp
\newcommand{\xlponly}[1]{}
% Ignore in HTML
\newcommand{\htmlignore}[1]{#1}
% Only print in HTML
\newcommand{\htmlonly}[1]{}
% Input a file only for help system (binder thickness is not a limitation
% in help systems!)
\newcommand{\helpinput}[1]{}
\newcommand{\rtfsp}{ } % Force a space in RTF, ignore in Latex
% =================== Miscellaneous macros ===================
%
% Headings consistent with generated ones
\newcommand{\myheading}[1]{\vspace*{25pt}
\begin{flushleft}
{\LARGE \bf #1}
\end{flushleft}
\vskip 20pt
}
% Heading with entry in contents page.
\newcommand{\chapterheading}[1]{\myheading{#1}
\addcontentsline{toc}{chapter}{#1}}
\newcommand{\sectionheading}[1]{\myheading{#1}
\addcontentsline{toc}{section}{#1}}
% Glossary environment
\newenvironment{helpglossary}{\newpage\chapterheading{Glossary}\begin{description}}{\end{description}}
% Glossary entry
\newcommand{\gloss}[1]{\item[#1]\index{#1}}
% Image: EPS in Latex, BMP or MF (whatever's available) in RTF. Requires psbox.
\newcommand{\image}[2]{\psboxto(#1){#2}}
% Image, left aligned (HTML)
\newcommand{\imager}[2]{\psboxto(#1){#2}}
% Image, right aligned (HTML)
\newcommand{\imagel}[2]{\psboxto(#1){#2}}
% Imagemap: principally for HTML only. In Latex,
% acts like \image.
\newcommand{\imagemap}[3]{\psboxto(#1){#2}}
% Headers and footers
% \setheader{EvenPageLeft}{EvenPageCentre}{EvenPageRight}
% {OddPageLeft}{OddPageCentre}{OddPageRight}
\newcommand{\setheader}[6]{
\lhead[\fancyplain{}{#1}]{\fancyplain{}{#4}}
\chead[\fancyplain{}{#2}]{\fancyplain{}{#5}}
\rhead[\fancyplain{}{#3}]{\fancyplain{}{#6}}
}
% \setfooter{EvenPageLeft}{EvenPageCentre}{EvenPageRight}
% {OddPageLeft}{OddPageCentre}{OddPageRight}
\newcommand{\setfooter}[6]{
\lfoot[\fancyplain{#1}{#1}]{\fancyplain{#4}{#4}}
\cfoot[\fancyplain{#2}{#2}]{\fancyplain{#5}{#5}}
\rfoot[\fancyplain{#3}{#3}]{\fancyplain{#6}{#6}}
}
% Needed for telling RTF where margin paragraph should go
% in mirrored margins mode.
\newcommand{\marginpareven}[1]{\hspace*{0pt}\marginpar{#1}}
\newcommand{\marginparodd}[1]{\hspace*{0pt}\marginpar{#1}}
% Environment for two-column table popular in WinHelp and manuals.
\newcommand{\twocolwidtha}[1]{\def\twocolwidthaval{#1}}
\newcommand{\twocolwidthb}[1]{\def\twocolwidthbval{#1}}
\newcommand{\twocolspacing}[1]{\def\twocolspacingval{#1}}
\twocolwidtha{3cm}
\twocolwidthb{8.5cm}
\twocolspacing{2}
\newcommand{\twocolitem}[2]{#1 & #2\\}
\newcommand{\twocolitemruled}[2]{#1 & #2\\\hline}
\newenvironment{twocollist}{\renewcommand{\arraystretch}{\twocolspacingval}\begin{tabular}{lp{\twocolwidthbval}}}%
{\end{tabular}\renewcommand{\arraystretch}{1}}
% Specifying table rows for RTF compatibility
\newcommand{\row}[1]{#1\\}
% Use for the last ruled row for correct RTF generation.
\newcommand{\ruledrow}[1]{#1\\\hline}
% Indentation environment. Arg1 is left margin size
\newenvironment{indented}[1]{\begin{list}{}{\leftmargin=#1}\item[]}%
{\end{list}}
% Framed box of text, normal formatting.
\newcommand{\normalbox}[1]{\fbox{\vbox{#1}}}
% Double-framed box of text.
\newcommand{\normalboxd}[1]{\fbox{\fbox{\vbox{#1}}}}
% WITHDRAWN -- can't do in RTF, easily.
% Framed box of text, horizontally centred. Ragged right within box.
% \newcommand{\centeredbox}[2]{\begin{center}\fbox{\parbox{#1}{\raggedright#2}}\end{center}}
% Double-framed box of text, horizontally centred. Ragged right within box.
% \newcommand{\centeredboxd}[2]{\begin{center}\fbox{\fbox{\parbox{#1}{\raggedright#2}}}\end{center}}
% toocomplex environment: simply prints the argument in LaTeX,
% comes out verbatim in all generated formats.
\newenvironment{toocomplex}{}{}
% Colour: dummy commands since LaTeX doesn't support colour.
% \definecolour{name}{red}{blue}{green}
% \fcol{name}{text} ; Foreground
% \bcol{name}{text} ; Background
\newcommand{\definecolour}[4]{}
\newcommand{\definecolor}[4]{}
\newcommand{\fcol}[2]{#2}
\newcommand{\bcol}[2]{#2}
\newcommand{\sethotspotcolour}[1]{}
\newcommand{\sethotspotunderline}[1]{}
\newcommand{\settransparency}[1]{}
\newcommand{\backslashraw}[0]{}
\newcommand{\lbraceraw}[0]{}
\newcommand{\rbraceraw}[0]{}
\newcommand{\registered}[0]{(r)}
\newcommand{\background}[1]{}
\newcommand{\textcolour}[1]{}
\newcommand{\overview}[2]{See \helpref{#1}{#2}.}
\newcommand{\docparam}[2]{{\it #1}\begin{list}{}{\leftmargin=1cm}\item[]
#2%
\end{list}}
\newcommand{\wxheading}[1]{{\bf #1}}
\newcommand{\const}[0]{{\bf const}}
\newcommand{\constfunc}[3]{{\bf #1} {\bf #2}(#3) {\bf const}\index{#2}}
\newcommand{\windowstyle}[1]{{\bf #1}\index{#1}}
\addtolength{\textwidth}{1in}
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\topmargin}{-0.5in}
\addtolength{\textheight}{1in}
\sloppy

View File

@@ -1,161 +0,0 @@
\chapter{Topic overviews}
\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}%
\setfooter{\thepage}{}{}{}{}{\thepage}
The following sections describe particular topics.
\section{OGL overview}\label{ogloverview}
\helpref{wxShapeCanvas}{wxshapecanvas}, derived from {\bf wxCanvas}, is the drawing area
for a number of \helpref{wxShape}{wxshape} instances. Everything drawn on a
wxShapeCanvas is derived from wxShape, which provides virtual
member functions for redrawing, creating and destroying
resize/selection `handles', movement and erasing behaviour, mouse
click behaviour, calculating the bounding box of the shape, linking
nodes with arcs, and so on.
The way a client application copes with `damage' to the canvas is to
erase (white out) anything should no longer be displayed, redraw the shape,
and then redraw everything on the canvas to repair any damage. If quick edit
mode is on for the canvas, the complete should be omitted by OGL and the
application.
Selection handles (called control points in the code) are implemented as
wxRectangleShapes.
Events are passed to shapes by the canvas in a high-level form, for example {\bf OnLeftClick},
{\bf OnBeginDragLeft}, {\bf OnDragLeft}, {\bf OnEndDragLeft}. The canvas decides
what is a click and what is a drag, whether it is on a shape or the canvas itself,
and (by interrogating the shape) which attachment point the click is associated with.
In order to provide event-handling flexibility, each shapes has an `event handler' associated with it,
which by default is the shape itself (all shapes derive from wxShapeEvtHandler).
An application can modify the event-handling behaviour simply by plugging a new
event handler into the shape. This can avoid the need for multiple inheritance when
new properties and behaviour are required for a number of different shape classes: instead
of overriding each class, one new event handler class can be defined and used for all
existing shape classes.
A range of shapes have been predefined in the library, including rectangles, ellipses,
polygons. A client application can derive from these shapes and/or derive entirely
new shapes from wxShape.
Instances of a class called \helpref{wxDiagram}{wxdiagram} organise collections of
shapes, providing default file input and output behaviour.
\section{wxDividedShape overview}\label{dividedshapeoverview}
Classes: \helpref{wxDividedShape}{wxdividedshape}
A wxDividedShape is a rectangle with a number of vertical divisions. Each
division may have its text formatted with independent characteristics, and
the size of each division relative to the whole image may be specified.
Once a wxDividedShape has been created, the user may move the divisions with the
mouse. By pressing Ctrl while right-clicking, the region attributes can be edited.
Here are examples of creating wxDividedShape objects:
{\small
\begin{verbatim}
/*
* Divided rectangle with 3 regions
*
*/
wxDividedShape *dividedRect = new wxDividedShape(50, 60);
wxShapeRegion *region = new wxShapeRegion;
region->SetProportions(0.0, 0.25);
dividedRect->AddRegion(region);
region = new wxShapeRegion;
region->SetProportions(0.0, 0.5);
dividedRect->AddRegion(region);
region = new wxShapeRegion;
region->SetProportions(0.0, 0.25);
dividedRect->AddRegion(region);
dividedRect->SetSize(50, 60); // Allow it to calculate region sizes
dividedRect->SetPen(wxBLACK_PEN);
dividedRect->SetBrush(wxWHITE_BRUSH);
dividedRect->Show(TRUE);
dividedRect->NameRegions();
/*
* Divided rectangle with 3 regions, rounded
*
*/
wxDividedShape *dividedRect3 = new wxDividedShape(50, 60);
dividedRect3->SetCornerRadius(-0.4);
region = new wxShapeRegion;
region->SetProportions(0.0, 0.25);
dividedRect3->AddRegion(region);
region = new wxShapeRegion;
region->SetProportions(0.0, 0.5);
dividedRect3->AddRegion(region);
region = new wxShapeRegion;
region->SetProportions(0.0, 0.25);
dividedRect3->AddRegion(region);
dividedRect3->SetSize(50, 60); // Allow it to calculate region sizes
dividedRect3->SetPen(wxBLACK_PEN);
dividedRect3->SetBrush(wxWHITE_BRUSH);
dividedRect3->Show(TRUE);
dividedRect3->NameRegions();
\end{verbatim}
}
\section{wxCompositeShape overview}\label{compositeshapeoverview}
Classes: \helpref{wxCompositeShape}{wxcompositeshape}, \helpref{wxOGLConstraint}{wxoglconstraint}
The wxCompositeShape allows fairly complex shapes to be created, and maintains
a set of constraints which specify the layout and proportions of child shapes.
Add child shapes to a wxCompositeShape using \helpref{AddChild}{wxcompositeshapeaddchild}, and
add constraints using \helpref{AddConstraint}{wxcompositeshapeaddconstraint}.
After children and shapes have been added, call \helpref{Recompute}{wxcompositeshaperecompute} which
will return TRUE is the constraints could be satisfied, FALSE otherwise. If
constraints have been correctly and consistently specified, this call will succeed.
If there is more than one child, constraints must be specified: OGL cannot calculate
the size and position of children otherwise. Don't assume that children will simply
move relative to the parent without the use of constraints.
To specify a constraint, you need three things:
\begin{enumerate}\itemsep=0pt
\item a constraint type, such as gyCONSTRAINT\_CENTRED\_VERTICALLY;
\item a reference shape, with respect to which other shapes are going to be positioned - the\rtfsp
{\it constraining} shape;
\item a list of one or more shapes to be constrained: the {\it constrained} shapes.
\end{enumerate}
The constraining shape can be either the parent of the constrained shapes, or a sibling. The
constrained shapes must all be siblings of each other.
For an exhaustive list and description of the available constraint types, see the \helpref{wxOGLConstraint constructor}{wxoglconstraintconstr}.
Note that most constraints operate in one dimension only (vertically or horizontally), so you will
usually need to specify constraints in pairs.
You can set the spacing between constraining and constrained shapes by
calling \helpref{wxOGLConstraint::SetSpacing}{wxoglconstraintsetspacing}.
Finally, a wxCompositeShape can have {\it divisions}, which are special child shapes of class
wxDivisionShape (not to be confused with wxDividedShape). The purpose of this is to allow
the composite to be divided into user-adjustable regions (divisions) into which other shapes
can be dropped dynamically, given suitable application code. Divisons allow the child
shapes to have an identity of their own - they can be manipulated independently of their container -
but to behave as if they are contained with the division, moving with the parent shape.
Divisions boundaries can themselves be moved using the mouse.
To create an initial division, call \helpref{wxCompositeShape::MakeContainer}{wxcompositeshapemakecontainer}.
Make further divisions by calling \helpref{wxDivisionShape::Divide}{wxdivisionshapedivide}.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B

View File

@@ -1,39 +0,0 @@
#
# File: Makefile
# Author: Julian Smart
# Created: 1999
# Updated:
# Copyright: (c) 2000 Julian Smart
#
# Makefile for OGL demo (GTK version)
#
# This makefile requires wxWindows/GTK to be
# installed (possibly using "make install")
# on your system.
#
CPP = gcc
CC = gcc
WXCONFIG=../../../../wx-config
WXINCLUDE=-I../../../../include
WXLIB=-L../../../../lib
OBJECTS=ogledit.o palette.o doc.o view.o
ogledit: $(OBJECTS)
$(CPP) -o ogledit $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl
ogledit.o: ogledit.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c ogledit.cpp
palette.o: palette.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c palette.cpp
doc.o: doc.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp
view.o: view.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp
clean:
rm -f *.o ogledit

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

View File

@@ -1,44 +0,0 @@
/* XPM */
static char *arrow_xpm[] = {
/* columns rows colors chars-per-pixel */
"22 22 16 1",
" c Gray0",
". c #bf0000",
"X c #00bf00",
"o c #bfbf00",
"O c #0000bf",
"+ c #bf00bf",
"@ c #00bfbf",
"# c #c0c0c0",
"$ c #808080",
"% c Red",
"& c Green",
"* c Yellow",
"= c Blue",
"- c Magenta",
"; c Cyan",
": c Gray100",
/* pixels */
"######################",
"######################",
"######################",
"######################",
"######################",
"####### ##############",
"####### #############",
"####### ############",
"####### ###########",
"####### ##########",
"####### #########",
"####### ########",
"####### #######",
"####### ##########",
"####### # ##########",
"####### ### #########",
"########### #########",
"############ ########",
"############ ########",
"######################",
"######################",
"######################"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

View File

@@ -1,44 +0,0 @@
/* XPM */
static char *tool1_xpm[] = {
/* columns rows colors chars-per-pixel */
"22 22 16 1",
" c Gray0",
". c #bf0000",
"X c #00bf00",
"o c #bfbf00",
"O c #0000bf",
"+ c #bf00bf",
"@ c #00bfbf",
"# c #c0c0c0",
"$ c #808080",
"% c Red",
"& c Green",
"* c Yellow",
"= c Blue",
"- c Magenta",
"; c Cyan",
": c Gray100",
/* pixels */
"######################",
"######################",
"# ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ##",
"######################",
"######################",
"######################"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

View File

@@ -1,44 +0,0 @@
/* XPM */
static char *tool2_xpm[] = {
/* columns rows colors chars-per-pixel */
"22 22 16 1",
" c Gray0",
". c #bf0000",
"X c #00bf00",
"o c #bfbf00",
"O c #0000bf",
"+ c #bf00bf",
"@ c #00bfbf",
"# c #c0c0c0",
"$ c #808080",
"% c Red",
"& c Green",
"* c Yellow",
"= c Blue",
"- c Magenta",
"; c Cyan",
": c Gray100",
/* pixels */
"######################",
"######################",
"#### #####",
"### ::::::::::::: ####",
"## ::::::::::::::: ###",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"## ::::::::::::::: ###",
"### ::::::::::::: ####",
"#### #####",
"######################",
"######################",
"######################"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

View File

@@ -1,44 +0,0 @@
/* XPM */
static char *tool3_xpm[] = {
/* columns rows colors chars-per-pixel */
"22 22 16 1",
" c Gray0",
". c #bf0000",
"X c #00bf00",
"o c #bfbf00",
"O c #0000bf",
"+ c #bf00bf",
"@ c #00bfbf",
"# c #c0c0c0",
"$ c #808080",
"% c Red",
"& c Green",
"* c Yellow",
"= c Blue",
"- c Magenta",
"; c Cyan",
": c Gray100",
/* pixels */
"######################",
"######################",
"######################",
"######################",
"####### ########",
"#### ::::::: #####",
"### ::::::::::::: ####",
"## ::::::::::::::: ###",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"# ::::::::::::::::: ##",
"## ::::::::::::::: ###",
"### ::::::::::::: ####",
"#### ::::::: #####",
"###### ########",
"######################",
"######################",
"######################",
"######################",
"######################",
"######################"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

View File

@@ -1,44 +0,0 @@
/* XPM */
static char *tool4_xpm[] = {
/* columns rows colors chars-per-pixel */
"22 22 16 1",
" c Gray0",
". c #bf0000",
"X c #00bf00",
"o c #bfbf00",
"O c #0000bf",
"+ c #bf00bf",
"@ c #00bfbf",
"# c #c0c0c0",
"$ c #808080",
"% c Red",
"& c Green",
"* c Yellow",
"= c Blue",
"- c Magenta",
"; c Cyan",
": c Gray100",
/* pixels */
"######################",
"######################",
"######################",
"########## ##########",
"######### :: #########",
"######## :::: ########",
"####### :::::: #######",
"###### :::::::: ######",
"##### :::::::::: #####",
"#### :::::::::::: ####",
"### :::::::::::::: ###",
"### :::::::::::::: ###",
"#### :::::::::::: ####",
"##### :::::::::: #####",
"###### :::::::: ######",
"####### :::::: #######",
"######## :::: ########",
"######### :: #########",
"########## ##########",
"######################",
"######################",
"######################"
};

View File

@@ -1,611 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: doc.cpp
// Purpose: Implements document functionality in OGLEdit
// Author: Julian Smart
// Modified by:
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// #pragma implementation
#endif
// For compilers that support precompilation, includes "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 wx_setup.h!
#endif
#include <wx/wxexpr.h>
#include "ogledit.h"
#include "doc.h"
#include "view.h"
#if wxUSE_STD_IOSTREAM
#include <iostream.h>
#endif
IMPLEMENT_DYNAMIC_CLASS(DiagramDocument, wxDocument)
DiagramDocument::DiagramDocument(void)
{
}
DiagramDocument::~DiagramDocument(void)
{
}
bool DiagramDocument::OnCloseDocument(void)
{
diagram.DeleteAllShapes();
return TRUE;
}
#if wxUSE_STD_IOSTREAM
ostream& DiagramDocument::SaveObject(ostream& stream)
{
wxDocument::SaveObject(stream);
char buf[400];
(void) wxGetTempFileName("diag", buf);
diagram.SaveFile(buf);
wxTransferFileToStream(buf, stream);
wxRemoveFile(buf);
return stream;
}
istream& DiagramDocument::LoadObject(istream& stream)
{
wxDocument::LoadObject(stream);
char buf[400];
(void) wxGetTempFileName("diag", buf);
wxTransferStreamToFile(stream, buf);
diagram.DeleteAllShapes();
diagram.LoadFile(buf);
wxRemoveFile(buf);
return stream;
}
#else
wxOutputStream& DiagramDocument::SaveObject(wxOutputStream& stream)
{
wxDocument::SaveObject(stream);
char buf[400];
(void) wxGetTempFileName("diag", buf);
diagram.SaveFile(buf);
wxTransferFileToStream(buf, stream);
wxRemoveFile(buf);
return stream;
}
wxInputStream& DiagramDocument::LoadObject(wxInputStream& stream)
{
wxDocument::LoadObject(stream);
char buf[400];
(void) wxGetTempFileName("diag", buf);
wxTransferStreamToFile(stream, buf);
diagram.DeleteAllShapes();
diagram.LoadFile(buf);
wxRemoveFile(buf);
return stream;
}
#endif
/*
* Implementation of drawing command
*/
DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, wxClassInfo *info, double xx, double yy,
bool sel, wxShape *theShape, wxShape *fs, wxShape *ts):
wxCommand(TRUE, name)
{
doc = ddoc;
cmd = command;
shape = theShape;
fromShape = fs;
toShape = ts;
shapeInfo = info;
shapeBrush = NULL;
shapePen = NULL;
x = xx;
y = yy;
selected = sel;
deleteShape = FALSE;
}
DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape):
wxCommand(TRUE, name)
{
doc = ddoc;
cmd = command;
shape = theShape;
fromShape = NULL;
toShape = NULL;
shapeInfo = NULL;
x = 0.0;
y = 0.0;
selected = FALSE;
deleteShape = FALSE;
shapeBrush = backgroundColour;
shapePen = NULL;
}
DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, const wxString& lab, wxShape *theShape):
wxCommand(TRUE, name)
{
doc = ddoc;
cmd = command;
shape = theShape;
fromShape = NULL;
toShape = NULL;
shapeInfo = NULL;
x = 0.0;
y = 0.0;
selected = FALSE;
deleteShape = FALSE;
shapeBrush = NULL;
shapePen = NULL;
shapeLabel = lab;
}
DiagramCommand::~DiagramCommand(void)
{
if (shape && deleteShape)
{
shape->SetCanvas(NULL);
delete shape;
}
}
bool DiagramCommand::Do(void)
{
switch (cmd)
{
case OGLEDIT_CUT:
{
if (shape)
{
deleteShape = TRUE;
shape->Select(FALSE);
// Generate commands to explicitly remove each connected line.
RemoveLines(shape);
doc->GetDiagram()->RemoveShape(shape);
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
{
wxLineShape *lineShape = (wxLineShape *)shape;
fromShape = lineShape->GetFrom();
toShape = lineShape->GetTo();
}
shape->Unlink();
doc->Modify(TRUE);
doc->UpdateAllViews();
}
break;
}
case OGLEDIT_ADD_SHAPE:
{
wxShape *theShape = NULL;
if (shape)
theShape = shape; // Saved from undoing the shape
else
{
theShape = (wxShape *)shapeInfo->CreateObject();
theShape->AssignNewIds();
theShape->SetEventHandler(new MyEvtHandler(theShape, theShape, wxString("")));
theShape->SetCentreResize(FALSE);
theShape->SetPen(wxBLACK_PEN);
theShape->SetBrush(wxCYAN_BRUSH);
theShape->SetSize(60, 60);
}
doc->GetDiagram()->AddShape(theShape);
theShape->Show(TRUE);
wxClientDC dc(theShape->GetCanvas());
theShape->GetCanvas()->PrepareDC(dc);
theShape->Move(dc, x, y);
shape = theShape;
deleteShape = FALSE;
doc->Modify(TRUE);
doc->UpdateAllViews();
break;
}
case OGLEDIT_ADD_LINE:
{
wxShape *theShape = NULL;
if (shape)
theShape = shape; // Saved from undoing the line
else
{
theShape = (wxShape *)shapeInfo->CreateObject();
theShape->AssignNewIds();
theShape->SetEventHandler(new MyEvtHandler(theShape, theShape, wxString("")));
theShape->SetPen(wxBLACK_PEN);
theShape->SetBrush(wxRED_BRUSH);
wxLineShape *lineShape = (wxLineShape *)theShape;
// Yes, you can have more than 2 control points, in which case
// it becomes a multi-segment line.
lineShape->MakeLineControlPoints(2);
lineShape->AddArrow(ARROW_ARROW, ARROW_POSITION_END, 10.0, 0.0, "Normal arrowhead");
}
doc->GetDiagram()->AddShape(theShape);
fromShape->AddLine((wxLineShape *)theShape, toShape);
theShape->Show(TRUE);
wxClientDC dc(theShape->GetCanvas());
theShape->GetCanvas()->PrepareDC(dc);
// It won't get drawn properly unless you move both
// connected images
fromShape->Move(dc, fromShape->GetX(), fromShape->GetY());
toShape->Move(dc, toShape->GetX(), toShape->GetY());
shape = theShape;
deleteShape = FALSE;
doc->Modify(TRUE);
doc->UpdateAllViews();
break;
}
case OGLEDIT_CHANGE_BACKGROUND_COLOUR:
{
if (shape)
{
wxClientDC dc(shape->GetCanvas());
shape->GetCanvas()->PrepareDC(dc);
wxBrush *oldBrush = shape->GetBrush();
shape->SetBrush(shapeBrush);
shapeBrush = oldBrush;
shape->Draw(dc);
doc->Modify(TRUE);
doc->UpdateAllViews();
}
break;
}
case OGLEDIT_EDIT_LABEL:
{
if (shape)
{
MyEvtHandler *myHandler = (MyEvtHandler *)shape->GetEventHandler();
wxString oldLabel(myHandler->label);
myHandler->label = shapeLabel;
shapeLabel = oldLabel;
wxClientDC dc(shape->GetCanvas());
shape->GetCanvas()->PrepareDC(dc);
shape->FormatText(dc, (char*) (const char*) myHandler->label);
shape->Draw(dc);
doc->Modify(TRUE);
doc->UpdateAllViews();
}
break;
}
}
return TRUE;
}
bool DiagramCommand::Undo(void)
{
switch (cmd)
{
case OGLEDIT_CUT:
{
if (shape)
{
doc->GetDiagram()->AddShape(shape);
shape->Show(TRUE);
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
{
wxLineShape *lineShape = (wxLineShape *)shape;
fromShape->AddLine(lineShape, toShape);
}
if (selected)
shape->Select(TRUE);
deleteShape = FALSE;
}
doc->Modify(TRUE);
doc->UpdateAllViews();
break;
}
case OGLEDIT_ADD_SHAPE:
case OGLEDIT_ADD_LINE:
{
if (shape)
{
wxClientDC dc(shape->GetCanvas());
shape->GetCanvas()->PrepareDC(dc);
shape->Select(FALSE, &dc);
doc->GetDiagram()->RemoveShape(shape);
shape->Unlink();
deleteShape = TRUE;
}
doc->Modify(TRUE);
doc->UpdateAllViews();
break;
}
case OGLEDIT_CHANGE_BACKGROUND_COLOUR:
{
if (shape)
{
wxClientDC dc(shape->GetCanvas());
shape->GetCanvas()->PrepareDC(dc);
wxBrush *oldBrush = shape->GetBrush();
shape->SetBrush(shapeBrush);
shapeBrush = oldBrush;
shape->Draw(dc);
doc->Modify(TRUE);
doc->UpdateAllViews();
}
break;
}
case OGLEDIT_EDIT_LABEL:
{
if (shape)
{
MyEvtHandler *myHandler = (MyEvtHandler *)shape->GetEventHandler();
wxString oldLabel(myHandler->label);
myHandler->label = shapeLabel;
shapeLabel = oldLabel;
wxClientDC dc(shape->GetCanvas());
shape->GetCanvas()->PrepareDC(dc);
shape->FormatText(dc, (char*) (const char*) myHandler->label);
shape->Draw(dc);
doc->Modify(TRUE);
doc->UpdateAllViews();
}
break;
}
}
return TRUE;
}
// Remove each individual line connected to a shape by sending a command.
void DiagramCommand::RemoveLines(wxShape *shape)
{
wxNode *node = shape->GetLines().First();
while (node)
{
wxLineShape *line = (wxLineShape *)node->Data();
doc->GetCommandProcessor()->Submit(new DiagramCommand("Cut", OGLEDIT_CUT, doc, NULL, 0.0, 0.0, line->Selected(), line));
node = shape->GetLines().First();
}
}
/*
* MyEvtHandler: an event handler class for all shapes
*/
void MyEvtHandler::OnLeftClick(double x, double y, int keys, int attachment)
{
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
if (keys == 0)
{
// Selection is a concept the library knows about
if (GetShape()->Selected())
{
GetShape()->Select(FALSE, &dc);
GetShape()->GetCanvas()->Redraw(dc); // Redraw because bits of objects will be are missing
}
else
{
// Ensure no other shape is selected, to simplify Undo/Redo code
bool redraw = FALSE;
wxNode *node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->First();
while (node)
{
wxShape *eachShape = (wxShape *)node->Data();
if (eachShape->GetParent() == NULL)
{
if (eachShape->Selected())
{
eachShape->Select(FALSE, &dc);
redraw = TRUE;
}
}
node = node->Next();
}
GetShape()->Select(TRUE, &dc);
if (redraw)
GetShape()->GetCanvas()->Redraw(dc);
}
}
else if (keys & KEY_CTRL)
{
// Do something for CONTROL
}
else
{
wxGetApp().frame->SetStatusText(label);
}
}
/*
* Implement connection of two shapes by right-dragging between them.
*/
void MyEvtHandler::OnBeginDragRight(double x, double y, int keys, int attachment)
{
// Force attachment to be zero for now. Eventually we can deal with
// the actual attachment point, e.g. a rectangle side if attachment mode is on.
attachment = 0;
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
GetShape()->GetAttachmentPosition(attachment, &xp, &yp);
dc.DrawLine((long) xp, (long) yp, (long) x, (long) y);
GetShape()->GetCanvas()->CaptureMouse();
}
void MyEvtHandler::OnDragRight(bool draw, double x, double y, int keys, int attachment)
{
// Force attachment to be zero for now
attachment = 0;
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
dc.SetLogicalFunction(OGLRBLF);
dc.SetPen(dottedPen);
double xp, yp;
GetShape()->GetAttachmentPosition(attachment, &xp, &yp);
dc.DrawLine((long) xp, (long) yp, (long) x, (long) y);
}
void MyEvtHandler::OnEndDragRight(double x, double y, int keys, int attachment)
{
GetShape()->GetCanvas()->ReleaseMouse();
MyCanvas *canvas = (MyCanvas *)GetShape()->GetCanvas();
// Check if we're on an object
int new_attachment;
wxShape *otherShape = canvas->FindFirstSensitiveShape(x, y, &new_attachment, OP_DRAG_RIGHT);
if (otherShape && !otherShape->IsKindOf(CLASSINFO(wxLineShape)))
{
canvas->view->GetDocument()->GetCommandProcessor()->Submit(
new DiagramCommand("wxLineShape", OGLEDIT_ADD_LINE, (DiagramDocument *)canvas->view->GetDocument(), CLASSINFO(wxLineShape),
0.0, 0.0, FALSE, NULL, GetShape(), otherShape));
}
}
void MyEvtHandler::OnEndSize(double x, double y)
{
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
GetShape()->FormatText(dc, (char*) (const char*) label);
}
/*
* Diagram
*/
bool MyDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
wxDiagram::OnShapeSave(db, shape, expr);
MyEvtHandler *handler = (MyEvtHandler *)shape.GetEventHandler();
expr.AddAttributeValueString("label", handler->label);
return TRUE;
}
bool MyDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
{
wxDiagram::OnShapeLoad(db, shape, expr);
char *label = NULL;
expr.AssignAttributeValue("label", &label);
MyEvtHandler *handler = new MyEvtHandler(&shape, &shape, wxString(label));
shape.SetEventHandler(handler);
if (label)
delete[] label;
return TRUE;
}
/*
* New shapes
*/
IMPLEMENT_DYNAMIC_CLASS(wxRoundedRectangleShape, wxRectangleShape)
wxRoundedRectangleShape::wxRoundedRectangleShape(double w, double h):
wxRectangleShape(w, h)
{
// 0.3 of the smaller rectangle dimension
SetCornerRadius((double) -0.3);
}
IMPLEMENT_DYNAMIC_CLASS(wxDiamondShape, wxPolygonShape)
wxDiamondShape::wxDiamondShape(double w, double h):
wxPolygonShape()
{
// wxPolygonShape::SetSize relies on the shape having non-zero
// size initially.
if (w == 0.0)
w = 60.0;
if (h == 0.0)
h = 60.0;
wxList *thePoints = new wxList;
wxRealPoint *point = new wxRealPoint(0.0, (-h/2.0));
thePoints->Append((wxObject*) point);
point = new wxRealPoint((w/2.0), 0.0);
thePoints->Append((wxObject*) point);
point = new wxRealPoint(0.0, (h/2.0));
thePoints->Append((wxObject*) point);
point = new wxRealPoint((-w/2.0), 0.0);
thePoints->Append((wxObject*) point);
Create(thePoints);
}

View File

@@ -1,182 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: doc.h
// Purpose: Document classes
// Author: Julian Smart
// Modified by:
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _OGLSAMPLE_DOC_H_
#define _OGLSAMPLE_DOC_H_
#ifdef __GNUG__
// #pragma interface
#endif
#include <wx/docview.h>
#include <wx/string.h>
#include <wx/wxexpr.h>
#include "ogl.h"
#if wxUSE_STD_IOSTREAM
class ostream;
class istream;
#endif
/*
* Override a few members for this application
*/
class MyDiagram: public wxDiagram
{
public:
MyDiagram(void) {}
bool OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
bool OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr);
};
/*
* A few new shape classes so we have a 1:1 mapping
* between palette symbol and unique class
*/
class wxRoundedRectangleShape: public wxRectangleShape
{
DECLARE_DYNAMIC_CLASS(wxRoundedRectangleShape)
private:
public:
wxRoundedRectangleShape(double w = 0.0, double h = 0.0);
};
class wxDiamondShape: public wxPolygonShape
{
DECLARE_DYNAMIC_CLASS(wxDiamondShape)
private:
public:
wxDiamondShape(double w = 0.0, double h = 0.0);
};
/*
* All shape event behaviour is routed through this handler, so we don't
* have to derive from each shape class. We plug this in to each shape.
*/
class MyEvtHandler: public wxShapeEvtHandler
{
public:
wxString label;
MyEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL, const wxString& lab = ""):wxShapeEvtHandler(prev, shape)
{
label = lab;
}
~MyEvtHandler(void)
{
}
void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
void OnBeginDragRight(double x, double y, int keys = 0, int attachment = 0);
void OnDragRight(bool draw, double x, double y, int keys = 0, int attachment = 0);
void OnEndDragRight(double x, double y, int keys = 0, int attachment = 0);
void OnEndSize(double x, double y);
};
/*
* A diagram document, which contains a diagram.
*/
class DiagramDocument: public wxDocument
{
DECLARE_DYNAMIC_CLASS(DiagramDocument)
private:
public:
MyDiagram diagram;
DiagramDocument(void);
~DiagramDocument(void);
#if wxUSE_STD_IOSTREAM
virtual ostream& SaveObject(ostream& stream);
virtual istream& LoadObject(istream& stream);
#else
virtual wxOutputStream& SaveObject(wxOutputStream& stream);
virtual wxInputStream& LoadObject(wxInputStream& stream);
#endif
inline wxDiagram *GetDiagram() { return &diagram; }
bool OnCloseDocument(void);
};
/*
* Most user interface commands are routed through this, to give us the
* Undo/Redo mechanism. If you add more commands, such as changing the shape colour,
* you will need to add members to 'remember' what the user applied (for 'Do') and what the
* previous state was (for 'Undo').
* You can have one member for each property to be changed. Assume we also have
* a pointer member wxShape *shape, which is set to the shape being changed.
* Let's assume we're changing the shape colour. Our member for this is shapeColour.
*
* - In 'Do':
* o Set a temporary variable 'temp' to the current colour for 'shape'.
* o Change the colour to the new colour.
* o Set shapeColour to the _old_ colour, 'temp'.
* - In 'Undo':
* o Set a temporary variable 'temp' to the current colour for 'shape'.
* o Change the colour to shapeColour (the old colour).
* o Set shapeColour to 'temp'.
*
* So, as long as we have a pointer to the shape being changed,
* we only need one member variable for each property.
*
* PROBLEM: when an Add shape command is redone, the 'shape' pointer changes.
* Assume, as here, that we keep a pointer to the old shape so we reuse it
* when we recreate.
*/
class DiagramCommand: public wxCommand
{
protected:
DiagramDocument *doc;
int cmd;
wxShape *shape; // Pointer to the shape we're acting on
wxShape *fromShape;
wxShape *toShape;
wxClassInfo *shapeInfo;
double x;
double y;
bool selected;
bool deleteShape;
// Storage for property commands
wxBrush *shapeBrush;
wxPen *shapePen;
wxString shapeLabel;
public:
// Multi-purpose constructor for creating, deleting shapes
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, wxClassInfo *shapeInfo = NULL,
double x = 0.0, double y = 0.0, bool sel = FALSE, wxShape *theShape = NULL, wxShape *fs = NULL, wxShape *ts = NULL);
// Property-changing command constructors
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape);
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, const wxString& lab, wxShape *theShape);
~DiagramCommand(void);
bool Do(void);
bool Undo(void);
inline void SetShape(wxShape *s) { shape = s; }
inline wxShape *GetShape(void) { return shape; }
inline wxShape *GetFromShape(void) { return fromShape; }
inline wxShape *GetToShape(void) { return toShape; }
inline wxClassInfo *GetShapeInfo(void) { return shapeInfo; }
inline bool GetSelected(void) { return selected; }
void RemoveLines(wxShape *shape);
};
#endif
// _OGLSAMPLE_DOC_H_

View File

@@ -1,18 +0,0 @@
#
# File: makefile.b32
# Author: Julian Smart
# Created: 1999
# Updated:
# Copyright:
#
# Makefile : Builds sample for 32-bit BC++
WXDIR = $(WXWIN)
TARGET=ogledit
EXTRALIBS=$(WXDIR)\lib\ogl.lib
EXTRACPPFLAGS=-I$(WXDIR)\utils\ogl\src
OBJECTS = $(TARGET).obj doc.obj view.obj palette.obj
!include $(WXDIR)\src\makeprog.b32

View File

@@ -1,21 +0,0 @@
#
# File: makefile.bcc
# Author: Julian Smart
# Created: 1998
# Updated:
#
# Builds a BC++ 16-bit sample
!if "$(WXWIN)" == ""
!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
!endif
WXDIR = $(WXWIN)
TARGET=ogledit
EXTRALIBS=$(WXDIR)\lib\ogl.lib
EXTRACPPFLAGS=-I$(WXDIR)\utils\ogl\src
OBJECTS = $(TARGET).obj doc.obj view.obj palette.obj
!include $(WXDIR)\src\makeprog.b32

View File

@@ -1,103 +0,0 @@
#
# File: makefile.dos
# Author: Julian Smart
# Created: 1995
# Updated:
# Copyright: (c) 1995, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds OGLEdit example (MSVC++ 1.5).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makemsc.env
THISDIR = $(WXDIR)\utils\ogl\samples\ogledit
WXLIB = $(WXDIR)\lib\wx.lib
OGLDIR = $(WXDIR)\utils\ogl
OGLINC = $(OGLDIR)\src
OGLLIB = $(OGLDIR)\lib\ogl.lib
LIBS=$(WXLIB) $(OGLLIB) oldnames libw llibcew commdlg shell ddeml
EXTRAFLAGS=/I$(OGLINC)
OBJECTS = ogledit.obj doc.obj view.obj palette.obj
all: ogledit.exe
wx:
cd $(WXDIR)\src\msw
nmake -f makefile.dos
cd $(THISDIR)
wxclean:
cd $(WXDIR)\src\msw
nmake -f makefile.dos clean
cd $(THISDIR)
ogl:
cd $(OGLDIR)\src
nmake -f makefile.dos FINAL=$(FINAL)
cd $(THISDIR)
prologio:
cd $(PROLOGDIR)\src
nmake -f makefile.dos FINAL=$(FINAL)
cd $(THISDIR)
ogledit.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) $(OBJECTS) $(OGLLIB) ogledit.def ogledit.res
link $(LINKFLAGS) @<<
$(WXDIR)\src\msw\dummy.obj $(OBJECTS),
ogledit,
NUL,
$(LIBS),
ogledit.def
;
<<
rc -30 -K ogledit.res
ogledit.obj: ogledit.h ogledit.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
view.obj: view.h view.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
doc.obj: doc.h doc.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
palette.obj: view.h doc.h ogledit.h palette.$(SRCSUFF) $(DUMMYOBJ)
cl @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
ogledit.res : ogledit.rc $(WXDIR)\include\msw\wx.rc
rc -r /dFAFA_LIB /i$(WXDIR)\contrib\fafa /i$(WXDIR)\include\msw ogledit
clean:
-erase *.obj
-erase *.exe
-erase *.res
-erase *.map
-erase *.sbr
-erase *.pdb
cleanogl:
cd $(OGLDIR)\src
nmake -f makefile.dos clean
cd $(THISDIR)
cleanall:
cd $(OGLDIR)\src
nmake -f makefile.dos clean
cd $(THISDIR)

View File

@@ -1,18 +0,0 @@
#
# File: makefile.g95
# Author: Julian Smart
# Created: 1999
# Updated:
# Copyright: (c) Julian Smart, 1999
#
# Makefile for wxWindows sample (Cygwin/Mingw32).
WXDIR = ../../../..
TARGET=ogledit
EXTRACPPFLAGS=-I../../src
EXTRALIBS=-logl
OBJECTS = $(TARGET).o doc.o view.o palette.o
include $(WXDIR)/src/makeprog.g95

View File

@@ -1,33 +0,0 @@
# Symantec C++ makefile for docview example
# NOTE that peripheral libraries are now dealt in main wxWindows makefile.
WXDIR = $(WXWIN)
include $(WXDIR)\src\makesc.env
WXLIB = $(WXDIR)\lib\wx.lib
INCDIR = $(WXDIR)\include
MSWINC = $(INCDIR)\msw
BASEINC = $(INCDIR)\base
INCLUDE=$(BASEINC);$(MSWINC)
LIBS=$(WXLIB) libw.lib commdlg.lib shell.lib
OBJECTS=docview.obj view.obj doc.obj
.$(SRCSUFF).obj:
*$(CC) -c $(CFLAGS) -I$(INCLUDE) $<
.rc.res:
*$(RC) -r -I$(INCLUDE) $<
docview.exe: $(OBJECTS) docview.def docview.res
*$(CC) $(LDFLAGS) -o$@ $(OBJECTS) docview.def $(LIBS)
*$(RC) -k docview.res
clean:
-del *.obj
-del *.exe
-del *.res
-del *.map
-del *.rws

View File

@@ -1,20 +0,0 @@
#
# File: makefile.unx
# Author: Julian Smart
# Created: 1998
# Updated:
# Copyright: (c) 1998 Julian Smart
#
# "%W% %G%"
#
# Makefile for OGLEdit example (UNIX).
PROGRAM=ogledit
OBJECTS=$(PROGRAM).o doc.o view.o palette.o
EXTRACPPFLAGS=-I$(WXDIR)/utils/ogl/src
EXTRALDLIBS=-logl$(GUISUFFIX)
include ../../../../src/makeprog.env

View File

@@ -1,95 +0,0 @@
#
# File: makefile.vc
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds docview example (MS VC++).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
# Set WXDIR for your system
WXDIR = $(WXWIN)
!include $(WXDIR)\src\makevc.env
THISDIR = $(WXDIR)\utils\ogl\samples\ogledit
OGLDIR = $(WXDIR)\utils\ogl
OGLINC = $(OGLDIR)\src
OGLLIB = $(WXDIR)\lib\ogl$(LIBEXT).lib
PROGRAM=ogledit
EXTRALIBS=$(OGLLIB)
EXTRAINC=/I$(OGLINC)
OBJECTS = $(PROGRAM).obj doc.obj view.obj palette.obj
$(PROGRAM): $(PROGRAM).exe
all: $(PROGRAM).exe
wx:
cd $(WXDIR)\src\msw
nmake -f makefile.vc FINAL=$(FINAL)
cd $(THISDIR)
wxclean:
cd $(WXDIR)\src\msw
nmake -f makefile.vc clean
cd $(THISDIR)
ogl:
cd $(OGLDIR)\src
nmake -f makefile.vc FINAL=$(FINAL)
cd $(THISDIR)
$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(OBJECTS) $(OGLLIB) $(PROGRAM).res
$(link) @<<
-out:$(PROGRAM).exe
$(LINKFLAGS)
$(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res
$(LIBS)
<<
$(PROGRAM).obj: $(PROGRAM).h doc.h view.h palette.h $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ)
$(cc) @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
doc.obj: view.h doc.h doc.$(SRCSUFF) ogledit.h $(DUMMYOBJ)
$(cc) @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
view.obj: view.h doc.h view.$(SRCSUFF) ogledit.h $(DUMMYOBJ)
$(cc) @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
palette.obj: view.h doc.h ogledit.h palette.$(SRCSUFF) $(DUMMYOBJ)
$(cc) @<<
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
<<
$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc ogl.ico
$(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc
cleanogl:
cd $(OGLDIR)\src
nmake -f makefile.vc clean
cd $(THISDIR)
clean:
-erase *.obj
-erase *.sbr
-erase *.exe
-erase *.res
-erase *.map
-erase *.pdb

View File

@@ -1,44 +0,0 @@
#************************************************************************
# Makefile for DOCVIEW under VMS
# by Stefan Hammes
# (incomplete) update history:
# 09.06.95
#************************************************************************
#************************************************************************
# Definition section
# (cave: definitions and includes must begin with ',')
#************************************************************************
APPOPTS =
APPDEFS =
APPINCS =
#************************************************************************
# Module section
#************************************************************************
# Name of main module
MAIN = docview
# Object modules of the application.
OBJS = docview.obj view.obj doc.obj
OBJLIST =docview.obj,view.obj,doc.obj
.include [--.src]makevms.env
# main dependency
$(MAIN).exe : $(OBJS)
$(LINK) $(LINKFLAGS) /exec=$(MAIN).exe $(OBJLIST),$(WXLIB)/lib,$(OPTSFILE)/option
- purge *.exe
#************************************************************************
# Header file depedencies following
#************************************************************************
docview.$(OBJSUFF) : docview.$(SRCSUFF) docview.h doc.h view.h
doc.$(OBJSUFF) : doc.$(SRCSUFF) doc.h
view.$(OBJSUFF) : view.$(SRCSUFF) view.h

View File

@@ -1,43 +0,0 @@
#
# Makefile for WATCOM
#
# Created by D.Chubraev, chubraev@iem.ee.ethz.ch
# 8 Nov 1994
#
WXDIR = ..\..
!include $(WXDIR)\src\makewat.env
WXLIB = $(WXDIR)\lib
NAME = docview
LNK = $(name).lnk
OBJS = $(name).obj doc.obj view.obj
all: $(name).exe
$(name).exe : $(OBJS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib
wlink @$(LNK)
$(BINDCOMMAND) $(name).res
$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc
$(RC) $(RESFLAGS1) $(name).rc
$(LNK) : makefile.wat
%create $(LNK)
@%append $(LNK) debug all
@%append $(LNK) system $(LINKOPTION)
@%append $(LNK) $(MINDATA)
@%append $(LNK) $(MAXDATA)
@%append $(LNK) $(STACK)
@%append $(LNK) name $(name)
@%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib
@for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i
@for %i in ($(OBJS)) do @%append $(LNK) file %i
thing: .SYMBOLIC
echo $(WATLIBDIR)
clean: .SYMBOLIC
-erase *.obj *.bak *.err *.pch *.lib *.lnk *.res *.exe *.rex

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

View File

@@ -1,45 +0,0 @@
/* XPM */
static char * ogl_xpm[] = {
/* width height ncolors chars_per_pixel */
"32 32 7 1",
/* colors */
" s None c None",
". c #000000",
"+ c #000080",
"@ c #ff0000",
"# c #00ff00",
"$ c #00ffff",
"% c #ffffff",
/* pixels */
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%",
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%",
"%............%%%%%%........%%%%%",
"%.@@@@@@@@@@.%%%%..$$$$$$$$..%%%",
"%.@@@@@@@@@@.%%%.$$$$$$$$$$$$.%%",
"%.@@@@@@@@@@.+++.$$$$$$$$$$$$.%%",
"%.@@@@@@@@@@.+++.$$$$$$$$$$$$.%%",
"%.@@@@@@@@@@.%%%.$$$$$$$$$$$$.%%",
"%.@@@@@@@@@@.%%%%..$$$$$$$$..%%%",
"%............%%%%%.........%%%%%",
"%%%%%%++%%%%%%%%%%%%%%++%%%%%%%%",
"%%%%%%++%%%%%%%%%%%%%%++%%%%%%%%",
"%%%%%%++%%%%%%%%%%%%%%++%%%%%%%%",
"%%%%%%++%%%%%%%%%%%%%%++%%%%%%%%",
"%%%%%%++%%%%%%%%%%%%%%++%%%%%%%%",
"%%%%%%++%%%%%%%%%%%%%%++%%%%%%%%",
"%%%%%%+.%%%%%%%%%%%%%%++%%%%%%%%",
"%%%%%%.+.%%%%%%%%%%%%.++..%%%%%%",
"%%%%%.+++.%%%%%%%%%..#####..%%%%",
"%%%%.+++++.%%%%%%%.#########.%%%",
"%%%.+++++++.%%%%%%.#########.%%%",
"%%.+++++++++.%%%%.###########.%%",
"%.+++++++++++.++++###########.%%",
"%%.+++++++++.+++++###########.%%",
"%%%.+++++++.%%%%%%.#########.%%%",
"%%%%.+++++.%%%%%%%.#########.%%%",
"%%%%%.+++.%%%%%%%%%..#####..%%%%",
"%%%%%%.+.%%%%%%%%%%%%.....%%%%%%",
"%%%%%%%.%%%%%%%%%%%%%%%%%%%%%%%%",
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%",
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%",
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"};

View File

@@ -1,213 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: ogledit.cpp
// Purpose: OGLEdit sample app
// Author: Julian Smart
// Modified by:
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// #pragma implementation
#endif
// For compilers that support precompilation, includes "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 wx_setup.h!
#endif
#include "ogledit.h"
#include "palette.h"
#include "doc.h"
#include "view.h"
#if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "ogl.xpm"
#endif
// A macro needed for some compilers (AIX) that need 'main' to be defined
// in the application itself.
IMPLEMENT_APP(MyApp)
MyApp::MyApp(void)
{
frame = NULL;
myDocManager= NULL;
}
// The `main program' equivalent, creating the windows and returning the
// main frame
bool MyApp::OnInit(void)
{
wxOGLInitialize();
//// Create a document manager
myDocManager = new wxDocManager;
//// Create a template relating drawing documents to their views
(void) new wxDocTemplate(myDocManager, "Diagram", "*.dia", "", "dia", "Diagram Doc", "Diagram View",
CLASSINFO(DiagramDocument), CLASSINFO(DiagramView));
// If we've only got one window, we only get to edit
// one document at a time.
myDocManager->SetMaxDocsOpen(1);
//// Create the main frame window
frame = new MyFrame(myDocManager, NULL, "OGLEdit Demo", wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE);
//// Give it an icon
frame->SetIcon(wxICON(ogl));
//// Make a menubar
wxMenu *file_menu = new wxMenu;
wxMenu *edit_menu = NULL;
file_menu->Append(wxID_NEW, "&New...");
file_menu->Append(wxID_OPEN, "&Open...");
file_menu->Append(wxID_CLOSE, "&Close");
file_menu->Append(wxID_SAVE, "&Save");
file_menu->Append(wxID_SAVEAS, "Save &As...");
file_menu->AppendSeparator();
file_menu->Append(wxID_PRINT, "&Print...");
file_menu->Append(wxID_PRINT_SETUP, "Print &Setup...");
file_menu->Append(wxID_PREVIEW, "Print Pre&view");
edit_menu = new wxMenu;
edit_menu->Append(wxID_UNDO, "&Undo");
edit_menu->Append(wxID_REDO, "&Redo");
edit_menu->AppendSeparator();
edit_menu->Append(OGLEDIT_CUT, "&Cut");
edit_menu->AppendSeparator();
edit_menu->Append(OGLEDIT_CHANGE_BACKGROUND_COLOUR, "Change &background colour");
edit_menu->Append(OGLEDIT_EDIT_LABEL, "Edit &label");
frame->editMenu = edit_menu;
file_menu->AppendSeparator();
file_menu->Append(wxID_EXIT, "E&xit");
// A nice touch: a history of files visited. Use this menu.
myDocManager->FileHistoryUseMenu(file_menu);
wxMenu *help_menu = new wxMenu;
help_menu->Append(OGLEDIT_ABOUT, "&About");
wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, "&File");
if (edit_menu)
menu_bar->Append(edit_menu, "&Edit");
menu_bar->Append(help_menu, "&Help");
frame->canvas = frame->CreateCanvas(NULL, frame);
frame->palette = wxGetApp().CreatePalette(frame);
myDocManager->CreateDocument("", wxDOC_NEW);
//// Associate the menu bar with the frame
frame->SetMenuBar(menu_bar);
frame->CreateStatusBar(1);
frame->Centre(wxBOTH);
frame->Show(TRUE);
return TRUE;
}
int MyApp::OnExit(void)
{
wxOGLCleanUp();
delete myDocManager;
return 0;
}
/*
* This is the top-level window of the application.
*/
IMPLEMENT_CLASS(MyFrame, wxDocParentFrame)
BEGIN_EVENT_TABLE(MyFrame, wxDocParentFrame)
EVT_MENU(OGLEDIT_ABOUT, MyFrame::OnAbout)
EVT_SIZE(MyFrame::OnSize)
EVT_CLOSE(MyFrame::OnCloseWindow)
END_EVENT_TABLE()
MyFrame::MyFrame(wxDocManager *manager, wxFrame *frame, const wxString& title,
const wxPoint& pos, const wxSize& size, long type):
wxDocParentFrame(manager, frame, -1, title, pos, size, type)
{
canvas = NULL;
palette = NULL;
editMenu = NULL;
}
void MyFrame::OnSize(wxSizeEvent& event)
{
if (canvas && palette)
{
int cw, ch;
GetClientSize(&cw, &ch);
int paletteX = 0;
int paletteY = 0;
int paletteW = 30;
int paletteH = ch;
int canvasX = paletteX + paletteW;
int canvasY = 0;
int canvasW = cw - paletteW;
int canvasH = ch;
palette->SetSize(paletteX, paletteY, paletteW, paletteH);
canvas->SetSize(canvasX, canvasY, canvasW, canvasH);
}
}
void MyFrame::OnCloseWindow(wxCloseEvent& event)
{
wxDocParentFrame::OnCloseWindow(event);
if (!event.GetVeto())
{
wxOGLCleanUp();
}
}
// Intercept menu commands
void MyFrame::OnAbout(wxCommandEvent& event)
{
(void)wxMessageBox("OGLEdit Demo\nTo draw a shape, select a shape on the toolbar and left-click on the canvas.\nTo draw a line, right-drag between shapes.\nFor further details, see the OGL manual.\n (c) Julian Smart 1996", "About OGLEdit");
}
// Creates a canvas. Called by OnInit as a child of the main window
MyCanvas *MyFrame::CreateCanvas(wxView *view, wxFrame *parent)
{
int width, height;
parent->GetClientSize(&width, &height);
// Non-retained canvas
MyCanvas *canvas = new MyCanvas(view, parent, -1, wxPoint(0, 0), wxSize(width, height), 0);
canvas->SetCursor(wxCursor(wxCURSOR_HAND));
// Give it scrollbars
canvas->SetScrollbars(20, 20, 50, 50);
return canvas;
}
MyFrame *GetMainFrame(void)
{
return wxGetApp().frame;
}

View File

@@ -1,8 +0,0 @@
NAME OGLEdit
DESCRIPTION 'OGL Editor Sample'
EXETYPE WINDOWS
STUB 'WINSTUB.EXE'
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE MULTIPLE
HEAPSIZE 1024
STACKSIZE 8192

View File

@@ -1,77 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: ogledit.h
// Purpose: OGL sample
// Author: Julian Smart
// Modified by:
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// #pragma interface
#endif
#ifndef _OGLSAMPLE_OGLEDIT_H_
#define _OGLSAMPLE_OGLEDIT_H_
#include <wx/docview.h>
// Define a new application
class MyFrame;
class EditorToolPalette;
class MyApp: public wxApp
{
public:
MyFrame *frame;
wxDocManager* myDocManager;
MyApp(void);
bool OnInit(void);
int OnExit(void);
// Palette stuff
EditorToolPalette *CreatePalette(wxFrame *parent);
};
DECLARE_APP(MyApp)
// Define a new frame
class MyCanvas;
class MyFrame: public wxDocParentFrame
{
DECLARE_CLASS(MyFrame)
public:
wxMenu *editMenu;
MyCanvas *canvas;
EditorToolPalette *palette;
MyFrame(wxDocManager *manager, wxFrame *parent, const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE);
MyCanvas *CreateCanvas(wxView *view, wxFrame *parent);
void OnSize(wxSizeEvent& event);
void OnCloseWindow(wxCloseEvent& event);
void OnAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
extern MyFrame *GetMainFrame(void);
// Menu/undo/redo commands
#define OGLEDIT_CUT 1
#define OGLEDIT_ADD_SHAPE 2
#define OGLEDIT_ADD_LINE 3
#define OGLEDIT_EDIT_LABEL 4
#define OGLEDIT_CHANGE_BACKGROUND_COLOUR 5
#define OGLEDIT_ABOUT 100
#endif
// _OGLSAMPLE_OGLEDIT_H_

View File

@@ -1,10 +0,0 @@
ogl ICON ogl.ico
TOOL1 BITMAP "bitmaps/tool1.bmp"
TOOL2 BITMAP "bitmaps/tool2.bmp"
TOOL3 BITMAP "bitmaps/tool3.bmp"
TOOL4 BITMAP "bitmaps/tool4.bmp"
ARROWTOOL BITMAP "bitmaps/arrow.bmp"
#include "wx/msw/wx.rc"

View File

@@ -1,121 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: palette.cpp
// Purpose: OGLEdit palette
// Author: Julian Smart
// Modified by:
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// #pragma implementation
#endif
// For compilers that support precompilation, includes "wx.h".
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/toolbar.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include "doc.h"
#include "view.h"
#include "ogledit.h"
#include "palette.h"
// Include pixmaps
#if defined(__WXGTK__) || defined(__WXMOTIF__)
#include "bitmaps/arrow.xpm"
#include "bitmaps/tool1.xpm"
#include "bitmaps/tool2.xpm"
#include "bitmaps/tool3.xpm"
#include "bitmaps/tool4.xpm"
#endif
/*
* Object editor tool palette
*
*/
EditorToolPalette::EditorToolPalette(wxWindow* parent, const wxPoint& pos, const wxSize& size,
long style):
TOOLPALETTECLASS(parent, -1, pos, size, style)
{
currentlySelected = -1;
#if 1 // ndef __WXGTK__
SetMaxRowsCols(1000, 1);
#endif
}
bool EditorToolPalette::OnLeftClick(int toolIndex, bool toggled)
{
// BEGIN mutual exclusivity code
if (toggled && (currentlySelected != -1) && (toolIndex != currentlySelected))
ToggleTool(currentlySelected, FALSE);
if (toggled)
currentlySelected = toolIndex;
else if (currentlySelected == toolIndex)
currentlySelected = -1;
// END mutual exclusivity code
return TRUE;
}
void EditorToolPalette::OnMouseEnter(int toolIndex)
{
}
void EditorToolPalette::SetSize(int x, int y, int width, int height, int sizeFlags)
{
TOOLPALETTECLASS::SetSize(x, y, width, height, sizeFlags);
}
EditorToolPalette *MyApp::CreatePalette(wxFrame *parent)
{
// Load palette bitmaps
#ifdef __WXMSW__
wxBitmap PaletteTool1("TOOL1");
wxBitmap PaletteTool2("TOOL2");
wxBitmap PaletteTool3("TOOL3");
wxBitmap PaletteTool4("TOOL4");
wxBitmap PaletteArrow("ARROWTOOL");
#elif defined(__WXGTK__) || defined(__WXMOTIF__)
wxBitmap PaletteTool1(tool1_xpm);
wxBitmap PaletteTool2(tool2_xpm);
wxBitmap PaletteTool3(tool3_xpm);
wxBitmap PaletteTool4(tool4_xpm);
wxBitmap PaletteArrow(arrow_xpm);
#endif
EditorToolPalette *palette = new EditorToolPalette(parent, wxPoint(0, 0), wxSize(-1, -1), wxTB_HORIZONTAL);
palette->SetMargins(2, 2);
palette->SetToolBitmapSize(wxSize(22, 22));
palette->AddTool(PALETTE_ARROW, PaletteArrow, wxNullBitmap, TRUE, 0, -1, NULL, "Pointer");
palette->AddTool(PALETTE_TOOL1, PaletteTool1, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 1");
palette->AddTool(PALETTE_TOOL2, PaletteTool2, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 2");
palette->AddTool(PALETTE_TOOL3, PaletteTool3, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 3");
palette->AddTool(PALETTE_TOOL4, PaletteTool4, wxNullBitmap, TRUE, 0, -1, NULL, "Tool 4");
palette->Realize();
palette->ToggleTool(PALETTE_ARROW, TRUE);
palette->currentlySelected = PALETTE_ARROW;
return palette;
}

View File

@@ -1,66 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: palette.h
// Purpose: OGL sample palette
// Author: Julian Smart
// Modified by:
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _OGLSAMPLE_PALETTE_H_
#define _OGLSAMPLE_PALETTE_H_
#ifdef __GNUG__
// #pragma interface
#endif
#include <wx/wx.h>
#include <wx/string.h>
#if 0 // def __WXGTK__
#include <wx/toolbar.h>
#else
#include <wx/tbarsmpl.h>
#endif
/*
* Object editor tool palette
*
*/
// TODO for wxWin: wxToolBar95 cannot be moved to a non-0,0 position!
// Needs to have a parent window...
// So use a simple toolbar at present.
#if 0 // def __WXGTK__
#define TOOLPALETTECLASS wxToolBar
#else
#define TOOLPALETTECLASS wxToolBarSimple
#endif
class EditorToolPalette: public TOOLPALETTECLASS
{
public:
int currentlySelected;
EditorToolPalette(wxWindow *parent, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTB_VERTICAL);
bool OnLeftClick(int toolIndex, bool toggled);
void OnMouseEnter(int toolIndex);
void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
};
#define PALETTE_TOOL1 1
#define PALETTE_TOOL2 2
#define PALETTE_TOOL3 3
#define PALETTE_TOOL4 4
#define PALETTE_TOOL5 5
#define PALETTE_TOOL6 6
#define PALETTE_TOOL7 7
#define PALETTE_TOOL8 8
#define PALETTE_TOOL9 9
#define PALETTE_ARROW 10
#endif
// _OGLSAMPLE_PALETTE_H_

View File

@@ -1,337 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: view.cpp
// Purpose: Implements view functionality in OGLEdit
// Author: Julian Smart
// Modified by:
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// #pragma implementation
#endif
// For compilers that support precompilation, includes "wx.h".
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/colordlg.h>
#if !wxUSE_DOC_VIEW_ARCHITECTURE
#error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h!
#endif
#include "ogledit.h"
#include "doc.h"
#include "view.h"
#include "palette.h"
IMPLEMENT_DYNAMIC_CLASS(DiagramView, wxView)
BEGIN_EVENT_TABLE(DiagramView, wxView)
EVT_MENU(OGLEDIT_CUT, DiagramView::OnCut)
EVT_MENU(OGLEDIT_CHANGE_BACKGROUND_COLOUR, DiagramView::OnChangeBackgroundColour)
EVT_MENU(OGLEDIT_EDIT_LABEL, DiagramView::OnEditLabel)
END_EVENT_TABLE()
// What to do when a view is created. Creates actual
// windows for displaying the view.
bool DiagramView::OnCreate(wxDocument *doc, long flags)
{
frame = GetMainFrame();
canvas = GetMainFrame()->canvas;
canvas->view = this;
SetFrame(frame);
Activate(TRUE);
// Initialize the edit menu Undo and Redo items
doc->GetCommandProcessor()->SetEditMenu(((MyFrame *)frame)->editMenu);
doc->GetCommandProcessor()->Initialize();
wxShapeCanvas *shapeCanvas = (wxShapeCanvas *)canvas;
DiagramDocument *diagramDoc = (DiagramDocument *)doc;
shapeCanvas->SetDiagram(diagramDoc->GetDiagram());
diagramDoc->GetDiagram()->SetCanvas(shapeCanvas);
return TRUE;
}
#define CENTER FALSE // Place the drawing to the center of the page
// Sneakily gets used for default print/preview
// as well as drawing on the screen.
void DiagramView::OnDraw(wxDC *dc)
{
/* You might use THIS code if you were scaling
* graphics of known size to fit on the page.
*/
int w, h;
// We need to adjust for the graphic size, a formula will be added
float maxX = 900;
float maxY = 700;
// A better way of find the maxium values would be to search through
// the linked list
// Let's have at least 10 device units margin
float marginX = 10;
float marginY = 10;
// Add the margin to the graphic size
maxX += (2 * marginX);
maxY += (2 * marginY);
// Get the size of the DC in pixels
dc->GetSize (&w, &h);
// Calculate a suitable scaling factor
float scaleX = (float) (w / maxX);
float scaleY = (float) (h / maxY);
// Use x or y scaling factor, whichever fits on the DC
float actualScale = wxMin (scaleX, scaleY);
float posX, posY;
// Calculate the position on the DC for centring the graphic
if (CENTER == TRUE) // center the drawing
{
posX = (float) ((w - (200 * actualScale)) / 2.0);
posY = (float) ((h - (200 * actualScale)) / 2.0);
}
else // Use defined presets
{
posX = 10;
posY = 35;
}
// Set the scale and origin
dc->SetUserScale (actualScale, actualScale);
dc->SetDeviceOrigin ((long) posX, (long) posY);
// This part was added to preform the print preview and printing functions
dc->BeginDrawing(); // Allows optimization of drawing code under MS Windows.
wxDiagram *diagram_p=((DiagramDocument*)GetDocument())->GetDiagram(); // Get the current diagram
if (diagram_p->GetShapeList())
{
wxCursor *old_cursor = NULL;
wxNode *current = diagram_p->GetShapeList()->First();
while (current) // Loop through the entire list of shapes
{
wxShape *object = (wxShape *)current->Data();
if (!object->GetParent())
{
object->Draw(* dc); // Draw the shape onto our printing dc
}
current = current->Next(); // Procede to the next shape in the list
}
}
dc->EndDrawing(); // Allows optimization of drawing code under MS Windows.
}
void DiagramView::OnUpdate(wxView *sender, wxObject *hint)
{
if (canvas)
canvas->Refresh();
}
// Clean up windows used for displaying the view.
bool DiagramView::OnClose(bool deleteWindow)
{
if (!GetDocument()->Close())
return FALSE;
DiagramDocument *diagramDoc = (DiagramDocument *)GetDocument();
diagramDoc->GetDiagram()->SetCanvas(NULL);
canvas->Clear();
canvas->SetDiagram(NULL);
canvas->view = NULL;
canvas = NULL;
wxString s = wxTheApp->GetAppName();
if (frame)
frame->SetTitle(s);
SetFrame(NULL);
Activate(FALSE);
return TRUE;
}
wxShape *DiagramView::FindSelectedShape(void)
{
DiagramDocument *doc = (DiagramDocument *)GetDocument();
wxShape *theShape = NULL;
wxNode *node = doc->GetDiagram()->GetShapeList()->First();
while (node)
{
wxShape *eachShape = (wxShape *)node->Data();
if ((eachShape->GetParent() == NULL) && eachShape->Selected())
{
theShape = eachShape;
node = NULL;
}
else node = node->Next();
}
return theShape;
}
void DiagramView::OnCut(wxCommandEvent& event)
{
DiagramDocument *doc = (DiagramDocument *)GetDocument();
wxShape *theShape = FindSelectedShape();
if (theShape)
doc->GetCommandProcessor()->Submit(new DiagramCommand("Cut", OGLEDIT_CUT, doc, NULL, 0.0, 0.0, TRUE, theShape));
}
void DiagramView::OnChangeBackgroundColour(wxCommandEvent& event)
{
DiagramDocument *doc = (DiagramDocument *)GetDocument();
wxShape *theShape = FindSelectedShape();
if (theShape)
{
wxColourData data;
data.SetChooseFull(TRUE);
data.SetColour(theShape->GetBrush()->GetColour());
wxColourDialog *dialog = new wxColourDialog(frame, &data);
wxBrush *theBrush = NULL;
if (dialog->ShowModal() == wxID_OK)
{
wxColourData retData = dialog->GetColourData();
wxColour col = retData.GetColour();
theBrush = wxTheBrushList->FindOrCreateBrush(col, wxSOLID);
}
dialog->Close();
if (theBrush)
doc->GetCommandProcessor()->Submit(new DiagramCommand("Change colour", OGLEDIT_CHANGE_BACKGROUND_COLOUR, doc,
theBrush, theShape));
}
}
void DiagramView::OnEditLabel(wxCommandEvent& event)
{
wxShape *theShape = FindSelectedShape();
if (theShape)
{
wxString newLabel = wxGetTextFromUser("Enter new label", "Shape Label", ((MyEvtHandler *)theShape->GetEventHandler())->label);
GetDocument()->GetCommandProcessor()->Submit(new DiagramCommand("Edit label", OGLEDIT_EDIT_LABEL, (DiagramDocument*) GetDocument(), newLabel, theShape));
}
}
/*
* Window implementations
*/
BEGIN_EVENT_TABLE(MyCanvas, wxShapeCanvas)
EVT_MOUSE_EVENTS(MyCanvas::OnMouseEvent)
EVT_PAINT(MyCanvas::OnPaint)
END_EVENT_TABLE()
// Define a constructor for my canvas
MyCanvas::MyCanvas(wxView *v, wxWindow *parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style):
wxShapeCanvas(parent, id, pos, size, style)
{
SetBackgroundColour(*wxWHITE);
view = v;
}
MyCanvas::~MyCanvas(void)
{
}
void MyCanvas::OnLeftClick(double x, double y, int keys)
{
EditorToolPalette *palette = wxGetApp().frame->palette;
wxClassInfo *info = NULL;
switch (palette->currentlySelected)
{
case PALETTE_TOOL1:
{
info = CLASSINFO(wxRectangleShape);
break;
}
case PALETTE_TOOL2:
{
info = CLASSINFO(wxRoundedRectangleShape);
break;
}
case PALETTE_TOOL3:
{
info = CLASSINFO(wxEllipseShape);
break;
}
case PALETTE_TOOL4:
{
info = CLASSINFO(wxDiamondShape);
break;
}
default:
break;
}
if (info)
{
view->GetDocument()->GetCommandProcessor()->Submit(new DiagramCommand(info->GetClassName(), OGLEDIT_ADD_SHAPE, (DiagramDocument *)view->GetDocument(), info,
x, y));
}
}
void MyCanvas::OnRightClick(double x, double y, int keys)
{
}
void MyCanvas::OnDragLeft(bool draw, double x, double y, int keys)
{
}
void MyCanvas::OnBeginDragLeft(double x, double y, int keys)
{
}
void MyCanvas::OnEndDragLeft(double x, double y, int keys)
{
}
void MyCanvas::OnDragRight(bool draw, double x, double y, int keys)
{
}
void MyCanvas::OnBeginDragRight(double x, double y, int keys)
{
}
void MyCanvas::OnEndDragRight(double x, double y, int keys)
{
}
void MyCanvas::OnMouseEvent(wxMouseEvent& event)
{
wxShapeCanvas::OnMouseEvent(event);
}
void MyCanvas::OnPaint(wxPaintEvent& event)
{
// if (GetDiagram())
wxShapeCanvas::OnPaint(event);
}

View File

@@ -1,79 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: view.h
// Purpose: View-related classes
// Author: Julian Smart
// Modified by:
// Created: 12/07/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _OGLSAMPLE_VIEW_H_
#define _OGLSAMPLE_VIEW_H_
#ifdef __GNUG__
// #pragma interface "view.h"
#endif
#include "doc.h"
#include "ogl.h"
class MyCanvas: public wxShapeCanvas
{
// DECLARE_DYNAMIC_CLASS(wxShapeCanvas)
protected:
public:
wxView *view;
MyCanvas(wxView *view, wxWindow *parent = NULL, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxRETAINED);
~MyCanvas(void);
void OnMouseEvent(wxMouseEvent& event);
void OnPaint(wxPaintEvent& event);
virtual void OnLeftClick(double x, double y, int keys = 0);
virtual void OnRightClick(double x, double y, int keys = 0);
virtual void OnDragLeft(bool draw, double x, double y, int keys=0); // Erase if draw false
virtual void OnBeginDragLeft(double x, double y, int keys=0);
virtual void OnEndDragLeft(double x, double y, int keys=0);
virtual void OnDragRight(bool draw, double x, double y, int keys=0); // Erase if draw false
virtual void OnBeginDragRight(double x, double y, int keys=0);
virtual void OnEndDragRight(double x, double y, int keys=0);
DECLARE_EVENT_TABLE()
};
class DiagramView: public wxView
{
DECLARE_DYNAMIC_CLASS(DiagramView)
private:
public:
wxFrame *frame;
MyCanvas *canvas;
DiagramView(void) { canvas = NULL; frame = NULL; };
~DiagramView(void) {};
bool OnCreate(wxDocument *doc, long flags);
void OnDraw(wxDC *dc);
void OnUpdate(wxView *sender, wxObject *hint = NULL);
bool OnClose(bool deleteWindow = TRUE);
wxShape *FindSelectedShape(void);
// void OnMenuCommand(int cmd);
void OnCut(wxCommandEvent& event);
void OnChangeBackgroundColour(wxCommandEvent& event);
void OnEditLabel(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
#endif
// _OGLSAMPLE_VIEW_H_

View File

@@ -1,57 +0,0 @@
#
# File: Makefile
# Author: Julian Smart
# Created: 1999
# Updated:
# Copyright: (c) 2000 Julian Smart
#
# Makefile for OGL demo (GTK version)
#
# This makefile requires wxWindows/GTK to be
# installed (possibly using "make install")
# on your system.
#
CPP = gcc
CC = gcc
WXCONFIG=../../../../wx-config
WXINCLUDE=-I../../../../include
WXLIB=-L../../../../lib
OBJECTS=studio.o cspalette.o csprint.o dialogs.o doc.o mainfrm.o project.o shapes.o symbols.o view.o
studio: $(OBJECTS)
$(CPP) -o studio $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl
studio.o: studio.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c studio.cpp
cspalette.o: cspalette.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c cspalette.cpp
doc.o: doc.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp
view.o: view.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp
dialogs.o: dialogs.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c dialogs.cpp
mainfrm.o: mainfrm.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c mainfrm.cpp
project.o: project.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c project.cpp
shapes.o: shapes.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c shapes.cpp
symbols.o: symbols.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c symbols.cpp
csprint.o: csprint.cpp
$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c csprint.cpp
clean:
rm -f *.o studio

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,24 +0,0 @@
/* XPM */
static char *alignb_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c None",
". c Black",
"X c Yellow",
/* pixels */
" ",
" ........",
" .XXXXXX.",
" .XXXXXX.",
" .XXXXXX.",
" .XXXXXX.",
" .XXXXXX.",
" ..... .XXXXXX.",
" .XXX. .XXXXXX.",
" .XXX. .XXXXXX.",
" .XXX. .XXXXXX.",
" .XXX. .XXXXXX.",
" ..... ........",
" ",
" "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,24 +0,0 @@
/* XPM */
static char *alignl_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c None",
". c Black",
"X c Yellow",
/* pixels */
" ",
" ...... ",
" .XXXX. ",
" .XXXX. ",
" .XXXX. ",
" ...... ",
" ",
" ",
" ........... ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" ........... ",
" "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,24 +0,0 @@
/* XPM */
static char *alignr_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c None",
". c Black",
"X c Yellow",
/* pixels */
" ",
" ...... ",
" .XXXX. ",
" .XXXX. ",
" .XXXX. ",
" ...... ",
" ",
" ",
" ........... ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" ........... ",
" "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,24 +0,0 @@
/* XPM */
static char *alignt_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c None",
". c Black",
"X c Yellow",
/* pixels */
" ",
" ..... ........",
" .XXX. .XXXXXX.",
" .XXX. .XXXXXX.",
" .XXX. .XXXXXX.",
" .XXX. .XXXXXX.",
" ..... .XXXXXX.",
" .XXXXXX.",
" .XXXXXX.",
" .XXXXXX.",
" .XXXXXX.",
" .XXXXXX.",
" ........",
" ",
" "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

View File

@@ -1,31 +0,0 @@
/* XPM */
static char *arrow_xpm[] = {
/* width height num_colors chars_per_pixel */
" 22 22 2 1",
/* colors */
". c #000000",
"# c #c0c0c0",
/* pixels */
"######################",
"######################",
"######################",
"######################",
"######################",
"#######.##############",
"#######..#############",
"#######...############",
"#######....###########",
"#######.....##########",
"#######......#########",
"#######.......########",
"#######........#######",
"#######.....##########",
"#######..#..##########",
"#######.###..#########",
"###########..#########",
"############..########",
"############..########",
"######################",
"######################",
"######################"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,25 +0,0 @@
/* XPM */
static char *copy_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 4 1",
" c None",
". c Black",
"X c Gray100",
"o c #000080",
/* pixels */
" ",
" ...... ",
" .XXXX.. ",
" .XXXX.X. ",
" .X..X.oooooo ",
" .XXXXXoXXXXoo ",
" .X....oXXXXoXo ",
" .XXXXXoX..Xoooo",
" .X....oXXXXXXXo",
" .XXXXXoX.....Xo",
" ......oXXXXXXXo",
" oX.....Xo",
" oXXXXXXXo",
" ooooooooo",
" "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,24 +0,0 @@
/* XPM */
static char *copysize_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c None",
". c Black",
"X c Yellow",
/* pixels */
" ",
".......... ... ",
".XXXXXXXX. . ",
".XXXXXXXX. . ",
".XXXXXXXX. .....",
".XXXXXXXX. ... ",
".......... . ",
" ",
" . . . . . . ",
" ",
" . ...... . ",
" .XXXX. ",
" . ...... . ",
" ",
" . . . . . . "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,24 +0,0 @@
/* XPM */
static char *cut_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c None",
". c Black",
"X c #000080",
/* pixels */
" ",
" . . ",
" . . ",
" . . ",
" .. .. ",
" . . ",
" ... ",
" . ",
" X.X ",
" X XXX ",
" XXX X X ",
" X X X X ",
" X X X X ",
" X X XX ",
" XX "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,25 +0,0 @@
/* XPM */
static char *cutpoint_xpm[] = {
/* width height num_colors chars_per_pixel */
" 16 15 3 1",
/* colors */
". c #000000",
"# c #800000",
"a c #c0c0c0",
/* pixels */
"aaaaaaaaaaaaaaaa",
"aaaaaaaaaaaaaaaa",
"aa#aaaaaaaaa#aaa",
"aaa#aaaaaaa#aaaa",
"aaaa#aaaaa#aaaaa",
"aaaaa#...#aaaaaa",
"aaaaaa#.#.aaaaaa",
".......#........",
"aaaaaa#.#.aaaaaa",
"aaaaa#...#aaaaaa",
"aaaa#aaaaa#aaaaa",
"aaa#aaaaaaa#aaaa",
"aa#aaaaaaaaa#aaa",
"aaaaaaaaaaaaaaaa",
"aaaaaaaaaaaaaaaa"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,24 +0,0 @@
/* XPM */
static char *help_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c None",
". c Black",
"X c #008080",
/* pixels */
" ",
" ...... ",
" .XXXXX.. ",
" .XX...XX.. ",
" .X.. .X.. ",
" .X.. .XX.. ",
" .. .XX.. ",
" .XX.. ",
" .X.. ",
" .X.. ",
" .X.. ",
" .. ",
" .XX.. ",
" .XX.. ",
" ... "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,24 +0,0 @@
/* XPM */
static char *helpcs_xpm[] = {
/* width height num_colors chars_per_pixel */
" 16 15 2 1",
/* colors */
". c #000000",
"# c #c0c0c0",
/* pixels */
"################",
".########.....##",
"..######..###..#",
"...####..####...",
"....###..####...",
".....###..###..#",
"......######..##",
".......####..###",
"........##..####",
".....#####..####",
"..#..###########",
".###..####...###",
"####..####...###",
"#####..#########",
"#####..#########"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,24 +0,0 @@
/* XPM */
static char *horiz_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c None",
". c Black",
"X c Yellow",
/* pixels */
" ",
" ..... ",
" .XXX. ",
" .XXX. ",
" .XXX. ",
" ..... ",
" ",
" ",
" ........... ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" ........... ",
" "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,25 +0,0 @@
/* XPM */
static char *linearrow_xpm[] = {
/* width height num_colors chars_per_pixel */
" 16 15 3 1",
/* colors */
". c #000000",
"# c #800000",
"a c #c0c0c0",
/* pixels */
"aaaaaaaaaaaaaaaa",
"aaaaa#aaaaaaaaaa",
"aaaaa##aaaaaaaaa",
"aaaaa###aaaaaaaa",
"aaaaa####aaaaaaa",
"aaaaa#####aaaaaa",
".....######.....",
".....######.....",
"aaaaa#####aaaaaa",
"aaaaa####aaaaaaa",
"aaaaa###aaaaaaaa",
"aaaaa##aaaaaaaaa",
"aaaaa#aaaaaaaaaa",
"aaaaaaaaaaaaaaaa",
"aaaaaaaaaaaaaaaa"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,24 +0,0 @@
/* XPM */
static char *new_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 3 1",
" c None",
". c Black",
"X c Gray100",
/* pixels */
" ",
" ........ ",
" .XXXXXX.. ",
" .XXXXXX.X. ",
" .XXXXXX.... ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" .XXXXXXXXX. ",
" ........... ",
" "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,25 +0,0 @@
/* XPM */
static char *newpoint_xpm[] = {
/* width height num_colors chars_per_pixel */
" 16 15 3 1",
/* colors */
". c #000000",
"# c #c0c0c0",
"a c #ffff00",
/* pixels */
"#######a########",
"###a###a###a####",
"####a##a##a#####",
"#####a#a#a######",
"################",
"##aaa#....#aaa##",
"######....######",
"................",
"######....######",
"######....######",
"################",
"################",
"################",
"################",
"################"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,26 +0,0 @@
/* XPM */
static char *open_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 5 1",
" c None",
". c Black",
"X c Yellow",
"o c Gray100",
"O c #bfbf00",
/* pixels */
" ",
" ... ",
" . . .",
" ..",
" ... ...",
" .XoX....... ",
" .oXoXoXoXo. ",
" .XoXoXoXoX. ",
" .oXoX..........",
" .XoX.OOOOOOOOO.",
" .oo.OOOOOOOOO. ",
" .X.OOOOOOOOO. ",
" ..OOOOOOOOO. ",
" ........... ",
" "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,27 +0,0 @@
/* XPM */
static char *paste_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 6 1",
" c None",
". c Black",
"X c Yellow",
"o c #808080",
"O c #000080",
"+ c Gray100",
/* pixels */
" ",
" .... ",
" .....XX..... ",
".ooo.X..X.ooo. ",
".oo. .oo. ",
".oo........oo. ",
".oooooooooooo. ",
".oooooOOOOOOO. ",
".oooooO+++++OO ",
".oooooO+++++O+O ",
".oooooO+OOO+OOO ",
".oooooO+++++++O ",
".oooooO+OOOOO+O ",
" .....O+++++++O ",
" OOOOOOOOO "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,26 +0,0 @@
/* XPM */
static char *preview_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 5 1",
" c Black",
". c None",
"X c Gray100",
"o c #808080",
"O c Cyan",
/* pixels */
" .......",
" XXXXXXX ......",
" XXXXXXX . .....",
" XXXXXXX ....",
" XXXXXXXXXX ....",
" XXXXXXX ....",
" XXXXXX o..o ...",
" XXXXX oOO.oo ..",
" XXXXX .O..o. ..",
" XXXXX ....o. ..",
" XXXXX o..Ooo ..",
" XXXXXX o..o o..",
" XXXXXXX o .",
" XXXXXXXXXX . ",
" .. "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,26 +0,0 @@
/* XPM */
static char *print_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 15 5 1",
" c None",
". c Black",
"X c Gray100",
"o c #808000",
"O c Yellow",
/* pixels */
" ",
" ......... ",
" .XXXXXXXX. ",
" .X.....X. ",
" .XXXXXXXX. ",
" .X.....X.... ",
" .XXXXXXXX. . .",
" .......... . ..",
". . . .",
"............. .",
". ooo . . ",
". OOO ... ",
"............. . ",
" . . . ",
" ........... "
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

View File

@@ -1,25 +0,0 @@
/* XPM */
static char *redo_xpm[] = {
/* width height num_colors chars_per_pixel */
" 16 15 3 1",
/* colors */
". c #000080",
"# c #c0c0c0",
"a c #808080",
/* pixels */
"################",
"################",
"################",
"################",
"###a....########",
"##a.####..###.##",
"##.#######.#..##",
"##.########...##",
"##.#######....##",
"##a.#####.....##",
"###.a###########",
"################",
"################",
"################",
"################"
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

Some files were not shown because too many files have changed in this diff Show More