From: Julian Smart Date: Mon, 28 Feb 2000 13:42:59 +0000 (+0000) Subject: Removed old wxGLCanvas stuff; moved wxTreeLayout to wxWindows; corrected some doc... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/babc97583e1280ac0992ca8e3dbd7604e2d3963b Removed old wxGLCanvas stuff; moved wxTreeLayout to wxWindows; corrected some doc errors git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6330 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index 08e45c9cd2..9dc78798cb 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -1035,6 +1035,44 @@ samples/rotate/*.xpm samples/rotate/*.txt samples/rotate/*.bmp +samples/treelay/*.cpp +samples/treelay/*.h +samples/treelay/makefile* +samples/treelay/*.rc +samples/treelay/*.def +samples/treelay/*.ico +samples/treelay/*.xpm +samples/treelay/*.txt +samples/treelay/*.bmp + +samples/opengl/cube/*.cpp +samples/opengl/cube/*.h +samples/opengl/cube/*.rc +samples/opengl/cube/*.ico +samples/opengl/cube/*.xbm +samples/opengl/cube/make*.* +samples/opengl/cube/Makefile + +samples/opengl/isosurf/*.cpp +samples/opengl/isosurf/*.h +samples/opengl/isosurf/*.rc +samples/opengl/isosurf/*.ico +samples/opengl/isosurf/*.xbm +samples/opengl/isosurf/*.dat.gz +samples/opengl/isosurf/make*.* +samples/opengl/isosurf/Makefile + +samples/opengl/penguin/*.cpp +samples/opengl/penguin/*.c +samples/opengl/penguin/*.h +samples/opengl/penguin/*.rc +samples/opengl/penguin/*.ico +samples/opengl/penguin/*.xbm +samples/opengl/penguin/*.xpm +samples/opengl/penguin/make*.* +samples/opengl/penguin/Makefile +samples/opengl/penguin/penguin.lwo + demos/makefile* demos/configure demos/configure.in diff --git a/distrib/msw/makefile.rsp b/distrib/msw/makefile.rsp index 481f54a8b1..35b2761e03 100644 --- a/distrib/msw/makefile.rsp +++ b/distrib/msw/makefile.rsp @@ -52,6 +52,12 @@ samples/socket/Makefile.in samples/dialup/Makefile.in samples/font/Makefile.in samples/menu/Makefile.in +samples/treelay/Makefile.in +samples/opengl/cube/Makefile.in +samples/opengl/penguin/Makefile.in +samples/opengl/isosurf/Makefile.in +samples/ogl/ogledit/Makefile.in +samples/ogl/studio/Makefile.in demos/bombs/Makefile.in demos/forty/Makefile.in demos/fractal/Makefile.in diff --git a/distrib/msw/tmake/filelist.txt b/distrib/msw/tmake/filelist.txt index e5f716ff6c..801e92b7a2 100644 --- a/distrib/msw/tmake/filelist.txt +++ b/distrib/msw/tmake/filelist.txt @@ -98,6 +98,7 @@ tbarsmpl.cpp G textdlgg.cpp G tipdlg.cpp G treectrl.cpp G 16 +treelay.cpp G wizard.cpp G appcmn.cpp C B diff --git a/distrib/msw/vc.rsp b/distrib/msw/vc.rsp index 6dfac1820e..b990f4aabd 100644 --- a/distrib/msw/vc.rsp +++ b/distrib/msw/vc.rsp @@ -3,9 +3,15 @@ src/wxvc.dsw src/wxvc_dll.dsp src/wxvc_dll.dsw +src/ogl/OglVC.dsp +src/ogl/OglVC.dsw + src/jpeg/jpeg.dsp src/jpeg/jpeg.dsw +src/tiff/tiff.dsp +src/tiff/tiff.dsw + samples/calendar/CalendarVC.dsp samples/calendar/CalendarVC.dsw @@ -187,6 +193,21 @@ samples/validate/ValidateVC.dsw samples/wizard/WizardVC.dsp samples/wizard/WizardVC.dsw +samples/opengl/cube/CubeVC.dsp +samples/opengl/cube/CubeVC.dsw +samples/opengl/isosurf/IsosurfVC.dsp +samples/opengl/isosurf/IsosurfVC.dsw +samples/opengl/penguin/PenguinVC.dsp +samples/opengl/penguin/PenguinVC.dsw + +samples/ogl/ogledit/OgleditVC.dsp +samples/ogl/ogledit/OgleditVC.dsw +samples/ogl/studio/StudioVC.dsp +samples/ogl/studio/StudioVC.dsw + +samples/treelay/TreeSampleVC.dsp +samples/treelay/TreeSampleVC.dsw + demos/bombs/BombsVC.dsp demos/bombs/BombsVC.dsw @@ -211,24 +232,4 @@ utils/dialoged/src/DialogEdVC.dsw utils/tex2rtf/src/Tex2RTFVC.dsp utils/tex2rtf/src/Tex2RTFVC.dsw -utils/glcanvas/win/Glcanvas*.dsp -utils/glcanvas/win/Glcanvas*.dsw -utils/glcanvas/samples/cube/CubeVC.dsp -utils/glcanvas/samples/cube/CubeVC.dsw -utils/glcanvas/samples/isosurf/IsosurfVC.dsp -utils/glcanvas/samples/isosurf/IsosurfVC.dsw -utils/glcanvas/samples/penguin/PenguinVC.dsp -utils/glcanvas/samples/penguin/PenguinVC.dsw - -utils/ogl/src/OglVC.dsp -utils/ogl/src/OglVC.dsw -utils/ogl/samples/ogledit/OgleditVC.dsp -utils/ogl/samples/ogledit/OgleditVC.dsw -utils/ogl/samples/studio/StudioVC.dsp -utils/ogl/samples/studio/StudioVC.dsw - -utils/wxtree/src/TreeVC.dsp -utils/wxtree/src/TreeVC.dsw -utils/wxtree/src/TreeSampleVC.dsp -utils/wxtree/src/TreeSampleVC.dsw diff --git a/distrib/msw/zipdist.bat b/distrib/msw/zipdist.bat index 27c2c22cf6..a351b9cc62 100755 --- a/distrib/msw/zipdist.bat +++ b/distrib/msw/zipdist.bat @@ -22,7 +22,6 @@ echo CTRL-C if this is not correct. pause erase %dest\wx*.zip -erase %dest\glcanvas.zip erase %dest\ogl3.zip erase %dest\tex2rtf2.zip erase %dest\jpeg.zip @@ -62,8 +61,8 @@ zip32 -@ %dest\wx%version%_cw.zip < %src\distrib\msw\cw.rsp rem OGL 3 zip32 -@ %dest\ogl3.zip < %src\distrib\msw\ogl.rsp -rem GLCanvas -zip32 -@ %dest\glcanvas.zip < %src\distrib\msw\glcanvas.rsp +rem GLCanvas: obsolete, now in main library +rem zip32 -@ %dest\glcanvas.zip < %src\distrib\msw\glcanvas.rsp rem Tex2RTF zip32 -@ %dest\tex2rtf2.zip < %src\distrib\msw\tex2rtf.rsp @@ -107,7 +106,6 @@ unzip32 -o ..\wx%version%_bc.zip unzip32 -o ..\wx%version%_hlp.zip Rem Need Word file, for Remstar DB classes unzip32 -o ..\wx%version%_wrd.zip -unzip32 -o ..\glcanvas.zip unzip32 -o ..\treedraw.zip unzip32 -o ..\ogl3.zip unzip32 -o ..\jpeg.zip diff --git a/docs/latex/wx/array.tex b/docs/latex/wx/array.tex index 73f53089f1..8a84b9ad45 100644 --- a/docs/latex/wx/array.tex +++ b/docs/latex/wx/array.tex @@ -125,7 +125,7 @@ WX_DEFINE_SORTED_ARRAY(MyFile *, ArrayOfFiles); \helpref{Container classes overview}{wxcontaineroverview}, \helpref{wxList}{wxlist} -\wxheading{Required headers:} +\wxheading{Include files} for wxArray and wxSortedArray and additionally for wxObjArray. diff --git a/docs/latex/wx/classes.tex b/docs/latex/wx/classes.tex index a6adbfd61c..3705f9fd10 100644 --- a/docs/latex/wx/classes.tex +++ b/docs/latex/wx/classes.tex @@ -284,6 +284,7 @@ \input toolbar.tex \input treectrl.tex \input treeevt.tex +\input treelay.tex \input upduievt.tex \input url.tex \input validatr.tex diff --git a/docs/latex/wx/sndaiff.tex b/docs/latex/wx/sndaiff.tex index 79e2f2d560..71142a72f8 100644 --- a/docs/latex/wx/sndaiff.tex +++ b/docs/latex/wx/sndaiff.tex @@ -3,10 +3,8 @@ % /home/guilhem/PROJECTS/wxWindows/utils/wxMMedia2/lib/sndaiff.h at 26/Feb/00 14:52:29 % - \section{\class{wxSoundAiff}}\label{wxsoundaiff} - AIFF codec \wxheading{Derived from} diff --git a/docs/latex/wx/sndbase.tex b/docs/latex/wx/sndbase.tex index ccd563c188..e5ecbc0028 100644 --- a/docs/latex/wx/sndbase.tex +++ b/docs/latex/wx/sndbase.tex @@ -16,9 +16,9 @@ Base class for sound streams No base class -\wxheading{Include file} +\wxheading{Include files} -wx/mmedia/sndbase.h + \wxheading{Data structures} @@ -56,6 +56,7 @@ may happen when you call wxSoundRouterStream::SetSoundFormat().} When a sound event is generated, it may either call the internal sound event processor (which can be inherited) or call a C function. Its definition is: + \begin{verbatim} typedef void (*wxSoundCallback)(wxSoundStream *stream, int evt, void *cdata); @@ -63,13 +64,13 @@ processor (which can be inherited) or call a C function. Its definition is: The {\bf stream} parameter represents the current wxSoundStream. -The {\bf evt} parameter represents the sound event which is the cause of the calling. (See \helpref{wxSound events}{wxsoundstreamevents}) +The {\bf evt} parameter represents the sound event which is the cause of the calling. (See \helpref{wxSound events}{wxsoundstreamevents}). The {\bf cdata} parameter represents the user callback data which were specified when the user called \helpref{wxSoundStream::Register}{wxsoundstreamregister}. -{\bf\it Note:} There is two other ways to catch sound events: you can inherit the -sound stream and redefine \helpref{wxSoundStream::OnSoundEvent}{wxsoundstreamonsoundevent}, or you can reroute the events to another sound stream using \helpref{wxSoundStream::SetEventHandler}{wxsoundstreameventhandler} +{\it Note:} There are two other ways to catch sound events: you can inherit the +sound stream and redefine \helpref{wxSoundStream::OnSoundEvent}{wxsoundstreamonsoundevent}, or you can reroute the events to another sound stream using \helpref{wxSoundStream::SetEventHandler}{wxsoundstreameventhandler}. %% %% wxSoundStream streaming mode @@ -78,18 +79,18 @@ sound stream and redefine \helpref{wxSoundStream::OnSoundEvent}{wxsoundstreamons \wxheading{wxSound streaming mode} The wxSoundStream object can work in three different modes. These modes are specified -at the call to \helpref{wxSoundStream::StartProduction}{wxsoundstreamstartproduction} -and cannot be changed until you call +at the call to \helpref{wxSoundStream::StartProduction}{wxsoundstreamstartproduction} +and cannot be changed until you call \helpref{wxSoundStream::StopProduction}{wxsoundstreamstopproduction}. -The {\bf wxSOUND\_INPUT} mode is the recording mode. It generates {\bf wxSOUND\_INPUT} +The {\bf wxSOUND\_INPUT} mode is the recording mode. It generates {\bf wxSOUND\_INPUT} events and you cannot use wxSoundStream::Write(). -The {\bf wxSOUND\_OUTPUT} mode is the playing mode. It generates {\bf wxSOUND\_OUTPUT} +The {\bf wxSOUND\_OUTPUT} mode is the playing mode. It generates {\bf wxSOUND\_OUTPUT} events and you cannot use wxSoundStream::Read(). -The {\bf wxSOUND\_DUPLEX} mode activates the full duplex mode. The full duplex needs -you make synchronous call to \helpref{wxSoundStream::Read}{wxsoundstreamread} and +The {\bf wxSOUND\_DUPLEX} mode activates the full duplex mode. The full duplex requires +you to make synchronous call to \helpref{wxSoundStream::Read}{wxsoundstreamread} and \helpref{wxSoundStream::Write}{wxsoundstreamwrite}. This means that you must be careful with realtime problems. Each time you call Read you must call Write. @@ -136,30 +137,29 @@ any temporary buffer. \func{wxSoundStream\&}{Read}{\param{void* }{buffer}, \param{wxUint32 }{len}} -Reads \it{len} bytes from the sound stream. This call may block the user so +Reads {\it len} bytes from the sound stream. This call may block the user so use it carefully when you need to intensively refresh the GUI. You may be -interested by sound events: see -\helpref{wxSoundStream::OnSoundEvent}{wxsoundstreamonsoundevent}. +interested by sound events: see \helpref{wxSoundStream::OnSoundEvent}{wxsoundstreamonsoundevent}. + It is better to use the size returned by \helpref{wxSoundStream::GetBestSize}{wxsoundstreamgetbestsize}: this may improve performance or accuracy of the sound event system. -\wxheading{Note on \it{len}} +\wxheading{Parameters} -\it{len} is expressed in bytes. If you need to do conversions between bytes +\docparam{len}{{\it len} is expressed in bytes. If you need to do conversions between bytes and seconds use wxSoundFormat. -See \helpref{wxSoundFormatBase}{wxsoundformatbase}, \helpref{wxSoundStream::GetSoundFormat}{wxsoundstreamgetsoundformat}. +See \helpref{wxSoundFormatBase}{wxsoundformatbase}, \helpref{wxSoundStream::GetSoundFormat}{wxsoundstreamgetsoundformat}.} -\wxheading{Note on data} - -Data in \it{buffer} are coded using the sound format attached to this sound +\docparam{data}{Data in \it{buffer} are coded using the sound format attached to this sound stream. The format is specified with -\helpref{SetSoundFormat}{wxsoundstreamsetsoundformat} +\helpref{SetSoundFormat}{wxsoundstreamsetsoundformat}.} %% %% Write %% \membersection{wxSoundStream::Write}\label{wxsoundstreamwrite} + \func{wxSoundStream\&}{Write}{\param{const void* }{buffer}, \param{wxUint32 }{len}} Writes \it{len} bytes to the sound stream. This call may block the user so @@ -169,17 +169,15 @@ use it carefully. You may be interested by sound events: see It is better to use the size returned by \helpref{wxSoundStream::GetBestSize}{wxsoundstreamgetbestsize}: this may improve performance or accuracy of the sound event system. -\wxheading{Note on \it{len}} +\wxheading{Parameters} -\it{len} is expressed in bytes. If you need to do conversions between bytes +\docparam{len}{This is expressed in bytes. If you need to do conversions between bytes and seconds use wxSoundFormat. -See \helpref{wxSoundFormatBase}{wxsoundformatbase}, \helpref{wxSoundStream::GetSoundFormat}{wxsoundstreamgetsoundformat}. +See \helpref{wxSoundFormatBase}{wxsoundformatbase}, \helpref{wxSoundStream::GetSoundFormat}{wxsoundstreamgetsoundformat}.} -\wxheading{Note on data} - -Data in \it{buffer} are coded using the sound format attached to this sound +\docparam{buffer}{Data in \it{buffer} are coded using the sound format attached to this sound stream. The format is specified with -\helpref{SetSoundFormat}{wxsoundstreamsetsoundformat} +\helpref{SetSoundFormat}{wxsoundstreamsetsoundformat}.} %% %% GetBestSize @@ -199,6 +197,7 @@ will not block for this buffer size. %% \membersection{wxSoundStream::SetSoundFormat}\label{wxsoundstreamsetsoundformat} + \func{bool}{SetSoundFormat}{\param{const wxSoundFormatBase\& }{format}} SetSoundFormat is one of the key function of the wxSoundStream object. It specifies @@ -206,7 +205,7 @@ the sound format the user needs. SetSoundFormat tries to apply the format to the current sound stream (it can be a sound file or a sound driver). Then, either it manages to apply it and it returns {\bf TRUE}, or it could not and it returns {\bf FALSE}. In this case, you must check the error with -\helpref{wxSoundStream::GetError}{wxsoundstreamgeterror}. See +\helpref{wxSoundStream::GetError}{wxsoundstreamgeterror}. See \helpref{wxSoundStream errors section}{wxsoundstreamerrors} for more details. \wxheading{Remark} @@ -227,6 +226,7 @@ the stream itself. %% SetCallback %% \membersection{wxSoundStream::SetCallback}\label{wxsoundstreamregister} + \func{void}{Register}{\param{int }{evt}, \param{wxSoundCallback }{cbk}, \param{void* }{cdata}} It installs a C callback for wxSoundStream events. The C callbacks are still useful @@ -249,29 +249,29 @@ recording or playing or the two at the same time. Stops the async notifier. - \membersection{wxSoundStream::SetEventHandler}\label{wxsoundstreamseteventhandler} \func{void}{SetEventHandler}{\param{wxSoundStream* }{handler}} Sets the event handler: if it is non-null, all events are routed to it. - \membersection{wxSoundStream::GetError}\label{wxsoundstreamgeterror} -\constfunc{wxSoundError}{GetError}{\void} +\constfunc{wxSoundError}{GetError}{\void} \membersection{wxSoundStream::GetLastAccess}\label{wxsoundstreamgetlastaccess} -\constfunc{wxUint32}{GetLastAccess}{\void} +\constfunc{wxUint32}{GetLastAccess}{\void} \membersection{wxSoundStream::QueueFilled}\label{wxsoundstreamqueuefilled} + \constfunc{bool}{QueueFilled}{\void} This is only useful for device (I think). - \membersection{wxSoundStream::OnSoundEvent}\label{wxsoundstreamonsoundevent} + \func{void}{OnSoundEvent}{\param{int }{evt}} -Handles event +Handles event. + diff --git a/docs/latex/wx/sndcodec.tex b/docs/latex/wx/sndcodec.tex index 8671ca3668..d836c0b728 100644 --- a/docs/latex/wx/sndcodec.tex +++ b/docs/latex/wx/sndcodec.tex @@ -3,7 +3,6 @@ % /home/guilhem/PROJECTS/wxWindows/utils/wxMMedia2/lib/sndcodec.h at 26/Feb/00 14:26:29 % - \section{\class{wxSoundStreamCodec}}\label{wxsoundstreamcodec} \wxheading{Derived from} @@ -14,7 +13,6 @@ \latexignore{\rtfignore{\wxheading{Members}}} - \membersection{wxSoundStreamCodec::wxSoundStreamCodec}\label{wxsoundstreamcodecwxsoundstreamcodec} \func{}{wxSoundStreamCodec}{\param{wxSoundStream\& }{snd\_io}} diff --git a/docs/latex/wx/sndesd.tex b/docs/latex/wx/sndesd.tex index c03ae98d94..4d860e2025 100644 --- a/docs/latex/wx/sndesd.tex +++ b/docs/latex/wx/sndesd.tex @@ -3,10 +3,8 @@ % /home/guilhem/PROJECTS/wxWindows/utils/wxMMedia2/lib/sndesd.h at 26/Feb/00 14:26:56 % - \section{\class{wxSoundStreamESD}}\label{wxsoundstreamesd} - ESD output class \wxheading{Derived from} @@ -20,7 +18,7 @@ ESD output class \membersection{wxSoundStreamESD::wxSoundStreamESD}\label{wxsoundstreamesdwxsoundstreamesd} -\func{}{wxSoundStreamESD}{\param{const wxString\& }{hostname = \_T("localhost")}} +\func{}{wxSoundStreamESD}{\param{const wxString\& }{hostname = "localhost"}} \membersection{wxSoundStreamESD::\destruct{wxSoundStreamESD}}\label{wxsoundstreamesddtor} diff --git a/docs/latex/wx/sndfg72x.tex b/docs/latex/wx/sndfg72x.tex index fc3dd7f95f..46d97f6f72 100644 --- a/docs/latex/wx/sndfg72x.tex +++ b/docs/latex/wx/sndfg72x.tex @@ -26,9 +26,10 @@ typedef enum { {\small \begin{verbatim} typedef struct g72x\_state g72state \end{verbatim}} + This fixes a bug in Mingw95 -\latexignore{\rtfignore{\wxheading{Members}}} +\latexignore{\rtfignore{\wxheading{Members}}} \membersection{wxSoundFormatG72X::wxSoundFormatG72X}\label{wxsoundformatg72xwxsoundformatg72x} @@ -80,7 +81,7 @@ This fixes a bug in Mingw95 \constfunc{wxUint32}{GetBytesFromTime}{\param{wxUint32 }{time}} -\membersection{wxSoundFormatG72X::operator!=}\label{wxsoundformatg72xoperator!=} +\membersection{wxSoundFormatG72X::operator!=}\label{wxsoundformatg72xoperatorneq} \constfunc{bool}{operator!=}{\param{const wxSoundFormatBase\& }{frmt2}} diff --git a/docs/latex/wx/sndfpcm.tex b/docs/latex/wx/sndfpcm.tex index c8faa073ca..79b3a6b8b6 100644 --- a/docs/latex/wx/sndfpcm.tex +++ b/docs/latex/wx/sndfpcm.tex @@ -98,7 +98,7 @@ PCM specification class \constfunc{wxUint32}{GetBytesFromTime}{\param{wxUint32 }{time}} -\membersection{wxSoundFormatPcm::operator!}\label{wxsoundformatpcmoperator!} +\membersection{wxSoundFormatPcm::operator!}\label{wxsoundformatpcmoperatornot} \constfunc{bool}{operator!}{\param{const wxSoundFormatBase\& }{frmt2}} diff --git a/docs/latex/wx/sndfrmt.tex b/docs/latex/wx/sndfrmt.tex index 62aaef718e..388afc7fcd 100644 --- a/docs/latex/wx/sndfrmt.tex +++ b/docs/latex/wx/sndfrmt.tex @@ -64,6 +64,6 @@ It clones the current format. \constfunc{wxUint32}{GetBytesFromTime}{\param{wxUint32 }{time}} -\membersection{wxSoundFormatBase::operator!=}\label{wxsoundformatbaseoperator!=} +\membersection{wxSoundFormatBase::operator!=}\label{wxsoundformatbaseoperatorneq} -\constfunc{bool}{operator!=}{\param{const wxSoundFormatBase\& }{frmt2} \ No newline at end of file +\constfunc{bool}{operator!=}{\param{const wxSoundFormatBase\& }{frmt2}} diff --git a/docs/latex/wx/sndfulaw.tex b/docs/latex/wx/sndfulaw.tex index 404de56d2b..538257137f 100644 --- a/docs/latex/wx/sndfulaw.tex +++ b/docs/latex/wx/sndfulaw.tex @@ -68,7 +68,7 @@ ULAW format \constfunc{wxUint32}{GetBytesFromTime}{\param{wxUint32 }{time}} -\membersection{wxSoundFormatUlaw::operator!=}\label{wxsoundformatulawoperator!=} +\membersection{wxSoundFormatUlaw::operator!=}\label{wxsoundformatulawoperatorneq} \constfunc{bool}{operator!=}{\param{const wxSoundFormatBase\& }{frmt2}} diff --git a/docs/latex/wx/treelay.tex b/docs/latex/wx/treelay.tex new file mode 100644 index 0000000000..4b6bda45f0 --- /dev/null +++ b/docs/latex/wx/treelay.tex @@ -0,0 +1,327 @@ +\section{\class{wxTreeLayout}}\label{wxtreelayout} + +wxTreeLayout provides layout of simple trees with one root node, drawn left-to-right, +with user-defined spacing between nodes. + +wxTreeLayout is an abstract class that must be subclassed. The programmer +defines various member functions which will access whatever data structures +are appropriate for the application, and wxTreeLayout uses these when laying +out the tree. + +Nodes are identified by long integer identifiers. The derived class +communicates the actual tree structure to wxTreeLayout by defining \helpref{wxTreeLayout::GetChildren}{wxtreelayoutgetchildren}\rtfsp +and \helpref{wxTreeLayout::GetNodeParent}{wxtreelayoutgetnodeparent} functions. + +The application should call \helpref{wxTreeLayout::DoLayout}{wxtreelayoutdolayout} to do the tree +layout. Depending on how the derived class has been defined, either +\rtfsp\helprefn{wxTreeLayout::Draw}{wxtreelayoutdraw} must be called (for example by the OnPaint member +of a wxScrolledWindow) or the application-defined drawing code should be called +as normal. + +For example, if you have an image drawing system already defined, you +may want wxTreeLayout to position existing node images in that system. So you +just need a way for wxTreeLayout to set the node image positions according to +the layout algorithm, and the rest will be done by your own image drawing +system. + +The algorithm is due to Gabriel Robins \cite{robins87}, a linear-time +algorithm originally implemented in LISP for AI applications. + +The original algorithm has been modified so that both X and Y planes +are calculated simultaneously, increasing efficiency slightly. The basic +code is only a page or so long. + +\helponly{Below is the example tree generated by the program test.cc. + +\begin{figure} +$$\image{11cm;0cm}{treetst.ps}$$ +\caption{Example tree}\label{exampletree} +\end{figure} +} + +\wxheading{Derived from} + +wxObject + +\wxheading{See also} + +\helpref{wxLayoutTreeStored}{wxlayouttreestored} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxTreeLayout::wxTreeLayout} + +\func{}{wxTreeLayout}{\void} + +Constructor. + +\membersection{wxTreeLayout::ActivateNode}\label{wxtreelayoutactivatenode} + +\func{void}{ActivateNode}{\param{long}{ id}, \param{bool }{active}} + +Define this so wxTreeLayout can turn nodes on and off for drawing purposes +(not all nodes may be connected in the tree). See also \helprefn{NodeActive}{nodeactive}. + +\membersection{wxTreeLayout::CalcLayout} + +\func{void}{CalcLayout}{\param{long}{ id}, \param{int}{ level}} + +Private function for laying out a branch. + +\membersection{wxTreeLayout::DoLayout}\label{wxtreelayoutdolayout} + +\func{void}{DoLayout}{\param{wxDC\&}{ dc}, \param{long}{ topNode = -1}} + +Calculates the layout for the tree, optionally specifying the top node. + +\membersection{wxTreeLayout::Draw}\label{wxtreelayoutdraw} + +\func{void}{Draw}{\param{wxDC\&}{ dc}} + +Call this to let wxTreeLayout draw the tree itself, once the layout has been +calculated with \helprefn{DoLayout}{dolayout}. + +\membersection{wxTreeLayout::DrawBranch} + +\func{void}{DrawBranch}{\param{long}{ from}, \param{long}{ to}, \param{wxDC\&}{ dc}} + +Defined by wxTreeLayout to draw an arc between two nodes. + +\membersection{wxTreeLayout::DrawBranches} + +\func{void}{DrawBranches}{\param{wxDC\&}{ dc}} + +Defined by wxTreeLayout to draw the arcs between nodes. + +\membersection{wxTreeLayout::DrawNode} + +\func{void}{DrawNode}{\param{long}{ id}, \param{wxDC\&}{ dc}} + +Defined by wxTreeLayout to draw a node. + +\membersection{wxTreeLayout::DrawNodes} + +\func{void}{DrawNodes}{\param{wxDC\&}{ dc}} + +Defined by wxTreeLayout to draw the nodes. + +\membersection{wxTreeLayout::GetChildren}\label{wxtreelayoutgetchildren} + +\func{void}{GetChildren}{\param{long}{ id}, \param{wxList \&}{list}} + +Must be defined to return the children of node {\it id} in the given list +of integers. + +\membersection{wxTreeLayout::GetNextNode}\label{wxtreelayoutgetnextnode} + +\func{long}{GetNextNode}{\param{long}{ id}} + +Must be defined to return the next node after {\it id}, so that wxTreeLayout can +iterate through all relevant nodes. The ordering is not important. +The function should return -1 if there are no more nodes. + +\membersection{wxTreeLayout::GetNodeName} + +\constfunc{wxString}{GetNodeName}{\param{long}{ id}} + +May optionally be defined to get a node's name (for example if leaving +the drawing to wxTreeLayout). + +\membersection{wxTreeLayout::GetNodeSize} + +\constfunc{void}{GetNodeSize}{\param{long}{ id}, \param{long*}{ x}, \param{long*}{ y}} + +Can be defined to indicate a node's size, or left to wxTreeLayout to use the +name as an indication of size. + +\membersection{wxTreeLayout::GetNodeParent}\label{wxtreelayoutgetnodeparent} + +\constfunc{long}{GetNodeParent}{\param{long}{ id}} + +Must be defined to return the parent node of {\it id}. +The function should return -1 if there is no parent. + +\membersection{wxTreeLayout::GetNodeX} + +\constfunc{long}{GetNodeX}{\param{long}{ id}} + +Must be defined to return the current X position of the node. Note that +coordinates are assumed to be at the top-left of the node so some conversion +may be necessary for your application. + +\membersection{wxTreeLayout::GetNodeY} + +\constfunc{long}{GetNodeY}{\param{long}{ id}} + +Must be defined to return the current Y position of the node. Note that +coordinates are assumed to be at the top-left of the node so some conversion +may be necessary for your application. + +\membersection{wxTreeLayout::GetLeftMargin} + +\constfunc{long}{GetLeftMargin}{\void} + +Gets the left margin set with \helprefn{SetMargins}{setmargins}. + +\membersection{wxTreeLayout::GetOrientation} + +\constfunc{bool}{GetOrientation}{\void} + +Gets the orientation: TRUE means top-to-bottom, FALSE means left-to-right (the default). + +\membersection{wxTreeLayout::GetTopMargin} + +\constfunc{long}{GetTopMargin}{\void} + +Gets the top margin set with \helprefn{SetMargins}{setmargins}. + +\membersection{wxTreeLayout::GetTopNode} + +\constfunc{long}{GetTopNode}{\void} + +wxTreeLayout calls this to get the top of the tree. Don't redefine this; call +\rtfsp\helprefn{SetTopNode}{settopnode} instead before calling \helprefn{DoLayout}{dolayout}. + +\membersection{wxTreeLayout::GetXSpacing} + +\constfunc{long}{GetXSpacing}{\void} + +Gets the horizontal spacing between nodes. + +\membersection{wxTreeLayout::GetYSpacing} + +\constfunc{long}{GetYSpacing}{\void} + +Gets the vertical spacing between nodes. + +\membersection{wxTreeLayout::Initialize} + +\func{void}{Initialize}{\void} + +Initializes wxTreeLayout. Call from application or overridden {\bf Initialize} +or constructor. + +\membersection{wxTreeLayout::NodeActive}\label{wxtreelayoutnodeactive} + +\func{bool}{NodeActive}{\param{long}{ id}} + +Define this so wxTreeLayout can know which nodes are to be drawn (not all +nodes may be connected in the tree). See also \helprefn{ActivateNode}{activatenode}. + +\membersection{wxTreeLayout::SetNodeName} + +\func{void}{SetNodeName}{\param{long}{ id}, \param{const wxString\& }{ name}} + +May optionally be defined to set a node's name. + +\membersection{wxTreeLayout::SetNodeX} + +\func{void}{SetNodeX}{\param{long}{ id}, \param{long}{ x}} + +Must be defined to set the current X position of the node. Note that +coordinates are assumed to be at the top-left of the node so some conversion +may be necessary for your application. + +\membersection{wxTreeLayout::SetNodeY} + +\func{void}{SetNodeY}{\param{long}{ id}, \param{long}{ y}} + +Must be defined to set the current Y position of the node. Note that +coordinates are assumed to be at the top-left of the node so some conversion +may be necessary for your application. + +\membersection{wxTreeLayout::SetOrientation} + +\func{void}{SetOrientation}{\param{bool}{ orientation}} + +Sets the tree orientation: TRUE means top-to-bottom, FALSE means left-to-right (the default). + +\membersection{wxTreeLayout::SetTopNode}\label{wxtreelayoutsettopnode} + +\func{void}{SetTopNode}{\param{long}{ id}} + +Call this to identify the top of the tree to wxTreeLayout. + +\membersection{wxTreeLayout::SetSpacing} + +\func{void}{SetSpacing}{\param{long}{ x}, \param{long}{ y}} + +Sets the horizontal and vertical spacing between nodes in the tree. + +\membersection{wxTreeLayout::SetMargins}\label{wxtreelayoutsetmargins} + +\func{void}{SetMargins}{\param{long}{ x}, \param{long}{ y}} + +Sets the left and top margins of the whole tree. + +\section{\class{wxLayoutTreeStored}}\label{wxlayouttreestored} + +wxLayoutTreeStored provides storage for node labels, position and client data. It also provides hit-testing +(which node a mouse event occurred on). It is usually a more convenient class to use than wxTreeLayout. + +\wxheading{Derived from} + +\helpref{wxTreeLayout}{wxtreelayout}\\ +\helpref{wxObject}{wxobject} + +\wxheading{See also} + +\helpref{wxLayoutTree}{wxlayouttree} + +\latexignore{\rtfignore{\wxheading{Members}}} + +\membersection{wxLayoutTreeStored::wxLayoutTreeStored} + +\func{}{wxLayoutTreeStored}{\param{int }{noNodes = 200}} + +Constructor. Specify the maximum number of nodes to be allocated. + +\membersection{wxLayoutTreeStored::AddChild}\label{wxlayouttreestoredaddchild} + +\func{long}{AddChild}{\param{const wxString\&}{ name}, \param{const wxString\&}{ parent = ""}} + +Adds a child with a given parent, returning the node id. + +\membersection{wxLayoutTreeStored::GetClientData}\label{wxlayouttreestoredgetclientdata} + +\constfunc{long}{GetClientData}{\param{long}{ id}} + +Gets the client data for the given node. + +\membersection{wxLayoutTreeStored::GetNode}\label{wxlayouttreestoredgetnode} + +\constfunc{wxStoredNode*}{GetNode}{\param{long}{ id}} + +Returns the wxStoredNode object for the given node id. + +\membersection{wxLayoutTreeStored::GetNodeCount}\label{wxlayouttreestoredgetnodecount} + +\constfunc{int}{GetNodeCount}{\void} + +Returns the current number of nodes. + +\membersection{wxLayoutTreeStored::GetNumNodes}\label{wxlayouttreestoredgetnumnodes} + +\constfunc{int}{GetNumNodes}{\void} + +Returns the maximum number of nodes. + +\membersection{wxLayoutTreeStored::HitTest}\label{wxlayouttreestoredhittest} + +\func{wxString}{HitTest}{\param{wxMouseEvent\&}{ event}, \param{wxDC\& }{dc}} + +Returns a string with the node name corresponding to the position of the mouse event, or the empty string if no node +was detected. + +\membersection{wxLayoutTreeStored::NameToId}\label{wxlayouttreestorednametoid} + +\func{long}{NameToId}{\param{const wxString\&}{ name}} + +Returns the id for the given node name, or -1 if there was no such node. + +\membersection{wxLayoutTreeStored::SetClientData}\label{wxlayouttreestoredsetclientdata} + +\func{void}{SetClientData}{\param{long}{ id}, \param{long}{ clientData}} + +Sets client data for the given node. + diff --git a/docs/latex/wx/treetst.bmp b/docs/latex/wx/treetst.bmp new file mode 100644 index 0000000000..fd6103035f Binary files /dev/null and b/docs/latex/wx/treetst.bmp differ diff --git a/docs/latex/wx/treetst.gif b/docs/latex/wx/treetst.gif new file mode 100644 index 0000000000..e9f7841957 Binary files /dev/null and b/docs/latex/wx/treetst.gif differ diff --git a/docs/latex/wx/vidbase.tex b/docs/latex/wx/vidbase.tex index 35eeea607f..09b7744412 100644 --- a/docs/latex/wx/vidbase.tex +++ b/docs/latex/wx/vidbase.tex @@ -3,11 +3,8 @@ % /home/guilhem/PROJECTS/wxWindows/utils/wxMMedia2/lib/vidbase.h at 26/Feb/00 14:51:56 % - \section{\class{wxVideoBaseDriver}}\label{wxvideobasedriver} - - Classes definition \wxheading{Derived from} diff --git a/docs/latex/wx/wx.hpj b/docs/latex/wx/wx.hpj index 5bf567ae88..43d8c37176 100644 --- a/docs/latex/wx/wx.hpj +++ b/docs/latex/wx/wx.hpj @@ -1,5 +1,5 @@ [OPTIONS] -BMROOT=d:\wx2\wxWind~1\docs/latex/wx ; Assume that bitmaps are where the source is +BMROOT=d:\wx2\wxWindows\docs\latex\wx ; Assume that bitmaps are where the source is TITLE=wxWindows Manual CONTENTS=Contents COMPRESS=HIGH diff --git a/include/wx/generic/treelay.h b/include/wx/generic/treelay.h new file mode 100644 index 0000000000..c6c5185c03 --- /dev/null +++ b/include/wx/generic/treelay.h @@ -0,0 +1,138 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: treelay.h +// Purpose: wxTreeLayout class +// Author: Julian Smart +// Modified by: +// Created: 7/4/98 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TREELAY_H_ +#define _WX_TREELAY_H_ + +#ifdef __GNUG__ +#pragma interface "wxtree.h" +#endif + +#include + +class WXDLLEXPORT wxTreeLayout: public wxObject +{ + DECLARE_ABSTRACT_CLASS(wxTreeLayout) + +public: + wxTreeLayout(); + + // Redefine these + virtual void GetChildren(long id, wxList& list) = 0; + virtual long GetNextNode(long id) = 0; + virtual long GetNodeParent(long id) = 0; + virtual long GetNodeX(long id) = 0; + virtual long GetNodeY(long id) = 0; + virtual void SetNodeX(long id, long x) = 0; + virtual void SetNodeY(long id, long y) = 0; + virtual void ActivateNode(long id, bool active) = 0; + virtual bool NodeActive(long id) = 0; + + // Optional redefinition + void Initialize(void); + inline virtual void SetNodeName(long id, const wxString& name) {} + inline virtual wxString GetNodeName(long id) { return wxString(""); } + virtual void GetNodeSize(long id, long *x, long *y, wxDC& dc); + virtual void Draw(wxDC& dc); + virtual void DrawNodes(wxDC& dc); + virtual void DrawBranches(wxDC& dc); + virtual void DrawNode(long id, wxDC& dc); + virtual void DrawBranch(long from, long to, wxDC& dc); + + // Don't redefine + virtual void DoLayout(wxDC& dc, long topNode = -1); + + // Accessors -- don't redefine + inline void SetTopNode(long id) { m_parentNode = id; } + inline long GetTopNode(void) const { return m_parentNode; } + inline void SetSpacing(long x, long y) { m_xSpacing = x; m_ySpacing = y; } + inline long GetXSpacing(void) const { return m_xSpacing; } + inline long GetYSpacing(void) const { return m_ySpacing; } + inline void SetMargins(long x, long y) { m_leftMargin = x; m_topMargin = y; } + inline long GetTopMargin(void) const { return m_topMargin; } + inline long GetLeftMargin(void) const { return m_leftMargin; } + + inline bool GetOrientation(void) const { return m_orientation; } + inline void SetOrientation(bool or) { m_orientation = or; } + +private: + void CalcLayout(long node_id, int level, wxDC& dc); + + // Members + +protected: + long m_parentNode; + long m_lastY; + long m_lastX; + long m_xSpacing; + long m_ySpacing; + long m_topMargin; + long m_leftMargin; + bool m_orientation; // TRUE for top-to-bottom, FALSE for left-to-right +}; + +class WXDLLEXPORT wxStoredNode +{ +public: + wxString m_name; + long m_x, m_y; + long m_parentId; + bool m_active; + long m_clientData; +}; + +/* + * A version of wxTreeLayout with storage for nodes + */ + +class WXDLLEXPORT wxLayoutTreeStored: public wxTreeLayout +{ + DECLARE_DYNAMIC_CLASS(wxLayoutTreeStored) +public: + wxLayoutTreeStored(int noNodes = 200); + ~wxLayoutTreeStored(void); + void Initialize(int n); + + wxString HitTest(wxMouseEvent& event, wxDC& dc); + wxStoredNode* GetNode(long id) const; + inline int GetNumNodes() const { return m_maxNodes; }; + inline int GetNodeCount() const { return m_num; }; + + virtual void GetChildren(long id, wxList& list); + virtual long GetNextNode(long id); + virtual long GetNodeParent(long id); + virtual long GetNodeX(long id); + virtual long GetNodeY(long id); + virtual void SetNodeX(long id, long x); + virtual void SetNodeY(long id, long y); + virtual void SetNodeName(long id, const wxString& name); + virtual wxString GetNodeName(long id); + virtual void ActivateNode(long id, bool active); + virtual bool NodeActive(long id); + virtual void SetClientData(long id, long clientData); + virtual long GetClientData(long id) const; + + virtual long AddChild(const wxString& name, const wxString& parent = ""); + virtual long NameToId(const wxString& name); + + // Data members +private: + wxStoredNode* m_nodes; + int m_num; + int m_maxNodes; +}; + +// For backward compatibility +#define wxStoredTree wxLayoutTreeStored + +#endif + // _WX_TREELAY_H_ + diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index f86739919a..04261d844a 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -220,6 +220,9 @@ // OpenGL canvas #define wxUSE_GLCANVAS 0 +// wxTreeLayout class +#define wxUSE_TREELAYOUT 1 + // ---------------------------------------------------------------------------- // Postscript support settings // ---------------------------------------------------------------------------- diff --git a/include/wx/treelay.h b/include/wx/treelay.h new file mode 100644 index 0000000000..1bd61c5607 --- /dev/null +++ b/include/wx/treelay.h @@ -0,0 +1,7 @@ +#ifndef _WX_TREELAY_H_BASE_ +#define _WX_TREELAY_H_BASE_ + +#include "wx/generic/treelay.h" + +#endif + // _WX_TREELAY_H_BASE_ diff --git a/samples/treelay/Makefile.in b/samples/treelay/Makefile.in new file mode 100644 index 0000000000..2b50609a91 --- /dev/null +++ b/samples/treelay/Makefile.in @@ -0,0 +1,21 @@ +# +# File: makefile.unx +# Author: Julian Smart +# Created: 1998 +# Updated: +# Copyright: (c) 1998 Julian Smart +# +# "%W% %G%" +# +# Makefile for test example (UNIX). + +top_srcdir = @top_srcdir@/.. +top_builddir = ../.. +program_dir = samples/test + +PROGRAM=test + +OBJECTS=$(PROGRAM).o + +include ../../src/makeprog.env + diff --git a/samples/treelay/makefile.b32 b/samples/treelay/makefile.b32 new file mode 100644 index 0000000000..95ddc80d76 --- /dev/null +++ b/samples/treelay/makefile.b32 @@ -0,0 +1,16 @@ +# +# File: makefile.b32 +# Author: Julian Smart +# Created: 1999 +# Updated: +# Copyright: +# +# Makefile : Builds sample for 32-bit BC++ + +WXDIR = $(WXWIN) + +TARGET=test +OBJECTS = $(TARGET).obj + +!include $(WXDIR)\src\makeprog.b32 + diff --git a/samples/treelay/makefile.bcc b/samples/treelay/makefile.bcc new file mode 100644 index 0000000000..669f01905a --- /dev/null +++ b/samples/treelay/makefile.bcc @@ -0,0 +1,19 @@ +# +# 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=test +OBJECTS=$(TARGET).obj + +!include $(WXDIR)\src\makeprog.bcc + diff --git a/samples/treelay/makefile.dos b/samples/treelay/makefile.dos new file mode 100644 index 0000000000..983ef2da8b --- /dev/null +++ b/samples/treelay/makefile.dos @@ -0,0 +1,17 @@ +# +# File: makefile.dos +# Author: Julian Smart +# Created: 1998 +# Updated: +# +# Makefile : Builds 16-bit sample, VC++ 1.5 +# Use FINAL=1 argument to nmake to build final version with no debugging +# info + +WXDIR = $(WXWIN) + +TARGET=test +OBJECTS=$(TARGET).obj + +!include $(WXDIR)\src\makeprog.msc + diff --git a/samples/treelay/makefile.g95 b/samples/treelay/makefile.g95 new file mode 100644 index 0000000000..b4a920f047 --- /dev/null +++ b/samples/treelay/makefile.g95 @@ -0,0 +1,16 @@ +# +# File: makefile.g95 +# Author: Julian Smart +# Created: 1999 +# Updated: +# Copyright: (c) Julian Smart, 1999 +# +# Makefile for wxWindows sample (Cygwin/Mingw32). + +WXDIR = ../.. + +TARGET=test +OBJECTS = $(TARGET).o + +include $(WXDIR)/src/makeprog.g95 + diff --git a/samples/treelay/makefile.unx b/samples/treelay/makefile.unx new file mode 100644 index 0000000000..21cab3c677 --- /dev/null +++ b/samples/treelay/makefile.unx @@ -0,0 +1,35 @@ +# +# File: Makefile for samples +# Author: Robert Roebling +# Created: 1999 +# Updated: +# Copyright: (c) 1998 Robert Roebling +# +# This makefile requires a Unix version of wxWindows +# to be installed on your system. This is most often +# done typing "make install" when using the complete +# sources of wxWindows or by installing the two +# RPM packages wxGTK.XXX.rpm and wxGTK-devel.XXX.rpm +# under Linux. +# + +CC = gcc + +PROGRAM = test + +OBJECTS = $(PROGRAM).o + +# implementation + +.SUFFIXES: .o .cpp + +.cpp.o : + $(CC) -c `wx-config --cflags` -o $@ $< + +all: $(PROGRAM) + +$(PROGRAM): $(OBJECTS) + $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs` + +clean: + rm -f *.o $(PROGRAM) diff --git a/samples/treelay/makefile.vc b/samples/treelay/makefile.vc new file mode 100644 index 0000000000..4ada748eda --- /dev/null +++ b/samples/treelay/makefile.vc @@ -0,0 +1,18 @@ +# +# File: makefile.vc +# Author: Julian Smart +# Created: 1999 +# Updated: +# Copyright: (c) Julian Smart +# +# Makefile : Builds sample (VC++, WIN32) +# Use FINAL=1 argument to nmake to build final version with no debug info. + +# Set WXDIR for your system +WXDIR = $(WXWIN) + +PROGRAM=test +OBJECTS = $(PROGRAM).obj + +!include $(WXDIR)\src\makeprog.vc + diff --git a/samples/treelay/makefile.wat b/samples/treelay/makefile.wat new file mode 100644 index 0000000000..81a83e42a9 --- /dev/null +++ b/samples/treelay/makefile.wat @@ -0,0 +1,15 @@ +# +# Makefile for WATCOM +# +# Created by Julian Smart, January 1999 +# +# + +WXDIR = $(%WXWIN) + +PROGRAM = test +OBJECTS = $(PROGRAM).obj + +!include $(WXDIR)\src\makeprog.wat + + diff --git a/samples/treelay/mondrian.ico b/samples/treelay/mondrian.ico new file mode 100644 index 0000000000..2310c5d275 Binary files /dev/null and b/samples/treelay/mondrian.ico differ diff --git a/samples/treelay/test.cpp b/samples/treelay/test.cpp new file mode 100644 index 0000000000..1434cf2d5c --- /dev/null +++ b/samples/treelay/test.cpp @@ -0,0 +1,202 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: test.cpp +// Purpose: wxTreeLayout sample +// Author: Julian Smart +// Modified by: +// Created: 7/4/98 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// For compilers that support precompilation, includes "wx.h". +#include + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include +#endif + +#include + +#include "test.h" + +wxStoredTree *myTree = NULL; + +// A macro needed for some compilers (AIX) that need 'main' to be defined +// in the application itself. +IMPLEMENT_APP(MyApp) + +// The `main program' equivalent, creating the windows and returning the +// main frame +bool MyApp::OnInit() +{ + // Create the main frame window + MyFrame* frame = new MyFrame(NULL, "Tree Test", wxPoint(-1, -1), wxSize(400, 550)); + + // Give it a status line + frame->CreateStatusBar(2); + + // Give it an icon +#ifdef __WINDOWS__ + wxIcon icon("tree_icn"); + frame->SetIcon(icon); +#endif + + // Make a menubar + wxMenu *file_menu = new wxMenu; + file_menu->Append(TEST_LEFT_RIGHT, "&Left to right", "Redraw left to right"); + file_menu->Append(TEST_TOP_BOTTOM, "&Top to bottom", "Redraw top to bottom"); + file_menu->AppendSeparator(); + file_menu->Append(TEST_QUIT, "E&xit", "Quit program"); + + wxMenu *help_menu = new wxMenu; + help_menu->Append(TEST_ABOUT, "&About", "About Tree Test"); + + wxMenuBar* menu_bar = new wxMenuBar; + + menu_bar->Append(file_menu, "&File"); + menu_bar->Append(help_menu, "&Help"); + + // Associate the menu bar with the frame + frame->SetMenuBar(menu_bar); + + MyCanvas *canvas = new MyCanvas(frame); + + // Give it scrollbars: the virtual canvas is 20 * 50 = 1000 pixels in each direction + canvas->SetScrollbars(20, 20, 50, 50); + frame->canvas = canvas; + + myTree = new wxStoredTree(); + + wxClientDC dc(canvas); + wxFont font(10, wxROMAN, wxNORMAL, wxBOLD); + dc.SetFont(font); + TreeTest(*myTree, dc); + + frame->Show(TRUE); + + frame->SetStatusText("Hello, tree!"); + + // Return the main frame window + return TRUE; +} + +void MyApp::TreeTest(wxStoredTree& tree, wxDC& dc) +{ + tree.Initialize(200); + + tree.AddChild("animal"); + tree.AddChild("mammal", "animal"); + tree.AddChild("insect", "animal"); + tree.AddChild("bird", "animal"); + + tree.AddChild("man", "mammal"); + tree.AddChild("cat", "mammal"); + tree.AddChild("dog", "mammal"); + tree.AddChild("giraffe", "mammal"); + tree.AddChild("elephant", "mammal"); + tree.AddChild("donkey", "mammal"); + tree.AddChild("horse", "mammal"); + + tree.AddChild("fido", "dog"); + tree.AddChild("domestic cat", "cat"); + tree.AddChild("lion", "cat"); + tree.AddChild("tiger", "cat"); + tree.AddChild("felix", "domestic cat"); + tree.AddChild("socks", "domestic cat"); + + tree.AddChild("beetle", "insect"); + tree.AddChild("earwig", "insect"); + tree.AddChild("eagle", "bird"); + tree.AddChild("bluetit", "bird"); + tree.AddChild("sparrow", "bird"); + tree.AddChild("blackbird", "bird"); + tree.AddChild("emu", "bird"); + tree.AddChild("crow", "bird"); + + tree.DoLayout(dc); +} + +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU(TEST_QUIT, MyFrame::OnQuit) + EVT_MENU(TEST_ABOUT, MyFrame::OnAbout) + EVT_MENU(TEST_LEFT_RIGHT, MyFrame::OnLeftRight) + EVT_MENU(TEST_TOP_BOTTOM, MyFrame::OnTopBottom) + EVT_CLOSE(MyFrame::OnCloseWindow) +END_EVENT_TABLE() + +// Define my frame constructor +MyFrame::MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size): + wxFrame(parent, -1, title, pos, size) +{ +} + +void MyFrame::OnQuit(wxCommandEvent& event) +{ + Close(TRUE); +} + +void MyFrame::OnLeftRight(wxCommandEvent& event) +{ + if (myTree) + { + myTree->SetOrientation(FALSE); + wxClientDC dc(canvas); + wxFont font(10, wxROMAN, wxNORMAL, wxBOLD); + dc.SetFont(font); + wxGetApp().TreeTest(*myTree, dc); + canvas->Refresh(); + } +} + +void MyFrame::OnTopBottom(wxCommandEvent& event) +{ + if (myTree) + { + myTree->SetOrientation(TRUE); + wxClientDC dc(canvas); + wxFont font(10, wxROMAN, wxNORMAL, wxBOLD); + dc.SetFont(font); + wxGetApp().TreeTest(*myTree, dc); + canvas->Refresh(); + } +} + +void MyFrame::OnAbout(wxCommandEvent& event) +{ + (void)wxMessageBox("wxWindows tree library demo Vsn 2.0\nAuthor: Julian Smart (c) 1998", "About tree test"); +} + +void MyFrame::OnCloseWindow(wxCloseEvent& event) +{ + Destroy(); +} + +BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) + EVT_PAINT(MyCanvas::OnPaint) +END_EVENT_TABLE() + +// Define a constructor for my canvas +MyCanvas::MyCanvas(wxWindow *parent): + wxScrolledWindow(parent, -1) +{ + SetBackgroundColour(*wxWHITE); +} + +// Define the repainting behaviour +void MyCanvas::OnPaint(wxPaintEvent& event) +{ + wxPaintDC dc(this); + PrepareDC(dc); + if (myTree) + { + wxFont font(10, wxROMAN, wxNORMAL, wxBOLD); + dc.SetFont(font); + myTree->Draw(dc); + } +} + diff --git a/samples/treelay/test.def b/samples/treelay/test.def new file mode 100644 index 0000000000..558ccc1235 --- /dev/null +++ b/samples/treelay/test.def @@ -0,0 +1,8 @@ +NAME Test +DESCRIPTION 'Tree Test' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 1024 +STACKSIZE 16192 diff --git a/samples/treelay/test.h b/samples/treelay/test.h new file mode 100644 index 0000000000..b00660744e --- /dev/null +++ b/samples/treelay/test.h @@ -0,0 +1,54 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: test.h +// Purpose: wxTreeLayout sample +// Author: Julian Smart +// Modified by: +// Created: 7/4/98 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +// Define a new application +class MyApp: public wxApp +{ + public: + bool OnInit(); + void TreeTest(wxStoredTree& tree, wxDC& dc); +}; + +DECLARE_APP(MyApp) + +class MyCanvas; + +class MyFrame: public wxFrame +{ + public: + MyCanvas *canvas; + MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size); + + void OnCloseWindow(wxCloseEvent& event); + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnLeftRight(wxCommandEvent& event); + void OnTopBottom(wxCommandEvent& event); + +DECLARE_EVENT_TABLE() +}; + +// Define a new canvas which can receive some events +class MyCanvas: public wxScrolledWindow +{ + public: + MyCanvas(wxWindow *frame); + void OnPaint(wxPaintEvent& event); + void OnEvent(wxMouseEvent& event); + void OnChar(wxKeyEvent& event); +DECLARE_EVENT_TABLE() +}; + +#define TEST_QUIT 1 +#define TEST_ABOUT 2 +#define TEST_LEFT_RIGHT 3 +#define TEST_TOP_BOTTOM 4 + diff --git a/samples/treelay/test.rc b/samples/treelay/test.rc new file mode 100644 index 0000000000..41e6896e8e --- /dev/null +++ b/samples/treelay/test.rc @@ -0,0 +1,3 @@ +tree_icn ICON "mondrian.ico" +#include "wx/msw/wx.rc" + diff --git a/src/generic/treelay.cpp b/src/generic/treelay.cpp new file mode 100644 index 0000000000..35496a9d7d --- /dev/null +++ b/src/generic/treelay.cpp @@ -0,0 +1,446 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: treelay.h +// Purpose: wxTreeLayout class +// Author: Julian Smart +// Modified by: +// Created: 7/4/98 +// RCS-ID: $Id$ +// Copyright: (c) 1998 Julian Smart +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ +#pragma implementation "wxtree.h" +#endif + +// For compilers that support precompilation, includes "wx.h". +#include + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include +#endif + +#if wxUSE_TREELAYOUT + +#include + +/* + * Abstract tree + * + */ + +IMPLEMENT_ABSTRACT_CLASS(wxTreeLayout, wxObject) + +wxTreeLayout::wxTreeLayout() +{ + m_xSpacing = 16; + m_ySpacing = 20; + m_topMargin = 5; + m_leftMargin = 5; + m_orientation = FALSE; + m_parentNode = 0; +} + +void wxTreeLayout::DoLayout(wxDC& dc, long topId) +{ + if (topId != -1) + SetTopNode(topId); + + long actualTopId = GetTopNode(); + long id = actualTopId; + while (id != -1) + { + SetNodeX(id, 0); + SetNodeY(id, 0); + ActivateNode(id, FALSE); + id = GetNextNode(id); + } + m_lastY = m_topMargin; + m_lastX = m_leftMargin; + CalcLayout(actualTopId, 0, dc); +} + +void wxTreeLayout::Draw(wxDC& dc) +{ + dc.Clear(); + DrawBranches(dc); + DrawNodes(dc); +} + +void wxTreeLayout::DrawNodes(wxDC& dc) +{ + long id = GetTopNode(); + while (id != -1) + { + if (NodeActive(id)) + DrawNode(id, dc); + id = GetNextNode(id); + } +} + +void wxTreeLayout::DrawBranches(wxDC& dc) +{ + long id = GetTopNode(); + while (id != -1) + { + if (GetNodeParent(id) > -1) + { + long parent = GetNodeParent(id); + if (NodeActive(parent)) + DrawBranch(parent, id, dc); + } + id = GetNextNode(id); + } +} + +void wxTreeLayout::DrawNode(long id, wxDC& dc) +{ + char buf[80]; + wxString name(GetNodeName(id)); + if (name != "") + sprintf(buf, "%s", (const char*) name); + else + sprintf(buf, ""); + + long x = 80; + long y = 20; + dc.GetTextExtent(buf, &x, &y); + dc.DrawText(buf, GetNodeX(id), (long)(GetNodeY(id) - (y/2.0))); +} + +void wxTreeLayout::DrawBranch(long from, long to, wxDC& dc) +{ + long w, h; + GetNodeSize(from, &w, &h, dc); + dc.DrawLine(GetNodeX(from)+w, GetNodeY(from), + GetNodeX(to), GetNodeY(to)); +} + +void wxTreeLayout::Initialize(void) +{ +} + +void wxTreeLayout::GetNodeSize(long id, long *x, long *y, wxDC& dc) +{ + wxString name(GetNodeName(id)); + if (name != "") + dc.GetTextExtent(name, x, y); + else + { + *x = 70; *y = 20; + } +} + +void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc) +{ + wxList children; + GetChildren(nodeId, children); + int n = children.Number(); + + if (m_orientation == FALSE) + { + // Left to right + // X Calculations + if (level == 0) + SetNodeX(nodeId, m_leftMargin); + else + { + long x = 0; + long y = 0; + long parentId = GetNodeParent(nodeId); + if (parentId != -1) + GetNodeSize(parentId, &x, &y, dc); + SetNodeX(nodeId, (long)(GetNodeX(parentId) + m_xSpacing + x)); + } + + wxNode *node = children.First(); + while (node) + { + CalcLayout((long)node->Data(), level+1, dc); + node = node->Next(); + } + + // Y Calculations + long averageY; + ActivateNode(nodeId, TRUE); + + if (n > 0) + { + averageY = 0; + node = children.First(); + while (node) + { + averageY += GetNodeY((long)node->Data()); + node = node->Next(); + } + averageY = averageY / n; + SetNodeY(nodeId, averageY); + } + else + { + SetNodeY(nodeId, m_lastY); + long x, y; + GetNodeSize(nodeId, &x, &y, dc); + + m_lastY = m_lastY + y + m_ySpacing; + } + } + else + { + // Top to bottom + + // Y Calculations + if (level == 0) + SetNodeY(nodeId, m_topMargin); + else + { + long x = 0; + long y = 0; + long parentId = GetNodeParent(nodeId); + if (parentId != -1) + GetNodeSize(parentId, &x, &y, dc); + SetNodeY(nodeId, (long)(GetNodeY(parentId) + m_ySpacing + y)); + } + + wxNode *node = children.First(); + while (node) + { + CalcLayout((long)node->Data(), level+1, dc); + node = node->Next(); + } + + // X Calculations + long averageX; + ActivateNode(nodeId, TRUE); + + if (n > 0) + { + averageX = 0; + node = children.First(); + while (node) + { + averageX += GetNodeX((long)node->Data()); + node = node->Next(); + } + averageX = averageX / n; + SetNodeX(nodeId, averageX); + } + else + { + SetNodeX(nodeId, m_lastX); + long x, y; + GetNodeSize(nodeId, &x, &y, dc); + + m_lastX = m_lastX + x + m_xSpacing; + } + } +} + +/* + * Tree with storage + * + */ + +IMPLEMENT_DYNAMIC_CLASS(wxLayoutTreeStored, wxTreeLayout) + +wxLayoutTreeStored::wxLayoutTreeStored(int n):wxTreeLayout() +{ + m_nodes = NULL; + m_maxNodes = 0; + Initialize(n); +} + +wxLayoutTreeStored::~wxLayoutTreeStored(void) +{ + if (m_nodes) + delete[] m_nodes; +} + +void wxLayoutTreeStored::Initialize(int n) +{ + m_maxNodes = n; + wxTreeLayout::Initialize(); + if (m_nodes) delete[] m_nodes; + m_nodes = new wxStoredNode[m_maxNodes]; + int i; + for (i = 0; i < n; i++) + { + m_nodes[i].m_name = ""; + m_nodes[i].m_active = FALSE; + m_nodes[i].m_parentId = -1; + m_nodes[i].m_x = 0; + m_nodes[i].m_y = 0; + } + m_num = 0; +} + +long wxLayoutTreeStored::AddChild(const wxString& name, const wxString& parent) +{ + if (m_num < (m_maxNodes -1 )) + { + long i = -1; + if (parent != "") + i = NameToId(parent); + else m_parentNode = m_num; + + m_nodes[m_num].m_parentId = i; + m_nodes[m_num].m_name = name; + m_nodes[m_num].m_x = m_nodes[m_num].m_y = 0; + m_nodes[m_num].m_clientData = 0; + m_num ++; + + return (m_num - 1); + } + else + return -1; +} + +long wxLayoutTreeStored::NameToId(const wxString& name) +{ + long i; + for (i = 0; i < m_num; i++) + if (name == m_nodes[i].m_name) + return i; + return -1; +} + +void wxLayoutTreeStored::GetChildren(long id, wxList& list) +{ + long currentId = GetTopNode(); + while (currentId != -1) + { + if (id == GetNodeParent(currentId)) + list.Append((wxObject *)currentId); + currentId = GetNextNode(currentId); + } +} + +wxStoredNode* wxLayoutTreeStored::GetNode(long idx) const +{ + wxASSERT(idx < m_num); + + return &m_nodes[idx]; +}; + +long wxLayoutTreeStored::GetNodeX(long id) +{ + wxASSERT(id < m_num); + + return (long)m_nodes[id].m_x; +} + +long wxLayoutTreeStored::GetNodeY(long id) +{ + wxASSERT(id < m_num); + + return (long)m_nodes[id].m_y; +} + +void wxLayoutTreeStored::SetNodeX(long id, long x) +{ + wxASSERT(id < m_num); + + m_nodes[id].m_x = (int)x; +} + +void wxLayoutTreeStored::SetNodeY(long id, long y) +{ + wxASSERT(id < m_num); + + m_nodes[id].m_y = (int)y; +} + +void wxLayoutTreeStored::SetNodeName(long id, const wxString& name) +{ + wxASSERT(id < m_num); + + m_nodes[id].m_name = name; +} + +wxString wxLayoutTreeStored::GetNodeName(long id) +{ + wxASSERT(id < m_num); + + return m_nodes[id].m_name; +} + +long wxLayoutTreeStored::GetNodeParent(long id) +{ + if (id != -1) + { + wxASSERT(id < m_num); + + return m_nodes[id].m_parentId; + } + else + return -1; +} + +long wxLayoutTreeStored::GetNextNode(long id) +{ + wxASSERT(id < m_num); + + if ((id != -1) && (id < (m_num - 1))) + return id + 1; + else + return -1; +} + +void wxLayoutTreeStored::SetClientData(long id, long clientData) +{ + wxASSERT(id < m_num); + + m_nodes[id].m_clientData = clientData; +} + +long wxLayoutTreeStored::GetClientData(long id) const +{ + wxASSERT(id < m_num); + + return m_nodes[id].m_clientData; +} + +void wxLayoutTreeStored::ActivateNode(long id, bool active) +{ + wxASSERT(id < m_num); + + m_nodes[id].m_active = active; +} + +bool wxLayoutTreeStored::NodeActive(long id) +{ + wxASSERT(id < m_num); + + return m_nodes[id].m_active; +} + +wxString wxLayoutTreeStored::HitTest(wxMouseEvent& event, wxDC& dc) +{ + wxPoint pt = event.GetPosition(); + wxCoord x = pt.x; + wxCoord y = pt.y; + + int i; + for (i = 0; i < m_maxNodes; i++) + { + wxStoredNode* item = &m_nodes[i]; + + long width, height; + dc.GetTextExtent(m_nodes[i].m_name, &width, &height); + + if ( (x >= (m_nodes[i].m_x-10)) && (x < (m_nodes[i].m_x + width+10)) && + (y >= m_nodes[i].m_y-10) && (y < (m_nodes[i].m_y + height+10)) ) + { + return m_nodes[i].m_name; + } + } + + return wxString(""); +} + +#endif + // wxUSE_TREELAYOUT diff --git a/src/msw/makefile.b32 b/src/msw/makefile.b32 index 5259b6be0a..9429f461a0 100644 --- a/src/msw/makefile.b32 +++ b/src/msw/makefile.b32 @@ -1,6 +1,6 @@ -# This file was automatically generated by tmake at 15:17, 2000/02/27 +# This file was automatically generated by tmake at 12:24, 2000/02/28 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T! # @@ -98,6 +98,7 @@ GENERICOBJS= $(MSWDIR)\busyinfo.obj \ $(MSWDIR)\tbarsmpl.obj \ $(MSWDIR)\textdlgg.obj \ $(MSWDIR)\tipdlg.obj \ + $(MSWDIR)\treelay.obj \ $(MSWDIR)\wizard.obj # Not needed: @@ -827,6 +828,8 @@ $(MSWDIR)\textdlgg.obj: $(GENDIR)\textdlgg.$(SRCSUFF) $(MSWDIR)\tipdlg.obj: $(GENDIR)\tipdlg.$(SRCSUFF) +$(MSWDIR)\treelay.obj: $(GENDIR)\treelay.$(SRCSUFF) + $(MSWDIR)\wizard.obj: $(GENDIR)\wizard.$(SRCSUFF) diff --git a/src/msw/makefile.bcc b/src/msw/makefile.bcc index 161d261176..d647a8395b 100644 --- a/src/msw/makefile.bcc +++ b/src/msw/makefile.bcc @@ -1,6 +1,6 @@ -# This file was automatically generated by tmake at 15:18, 2000/02/27 +# This file was automatically generated by tmake at 12:24, 2000/02/28 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T! # @@ -99,6 +99,7 @@ GENERICOBJS= $(MSWDIR)\busyinfo.obj \ $(MSWDIR)\textdlgg.obj \ $(MSWDIR)\tipdlg.obj \ $(MSWDIR)\treectrl.obj \ + $(MSWDIR)\treelay.obj \ $(MSWDIR)\wizard.obj COMMONOBJS = \ @@ -692,6 +693,8 @@ $(MSWDIR)\tipdlg.obj: $(GENDIR)\tipdlg.$(SRCSUFF) $(MSWDIR)\treectrl.obj: $(GENDIR)\treectrl.$(SRCSUFF) +$(MSWDIR)\treelay.obj: $(GENDIR)\treelay.$(SRCSUFF) + $(MSWDIR)\wizard.obj: $(GENDIR)\wizard.$(SRCSUFF) diff --git a/src/msw/makefile.dos b/src/msw/makefile.dos index 8b00c315cc..970f679626 100644 --- a/src/msw/makefile.dos +++ b/src/msw/makefile.dos @@ -84,6 +84,7 @@ GENERICOBJS= $(GENDIR)\busyinfo.obj \ $(GENDIR)\textdlgg.obj \ $(GENDIR)\tipdlg.obj \ $(GENDIR)\treectrl.obj \ + $(GENDIR)\treelay.obj \ $(GENDIR)\wizard.obj # we can't have all objects in one list because the library becomes too big diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95 index 0762df0d7c..1004d5662f 100644 --- a/src/msw/makefile.g95 +++ b/src/msw/makefile.g95 @@ -89,6 +89,7 @@ GENERICOBJS = \ $(GENDIR)/tbarsmpl.$(OBJSUFF) \ $(GENDIR)/textdlgg.$(OBJSUFF) \ $(GENDIR)/tipdlg.$(OBJSUFF) \ + $(GENDIR)/treelay.$(OBJSUFF) \ $(GENDIR)/wizard.$(OBJSUFF) COMMONOBJS = \ diff --git a/src/msw/makefile.vc b/src/msw/makefile.vc index 3ceaa58c47..b5f724b0d0 100644 --- a/src/msw/makefile.vc +++ b/src/msw/makefile.vc @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 15:17, 2000/02/27 +# This file was automatically generated by tmake at 12:24, 2000/02/28 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T! # File: makefile.vc @@ -103,6 +103,7 @@ GENERICOBJS= ..\generic\$D\busyinfo.obj \ ..\generic\$D\tbarsmpl.obj \ ..\generic\$D\textdlgg.obj \ ..\generic\$D\tipdlg.obj \ + ..\generic\$D\treelay.obj \ ..\generic\$D\wizard.obj # These are generic things that don't need to be compiled on MSW, diff --git a/src/msw/makefile.wat b/src/msw/makefile.wat index c2a5bc5448..fbda5947ab 100644 --- a/src/msw/makefile.wat +++ b/src/msw/makefile.wat @@ -1,6 +1,6 @@ #!/binb/wmake.exe -# This file was automatically generated by tmake at 15:18, 2000/02/27 +# This file was automatically generated by tmake at 12:25, 2000/02/28 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T! # @@ -59,6 +59,7 @@ GENERICOBJS= busyinfo.obj & tbarsmpl.obj & textdlgg.obj & tipdlg.obj & + treelay.obj & wizard.obj # These are generic things that don't need to be compiled on MSW, @@ -998,6 +999,9 @@ textdlgg.obj: $(GENDIR)\textdlgg.cpp tipdlg.obj: $(GENDIR)\tipdlg.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< +treelay.obj: $(GENDIR)\treelay.cpp + *$(CCC) $(CPPFLAGS) $(IFLAGS) $< + wizard.obj: $(GENDIR)\wizard.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< diff --git a/src/wxvc.dsp b/src/wxvc.dsp index b95508cacb..6270077de3 100644 --- a/src/wxvc.dsp +++ b/src/wxvc.dsp @@ -592,6 +592,10 @@ SOURCE=.\generic\tipdlg.cpp # End Source File # Begin Source File +SOURCE=.\generic\treelay.cpp +# End Source File +# Begin Source File + SOURCE=.\generic\wizard.cpp # End Source File # End Group diff --git a/src/wxvc_dll.dsp b/src/wxvc_dll.dsp index ee66692879..4a2ff43239 100644 --- a/src/wxvc_dll.dsp +++ b/src/wxvc_dll.dsp @@ -592,6 +592,14 @@ SOURCE=.\generic\textdlgg.cpp SOURCE=.\generic\tipdlg.cpp # End Source File +# Begin Source File + +SOURCE=.\generic\treelay.cpp +# End Source File +# Begin Source File + +SOURCE=.\generic\wizard.cpp +# End Source File # End Group # Begin Group "wxHTML Files" diff --git a/utils/glcanvas/Makefile.in b/utils/glcanvas/Makefile.in deleted file mode 100644 index ac286b6794..0000000000 --- a/utils/glcanvas/Makefile.in +++ /dev/null @@ -1,3 +0,0 @@ -all: - cd @GL_TOOLKIT_DIR@; make - cd samples; make diff --git a/utils/glcanvas/distrib/glcanvas.rsp b/utils/glcanvas/distrib/glcanvas.rsp deleted file mode 100644 index 1c238e484d..0000000000 --- a/utils/glcanvas/distrib/glcanvas.rsp +++ /dev/null @@ -1,40 +0,0 @@ -docs/*.* -win/*.cpp -win/*.h -win/make*.* -gtk/*.cpp -gtk/*.h -gtk/make*.* -motif/*.cpp -motif/*.h -motif/*.txt -motif/make*.* -samples/cube/*.cpp -samples/cube/*.h -samples/cube/*.rc -samples/cube/*.ico -samples/cube/*.xbm -samples/cube/make*.* -samples/cube/Makefile -samples/isosurf/*.cpp -samples/isosurf/*.h -samples/isosurf/*.rc -samples/isosurf/*.ico -samples/isosurf/*.xbm -samples/isosurf/*.dat -samples/isosurf/*.dat.gz -samples/isosurf/make*.* -samples/isosurf/Makefile -samples/penguin/*.cpp -samples/penguin/*.c -samples/penguin/*.h -samples/penguin/*.rc -samples/penguin/*.ico -samples/penguin/*.xbm -samples/penguin/*.xpm -samples/penguin/make*.* -samples/penguin/penguin.lwo -samples/penguin/Makefile - - - diff --git a/utils/glcanvas/distrib/zipsrc.bat b/utils/glcanvas/distrib/zipsrc.bat deleted file mode 100755 index 74029e3967..0000000000 --- a/utils/glcanvas/distrib/zipsrc.bat +++ /dev/null @@ -1,27 +0,0 @@ -@echo off -rem Zip up an external source distribution of GLCanvas -set src=%1 -set dest=%2 -if "%src" == "" set src=%WXWIN\utils\glcanvas -if "%dest" == "" set dest=%WXWIN\utils\glcanvas\deliver -echo About to archive an external GLCanvas distribution: -echo From %src -echo To %dest\glcanvas.zip -echo CTRL-C if this is not correct. -inkey /W10 `Press any key to continue...` %%input - -erase %dest\glcanvas.zip -cd %src - -zip32 -@ %dest\glcanvas.zip < %src\distrib\glcanvas.rsp - -echo GLCanvas archived. -goto end - -:usage -echo GLCanvas distribution. -echo Usage: zipsrc source destination - -:end - - diff --git a/utils/glcanvas/docs/notes.txt b/utils/glcanvas/docs/notes.txt deleted file mode 100644 index 7bcb165caf..0000000000 --- a/utils/glcanvas/docs/notes.txt +++ /dev/null @@ -1,5 +0,0 @@ -wxGLCanvas ----------- - -No known issues, though probably palettes aren't correctly -handled under Windows. They are ignored under GTK. diff --git a/utils/glcanvas/gtk/.cvsignore b/utils/glcanvas/gtk/.cvsignore deleted file mode 100644 index 4646a42c35..0000000000 --- a/utils/glcanvas/gtk/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Linux -linux-gnu -linux diff --git a/utils/glcanvas/gtk/Makefile.in b/utils/glcanvas/gtk/Makefile.in deleted file mode 100644 index 907fe3ad61..0000000000 --- a/utils/glcanvas/gtk/Makefile.in +++ /dev/null @@ -1,22 +0,0 @@ -# -# File: Makefile -# Author: Robert Roebling -# Created: 1999 -# Updated: -# Copyright: (c) 1998 Robert Roebling -# -# "%W% %G%" -# -# Makefile for wxMultiMedia (UNIX). - -top_srcdir = @top_srcdir@/.. -top_builddir = ../../.. - -VPATH= $(top_srcdir)/utils/glcanvas/gtk - -LIBTARGET=libwxglcanvas - -OBJECTS=glcanvas.o - -include $(top_builddir)/src/makelib.env - diff --git a/utils/glcanvas/gtk/glcanvas.cpp b/utils/glcanvas/gtk/glcanvas.cpp deleted file mode 100644 index 68552f1b16..0000000000 --- a/utils/glcanvas/gtk/glcanvas.cpp +++ /dev/null @@ -1,424 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: glcanvas.cpp -// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK -// Author: Robert Roebling -// Modified by: -// Created: 17/08/98 -// RCS-ID: $Id$ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "glcanvas.h" -#endif - -#include "glcanvas.h" - -#include "wx/frame.h" -#include "wx/colour.h" -#include "wx/module.h" -#include "wx/app.h" - -extern "C" { -#include "gtk/gtk.h" -#include "gdk/gdk.h" -#include "gdk/gdkx.h" -} - -#include "wx/gtk/win_gtk.h" - -//--------------------------------------------------------------------------- -// global data -//--------------------------------------------------------------------------- - -XVisualInfo *g_vi = (XVisualInfo*) NULL; - -//----------------------------------------------------------------------------- -// idle system -//----------------------------------------------------------------------------- - -extern void wxapp_install_idle_handler(); -extern bool g_isIdle; - -//--------------------------------------------------------------------------- -// wxGLContext -//--------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxGLContext,wxObject) - -wxGLContext::wxGLContext( bool WXUNUSED(isRGB), wxWindow *win, const wxPalette& WXUNUSED(palette) ) -{ - m_window = win; - m_widget = win->m_wxwindow; - - wxGLCanvas *gc = (wxGLCanvas*) win; - XVisualInfo *vi = (XVisualInfo *) gc->m_vi; - - wxCHECK_RET( vi, "invalid visual for OpenGl" ); - - m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE ); - - wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); -} - -wxGLContext::wxGLContext( - bool WXUNUSED(isRGB), wxWindow *win, - const wxPalette& WXUNUSED(palette), - const wxGLContext *other /* for sharing display lists */ -) -{ - m_window = win; - m_widget = win->m_wxwindow; - - wxGLCanvas *gc = (wxGLCanvas*) win; - XVisualInfo *vi = (XVisualInfo *) gc->m_vi; - - wxCHECK_RET( vi, "invalid visual for OpenGl" ); - - if( other != 0 ) - m_glContext = glXCreateContext( GDK_DISPLAY(), vi, other->m_glContext, GL_TRUE ); - else - m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE ); - - wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); -} - -wxGLContext::~wxGLContext() -{ - if (!m_glContext) return; - - if (m_glContext == glXGetCurrentContext()) - { - glXMakeCurrent( GDK_DISPLAY(), None, NULL); - } - - glXDestroyContext( GDK_DISPLAY(), m_glContext ); -} - -void wxGLContext::SwapBuffers() -{ - if (m_glContext) - { - GdkWindow *window = GTK_PIZZA(m_widget)->bin_window; - glXSwapBuffers( GDK_DISPLAY(), GDK_WINDOW_XWINDOW( window ) ); - } -} - -void wxGLContext::SetCurrent() -{ - if (m_glContext) - { - GdkWindow *window = GTK_PIZZA(m_widget)->bin_window; - glXMakeCurrent( GDK_DISPLAY(), GDK_WINDOW_XWINDOW(window), m_glContext ); - } -} - -void wxGLContext::SetColour(const char *colour) -{ - float r = 0.0; - float g = 0.0; - float b = 0.0; - wxColour *col = wxTheColourDatabase->FindColour(colour); - if (col) - { - r = (float)(col->Red()/256.0); - g = (float)(col->Green()/256.0); - b = (float)(col->Blue()/256.0); - glColor3f( r, g, b); - } -} - -void wxGLContext::SetupPixelFormat() -{ -} - -void wxGLContext::SetupPalette( const wxPalette& WXUNUSED(palette) ) -{ -} - -wxPalette wxGLContext::CreateDefaultPalette() -{ - return wxNullPalette; -} - -//----------------------------------------------------------------------------- -// "realize" from m_wxwindow -//----------------------------------------------------------------------------- - -static gint -gtk_glwindow_realized_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) -{ - wxGLContext *share= win->m_sharedContext; - if (share==NULL && win->m_sharedContextOf) share=win->m_sharedContextOf->GetContext(); - - win->m_glContext = new wxGLContext( TRUE, win, wxNullPalette, share ); - - return FALSE; -} - -//----------------------------------------------------------------------------- -// "map" from m_wxwindow -//----------------------------------------------------------------------------- - -static gint -gtk_glwindow_map_callback( GtkWidget * WXUNUSED(widget), wxGLCanvas *win ) -{ - if (win->m_glContext/* && win->m_exposed*/) - { - wxPaintEvent event( win->GetId() ); - event.SetEventObject( win ); - win->GetEventHandler()->ProcessEvent( event ); - - win->m_exposed = FALSE; - win->GetUpdateRegion().Clear(); - } - - return FALSE; -} - -//----------------------------------------------------------------------------- -// "expose_event" of m_wxwindow -//----------------------------------------------------------------------------- - -static void -gtk_glwindow_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxGLCanvas *win ) -{ - if (g_isIdle) - wxapp_install_idle_handler(); - - win->m_exposed = TRUE; - - win->GetUpdateRegion().Union( gdk_event->area.x, - gdk_event->area.y, - gdk_event->area.width, - gdk_event->area.height ); -} - -//----------------------------------------------------------------------------- -// "draw" of m_wxwindow -//----------------------------------------------------------------------------- - -static void -gtk_glwindow_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxGLCanvas *win ) -{ - if (g_isIdle) - wxapp_install_idle_handler(); - - win->m_exposed = TRUE; - - win->GetUpdateRegion().Union( rect->x, rect->y, - rect->width, rect->height ); -} - -//----------------------------------------------------------------------------- -// "size_allocate" of m_wxwindow -//----------------------------------------------------------------------------- - -static void -gtk_glcanvas_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxGLCanvas *win ) -{ - if (g_isIdle) - wxapp_install_idle_handler(); - - if (!win->m_hasVMT) - return; - - wxSizeEvent event( wxSize(win->m_width,win->m_height), win->GetId() ); - event.SetEventObject( win ); - win->GetEventHandler()->ProcessEvent( event ); -} - -//--------------------------------------------------------------------------- -// wxGlCanvas -//--------------------------------------------------------------------------- - -IMPLEMENT_CLASS(wxGLCanvas, wxScrolledWindow) - -BEGIN_EVENT_TABLE(wxGLCanvas, wxScrolledWindow) - EVT_SIZE(wxGLCanvas::OnSize) -END_EVENT_TABLE() - -wxGLCanvas::wxGLCanvas( wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette ) -{ - Create( parent, NULL, NULL, id, pos, size, style, name, attribList, palette ); -} - -wxGLCanvas::wxGLCanvas( wxWindow *parent, - const wxGLContext *shared, - wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette ) -{ - Create( parent, shared, NULL, id, pos, size, style, name, attribList, palette ); -} - -wxGLCanvas::wxGLCanvas( wxWindow *parent, - const wxGLCanvas *shared, - wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette ) -{ - Create( parent, NULL, shared, id, pos, size, style, name, attribList, palette ); -} - -bool wxGLCanvas::Create( wxWindow *parent, - const wxGLContext *shared, - const wxGLCanvas *shared_context_of, - wxWindowID id, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name, - int *attribList, - const wxPalette& palette) -{ - m_sharedContext = (wxGLContext*)shared; // const_cast - m_sharedContextOf = (wxGLCanvas*)shared_context_of; // const_cast - m_glContext = (wxGLContext*) NULL; - - m_exposed = FALSE; - m_noExpose = TRUE; - m_nativeSizeEvent = TRUE; - - if (!attribList) - { - int data[] = { GLX_RGBA, - GLX_DOUBLEBUFFER, - GLX_DEPTH_SIZE, 1, // use largest available depth buffer - GLX_RED_SIZE, 1, - GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, - GLX_ALPHA_SIZE, 0, - None }; - attribList = (int*) data; - } - else - { - int data[512], arg=0, p=0; - - while( (attribList[arg]!=0) && (p<512) ) - { - switch( attribList[arg++] ) - { - case WX_GL_RGBA: data[p++] = GLX_RGBA; break; - case WX_GL_DOUBLEBUFFER: data[p++] = GLX_DOUBLEBUFFER; break; - case WX_GL_DEPTH_SIZE: - data[p++]=GLX_DEPTH_SIZE; data[p++]=attribList[arg++]; break; - case WX_GL_MIN_RED: - data[p++]=GLX_RED_SIZE; data[p++]=attribList[arg++]; break; - case WX_GL_MIN_GREEN: - data[p++]=GLX_GREEN_SIZE; data[p++]=attribList[arg++]; break; - case WX_GL_MIN_BLUE: - data[p++]=GLX_BLUE_SIZE; data[p++]=attribList[arg++]; break; - default: - break; - } - } - data[p] = 0; - - attribList = (int*) data; - } - - - Display *dpy = GDK_DISPLAY(); - - XVisualInfo *vi = glXChooseVisual( dpy, DefaultScreen(dpy), attribList ); - - m_vi = vi; // safe for later use - - wxCHECK_MSG( m_vi, FALSE, "required visual couldn't be found" ); - - GdkVisual *visual = gdkx_visual_get( vi->visualid ); - GdkColormap *colormap = gdk_colormap_new( gdkx_visual_get(vi->visualid), TRUE ); - - gtk_widget_push_colormap( colormap ); - gtk_widget_push_visual( visual ); - - wxScrolledWindow::Create( parent, id, pos, size, style, name ); - - m_glWidget = m_wxwindow; - - gtk_pizza_set_clear( GTK_PIZZA(m_wxwindow), FALSE ); - - gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize", - GTK_SIGNAL_FUNC(gtk_glwindow_realized_callback), (gpointer) this ); - - gtk_signal_connect( GTK_OBJECT(m_wxwindow), "map", - GTK_SIGNAL_FUNC(gtk_glwindow_map_callback), (gpointer) this ); - - gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", - GTK_SIGNAL_FUNC(gtk_glwindow_expose_callback), (gpointer)this ); - - gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", - GTK_SIGNAL_FUNC(gtk_glwindow_draw_callback), (gpointer)this ); - - gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", - GTK_SIGNAL_FUNC(gtk_glcanvas_size_callback), (gpointer)this ); - - gtk_widget_pop_visual(); - gtk_widget_pop_colormap(); - - return TRUE; -} - -wxGLCanvas::~wxGLCanvas() -{ - XVisualInfo *vi = (XVisualInfo *) m_vi; - - if (vi) XFree( vi ); - if (m_glContext) delete m_glContext; -} - -void wxGLCanvas::SwapBuffers() -{ - if (m_glContext) m_glContext->SwapBuffers(); -} - -void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event)) -{ - int width, height; - GetClientSize( &width, &height ); - - if (m_glContext && GTK_WIDGET_REALIZED(m_glWidget) ) - { - SetCurrent(); - - glViewport(0, 0, (GLint)width, (GLint)height ); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 ); - glMatrixMode(GL_MODELVIEW); - } -} - -void wxGLCanvas::SetCurrent() -{ - if (m_glContext) m_glContext->SetCurrent(); -} - -void wxGLCanvas::SetColour( const char *colour ) -{ - if (m_glContext) m_glContext->SetColour( colour ); -} - -void wxGLCanvas::OnInternalIdle() -{ - if (m_glContext && m_exposed) - { - wxPaintEvent event( GetId() ); - event.SetEventObject( this ); - GetEventHandler()->ProcessEvent( event ); - - m_exposed = FALSE; - GetUpdateRegion().Clear(); - } - - wxWindow::OnInternalIdle(); -} diff --git a/utils/glcanvas/gtk/glcanvas.h b/utils/glcanvas/gtk/glcanvas.h deleted file mode 100644 index b67e1ba7c8..0000000000 --- a/utils/glcanvas/gtk/glcanvas.h +++ /dev/null @@ -1,161 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: glcanvas.h -// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK -// Author: Robert Roebling -// Modified by: -// Created: 17/8/98 -// RCS-ID: $Id$ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma interface "glcanvas.h" -#endif - -#ifndef _WX_GLCANVAS_H_ -#define _WX_GLCANVAS_H_ - -#include "wx/defs.h" -#include "wx/scrolwin.h" - -extern "C" { -#include "GL/gl.h" -#include "GL/glx.h" -#include "GL/glu.h" -} - -//--------------------------------------------------------------------------- -// Constants for attriblist -//--------------------------------------------------------------------------- - -enum -{ - WX_GL_RGBA=1, /* use true color palette */ - WX_GL_DEPTH_SIZE, /* bits for Z-buffer (0,16,32) */ - WX_GL_DOUBLEBUFFER, /* use doublebuffer */ - WX_GL_MIN_RED, /* use red buffer with most bits (> MIN_RED bits) */ - WX_GL_MIN_GREEN, /* use green buffer with most bits (> MIN_GREEN bits) */ - WX_GL_MIN_BLUE /* use blue buffer with most bits (> MIN_BLUE bits) */ -/* these are enough constants for now, the remaining will be added later */ -}; - -//--------------------------------------------------------------------------- -// classes -//--------------------------------------------------------------------------- - -class wxGLContext; -class wxGLCanvas; - -//--------------------------------------------------------------------------- -// wxGLContext -//--------------------------------------------------------------------------- - - -class wxGLContext: public wxObject -{ -public: - wxGLContext( bool isRGB, wxWindow *win, const wxPalette& palette = wxNullPalette ); - wxGLContext( - bool WXUNUSED(isRGB), wxWindow *win, - const wxPalette& WXUNUSED(palette), - const wxGLContext *other /* for sharing display lists */ - ); - ~wxGLContext(); - - void SetCurrent(); - void SetColour(const char *colour); - void SwapBuffers(); - - void SetupPixelFormat(); - void SetupPalette(const wxPalette& palette); - wxPalette CreateDefaultPalette(); - - inline wxPalette* GetPalette() const { return (wxPalette*) & m_palette; } - inline wxWindow* GetWindow() const { return m_window; } - inline GtkWidget* GetWidget() const { return m_widget; } - inline GLXContext GetContext() const { return m_glContext; } - -public: - GLXContext m_glContext; - - GtkWidget *m_widget; - wxPalette m_palette; - wxWindow* m_window; - -private: - DECLARE_CLASS(wxGLContext) -}; - -//--------------------------------------------------------------------------- -// wxGLContext -//--------------------------------------------------------------------------- - -class wxGLCanvas: public wxScrolledWindow -{ -public: - inline wxGLCanvas() { - m_glContext = (wxGLContext*) NULL; - m_sharedContext = (wxGLContext*) NULL; - m_glWidget = (GtkWidget*) NULL; - m_vi = (void*) NULL; - m_exposed = FALSE; - } - wxGLCanvas( wxWindow *parent, wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = "GLCanvas", - int *attribList = (int*) NULL, - const wxPalette& palette = wxNullPalette ); - wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL, - wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = "GLCanvas", - int *attribList = (int*) NULL, - const wxPalette& palette = wxNullPalette ); - wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, - wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = "GLCanvas", - int *attribList = (int*) NULL, - const wxPalette& palette = wxNullPalette ); - - bool Create( wxWindow *parent, - const wxGLContext *shared = (wxGLContext*)NULL, - const wxGLCanvas *shared_context_of = (wxGLCanvas*)NULL, - wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = "GLCanvas", - int *attribList = (int*) NULL, - const wxPalette& palette = wxNullPalette ); - - ~wxGLCanvas(); - - void SetCurrent(); - void SetColour(const char *colour); - void SwapBuffers(); - - void OnSize(wxSizeEvent& event); - - void OnInternalIdle(); - - inline wxGLContext* GetContext() const { return m_glContext; } - - // implementation - - wxGLContext *m_glContext, - *m_sharedContext; - wxGLCanvas *m_sharedContextOf; - void *m_vi; - GtkWidget *m_glWidget; - bool m_exposed; - -private: - DECLARE_EVENT_TABLE() - DECLARE_CLASS(wxGLCanvas) -}; - -#endif diff --git a/utils/glcanvas/motif/glcanvas.cpp b/utils/glcanvas/motif/glcanvas.cpp deleted file mode 100644 index 0933fb73bf..0000000000 --- a/utils/glcanvas/motif/glcanvas.cpp +++ /dev/null @@ -1,161 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: glcanvas.cpp -// Purpose: wxGLCanvas, for using OpenGL with wxWindows 2.0 for Motif. -// Uses the GLX extension. -// Author: Julian Smart and Wolfram Gloger -// Modified by: -// Created: 1995, 1999 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart, Wolfram Gloger -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "glcanvas.h" -#endif - -#include "glcanvas.h" -#include "wx/utils.h" -#include "wx/app.h" - -#include -#include "wx/motif/private.h" - -#ifdef OLD_MESA -// workaround for bug in Mesa's glx.c -static int bitcount( unsigned long n ) -{ - int bits; - for (bits=0; n>0;) { - if(n & 1) bits++; - n = n >> 1; - } - return bits; -} -#endif - -/* - * GLCanvas implementation - */ - -IMPLEMENT_CLASS(wxGLCanvas, wxScrolledWindow) - -wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos, - const wxSize& size, long style, - const wxString& name, int *attrib_list, const wxPalette& palette): - wxScrolledWindow(parent, id, pos, size, style, name) -{ - XVisualInfo *vi, vi_templ; - XWindowAttributes xwa; - int val, n; - - Display* display = (Display*) GetXDisplay(); - - glx_cx = 0; - // Check for the presence of the GLX extension - if(!glXQueryExtension(display, NULL, NULL)) { - wxDebugMsg("wxGLCanvas: GLX extension is missing\n"); - return; - } - - if(attrib_list) { - // Get an appropriate visual - vi = glXChooseVisual(display, DefaultScreen(display), attrib_list); - if(!vi) return; - - // Here we should make sure that vi is the same visual as the - // one used by the xwindow drawable in wxCanvas. However, - // there is currently no mechanism for this in wx_canvs.cc. - } else { - // By default, we use the visual of xwindow - XGetWindowAttributes(display, (Window) GetXWindow(), &xwa); - vi_templ.visualid = XVisualIDFromVisual(xwa.visual); - vi = XGetVisualInfo(display, VisualIDMask, &vi_templ, &n); - if(!vi) return; - glXGetConfig(display, vi, GLX_USE_GL, &val); - if(!val) return; - // Basically, this is it. It should be possible to use vi - // in glXCreateContext() below. But this fails with Mesa. - // I notified the Mesa author about it; there may be a fix. -#ifdef OLD_MESA - // Construct an attribute list matching the visual - int a_list[32]; - n = 0; - if(vi->c_class==TrueColor || vi->c_class==DirectColor) { // RGBA visual - a_list[n++] = GLX_RGBA; - a_list[n++] = GLX_RED_SIZE; - a_list[n++] = bitcount(vi->red_mask); - a_list[n++] = GLX_GREEN_SIZE; - a_list[n++] = bitcount(vi->green_mask); - a_list[n++] = GLX_BLUE_SIZE; - a_list[n++] = bitcount(vi->blue_mask); - glXGetConfig(display, vi, GLX_ALPHA_SIZE, &val); - a_list[n++] = GLX_ALPHA_SIZE; - a_list[n++] = val; - } else { // Color index visual - glXGetConfig(display, vi, GLX_BUFFER_SIZE, &val); - a_list[n++] = GLX_BUFFER_SIZE; - a_list[n++] = val; - } - a_list[n] = None; - XFree(vi); - vi = glXChooseVisual(display, DefaultScreen(display), a_list); - if(!vi) return; -#endif /* OLD_MESA */ - } - - // Create the GLX context and make it current - glx_cx = glXCreateContext(display, vi, 0, GL_TRUE); -#ifndef OLD_MESA - XFree(vi); -#endif - SetCurrent(); -} - -wxGLCanvas::~wxGLCanvas(void) -{ - Display* display = (Display*) GetXDisplay(); - if(glx_cx) glXDestroyContext(display, glx_cx); -} - -void wxGLCanvas::SwapBuffers() -{ - Display* display = (Display*) GetXDisplay(); - if(glx_cx) glXSwapBuffers(display, (Window) GetXWindow()); -} - -void wxGLCanvas::SetCurrent() -{ - Display* display = (Display*) GetXDisplay(); - if(glx_cx) glXMakeCurrent(display, (Window) GetXWindow(), glx_cx); -} - -void wxGLCanvas::SetColour(const char *col) -{ - wxColour *the_colour = wxTheColourDatabase->FindColour(col); - if(the_colour) { - GLboolean b; - glGetBooleanv(GL_RGBA_MODE, &b); - if(b) { - glColor3ub(the_colour->Red(), - the_colour->Green(), - the_colour->Blue()); - } else { - GLint pix = (GLint)the_colour->m_pixel; - if(pix == -1) { - XColor exact_def; - exact_def.red = (unsigned short)the_colour->Red() << 8; - exact_def.green = (unsigned short)the_colour->Green() << 8; - exact_def.blue = (unsigned short)the_colour->Blue() << 8; - exact_def.flags = DoRed | DoGreen | DoBlue; - if(!XAllocColor((Display*) GetXDisplay(), (Colormap) wxTheApp->GetMainColormap(GetXDisplay()), &exact_def)) { - wxDebugMsg("wxGLCanvas: cannot allocate color\n"); - return; - } - pix = the_colour->m_pixel = exact_def.pixel; - } - glIndexi(pix); - } - } -} - diff --git a/utils/glcanvas/motif/glcanvas.h b/utils/glcanvas/motif/glcanvas.h deleted file mode 100644 index 96ae147094..0000000000 --- a/utils/glcanvas/motif/glcanvas.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: glcanvas.h -// Purpose: wxGLCanvas, for using OpenGL with wxWindows 2.0 for Motif. -// Uses the GLX extension. -// Author: Julian Smart and Wolfram Gloger -// Modified by: -// Created: 1995, 1999 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart, Wolfram Gloger -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma interface "glcanvas.h" -#endif - -#ifndef _WX_GLCANVAS_H_ -#define _WX_GLCANVAS_H_ - -#include "wx/setup.h" -#include "wx/gdicmn.h" -#include "wx/palette.h" -#include "wx/scrolwin.h" - -#include - -class wxGLCanvas: public wxScrolledWindow -{ -DECLARE_CLASS(wxGLCanvas) -public: - GLXContext glx_cx; - - inline wxGLCanvas() { glx_cx = 0; } - - wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette); - ~wxGLCanvas(void); - - void SetCurrent(); - void SwapBuffers(); - void SetColour(const char *col); -}; - -#endif - // _WX_GLCANVAS_H_ diff --git a/utils/glcanvas/motif/makefile.unx b/utils/glcanvas/motif/makefile.unx deleted file mode 100644 index 90090c9ea2..0000000000 --- a/utils/glcanvas/motif/makefile.unx +++ /dev/null @@ -1,20 +0,0 @@ -# -# File: makefile.unx -# Author: Julian Smart -# Created: 1998 -# Updated: -# Copyright: (c) 1998 Julia`n Smart -# -# "%W% %G%" -# -# Makefile for wxGLCanvas (Unix) - -LIBTARGET=$(WXWIN)/lib/libglcanvas -OPENGLHOME=/home/jacs/mesa/Mesa-2.3 - -EXTRACPPFLAGS=-I$(OPENGLHOME)/include - -OBJECTS=glcanvas.o - -include ../../../src/makelib.env - diff --git a/utils/glcanvas/motif/readme.txt b/utils/glcanvas/motif/readme.txt deleted file mode 100644 index 5771811049..0000000000 --- a/utils/glcanvas/motif/readme.txt +++ /dev/null @@ -1,52 +0,0 @@ -GLCanvas class for wxWindows 1.66 using the GLX protocol extension -================================================================== - -I have just uploaded a file 'wx166glx.tar.gz' to the wxWindows -incoming directory. It contains an implementation of a GLCanvas class -(interfacing an ordinary wxCanvas with OpenGL calls) for X11 (I tested -with Motif, maybe it works with XView as well). I tried to imitate -what Julian did in 'wxmesa1.zip' for MS Windows in conjunction with -the Mesa library. - -Of the several possibilities to use OpenGL under X11, I chose the GLX -server extension, because it is the most efficient method on machines -with graphics hardware support (I expect wxWindows/OpenGL applications -to _fly_ on my Indy :-). However, you don't need a 'real' OpenGL -implementation to use GLCanvas -- the free Mesa library has a -simulated GLX interface built-in. Just link in libMesaGLU and -libMesaGL along with libwx_motif and everything should work fine. - -Installation: - -Untar wx166glx.tar.gz from your main wxWindows directory (i.e. where -the `include' and `src' subdirectories are). Then apply the small -patch file which has appeared in the `glx' subdirectory: - -% patch -p0 < glx/wx166-glx.diff - -Recompile the wx_motif library in the standard way. The inclusion of -the GLCanvas class in libwx_motif is protected with a new 'USE_GLX' -flag in wx_setup.h, so it could maybe be included in a future -wxWindows release (with USE_GLX turned off by default). - -Two new samples (bounce and prim) are included. I adapted them from -wxmesa1.zip -- they should compile under both MS Windows (with wxMesa) -and X11. The makefile.unx's are set up for the Mesa libraries; if you -have original libGLU/libGL's just change the GLLIBS = ... line. - -Problems: - -One more or less serious problem remains: the visual generated by the -GLCanvas class must match the visual of wxCanvas.xwindow (which -currently is always the screen's default visual). The end result is -that you will get a nice RGB mode for OpenGL only if your display's -default visual is TrueColor or DirectColor (the XFree86 S3 servers for -PCs with the '-bpp 16/32' option are examples). I'm contemplating a -solution where the wxCanvas drawingarea widget is destroyed and then -re-created from within the GLCanvas constructor. I would welcome -suggestions on this and discussions of the GLCanvas 'API'. - -Regards, - -Wolfram Gloger. -(Gloger@lrz.uni-muenchen.de) diff --git a/utils/glcanvas/samples/cube/Makefile b/utils/glcanvas/samples/cube/Makefile deleted file mode 100644 index f1e4059dad..0000000000 --- a/utils/glcanvas/samples/cube/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# -# File: Makefile -# Author: Robert Roebling -# Created: 1999 -# Updated: -# Copyright: (c) 1998 Robert Roebling -# -# Makefile for OpenGl demo (GTK version) -# -# This makefile requires wxWindows/GTK to be -# installed (possibly using "make install") -# on your system. -# - -CC = gcc -WXCONFIG=../../../../wx-config -WXINCLUDE=-I../../../../include -WXLIB=-L../../../../lib - -cube: cube.o glcanvas.o - $(CC) -o cube cube.o glcanvas.o `$(WXCONFIG) --libs` $(WXLIB) -lMesaGL -lMesaGLU - -cube.o: cube.cpp - $(CC) `$(WXCONFIG) --cflags` -I../../gtk $(WXINCLUDE) -c cube.cpp - -glcanvas.o: ../../gtk/glcanvas.cpp - $(CC) `$(WXCONFIG) --cflags` `gtk-config --cflags` -I../../gtk $(WXINCLUDE) -c ../../gtk/glcanvas.cpp - -clean: - rm -f *.o cube - diff --git a/utils/glcanvas/samples/cube/cube.cpp b/utils/glcanvas/samples/cube/cube.cpp deleted file mode 100644 index be5d196b33..0000000000 --- a/utils/glcanvas/samples/cube/cube.cpp +++ /dev/null @@ -1,505 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: cube.cpp -// Purpose: wxGLCanvas demo program -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation -#pragma interface -#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/log.h" - -#include "cube.h" - -#ifndef __WXMSW__ // for wxStopWatch, see remark below -#include -#include -#else -#include -#endif - -#define ID_NEW_WINDOW 10000 -#define ID_DEF_ROTATE_LEFT_KEY 10001 -#define ID_DEF_ROTATE_RIGHT_KEY 10002 - -/*---------------------------------------------------------- - Control to get a keycode - ----------------------------------------------------------*/ -class ScanCodeCtrl : public wxTextCtrl -{ -public: - ScanCodeCtrl( wxWindow* parent, wxWindowID id, int code, - const wxPoint& pos, const wxSize& size ); - void OnChar( wxKeyEvent& event ) { } /* do nothing */ - void OnKeyDown(wxKeyEvent& event); -private: -// any class wishing to process wxWindows events must use this macro - DECLARE_EVENT_TABLE() -}; -BEGIN_EVENT_TABLE( ScanCodeCtrl, wxTextCtrl ) - EVT_CHAR( ScanCodeCtrl::OnChar ) - EVT_KEY_DOWN( ScanCodeCtrl::OnKeyDown ) -END_EVENT_TABLE() - -ScanCodeCtrl::ScanCodeCtrl( wxWindow* parent, wxWindowID id, int code, - const wxPoint& pos, const wxSize& size ) - : wxTextCtrl( parent, id, "", pos, size ) -{ wxString buf; - buf.Printf( "0x%04x", code ); - SetValue( buf ); -} - -void ScanCodeCtrl::OnKeyDown( wxKeyEvent& event ) -{ wxString buf; - buf.Printf( "0x%04x", event.KeyCode() ); - SetValue( buf ); -} - -/*------------------------------------------------------------------ - Dialog for defining a keypress --------------------------------------------------------------------*/ - -class ScanCodeDialog : public wxDialog -{ -public: - ScanCodeDialog( wxWindow* parent, wxWindowID id, const int code, - const wxString &descr, const wxString& title ); - int GetValue(); -private: - ScanCodeCtrl *m_ScanCode; - wxTextCtrl *m_Description; -}; - -ScanCodeDialog::ScanCodeDialog( wxWindow* parent, wxWindowID id, - const int code, const wxString &descr, const wxString& title ) - : wxDialog( parent, id, title, wxPoint(-1, -1), wxSize(96*2,76*2) ) -{ - new wxStaticText( this, -1, "Scancode", wxPoint(4*2,3*2), - wxSize(31*2,12*2) ); - m_ScanCode = new ScanCodeCtrl( this, -1, code, wxPoint(37*2,6*2), - wxSize(53*2,14*2) ); - - new wxStaticText( this, -1, "Description", wxPoint(4*2,24*2), - wxSize(32*2,12*2) ); - m_Description = new wxTextCtrl( this, -1, descr, wxPoint(37*2,27*2), - wxSize(53*2,14*2) ); - - new wxButton( this, wxID_OK, "Ok", wxPoint(20*2,50*2), wxSize(20*2,13*2) ); - new wxButton( this, wxID_CANCEL, "Cancel", wxPoint(44*2,50*2), - wxSize(25*2,13*2) ); -} - -int ScanCodeDialog::GetValue() -{ - int code; - wxString buf = m_ScanCode->GetValue(); - sscanf( buf.c_str(), "%i", &code ); - return( code ); -} - -/*---------------------------------------------------------------------- - Utility function to get the elapsed time (in msec) since a given point - in time (in sec) (because current version of wxGetElapsedTime doesn´t - works right with glibc-2.1 and linux, at least for me) ------------------------------------------------------------------------*/ -unsigned long wxStopWatch( unsigned long *sec_base ) -{ - unsigned long secs,msec; - -#ifndef __WXMSW__ // think every unice has gettimeofday - struct timeval tv; - gettimeofday( &tv, (struct timezone *)NULL ); - secs = tv.tv_sec; - msec = tv.tv_usec/1000; -#else - struct timeb tb; - ftime( &tb ); - secs = tb.time; - msec = tb.millitm; -#endif - - if( *sec_base == 0 ) - *sec_base = secs; - - return( (secs-*sec_base)*1000 + msec ); -} - -/*---------------------------------------------------------------- - Implementation of Test-GLCanvas ------------------------------------------------------------------*/ - -BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas) - EVT_SIZE(TestGLCanvas::OnSize) - EVT_PAINT(TestGLCanvas::OnPaint) - EVT_ERASE_BACKGROUND(TestGLCanvas::OnEraseBackground) - EVT_KEY_DOWN( TestGLCanvas::OnKeyDown ) - EVT_KEY_UP( TestGLCanvas::OnKeyUp ) - EVT_ENTER_WINDOW( TestGLCanvas::OnEnterWindow ) -END_EVENT_TABLE() - -unsigned long TestGLCanvas::m_secbase = 0; -int TestGLCanvas::m_TimeInitialized = 0; -unsigned long TestGLCanvas::m_xsynct; -unsigned long TestGLCanvas::m_gsynct; - - -TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, long style, const wxString& name): - wxGLCanvas(parent, NULL, id, pos, size, style, name ) -{ - m_init = FALSE; - m_gllist = 0; - m_rleft = WXK_LEFT; - m_rright = WXK_RIGHT; -} - -TestGLCanvas::TestGLCanvas(wxWindow *parent, const TestGLCanvas &other, - wxWindowID id, const wxPoint& pos, const wxSize& size, long style, - const wxString& name ) : - wxGLCanvas(parent, other.GetContext(), id, pos, size, style, name ) -{ - m_init = FALSE; - m_gllist = other.m_gllist; /* share display list */ - m_rleft = WXK_LEFT; - m_rright = WXK_RIGHT; -} - -TestGLCanvas::~TestGLCanvas() -{ -} - -void TestGLCanvas::Render() -{ - wxPaintDC dc(this); - -#ifndef __WXMOTIF__ - if (!GetContext()) return; -#endif - - SetCurrent(); - /* init OpenGL once, but after SetCurrent */ - if (!m_init) - { - InitGL(); - m_init = TRUE; - } - - /* clear color and depth buffers */ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - if( m_gllist == 0 ) - { - m_gllist = glGenLists( 1 ); - glNewList( m_gllist, GL_COMPILE_AND_EXECUTE ); - /* draw six faces of a cube */ - glBegin(GL_QUADS); - glNormal3f( 0.0F, 0.0F, 1.0F); - glVertex3f( 0.5F, 0.5F, 0.5F); glVertex3f(-0.5F, 0.5F, 0.5F); - glVertex3f(-0.5F,-0.5F, 0.5F); glVertex3f( 0.5F,-0.5F, 0.5F); - - glNormal3f( 0.0F, 0.0F,-1.0F); - glVertex3f(-0.5F,-0.5F,-0.5F); glVertex3f(-0.5F, 0.5F,-0.5F); - glVertex3f( 0.5F, 0.5F,-0.5F); glVertex3f( 0.5F,-0.5F,-0.5F); - - glNormal3f( 0.0F, 1.0F, 0.0F); - glVertex3f( 0.5F, 0.5F, 0.5F); glVertex3f( 0.5F, 0.5F,-0.5F); - glVertex3f(-0.5F, 0.5F,-0.5F); glVertex3f(-0.5F, 0.5F, 0.5F); - - glNormal3f( 0.0F,-1.0F, 0.0F); - glVertex3f(-0.5F,-0.5F,-0.5F); glVertex3f( 0.5F,-0.5F,-0.5F); - glVertex3f( 0.5F,-0.5F, 0.5F); glVertex3f(-0.5F,-0.5F, 0.5F); - - glNormal3f( 1.0F, 0.0F, 0.0F); - glVertex3f( 0.5F, 0.5F, 0.5F); glVertex3f( 0.5F,-0.5F, 0.5F); - glVertex3f( 0.5F,-0.5F,-0.5F); glVertex3f( 0.5F, 0.5F,-0.5F); - - glNormal3f(-1.0F, 0.0F, 0.0F); - glVertex3f(-0.5F,-0.5F,-0.5F); glVertex3f(-0.5F,-0.5F, 0.5F); - glVertex3f(-0.5F, 0.5F, 0.5F); glVertex3f(-0.5F, 0.5F,-0.5F); - glEnd(); - - glEndList(); - } - else - glCallList( m_gllist ); - - glFlush(); - SwapBuffers(); -} - -void TestGLCanvas::OnEnterWindow( wxMouseEvent& event ) -{ - SetFocus(); -} - -void TestGLCanvas::OnPaint( wxPaintEvent& event ) -{ - Render(); -} - -void TestGLCanvas::OnSize(wxSizeEvent& event) -{ - int width, height; - GetClientSize(& width, & height); - -#ifndef __WXMOTIF__ - if (GetContext()) -#endif - { - SetCurrent(); - glViewport(0, 0, width, height); - } -} - -void TestGLCanvas::OnEraseBackground(wxEraseEvent& event) -{ - // Do nothing, to avoid flashing. -} - -void TestGLCanvas::InitGL() -{ - SetCurrent(); - - /* set viewing projection */ - glMatrixMode(GL_PROJECTION); - glFrustum(-0.5F, 0.5F, -0.5F, 0.5F, 1.0F, 3.0F); - - /* position viewer */ - glMatrixMode(GL_MODELVIEW); - glTranslatef(0.0F, 0.0F, -2.0F); - - /* position object */ - glRotatef(30.0F, 1.0F, 0.0F, 0.0F); - glRotatef(30.0F, 0.0F, 1.0F, 0.0F); - - glEnable(GL_DEPTH_TEST); - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); -} - -GLfloat TestGLCanvas::CalcRotateSpeed( unsigned long acceltime ) -{ - GLfloat t,v; - - t = ((GLfloat)acceltime) / 1000.0f; - - if( t < 0.5f ) - v = t; - else if( t < 1.0f ) - v = t * (2.0f - t); - else - v = 0.75f; - - return(v); -} - -GLfloat TestGLCanvas::CalcRotateAngle( unsigned long lasttime, - unsigned long acceltime ) -{ - GLfloat t,s1,s2; - - t = ((GLfloat)(acceltime - lasttime)) / 1000.0f; - s1 = CalcRotateSpeed( lasttime ); - s2 = CalcRotateSpeed( acceltime ); - - return( t * (s1 + s2) * 135.0f ); -} - -void TestGLCanvas::Action( long code, unsigned long lasttime, - unsigned long acceltime ) -{ - GLfloat angle = CalcRotateAngle( lasttime, acceltime ); - - if (code == m_rleft) - Rotate( angle ); - else if (code == m_rright) - Rotate( -angle ); -} - -void TestGLCanvas::OnKeyDown( wxKeyEvent& event ) -{ - long evkey = event.KeyCode(); - if (evkey == 0) return; - - if (!m_TimeInitialized) - { - m_TimeInitialized = 1; - m_xsynct = event.m_timeStamp; - m_gsynct = wxStopWatch(&m_secbase); - - m_Key = evkey; - m_StartTime = 0; - m_LastTime = 0; - m_LastRedraw = 0; - } - - unsigned long currTime = event.m_timeStamp - m_xsynct; - - if (evkey != m_Key) - { - m_Key = evkey; - m_LastRedraw = m_StartTime = m_LastTime = currTime; - } - - if (currTime >= m_LastRedraw) // Redraw: - { - Action( m_Key, m_LastTime-m_StartTime, currTime-m_StartTime ); - - m_LastRedraw = wxStopWatch(&m_secbase) - m_gsynct; - m_LastTime = currTime; - } - - event.Skip(); -} - -void TestGLCanvas::OnKeyUp( wxKeyEvent& event ) -{ - m_Key = 0; - m_StartTime = 0; - m_LastTime = 0; - m_LastRedraw = 0; - - event.Skip(); -} - -void TestGLCanvas::Rotate( GLfloat deg ) -{ - SetCurrent(); - - glMatrixMode(GL_MODELVIEW); - glRotatef((GLfloat)deg, 0.0F, 0.0F, 1.0F); - Refresh(FALSE); -} - - -/* ----------------------------------------------------------------------- - Main Window --------------------------------------------------------------------------*/ - -BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU(wxID_EXIT, MyFrame::OnExit) - EVT_MENU( ID_NEW_WINDOW, MyFrame::OnNewWindow) - EVT_MENU( ID_DEF_ROTATE_LEFT_KEY, MyFrame::OnDefRotateLeftKey) - EVT_MENU( ID_DEF_ROTATE_RIGHT_KEY, MyFrame::OnDefRotateRightKey) -END_EVENT_TABLE() - -// My frame constructor -MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, - const wxSize& size, long style) - : wxFrame(frame, -1, title, pos, size, style) -{ - m_canvas = NULL; -} - -// Intercept menu commands -void MyFrame::OnExit(wxCommandEvent& event) -{ - Destroy(); -} - -void MyFrame::OnNewWindow() -{ - MyFrame *frame = new MyFrame(NULL, "Cube OpenGL Demo Clone", - wxPoint(50, 50), wxSize(400, 300)); - // Give it an icon -#ifdef wx_msw - frame->SetIcon(wxIcon("mondrian")); -#endif - - // Make a menubar - wxMenu *winMenu = new wxMenu; - - winMenu->Append(wxID_EXIT, "&Close"); - winMenu->Append(ID_NEW_WINDOW, "&New" ); - wxMenuBar *menuBar = new wxMenuBar; - menuBar->Append(winMenu, "&Window"); - - winMenu = new wxMenu; - winMenu->Append(ID_DEF_ROTATE_LEFT_KEY, "Rotate &left"); - winMenu->Append(ID_DEF_ROTATE_RIGHT_KEY, "Rotate &right"); - menuBar->Append(winMenu, "&Key"); - - frame->SetMenuBar(menuBar); - - frame->m_canvas = new TestGLCanvas( frame, *m_canvas, -1, - wxPoint(0, 0), wxSize(200, 200) ); - - // Show the frame - frame->Show(TRUE); -} - -void MyFrame::OnDefRotateLeftKey() -{ - ScanCodeDialog dial( this, -1, m_canvas->m_rleft, - wxString("Left"), "Define key" ); - int result = dial.ShowModal(); - if( result == wxID_OK ) - m_canvas->m_rleft = dial.GetValue(); -} -void MyFrame::OnDefRotateRightKey() -{ - ScanCodeDialog dial( this, -1, m_canvas->m_rright, - wxString("Right"), "Define key" ); - int result = dial.ShowModal(); - if( result == wxID_OK ) - m_canvas->m_rright = dial.GetValue(); -} - -/*------------------------------------------------------------------ - Application object ( equivalent to main() ) ------------------------------------------------------------------- */ - -IMPLEMENT_APP(MyApp) - -bool MyApp::OnInit(void) -{ - wxLog::SetTraceMask(wxTraceMessages); - - // Create the main frame window - MyFrame *frame = new MyFrame(NULL, "Cube OpenGL Demo", wxPoint(50, 50), - wxSize(400, 300)); - // Give it an icon -#ifdef wx_msw - frame->SetIcon(wxIcon("mondrian")); -#endif - - // Make a menubar - wxMenu *winMenu = new wxMenu; - - winMenu->Append(wxID_EXIT, "&Close"); - winMenu->Append(ID_NEW_WINDOW, "&New" ); - wxMenuBar *menuBar = new wxMenuBar; - menuBar->Append(winMenu, "&Window"); - - winMenu = new wxMenu; - winMenu->Append(ID_DEF_ROTATE_LEFT_KEY, "Rotate &left"); - winMenu->Append(ID_DEF_ROTATE_RIGHT_KEY, "Rotate &right"); - menuBar->Append(winMenu, "&Key"); - - frame->SetMenuBar(menuBar); - - frame->m_canvas = new TestGLCanvas(frame, -1, wxPoint(0, 0), wxSize(200, 200)); - - // Show the frame - frame->Show(TRUE); - - return TRUE; -} diff --git a/utils/glcanvas/samples/cube/cube.h b/utils/glcanvas/samples/cube/cube.h deleted file mode 100644 index ecbabfb177..0000000000 --- a/utils/glcanvas/samples/cube/cube.h +++ /dev/null @@ -1,93 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: cube.h -// Purpose: wxGLCanvas demo program -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_CUBE_H_ -#define _WX_CUBE_H_ - -#include "glcanvas.h" - -// Define a new application type -class MyApp: public wxApp -{ -public: - bool OnInit(void); -}; - -// Define a new frame type -class TestGLCanvas; -class MyFrame: public wxFrame -{ -public: - MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, - const wxSize& size, long style = wxDEFAULT_FRAME_STYLE); - - void OnExit(wxCommandEvent& event); - void OnNewWindow(); - void OnDefRotateLeftKey(); - void OnDefRotateRightKey(); - -public: - TestGLCanvas* m_canvas; - -DECLARE_EVENT_TABLE() -}; - -class TestGLCanvas: public wxGLCanvas -{ - friend class MyFrame; -public: - TestGLCanvas(wxWindow *parent, const wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = "TestGLCanvas"); - TestGLCanvas(wxWindow *parent, const TestGLCanvas &other, - const wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = "TestGLCanvas" ); - - ~TestGLCanvas(void); - - void OnPaint(wxPaintEvent& event); - void OnSize(wxSizeEvent& event); - void OnEraseBackground(wxEraseEvent& event); - void OnKeyDown(wxKeyEvent& event); - void OnKeyUp(wxKeyEvent& event); - void OnEnterWindow( wxMouseEvent& event ); - - void Render( void ); - void InitGL(void); - void Rotate( GLfloat deg ); - static GLfloat CalcRotateSpeed( unsigned long acceltime ); - static GLfloat CalcRotateAngle( unsigned long lasttime, - unsigned long acceltime ); - void Action( long code, unsigned long lasttime, - unsigned long acceltime ); - -private: - bool m_init; - GLuint m_gllist; - long m_rleft; - long m_rright; - - static unsigned long m_secbase; - static int m_TimeInitialized; - static unsigned long m_xsynct; - static unsigned long m_gsynct; - - long m_Key; - unsigned long m_StartTime; - unsigned long m_LastTime; - unsigned long m_LastRedraw; - -DECLARE_EVENT_TABLE() -}; - -#endif - diff --git a/utils/glcanvas/samples/cube/cube.rc b/utils/glcanvas/samples/cube/cube.rc deleted file mode 100644 index 7655c62a4c..0000000000 --- a/utils/glcanvas/samples/cube/cube.rc +++ /dev/null @@ -1,3 +0,0 @@ -mondrian ICON "mondrian.ico" -#include "wx/msw/wx.rc" - diff --git a/utils/glcanvas/samples/cube/makefile.b32 b/utils/glcanvas/samples/cube/makefile.b32 deleted file mode 100644 index d247005826..0000000000 --- a/utils/glcanvas/samples/cube/makefile.b32 +++ /dev/null @@ -1,18 +0,0 @@ -# -# File: makefile.b32 -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: -# -# Makefile : Builds sample for 32-bit BC++ - -WXDIR = $(WXWIN) - -TARGET=cube -EXTRALIBS=$(WXDIR)\lib\glcanvas.lib -EXTRACPPFLAGS=-I$(WXDIR)\utils\glcanvas\win -OBJECTS = $(TARGET).obj - -!include $(WXDIR)\src\makeprog.b32 - diff --git a/utils/glcanvas/samples/cube/makefile.bcc b/utils/glcanvas/samples/cube/makefile.bcc deleted file mode 100644 index 750206f1f0..0000000000 --- a/utils/glcanvas/samples/cube/makefile.bcc +++ /dev/null @@ -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=cube -EXTRALIBS=$(WXDIR)\lib\glcanvas.lib -EXTRACPPFLAGS=-I$(WXDIR)\utils\glcanvas\win -OBJECTS = $(TARGET).obj - -!include $(WXDIR)\src\makeprog.bcc - diff --git a/utils/glcanvas/samples/cube/makefile.g95 b/utils/glcanvas/samples/cube/makefile.g95 deleted file mode 100644 index 7d4119e5db..0000000000 --- a/utils/glcanvas/samples/cube/makefile.g95 +++ /dev/null @@ -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=cube -EXTRACPPFLAGS=-I../../win -EXTRALIBS=-lglcanvas -lopengl32 -lglu32 -OBJECTS = $(TARGET).o - -include $(WXDIR)/src/makeprog.g95 - diff --git a/utils/glcanvas/samples/cube/makefile.unx b/utils/glcanvas/samples/cube/makefile.unx deleted file mode 100644 index 590b54ddd5..0000000000 --- a/utils/glcanvas/samples/cube/makefile.unx +++ /dev/null @@ -1,23 +0,0 @@ -# -# File: makefile.unx -# Author: Julian Smart -# Created: 1998 -# Updated: -# Copyright: (c) 1998 Julian Smart -# -# "%W% %G%" -# -# Makefile for cube example (UNIX). - -PROGRAM=cube - -OPENGLHOME=/home/jacs/mesa/Mesa-2.3 - -EXTRACPPFLAGS=-I$(OPENGLHOME)/include -I../../motif -EXTRALDFLAGS=-L$(OPENGLHOME)/lib -EXTRALDLIBS=-lglcanvas_motif -lMesaGL -lMesaGLU - -OBJECTS=$(PROGRAM).o - -include ../../../../src/makeprog.env - diff --git a/utils/glcanvas/samples/cube/makefile.vc b/utils/glcanvas/samples/cube/makefile.vc deleted file mode 100644 index f944029f9e..0000000000 --- a/utils/glcanvas/samples/cube/makefile.vc +++ /dev/null @@ -1,25 +0,0 @@ -# -# File: makefile.vc -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: (c) Julian Smart -# -# Makefile : Builds sample (VC++, WIN32) -# Use FINAL=1 argument to nmake to build final version with no debug info. - -# Set WXDIR for your system -WXDIR = $(WXWIN) - -!if "$(FINAL)" == "1" -!else -LIBEXT=_d -!endif - -PROGRAM=cube -OBJECTS = $(PROGRAM).obj -EXTRAINC=-I..\..\win -EXTRALIBS=$(WXDIR)\lib\glcanvas$(LIBEXT).lib glu32.lib opengl32.lib - -!include $(WXDIR)\src\makeprog.vc - diff --git a/utils/glcanvas/samples/cube/makefile.wat b/utils/glcanvas/samples/cube/makefile.wat deleted file mode 100644 index 448db542b5..0000000000 --- a/utils/glcanvas/samples/cube/makefile.wat +++ /dev/null @@ -1,17 +0,0 @@ -# -# Makefile for WATCOM -# -# Created by Julian Smart, January 1999 -# -# - -WXDIR = $(%WXWIN) - -PROGRAM = cube -OBJECTS = $(PROGRAM).obj -EXTRALIBS=$(WXDIR)\lib\glcanvas.lib -EXTRACPPFLAGS=-I$(WXDIR)\utils\glcanvas\win - -!include $(WXDIR)\src\makeprog.wat - - diff --git a/utils/glcanvas/samples/cube/mondrian.ico b/utils/glcanvas/samples/cube/mondrian.ico deleted file mode 100644 index 2310c5d275..0000000000 Binary files a/utils/glcanvas/samples/cube/mondrian.ico and /dev/null differ diff --git a/utils/glcanvas/samples/isosurf/Makefile b/utils/glcanvas/samples/isosurf/Makefile deleted file mode 100644 index 97ba2a59b1..0000000000 --- a/utils/glcanvas/samples/isosurf/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# File: Makefile -# Author: Robert Roebling -# Created: 1999 -# Updated: -# Copyright: (c) 1998 Robert Roebling -# -# Makefile for OpenGl demo (GTK version) -# -# This makefile requires wxWindows/GTK to be -# installed (possibly using "make install") -# on your system. -# - -CC = g++ -WXCONFIG=../../../../wx-config -WXINCLUDE=-I../../../../include -WXLIB=-L../../../../lib - -isosurf: isosurf.o glcanvas.o - $(CC) -o isosurf \ - isosurf.o glcanvas.o \ - `$(WXCONFIG) --libs` $(WXLIB) -lMesaGL -lMesaGLU - -isosurf.o: isosurf.cpp - $(CC) `$(WXCONFIG) --cflags` -I../../gtk $(WXINCLUDE) -c isosurf.cpp - -glcanvas.o: ../../gtk/glcanvas.cpp - $(CC) `$(WXCONFIG) --cflags` `gtk-config --cflags` -I../../gtk -c $(WXINCLUDE) ../../gtk/glcanvas.cpp - -clean: - rm -f *.o isosurf diff --git a/utils/glcanvas/samples/isosurf/isosurf.cpp b/utils/glcanvas/samples/isosurf/isosurf.cpp deleted file mode 100644 index bc5615f81f..0000000000 --- a/utils/glcanvas/samples/isosurf/isosurf.cpp +++ /dev/null @@ -1,412 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: isosurf.cpp -// Purpose: wxGLCanvas demo program -// Author: Brian Paul (original gltk version), Wolfram Gloger -// Modified by: Julian Smart -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation -#pragma interface -#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/timer.h" -#include "glcanvas.h" - -#include -#include - -#include "isosurf.h" - -// The following part is taken largely unchanged from the original C Version - -#include - -GLboolean speed_test = GL_FALSE; -GLboolean use_vertex_arrays = GL_FALSE; - -GLboolean doubleBuffer = GL_TRUE; - -GLboolean smooth = GL_TRUE; -GLboolean lighting = GL_TRUE; - - -#define MAXVERTS 10000 - -static GLfloat verts[MAXVERTS][3]; -static GLfloat norms[MAXVERTS][3]; -static GLint numverts; - -static GLfloat xrot; -static GLfloat yrot; - - -static void read_surface( char *filename ) -{ - FILE *f; - - f = fopen(filename,"r"); - if (!f) { - wxString msg("Couldn't read "); - msg += filename; - wxMessageBox(msg); - return; - } - - numverts = 0; - while (!feof(f) && numvertsSetIcon(wxIcon("mondrian")); - - // Make a menubar - wxMenu *fileMenu = new wxMenu; - - fileMenu->Append(wxID_EXIT, "E&xit"); - wxMenuBar *menuBar = new wxMenuBar; - menuBar->Append(fileMenu, "&File"); - frame->SetMenuBar(menuBar); - - // Make a TestGLCanvas - - // JACS -#ifdef __WXMSW__ - int *gl_attrib = NULL; -#else - int gl_attrib[20] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, - GLX_BLUE_SIZE, 1, GLX_DEPTH_SIZE, 1, - GLX_DOUBLEBUFFER, None }; -#endif - - if(!doubleBuffer) - { - printf("don't have double buffer, disabling\n"); -#ifdef __WXGTK__ - gl_attrib[9] = None; -#endif - doubleBuffer = GL_FALSE; - } - frame->m_canvas = new TestGLCanvas(frame, -1, wxPoint(0, 0), wxSize(200, 200), 0, "TestGLCanvas", - gl_attrib); - - // Show the frame - frame->Show(TRUE); - - frame->m_canvas->SetCurrent(); - read_surface( "isosurf.dat" ); - - Init(); - - return TRUE; -} - -BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU(wxID_EXIT, MyFrame::OnExit) -END_EVENT_TABLE() - -// My frame constructor -MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, - const wxSize& size, long style): - wxFrame(frame, -1, title, pos, size, style) -{ - m_canvas = NULL; -} - -// Intercept menu commands -void MyFrame::OnExit(wxCommandEvent& event) -{ - Destroy(); -} - -/* - * TestGLCanvas implementation - */ - -BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas) - EVT_SIZE(TestGLCanvas::OnSize) - EVT_PAINT(TestGLCanvas::OnPaint) - EVT_CHAR(TestGLCanvas::OnChar) - EVT_MOUSE_EVENTS(TestGLCanvas::OnMouseEvent) - EVT_ERASE_BACKGROUND(TestGLCanvas::OnEraseBackground) -END_EVENT_TABLE() - -TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, long style, const wxString& name, int* gl_attrib): - wxGLCanvas(parent, id, pos, size, style, name, gl_attrib) -{ - parent->Show(TRUE); - SetCurrent(); - /* Make sure server supports the vertex array extension */ - char* extensions = (char *) glGetString( GL_EXTENSIONS ); - if (!extensions || !strstr( extensions, "GL_EXT_vertex_array" )) { - use_vertex_arrays = GL_FALSE; - } -} - - -TestGLCanvas::~TestGLCanvas(void) -{ -} - -void TestGLCanvas::OnPaint( wxPaintEvent& event ) -{ - // This is a dummy, to avoid an endless succession of paint messages. - // OnPaint handlers must always create a wxPaintDC. - wxPaintDC dc(this); - - draw1(); - SwapBuffers(); -} - -void TestGLCanvas::OnSize(wxSizeEvent& event) -{ - SetCurrent(); - int width, height; - GetClientSize(& width, & height); - Reshape(width, height); -} - -void TestGLCanvas::OnChar(wxKeyEvent& event) -{ - switch(event.KeyCode()) { - case WXK_ESCAPE: - exit(0); - case WXK_LEFT: - yrot -= 15.0; - break; - case WXK_RIGHT: - yrot += 15.0; - break; - case WXK_UP: - xrot += 15.0; - break; - case WXK_DOWN: - xrot -= 15.0; - break; - case 's': case 'S': - smooth = !smooth; - if (smooth) { - glShadeModel(GL_SMOOTH); - } else { - glShadeModel(GL_FLAT); - } - break; - case 'l': case 'L': - lighting = !lighting; - if (lighting) { - glEnable(GL_LIGHTING); - } else { - glDisable(GL_LIGHTING); - } - break; - default: - { - event.Skip(); - return; - } - } - - Refresh(FALSE); -} - -void TestGLCanvas::OnMouseEvent(wxMouseEvent& event) -{ - static int dragging = 0; - static float last_x, last_y; - - //printf("%f %f %d\n", event.GetX(), event.GetY(), (int)event.LeftIsDown()); - if(event.LeftIsDown()) { - if(!dragging) { - dragging = 1; - } else { - yrot += (event.GetX() - last_x)*1.0; - xrot += (event.GetY() - last_y)*1.0; - Refresh(FALSE); - } - last_x = event.GetX(); - last_y = event.GetY(); - } else - dragging = 0; -} - -void TestGLCanvas::OnEraseBackground(wxEraseEvent& event) -{ - // Do nothing, to avoid flashing. -} - diff --git a/utils/glcanvas/samples/isosurf/isosurf.dat.gz b/utils/glcanvas/samples/isosurf/isosurf.dat.gz deleted file mode 100644 index c07dc570d2..0000000000 Binary files a/utils/glcanvas/samples/isosurf/isosurf.dat.gz and /dev/null differ diff --git a/utils/glcanvas/samples/isosurf/isosurf.h b/utils/glcanvas/samples/isosurf/isosurf.h deleted file mode 100644 index e84098c56b..0000000000 --- a/utils/glcanvas/samples/isosurf/isosurf.h +++ /dev/null @@ -1,52 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: isosurf.h -// Purpose: wxGLCanvas demo program -// Author: Brian Paul (original gltk version), Wolfram Gloger -// Modified by: Julian Smart -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_ISOSURF_H_ -#define _WX_ISOSURF_H_ - -// Define a new application type -class MyApp: public wxApp -{ public: - bool OnInit(void); -}; - -class TestGLCanvas: public wxGLCanvas -{ - public: - TestGLCanvas(wxWindow *parent, const wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "TestGLCanvas", - int* gl_attrib = NULL); - ~TestGLCanvas(void); - - void OnPaint(wxPaintEvent& event); - void OnSize(wxSizeEvent& event); - void OnEraseBackground(wxEraseEvent& event); - void OnChar(wxKeyEvent& event); - void OnMouseEvent(wxMouseEvent& event); - -DECLARE_EVENT_TABLE() -}; - -class MyFrame: public wxFrame -{ -public: - MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, - long style = wxDEFAULT_FRAME_STYLE); - - void OnExit(wxCommandEvent& event); -public: - TestGLCanvas* m_canvas; - -DECLARE_EVENT_TABLE() -}; - -#endif - diff --git a/utils/glcanvas/samples/isosurf/isosurf.rc b/utils/glcanvas/samples/isosurf/isosurf.rc deleted file mode 100644 index 7655c62a4c..0000000000 --- a/utils/glcanvas/samples/isosurf/isosurf.rc +++ /dev/null @@ -1,3 +0,0 @@ -mondrian ICON "mondrian.ico" -#include "wx/msw/wx.rc" - diff --git a/utils/glcanvas/samples/isosurf/makefile.b32 b/utils/glcanvas/samples/isosurf/makefile.b32 deleted file mode 100644 index 27bd57a6e6..0000000000 --- a/utils/glcanvas/samples/isosurf/makefile.b32 +++ /dev/null @@ -1,22 +0,0 @@ -# -# File: makefile.b32 -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: -# -# Makefile : Builds sample for 32-bit BC++ - -WXDIR = $(WXWIN) - -TARGET=isosurf -EXTRALIBS=$(WXDIR)\lib\glcanvas.lib -EXTRACPPFLAGS=-I$(WXDIR)\utils\glcanvas\win -OBJECTS = $(TARGET).obj -EXTRATARGETS=isosurf.dat - -!include $(WXDIR)\src\makeprog.b32 - -isosurf.dat: isosurf.dat.gz - gzip -c -d isosurf.dat.gz > isosurf.dat - diff --git a/utils/glcanvas/samples/isosurf/makefile.bcc b/utils/glcanvas/samples/isosurf/makefile.bcc deleted file mode 100644 index 778a628406..0000000000 --- a/utils/glcanvas/samples/isosurf/makefile.bcc +++ /dev/null @@ -1,25 +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=isosurf -EXTRALIBS=$(WXDIR)\lib\glcanvas.lib -EXTRACPPFLAGS=-I$(WXDIR)\utils\glcanvas\win -OBJECTS = $(TARGET).obj -EXTRATARGETS=isosurf.dat - -!include $(WXDIR)\src\makeprog.bcc - -isosurf.dat: isosurf.dat.gz - gzip -c -d isosurf.dat.gz > isosurf.dat - diff --git a/utils/glcanvas/samples/isosurf/makefile.g95 b/utils/glcanvas/samples/isosurf/makefile.g95 deleted file mode 100644 index 81b138d0ec..0000000000 --- a/utils/glcanvas/samples/isosurf/makefile.g95 +++ /dev/null @@ -1,20 +0,0 @@ -# -# File: makefile.g95 -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: (c) Julian Smart, 1999 -# -# Makefile for wxWindows sample (Cygwin/Mingw32). - -WXDIR = ../../../.. - -TARGET=isosurf -EXTRACPPFLAGS=-I../../win -EXTRALIBS=-lglcanvas -lopengl32 -lglu32 -OBJECTS = $(TARGET).o - -include $(WXDIR)/src/makeprog.g95 - -isosurf.dat: isosurf.dat.gz - gzip -c -d isosurf.dat.gz > isosurf.dat diff --git a/utils/glcanvas/samples/isosurf/makefile.unx b/utils/glcanvas/samples/isosurf/makefile.unx deleted file mode 100644 index d7b4d3d92b..0000000000 --- a/utils/glcanvas/samples/isosurf/makefile.unx +++ /dev/null @@ -1,27 +0,0 @@ -# -# File: makefile.unx -# Author: Julian Smart -# Created: 1998 -# Updated: -# Copyright: (c) 1998 Julian Smart -# -# "%W% %G%" -# -# Makefile for isosurf example (UNIX). - -PROGRAM=isosurf - -OPENGLHOME=/home/jacs/mesa/Mesa-2.3 - -EXTRACPPFLAGS=-I$(OPENGLHOME)/include -I../../motif -EXTRALDFLAGS=-L$(OPENGLHOME)/lib -EXTRALDLIBS=-lglcanvas_motif -lMesaGL -lMesaGLU - -OBJECTS=$(PROGRAM).o -EXTRATARGETS=isosurf.dat - -include ../../../../src/makeprog.env - -isosurf.dat: isosurf.dat.gz - gzip -c -d isosurf.dat.gz > isosurf.dat - diff --git a/utils/glcanvas/samples/isosurf/makefile.vc b/utils/glcanvas/samples/isosurf/makefile.vc deleted file mode 100644 index 7da10310ff..0000000000 --- a/utils/glcanvas/samples/isosurf/makefile.vc +++ /dev/null @@ -1,30 +0,0 @@ -# -# File: makefile.vc -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: (c) Julian Smart -# -# Makefile : Builds sample (VC++, WIN32) -# Use FINAL=1 argument to nmake to build final version with no debug info. - -# Set WXDIR for your system -WXDIR = $(WXWIN) - -!if "$(FINAL)" == "1" -!else -LIBEXT=_d -!endif - -PROGRAM=isosurf -OBJECTS = $(PROGRAM).obj -EXTRAINC=-I..\..\win -EXTRALIBS=$(WXDIR)\lib\glcanvas$(LIBEXT).lib glu32.lib opengl32.lib -EXTRATARGETS=isosurf.dat - -!include $(WXDIR)\src\makeprog.vc - -isosurf.dat: isosurf.dat.gz - gzip -c -d isosurf.dat.gz > isosurf.dat - - diff --git a/utils/glcanvas/samples/isosurf/makefile.wat b/utils/glcanvas/samples/isosurf/makefile.wat deleted file mode 100644 index 424761f965..0000000000 --- a/utils/glcanvas/samples/isosurf/makefile.wat +++ /dev/null @@ -1,20 +0,0 @@ -# -# Makefile for WATCOM -# -# Created by Julian Smart, January 1999 -# -# - -WXDIR = $(%WXWIN) - -PROGRAM = isosurf -OBJECTS = $(PROGRAM).obj -EXTRALIBS=$(WXDIR)\lib\glcanvas.lib -EXTRACPPFLAGS=-I$(WXDIR)\utils\glcanvas\win -EXTRATARGETS=isosurf.dat - -!include $(WXDIR)\src\makeprog.wat - -isosurf.dat: isosurf.dat.gz - gzip -c -d isosurf.dat.gz > isosurf.dat - diff --git a/utils/glcanvas/samples/isosurf/mondrian.ico b/utils/glcanvas/samples/isosurf/mondrian.ico deleted file mode 100644 index 2310c5d275..0000000000 Binary files a/utils/glcanvas/samples/isosurf/mondrian.ico and /dev/null differ diff --git a/utils/glcanvas/samples/penguin/Makefile b/utils/glcanvas/samples/penguin/Makefile deleted file mode 100644 index 437f7bc1bb..0000000000 --- a/utils/glcanvas/samples/penguin/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# File: Makefile -# Author: Robert Roebling -# Created: 1999 -# Updated: -# Copyright: (c) 1998 Robert Roebling -# -# Makefile for OpenGL 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 - -Penguin: penguin.o trackball.o lw.o glcanvas.o - $(CPP) -o Penguin penguin.o trackball.o lw.o glcanvas.o `$(WXCONFIG) --libs` $(WXLIB) -lMesaGL -lMesaGLU - -penguin.o: penguin.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../gtk $(WXINCLUDE) -c penguin.cpp - -lw.o: lw.cpp - $(CPP) `$(WXCONFIG) --cflags` -I../../gtk $(WXINCLUDE) -c lw.cpp - -trackball.o: trackball.c - $(CC) `$(WXCONFIG) --cflags` -I../../gtk $(WXINCLUDE) -c trackball.c - -glcanvas.o: ../../gtk/glcanvas.cpp - $(CPP) `$(WXCONFIG) --cflags` `gtk-config --cflags` -g -I../../gtk $(WXINCLUDE) -c ../../gtk/glcanvas.cpp - -clean: - rm -f *.o Penguin diff --git a/utils/glcanvas/samples/penguin/lw.cpp b/utils/glcanvas/samples/penguin/lw.cpp deleted file mode 100644 index e7bfe17843..0000000000 --- a/utils/glcanvas/samples/penguin/lw.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (C) 1998 Janne Löf - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifdef __WXMSW__ -#include -#endif - -#include "lw.h" -#include -#include -#include - -#define wxInt32 int -#define wxUint32 unsigned int - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#define MK_ID(a,b,c,d) ((((wxUint32)(a))<<24)| \ - (((wxUint32)(b))<<16)| \ - (((wxUint32)(c))<< 8)| \ - (((wxUint32)(d)) )) - -#define ID_FORM MK_ID('F','O','R','M') -#define ID_LWOB MK_ID('L','W','O','B') -#define ID_PNTS MK_ID('P','N','T','S') -#define ID_SRFS MK_ID('S','R','F','S') -#define ID_SURF MK_ID('S','U','R','F') -#define ID_POLS MK_ID('P','O','L','S') -#define ID_COLR MK_ID('C','O','L','R') - -static wxInt32 read_char(FILE *f) -{ - int c = fgetc(f); - return c; -} - -static wxInt32 read_short(FILE *f) -{ - return (read_char(f)<<8) | read_char(f); -} - -static wxInt32 read_long(FILE *f) -{ - return (read_char(f)<<24) | (read_char(f)<<16) | (read_char(f)<<8) | read_char(f); -} - -static GLfloat read_float(FILE *f) -{ - wxInt32 x = read_long(f); - return *(GLfloat*)&x; -} - -static int read_string(FILE *f, char *s) -{ - int c; - int cnt = 0; - do { - c = read_char(f); - if (cnt < LW_MAX_NAME_LEN) - s[cnt] = c; - else - s[LW_MAX_NAME_LEN-1] = 0; - cnt++; - } while (c != 0); - /* if length of string (including \0) is odd skip another byte */ - if (cnt%2) { - read_char(f); - cnt++; - } - return cnt; -} - -static void read_srfs(FILE *f, int nbytes, lwObject *lwo) -{ - int guess_cnt = lwo->material_cnt; - - while (nbytes > 0) { - lwMaterial *material; - - /* allocate more memory for materials if needed */ - if (guess_cnt <= lwo->material_cnt) { - guess_cnt += guess_cnt/2 + 4; - lwo->material = (lwMaterial*) realloc(lwo->material, sizeof(lwMaterial)*guess_cnt); - } - material = lwo->material + lwo->material_cnt++; - - /* read name */ - nbytes -= read_string(f,material->name); - - /* defaults */ - material->r = 0.7; - material->g = 0.7; - material->b = 0.7; - } - lwo->material = (lwMaterial*) realloc(lwo->material, sizeof(lwMaterial)*lwo->material_cnt); -} - - -static void read_surf(FILE *f, int nbytes, lwObject *lwo) -{ - int i; - char name[LW_MAX_NAME_LEN]; - lwMaterial *material = NULL; - - /* read surface name */ - nbytes -= read_string(f,name); - - /* find material */ - for (i=0; i< lwo->material_cnt; i++) { - if (strcmp(lwo->material[i].name,name) == 0) { - material = &lwo->material[i]; - break; - } - } - - /* read values */ - while (nbytes > 0) { - int id = read_long(f); - int len = read_short(f); - nbytes -= 6 + len + (len%2); - - switch (id) { - case ID_COLR: - material->r = read_char(f) / 255.0; - material->g = read_char(f) / 255.0; - material->b = read_char(f) / 255.0; - read_char(f); /* dummy */ - break; - default: - fseek(f, len+(len%2), SEEK_CUR); - } - } -} - - -static void read_pols(FILE *f, int nbytes, lwObject *lwo) -{ - int guess_cnt = lwo->face_cnt; - - while (nbytes > 0) { - lwFace *face; - int i; - - /* allocate more memory for polygons if necessary */ - if (guess_cnt <= lwo->face_cnt) { - guess_cnt += guess_cnt + 4; - lwo->face = (lwFace*) realloc((void*) lwo->face, sizeof(lwFace)*guess_cnt); - } - face = lwo->face + lwo->face_cnt++; - - /* number of points in this face */ - face->index_cnt = read_short(f); - nbytes -= 2; - - /* allocate space for points */ - face->index = (int*) calloc(sizeof(int)*face->index_cnt,1); - - /* read points in */ - for (i=0; iindex_cnt; i++) { - face->index[i] = read_short(f); - nbytes -= 2; - } - - /* read surface material */ - face->material = read_short(f); - nbytes -= 2; - - /* skip over detail polygons */ - if (face->material < 0) { - int det_cnt; - face->material = -face->material; - det_cnt = read_short(f); - nbytes -= 2; - while (det_cnt-- > 0) { - int cnt = read_short(f); - fseek(f, cnt*2+2, SEEK_CUR); - nbytes -= cnt*2+2; - } - } - face->material -= 1; - } - /* readjust to true size */ - lwo->face = (lwFace*) realloc(lwo->face, sizeof(lwFace)*lwo->face_cnt); -} - - - -static void read_pnts(FILE *f, int nbytes, lwObject *lwo) -{ - int i; - lwo->vertex_cnt = nbytes / 12; - lwo->vertex = (float*) calloc(sizeof(GLfloat)*lwo->vertex_cnt*3, 1); - for (i=0; ivertex_cnt; i++) { - lwo->vertex[i*3+0] = read_float(f); - lwo->vertex[i*3+1] = read_float(f); - lwo->vertex[i*3+2] = read_float(f); - } -} - - - - - - -int lw_is_lwobject(const char *lw_file) -{ - FILE *f = fopen(lw_file, "rb"); - if (f) { - wxInt32 form = read_long(f); - wxInt32 nlen = read_long(f); - wxInt32 lwob = read_long(f); - fclose(f); - if (form == ID_FORM && nlen != 0 && lwob == ID_LWOB) - return TRUE; - } - return FALSE; -} - - -lwObject *lw_object_read(const char *lw_file) -{ - FILE *f = NULL; - lwObject *lw_object = NULL; - - wxInt32 form_bytes = 0; - wxInt32 read_bytes = 0; - - /* open file */ - f = fopen(lw_file, "rb"); - if (f == NULL) { - return NULL; - } - - /* check for headers */ - if (read_long(f) != ID_FORM) { - fclose(f); - return NULL; - } - form_bytes = read_long(f); - read_bytes += 4; - - if (read_long(f) != ID_LWOB) { - fclose(f); - return NULL; - } - - /* create new lwObject */ - lw_object = (lwObject*) calloc(sizeof(lwObject),1); - - /* read chunks */ - while (read_bytes < form_bytes) { - wxInt32 id = read_long(f); - wxInt32 nbytes = read_long(f); - read_bytes += 8 + nbytes + (nbytes%2); - - switch (id) { - case ID_PNTS: - read_pnts(f, nbytes, lw_object); - break; - case ID_POLS: - read_pols(f, nbytes, lw_object); - break; - case ID_SRFS: - read_srfs(f, nbytes, lw_object); - break; - case ID_SURF: - read_surf(f, nbytes, lw_object); - break; - default: - fseek(f, nbytes + (nbytes%2), SEEK_CUR); - } - } - - fclose(f); - return lw_object; -} - - - -void lw_object_free(lwObject *lw_object) -{ - if (lw_object->face) { - int i; - for (i=0; iface_cnt; i++) - free(lw_object->face[i].index); - free(lw_object->face); - } - free(lw_object->material); - free(lw_object->vertex); - free(lw_object); -} - - - - - -#define PX(i) (lw_object->vertex[face->index[i]*3+0]) -#define PY(i) (lw_object->vertex[face->index[i]*3+1]) -#define PZ(i) (lw_object->vertex[face->index[i]*3+2]) -void lw_object_show(const lwObject *lw_object) -{ - int i,j; - int prev_index_cnt = -1; - int prev_material = -1; - GLfloat prev_nx = 0; - GLfloat prev_ny = 0; - GLfloat prev_nz = 0; - - for (i=0; iface_cnt; i++) { - GLfloat ax,ay,az,bx,by,bz,nx,ny,nz,r; - const lwFace *face = lw_object->face+i; - - /* ignore faces with less than 3 points */ - if (face->index_cnt < 3) - continue; - - /* calculate normal */ - ax = PX(1) - PX(0); - ay = PY(1) - PY(0); - az = PZ(1) - PZ(0); - - bx = PX(face->index_cnt-1) - PX(0); - by = PY(face->index_cnt-1) - PY(0); - bz = PZ(face->index_cnt-1) - PZ(0); - - nx = ay * bz - az * by; - ny = az * bx - ax * bz; - nz = ax * by - ay * bx; - - r = sqrt(nx*nx + ny*ny + nz*nz); - if (r < 0.000001) /* avoid division by zero */ - continue; - nx /= r; - ny /= r; - nz /= r; - - /* glBegin/glEnd */ - if (prev_index_cnt != face->index_cnt || prev_index_cnt > 4) { - if (prev_index_cnt > 0) glEnd(); - prev_index_cnt = face->index_cnt; - switch (face->index_cnt) { - case 3: - glBegin(GL_TRIANGLES); - break; - case 4: - glBegin(GL_QUADS); - break; - default: - glBegin(GL_POLYGON); - } - } - - /* update material if necessary */ - if (prev_material != face->material) { - prev_material = face->material; - glColor3f(lw_object->material[face->material].r, - lw_object->material[face->material].g, - lw_object->material[face->material].b); - } - - /* update normal if necessary */ - if (nx != prev_nx || ny != prev_ny || nz != prev_nz) { - prev_nx = nx; - prev_ny = ny; - prev_nz = nz; - glNormal3f(nx,ny,nz); - } - - /* draw polygon/triangle/quad */ - for (j=0; jindex_cnt; j++) - glVertex3f(PX(j),PY(j),PZ(j)); - - } - - /* if glBegin was called call glEnd */ - if (prev_index_cnt > 0) - glEnd(); -} - - -GLfloat lw_object_radius(const lwObject *lwo) -{ - int i; - double max_radius = 0.0; - - for (i=0; ivertex_cnt; i++) { - GLfloat *v = &lwo->vertex[i*3]; - double r = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; - if (r > max_radius) - max_radius = r; - } - return sqrt(max_radius); -} - -void lw_object_scale(lwObject *lwo, GLfloat scale) -{ - int i; - - for (i=0; ivertex_cnt; i++) { - lwo->vertex[i*3+0] *= scale; - lwo->vertex[i*3+1] *= scale; - lwo->vertex[i*3+2] *= scale; - } -} - - diff --git a/utils/glcanvas/samples/penguin/lw.h b/utils/glcanvas/samples/penguin/lw.h deleted file mode 100644 index b49e8ffc91..0000000000 --- a/utils/glcanvas/samples/penguin/lw.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 1998 Janne Löf - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#ifndef LW_H -#define LW_H - -#include - -#define LW_MAX_POINTS 200 -#define LW_MAX_NAME_LEN 500 - -typedef struct { - char name[LW_MAX_NAME_LEN]; - GLfloat r,g,b; -} lwMaterial; - -typedef struct { - int material; /* material of this face */ - int index_cnt; /* number of vertices */ - int *index; /* index to vertex */ - float *texcoord; /* u,v texture coordinates */ -} lwFace; - -typedef struct { - int face_cnt; - lwFace *face; - - int material_cnt; - lwMaterial *material; - - int vertex_cnt; - GLfloat *vertex; - -} lwObject; - -#ifdef __cplusplus -extern "C" { -#endif - -int lw_is_lwobject(const char *lw_file); -lwObject *lw_object_read(const char *lw_file); -void lw_object_free( lwObject *lw_object); -void lw_object_show(const lwObject *lw_object); - -GLfloat lw_object_radius(const lwObject *lw_object); -void lw_object_scale (lwObject *lw_object, GLfloat scale); - -#ifdef __cplusplus -} -#endif - -#endif /* LW_H */ - diff --git a/utils/glcanvas/samples/penguin/makefile.b32 b/utils/glcanvas/samples/penguin/makefile.b32 deleted file mode 100644 index a8dbbec2ab..0000000000 --- a/utils/glcanvas/samples/penguin/makefile.b32 +++ /dev/null @@ -1,18 +0,0 @@ -# -# File: makefile.b32 -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: -# -# Makefile : Builds sample for 32-bit BC++ - -WXDIR = $(WXWIN) - -TARGET=penguin -EXTRALIBS=$(WXDIR)\lib\glcanvas.lib -EXTRACPPFLAGS=-I$(WXDIR)\utils\glcanvas\win -OBJECTS = $(TARGET).obj lw.obj trackball.obj - -!include $(WXDIR)\src\makeprog.b32 - diff --git a/utils/glcanvas/samples/penguin/makefile.bcc b/utils/glcanvas/samples/penguin/makefile.bcc deleted file mode 100644 index 750206f1f0..0000000000 --- a/utils/glcanvas/samples/penguin/makefile.bcc +++ /dev/null @@ -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=cube -EXTRALIBS=$(WXDIR)\lib\glcanvas.lib -EXTRACPPFLAGS=-I$(WXDIR)\utils\glcanvas\win -OBJECTS = $(TARGET).obj - -!include $(WXDIR)\src\makeprog.bcc - diff --git a/utils/glcanvas/samples/penguin/makefile.g95 b/utils/glcanvas/samples/penguin/makefile.g95 deleted file mode 100644 index 6002514c36..0000000000 --- a/utils/glcanvas/samples/penguin/makefile.g95 +++ /dev/null @@ -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=penguin -EXTRACPPFLAGS=-I../../win -EXTRALIBS=-lglcanvas -lopengl32 -lglu32 -OBJECTS = $(TARGET).o lw.o trackball.o - -include $(WXDIR)/src/makeprog.g95 - diff --git a/utils/glcanvas/samples/penguin/makefile.unx b/utils/glcanvas/samples/penguin/makefile.unx deleted file mode 100644 index 2625c45bc9..0000000000 --- a/utils/glcanvas/samples/penguin/makefile.unx +++ /dev/null @@ -1,21 +0,0 @@ -# -# File: makefile.unx -# Author: Julian Smart -# Created: 1998 -# Updated: -# Copyright: (c) 1998 Julian Smart -# -# Makefile for penguin example (UNIX). - -PROGRAM=penguin - -OPENGLHOME=/home/jacs/mesa/Mesa-2.3 - -EXTRACPPFLAGS=-I$(OPENGLHOME)/include -I../../motif -EXTRALDFLAGS=-L$(OPENGLHOME)/lib -EXTRALDLIBS=-lglcanvas_motif -lMesaGL -lMesaGLU - -OBJECTS=$(PROGRAM).o trackball.o lw.o - -include ../../../../src/makeprog.env - diff --git a/utils/glcanvas/samples/penguin/makefile.vc b/utils/glcanvas/samples/penguin/makefile.vc deleted file mode 100644 index 32e14d829c..0000000000 --- a/utils/glcanvas/samples/penguin/makefile.vc +++ /dev/null @@ -1,30 +0,0 @@ -# -# File: makefile.vc -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: (c) Julian Smart -# -# Makefile : Builds sample (VC++, WIN32) -# Use FINAL=1 argument to nmake to build final version with no debug info. - -# Set WXDIR for your system -WXDIR = $(WXWIN) - -!if "$(FINAL)" == "1" -!else -LIBEXT=_d -!endif - -PROGRAM=penguin -OBJECTS = $(PROGRAM).obj trackball.obj lw.obj -EXTRAINC=-I..\..\win -EXTRALIBS=$(WXDIR)\lib\glcanvas$(LIBEXT).lib glu32.lib opengl32.lib - -!include $(WXDIR)\src\makeprog.vc - -lw.obj: lw.cpp lw.h - $(cc) @<< -$(CPPFLAGS2) /c $*.$(SRCSUFF) -<< - diff --git a/utils/glcanvas/samples/penguin/makefile.wat b/utils/glcanvas/samples/penguin/makefile.wat deleted file mode 100644 index 448db542b5..0000000000 --- a/utils/glcanvas/samples/penguin/makefile.wat +++ /dev/null @@ -1,17 +0,0 @@ -# -# Makefile for WATCOM -# -# Created by Julian Smart, January 1999 -# -# - -WXDIR = $(%WXWIN) - -PROGRAM = cube -OBJECTS = $(PROGRAM).obj -EXTRALIBS=$(WXDIR)\lib\glcanvas.lib -EXTRACPPFLAGS=-I$(WXDIR)\utils\glcanvas\win - -!include $(WXDIR)\src\makeprog.wat - - diff --git a/utils/glcanvas/samples/penguin/penguin.cpp b/utils/glcanvas/samples/penguin/penguin.cpp deleted file mode 100644 index 8eaed6a1d9..0000000000 --- a/utils/glcanvas/samples/penguin/penguin.cpp +++ /dev/null @@ -1,236 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: penguin.cpp -// Purpose: wxGLCanvas demo program -// Author: Robert Roebling -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation -#pragma interface -#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 "penguin.h" -#include - -#define VIEW_ASPECT 1.3 - -/* `Main program' equivalent, creating windows and returning main app frame */ -bool MyApp::OnInit(void) -{ - - /* Create the main frame window */ - MyFrame *frame = new MyFrame(NULL, "wxWindows OpenGL Demo", wxPoint(50, 50), wxSize(400, 300)); - - /* Make a menubar */ - wxMenu *fileMenu = new wxMenu; - - fileMenu->Append(wxID_EXIT, "E&xit"); - wxMenuBar *menuBar = new wxMenuBar; - menuBar->Append(fileMenu, "&File"); - frame->SetMenuBar(menuBar); - - frame->m_canvas = new TestGLCanvas(frame, -1, wxPoint(0, 0), wxSize(200, 200)); - - /* Load file wiht mesh data */ - frame->m_canvas->LoadLWO( "penguin.lwo" ); - - /* Show the frame */ - frame->Show(TRUE); - - return TRUE; -} - -IMPLEMENT_APP(MyApp) - -BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU(wxID_EXIT, MyFrame::OnExit) -END_EVENT_TABLE() - -/* My frame constructor */ -MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, - const wxSize& size, long style): - wxFrame(frame, -1, title, pos, size, style) -{ - m_canvas = NULL; -} - -/* Intercept menu commands */ -void MyFrame::OnExit(wxCommandEvent& event) -{ - Destroy(); -} - -BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas) - EVT_SIZE(TestGLCanvas::OnSize) - EVT_PAINT(TestGLCanvas::OnPaint) - EVT_ERASE_BACKGROUND(TestGLCanvas::OnEraseBackground) - EVT_MOUSE_EVENTS(TestGLCanvas::OnMouse) -END_EVENT_TABLE() - -TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, long style, const wxString& name): - wxGLCanvas(parent, id, pos, size, style, name) -{ - block = FALSE; -} - -TestGLCanvas::~TestGLCanvas(void) -{ - /* destroy mesh */ - lw_object_free(info.lwobject); -} - -void TestGLCanvas::OnPaint( wxPaintEvent& event ) -{ - /* must always be here */ - wxPaintDC dc(this); - -#ifndef __WXMOTIF__ - if (!GetContext()) return; -#endif - - SetCurrent(); - - /* initialize OpenGL */ - if (info.do_init == TRUE) - { - InitGL(); - info.do_init = FALSE; - } - - /* view */ - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - gluPerspective( info.zoom, VIEW_ASPECT, 1, 100 ); - glMatrixMode( GL_MODELVIEW ); - - /* clear */ - glClearColor( .3, .4, .6, 1 ); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - /* transformations */ - GLfloat m[4][4]; - glLoadIdentity(); - glTranslatef( 0, 0, -30 ); - build_rotmatrix( m,info.quat ); - glMultMatrixf( &m[0][0] ); - - /* draw object */ - lw_object_show( info.lwobject ); - - /* flush */ - glFlush(); - - /* swap */ - SwapBuffers(); -} - -void TestGLCanvas::OnSize(wxSizeEvent& event) -{ - int width, height; - GetClientSize(& width, & height); - -#ifndef __WXMOTIF__ - if (GetContext()) -#endif - { - SetCurrent(); - glViewport(0, 0, width, height); - } -} - -void TestGLCanvas::OnEraseBackground(wxEraseEvent& event) -{ - /* Do nothing, to avoid flashing on MSW */ -} - -void TestGLCanvas::LoadLWO(const wxString &filename) -{ - /* test if lightwave object */ - if (!lw_is_lwobject(filename)) return; - - /* read lightwave object */ - lwObject *lwobject = lw_object_read(filename); - - /* scale */ - lw_object_scale(lwobject, 10.0 / lw_object_radius(lwobject)); - - /* set up mesh info */ - info.do_init = TRUE; - info.lwobject = lwobject; - info.beginx = 0; - info.beginy = 0; - info.zoom = 45; - trackball( info.quat, 0.0, 0.0, 0.0, 0.0 ); -} - -void TestGLCanvas::OnMouse( wxMouseEvent& event ) -{ - wxSize sz(GetClientSize()); - if (event.Dragging()) - { - /* drag in progress, simulate trackball */ - float spin_quat[4]; - trackball(spin_quat, - (2.0*info.beginx - sz.x) / sz.x, - ( sz.y - 2.0*info.beginy) / sz.y, - ( 2.0*event.GetX() - sz.x) / sz.x, - ( sz.y - 2.0*event.GetY()) / sz.y); - - add_quats( spin_quat, info.quat, info.quat ); - - /* orientation has changed, redraw mesh */ - Refresh(FALSE); - } - - info.beginx = event.GetX(); - info.beginy = event.GetY(); -} - -void TestGLCanvas::InitGL(void) -{ - GLfloat light0_pos[4] = { -50.0, 50.0, 0.0, 0.0 }; - GLfloat light0_color[4] = { .6, .6, .6, 1.0 }; /* white light */ - GLfloat light1_pos[4] = { 50.0, 50.0, 0.0, 0.0 }; - GLfloat light1_color[4] = { .4, .4, 1, 1.0 }; /* cold blue light */ - - /* remove back faces */ - glDisable(GL_CULL_FACE); - glEnable(GL_DEPTH_TEST); - - /* speedups */ - glEnable(GL_DITHER); - glShadeModel(GL_SMOOTH); - glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); - glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST); - - /* light */ - glLightfv(GL_LIGHT0, GL_POSITION, light0_pos); - glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_color); - glLightfv(GL_LIGHT1, GL_POSITION, light1_pos); - glLightfv(GL_LIGHT1, GL_DIFFUSE, light1_color); - glEnable(GL_LIGHT0); - glEnable(GL_LIGHT1); - glEnable(GL_LIGHTING); - - glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE); - glEnable(GL_COLOR_MATERIAL); -} - - diff --git a/utils/glcanvas/samples/penguin/penguin.h b/utils/glcanvas/samples/penguin/penguin.h deleted file mode 100644 index d94c6a8565..0000000000 --- a/utils/glcanvas/samples/penguin/penguin.h +++ /dev/null @@ -1,84 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: penguin.h -// Purpose: wxGLCanvas demo program -// Author: Robert Roebling -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Robert Roebling -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_PENGUIN_H_ -#define _WX_PENGUIN_H_ - - -#include "wx/defs.h" -#include "wx/app.h" -#include "wx/menu.h" -#include "wx/dcclient.h" - -#include "glcanvas.h" - -extern "C" { -#include "lw.h" -#include "trackball.h" -} - -/* information needed to display lightwave mesh */ -typedef struct -{ -// gint do_init; /* true if initgl not yet called */ - int do_init; - lwObject *lwobject; /* lightwave object mesh */ - float beginx,beginy; /* position of mouse */ - float quat[4]; /* orientation of object */ - float zoom; /* field of view in degrees */ -} mesh_info; - - -/* Define a new application type */ -class MyApp: public wxApp -{ -public: - bool OnInit(void); -}; - -/* Define a new frame type */ -class TestGLCanvas; -class MyFrame: public wxFrame -{ -public: - MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, - long style = wxDEFAULT_FRAME_STYLE); - - void OnExit(wxCommandEvent& event); -public: - TestGLCanvas* m_canvas; - -DECLARE_EVENT_TABLE() -}; - - -class TestGLCanvas: public wxGLCanvas -{ - public: - TestGLCanvas(wxWindow *parent, const wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "TestGLCanvas"); - ~TestGLCanvas(void); - - void OnPaint(wxPaintEvent& event); - void OnSize(wxSizeEvent& event); - void OnEraseBackground(wxEraseEvent& event); - void LoadLWO( const wxString &filename); - void OnMouse( wxMouseEvent& event ); - void InitGL(void); - - mesh_info info; - bool block; - -DECLARE_EVENT_TABLE() -}; - -#endif - diff --git a/utils/glcanvas/samples/penguin/penguin.lwo b/utils/glcanvas/samples/penguin/penguin.lwo deleted file mode 100644 index 3f5122db82..0000000000 Binary files a/utils/glcanvas/samples/penguin/penguin.lwo and /dev/null differ diff --git a/utils/glcanvas/samples/penguin/penguin.rc b/utils/glcanvas/samples/penguin/penguin.rc deleted file mode 100644 index 626b82f58a..0000000000 --- a/utils/glcanvas/samples/penguin/penguin.rc +++ /dev/null @@ -1,3 +0,0 @@ -/* mondrian ICON "mondrian.ico" */ -#include "wx/msw/wx.rc" - diff --git a/utils/glcanvas/samples/penguin/trackball.c b/utils/glcanvas/samples/penguin/trackball.c deleted file mode 100644 index f23d3db30b..0000000000 --- a/utils/glcanvas/samples/penguin/trackball.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - * (c) Copyright 1993, 1994, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(TM) is a trademark of Silicon Graphics, Inc. - */ -/* - * Trackball code: - * - * Implementation of a virtual trackball. - * Implemented by Gavin Bell, lots of ideas from Thant Tessman and - * the August '88 issue of Siggraph's "Computer Graphics," pp. 121-129. - * - * Vector manip code: - * - * Original code from: - * David M. Ciemiewicz, Mark Grossman, Henry Moreton, and Paul Haeberli - * - * Much mucking with by: - * Gavin Bell - */ -#include -#include "trackball.h" - -/* - * This size should really be based on the distance from the center of - * rotation to the point on the object underneath the mouse. That - * point would then track the mouse as closely as possible. This is a - * simple example, though, so that is left as an Exercise for the - * Programmer. - */ -#define TRACKBALLSIZE (0.8) - -/* - * Local function prototypes (not defined in trackball.h) - */ -static float tb_project_to_sphere(float, float, float); -static void normalize_quat(float [4]); - -void -vzero(float *v) -{ - v[0] = 0.0; - v[1] = 0.0; - v[2] = 0.0; -} - -void -vset(float *v, float x, float y, float z) -{ - v[0] = x; - v[1] = y; - v[2] = z; -} - -void -vsub(const float *src1, const float *src2, float *dst) -{ - dst[0] = src1[0] - src2[0]; - dst[1] = src1[1] - src2[1]; - dst[2] = src1[2] - src2[2]; -} - -void -vcopy(const float *v1, float *v2) -{ - register int i; - for (i = 0 ; i < 3 ; i++) - v2[i] = v1[i]; -} - -void -vcross(const float *v1, const float *v2, float *cross) -{ - float temp[3]; - - temp[0] = (v1[1] * v2[2]) - (v1[2] * v2[1]); - temp[1] = (v1[2] * v2[0]) - (v1[0] * v2[2]); - temp[2] = (v1[0] * v2[1]) - (v1[1] * v2[0]); - vcopy(temp, cross); -} - -float -vlength(const float *v) -{ - return sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); -} - -void -vscale(float *v, float div) -{ - v[0] *= div; - v[1] *= div; - v[2] *= div; -} - -void -vnormal(float *v) -{ - vscale(v,1.0/vlength(v)); -} - -float -vdot(const float *v1, const float *v2) -{ - return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; -} - -void -vadd(const float *src1, const float *src2, float *dst) -{ - dst[0] = src1[0] + src2[0]; - dst[1] = src1[1] + src2[1]; - dst[2] = src1[2] + src2[2]; -} - -/* - * Ok, simulate a track-ball. Project the points onto the virtual - * trackball, then figure out the axis of rotation, which is the cross - * product of P1 P2 and O P1 (O is the center of the ball, 0,0,0) - * Note: This is a deformed trackball-- is a trackball in the center, - * but is deformed into a hyperbolic sheet of rotation away from the - * center. This particular function was chosen after trying out - * several variations. - * - * It is assumed that the arguments to this routine are in the range - * (-1.0 ... 1.0) - */ -void -trackball(float q[4], float p1x, float p1y, float p2x, float p2y) -{ - float a[3]; /* Axis of rotation */ - float phi; /* how much to rotate about axis */ - float p1[3], p2[3], d[3]; - float t; - - if (p1x == p2x && p1y == p2y) { - /* Zero rotation */ - vzero(q); - q[3] = 1.0; - return; - } - - /* - * First, figure out z-coordinates for projection of P1 and P2 to - * deformed sphere - */ - vset(p1,p1x,p1y,tb_project_to_sphere(TRACKBALLSIZE,p1x,p1y)); - vset(p2,p2x,p2y,tb_project_to_sphere(TRACKBALLSIZE,p2x,p2y)); - - /* - * Now, we want the cross product of P1 and P2 - */ - vcross(p2,p1,a); - - /* - * Figure out how much to rotate around that axis. - */ - vsub(p1,p2,d); - t = vlength(d) / (2.0*TRACKBALLSIZE); - - /* - * Avoid problems with out-of-control values... - */ - if (t > 1.0) t = 1.0; - if (t < -1.0) t = -1.0; - phi = 2.0 * asin(t); - - axis_to_quat(a,phi,q); -} - -/* - * Given an axis and angle, compute quaternion. - */ -void -axis_to_quat(float a[3], float phi, float q[4]) -{ - vnormal(a); - vcopy(a,q); - vscale(q,sin(phi/2.0)); - q[3] = cos(phi/2.0); -} - -/* - * Project an x,y pair onto a sphere of radius r OR a hyperbolic sheet - * if we are away from the center of the sphere. - */ -static float -tb_project_to_sphere(float r, float x, float y) -{ - float d, t, z; - - d = sqrt(x*x + y*y); - if (d < r * 0.70710678118654752440) { /* Inside sphere */ - z = sqrt(r*r - d*d); - } else { /* On hyperbola */ - t = r / 1.41421356237309504880; - z = t*t / d; - } - return z; -} - -/* - * Given two rotations, e1 and e2, expressed as quaternion rotations, - * figure out the equivalent single rotation and stuff it into dest. - * - * This routine also normalizes the result every RENORMCOUNT times it is - * called, to keep error from creeping in. - * - * NOTE: This routine is written so that q1 or q2 may be the same - * as dest (or each other). - */ - -#define RENORMCOUNT 97 - -void -add_quats(float q1[4], float q2[4], float dest[4]) -{ - static int count=0; - float t1[4], t2[4], t3[4]; - float tf[4]; - - vcopy(q1,t1); - vscale(t1,q2[3]); - - vcopy(q2,t2); - vscale(t2,q1[3]); - - vcross(q2,q1,t3); - vadd(t1,t2,tf); - vadd(t3,tf,tf); - tf[3] = q1[3] * q2[3] - vdot(q1,q2); - - dest[0] = tf[0]; - dest[1] = tf[1]; - dest[2] = tf[2]; - dest[3] = tf[3]; - - if (++count > RENORMCOUNT) { - count = 0; - normalize_quat(dest); - } -} - -/* - * Quaternions always obey: a^2 + b^2 + c^2 + d^2 = 1.0 - * If they don't add up to 1.0, dividing by their magnitued will - * renormalize them. - * - * Note: See the following for more information on quaternions: - * - * - Shoemake, K., Animating rotation with quaternion curves, Computer - * Graphics 19, No 3 (Proc. SIGGRAPH'85), 245-254, 1985. - * - Pletinckx, D., Quaternion calculus as a basic tool in computer - * graphics, The Visual Computer 5, 2-13, 1989. - */ -static void -normalize_quat(float q[4]) -{ - int i; - float mag; - - mag = (q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3]); - for (i = 0; i < 4; i++) q[i] /= mag; -} - -/* - * Build a rotation matrix, given a quaternion rotation. - * - */ -void -build_rotmatrix(float m[4][4], float q[4]) -{ - m[0][0] = 1.0 - 2.0 * (q[1] * q[1] + q[2] * q[2]); - m[0][1] = 2.0 * (q[0] * q[1] - q[2] * q[3]); - m[0][2] = 2.0 * (q[2] * q[0] + q[1] * q[3]); - m[0][3] = 0.0; - - m[1][0] = 2.0 * (q[0] * q[1] + q[2] * q[3]); - m[1][1]= 1.0 - 2.0 * (q[2] * q[2] + q[0] * q[0]); - m[1][2] = 2.0 * (q[1] * q[2] - q[0] * q[3]); - m[1][3] = 0.0; - - m[2][0] = 2.0 * (q[2] * q[0] - q[1] * q[3]); - m[2][1] = 2.0 * (q[1] * q[2] + q[0] * q[3]); - m[2][2] = 1.0 - 2.0 * (q[1] * q[1] + q[0] * q[0]); - m[2][3] = 0.0; - - m[3][0] = 0.0; - m[3][1] = 0.0; - m[3][2] = 0.0; - m[3][3] = 1.0; -} - diff --git a/utils/glcanvas/samples/penguin/trackball.h b/utils/glcanvas/samples/penguin/trackball.h deleted file mode 100644 index b676fb4e54..0000000000 --- a/utils/glcanvas/samples/penguin/trackball.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * (c) Copyright 1993, 1994, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(TM) is a trademark of Silicon Graphics, Inc. - */ -/* - * trackball.h - * A virtual trackball implementation - * Written by Gavin Bell for Silicon Graphics, November 1988. - */ - -/* - * Pass the x and y coordinates of the last and current positions of - * the mouse, scaled so they are from (-1.0 ... 1.0). - * - * The resulting rotation is returned as a quaternion rotation in the - * first paramater. - */ -void -trackball(float q[4], float p1x, float p1y, float p2x, float p2y); - -/* - * Given two quaternions, add them together to get a third quaternion. - * Adding quaternions to get a compound rotation is analagous to adding - * translations to get a compound translation. When incrementally - * adding rotations, the first argument here should be the new - * rotation, the second and third the total rotation (which will be - * over-written with the resulting new total rotation). - */ -void -add_quats(float *q1, float *q2, float *dest); - -/* - * A useful function, builds a rotation matrix in Matrix based on - * given quaternion. - */ -void -build_rotmatrix(float m[4][4], float q[4]); - -/* - * This function computes a quaternion based on an axis (defined by - * the given vector) and an angle about which to rotate. The angle is - * expressed in radians. The result is put into the third argument. - */ -void -axis_to_quat(float a[3], float phi, float q[4]); - diff --git a/utils/glcanvas/win/Makefile.in b/utils/glcanvas/win/Makefile.in deleted file mode 100644 index 6c0217d793..0000000000 --- a/utils/glcanvas/win/Makefile.in +++ /dev/null @@ -1,21 +0,0 @@ -# -# File: Makefile -# Author: Robert Roebling -# Created: 1999 -# Updated: -# Copyright: (c) 1998 Robert Roebling -# -# "%W% %G%" -# - -top_srcdir = @top_srcdir@/.. -top_builddir = ../../.. - -VPATH= $(top_srcdir)/utils/glcanvas/win - -LIBTARGET=libwxglcanvas - -OBJECTS=glcanvas.o - -include $(top_builddir)/src/makelib.env - diff --git a/utils/glcanvas/win/glcanvas.cpp b/utils/glcanvas/win/glcanvas.cpp deleted file mode 100644 index aee52f2f2a..0000000000 --- a/utils/glcanvas/win/glcanvas.cpp +++ /dev/null @@ -1,618 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: glcanvas.cpp -// Purpose: wxGLCanvas, for using OpenGL with wxWindows under MS Windows -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "glcanvas.h" -#endif - -#include "wx/wxprec.h" - -#if defined(__BORLANDC__) -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#include - -#include "glcanvas.h" - -wxChar wxGLCanvasClassName[] = wxT("wxGLCanvasClass"); - -LRESULT WXDLLEXPORT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, - WPARAM wParam, LPARAM lParam); - -/* - * GLContext implementation - */ - -wxGLContext::wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette) -{ - m_window = win; - - m_hDC = win->GetHDC(); - - m_glContext = wglCreateContext((HDC) m_hDC); - wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); - - wglMakeCurrent((HDC) m_hDC, m_glContext); -} - -wxGLContext::wxGLContext( - bool isRGB, wxGLCanvas *win, - const wxPalette& palette, - const wxGLContext *other /* for sharing display lists */ -) -{ - m_window = win; - - m_hDC = win->GetHDC(); - - m_glContext = wglCreateContext((HDC) m_hDC); - wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); - - if( other != 0 ) - wglShareLists( other->m_glContext, m_glContext ); - - wglMakeCurrent((HDC) m_hDC, m_glContext); -} - -wxGLContext::~wxGLContext() -{ - if (m_glContext) - { - wglMakeCurrent(NULL, NULL); - wglDeleteContext(m_glContext); - } -} - -void wxGLContext::SwapBuffers() -{ - if (m_glContext) - { - wglMakeCurrent((HDC) m_hDC, m_glContext); - ::SwapBuffers((HDC) m_hDC); //blits the backbuffer into DC - } -} - -void wxGLContext::SetCurrent() -{ - if (m_glContext) - { - wglMakeCurrent((HDC) m_hDC, m_glContext); - } - -/* - setupPixelFormat(hDC); - setupPalette(hDC); -*/ -} - -void wxGLContext::SetColour(const char *colour) -{ - float r = 0.0; - float g = 0.0; - float b = 0.0; - wxColour *col = wxTheColourDatabase->FindColour(colour); - if (col) - { - r = (float)(col->Red()/256.0); - g = (float)(col->Green()/256.0); - b = (float)(col->Blue()/256.0); - glColor3f( r, g, b); - } -} - - -/* - * wxGLCanvas implementation - */ - -IMPLEMENT_CLASS(wxGLCanvas, wxScrolledWindow) - -BEGIN_EVENT_TABLE(wxGLCanvas, wxScrolledWindow) - EVT_SIZE(wxGLCanvas::OnSize) - EVT_PALETTE_CHANGED(wxGLCanvas::OnPaletteChanged) - EVT_QUERY_NEW_PALETTE(wxGLCanvas::OnQueryNewPalette) -END_EVENT_TABLE() - -wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, long style, const wxString& name, - int *attribList /* not used yet! */, const wxPalette& palette): - wxScrolledWindow() -{ - m_glContext = (wxGLContext*) NULL; - - bool ret = Create(parent, id, pos, size, style, name); - - if ( ret ) - { - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); - SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); - } - - m_hDC = (WXHDC) ::GetDC((HWND) GetHWND()); - - SetupPixelFormat(); - SetupPalette(palette); - - m_glContext = new wxGLContext(TRUE, this, palette); -} - -wxGLCanvas::wxGLCanvas( wxWindow *parent, - const wxGLContext *shared, wxWindowID id, - const wxPoint& pos, const wxSize& size, long style, const wxString& name, - int *attribList, const wxPalette& palette ) - : wxScrolledWindow() -{ - m_glContext = (wxGLContext*) NULL; - - bool ret = Create(parent, id, pos, size, style, name); - - if ( ret ) - { - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); - SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); - } - - m_hDC = (WXHDC) ::GetDC((HWND) GetHWND()); - - SetupPixelFormat(); - SetupPalette(palette); - - m_glContext = new wxGLContext(TRUE, this, palette, shared ); -} - -// Not very usefull for wxMSW, but this is to be wxGTK compliant - -wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id, - const wxPoint& pos, const wxSize& size, long style, const wxString& name, - int *attribList, const wxPalette& palette ): - wxScrolledWindow() -{ - m_glContext = (wxGLContext*) NULL; - - bool ret = Create(parent, id, pos, size, style, name); - - if ( ret ) - { - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE)); - SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); - } - - m_hDC = (WXHDC) ::GetDC((HWND) GetHWND()); - - SetupPixelFormat(); - SetupPalette(palette); - - wxGLContext *sharedContext=0; - if (shared) sharedContext=shared->GetContext(); - m_glContext = new wxGLContext(TRUE, this, palette, sharedContext ); -} - -wxGLCanvas::~wxGLCanvas() -{ - if (m_glContext) - delete m_glContext; - - ::ReleaseDC((HWND) GetHWND(), (HDC) m_hDC); -} - -// Replaces wxWindow::Create functionality, since we need to use a different window class -bool wxGLCanvas::Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, long style, const wxString& name) -{ - static bool registeredGLCanvasClass = FALSE; - - // We have to register a special window class because we need - // the CS_OWNDC style for GLCanvas. - -/* - From Angel Popov - - Here are two snips from a dicussion in the OpenGL Gamedev list that explains - how this problem can be fixed: - - "There are 5 common DCs available in Win95. These are aquired when you call - GetDC or GetDCEx from a window that does _not_ have the OWNDC flag. - OWNDC flagged windows do not get their DC from the common DC pool, the issue - is they require 800 bytes each from the limited 64Kb local heap for GDI." - - "The deal is, if you hold onto one of the 5 shared DC's too long (as GL apps - do), Win95 will actually "steal" it from you. MakeCurrent fails, - apparently, because Windows re-assigns the HDC to a different window. The - only way to prevent this, the only reliable means, is to set CS_OWNDC." -*/ - - if (!registeredGLCanvasClass) - { - WNDCLASS wndclass; - - static const long styleNormal = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | CS_OWNDC; - - // the fields which are common to all classes - wndclass.lpfnWndProc = (WNDPROC)wxWndProc; - wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = sizeof( DWORD ); // VZ: what is this DWORD used for? - wndclass.hInstance = wxhInstance; - wndclass.hIcon = (HICON) NULL; - wndclass.hCursor = ::LoadCursor((HINSTANCE)NULL, IDC_ARROW); - wndclass.lpszMenuName = NULL; - - // Register the GLCanvas class name - wndclass.hbrBackground = (HBRUSH)NULL; - wndclass.lpszClassName = wxGLCanvasClassName; - wndclass.style = styleNormal; - - if ( !RegisterClass(&wndclass) ) - { - wxLogLastError("RegisterClass(wxGLCanvasClass)"); - - return FALSE; - } - registeredGLCanvasClass = TRUE; - } - - wxCHECK_MSG( parent, FALSE, wxT("can't create wxWindow without parent") ); - - if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) ) - return FALSE; - - parent->AddChild(this); - - DWORD msflags = 0; - if ( style & wxBORDER ) - msflags |= WS_BORDER; - if ( style & wxTHICK_FRAME ) - msflags |= WS_THICKFRAME; - - msflags |= WS_CHILD | WS_VISIBLE; - if ( style & wxCLIP_CHILDREN ) - msflags |= WS_CLIPCHILDREN; - - bool want3D; - WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D); - - // Even with extended styles, need to combine with WS_BORDER - // for them to look right. - if ( want3D || (m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) || - (m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER)) - { - msflags |= WS_BORDER; - } - - // calculate the value to return from WM_GETDLGCODE handler - if ( GetWindowStyleFlag() & wxWANTS_CHARS ) - { - // want everything: i.e. all keys and WM_CHAR message - m_lDlgCode = DLGC_WANTARROWS | DLGC_WANTCHARS | - DLGC_WANTTAB | DLGC_WANTMESSAGE; - } - - MSWCreate(m_windowId, parent, wxGLCanvasClassName, this, NULL, - pos.x, pos.y, - WidthDefault(size.x), HeightDefault(size.y), - msflags, NULL, exStyle); - - return TRUE; - -} - -void wxGLCanvas::SetupPixelFormat() // (HDC hDC) -{ - PIXELFORMATDESCRIPTOR pfd = { - sizeof(PIXELFORMATDESCRIPTOR), /* size */ - 1, /* version */ - PFD_SUPPORT_OPENGL | - PFD_DRAW_TO_WINDOW | - PFD_DOUBLEBUFFER, /* support double-buffering */ - PFD_TYPE_RGBA, /* color type */ - 16, /* prefered color depth */ - 0, 0, 0, 0, 0, 0, /* color bits (ignored) */ - 0, /* no alpha buffer */ - 0, /* alpha bits (ignored) */ - 0, /* no accumulation buffer */ - 0, 0, 0, 0, /* accum bits (ignored) */ - 16, /* depth buffer */ - 0, /* no stencil buffer */ - 0, /* no auxiliary buffers */ - PFD_MAIN_PLANE, /* main layer */ - 0, /* reserved */ - 0, 0, 0, /* no layer, visible, damage masks */ - }; - int pixelFormat; - - pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd); - if (pixelFormat == 0) { - MessageBox(WindowFromDC((HDC) m_hDC), "ChoosePixelFormat failed.", "Error", - MB_ICONERROR | MB_OK); - exit(1); - } - - if (SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) != TRUE) { - MessageBox(WindowFromDC((HDC) m_hDC), "SetPixelFormat failed.", "Error", - MB_ICONERROR | MB_OK); - exit(1); - } -} - -void wxGLCanvas::SetupPalette(const wxPalette& palette) -{ - int pixelFormat = GetPixelFormat((HDC) m_hDC); - PIXELFORMATDESCRIPTOR pfd; - - DescribePixelFormat((HDC) m_hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd); - - if (pfd.dwFlags & PFD_NEED_PALETTE) - { - } - else - { - return; - } - - m_palette = palette; - - if ( !m_palette.Ok() ) - { - m_palette = CreateDefaultPalette(); - } - - if (m_palette.Ok()) - { - SelectPalette((HDC) m_hDC, (HPALETTE) m_palette.GetHPALETTE(), FALSE); - RealizePalette((HDC) m_hDC); - } -} - -wxPalette wxGLCanvas::CreateDefaultPalette() -{ - PIXELFORMATDESCRIPTOR pfd; - int paletteSize; - int pixelFormat = GetPixelFormat((HDC) m_hDC); - - DescribePixelFormat((HDC) m_hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd); - - paletteSize = 1 << pfd.cColorBits; - - LOGPALETTE* pPal = - (LOGPALETTE*) malloc(sizeof(LOGPALETTE) + paletteSize * sizeof(PALETTEENTRY)); - pPal->palVersion = 0x300; - pPal->palNumEntries = paletteSize; - - /* build a simple RGB color palette */ - { - int redMask = (1 << pfd.cRedBits) - 1; - int greenMask = (1 << pfd.cGreenBits) - 1; - int blueMask = (1 << pfd.cBlueBits) - 1; - int i; - - for (i=0; ipalPalEntry[i].peRed = - (((i >> pfd.cRedShift) & redMask) * 255) / redMask; - pPal->palPalEntry[i].peGreen = - (((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask; - pPal->palPalEntry[i].peBlue = - (((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask; - pPal->palPalEntry[i].peFlags = 0; - } - } - - HPALETTE hPalette = CreatePalette(pPal); - free(pPal); - - wxPalette palette; - palette.SetHPALETTE((WXHPALETTE) hPalette); - - return palette; -} - -void wxGLCanvas::SwapBuffers() -{ - if (m_glContext) - m_glContext->SwapBuffers(); -} - -void wxGLCanvas::OnSize(wxSizeEvent& event) -{ - int width, height; - GetClientSize(& width, & height); - - if (m_glContext) - { - m_glContext->SetCurrent(); - - glViewport(0, 0, (GLint)width, (GLint)height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 ); - glMatrixMode(GL_MODELVIEW); - } -} - -void wxGLCanvas::SetCurrent() -{ - if (m_glContext) - { - m_glContext->SetCurrent(); - } -} - -void wxGLCanvas::SetColour(const char *colour) -{ - if (m_glContext) - m_glContext->SetColour(colour); -} - -// TODO: Have to have this called by parent frame (?) -// So we need wxFrame to call OnQueryNewPalette for all children... -void wxGLCanvas::OnQueryNewPalette(wxQueryNewPaletteEvent& event) -{ - /* realize palette if this is the current window */ - if ( GetPalette()->Ok() ) { - ::UnrealizeObject((HPALETTE) GetPalette()->GetHPALETTE()); - ::SelectPalette((HDC) GetHDC(), (HPALETTE) GetPalette()->GetHPALETTE(), FALSE); - ::RealizePalette((HDC) GetHDC()); - Refresh(); - event.SetPaletteRealized(TRUE); - } - else - event.SetPaletteRealized(FALSE); -} - -// I think this doesn't have to be propagated to child windows. -void wxGLCanvas::OnPaletteChanged(wxPaletteChangedEvent& event) -{ - /* realize palette if this is *not* the current window */ - if ( GetPalette() && - GetPalette()->Ok() && (this != event.GetChangedWindow()) ) - { - ::UnrealizeObject((HPALETTE) GetPalette()->GetHPALETTE()); - ::SelectPalette((HDC) GetHDC(), (HPALETTE) GetPalette()->GetHPALETTE(), FALSE); - ::RealizePalette((HDC) GetHDC()); - Refresh(); - } -} - -/* Give extensions proper function names. */ - -/* EXT_vertex_array */ -void glArrayElementEXT(GLint i) -{ -} - -void glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) -{ -} - -void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count) -{ -#ifdef GL_EXT_vertex_array - static PFNGLDRAWARRAYSEXTPROC proc = 0; - - if ( !proc ) - { - proc = (PFNGLDRAWARRAYSEXTPROC) wglGetProcAddress("glDrawArraysEXT"); - } - - if ( proc ) - (* proc) (mode, first, count); -#endif -} - -void glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *pointer) -{ -} - -void glGetPointervEXT(GLenum pname, GLvoid* *params) -{ -} - -void glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) -{ -} - -void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) -{ -#ifdef GL_EXT_vertex_array - static PFNGLNORMALPOINTEREXTPROC proc = 0; - - if ( !proc ) - { - proc = (PFNGLNORMALPOINTEREXTPROC) wglGetProcAddress("glNormalPointerEXT"); - } - - if ( proc ) - (* proc) (type, stride, count, pointer); -#endif -} - -void glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) -{ -} - -void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer) -{ -#ifdef GL_EXT_vertex_array - static PFNGLVERTEXPOINTEREXTPROC proc = 0; - - if ( !proc ) - { - proc = (PFNGLVERTEXPOINTEREXTPROC) wglGetProcAddress("glVertexPointerEXT"); - } - - if ( proc ) - (* proc) (size, type, stride, count, pointer); -#endif -} - -/* EXT_color_subtable */ -void glColorSubtableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table) -{ -} - -/* EXT_color_table */ -void glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) -{ -} - -void glCopyColorTableEXT(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) -{ -} - -void glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid *table) -{ -} - -void glGetColorTableParamaterfvEXT(GLenum target, GLenum pname, GLfloat *params) -{ -} - -void glGetColorTavleParameterivEXT(GLenum target, GLenum pname, GLint *params) -{ -} - -/* SGI_compiled_vertex_array */ -void glLockArraysSGI(GLint first, GLsizei count) -{ -} - -void glUnlockArraysSGI() -{ -} - - -/* SGI_cull_vertex */ -void glCullParameterdvSGI(GLenum pname, GLdouble* params) -{ -} - -void glCullParameterfvSGI(GLenum pname, GLfloat* params) -{ -} - -/* SGI_index_func */ -void glIndexFuncSGI(GLenum func, GLclampf ref) -{ -} - -/* SGI_index_material */ -void glIndexMaterialSGI(GLenum face, GLenum mode) -{ -} - -/* WIN_swap_hint */ -void glAddSwapHintRectWin(GLint x, GLint y, GLsizei width, GLsizei height) -{ -} - diff --git a/utils/glcanvas/win/glcanvas.h b/utils/glcanvas/win/glcanvas.h deleted file mode 100644 index e684478b28..0000000000 --- a/utils/glcanvas/win/glcanvas.h +++ /dev/null @@ -1,165 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: glcanvas.h -// Purpose: wxGLCanvas, for using OpenGL with wxWindows under Windows -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma interface "glcanvas.h" -#endif - -#ifndef _WX_GLCANVAS_H_ -#define _WX_GLCANVAS_H_ - -#include - -#include - -#include "gl/gl.h" - -//--------------------------------------------------------------------------- -// Constants for attriblist -//--------------------------------------------------------------------------- - -enum -{ - WX_GL_RGBA=1, /* use true color palette */ - WX_GL_DEPTH_SIZE, /* bits for Z-buffer (0,16,32) */ - WX_GL_DOUBLEBUFFER, /* use doublebuffer */ - WX_GL_MIN_RED, /* use red buffer with most bits (> MIN_RED bits) */ - WX_GL_MIN_GREEN, /* use green buffer with most bits (> MIN_GREEN bits) */ - WX_GL_MIN_BLUE /* use blue buffer with most bits (> MIN_BLUE bits) */ -/* these are enough constants for now, the remaining will be added later */ -}; - -class wxGLCanvas; /* forward reference */ - -class wxGLContext: public wxObject -{ -public: - wxGLContext(bool isRGB, wxGLCanvas *win, const wxPalette& palette = wxNullPalette); - wxGLContext( - bool isRGB, wxGLCanvas *win, - const wxPalette& WXUNUSED(palette), - const wxGLContext *other /* for sharing display lists */ - ); - ~wxGLContext(); - - void SetCurrent(); - void SetColour(const char *colour); - void SwapBuffers(); - - - inline wxWindow* GetWindow() const { return m_window; } - inline WXHDC GetHDC() const { return m_hDC; } - inline HGLRC GetGLRC() const { return m_glContext; } - -public: - HGLRC m_glContext; - WXHDC m_hDC; - wxWindow* m_window; -}; - -class wxGLCanvas: public wxScrolledWindow -{ - DECLARE_CLASS(wxGLCanvas) - public: - wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette); - wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL, - wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas", - int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette ); - wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette ); - ~wxGLCanvas(); - - // Replaces wxWindow::Create functionality, since we need to use a different window class - bool Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, const wxSize& size, long style, const wxString& name); - - void SetCurrent(); - void SetColour(const char *colour); - void SwapBuffers(); - - void OnSize(wxSizeEvent& event); - - void OnQueryNewPalette(wxQueryNewPaletteEvent& event); - void OnPaletteChanged(wxPaletteChangedEvent& event); - - inline wxGLContext* GetContext() const { return m_glContext; } - - - inline WXHDC GetHDC() const { return m_hDC; } - void SetupPixelFormat(); - void SetupPalette(const wxPalette& palette); - wxPalette CreateDefaultPalette(); - - inline wxPalette* GetPalette() const { return (wxPalette*) & m_palette; } - -protected: - wxGLContext* m_glContext; // this is typedef-ed ptr, in fact - wxPalette m_palette; - WXHDC m_hDC; - -DECLARE_EVENT_TABLE() -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/* Give extensions proper function names. */ - -/* N.B. - this is not completely implemented as yet */ - -/* EXT_vertex_array */ -void glArrayElementEXT(GLint i); -void glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -void glDrawArraysEXT(GLenum mode, GLint first, GLsizei count); -void glEdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *pointer); -void glGetPointervEXT(GLenum pname, GLvoid* *params); -void glIndexPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -void glNormalPointerEXT(GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -void glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); -void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); - -/* EXT_color_subtable */ -void glColorSubtableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table); - -/* EXT_color_table */ -void glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -void glCopyColorTableEXT(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); -void glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid *table); -void glGetColorTableParamaterfvEXT(GLenum target, GLenum pname, GLfloat *params); -void glGetColorTavleParameterivEXT(GLenum target, GLenum pname, GLint *params); - -/* SGI_compiled_vertex_array */ -void glLockArraysSGI(GLint first, GLsizei count); -void glUnlockArraysSGI(); - -/* SGI_cull_vertex */ -void glCullParameterdvSGI(GLenum pname, GLdouble* params); -void glCullParameterfvSGI(GLenum pname, GLfloat* params); - -/* SGI_index_func */ -void glIndexFuncSGI(GLenum func, GLclampf ref); - -/* SGI_index_material */ -void glIndexMaterialSGI(GLenum face, GLenum mode); - -/* WIN_swap_hint */ -void glAddSwapHintRectWin(GLint x, GLint y, GLsizei width, GLsizei height); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/utils/glcanvas/win/makefile.b32 b/utils/glcanvas/win/makefile.b32 deleted file mode 100644 index 97783fb2d7..0000000000 --- a/utils/glcanvas/win/makefile.b32 +++ /dev/null @@ -1,17 +0,0 @@ -# -# File: makefile.b32 -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: -# -# Makefile : Builds wxGLCanvas library for 32-bit BC++ - -WXDIR = $(WXWIN) - -LIBTARGET=$(WXDIR)\lib\glcanvas.lib - -OBJECTS = glcanvas.obj - -!include $(WXDIR)\src\makelib.b32 - diff --git a/utils/glcanvas/win/makefile.bcc b/utils/glcanvas/win/makefile.bcc deleted file mode 100644 index 705fc065bc..0000000000 --- a/utils/glcanvas/win/makefile.bcc +++ /dev/null @@ -1,19 +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=minimal -OBJECTS=$(TARGET).obj - -!include $(WXDIR)\src\makeprog.bcc - diff --git a/utils/glcanvas/win/makefile.g95 b/utils/glcanvas/win/makefile.g95 deleted file mode 100644 index 98be5a9d86..0000000000 --- a/utils/glcanvas/win/makefile.g95 +++ /dev/null @@ -1,16 +0,0 @@ -# -# File: makefile.g95 -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: (c) Julian Smart, 1999 -# -# Makefile for wxWindows wxGLCanvas library Cygwin/Mingw32). - -WXDIR = ../../.. - -LIBTARGET=$(WXDIR)/lib/libglcanvas.a -OBJECTS = glcanvas.o - -include $(WXDIR)/src/makelib.g95 - diff --git a/utils/glcanvas/win/makefile.vc b/utils/glcanvas/win/makefile.vc deleted file mode 100644 index ebe99e4e97..0000000000 --- a/utils/glcanvas/win/makefile.vc +++ /dev/null @@ -1,103 +0,0 @@ -# -# File: makefile.nt -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds GLCanvas class library (MS VC++). -# Use FINAL=1 argument to nmake to build final version with no debugging -# info - -# Set WXDIR for your system -WXDIR = $(WXWIN) -GLDIR = $(WXDIR)\utils\glcanvas -THISDIR = $(GLDIR)\win -EXTRALIBS=$(WXDIR)\lib\glcanvas$(LIBEXT).lib -DOCDIR=$(WXDIR)\docs -LOCALDOCDIR=$(WXDIR)\utils\glcanvas\docs - - -!include $(WXDIR)\src\makevc.env - -LIBTARGET=$(WXDIR)\lib\glcanvas$(LIBEXT).lib -OBJECTS = $(D)\glcanvas.obj - -all: $(D) $(LIBTARGET) - -$(D) : - mkdir $(D) - -$(LIBTARGET): $(OBJECTS) - -erase $(LIBTARGET) - $(implib) @<< --out:$(LIBTARGET) --machine:$(CPU) -$(OBJECTS) -<< - -$(D)\glcanvas.obj: glcanvas.h glcanvas.$(SRCSUFF) $(DUMMYOBJ) - $(cc) @<< -$(CPPFLAGS) /c /Fo$@ /Tp $(*B).$(SRCSUFF) -<< - - -clean: - -erase $(D)\*.obj - -erase *.sbr - -erase *.exe - -erase *.res - -erase *.map - -erase *.pdb - -erase $(LIBTARGET) - - - - - -DOCSOURCES=$(LOCALDOCDIR)\manual.tex $(LOCALDOCDIR)\classes.tex - -html: $(DOCDIR)\html\glcanvas\glcanvas.htm -hlp: $(DOCDIR)\winhelp\glcanvas.hlp -ps: $(WXDIR)\docs\ps\glcanvas.ps - -$(DOCDIR)\winhelp\glcanvas.hlp: $(LOCALDOCDIR)\glcanvas.rtf $(LOCALDOCDIR)\glcanvas.hpj - cd $(LOCALDOCDIR) - -erase glcanvas.ph - hc glcanvas - move glcanvas.hlp $(DOCDIR)\winhelp\glcanvas.hlp - move glcanvas.cnt $(DOCDIR)\winhelp\glcanvas.cnt - cd $(THISDIR) - -$(LOCALDOCDIR)\glcanvas.rtf: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -start /w tex2rtf $(LOCALDOCDIR)\manual.tex $(LOCALDOCDIR)\glcanvas.rtf -twice -winhelp - cd $(THISDIR) - -$(DOCDIR)\html\glcanvas\glcanvas.htm: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -mkdir $(DOCDIR)\html\glcanvas - -start /w tex2rtf $(LOCALDOCDIR)\manual.tex $(DOCDIR)\html\glcanvas\glcanvas.htm -twice -html - -erase $(DOCDIR)\html\glcanvas\*.con - -erase $(DOCDIR)\html\glcanvas\*.ref - cd $(THISDIR) - -$(LOCALDOCDIR)\manual.dvi: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -latex manual - -latex manual - -makeindx manual - -bibtex manual - -latex manual - -latex manual - cd $(THISDIR) - -$(WXDIR)\docs\ps\glcanvas.ps: $(LOCALDOCDIR)\manual.dvi - cd $(LOCALDOCDIR) - -dvips32 -o glcanvas.ps manual - move glcanvas.ps $(WXDIR)\docs\ps\glcanvas.ps - cd $(THISDIR) - - diff --git a/utils/glcanvas/win/makefile.wat b/utils/glcanvas/win/makefile.wat deleted file mode 100644 index 7b533107ee..0000000000 --- a/utils/glcanvas/win/makefile.wat +++ /dev/null @@ -1,16 +0,0 @@ -#!/binb/wmake.exe -# -# File: makefile.wat -# Author: Julian Smart -# Created: 1999 -# -# Makefile : Builds wxGLCanvas library for Watcom C++, WIN32 - -WXDIR = $(%WXWIN) - -OBJECTS=glcanvas.obj -LIBTARGET=$(WXDIR)\lib\glcanvas.lib - -!include $(WXDIR)\src\makelib.wat - - diff --git a/utils/projgen/makeproj.cpp b/utils/projgen/makeproj.cpp index 4003324e5f..63c8ce205c 100644 --- a/utils/projgen/makeproj.cpp +++ b/utils/projgen/makeproj.cpp @@ -303,6 +303,7 @@ void MyApp::GenerateSamples(const wxString& dir) GenerateSample("ExecVC", "exec", dir + wxString("/samples/exec"), wxStringList("exec.cpp", 0)); GenerateSample("FontVC", "font", dir + wxString("/samples/font"), wxStringList("font.cpp", 0)); GenerateSample("MenuVC", "menu", dir + wxString("/samples/menu"), wxStringList("menu.cpp", 0)); + GenerateSample("TreelayVC", "test", dir + wxString("/samples/treelay"), wxStringList("test.cpp", "test.h", 0)); //// Demos @@ -433,7 +434,7 @@ void MyApp::GenerateSamples(const wxString& dir) } // wxTreeLayout sample - +#if 0 project.SetIncludeDirs(wxStringList("../../../include", 0)); project.SetResourceIncludeDirs(wxStringList("../../../include", 0)); project.SetLibDirs(wxStringList("../../../lib", 0)); @@ -450,6 +451,7 @@ void MyApp::GenerateSamples(const wxString& dir) wxString msg("Could not generate wxTreeLayout project"); wxMessageBox(msg); } +#endif // OGLEdit. We have to do it the long way because we need to add the extra ogl.lib. diff --git a/utils/wxtree/docs/back.gif b/utils/wxtree/docs/back.gif deleted file mode 100644 index 8a61076d3b..0000000000 Binary files a/utils/wxtree/docs/back.gif and /dev/null differ diff --git a/utils/wxtree/docs/books.gif b/utils/wxtree/docs/books.gif deleted file mode 100644 index 26ff394df6..0000000000 Binary files a/utils/wxtree/docs/books.gif and /dev/null differ diff --git a/utils/wxtree/docs/classes.tex b/utils/wxtree/docs/classes.tex deleted file mode 100644 index 98b9e89ee2..0000000000 --- a/utils/wxtree/docs/classes.tex +++ /dev/null @@ -1,304 +0,0 @@ -\chapter{wxTreeLayout Class Reference} -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage} - -\section{\class{wxTreeLayout}}\label{wxtreelayout} - -This abstract class is used for drawing a tree. You must derive a new -class from this, and define member functions to access the data that -wxTreeLayout needs. - -Nodes are identified by long integer identifiers. The derived class -communicates the actual tree structure to wxTreeLayout by defining \helprefn{wxTreeLayout::GetChildren}{getchildren}\rtfsp -and \helprefn{wxTreeLayout::GetNodeParent}{getnodeparent} functions. - -The application should call \helprefn{DoLayout}{dolayout} to do the tree -layout. Depending on how the derived class has been defined, either -\rtfsp\helprefn{wxTreeLayout::Draw}{draw} must be called (for example by the OnPaint member -of a wxScrolledWindow) or the application-defined drawing code should be called -as normal. - -For example, if you have an image drawing system already defined, you -may want wxTreeLayout to position existing node images in that system. So you -just need a way for wxTreeLayout to set the node image positions according to -the layout algorithm, and the rest will be done by your own image drawing -system. - -\wxheading{Derived from} - -wxObject - -\latexignore{\rtfignore{\wxheading{Members}}} - -\membersection{wxTreeLayout::wxTreeLayout} - -\func{}{wxTreeLayout}{\void} - -Constructor. - -\membersection{wxTreeLayout::ActivateNode}\label{activatenode} - -\func{void}{ActivateNode}{\param{long}{ id}, \param{bool }{active}} - -Define this so wxTreeLayout can turn nodes on and off for drawing purposes -(not all nodes may be connected in the tree). See also \helprefn{NodeActive}{nodeactive}. - -\membersection{wxTreeLayout::CalcLayout} - -\func{void}{CalcLayout}{\param{long}{ id}, \param{int}{ level}} - -Private function for laying out a branch. - -\membersection{wxTreeLayout::DoLayout}\label{dolayout} - -\func{void}{DoLayout}{\param{wxDC\&}{ dc}, \param{long}{ topNode = -1}} - -Calculates the layout for the tree, optionally specifying the top node. - -\membersection{wxTreeLayout::Draw}\label{draw} - -\func{void}{Draw}{\param{wxDC\&}{ dc}} - -Call this to let wxTreeLayout draw the tree itself, once the layout has been -calculated with \helprefn{DoLayout}{dolayout}. - -\membersection{wxTreeLayout::DrawBranch} - -\func{void}{DrawBranch}{\param{long}{ from}, \param{long}{ to}, \param{wxDC\&}{ dc}} - -Defined by wxTreeLayout to draw an arc between two nodes. - -\membersection{wxTreeLayout::DrawBranches} - -\func{void}{DrawBranches}{\param{wxDC\&}{ dc}} - -Defined by wxTreeLayout to draw the arcs between nodes. - -\membersection{wxTreeLayout::DrawNode} - -\func{void}{DrawNode}{\param{long}{ id}, \param{wxDC\&}{ dc}} - -Defined by wxTreeLayout to draw a node. - -\membersection{wxTreeLayout::DrawNodes} - -\func{void}{DrawNodes}{\param{wxDC\&}{ dc}} - -Defined by wxTreeLayout to draw the nodes. - -\membersection{wxTreeLayout::GetChildren}\label{getchildren} - -\func{void}{GetChildren}{\param{long}{ id}, \param{wxList \&}{list}} - -Must be defined to return the children of node {\it id} in the given list -of integers. - -\membersection{wxTreeLayout::GetNextNode}\label{getnextnode} - -\func{long}{GetNextNode}{\param{long}{ id}} - -Must be defined to return the next node after {\it id}, so that wxTreeLayout can -iterate through all relevant nodes. The ordering is not important. -The function should return -1 if there are no more nodes. - -\membersection{wxTreeLayout::GetNodeName} - -\constfunc{wxString}{GetNodeName}{\param{long}{ id}} - -May optionally be defined to get a node's name (for example if leaving -the drawing to wxTreeLayout). - -\membersection{wxTreeLayout::GetNodeSize} - -\constfunc{void}{GetNodeSize}{\param{long}{ id}, \param{long*}{ x}, \param{long*}{ y}} - -Can be defined to indicate a node's size, or left to wxTreeLayout to use the -name as an indication of size. - -\membersection{wxTreeLayout::GetNodeParent}\label{getnodeparent} - -\constfunc{long}{GetNodeParent}{\param{long}{ id}} - -Must be defined to return the parent node of {\it id}. -The function should return -1 if there is no parent. - -\membersection{wxTreeLayout::GetNodeX} - -\constfunc{long}{GetNodeX}{\param{long}{ id}} - -Must be defined to return the current X position of the node. Note that -coordinates are assumed to be at the top-left of the node so some conversion -may be necessary for your application. - -\membersection{wxTreeLayout::GetNodeY} - -\constfunc{long}{GetNodeY}{\param{long}{ id}} - -Must be defined to return the current Y position of the node. Note that -coordinates are assumed to be at the top-left of the node so some conversion -may be necessary for your application. - -\membersection{wxTreeLayout::GetLeftMargin} - -\constfunc{long}{GetLeftMargin}{\void} - -Gets the left margin set with \helprefn{SetMargins}{setmargins}. - -\membersection{wxTreeLayout::GetOrientation} - -\constfunc{bool}{GetOrientation}{\void} - -Gets the orientation: TRUE means top-to-bottom, FALSE means left-to-right (the default). - -\membersection{wxTreeLayout::GetTopMargin} - -\constfunc{long}{GetTopMargin}{\void} - -Gets the top margin set with \helprefn{SetMargins}{setmargins}. - -\membersection{wxTreeLayout::GetTopNode} - -\constfunc{long}{GetTopNode}{\void} - -wxTreeLayout calls this to get the top of the tree. Don't redefine this; call -\rtfsp\helprefn{SetTopNode}{settopnode} instead before calling \helprefn{DoLayout}{dolayout}. - -\membersection{wxTreeLayout::GetXSpacing} - -\constfunc{long}{GetXSpacing}{\void} - -Gets the horizontal spacing between nodes. - -\membersection{wxTreeLayout::GetYSpacing} - -\constfunc{long}{GetYSpacing}{\void} - -Gets the vertical spacing between nodes. - -\membersection{wxTreeLayout::Initialize} - -\func{void}{Initialize}{\void} - -Initializes wxTreeLayout. Call from application or overridden {\bf Initialize} -or constructor. - -\membersection{wxTreeLayout::NodeActive}\label{nodeactive} - -\func{bool}{NodeActive}{\param{long}{ id}} - -Define this so wxTreeLayout can know which nodes are to be drawn (not all -nodes may be connected in the tree). See also \helprefn{ActivateNode}{activatenode}. - -\membersection{wxTreeLayout::SetNodeName} - -\func{void}{SetNodeName}{\param{long}{ id}, \param{const wxString\& }{ name}} - -May optionally be defined to set a node's name. - -\membersection{wxTreeLayout::SetNodeX} - -\func{void}{SetNodeX}{\param{long}{ id}, \param{long}{ x}} - -Must be defined to set the current X position of the node. Note that -coordinates are assumed to be at the top-left of the node so some conversion -may be necessary for your application. - -\membersection{wxTreeLayout::SetNodeY} - -\func{void}{SetNodeY}{\param{long}{ id}, \param{long}{ y}} - -Must be defined to set the current Y position of the node. Note that -coordinates are assumed to be at the top-left of the node so some conversion -may be necessary for your application. - -\membersection{wxTreeLayout::SetOrientation} - -\func{void}{SetOrientation}{\param{bool}{ orientation}} - -Sets the tree orientation: TRUE means top-to-bottom, FALSE means left-to-right (the default). - -\membersection{wxTreeLayout::SetTopNode}\label{settopnode} - -\func{void}{SetTopNode}{\param{long}{ id}} - -Call this to identify the top of the tree to wxTreeLayout. - -\membersection{wxTreeLayout::SetSpacing} - -\func{void}{SetSpacing}{\param{long}{ x}, \param{long}{ y}} - -Sets the horizontal and vertical spacing between nodes in the tree. - -\membersection{wxTreeLayout::SetMargins}\label{setmargins} - -\func{void}{SetMargins}{\param{long}{ x}, \param{long}{ y}} - -Sets the left and top margins of the whole tree. - -\section{\class{wxStoredTree}}\label{wxstoredtree} - -wxStoredTree provides storage for node labels, position and client data. It also provides hit-testing -(which node a mouse event occurred on). It is usually a more convenient class to use than wxTreeLayout. - -\wxheading{Derived from} - -\helpref{wxTreeLayout}{wxtreelayout} - -\latexignore{\rtfignore{\wxheading{Members}}} - -\membersection{wxStoredTree::wxStoredTree} - -\func{}{wxStoredTree}{\param{int }{noNodes = 200}} - -Constructor. Specify the maximum number of nodes to be allocated. - -\membersection{wxStoredTree::AddChild}\label{wxstoredtreeaddchild} - -\func{long}{AddChild}{\param{const wxString\&}{ name}, \param{const wxString\&}{ parent = ""}} - -Adds a child with a given parent, returning the node id. - -\membersection{wxStoredTree::GetClientData}\label{wxstoredtreegetclientdata} - -\constfunc{long}{GetClientData}{\param{long}{ id}} - -Gets the client data for the given node. - -\membersection{wxStoredTree::GetNode}\label{wxstoredtreegetnode} - -\constfunc{wxStoredNode*}{GetNode}{\param{long}{ id}} - -Returns the wxStoredNode object for the given node id. - -\membersection{wxStoredTree::GetNodeCount}\label{wxstoredtreegetnodecount} - -\constfunc{int}{GetNodeCount}{\void} - -Returns the current number of nodes. - -\membersection{wxStoredTree::GetNumNodes}\label{wxstoredtreegetnumnodes} - -\constfunc{int}{GetNumNodes}{\void} - -Returns the maximum number of nodes. - -\membersection{wxStoredTree::HitTest}\label{wxstoredtreehittest} - -\func{wxString}{HitTest}{\param{wxMouseEvent\&}{ event}, \param{wxDC\& }{dc}} - -Returns a string with the node name corresponding to the position of the mouse event, or the empty string if no node -was detected. - -\membersection{wxStoredTree::NameToId}\label{wxstoredtreenametoid} - -\func{long}{NameToId}{\param{const wxString\&}{ name}} - -Returns the id for the given node name, or -1 if there was no such node. - -\membersection{wxStoredTree::SetClientData}\label{wxstoredtreesetclientdata} - -\func{void}{SetClientData}{\param{long}{ id}, \param{long}{ clientData}} - -Sets client data for the given node. - - diff --git a/utils/wxtree/docs/contents.gif b/utils/wxtree/docs/contents.gif deleted file mode 100644 index 3dddfa3dd5..0000000000 Binary files a/utils/wxtree/docs/contents.gif and /dev/null differ diff --git a/utils/wxtree/docs/forward.gif b/utils/wxtree/docs/forward.gif deleted file mode 100644 index 9c81e8c92f..0000000000 Binary files a/utils/wxtree/docs/forward.gif and /dev/null differ diff --git a/utils/wxtree/docs/tex2rtf.ini b/utils/wxtree/docs/tex2rtf.ini deleted file mode 100644 index 8b55040f1f..0000000000 --- a/utils/wxtree/docs/tex2rtf.ini +++ /dev/null @@ -1,28 +0,0 @@ -;;; Tex2RTF initialisation file -runTwice = yes -titleFontSize = 12 -authorFontSize = 10 -authorFontSize = 10 -chapterFontSize = 12 -sectionFontSize = 12 -subsectionFontSize = 12 -contentsDepth = 2 -headerRule = yes -footerRule = yes -useHeadingStyles = yes -listItemIndent=40 -generateHPJ = no -htmlBrowseButtons = bitmap -winHelpContents = yes -winHelpVersion = 3 ; 3 for Windows 3.x, 4 for Windows 95 -winHelpTitle = "wxTreeLayout 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}} diff --git a/utils/wxtree/docs/tree.bib b/utils/wxtree/docs/tree.bib deleted file mode 100644 index 9793c41c47..0000000000 --- a/utils/wxtree/docs/tree.bib +++ /dev/null @@ -1,8 +0,0 @@ -@techreport{robins87, -author = {Robins, Gabriel}, -title = {The {ISI} grapher: a portable tool for displaying graphs pictorially (ISI/RS-87-196)}, -institution = {University of South California}, -year = {1987}, -month = {September} -} - diff --git a/utils/wxtree/docs/treetst.bmp b/utils/wxtree/docs/treetst.bmp deleted file mode 100644 index fd6103035f..0000000000 Binary files a/utils/wxtree/docs/treetst.bmp and /dev/null differ diff --git a/utils/wxtree/docs/treetst.gif b/utils/wxtree/docs/treetst.gif deleted file mode 100644 index e9f7841957..0000000000 Binary files a/utils/wxtree/docs/treetst.gif and /dev/null differ diff --git a/utils/wxtree/docs/up.gif b/utils/wxtree/docs/up.gif deleted file mode 100644 index 316d0d2a14..0000000000 Binary files a/utils/wxtree/docs/up.gif and /dev/null differ diff --git a/utils/wxtree/docs/wxtree.tex b/utils/wxtree/docs/wxtree.tex deleted file mode 100644 index bf14b0dc75..0000000000 --- a/utils/wxtree/docs/wxtree.tex +++ /dev/null @@ -1,73 +0,0 @@ -\documentstyle[a4,makeidx,verbatim,texhelp,fancyhea,mysober,mytitle]{report}% -\newcommand{\indexit}[1]{#1\index{#1}}% -\newcommand{\pipe}[0]{$\|$\ }% -\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 -\parskip=10pt% -\title{Manual for wxTreeLayout 2.0: a tree layout library for wxWindows} -\author{Julian Smart\\Anthemion Software} -\date{July 1998}% -\makeindex% -\begin{document}% -\maketitle - -\pagestyle{fancyplain} -\bibliographystyle{plain} -\pagenumbering{roman} -\setheader{{\it CONTENTS}}{}{}{}{}{{\it CONTENTS}} -\setfooter{\thepage}{}{}{}{}{\thepage} -\tableofcontents% - -\chapter{Introduction} -\pagenumbering{arabic}% -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage} - -This manual describes a tree-drawing class library for wxWindows. It -provides layout of simple trees with one root node, drawn left-to-right, -with user-defined spacing between nodes. - -wxTreeLayout is an abstract class that must be subclassed. The programmer -defines various member functions which will access whatever data structures -are appropriate for the application, and wxTreeLayout uses these when laying -out the tree. - -wxStoredTree is a class derived from wxTreeLayout that may be used directly to -draw trees on a canvas. It supplies storage for the nodes, and draws -to a device context. - -\helponly{Below is the example tree generated by the program test.cc. - -\begin{figure} -$$\image{11cm;0cm}{treetst.ps}$$ -\caption{Example tree}\label{exampletree} -\end{figure} -} - -\chapter{Implementation} -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage} - -The algorithm is due to Gabriel Robins \cite{robins87}, a linear-time -algorithm originally implemented in LISP for AI applications. - -The original algorithm has been modified so that both X and Y planes -are calculated simultaneously, increasing efficiency slightly. The basic -code is only a page or so long. - -\input classes.tex -% -\bibliography{tree} - -\addcontentsline{toc}{chapter}{Index} -\setheader{{\it INDEX}}{}{}{}{}{{\it INDEX}}% -\setfooter{\thepage}{}{}{}{}{\thepage} -\printindex -\end{document} diff --git a/utils/wxtree/lib/dummy b/utils/wxtree/lib/dummy deleted file mode 100644 index bfdf726d49..0000000000 --- a/utils/wxtree/lib/dummy +++ /dev/null @@ -1 +0,0 @@ -I'm just here to force the creation of a LIB directory. diff --git a/utils/wxtree/src/makefile.b32 b/utils/wxtree/src/makefile.b32 deleted file mode 100644 index fe9d9fb3e3..0000000000 --- a/utils/wxtree/src/makefile.b32 +++ /dev/null @@ -1,16 +0,0 @@ -# -# File: makefile.b32 -# Author: Julian Smart -# Created: 1999 -# Updated: -# -# -# Makefile : Builds wxTree sample for 32-bit BC++ - -WXDIR = $(WXWIN) - -TARGET=test -OBJECTS=$(TARGET).obj wxtree.obj - -!include $(WXDIR)\src\makeprog.b32 - diff --git a/utils/wxtree/src/makefile.bcc b/utils/wxtree/src/makefile.bcc deleted file mode 100644 index 69a61d94eb..0000000000 --- a/utils/wxtree/src/makefile.bcc +++ /dev/null @@ -1,16 +0,0 @@ -# -# File: makefile.bcc -# Author: Julian Smart -# Created: 1999 -# Updated: -# -# -# Makefile : Builds wxTree sample for 16-bit BC++ - -WXDIR = $(WXWIN) - -TARGET=test -OBJECTS=$(TARGET).obj wxtree.obj - -!include $(WXDIR)\src\makeprog.bcc - diff --git a/utils/wxtree/src/makefile.dos b/utils/wxtree/src/makefile.dos deleted file mode 100644 index c78d0a7cfb..0000000000 --- a/utils/wxtree/src/makefile.dos +++ /dev/null @@ -1,118 +0,0 @@ -# -# File: makefile.dos -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds tree library and example (DOS). -# Use FINAL=1 argument to nmake to build final version with no debugging -# info - -# Set WXDIR for your system -WXDIR = $(WXWIN) - -!include $(WXDIR)\src\makemsc.env - -TREEDIR = $(WXDIR)\utils\wxtree -TREELIB = $(TREEDIR)\lib\wxtree.lib -DOCDIR = $(TREEDIR)\docs -THISDIR = $(TREEDIR)\src -EXTRALIBS = $(TREELIB) -INC=-I$(WXDIR)\include\base -I$(WXDIR)\include\msw -DUMMY=$(WXDIR)\src\msw\dummy.obj - -# Default is to output RTF for WinHelp -!ifndef RTFSTYLE -RTFSTYLE=-winhelp -!endif - -HEADERS = wxtree.h -SOURCES = wxtree.$(SRCSUFF) -OBJECTS = wxtree.obj - -all: $(TREELIB) - -test: test.exe - -wx: - cd $(WXDIR)\src\msw - nmake -f makefile.dos FINAL=$(FINAL) - cd $(TREEDIR)\src - -wxclean: - cd $(WXDIR)\src\msw - nmake -f makefile.dos clean - cd $(TREEDIR)\src - -$(TREELIB): $(OBJECTS) - -erase $(TREELIB) - lib /PAGESIZE:128 @<< -$(TREELIB) -y -$(OBJECTS) -nul -; -<< - -test.exe: $(DUMMY) $(WXLIB) $(TREELIB) test.obj test.def test.res - link $(LINKFLAGS) @<< -$(DUMMY) test.obj, -test, -NUL, -$(LIBS), -test.def -; -<< - rc -31 -K test.res - -wxtree.obj: wxtree.h wxtree.$(SRCSUFF) $(DUMMY) - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -test.obj: test.h wxtree.h test.$(SRCSUFF) $(DUMMY) - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -test.res : test.rc $(WXDIR)\include\msw\wx.rc - rc -r /dFAFA_LIB /i$(WXDIR)\contrib\fafa /i$(WXDIR)\include\msw test - -# Making documents -docs: hlp xlp -hlp: $(DOCDIR)/wxtree.hlp -xlp: $(DOCDIR)/wxtree.xlp -rtf: $(DOCDIR)/wxtree.rtf - -$(DOCDIR)/wxtree.hlp: $(DOCDIR)/wxtree.rtf $(DOCDIR)/wxtree.hpj - cd $(DOCDIR) - -erase wxtree.ph - hc wxtree - cd $(THISDIR) - -$(DOCDIR)/wxtree.rtf: $(DOCDIR)/manual.tex $(DOCDIR)/classes.tex - cd $(DOCDIR) - -wx /W tex2rtf $(DOCDIR)\manual.tex $(DOCDIR)\wxtree.rtf -twice $(RTFSTYLE) - cd $(THISDIR) - -$(DOCDIR)/wxtree.xlp: $(DOCDIR)/manual.tex $(DOCDIR)/classes.tex - cd $(DOCDIR) - -wx /W tex2rtf $(DOCDIR)\manual.tex $(DOCDIR)\wxtree.xlp -twice -xlp - cd $(THISDIR) - -cleanrtf: - cd $(DOCDIR) - -erase *.rtf - cd $(THISDIR) - -clean: - -erase *.obj - -erase *.sbr - -erase *.exe - -erase *.res - -erase *.map - -erase *.pdb - -erase $(TREELIB) diff --git a/utils/wxtree/src/makefile.g95 b/utils/wxtree/src/makefile.g95 deleted file mode 100644 index 721817437c..0000000000 --- a/utils/wxtree/src/makefile.g95 +++ /dev/null @@ -1,16 +0,0 @@ -# -# File: makefile.g95 -# Author: Julian Smart -# Created: 1999 -# Updated: -# Copyright: (c) Julian Smart, 1999 -# -# Makefile for wxWindows sample (Cygwin/Mingw32). - -WXDIR = $(WXWIN) - -TARGET=test -OBJECTS = $(TARGET).o wxtree.o - -include $(WXDIR)/src/makeprog.g95 - diff --git a/utils/wxtree/src/makefile.sc b/utils/wxtree/src/makefile.sc deleted file mode 100644 index a03ad23365..0000000000 --- a/utils/wxtree/src/makefile.sc +++ /dev/null @@ -1,73 +0,0 @@ -# Symantec C++ makefile for the tree library -# NOTE that peripheral libraries are now dealt in main wxWindows makefile. - -WXDIR = $(WXWIN) - -WXLIB = $(WXDIR)\lib\wx.lib -INCDIR = $(WXDIR)\include -MSWINC = $(INCDIR)\msw -BASEINC = $(INCDIR)\base - -include $(WXDIR)\src\makesc.env - -TREEDIR = $(WXDIR)\utils\wxtree -TREEINC = $(TREEDIR)\src -TREELIB = $(TREEDIR)\lib\wxtree.lib - -DOCDIR = $(TREEDIR)\docs -SRCDIR = $(TREEDIR)\src - -# Default is to output RTF for WinHelp -WINHELP=-winhelp - -INCLUDE=$(BASEINC);$(MSWINC) - -LIBS=$(TREELIB) $(WXLIB) libw.lib commdlg.lib shell.lib - -.$(SRCSUFF).obj: - *$(CC) -c $(CFLAGS) -I$(INCLUDE) $< - -.rc.res: - *$(RC) -r -I$(INCLUDE) $< - -$(TREELIB): wxtree.obj - -del $(TREELIB) - *lib $(TREELIB) y wxtree.obj, nul; - -wxtree.obj: wxtree.h wxtree.$(SRCSUFF) - -test.exe: test.obj test.def test.res - *$(CC) $(LDFLAGS) -o$@ test.obj test.def $(LIBS) - *$(RC) -k test.res - -test.obj: test.h wxtree.h test.$(SRCSUFF) - -# Making documents -docs: hlp xlp -hlp: $(DOCDIR)/wxtree.hlp -xlp: $(DOCDIR)/wxtree.xlp -rtf: $(DOCDIR)/wxtree.rtf - -$(DOCDIR)/wxtree.hlp: $(DOCDIR)/wxtree.rtf $(DOCDIR)/wxtree.hpj - cd $(DOCDIR) - -erase wxtree.ph - hc wxtree - cd $(SRCDIR) - -$(DOCDIR)/wxtree.rtf: $(DOCDIR)/manual.tex $(DOCDIR)/classes.tex - cd $(DOCDIR) - -wx tex2rtf $(DOCDIR)\manual.tex $(DOCDIR)\wxtree.rtf -twice -winhelp - cd $(SRCDIR) - -$(DOCDIR)/wxtree.xlp: $(DOCDIR)/manual.tex $(DOCDIR)/classes.tex - cd $(DOCDIR) - -wx tex2rtf $(DOCDIR)\manual.tex $(DOCDIR)\wxtree.xlp -twice -xlp - cd $(SRCDIR) - -clean: - -del *.obj - -del *.exe - -del *.res - -del *.map - -del *.rws - -del $(TREELIB) diff --git a/utils/wxtree/src/makefile.unx b/utils/wxtree/src/makefile.unx deleted file mode 100644 index 0d0d64162e..0000000000 --- a/utils/wxtree/src/makefile.unx +++ /dev/null @@ -1,133 +0,0 @@ -# -# File: makefile.unx -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile for tree library and example (UNIX). -# Change the WXDIR directory, and CPPFLAGS and LDFLAGS, for your system. - -WXDIR = ../../.. - -# All common UNIX compiler flags and options are now in -# this central makefile. -include $(WXDIR)/src/make.env - -TREEDIR = $(WXDIR)/utils/wxtree -TREEINC = $(TREEDIR)/src -TREELIB = $(TREEDIR)/lib/libwxtree$(GUISUFFIX).a - -SOURCES = tree.$(SRCSUFF) -HEADERS = tree.h -OBJECTS = $(OBJDIR)/wxtree.$(OBJSUFF) - -TESTOBJECTS = $(OBJDIR)/test.$(OBJSUFF) -TESTPROGRAM = $(TREEDIR)/src/test$(GUISUFFIX) - -DOCUTILSDIR = $(WXDIR)/utils/tex2rtf/src - -LDFLAGS = $(XLIB) -L$(WXDIR)/lib -L$(TREEDIR)/lib - -XVIEWLDLIBS = -lwxtree_ol -lwx_ol -lxview -lolgx -lX11 -lm $(COMPLIBS) -MOTIFLDLIBS = -lwxtree_motif -lwx_motif -lXm -lXmu -lXt -lX11 -lm $(COMPLIBS) -HPLDLIBS = -lwxtree_hp -lwx_hp -lXm -lXmu -lXt -lX11 -lm $(COMPLIBS) -# Default -LDLIBS=$(XVIEWLDLIBS) - -.SUFFIXES: - -all: $(OBJDIR) $(TREELIB) - -demo: $(TESTPROGRAM) - -$(TREELIB): $(OBJECTS) - rm -f $@ - ar $(AROPTIONS) $@ $(OBJECTS) - $(RANLIB) $@ - -wxmotif: - cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif DEBUG='$(DEBUG)' - -wxxview: - cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview DEBUG='$(DEBUG)' - -motif: - cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif OPT='$(OPT)' DEBUG='$(DEBUG)' - $(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif DEBUG='$(DEBUG)' OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' XVIEW_LINK= - -xview: - cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview OPT='$(OPT)' DEBUG='$(DEBUG)' - $(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol OPT='$(OPT)' DEBUG='$(DEBUG)' - -demo_motif: - $(MAKE) -f makefile.unx all test_motif GUI=-Dwx_motif GUISUFFIX=_motif DEBUG='$(DEBUG)' OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' XVIEW_LINK= - -demo_ol: - cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview OPT='$(OPT)' DEBUG='$(DEBUG)' - $(MAKE) -f makefile.unx all test_ol GUI=-Dwx_xview OPT='$(OPT)' DEBUG='$(DEBUG)' - -hp: - $(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' DEBUGFLAGS='-g' OPT='' WARN='-w' \ - XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' CCLEX='cc' \ - LDLIBS='$(HPLDLIBS)' - -demo_hp: - $(MAKE) -f makefile.unx all test_hp GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' DEBUGFLAGS='-g' OPT='' WARN='-w' \ - XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' CCLEX='cc' \ - LDLIBS='$(HPLDLIBS)' - -$(OBJDIR): - mkdir $(OBJDIR) - -test$(GUISUFFIX): $(OBJDIR)/test.$(OBJSUFF) $(WXLIB) $(TREELIB) - $(CC) $(LDFLAGS) -o test$(GUISUFFIX) $(OBJDIR)/test.$(OBJSUFF) $(XVIEW_LINK) $(LDLIBS) - -$(OBJDIR)/wxtree.$(OBJSUFF): wxtree.$(SRCSUFF) wxtree.h - $(CC) -c $(CPPFLAGS) -o $@ wxtree.$(SRCSUFF) - -$(OBJDIR)/test.$(OBJSUFF): test.$(SRCSUFF) test.h wxtree.h - $(CC) -c $(CPPFLAGS) -o $@ test.$(SRCSUFF) - -HTMLDIR=/home/hardy/html/wx/manuals -docs: ps xlp -ps: $(TREEDIR)/docs/manual.ps -xlp: $(TREEDIR)/docs/wxtree.xlp -html: $(HTMLDIR)/wxtree/wxtree_contents.html - -$(TREEDIR)/docs/wxtree.xlp: $(TREEDIR)/docs/manual.tex $(TREEDIR)/docs/classes.tex - cd ../docs; tex2rtf manual.tex tmp.xlp -xlp -twice - sed -e "s/WXHELPCONTENTS/wxTree Manual/g" < $(TREEDIR)/docs/tmp.xlp > $(TREEDIR)/docs/wxtree.xlp - /bin/rm -f $(TREEDIR)/docs/tmp.xlp - -$(HTMLDIR)/wxtree/wxtree_contents.html: $(TREEDIR)/docs/manual.tex $(TREEDIR)/docs/classes.tex - cd ../docs; tex2rtf manual.tex $(HTMLDIR)/wxtree/wxtree.html -html -twice - -$(TREEDIR)/docs/manual.dvi: $(TREEDIR)/docs/manual.tex $(TREEDIR)/docs/classes.tex - cd $(TREEDIR)/docs; latex manual; latex manual; makeindex manual; bibtex manual; latex manual; latex manual - -$(TREEDIR)/docs/manual.ps: $(TREEDIR)/docs/manual.dvi - cd $(TREEDIR)/docs; dvips -f -r < manual.dvi > manual.ps - -clean_motif: - $(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany - -clean_ol: - $(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany - -clean_hp: - $(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany - -cleanany: - rm -f $(OBJECTS) $(OBJDIR)/*.$(OBJSUFF) test$(GUISUFFIX) $(TREELIB) core - -wxclean_ol: - cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_ol - -wxclean_motif: - cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_motif - -wxclean_hp: - cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx clean_hp diff --git a/utils/wxtree/src/makefile.vc b/utils/wxtree/src/makefile.vc deleted file mode 100644 index 26db16510a..0000000000 --- a/utils/wxtree/src/makefile.vc +++ /dev/null @@ -1,133 +0,0 @@ -# -# File: makefile.nt -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds wxTree class library (MS VC++). -# Use FINAL=1 argument to nmake to build final version with no debugging -# info - -# Set WXDIR for your system -WXDIR = $(WXWIN) -TREEDIR = $(WXDIR)\utils\wxtree -THISDIR = $(WXDIR)\utils\wxtree\src -EXTRALIBS=$(WXDIR)\lib\wxtree.lib -DOCDIR=$(WXDIR)\docs -LOCALDOCDIR=$(WXDIR)\utils\wxtree\docs - -!include $(WXDIR)\src\ntwxwin.mak - -PROGRAM=test - -OBJECTS = wxtree.obj -PROGOBJECTS = $(PROGRAM).obj -LIBTARGET=$(WXDIR)\lib\wxtree.lib - -all: $(LIBTARGET) - -$(PROGRAM): $(PROGRAM).exe - -wx: - cd $(WXDIR)\src\msw - nmake -f makefile.nt FINAL=$(FINAL) - cd $(THISDIR) - -wxclean: - cd $(WXDIR)\src\msw - nmake -f makefile.nt clean - cd $(THISDIR) - -$(LIBTARGET): $(OBJECTS) - -erase $(LIBTARGET) - $(implib) @<< --out:$(LIBTARGET) --machine:$(CPU) -$(OBJECTS) -<< - -$(PROGRAM).exe: $(DUMMYOBJ) $(WXLIB) $(PROGOBJECTS) $(LIBTARGET) $(PROGRAM).res - $(link) @<< --out:$(PROGRAM).exe -$(LINKFLAGS) -$(DUMMYOBJ) $(PROGOBJECTS) $(PROGRAM).res -$(LIBS) -<< - -wxtree.obj: wxtree.h wxtree.$(SRCSUFF) $(DUMMYOBJ) - $(cc) @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -$(PROGRAM).obj: $(PROGRAM).h $(PROGRAM).$(SRCSUFF) $(DUMMYOBJ) - $(cc) @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc - $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc - - -clean: - -erase *.obj - -erase *.sbr - -erase *.exe - -erase *.res - -erase *.map - -erase *.pdb - -erase $(LIBTARGET) - -DOCSOURCES=$(LOCALDOCDIR)\wxtree.tex $(LOCALDOCDIR)\classes.tex - -html: $(DOCDIR)\html\wxtree\tree.htm -hlp: $(DOCDIR)\winhelp\wxtree.hlp -pdfrtf: $(DOCDIR)\pdf\wxtree.rtf -ps: $(WXDIR)\docs\ps\wxtree.ps - -$(DOCDIR)\winhelp\wxtree.hlp: $(LOCALDOCDIR)\wxtree.rtf $(LOCALDOCDIR)\wxtree.hpj - cd $(LOCALDOCDIR) - -erase wxtree.ph - hc wxtree - move wxtree.hlp $(DOCDIR)\winhelp\wxtree.hlp - move wxtree.cnt $(DOCDIR)\winhelp\wxtree.cnt - cd $(THISDIR) - -$(LOCALDOCDIR)\wxtree.rtf: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -start /w tex2rtf $(LOCALDOCDIR)\wxtree.tex $(LOCALDOCDIR)\wxtree.rtf -twice -winhelp - cd $(THISDIR) - -$(DOCDIR)\pdf\wxtree.rtf: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -copy *.bmp $(DOCDIR)\pdf - -start /w tex2rtf $(LOCALDOCDIR)\wxtree.tex $(DOCDIR)\pdf\wxtree.rtf -twice -rtf - cd $(THISDIR) - -$(DOCDIR)\html\wxtree\tree.htm: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -mkdir $(DOCDIR)\html\wxtree - -start /w tex2rtf $(LOCALDOCDIR)\wxtree.tex $(DOCDIR)\html\wxtree\tree.htm -twice -html - -erase $(DOCDIR)\html\wxtree\*.con - -erase $(DOCDIR)\html\wxtree\*.ref - cd $(THISDIR) - -$(LOCALDOCDIR)\wxtree.dvi: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -latex wxtree - -latex wxtree - -makeindx wxtree - -bibtex wxtree - -latex wxtree - -latex wxtree - cd $(THISDIR) - -$(WXDIR)\docs\ps\wxtree.ps: $(LOCALDOCDIR)\wxtree.dvi - cd $(LOCALDOCDIR) - -dvips32 -o wxtree.ps wxtree - move wxtree.ps $(WXDIR)\docs\ps\wxtree.ps - cd $(THISDIR) - - diff --git a/utils/wxtree/src/makefile.wat b/utils/wxtree/src/makefile.wat deleted file mode 100644 index 818e657eac..0000000000 --- a/utils/wxtree/src/makefile.wat +++ /dev/null @@ -1,49 +0,0 @@ -WXDIR = ..\..\.. - -NOPRECOMP=1 - -!include $(WXDIR)\src\makewat.env - -WXLIB=$(WXDIR)\lib -LIBTARGET = ..\lib\wxtree.lib -IFLAGS = -i=$(WXINC) -i=$(WXBASEINC) -EXTRACPPFLAGS = -NAME = wxtree -LNK = test.lnk -TESTOBJECTS=test.obj - -OBJECTS = $(name).obj - -all: $(OBJECTS) $(LIBTARGET) - -$(LIBTARGET): $(OBJECTS) - *wlib /b /c /n /P=256 $(LIBTARGET) $(OBJECTS) - -test: test.exe - -test.obj: test.$(SRCSUFF) test.h wxtree.h - -test.exe : $(TESTOBJECTS) test.res $(LNK) $(LIBTARGET) $(WXLIB)\wx$(LEVEL).lib - wlink @$(LNK) - $(BINDCOMMAND) test.res - -test.res : test.rc $(WXDIR)\include\msw\wx.rc - $(RC) $(RESFLAGS1) test.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 test - @%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib - @%append $(LNK) file $(LIBTARGET) - @for %i in ($(EXTRALIBS)) do @%append $(LNK) file %i - @for %i in ($(TESTOBJECTS)) do @%append $(LNK) file %i - -clean: .SYMBOLIC - -erase $(LIBTARGET) *.obj *.bak *.err *.pch *.lib *.lbc *.res *.exe - - diff --git a/utils/wxtree/src/mondrian.ico b/utils/wxtree/src/mondrian.ico deleted file mode 100644 index 2310c5d275..0000000000 Binary files a/utils/wxtree/src/mondrian.ico and /dev/null differ diff --git a/utils/wxtree/src/test.cpp b/utils/wxtree/src/test.cpp deleted file mode 100644 index 65198f308b..0000000000 --- a/utils/wxtree/src/test.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: test.cpp -// Purpose: wxTreeLayout sample -// Author: Julian Smart -// Modified by: -// Created: 7/4/98 -// RCS-ID: $Id$ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#include "wxtree.h" -#include "test.h" - -wxStoredTree *myTree = NULL; - -// A macro needed for some compilers (AIX) that need 'main' to be defined -// in the application itself. -IMPLEMENT_APP(MyApp) - -// The `main program' equivalent, creating the windows and returning the -// main frame -bool MyApp::OnInit() -{ - // Create the main frame window - MyFrame* frame = new MyFrame(NULL, "Tree Test", wxPoint(-1, -1), wxSize(400, 550)); - - // Give it a status line - frame->CreateStatusBar(2); - - // Give it an icon -#ifdef __WINDOWS__ - wxIcon icon("tree_icn"); - frame->SetIcon(icon); -#endif - - // Make a menubar - wxMenu *file_menu = new wxMenu; - file_menu->Append(TEST_LEFT_RIGHT, "&Left to right", "Redraw left to right"); - file_menu->Append(TEST_TOP_BOTTOM, "&Top to bottom", "Redraw top to bottom"); - file_menu->AppendSeparator(); - file_menu->Append(TEST_QUIT, "E&xit", "Quit program"); - - wxMenu *help_menu = new wxMenu; - help_menu->Append(TEST_ABOUT, "&About", "About Tree Test"); - - wxMenuBar* menu_bar = new wxMenuBar; - - menu_bar->Append(file_menu, "&File"); - menu_bar->Append(help_menu, "&Help"); - - // Associate the menu bar with the frame - frame->SetMenuBar(menu_bar); - - MyCanvas *canvas = new MyCanvas(frame); - - // Give it scrollbars: the virtual canvas is 20 * 50 = 1000 pixels in each direction - canvas->SetScrollbars(20, 20, 50, 50); - frame->canvas = canvas; - - myTree = new wxStoredTree(); - - wxClientDC dc(canvas); - wxFont font(10, wxROMAN, wxNORMAL, wxBOLD); - dc.SetFont(font); - TreeTest(*myTree, dc); - - frame->Show(TRUE); - - frame->SetStatusText("Hello, tree!"); - - // Return the main frame window - return TRUE; -} - -void MyApp::TreeTest(wxStoredTree& tree, wxDC& dc) -{ - tree.Initialize(200); - - tree.AddChild("animal"); - tree.AddChild("mammal", "animal"); - tree.AddChild("insect", "animal"); - tree.AddChild("bird", "animal"); - - tree.AddChild("man", "mammal"); - tree.AddChild("cat", "mammal"); - tree.AddChild("dog", "mammal"); - tree.AddChild("giraffe", "mammal"); - tree.AddChild("elephant", "mammal"); - tree.AddChild("donkey", "mammal"); - tree.AddChild("horse", "mammal"); - - tree.AddChild("fido", "dog"); - tree.AddChild("domestic cat", "cat"); - tree.AddChild("lion", "cat"); - tree.AddChild("tiger", "cat"); - tree.AddChild("felix", "domestic cat"); - tree.AddChild("socks", "domestic cat"); - - tree.AddChild("beetle", "insect"); - tree.AddChild("earwig", "insect"); - tree.AddChild("eagle", "bird"); - tree.AddChild("bluetit", "bird"); - tree.AddChild("sparrow", "bird"); - tree.AddChild("blackbird", "bird"); - tree.AddChild("emu", "bird"); - tree.AddChild("crow", "bird"); - - tree.DoLayout(dc); -} - -BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU(TEST_QUIT, MyFrame::OnQuit) - EVT_MENU(TEST_ABOUT, MyFrame::OnAbout) - EVT_MENU(TEST_LEFT_RIGHT, MyFrame::OnLeftRight) - EVT_MENU(TEST_TOP_BOTTOM, MyFrame::OnTopBottom) - EVT_CLOSE(MyFrame::OnCloseWindow) -END_EVENT_TABLE() - -// Define my frame constructor -MyFrame::MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size): - wxFrame(parent, -1, title, pos, size) -{ -} - -void MyFrame::OnQuit(wxCommandEvent& event) -{ - Close(TRUE); -} - -void MyFrame::OnLeftRight(wxCommandEvent& event) -{ - if (myTree) - { - myTree->SetOrientation(FALSE); - wxClientDC dc(canvas); - wxFont font(10, wxROMAN, wxNORMAL, wxBOLD); - dc.SetFont(font); - wxGetApp().TreeTest(*myTree, dc); - canvas->Refresh(); - } -} - -void MyFrame::OnTopBottom(wxCommandEvent& event) -{ - if (myTree) - { - myTree->SetOrientation(TRUE); - wxClientDC dc(canvas); - wxFont font(10, wxROMAN, wxNORMAL, wxBOLD); - dc.SetFont(font); - wxGetApp().TreeTest(*myTree, dc); - canvas->Refresh(); - } -} - -void MyFrame::OnAbout(wxCommandEvent& event) -{ - (void)wxMessageBox("wxWindows tree library demo Vsn 2.0\nAuthor: Julian Smart (c) 1998", "About tree test"); -} - -void MyFrame::OnCloseWindow(wxCloseEvent& event) -{ - Destroy(); -} - -BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) - EVT_PAINT(MyCanvas::OnPaint) -END_EVENT_TABLE() - -// Define a constructor for my canvas -MyCanvas::MyCanvas(wxWindow *parent): - wxScrolledWindow(parent, -1) -{ - SetBackgroundColour(*wxWHITE); -} - -// Define the repainting behaviour -void MyCanvas::OnPaint(wxPaintEvent& event) -{ - wxPaintDC dc(this); - PrepareDC(dc); - if (myTree) - { - wxFont font(10, wxROMAN, wxNORMAL, wxBOLD); - dc.SetFont(font); - myTree->Draw(dc); - } -} - diff --git a/utils/wxtree/src/test.def b/utils/wxtree/src/test.def deleted file mode 100644 index 558ccc1235..0000000000 --- a/utils/wxtree/src/test.def +++ /dev/null @@ -1,8 +0,0 @@ -NAME Test -DESCRIPTION 'Tree Test' -EXETYPE WINDOWS -STUB 'WINSTUB.EXE' -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD MOVEABLE MULTIPLE -HEAPSIZE 1024 -STACKSIZE 16192 diff --git a/utils/wxtree/src/test.h b/utils/wxtree/src/test.h deleted file mode 100644 index b00660744e..0000000000 --- a/utils/wxtree/src/test.h +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: test.h -// Purpose: wxTreeLayout sample -// Author: Julian Smart -// Modified by: -// Created: 7/4/98 -// RCS-ID: $Id$ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -// Define a new application -class MyApp: public wxApp -{ - public: - bool OnInit(); - void TreeTest(wxStoredTree& tree, wxDC& dc); -}; - -DECLARE_APP(MyApp) - -class MyCanvas; - -class MyFrame: public wxFrame -{ - public: - MyCanvas *canvas; - MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size); - - void OnCloseWindow(wxCloseEvent& event); - void OnQuit(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); - void OnLeftRight(wxCommandEvent& event); - void OnTopBottom(wxCommandEvent& event); - -DECLARE_EVENT_TABLE() -}; - -// Define a new canvas which can receive some events -class MyCanvas: public wxScrolledWindow -{ - public: - MyCanvas(wxWindow *frame); - void OnPaint(wxPaintEvent& event); - void OnEvent(wxMouseEvent& event); - void OnChar(wxKeyEvent& event); -DECLARE_EVENT_TABLE() -}; - -#define TEST_QUIT 1 -#define TEST_ABOUT 2 -#define TEST_LEFT_RIGHT 3 -#define TEST_TOP_BOTTOM 4 - diff --git a/utils/wxtree/src/test.rc b/utils/wxtree/src/test.rc deleted file mode 100644 index 41e6896e8e..0000000000 --- a/utils/wxtree/src/test.rc +++ /dev/null @@ -1,3 +0,0 @@ -tree_icn ICON "mondrian.ico" -#include "wx/msw/wx.rc" - diff --git a/utils/wxtree/src/wxtree.cpp b/utils/wxtree/src/wxtree.cpp deleted file mode 100644 index aed1afafed..0000000000 --- a/utils/wxtree/src/wxtree.cpp +++ /dev/null @@ -1,440 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: tree.h -// Purpose: wxTreeLayout class -// Author: Julian Smart -// Modified by: -// Created: 7/4/98 -// RCS-ID: $Id$ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "wxtree.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#include "wxtree.h" - -/* - * Abstract tree - * - */ - -IMPLEMENT_ABSTRACT_CLASS(wxTreeLayout, wxObject) - -wxTreeLayout::wxTreeLayout() -{ - m_xSpacing = 16; - m_ySpacing = 20; - m_topMargin = 5; - m_leftMargin = 5; - m_orientation = FALSE; - m_parentNode = 0; -} - -void wxTreeLayout::DoLayout(wxDC& dc, long topId) -{ - if (topId != -1) - SetTopNode(topId); - - long actualTopId = GetTopNode(); - long id = actualTopId; - while (id != -1) - { - SetNodeX(id, 0); - SetNodeY(id, 0); - ActivateNode(id, FALSE); - id = GetNextNode(id); - } - m_lastY = m_topMargin; - m_lastX = m_leftMargin; - CalcLayout(actualTopId, 0, dc); -} - -void wxTreeLayout::Draw(wxDC& dc) -{ - dc.Clear(); - DrawBranches(dc); - DrawNodes(dc); -} - -void wxTreeLayout::DrawNodes(wxDC& dc) -{ - long id = GetTopNode(); - while (id != -1) - { - if (NodeActive(id)) - DrawNode(id, dc); - id = GetNextNode(id); - } -} - -void wxTreeLayout::DrawBranches(wxDC& dc) -{ - long id = GetTopNode(); - while (id != -1) - { - if (GetNodeParent(id) > -1) - { - long parent = GetNodeParent(id); - if (NodeActive(parent)) - DrawBranch(parent, id, dc); - } - id = GetNextNode(id); - } -} - -void wxTreeLayout::DrawNode(long id, wxDC& dc) -{ - char buf[80]; - wxString name(GetNodeName(id)); - if (name != "") - sprintf(buf, "%s", (const char*) name); - else - sprintf(buf, ""); - - long x = 80; - long y = 20; - dc.GetTextExtent(buf, &x, &y); - dc.DrawText(buf, GetNodeX(id), (long)(GetNodeY(id) - (y/2.0))); -} - -void wxTreeLayout::DrawBranch(long from, long to, wxDC& dc) -{ - long w, h; - GetNodeSize(from, &w, &h, dc); - dc.DrawLine(GetNodeX(from)+w, GetNodeY(from), - GetNodeX(to), GetNodeY(to)); -} - -void wxTreeLayout::Initialize(void) -{ -} - -void wxTreeLayout::GetNodeSize(long id, long *x, long *y, wxDC& dc) -{ - wxString name(GetNodeName(id)); - if (name != "") - dc.GetTextExtent(name, x, y); - else - { - *x = 70; *y = 20; - } -} - -void wxTreeLayout::CalcLayout(long nodeId, int level, wxDC& dc) -{ - wxList children; - GetChildren(nodeId, children); - int n = children.Number(); - - if (m_orientation == FALSE) - { - // Left to right - // X Calculations - if (level == 0) - SetNodeX(nodeId, m_leftMargin); - else - { - long x = 0; - long y = 0; - long parentId = GetNodeParent(nodeId); - if (parentId != -1) - GetNodeSize(parentId, &x, &y, dc); - SetNodeX(nodeId, (long)(GetNodeX(parentId) + m_xSpacing + x)); - } - - wxNode *node = children.First(); - while (node) - { - CalcLayout((long)node->Data(), level+1, dc); - node = node->Next(); - } - - // Y Calculations - long averageY; - ActivateNode(nodeId, TRUE); - - if (n > 0) - { - averageY = 0; - node = children.First(); - while (node) - { - averageY += GetNodeY((long)node->Data()); - node = node->Next(); - } - averageY = averageY / n; - SetNodeY(nodeId, averageY); - } - else - { - SetNodeY(nodeId, m_lastY); - long x, y; - GetNodeSize(nodeId, &x, &y, dc); - - m_lastY = m_lastY + y + m_ySpacing; - } - } - else - { - // Top to bottom - - // Y Calculations - if (level == 0) - SetNodeY(nodeId, m_topMargin); - else - { - long x = 0; - long y = 0; - long parentId = GetNodeParent(nodeId); - if (parentId != -1) - GetNodeSize(parentId, &x, &y, dc); - SetNodeY(nodeId, (long)(GetNodeY(parentId) + m_ySpacing + y)); - } - - wxNode *node = children.First(); - while (node) - { - CalcLayout((long)node->Data(), level+1, dc); - node = node->Next(); - } - - // X Calculations - long averageX; - ActivateNode(nodeId, TRUE); - - if (n > 0) - { - averageX = 0; - node = children.First(); - while (node) - { - averageX += GetNodeX((long)node->Data()); - node = node->Next(); - } - averageX = averageX / n; - SetNodeX(nodeId, averageX); - } - else - { - SetNodeX(nodeId, m_lastX); - long x, y; - GetNodeSize(nodeId, &x, &y, dc); - - m_lastX = m_lastX + x + m_xSpacing; - } - } -} - -/* - * Tree with storage - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxStoredTree, wxTreeLayout) - -wxStoredTree::wxStoredTree(int n):wxTreeLayout() -{ - m_nodes = NULL; - m_maxNodes = 0; - Initialize(n); -} - -wxStoredTree::~wxStoredTree(void) -{ - if (m_nodes) - delete[] m_nodes; -} - -void wxStoredTree::Initialize(int n) -{ - m_maxNodes = n; - wxTreeLayout::Initialize(); - if (m_nodes) delete[] m_nodes; - m_nodes = new wxStoredNode[m_maxNodes]; - int i; - for (i = 0; i < n; i++) - { - m_nodes[i].m_name = ""; - m_nodes[i].m_active = FALSE; - m_nodes[i].m_parentId = -1; - m_nodes[i].m_x = 0; - m_nodes[i].m_y = 0; - } - m_num = 0; -} - -long wxStoredTree::AddChild(const wxString& name, const wxString& parent) -{ - if (m_num < (m_maxNodes -1 )) - { - long i = -1; - if (parent != "") - i = NameToId(parent); - else m_parentNode = m_num; - - m_nodes[m_num].m_parentId = i; - m_nodes[m_num].m_name = name; - m_nodes[m_num].m_x = m_nodes[m_num].m_y = 0; - m_nodes[m_num].m_clientData = 0; - m_num ++; - - return (m_num - 1); - } - else - return -1; -} - -long wxStoredTree::NameToId(const wxString& name) -{ - long i; - for (i = 0; i < m_num; i++) - if (name == m_nodes[i].m_name) - return i; - return -1; -} - -void wxStoredTree::GetChildren(long id, wxList& list) -{ - long currentId = GetTopNode(); - while (currentId != -1) - { - if (id == GetNodeParent(currentId)) - list.Append((wxObject *)currentId); - currentId = GetNextNode(currentId); - } -} - -wxStoredNode* wxStoredTree::GetNode(long idx) const -{ - wxASSERT(idx < m_num); - - return &m_nodes[idx]; -}; - -long wxStoredTree::GetNodeX(long id) -{ - wxASSERT(id < m_num); - - return (long)m_nodes[id].m_x; -} - -long wxStoredTree::GetNodeY(long id) -{ - wxASSERT(id < m_num); - - return (long)m_nodes[id].m_y; -} - -void wxStoredTree::SetNodeX(long id, long x) -{ - wxASSERT(id < m_num); - - m_nodes[id].m_x = (int)x; -} - -void wxStoredTree::SetNodeY(long id, long y) -{ - wxASSERT(id < m_num); - - m_nodes[id].m_y = (int)y; -} - -void wxStoredTree::SetNodeName(long id, const wxString& name) -{ - wxASSERT(id < m_num); - - m_nodes[id].m_name = name; -} - -wxString wxStoredTree::GetNodeName(long id) -{ - wxASSERT(id < m_num); - - return m_nodes[id].m_name; -} - -long wxStoredTree::GetNodeParent(long id) -{ - if (id != -1) - { - wxASSERT(id < m_num); - - return m_nodes[id].m_parentId; - } - else - return -1; -} - -long wxStoredTree::GetNextNode(long id) -{ - wxASSERT(id < m_num); - - if ((id != -1) && (id < (m_num - 1))) - return id + 1; - else - return -1; -} - -void wxStoredTree::SetClientData(long id, long clientData) -{ - wxASSERT(id < m_num); - - m_nodes[id].m_clientData = clientData; -} - -long wxStoredTree::GetClientData(long id) const -{ - wxASSERT(id < m_num); - - return m_nodes[id].m_clientData; -} - -void wxStoredTree::ActivateNode(long id, bool active) -{ - wxASSERT(id < m_num); - - m_nodes[id].m_active = active; -} - -bool wxStoredTree::NodeActive(long id) -{ - wxASSERT(id < m_num); - - return m_nodes[id].m_active; -} - -wxString wxStoredTree::HitTest(wxMouseEvent& event, wxDC& dc) -{ - long x, y; - event.Position(&x, &y); - - int i; - for (i = 0; i < m_maxNodes; i++) - { - wxStoredNode* item = &m_nodes[i]; - - long width, height; - dc.GetTextExtent(m_nodes[i].m_name, &width, &height); - - if ( (x >= (m_nodes[i].m_x-10)) && (x < (m_nodes[i].m_x + width+10)) && - (y >= m_nodes[i].m_y-10) && (y < (m_nodes[i].m_y + height+10)) ) - { - return m_nodes[i].m_name; - } - } - - return wxString(""); -} diff --git a/utils/wxtree/src/wxtree.h b/utils/wxtree/src/wxtree.h deleted file mode 100644 index 538e9e0891..0000000000 --- a/utils/wxtree/src/wxtree.h +++ /dev/null @@ -1,135 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: tree.h -// Purpose: wxTreeLayout class -// Author: Julian Smart -// Modified by: -// Created: 7/4/98 -// RCS-ID: $Id$ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _WXTREE_H_ -#define _WXTREE_H_ - -#ifdef __GNUG__ -#pragma interface "wxtree.h" -#endif - -#include - -class wxTreeLayout: public wxObject -{ - DECLARE_ABSTRACT_CLASS(wxTreeLayout) - - public: - wxTreeLayout(); - - // Redefine these - virtual void GetChildren(long id, wxList& list) = 0; - virtual long GetNextNode(long id) = 0; - virtual long GetNodeParent(long id) = 0; - virtual long GetNodeX(long id) = 0; - virtual long GetNodeY(long id) = 0; - virtual void SetNodeX(long id, long x) = 0; - virtual void SetNodeY(long id, long y) = 0; - virtual void ActivateNode(long id, bool active) = 0; - virtual bool NodeActive(long id) = 0; - - // Optional redefinition - void Initialize(void); - inline virtual void SetNodeName(long id, const wxString& name) {} - inline virtual wxString GetNodeName(long id) { return wxString(""); } - virtual void GetNodeSize(long id, long *x, long *y, wxDC& dc); - virtual void Draw(wxDC& dc); - virtual void DrawNodes(wxDC& dc); - virtual void DrawBranches(wxDC& dc); - virtual void DrawNode(long id, wxDC& dc); - virtual void DrawBranch(long from, long to, wxDC& dc); - - // Don't redefine - virtual void DoLayout(wxDC& dc, long topNode = -1); - - // Accessors -- don't redefine - inline void SetTopNode(long id) { m_parentNode = id; } - inline long GetTopNode(void) const { return m_parentNode; } - inline void SetSpacing(long x, long y) { m_xSpacing = x; m_ySpacing = y; } - inline long GetXSpacing(void) const { return m_xSpacing; } - inline long GetYSpacing(void) const { return m_ySpacing; } - inline void SetMargins(long x, long y) { m_leftMargin = x; m_topMargin = y; } - inline long GetTopMargin(void) const { return m_topMargin; } - inline long GetLeftMargin(void) const { return m_leftMargin; } - - inline bool GetOrientation(void) const { return m_orientation; } - inline void SetOrientation(bool or) { m_orientation = or; } - - private: - void CalcLayout(long node_id, int level, wxDC& dc); - -// Members - - protected: - long m_parentNode; - long m_lastY; - long m_lastX; - long m_xSpacing; - long m_ySpacing; - long m_topMargin; - long m_leftMargin; - bool m_orientation; // TRUE for top-to-bottom, FALSE for left-to-right -}; - -class wxStoredNode -{ - public: - wxString m_name; - long m_x, m_y; - long m_parentId; - bool m_active; - long m_clientData; -}; - -/* - * A version of wxTreeLayout with storage for nodes - */ - -class wxStoredTree: public wxTreeLayout -{ - DECLARE_DYNAMIC_CLASS(wxStoredTree) -public: - wxStoredTree(int noNodes = 200); - ~wxStoredTree(void); - void Initialize(int n); - - wxString HitTest(wxMouseEvent& event, wxDC& dc); - wxStoredNode* GetNode(long id) const; - inline int GetNumNodes() const { return m_maxNodes; }; - inline int GetNodeCount() const { return m_num; }; - - virtual void GetChildren(long id, wxList& list); - virtual long GetNextNode(long id); - virtual long GetNodeParent(long id); - virtual long GetNodeX(long id); - virtual long GetNodeY(long id); - virtual void SetNodeX(long id, long x); - virtual void SetNodeY(long id, long y); - virtual void SetNodeName(long id, const wxString& name); - virtual wxString GetNodeName(long id); - virtual void ActivateNode(long id, bool active); - virtual bool NodeActive(long id); - virtual void SetClientData(long id, long clientData); - virtual long GetClientData(long id) const; - - virtual long AddChild(const wxString& name, const wxString& parent = ""); - virtual long NameToId(const wxString& name); - -// Data members -private: - wxStoredNode* m_nodes; - int m_num; - int m_maxNodes; -}; - -#endif - // _WXTREE_H_ -