diff --git a/utils/nplugin/docs/notes.txt b/utils/nplugin/docs/notes.txt deleted file mode 100644 index ee3d1412ea..0000000000 --- a/utils/nplugin/docs/notes.txt +++ /dev/null @@ -1,32 +0,0 @@ -Notes about plugins - - - I have users that want to visit my pages with tclets, but they do not - have the plugin. What can I do? - - Add a pluginspage=http://www.sunlabs.com/tcl/plugin/ name=value - pair to the embed statement. This will cause Navigator to find - the plugin for your user and suggest they install it. The user - is then prompted to download and install the plugin, and then she - has to restart the browser and revisit your page. Very inconvenient - and only slightly better than giving your users the broken image - icon. Netscape says they are working on a more automatic solution. - - - - -14. Your demos work just fine, but when I visit my own pages with tclets in - them, at http://www.myserver.com/~mypages/mypage.html, I still get the - broken image icon. Why doesn't it work for me? - - This is likely because your web server -- the program that sends - the pages to your browser when you click on a URL -- is not - sending the right mime-type when it sends the '.tcl' file. You - can work around this by adding a type=application/x-tcl name=value - pair to the embed statement, which will cause Navigator to infer - that it should use the Tcl plugin anyways. A better solution is - to ask your system administrator to configure the web server to - send the mime type application/x-tcl when it sends files with a - '.tcl' extension. Nearly all web servers in the world nowadays - are already configured to do this, the only ones we are aware of - that do not are some older versions of Apache. diff --git a/utils/nplugin/lib/dummy b/utils/nplugin/lib/dummy deleted file mode 100644 index bfdf726d49..0000000000 --- a/utils/nplugin/lib/dummy +++ /dev/null @@ -1 +0,0 @@ -I'm just here to force the creation of a LIB directory. diff --git a/utils/nplugin/makefile.nt b/utils/nplugin/makefile.nt deleted file mode 100644 index a6a1d27258..0000000000 --- a/utils/nplugin/makefile.nt +++ /dev/null @@ -1,32 +0,0 @@ -# -# File: makefile.nt -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds utilities for Win95, VC++ 4.0 -# Use FINAL=1 argument to nmake to build final version with no debugging -# info - -# Set WXDIR for your system -WXDIR = $(WXWIN) - -THISDIR=$(WXDIR)\utils\nplugin - -!include $(WXDIR)\src\ntwxwin.mak - -DEBUG_FLAGS="/Zi /FR" -LINK_DEBUG_FLAGS="/RELEASE" - -clean: - cd $(WXDIR)\utils\nplugin\src - nmake -f makefile.nt clean - cd $(WXDIR)\utils\nplugin\samples\simple - nmake -f makefile.nt clean - cd $(WXDIR)\utils\nplugin\samples\gui - nmake -f makefile.nt clean - cd $(WXDIR)\utils\nplugin - diff --git a/utils/nplugin/samples/gui/gui.cpp b/utils/nplugin/samples/gui/gui.cpp deleted file mode 100644 index 3ae118fda0..0000000000 --- a/utils/nplugin/samples/gui/gui.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * File: simple.cpp - * Purpose: Minimal wxWindows plugin - * Author: Julian Smart - * Created: 1997 - * Updated: - * Copyright: (c) Julian Smart - */ - -/* static const char sccsid[] = "%W% %G%"; */ - -#ifdef __GNUG__ -#pragma implementation -#pragma interface -#endif - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include - -#include "NPApp.h" -#include "NPFrame.h" - -#define ID_HELLO 10 - -// Define a new application type -class MyApp: public wxPluginApp -{ public: - virtual wxFrame *OnInit(void); - virtual wxPluginFrame* OnNewInstance(const wxPluginData& data); -}; - -// Define a new frame type -class MyFrame: public wxPluginFrame -{ public: - MyFrame(const wxPluginData& data); - - public: - // Let's paint directly onto the 'frame'; we don't need a subwindow - void OnPaint(wxPaintEvent& event); - void OnMouseEvent(wxMouseEvent& event); - void OnHello(wxCommandEvent& event); - - // Called when the file has been downloaded - virtual void OnNPNewFile(NPStream *stream, const wxString& fname); - - void CentreStrings(wxDC& dc); - - DECLARE_EVENT_TABLE() - - protected: - wxStringList m_strings; - float m_xpos; - float m_ypos; -}; - -BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_SIZE(MyFrame::OnSize) - EVT_PAINT(MyFrame::OnPaint) - EVT_MOUSE_EVENTS(MyFrame::OnMouseEvent) - EVT_BUTTON(ID_HELLO, MyFrame::OnHello) -END_EVENT_TABLE() - -IMPLEMENT_APP(MyApp) - -// No app initialisation necessary, and for a plugin there is no -// top frame. -wxFrame *MyApp::OnInit(void) -{ - return NULL; -} - -// Called whenever a new plugin instance is called. We could check -// various things here in 'data' but we won't bother. -wxPluginFrame* MyApp::OnNewInstance(const wxPluginData& data) -{ - // Implicitly added to list of plugin frames - return new MyFrame(data); -} - -// My frame constructor -MyFrame::MyFrame(const wxPluginData& data): - wxPluginFrame(data) -{ - m_xpos = -1; - m_ypos = -1; - - wxMenuBar *menuBar = new wxMenuBar; - wxMenu *menu = new wxMenu; - menu->Append(1, "E&xit"); - menuBar->Append(menu, "&File"); - - SetMenuBar(menuBar); - - new wxTextCtrl(this, -1, "", wxPoint(10, 30), wxSize(200, 25), wxSUNKEN_BORDER); - new wxButton(this, ID_HELLO, "Hello", wxPoint(10, 70)); -} - -void MyFrame::OnPaint(wxPaintEvent& event) -{ - wxPaintDC dc(this); - - dc.SetBrush(*wxCYAN_BRUSH); - dc.SetPen(*wxRED_PEN); - - int w, h; - GetClientSize(&w, &h); - - dc.DrawRectangle(0, 0, w, h); - - wxFont swissFont(10, wxSWISS, wxNORMAL, wxNORMAL); - dc.SetFont(swissFont); - dc.SetBackgroundMode(wxTRANSPARENT); - - CentreStrings(dc); -} - -// Called when the file has been downloaded -void MyFrame::OnNPNewFile(NPStream *stream, const wxString& fname) -{ - ifstream str(fname); - char buf[201]; - - while ( !str.eof() ) - { - buf[0] = 0; - str.getline(buf, 200); - - if ( buf[0] != 0 ) - m_strings.Add(buf); - } - Refresh(); -} - -void MyFrame::CentreStrings(wxDC& dc) -{ - int y = 5; - int cw, ch; - GetClientSize(&cw, &ch); - - wxNode *node = m_strings.First(); - while ( node ) - { - char *s = (char *)node->Data(); - float w, h; - dc.GetTextExtent(s, &w, &h); - - int x = wxMax(0, (cw - w)/2); - dc.DrawText(s, x, y); - - y += h + (h/2); - - node = node->Next(); - } -} - -// This implements a tiny doodling program. Drag the mouse using -// the left button. -void MyFrame::OnMouseEvent(wxMouseEvent& event) -{ - float x, y; - event.Position(&x, &y); - wxClientDC dc(this); - - if (m_xpos > -1 && m_ypos > -1 && event.Dragging() && event.LeftIsDown()) - { - dc.SetPen(wxBLACK_PEN); - dc.SetBrush(wxTRANSPARENT_BRUSH); - dc.DrawLine(m_xpos, m_ypos, x, y); - } - m_xpos = x; - m_ypos = y; -} - -void MyFrame::OnHello(wxCommandEvent& event) -{ - wxMessageBox("Hello!"); -} diff --git a/utils/nplugin/samples/gui/gui.h b/utils/nplugin/samples/gui/gui.h deleted file mode 100644 index 01e46d64b6..0000000000 --- a/utils/nplugin/samples/gui/gui.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * File: gui.h - * Purpose: wxWindows plugin with a few GUI elements - * Author: Julian Smart - * Created: 1997 - * Updated: - * Copyright: (c) Julian Smart - */ - -#ifndef __GUIH__ -#define __GUIH__ - -// Define a new application type -class MyApp: public wxPluginApp -{ public: - virtual wxFrame *OnInit(void); - virtual wxPluginFrame* OnNewInstance(const wxPluginData& data); -}; - -class MyApp; -class MyFrame; -class MyCanvas; - -class MyFrame: public wxPluginFrame -{ -public: - MyFrame(const wxPluginData& data); - virtual ~MyFrame(); - - void OldOnMenuCommand(int id); - -private: - wxMenu* fileMenu; - wxMenuBar* menuBar; - MyCanvas* leftCanvas; - MyCanvas* rightCanvas; - wxSplitterWindow* splitter; -}; - -class MyCanvas: public wxScrolledWindow -{ -public: - MyCanvas(wxWindow* parent, int x, int y, int w, int h); - virtual ~MyCanvas(); - - void OnPaint(wxPaintEvent& event); - -DECLARE_EVENT_TABLE() -}; - -// ID for the menu quit command -#define SPLIT_QUIT 1 -#define SPLIT_HORIZONTAL 2 -#define SPLIT_VERTICAL 3 -#define SPLIT_UNSPLIT 4 - - -#endif - diff --git a/utils/nplugin/samples/gui/makefile.nt b/utils/nplugin/samples/gui/makefile.nt deleted file mode 100644 index 2487d04e37..0000000000 --- a/utils/nplugin/samples/gui/makefile.nt +++ /dev/null @@ -1,70 +0,0 @@ -# -# File: makefile.nt -# Author: Julian Smart -# Created: 1997 -# Updated: -# Copyright: (c) 1997, Julian Smart -# -# "%W% %G%" -# -# Makefile : Builds gui plugin example (MS VC++). -# Use FINAL=1 argument to nmake to build final version with no debugging -# info - -# Set WXDIR for your system -WXDIR = $(WXWIN) - -# Application is a DLL -DLL=1 - -EXTRAINC=/I$(WXDIR)\utils\nplugin\src - -!include $(WXDIR)\src\ntwxwin.mak - -THISDIR = $(WXDIR)\utils\nplugin\examples\gui -PROGRAM=npgui32 -PLUGINLIB=$(WXDIR)\utils\nplugin\lib\nplugin.lib - -OBJECTS = gui.obj - -all: $(PROGRAM).dll - -$(PROGRAM): $(PROGRAM).exe - -wx: - cd $(WXDIR)\src\msw - nmake -f makefile.nt dllnp FINAL=$(FINAL) - cd $(THISDIR) - -# Update the dynamic link library - -$(PROGRAM).dll: $(DUMMYOBJ) $(OBJECTS) $(WXDIR)\lib\wx.lib $(PLUGINLIB) $(PROGRAM).res $(PROGRAM).def - $(link) $(LINKFLAGS) \ - -out:$(PROGRAM).dll \ - -def:$(PROGRAM).def \ - $(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res $(WXDIR)\lib\wx.lib $(PLUGINLIB) \ - $(guilibsdll) msvcrt.lib shell32.lib comctl32.lib ctl3d32.lib - -gui.obj: gui.$(SRCSUFF) gui.h $(DUMMYOBJ) - $(cc) @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -$(PROGRAM).res : $(PROGRAM).rc $(WXDIR)\include\wx\msw\wx.rc - $(rc) -r /i$(WXDIR)\include -fo$@ $(PROGRAM).rc - -copy: - copy npgui32.dll "c:\program files\Netscape\Navigator\program\plugins" - copy npgui32.dll "c:\program files\Internet Explorer\plugins" - -clean: - -erase *.obj - -erase *.exe - -erase *.res - -erase *.map - -erase *.sbr - -erase *.pdb - -erase *.dll - -erase *.exp - -erase *.lib - -erase *.ilk diff --git a/utils/nplugin/samples/gui/npgui32.def b/utils/nplugin/samples/gui/npgui32.def deleted file mode 100644 index 1107bb98f5..0000000000 --- a/utils/nplugin/samples/gui/npgui32.def +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY NPGUI32 - -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD SINGLE - -EXPORTS - NP_GetEntryPoints @1 - NP_Initialize @2 - NP_Shutdown @3 diff --git a/utils/nplugin/samples/gui/npgui32.rc b/utils/nplugin/samples/gui/npgui32.rc deleted file mode 100644 index cafee455df..0000000000 --- a/utils/nplugin/samples/gui/npgui32.rc +++ /dev/null @@ -1,44 +0,0 @@ -#include "wx/msw/wx.rc" - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "Julian Smart\0" - VALUE "FileDescription", "wxWindows GUI example plugin file\0" - VALUE "FileVersion", "0.0.0.1\0" - VALUE "InternalName", "wxWindows GUI Plugin\0" - VALUE "LegalCopyright", "Copyright Julian Smart 1997\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename","npgui32.dll\0" - VALUE "ProductName", "wxWindows GUI Plugin Sample\0" - VALUE "ProductVersion", "0.0.0.1\0" - VALUE "MIMEType", "wxgui/mime-type\0" - VALUE "FileExtents", "gui\0" - VALUE "FileOpenName", "wxWindows GUI (*.gui)\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - diff --git a/utils/nplugin/samples/simple/makefile.nt b/utils/nplugin/samples/simple/makefile.nt deleted file mode 100644 index 66e55eee46..0000000000 --- a/utils/nplugin/samples/simple/makefile.nt +++ /dev/null @@ -1,70 +0,0 @@ -# -# File: makefile.nt -# Author: Julian Smart -# Created: 1997 -# Updated: -# Copyright: (c) 1997, Julian Smart -# -# "%W% %G%" -# -# Makefile : Builds simple plugin example (MS VC++). -# Use FINAL=1 argument to nmake to build final version with no debugging -# info - -# Set WXDIR for your system -WXDIR = $(WXWIN) - -# Application is a DLL -DLL=1 - -EXTRAINC=/I$(WXDIR)\utils\nplugin\src - -!include $(WXDIR)\src\ntwxwin.mak - -THISDIR = $(WXDIR)\utils\nplugin\smples\simple -PROGRAM=npsimple32 -PLUGINLIB=$(WXDIR)\utils\nplugin\lib\nplugin.lib - -OBJECTS = simple.obj - -all: $(PROGRAM).dll - -$(PROGRAM): $(PROGRAM).exe - -wx: - cd $(WXDIR)\src\msw - nmake -f makefile.nt dllnp FINAL=$(FINAL) - cd $(THISDIR) - -# Update the dynamic link library - -$(PROGRAM).dll: $(DUMMYOBJ) $(OBJECTS) $(WXDIR)\lib\wx.lib $(PLUGINLIB) $(PROGRAM).res $(PROGRAM).def - $(link) $(LINKFLAGS) \ - -out:$(PROGRAM).dll \ - -def:$(PROGRAM).def \ - $(DUMMYOBJ) $(OBJECTS) $(PROGRAM).res $(WXDIR)\lib\wx.lib $(PLUGINLIB) \ - $(guilibsdll) msvcrt.lib shell32.lib comctl32.lib ctl3d32.lib - -simple.obj: simple.$(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 - -copy: - copy npsimple32.dll "c:\program files\Netscape\Navigator\program\plugins" - copy npsimple32.dll "c:\program files\Internet Explorer\plugins" - -clean: - -erase *.obj - -erase *.exe - -erase *.res - -erase *.map - -erase *.sbr - -erase *.pdb - -erase *.dll - -erase *.exp - -erase *.lib - -erase *.ilk diff --git a/utils/nplugin/samples/simple/npsimple32.def b/utils/nplugin/samples/simple/npsimple32.def deleted file mode 100644 index e3af3116fe..0000000000 --- a/utils/nplugin/samples/simple/npsimple32.def +++ /dev/null @@ -1,9 +0,0 @@ -LIBRARY NPSIMPLE32 - -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD SINGLE - -EXPORTS - NP_GetEntryPoints @1 - NP_Initialize @2 - NP_Shutdown @3 diff --git a/utils/nplugin/samples/simple/npsimple32.rc b/utils/nplugin/samples/simple/npsimple32.rc deleted file mode 100644 index f2d4903226..0000000000 --- a/utils/nplugin/samples/simple/npsimple32.rc +++ /dev/null @@ -1,44 +0,0 @@ -#include "wx/msw/wx.rc" - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "Julian Smart\0" - VALUE "FileDescription", "wxWindows simple example plugin file\0" - VALUE "FileVersion", "0.0.0.1\0" - VALUE "InternalName", "wxWindows Simple Plugin\0" - VALUE "LegalCopyright", "Copyright Julian Smart 1997\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename","npsimple32.dll\0" - VALUE "ProductName", "wxWindows Simple Plugin Sample\0" - VALUE "ProductVersion", "0.0.0.1\0" - VALUE "MIMEType", "wxsimple/mime-type\0" - VALUE "FileExtents", "smp\0" - VALUE "FileOpenName", "wxWindows Simple (*.smp)\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - diff --git a/utils/nplugin/samples/simple/simple.cpp b/utils/nplugin/samples/simple/simple.cpp deleted file mode 100644 index 137e7b0585..0000000000 --- a/utils/nplugin/samples/simple/simple.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * File: simple.cpp - * Purpose: Minimal wxWindows plugin - * Author: Julian Smart - * Created: 1997 - * Updated: - * Copyright: (c) Julian Smart - */ - -/* static const char sccsid[] = "%W% %G%"; */ - -#ifdef __GNUG__ -#pragma implementation -#pragma interface -#endif - -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include - -#include "NPApp.h" -#include "NPFrame.h" - -// Define a new application type -class MyApp: public wxPluginApp -{ public: - virtual wxFrame *OnInit(void); - virtual wxPluginFrame* OnNewInstance(const wxPluginData& data); -}; - -// Define a new frame type -class MyFrame: public wxPluginFrame -{ public: - MyFrame(const wxPluginData& data); - - public: - // Let's paint directly onto the 'frame'; we don't need a subwindow - void OnPaint(wxPaintEvent& event); - void OnDraw(wxDC& dc); - void OnMouseEvent(wxMouseEvent& event); - - // Called when the file has been downloaded - virtual void OnNPNewFile(NPStream *stream, const wxString& fname); - - void CentreStrings(wxDC& dc); - - DECLARE_EVENT_TABLE() - - protected: - wxStringList m_strings; - long m_xpos; - long m_ypos; -}; - -BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_SIZE(MyFrame::OnSize) - EVT_PAINT(MyFrame::OnPaint) - EVT_MOUSE_EVENTS(MyFrame::OnMouseEvent) -END_EVENT_TABLE() - -IMPLEMENT_APP(MyApp) - -// No app initialisation necessary, and for a plugin there is no -// top frame. -wxFrame *MyApp::OnInit(void) -{ - return NULL; -} - -// Called whenever a new plugin instance is called. We could check -// various things here in 'data' but we won't bother. -wxPluginFrame* MyApp::OnNewInstance(const wxPluginData& data) -{ - // Implicitly added to list of plugin frames - return new MyFrame(data); -} - -// My frame constructor -MyFrame::MyFrame(const wxPluginData& data): - wxPluginFrame(data) -{ - m_xpos = -1; - m_ypos = -1; -} - -void MyFrame::OnPaint(wxPaintEvent& event) -{ - wxPaintDC dc(this); - - OnDraw(dc); -} - -void MyFrame::OnDraw(wxDC& dc) -{ - dc.SetBrush(*wxCYAN_BRUSH); - dc.SetPen(*wxRED_PEN); - - int w, h; - GetClientSize(&w, &h); - - dc.DrawRectangle(0, 0, w, h); - - wxFont swissFont(10, wxSWISS, wxNORMAL, wxNORMAL); - dc.SetFont(swissFont); - dc.SetBackgroundMode(wxTRANSPARENT); - - CentreStrings(dc); -} - -// Called when the file has been downloaded -void MyFrame::OnNPNewFile(NPStream *stream, const wxString& fname) -{ - ifstream str(fname); - char buf[201]; - - while ( !str.eof() ) - { - buf[0] = 0; - str.getline(buf, 200); - - if ( buf[0] != 0 ) - m_strings.Add(buf); - } - Refresh(); -} - -void MyFrame::CentreStrings(wxDC& dc) -{ - int y = 5; - int cw, ch; - GetClientSize(&cw, &ch); - - wxNode *node = m_strings.First(); - while ( node ) - { - char *s = (char *)node->Data(); - long w, h; - dc.GetTextExtent(s, &w, &h); - - int x = wxMax(0, (cw - w)/2); - dc.DrawText(s, x, y); - - y += h + (h/2); - - node = node->Next(); - } -} - -// This implements a tiny doodling program. Drag the mouse using -// the left button. -void MyFrame::OnMouseEvent(wxMouseEvent& event) -{ - long x, y; - event.Position(&x, &y); - wxClientDC dc(this); - - if (m_xpos > -1 && m_ypos > -1 && event.Dragging() && event.LeftIsDown()) - { - dc.SetPen(wxBLACK_PEN); - dc.SetBrush(wxTRANSPARENT_BRUSH); - dc.DrawLine(m_xpos, m_ypos, x, y); - } - m_xpos = x; - m_ypos = y; -} - diff --git a/utils/nplugin/src/makefile.nt b/utils/nplugin/src/makefile.nt deleted file mode 100644 index b3e4491221..0000000000 --- a/utils/nplugin/src/makefile.nt +++ /dev/null @@ -1,78 +0,0 @@ -# -# File: makefile.nt -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds controls example (MS VC++). -# Use FINAL=1 argument to nmake to build final version with no debugging -# info - -# Set WXDIR for your system -WXDIR = $(WXWIN) - -# Application is a DLL -DLL=1 - -!include $(WXDIR)\src\ntwxwin.mak - -PLUGINDIR = $(WXDIR)\utils\nplugin -THISDIR = $(PLUGINDIR)\src -LIBTARGET=$(PLUGINDIR)\lib\nplugin.lib - -OBJECTS = npwin.obj npshell.obj NPFrame.obj NPApp.obj - -all: $(LIBTARGET) - -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) -<< - -npwin.obj: npwin.cpp npapi.h npupp.h - $(cc) @<< -$(CPPFLAGS2) /c /Tp $*.$(SRCSUFF) -<< - -npshell.obj: npshell.cpp npapi.h NPApp.h NPFrame.h - $(cc) @<< -$(CPPFLAGS2) /c /Tp $*.$(SRCSUFF) -<< - -NPFrame.obj: NPFrame.cpp NPFrame.h NPApp.h npapi.h - $(cc) @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -NPApp.obj: NPApp.cpp NPApp.h NPFrame.h npapi.h - $(cc) @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -clean: - -erase *.obj - -erase *.exe - -erase *.res - -erase *.map - -erase *.sbr - -erase *.pdb - -erase *.dll - -erase *.exp - -erase *.ilk - -erase $(LIBTARGET) diff --git a/utils/nplugin/src/npapi.h b/utils/nplugin/src/npapi.h deleted file mode 100644 index bbb631c3d4..0000000000 --- a/utils/nplugin/src/npapi.h +++ /dev/null @@ -1,258 +0,0 @@ -/* - * npapi.h $Revision$ - * Netscape client plug-in API spec - */ - -#ifndef _NPAPI_H_ -#define _NPAPI_H_ - - -/* XXX this needs to get out of here */ -#if defined(__MWERKS__) -#ifndef XP_MAC -#define XP_MAC -#endif -#endif - - -/* - * Version constants - */ - -#define NP_VERSION_MAJOR 0 -#define NP_VERSION_MINOR 6 - - - -/* - * Basic types - */ - -#ifndef _UINT16 -typedef unsigned short uint16; -#endif -#ifndef _UINT32 -typedef unsigned long uint32; -#endif -#ifndef _INT16 -typedef short int16; -#endif -#ifndef _INT32 -typedef long int32; -#endif - -#ifndef FALSE -#define FALSE (0) -#endif -#ifndef TRUE -#define TRUE (1) -#endif -#ifndef NULL -#define NULL (0L) -#endif - -typedef unsigned char NPBool; -typedef void* NPEvent; -typedef int16 NPError; -typedef char* NPMIMEType; - - -/* - * NPP is a plug-in's opaque instance handle - */ -typedef struct _NPP -{ - void* pdata; /* plug-in private data */ - void* ndata; /* netscape private data */ -} NPP_t; - -typedef NPP_t* NPP; - - - -typedef struct _NPStream -{ - void* pdata; /* plug-in private data */ - void* ndata; /* netscape private data */ - const char* url; - uint32 end; - uint32 lastmodified; -} NPStream; - -typedef struct _NPByteRange -{ - int32 offset; /* negative offset means from the end */ - uint32 length; - struct _NPByteRange* next; -} NPByteRange; - - -typedef struct _NPSavedData -{ - int32 len; - void* buf; -} NPSavedData; - - - -typedef struct _NPRect -{ - uint16 top; - uint16 left; - uint16 bottom; - uint16 right; -} NPRect; - -typedef struct _NPWindow -{ - void* window; /* platform specific window handle */ - uint32 x; /* position of top left corner relative to a netscape page */ - uint32 y; - uint32 width; /* maximum window size */ - uint32 height; - NPRect clipRect; /* clipping rectangle in port coordinates */ -} NPWindow; - - - -typedef struct _NPFullPrint -{ - NPBool pluginPrinted; /* Set TRUE if plugin handled fullscreen printing */ - NPBool printOne; /* TRUE if plugin should print one copy to default printer */ - void* platformPrint; /* Platform-specific printing info */ -} NPFullPrint; - -typedef struct _NPEmbedPrint -{ - NPWindow window; - void* platformPrint; /* Platform-specific printing info */ -} NPEmbedPrint; - -typedef struct _NPPrint -{ - uint16 mode; /* NP_FULL or NP_EMBED */ - union - { - NPFullPrint fullPrint; /* if mode is NP_FULL */ - NPEmbedPrint embedPrint; /* if mode is NP_EMBED */ - } print; -} NPPrint; - - - - -#ifdef XP_MAC - -/* - * Mac-specific structures and definitions. - */ - -#include -#include - -typedef struct NP_Port -{ - CGrafPtr port; /* Grafport */ - int32 portx; /* position inside the topmost window */ - int32 porty; -} NP_Port; - -/* - * Non-standard event types that can be passed to HandleEvent - */ -#define getFocusEvent (osEvt + 16) -#define loseFocusEvent (osEvt + 17) -#define adjustCursorEvent (osEvt + 18) - -#endif /* XP_MAC */ - - - - -#define NP_EMBED 1 -#define NP_FULL 2 -#define NP_BACKGROUND 3 - -#define NP_NORMAL 1 -#define NP_SEEK 2 -#define NP_ASFILE 3 - -#define NP_MAXREADY (((unsigned)(~0)<<1)>>1) - - -/* - * Error and reason code definitions. - */ - -#define NP_NOERR 0 -#define NP_EINVAL 1 -#define NP_EABORT 2 - -#define NPERR_BASE 0 -#define NPERR_NO_ERROR (NPERR_BASE + 0) -#define NPERR_GENERIC_ERROR (NPERR_BASE + 1) -#define NPERR_INVALID_INSTANCE_ERROR (NPERR_BASE + 2) -#define NPERR_INVALID_FUNCTABLE_ERROR (NPERR_BASE + 3) -#define NPERR_MODULE_LOAD_FAILED_ERROR (NPERR_BASE + 4) -#define NPERR_OUT_OF_MEMORY_ERROR (NPERR_BASE + 5) -#define NPERR_INVALID_PLUGIN_ERROR (NPERR_BASE + 6) -#define NPERR_INVALID_PLUGIN_DIR_ERROR (NPERR_BASE + 7) -#define NPERR_INCOMPATIBLE_VERSION_ERROR (NPERR_BASE + 8) - -#define NPRES_BASE 0 -#define NPRES_NETWORK_ERR (NPRES_BASE + 0) -#define NPRES_USER_BREAK (NPRES_BASE + 1) -#define NPRES_DONE (NPRES_BASE + 3) - - - -/* - * Function prototypes. - * Functions beginning with 'NPP' are functions provided by the plugin that Netscape will call. - * Functions beginning with 'NPN' are functions provided by Netscape that the plugin will call. - */ - -#if defined(_WINDOWS) && !defined(__WIN32__) -#define NP_LOADDS _loadds -#else -#define NP_LOADDS -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -NPError NPP_Initialize(void); -void NPP_Shutdown(void); -NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); -NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save); -NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window); -NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); -NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, NPError reason); -int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream); -int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer); -void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname); -void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint); -int16 NPP_HandleEvent(NPP instance, void* event); - -void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor); -NPError NPN_GetURL(NPP instance, const char* url, const char* window); -NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file); -NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList); -NPError NPN_NewStream(NPP instance, NPMIMEType type, NPStream* stream); -int32 NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer); -NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason); -void NPN_Status(NPP instance, const char* message); -const char* NPN_UserAgent(NPP instance); -void* NPN_MemAlloc(uint32 size); -void NPN_MemFree(void* ptr); -uint32 NPN_MemFlush(uint32 size); -void NPN_ReloadPlugins(NPBool reloadPages); - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - - -#endif /* _NPAPI_H_ */ - diff --git a/utils/nplugin/src/npapp.cpp b/utils/nplugin/src/npapp.cpp deleted file mode 100644 index e9c43029c3..0000000000 --- a/utils/nplugin/src/npapp.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/* - * File: NPApp.cc - * Purpose: wxPluginApp implementation - * Author: Julian Smart - * Created: 1997 - * Updated: - * Copyright: (c) Julian Smart - */ - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#include "NPApp.h" -#include "NPFrame.h" - -#include - -IMPLEMENT_ABSTRACT_CLASS(wxPluginApp, wxApp) - -wxPluginApp *wxGetPluginApp(void) -{ - if ( wxTheApp && wxTheApp->IsKindOf(CLASSINFO(wxPluginApp))) - return (wxPluginApp *)wxTheApp; - else - return NULL; -} - -wxPluginApp::wxPluginApp(void) -{ - m_data.m_argc = NULL; - m_data.m_argn = NULL; - m_data.m_argv = NULL; - m_data.m_type = 0; - m_data.m_instance = 0; - m_data.m_mode = 0; - m_data.m_window = 0; -} - -wxPluginApp::~wxPluginApp(void) -{ - if ( m_data.m_argn ) - delete[] m_data.m_argn; - if ( m_data.m_argv ) - delete[] m_data.m_argv; -} - -// Add a frame -void wxPluginApp::AddFrame(wxPluginFrame *frame) -{ - m_frames.Append(frame); -} - -// Remove a frame -void wxPluginApp::RemoveFrame(wxPluginFrame *frame) -{ - m_frames.DeleteObject(frame); -} - -// Find a frame given a NP instance -wxPluginFrame *wxPluginApp::FindFrame(NPP instance) -{ - wxNode *node = m_frames.First(); - while ( node ) - { - wxPluginFrame *frame = (wxPluginFrame *)node->Data(); - if ( frame->GetInstance() == instance ) - { - return frame; - } - node = node->Next(); - } - return NULL; -} - -void wxPluginApp::SetAttributeValues(const int n, char *argn[], char *argv[]) -{ - if ( m_data.m_argn ) - delete[] m_data.m_argn; - if ( m_data.m_argv ) - delete[] m_data.m_argv; - - m_data.m_argc = n; - - m_data.m_argn = new wxString[n]; - m_data.m_argv = new wxString[n]; - int i; - for ( i = 0; i < n ; i ++) - { - m_data.m_argn[i] = argn[i]; - m_data.m_argv[i] = argv[i]; - } -} - -/////////////////////////////////////////////////////////////// -// Netscape Plugin API calls routed via wxPluginApp - -NPError wxPluginApp::NPP_Destroy(NPP instance, NPSavedData** save) -{ - wxPluginFrame *frame = FindFrame(instance); - if ( frame ) - { - frame->OnClose(); - delete frame; - } - return NPERR_NO_ERROR; -} - -NPError wxPluginApp::NPP_DestroyStream(NPP instance, NPStream* stream, NPError reason) -{ - return NPERR_NO_ERROR; -} - -/* -jref wxPluginApp::NPP_GetJavaClass(void) -{ - return 0; -} -*/ - -NPError wxPluginApp::NPP_Initialize(void) -{ - static int init = FALSE; - - if ( init == TRUE ) - MessageBox(NULL, "wxPluginApp::NPP_Initialize:\nabout to call wxEntry for 2nd time!!!", "wxPlugin", MB_OK); - - wxEntry((WXHINSTANCE) GetModuleHandle(NULL)); - - init = TRUE; - -// MessageBox(NULL, "wxPluginApp::NPP_Initialize: have called wxEntry", "wxPlugin", MB_OK); - return NPERR_NO_ERROR; -} - -NPError wxPluginApp::NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, - int16 argc, char* argn[], char* argv[], NPSavedData* saved) -{ -// MessageBox(NULL, "wxPluginApp::NPP_New", "wxPlugin", MB_OK); - - // Save values so frame can be created in first NPP_SetWindow - if ( m_data.m_instance != 0 ) - { - MessageBox(NULL, "wxPluginApp::NPP_New: whoops, 2 NPP_New calls in succession without NPP_SetWindow.\n Need to modify my code!", "wxPlugin", MB_OK); - return NPERR_NO_ERROR; - } - - m_data.m_instance = instance; - m_data.m_type = pluginType; - m_data.m_mode = mode; - - SetAttributeValues(argc, argn, argv); - - // Unfortunately, we may get a stream event before we've got a valid window - // handle, so we just have to go ahead and create a new instance. - wxPluginFrame *frame = OnNewInstance(m_data); - - m_data.m_instance = NULL; - m_data.m_window = NULL; - delete[] m_data.m_argv; - delete[] m_data.m_argn; - m_data.m_argv = NULL; - m_data.m_argn = NULL; - - return NPERR_NO_ERROR; -} - -NPError wxPluginApp::NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, - NPBool seekable, uint16* stype) -{ - // By default, we want to receive a file instead of a stream. - wxPluginFrame *frame = FindFrame(instance); - if ( frame ) - { - return frame->OnNPNewStream(type, stream, seekable, stype); - } - return NPERR_NO_ERROR; -} - -void wxPluginApp::NPP_Print(NPP instance, NPPrint* printInfo) -{ - if (instance == NULL) - return; - - wxPluginFrame *frame = FindFrame(instance); - if ( frame ) - { - frame->OnNPPrint(printInfo); - } -} - -NPError wxPluginApp::NPP_SetWindow(NPP instance, NPWindow* window) -{ -// MessageBox(NULL, "wxPluginApp::NPP_SetWindow", "wxPlugin", MB_OK); - - if ( window ) - wxDebugMsg("%d\n", (int) window->window); - - wxPluginFrame *frame = FindFrame(instance); - if ( frame ) - { - frame->SetNPWindow(window); - } - else - { -#if 0 - // No such frame: must make it. - if ( m_data.m_instance == NULL ) - { - MessageBox(NULL, "wxPluginApp::NPP_SetWindow: whoops, no data to create window. SetWindow called in funny order?", "wxPlugin", MB_OK); - return NPERR_NO_ERROR; - } - - if ( window->window == NULL ) - { - // We're receiving a NULL window before we've even received - // a valid window. Ignore this silly thing. - return NPERR_NO_ERROR; - } - - m_data.m_window = window; - m_data.m_instance = instance; - -// wxPluginFrame *frame = OnNewInstance(m_data); - - m_data.m_instance = NULL; - m_data.m_window = NULL; - delete[] m_data.m_argv; - delete[] m_data.m_argn; - m_data.m_argv = NULL; - m_data.m_argn = NULL; -#endif - } - return NPERR_NO_ERROR; -} - -void wxPluginApp::NPP_Shutdown(void) -{ - // Clean up wxWindows - CleanUp(); -} - -void wxPluginApp::NPP_StreamAsFile(NPP instance, NPStream* stream, const char *fname) -{ - wxPluginFrame *frame = FindFrame(instance); - if ( frame ) - { - wxString str(fname); - frame->OnNPNewFile(stream, str); - } -} - -/* -void wxPluginApp::NPP_URLNotify(NPP instance, const char* url, NPReason reason, - void* notifyData) -{ -} -*/ - -int32 wxPluginApp::NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, - void* buf) -{ - return len; // The number of bytes accepted -} - -static int32 STREAMBUFSIZE = 0X0FFFFFFF; // If we are reading from a file in NPAsFile - // mode so we can take any size stream in our - // write call (since we ignore it) - -int32 wxPluginApp::NPP_WriteReady(NPP instance, NPStream* stream) -{ - return STREAMBUFSIZE; // Number of bytes ready to accept in NPP_Write() -} - diff --git a/utils/nplugin/src/npapp.h b/utils/nplugin/src/npapp.h deleted file mode 100644 index 238a612313..0000000000 --- a/utils/nplugin/src/npapp.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * File: NPApp.h - * Purpose: wxPluginApp declaration - * Author: Julian Smart - * Created: 1997 - * Updated: - * Copyright: (c) Julian Smart - */ - -#ifndef __PLUGINAPP__ -#define __PLUGINAPP__ - -#include "wx/wx.h" -#include "npapi.h" - -class wxPluginFrame; - -// Data passed to OnNewInstance -class wxPluginData -{ -public: - NPP m_instance; - NPMIMEType m_type; - NPWindow* m_window; - int m_mode; - int m_argc; - wxString* m_argn; - wxString* m_argv; -}; - -class WXDLLEXPORT wxPluginApp: public wxApp -{ - DECLARE_ABSTRACT_CLASS(wxPluginApp) - -public: - wxPluginApp(void); - ~wxPluginApp(void); - - // Find a frame given a NP instance - wxPluginFrame *FindFrame(NPP instance); - - // Add a frame - void AddFrame(wxPluginFrame *frame); - - // Remove a frame - void RemoveFrame(wxPluginFrame *frame); - - // Set attribute/values for the last instance - void SetAttributeValues(const int n, char *argn[], char *argv[]); - - /////////////////////////////////////////////////////////////// - // Higher-level API than NP API - virtual wxPluginFrame *OnNewInstance(const wxPluginData& data) = 0; - - /////////////////////////////////////////////////////////////// - // Netscape Plugin API calls routed via wxPluginApp - - virtual NPError NPP_Destroy(NPP instance, NPSavedData** save); - virtual NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPError reason); -// virtual jref NPP_GetJavaClass(void); - virtual NPError NPP_Initialize(void); - virtual NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, - int16 argc, char* argn[], char* argv[], NPSavedData* saved); - virtual NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, - NPBool seekable, uint16* stype); - virtual void NPP_Print(NPP instance, NPPrint* platformPrint); - virtual NPError NPP_SetWindow(NPP instance, NPWindow* window); - virtual void NPP_Shutdown(void); - virtual void NPP_StreamAsFile(NPP instance, NPStream* stream, const char *fname); -/* - virtual void NPP_URLNotify(NPP instance, const char* url, NPReason reason, - void* notifyData); -*/ - virtual int32 NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, - void* buf); - virtual int32 NPP_WriteReady(NPP instance, NPStream* stream); - -protected: - - // List of plugin frames - wxList m_frames; - - // Temporary NPP_New arguments so we can wait until NPP_SetWindow is called - // before creating a frame - wxPluginData m_data; -}; - -wxPluginApp *wxGetPluginApp(void); - -#endif - diff --git a/utils/nplugin/src/npframe.cpp b/utils/nplugin/src/npframe.cpp deleted file mode 100644 index e3e3f63661..0000000000 --- a/utils/nplugin/src/npframe.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/* - * File: NPFrame.cc - * Purpose: wxPluginFrame implementation - * Author: Julian Smart - * Created: 1997 - * Updated: - * Copyright: (c) Julian Smart - */ - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/frame.h" -#endif - -#include "wx/dcprint.h" - -#include "NPFrame.h" -#include "NPApp.h" - -#include - -extern wxList wxModelessWindows; -extern char wxFrameClassName[]; - -IMPLEMENT_DYNAMIC_CLASS(wxPluginFrame, wxFrame) - -wxPluginFrame::wxPluginFrame(void) -{ - m_npWindow = NULL; - m_npInstance = NULL; - m_nAttributes = 0; - m_names = NULL; - m_values = NULL; -} - -bool wxPluginFrame::Create(const wxPluginData& data) -{ - SetName("pluginFrame"); - - m_npWindow = NULL; - m_npInstance = NULL; - m_nAttributes = 0; - m_names = NULL; - m_values = NULL; - m_npWindow = data.m_window; - m_npInstance = data.m_instance; - - SetAttributeValues(data.m_argc, data.m_argn, data.m_argv); - SetNPWindow(data.m_window); - - wxModelessWindows.Append(this); - - if (wxTheApp->IsKindOf(CLASSINFO(wxPluginApp))) - { - ((wxPluginApp *)wxTheApp)->AddFrame(this); - } - return TRUE; -} - -wxPluginFrame::~wxPluginFrame(void) -{ - if (wxTheApp->IsKindOf(CLASSINFO(wxPluginApp))) - { - ((wxPluginApp *)wxTheApp)->RemoveFrame(this); - } - - if ( GetHWND() ) - UnsubclassWin(); - m_hWnd = 0; - - if ( m_names ) - delete[] m_names; - if ( m_values ) - delete[] m_values; -} - -// Get size *available for subwindows* i.e. excluding menu bar etc. -// For XView, this is the same as GetSize -void wxPluginFrame::GetClientSize(int *x, int *y) const -{ - if ( !m_hWnd ) - { - *x = 0; *y = 0; - return; - } - wxFrame::GetClientSize(x, y); -} - -// Set the client size (i.e. leave the calculation of borders etc. -// to wxWindows) -void wxPluginFrame::SetClientSize(const int width, const int height) -{ - if ( !m_hWnd ) - return ; - - wxFrame::SetClientSize(width, height); -} - -void wxPluginFrame::GetSize(int *width, int *height) const -{ - if ( !m_hWnd ) - { - *width = 0; *height = 0; - return; - } - wxFrame::GetSize(width, height); -} - -void wxPluginFrame::GetPosition(int *x, int *y) const -{ - if ( !m_hWnd ) - { - *x = 0; *y = 0; - return; - } - wxFrame::GetPosition(x, y); -} - -void wxPluginFrame::SetAttributeValues(const int n, const char *argn[], const char *argv[]) -{ - if ( m_names ) - delete[] m_names; - if ( m_values ) - delete[] m_values; - - m_nAttributes = n; - - m_names = new wxString[n]; - m_values = new wxString[n]; - int i; - for ( i = 0; i < n ; i ++) - { - m_names[i] = argn[i]; - m_values[i] = argv[i]; - } -} - -void wxPluginFrame::SetAttributeValues(const int n, const wxString* argn, const wxString* argv) -{ - if ( m_names ) - delete[] m_names; - if ( m_values ) - delete[] m_values; - - m_nAttributes = n; - - m_names = new wxString[n]; - m_values = new wxString[n]; - int i; - for ( i = 0; i < n ; i ++) - { - m_names[i] = argn[i]; - m_values[i] = argv[i]; - } -} - -void wxPluginFrame::SetSize(const int x, const int y, const int width, const int height, const int sizeFlags) -{ - // Can't allow app to set the size. - return; -} - -// Sets and subclasses the platform-specific window handle -bool wxPluginFrame::SetNPWindow(NPWindow *window) -{ - if ( !window || !window->window) - { - if ( m_hWnd ) - { - wxMessageBox("Unsubclassing window prematurely"); - UnsubclassWin(); - m_hWnd = 0; - } - m_npWindow = NULL; - } - else - { - if ( m_hWnd ) - { - if ( m_hWnd == (WXHWND) window->window ) - { - // Does this mean a resize? - return TRUE; - } - } - - m_npWindow = window; - m_hWnd = (WXHWND) window->window; - SubclassWin(m_hWnd); - m_windowId = ::GetWindowLong((HWND) m_hWnd, GWL_ID); - } - return TRUE; -} - -NPError wxPluginFrame::OnNPNewStream(NPMIMEType type, NPStream *stream, bool seekable, uint16* stype) -{ - *stype = NP_ASFILE; - return NPERR_NO_ERROR; -} - -void wxPluginFrame::OnNPNewFile(NPStream *stream, const wxString& fname) -{ -} - -void wxPluginFrame::OnNPPrint(NPPrint* printInfo) -{ - if (printInfo->mode == NP_FULL) - { - // - // *Developers*: If your plugin would like to take over - // printing completely when it is in full-screen mode, - // set printInfo->pluginPrinted to TRUE and print your - // plugin as you see fit. If your plugin wants Netscape - // to handle printing in this case, set printInfo->pluginPrinted - // to FALSE (the default) and do nothing. If you do want - // to handle printing yourself, printOne is true if the - // print button (as opposed to the print menu) was clicked. - // On the Macintosh, platformPrint is a THPrint; on Windows, - // platformPrint is a structure (defined in npapi.h) containing - // the printer name, port, etc. - // - void* platformPrint = printInfo->print.fullPrint.platformPrint; - NPBool printOne = printInfo->print.fullPrint.printOne; - - printInfo->print.fullPrint.pluginPrinted = FALSE; // Do the default - - } - else // If not fullscreen, we must be embedded - { - // - // *Developers*: If your plugin is embedded, or is full-screen - // but you returned false in pluginPrinted above, NPP_Print - // will be called with mode == NP_EMBED. The NPWindow - // in the printInfo gives the location and dimensions of - // the embedded plugin on the printed page. On the Macintosh, - // platformPrint is the printer port; on Windows, platformPrint - // is the handle to the printing device context. - // - NPWindow* printWindow = &(printInfo->print.embedPrint.window); - void* platformPrint = printInfo->print.embedPrint.platformPrint; - - HDC hDC = (HDC) platformPrint; - wxRectangle rect; - rect.x = printWindow->x; - rect.y = printWindow->y; - rect.width = printWindow->width; - rect.height = printWindow->height; - - int saveIt = ::SaveDC(hDC); - - wxPrinterDC *printerDC = new wxPrinterDC((WXHDC) hDC); - - OnPrint(*printerDC, rect); - - printerDC->SetHDC(0); - delete printerDC; - - ::RestoreDC(hDC, saveIt); - } - } - -void wxPluginFrame::OnPrint(wxPrinterDC& dc, wxRectangle& rect) -{ - // We must do some transformations here - RECT winRect; -/* - winRect.left = rect.x; - winRect.top = rect.y; - winRect.right = rect.x + rect.right; - winRect.bottom = rect.y + rect.height; -*/ - POINT winPoint[2]; - winPoint[0].x = rect.x; - winPoint[0].y = rect.y; - winPoint[1].x = rect.x + rect.width; - winPoint[1].y = rect.y + rect.height; - - if (!LPtoDP((HDC) dc.GetHDC(), winPoint, 2)) - wxMessageBox("LPtoDP failed."); - - OnDraw(dc); -} - -void wxPluginFrame::OnDraw(wxDC& dc) -{ -} - diff --git a/utils/nplugin/src/npframe.h b/utils/nplugin/src/npframe.h deleted file mode 100644 index 23a45da355..0000000000 --- a/utils/nplugin/src/npframe.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * File: NPFrame.h - * Purpose: wxPluginFrame declaration - * Author: Julian Smart - * Created: 1997 - * Updated: - * Copyright: (c) Julian Smart - */ - -#ifndef __PLUGINFRAME__ -#define __PLUGINFRAME__ - -#include "wx/frame.h" -#include "NPApp.h" -#include "npapi.h" - -WXDLLEXPORT extern const char *wxFrameNameStr; - -class wxPrinterDC; -class WXDLLEXPORT wxPluginFrame: public wxFrame -{ - DECLARE_DYNAMIC_CLASS(wxPluginFrame) - -public: - wxPluginFrame(void); - inline wxPluginFrame(const wxPluginData& data) - { - m_npWindow = NULL; - m_npInstance = NULL; - m_nAttributes = 0; - m_names = NULL; - m_values = NULL; - - Create(data); - } - - ~wxPluginFrame(void); - - bool Create(const wxPluginData& data); - - // Sets and subclasses the platform-specific window handle - virtual bool SetNPWindow(NPWindow *window); - inline NPWindow *GetNPWindow(void) { return m_npWindow; } - - void SetClientSize(const int width, const int height); - void GetClientSize(int *width, int *height) const; - - void GetSize(int *width, int *height) const ; - void GetPosition(int *x, int *y) const ; - void SetSize(const int x, const int y, const int width, const int height, const int sizeFlags = wxSIZE_AUTO); - - // Accessors - inline int GetAttributeCount(void) const { return m_nAttributes; } - inline wxString GetAttributeName(const int n) { return m_names[n]; } - inline wxString GetAttributeValue(const int n) { return m_values[n]; } - - void SetAttributeValues(const int n, const char* argn[], const char *argv[]); - void SetAttributeValues(const int n, const wxString* argn, const wxString* argv); - inline void SetInstance(const NPP instance) { m_npInstance = instance; }; - inline NPP GetInstance(void) { return m_npInstance; } - - // Overridables: low-level - virtual NPError OnNPNewStream(NPMIMEType type, NPStream *stream, bool seekable, uint16* stype); - virtual void OnNPNewFile(NPStream *stream, const wxString& fname); - virtual void OnNPPrint(NPPrint* printInfo); - - // Overridables: high-level - virtual void OnPrint(wxPrinterDC& dc, wxRectangle& rect); - virtual void OnDraw(wxDC& dc); - -protected: - - wxString* m_names; - wxString* m_values; - int m_nAttributes; - NPP m_npInstance; - NPWindow* m_npWindow; -}; - -#endif - diff --git a/utils/nplugin/src/npshell.cpp b/utils/nplugin/src/npshell.cpp deleted file mode 100644 index fa040054de..0000000000 --- a/utils/nplugin/src/npshell.cpp +++ /dev/null @@ -1,278 +0,0 @@ -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -// -// npshell.cpp -// -// This file defines a "shell" plugin that plugin developers can use -// as the basis for a real plugin. This shell just provides empty -// implementations of all functions that the plugin can implement -// that will be called by Netscape (the NPP_xxx methods defined in -// npapi.h). -// -//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -#ifndef _NPAPI_H_ -#include "npapi.h" -#endif - -#include -#include -#include - -#include "NPApp.h" - -// -// Instance state information about the plugin. -// -// *Developers*: Use this struct to hold per-instance -// information that you'll need in the -// various functions in this file. -// -typedef struct _PluginInstance -{ - NPWindow* fWindow; - uint16 fMode; - -} PluginInstance; - - - -//------------------------------------------------------------------------------------ -// NPP_Initialize: -//------------------------------------------------------------------------------------ -NPError NPP_Initialize(void) -{ -// MessageBox(NULL, "NPP_Initialize", "NPTest", MB_OK); - - wxPluginApp *app = wxGetPluginApp(); - if ( app ) - return app->NPP_Initialize(); - else - return NPERR_NO_ERROR; -} - - -//------------------------------------------------------------------------------------ -// NPP_Shutdown: -//------------------------------------------------------------------------------------ -void NPP_Shutdown(void) -{ -// MessageBox(NULL, "NPP_Shutdown", "wxPlugin", MB_OK); - - wxPluginApp *app = wxGetPluginApp(); - if ( app ) - app->NPP_Shutdown(); -} - - -//------------------------------------------------------------------------------------ -// NPP_New: -//------------------------------------------------------------------------------------ -NPError NP_LOADDS -NPP_New(NPMIMEType pluginType, - NPP instance, - uint16 mode, - int16 argc, - char* argn[], - char* argv[], - NPSavedData* saved) -{ -// MessageBox(NULL, "NPP_New", "NPTest", MB_OK); - - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - wxPluginApp *app = wxGetPluginApp(); - if ( app ) - return app->NPP_New(pluginType, instance, mode, argc, argn, argv, saved); - else - return NPERR_NO_ERROR; -} - -//------------------------------------------------------------------------------------ -// NPP_Destroy: -//------------------------------------------------------------------------------------ -NPError NP_LOADDS -NPP_Destroy(NPP instance, NPSavedData** save) -{ -// MessageBox(NULL, "NPP_Destroy", "NPTest", MB_OK); - - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - wxPluginApp *app = wxGetPluginApp(); - if ( app ) - return app->NPP_Destroy(instance, save); - else - return NPERR_NO_ERROR; -} - - -//------------------------------------------------------------------------------------ -// NPP_SetWindow: -//------------------------------------------------------------------------------------ -NPError NP_LOADDS -NPP_SetWindow(NPP instance, NPWindow* window) -{ -// MessageBox(NULL, "NPP_SetWindow", "NPTest", MB_OK); - - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - wxPluginApp *app = wxGetPluginApp(); - if ( app ) - return app->NPP_SetWindow(instance, window); - else - return NPERR_NO_ERROR; -} - - -//------------------------------------------------------------------------------------ -// NPP_NewStream: -//------------------------------------------------------------------------------------ -NPError NP_LOADDS -NPP_NewStream(NPP instance, - NPMIMEType type, - NPStream *stream, - NPBool seekable, - uint16 *stype) -{ -// MessageBox(NULL, "NPP_NewStream", "NPTest", MB_OK); - - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - wxPluginApp *app = wxGetPluginApp(); - if ( app ) - return app->NPP_NewStream(instance, type, stream, seekable, stype); - else - return NPERR_NO_ERROR; -} - - - -// -// *Developers*: -// These next 2 functions are directly relevant in a plug-in which handles the -// data in a streaming manner. If you want zero bytes because no buffer space -// is YET available, return 0. As long as the stream has not been written -// to the plugin, Navigator will continue trying to send bytes. If the plugin -// doesn't want them, just return some large number from NPP_WriteReady(), and -// ignore them in NPP_Write(). For a NP_ASFILE stream, they are still called -// but can safely be ignored using this strategy. -// - -static int32 STREAMBUFSIZE = 0X0FFFFFFF; // If we are reading from a file in NPAsFile - // mode so we can take any size stream in our - // write call (since we ignore it) - -//------------------------------------------------------------------------------------ -// NPP_WriteReady: -//------------------------------------------------------------------------------------ -int32 NP_LOADDS -NPP_WriteReady(NPP instance, NPStream *stream) -{ - wxPluginApp *app = wxGetPluginApp(); - if ( app ) - return app->NPP_WriteReady(instance, stream); - else - return STREAMBUFSIZE; - - return STREAMBUFSIZE; // Number of bytes ready to accept in NPP_Write() -} - - - -//------------------------------------------------------------------------------------ -// NPP_Write: -//------------------------------------------------------------------------------------ -int32 NP_LOADDS -NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer) -{ - wxPluginApp *app = wxGetPluginApp(); - if ( app ) - return app->NPP_Write(instance, stream, offset, len, buffer); - else - return len; // The number of bytes accepted -} - - - -//------------------------------------------------------------------------------------ -// NPP_DestroyStream: -//------------------------------------------------------------------------------------ -NPError NP_LOADDS -NPP_DestroyStream(NPP instance, NPStream *stream, NPError reason) -{ - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - wxPluginApp *app = wxGetPluginApp(); - if ( app ) - return app->NPP_DestroyStream(instance, stream, reason); - else - return NPERR_NO_ERROR; -} - - -//------------------------------------------------------------------------------------ -// NPP_StreamAsFile: -//------------------------------------------------------------------------------------ -void NP_LOADDS -NPP_StreamAsFile(NPP instance, NPStream *stream, const char* fname) -{ - wxPluginApp *app = wxGetPluginApp(); - if ( app ) - app->NPP_StreamAsFile(instance, stream, fname); -} - - - -//------------------------------------------------------------------------------------ -// NPP_Print: -//------------------------------------------------------------------------------------ -void NP_LOADDS -NPP_Print(NPP instance, NPPrint* printInfo) -{ - if (printInfo == NULL) // trap invalid parm - return; - if ( instance == NULL ) - return; - - wxPluginApp *app = wxGetPluginApp(); - if ( app ) - app->NPP_Print(instance, printInfo); -} - - -//------------------------------------------------------------------------------------ -// NPP_HandleEvent: -// Mac-only. -//------------------------------------------------------------------------------------ -int16 NPP_HandleEvent(NPP instance, void* event) -{ - NPBool eventHandled = FALSE; - if (instance == NULL) - return eventHandled; - - PluginInstance* This = (PluginInstance*) instance->pdata; - - // - // *Developers*: The "event" passed in is a Macintosh - // EventRecord*. The event.what field can be any of the - // normal Mac event types, or one of the following additional - // types defined in npapi.h: getFocusEvent, loseFocusEvent, - // adjustCursorEvent. The focus events inform your plugin - // that it will become, or is no longer, the recepient of - // key events. If your plugin doesn't want to receive key - // events, return false when passed at getFocusEvent. The - // adjustCursorEvent is passed repeatedly when the mouse is - // over your plugin; if your plugin doesn't want to set the - // cursor, return false. Handle the standard Mac events as - // normal. The return value for all standard events is currently - // ignored except for the key event: for key events, only return - // true if your plugin has handled that particular key event. - // - - return eventHandled; -} - diff --git a/utils/nplugin/src/npupp.h b/utils/nplugin/src/npupp.h deleted file mode 100644 index 1c352d2245..0000000000 --- a/utils/nplugin/src/npupp.h +++ /dev/null @@ -1,799 +0,0 @@ -/* - * npupp.h $Revision$ - * function call mecahnics needed by platform specific glue code. - */ - - -#ifndef _NPUPP_H_ -#define _NPUPP_H_ - -#ifndef GENERATINGCFM -#define GENERATINGCFM 0 -#endif - -#ifndef _NPAPI_H_ -#include "npapi.h" -#endif - -/****************************************************************************************** - plug-in function table macros - for each function in and out of the plugin API we define - typedef NPP_FooUPP - #define NewNPP_FooProc - #define CallNPP_FooProc - for mac, define the UPP magic for PPC/68K calling - *******************************************************************************************/ - - -/* NPP_Initialize */ - -#if GENERATINGCFM -typedef UniversalProcPtr NPP_InitializeUPP; - -enum { - uppNPP_InitializeProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0)) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPP_InitializeProc(FUNC) \ - (NPP_InitializeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_InitializeProcInfo, GetCurrentArchitecture()) -#define CallNPP_InitializeProc(FUNC) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_InitializeProcInfo) - -#else - -typedef void (*NPP_InitializeUPP)(void); -#define NewNPP_InitializeProc(FUNC) \ - ((NPP_InitializeUPP) (FUNC)) -#define CallNPP_InitializeProc(FUNC) \ - (*(FUNC))() - -#endif - - -/* NPP_Shutdown */ - -#if GENERATINGCFM -typedef UniversalProcPtr NPP_ShutdownUPP; - -enum { - uppNPP_ShutdownProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0)) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPP_ShutdownProc(FUNC) \ - (NPP_ShutdownUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_ShutdownProcInfo, GetCurrentArchitecture()) -#define CallNPP_ShutdownProc(FUNC) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_ShutdownProcInfo) - -#else - -typedef void (*NPP_ShutdownUPP)(void); -#define NewNPP_ShutdownProc(FUNC) \ - ((NPP_ShutdownUPP) (FUNC)) -#define CallNPP_ShutdownProc(FUNC) \ - (*(FUNC))() - -#endif - - -/* NPP_New */ - -#if GENERATINGCFM -typedef UniversalProcPtr NPP_NewUPP; - -enum { - uppNPP_NewProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPMIMEType))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(char **))) - | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(char **))) - | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(NPSavedData *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; - -#define NewNPP_NewProc(FUNC) \ - (NPP_NewUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewProcInfo, GetCurrentArchitecture()) -#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewProcInfo, \ - (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) -#else - -typedef NPError (*NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved); -#define NewNPP_NewProc(FUNC) \ - ((NPP_NewUPP) (FUNC)) -#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7)) - -#endif - - -/* NPP_Destroy */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_DestroyUPP; -enum { - uppNPP_DestroyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPSavedData **))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_DestroyProc(FUNC) \ - (NPP_DestroyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyProcInfo, GetCurrentArchitecture()) -#define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyProcInfo, (ARG1), (ARG2)) -#else - -typedef NPError (*NPP_DestroyUPP)(NPP instance, NPSavedData** save); -#define NewNPP_DestroyProc(FUNC) \ - ((NPP_DestroyUPP) (FUNC)) -#define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \ - (*(FUNC))((ARG1), (ARG2)) - -#endif - - -/* NPP_SetWindow */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_SetWindowUPP; -enum { - uppNPP_SetWindowProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPWindow *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_SetWindowProc(FUNC) \ - (NPP_SetWindowUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetWindowProcInfo, GetCurrentArchitecture()) -#define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetWindowProcInfo, (ARG1), (ARG2)) - -#else - -typedef NPError (*NPP_SetWindowUPP)(NPP instance, NPWindow* window); -#define NewNPP_SetWindowProc(FUNC) \ - ((NPP_SetWindowUPP) (FUNC)) -#define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \ - (*(FUNC))((ARG1), (ARG2)) - -#endif - - -/* NPP_NewStream */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_NewStreamUPP; -enum { - uppNPP_NewStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16 *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_NewStreamProc(FUNC) \ - (NPP_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewStreamProcInfo, GetCurrentArchitecture()) -#define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewStreamProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5)) -#else - -typedef NPError (*NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype); -#define NewNPP_NewStreamProc(FUNC) \ - ((NPP_NewStreamUPP) (FUNC)) -#define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5)) -#endif - - -/* NPP_DestroyStream */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_DestroyStreamUPP; -enum { - uppNPP_DestroyStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPError))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_DestroyStreamProc(FUNC) \ - (NPP_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, GetCurrentArchitecture()) -#define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPErrorArg) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, (NPParg), (NPStreamPtr), (NPErrorArg)) - -#else - -typedef NPError (*NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPError reason); -#define NewNPP_DestroyStreamProc(FUNC) \ - ((NPP_DestroyStreamUPP) (FUNC)) -#define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPErrorArg) \ - (*(FUNC))((NPParg), (NPStreamPtr), (NPErrorArg)) - -#endif - - -/* NPP_WriteReady */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_WriteReadyUPP; -enum { - uppNPP_WriteReadyProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32))) -}; -#define NewNPP_WriteReadyProc(FUNC) \ - (NPP_WriteReadyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, GetCurrentArchitecture()) -#define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \ - (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr)) - -#else - -typedef int32 (*NPP_WriteReadyUPP)(NPP instance, NPStream* stream); -#define NewNPP_WriteReadyProc(FUNC) \ - ((NPP_WriteReadyUPP) (FUNC)) -#define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \ - (*(FUNC))((NPParg), (NPStreamPtr)) - -#endif - - -/* NPP_Write */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_WriteUPP; -enum { - uppNPP_WriteProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32))) -}; -#define NewNPP_WriteProc(FUNC) \ - (NPP_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteProcInfo, GetCurrentArchitecture()) -#define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \ - (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr)) - -#else - -typedef int32 (*NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer); -#define NewNPP_WriteProc(FUNC) \ - ((NPP_WriteUPP) (FUNC)) -#define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \ - (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr)) - -#endif - - -/* NPP_StreamAsFile */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_StreamAsFileUPP; -enum { - uppNPP_StreamAsFileProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *))) - | RESULT_SIZE(SIZE_CODE(0)) -}; -#define NewNPP_StreamAsFileProc(FUNC) \ - (NPP_StreamAsFileUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, GetCurrentArchitecture()) -#define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, (ARG1), (ARG2), (ARG3)) - -#else - -typedef void (*NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname); -#define NewNPP_StreamAsFileProc(FUNC) \ - ((NPP_StreamAsFileUPP) (FUNC)) -#define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPP_Print */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_PrintUPP; -enum { - uppNPP_PrintProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPrint *))) - | RESULT_SIZE(SIZE_CODE(0)) -}; -#define NewNPP_PrintProc(FUNC) \ - (NPP_PrintUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_PrintProcInfo, GetCurrentArchitecture()) -#define CallNPP_PrintProc(FUNC, NPParg, voidPtr) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_PrintProcInfo, (NPParg), (voidPtr)) - -#else - -typedef void (*NPP_PrintUPP)(NPP instance, NPPrint* platformPrint); -#define NewNPP_PrintProc(FUNC) \ - ((NPP_PrintUPP) (FUNC)) -#define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \ - (*(FUNC))((NPParg), (NPPrintArg)) - -#endif - - -/* NPP_HandleEvent */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_HandleEventUPP; -enum { - uppNPP_HandleEventProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *))) - | RESULT_SIZE(SIZE_CODE(sizeof(int16))) -}; -#define NewNPP_HandleEventProc(FUNC) \ - (NPP_HandleEventUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_HandleEventProcInfo, GetCurrentArchitecture()) -#define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \ - (int16)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr)) - -#else - -typedef int16 (*NPP_HandleEventUPP)(NPP instance, void* event); -#define NewNPP_HandleEventProc(FUNC) \ - ((NPP_HandleEventUPP) (FUNC)) -#define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \ - (*(FUNC))((NPParg), (voidPtr)) - -#endif - - - - -/* - * Netscape entry points - */ - - -/* NPN_GetUrl */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_GetURLUPP; -enum { - uppNPN_GetURLProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_GetURLProc(FUNC) \ - (NPN_GetURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLProcInfo, GetCurrentArchitecture()) -#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLProcInfo, (ARG1), (ARG2), (ARG3)) -#else - -typedef NPError (*NPN_GetURLUPP)(NPP instance, const char* url, const char* window); -#define NewNPN_GetURLProc(FUNC) \ - ((NPN_GetURLUPP) (FUNC)) -#define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \ - (*(FUNC))((ARG1), (ARG2), (ARG3)) -#endif - - -/* NPN_PostUrl */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_PostURLUPP; -enum { - uppNPN_PostURLProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*))) - | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_PostURLProc(FUNC) \ - (NPN_PostURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLProcInfo, GetCurrentArchitecture()) -#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6)) -#else - -typedef NPError (*NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file); -#define NewNPN_PostURLProc(FUNC) \ - ((NPN_PostURLUPP) (FUNC)) -#define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \ - (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6)) -#endif - - -/* NPN_RequestRead */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_RequestReadUPP; -enum { - uppNPN_RequestReadProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPByteRange *))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_RequestReadProc(FUNC) \ - (NPN_RequestReadUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RequestReadProcInfo, GetCurrentArchitecture()) -#define CallNPN_RequestReadProc(FUNC, stream, range) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RequestReadProcInfo, (stream), (range)) - -#else - -typedef NPError (*NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList); -#define NewNPN_RequestReadProc(FUNC) \ - ((NPN_RequestReadUPP) (FUNC)) -#define CallNPN_RequestReadProc(FUNC, stream, range) \ - (*(FUNC))((stream), (range)) - -#endif - - -/* NPN_NewStream */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_NewStreamUPP; -enum { - uppNPN_NewStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP ))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool))) - | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16*))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_NewStreamProc(FUNC) \ - (NPN_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_NewStreamProcInfo, GetCurrentArchitecture()) -#define CallNPN_NewStreamProc(FUNC, npp, type, stream) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_NewStreamProcInfo, (npp), (type), (stream)) - -#else - -typedef NPError (*NPN_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream); -#define NewNPN_NewStreamProc(FUNC) \ - ((NPN_NewStreamUPP) (FUNC)) -#define CallNPN_NewStreamProc(FUNC, npp, type, stream) \ - (*(FUNC))((npp), (type), (stream)) - -#endif - - -/* NPN_Write */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_WriteUPP; -enum { - uppNPN_WriteProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP ))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32))) - | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*))) - | RESULT_SIZE(SIZE_CODE(sizeof(int32))) -}; -#define NewNPN_WriteProc(FUNC) \ - (NPN_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_WriteProcInfo, GetCurrentArchitecture()) -#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \ - (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer)) - -#else - -typedef int32 (*NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer); -#define NewNPN_WriteProc(FUNC) \ - ((NPN_WriteUPP) (FUNC)) -#define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \ - (*(FUNC))((npp), (stream), (len), (buffer)) - -#endif - - -/* NPN_DestroyStream */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_DestroyStreamUPP; -enum { - uppNPN_DestroyStreamProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP ))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPError))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPN_DestroyStreamProc(FUNC) \ - (NPN_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, GetCurrentArchitecture()) -#define CallNPN_DestroyStreamProc(FUNC, npp, stream, err) \ - (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, (npp), (stream), (err)) - -#else - -typedef NPError (*NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPError reason); -#define NewNPN_DestroyStreamProc(FUNC) \ - ((NPN_DestroyStreamUPP) (FUNC)) -#define CallNPN_DestroyStreamProc(FUNC, npp, stream, err) \ - (*(FUNC))((npp), (stream), (err)) - -#endif - - -/* NPN_Status */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_StatusUPP; -enum { - uppNPN_StatusProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char *))) -}; - -#define NewNPN_StatusProc(FUNC) \ - (NPN_StatusUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_StatusProcInfo, GetCurrentArchitecture()) -#define CallNPN_StatusProc(FUNC, npp, msg) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_StatusProcInfo, (npp), (msg)) - -#else - -typedef void (*NPN_StatusUPP)(NPP instance, const char* message); -#define NewNPN_StatusProc(FUNC) \ - ((NPN_StatusUPP) (FUNC)) -#define CallNPN_StatusProc(FUNC, npp, msg) \ - (*(FUNC))((npp), (msg)) - -#endif - - -/* NPN_UserAgent */ -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_UserAgentUPP; -enum { - uppNPN_UserAgentProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP))) - | RESULT_SIZE(SIZE_CODE(sizeof(const char *))) -}; - -#define NewNPN_UserAgentProc(FUNC) \ - (NPN_UserAgentUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_UserAgentProcInfo, GetCurrentArchitecture()) -#define CallNPN_UserAgentProc(FUNC, ARG1) \ - (const char*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_UserAgentProcInfo, (ARG1)) - -#else - -typedef const char* (*NPN_UserAgentUPP)(NPP instance); -#define NewNPN_UserAgentProc(FUNC) \ - ((NPN_UserAgentUPP) (FUNC)) -#define CallNPN_UserAgentProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN_MemAlloc */ -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_MemAllocUPP; -enum { - uppNPN_MemAllocProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32))) - | RESULT_SIZE(SIZE_CODE(sizeof(void *))) -}; - -#define NewNPN_MemAllocProc(FUNC) \ - (NPN_MemAllocUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemAllocProcInfo, GetCurrentArchitecture()) -#define CallNPN_MemAllocProc(FUNC, ARG1) \ - (void*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemAllocProcInfo, (ARG1)) - -#else - -typedef void* (*NPN_MemAllocUPP)(uint32 size); -#define NewNPN_MemAllocProc(FUNC) \ - ((NPN_MemAllocUPP) (FUNC)) -#define CallNPN_MemAllocProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN__MemFree */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_MemFreeUPP; -enum { - uppNPN_MemFreeProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void *))) -}; - -#define NewNPN_MemFreeProc(FUNC) \ - (NPN_MemFreeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFreeProcInfo, GetCurrentArchitecture()) -#define CallNPN_MemFreeProc(FUNC, ARG1) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFreeProcInfo, (ARG1)) - -#else - -typedef void (*NPN_MemFreeUPP)(void* ptr); -#define NewNPN_MemFreeProc(FUNC) \ - ((NPN_MemFreeUPP) (FUNC)) -#define CallNPN_MemFreeProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - -/* NPN_MemFlush */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_MemFlushUPP; -enum { - uppNPN_MemFlushProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32))) - | RESULT_SIZE(SIZE_CODE(sizeof(uint32))) -}; - -#define NewNPN_MemFlushProc(FUNC) \ - (NPN_MemFlushUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFlushProcInfo, GetCurrentArchitecture()) -#define CallNPN_MemFlushProc(FUNC, ARG1) \ - (uint32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1)) - -#else - -typedef uint32 (*NPN_MemFlushUPP)(uint32 size); -#define NewNPN_MemFlushProc(FUNC) \ - ((NPN_MemFlushUPP) (FUNC)) -#define CallNPN_MemFlushProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - - -/* NPN_ReloadPlugins */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPN_ReloadPluginsUPP; -enum { - uppNPN_ReloadPluginsProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPBool))) - | RESULT_SIZE(SIZE_CODE(0)) -}; - -#define NewNPN_ReloadPluginsProc(FUNC) \ - (NPN_ReloadPluginsUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, GetCurrentArchitecture()) -#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \ - (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, (ARG1)) - -#else - -typedef void (*NPN_ReloadPluginsUPP)(NPBool reloadPages); -#define NewNPN_ReloadPluginsProc(FUNC) \ - ((NPN_ReloadPluginsUPP) (FUNC)) -#define CallNPN_ReloadPluginsProc(FUNC, ARG1) \ - (*(FUNC))((ARG1)) - -#endif - - - - -/****************************************************************************************** - * The actual plugin function table definitions - *******************************************************************************************/ - -typedef struct _NPPluginFuncs { - uint16 size; - uint16 version; - NPP_NewUPP newp; - NPP_DestroyUPP destroy; - NPP_SetWindowUPP setwindow; - NPP_NewStreamUPP newstream; - NPP_DestroyStreamUPP destroystream; - NPP_StreamAsFileUPP asfile; - NPP_WriteReadyUPP writeready; - NPP_WriteUPP write; - NPP_PrintUPP print; - NPP_HandleEventUPP event; -} NPPluginFuncs; - -typedef struct _NPNetscapeFuncs { - uint16 size; - uint16 version; - NPN_GetURLUPP geturl; - NPN_PostURLUPP posturl; - NPN_RequestReadUPP requestread; - NPN_NewStreamUPP newstream; - NPN_WriteUPP write; - NPN_DestroyStreamUPP destroystream; - NPN_StatusUPP status; - NPN_UserAgentUPP uagent; - NPN_MemAllocUPP memalloc; - NPN_MemFreeUPP memfree; - NPN_MemFlushUPP memflush; - NPN_ReloadPluginsUPP reloadplugins; -} NPNetscapeFuncs; - - - -#ifdef XP_MAC -/****************************************************************************************** - * Mac platform-specific plugin glue stuff - *******************************************************************************************/ - -/* - * Main entry point of the plugin. - * This routine will be called when the plugin is loaded. The function - * tables are passed in and the plugin fills in the NPPluginFuncs table - * and NPPShutdownUPP for Netscape's use. - */ - -#if GENERATINGCFM - -typedef UniversalProcPtr NPP_MainEntryUPP; -enum { - uppNPP_MainEntryProcInfo = kThinkCStackBased - | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPNetscapeFuncs*))) - | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPluginFuncs*))) - | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPP_ShutdownUPP*))) - | RESULT_SIZE(SIZE_CODE(sizeof(NPError))) -}; -#define NewNPP_MainEntryProc(FUNC) \ - (NPP_MainEntryUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_MainEntryProcInfo, GetCurrentArchitecture()) -#define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \ - CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNPP_MainEntryProcInfo, (netscapeFunc), (pluginFunc), (shutdownUPP)) - -#else - -typedef NPError (*NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*); -#define NewNPP_MainEntryProc(FUNC) \ - ((NPP_MainEntryUPP) (FUNC)) -#define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \ - (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP)) - -#endif -#endif /* MAC */ - - -#ifdef _WINDOWS - -#ifdef __cplusplus -extern "C" { -#endif - -/* plugin meta member functions */ - -NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* pFuncs); - -NPError WINAPI NP_Initialize(NPNetscapeFuncs* pFuncs); - -NPError WINAPI NP_Shutdown(); - -#ifdef __cplusplus -} -#endif - -#endif /* _WINDOWS */ - - -#endif /* _NPUPP_H_ */ - diff --git a/utils/nplugin/src/npwin.cpp b/utils/nplugin/src/npwin.cpp deleted file mode 100644 index f97ef498a7..0000000000 --- a/utils/nplugin/src/npwin.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* npwin.cpp */ -#include "windows.h" - -#include "npapi.h" -#include "npupp.h" - -#ifdef __WIN32__ - #define NP_EXPORT -#else - #define NP_EXPORT _export -#endif - -static NPNetscapeFuncs* g_pNavigatorFuncs = NULL; - - -/* PLUGIN DLL entry points */ -/* These are the Windows specific DLL entry points, not the "normal" plugin - entry points. The "normal" ones are in NPSHELL.CPP -*/ - -/* fills in the func table used by Navigator to call entry points in - plugin DLL. Note that these entry points ensure that DS is loaded - by using the NP_LOADDS macro, when compiling for Win16 -*/ -NPError WINAPI NP_EXPORT NP_GetEntryPoints(NPPluginFuncs* pFuncs) -{ - /* trap a NULL ptr */ - if(pFuncs == NULL) - return NPERR_INVALID_FUNCTABLE_ERROR; - - /* if the plugin's function table is smaller than the plugin expects, - then they are incompatible, and should return an error */ - if(pFuncs->size < sizeof NPPluginFuncs) - return NPERR_INVALID_FUNCTABLE_ERROR; - - pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; - pFuncs->newp = NPP_New; - pFuncs->destroy = NPP_Destroy; - pFuncs->setwindow = NPP_SetWindow; - pFuncs->newstream = NPP_NewStream; - pFuncs->destroystream = NPP_DestroyStream; - pFuncs->asfile = NPP_StreamAsFile; - pFuncs->writeready = NPP_WriteReady; - pFuncs->write = NPP_Write; - pFuncs->print = NPP_Print; - pFuncs->event = NULL; /* reserved */ - - return NPERR_NO_ERROR; -} - -/* called immediately after the plugin DLL is loaded -*/ -NPError WINAPI NP_EXPORT NP_Initialize(NPNetscapeFuncs* pFuncs) -{ - /* trap a NULL ptr */ - if(pFuncs == NULL) - return NPERR_INVALID_FUNCTABLE_ERROR; - - g_pNavigatorFuncs = pFuncs; /* save it for future reference */ - - /* if the plugin's major ver level is lower than the Navigator's, - then they are incompatible, and should return an error */ - if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR) - return NPERR_INCOMPATIBLE_VERSION_ERROR; - - /* if the Navigator's function table is smaller than the plugin expects, - then they are incompatible, and should return an error */ - if(pFuncs->size < sizeof NPNetscapeFuncs) - return NPERR_INVALID_FUNCTABLE_ERROR; - - return NPP_Initialize(); -} - -/* called immediately before the plugin DLL is unloaded -*/ -NPError WINAPI NP_EXPORT NP_Shutdown() -{ - NPP_Shutdown(); - - g_pNavigatorFuncs = NULL; - - return NPERR_NO_ERROR; -} - - -/* NAVIGATOR Entry points */ - -/* These entry points expect to be called from within the plugin. The - noteworthy assumption is that DS has already been set to point to the - plugin's DLL data segment. Don't call these functions from outside - the plugin without ensuring DS is set to the DLLs data segment first, - typically using the NP_LOADDS macro -*/ - -/* returns the major/minor version numbers of the Plugin API for the plugin - and the Navigator -*/ -void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor) -{ - *plugin_major = NP_VERSION_MAJOR; - *plugin_minor = NP_VERSION_MINOR; - *netscape_major = HIBYTE(g_pNavigatorFuncs->version); - *netscape_minor = LOBYTE(g_pNavigatorFuncs->version); -} - -/* causes the specified URL to be fetched and streamed in -*/ -NPError NPN_GetURL(NPP instance, const char *url, const char *window) -{ - return g_pNavigatorFuncs->geturl(instance, url, window); -} - -NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file) -{ - return g_pNavigatorFuncs->posturl(instance, url, window, len, buf, file); -} - -/* Requests that a number of bytes be provided on a stream. Typically - this would be used if a stream was in "pull" mode. An optional - position can be provided for streams which are seekable. -*/ -NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList) -{ - return g_pNavigatorFuncs->requestread(stream, rangeList); -} - -/* Creates a new stream of data from the plug-in to be interpreted - by Netscape in the current window. -*/ -NPError NPN_NewStream(NPP instance, NPMIMEType type, NPStream *stream) -{ - return g_pNavigatorFuncs->newstream(instance, type, stream); -} - -/* Provides len bytes of data. -*/ -int32 NPN_Write(NPP instance, NPStream *stream, - int32 len, void *buffer) -{ - return g_pNavigatorFuncs->write(instance, stream, len, buffer); -} - -/* Closes a stream object. -reason indicates why the stream was closed. -*/ -NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason) -{ - return g_pNavigatorFuncs->destroystream(instance, stream, reason); -} - -/* Provides a text status message in the Netscape client user interface -*/ -void NPN_Status(NPP instance, const char *message) -{ - g_pNavigatorFuncs->status(instance, message); -} - -/* returns the user agent string of Navigator, which contains version info -*/ -const char* NPN_UserAgent(NPP instance) -{ - return g_pNavigatorFuncs->uagent(instance); -} - -/* allocates memory from the Navigator's memory space. Necessary so that - saved instance data may be freed by Navigator when exiting. -*/ -void* NPN_MemAlloc(uint32 size) -{ - return g_pNavigatorFuncs->memalloc(size); -} - -/* reciprocal of MemAlloc() above -*/ -void NPN_MemFree(void* ptr) -{ - g_pNavigatorFuncs->memfree(ptr); -} - -/* private function to Netscape. do not use! -*/ -void NPN_ReloadPlugins(NPBool reloadPages) -{ - g_pNavigatorFuncs->reloadplugins(reloadPages); -} - diff --git a/utils/ogl/distrib/ogl.rsp b/utils/ogl/distrib/ogl.rsp deleted file mode 100644 index f7eaa1967c..0000000000 --- a/utils/ogl/distrib/ogl.rsp +++ /dev/null @@ -1,39 +0,0 @@ -src/*.cpp -src/*.c -src/*.h -src/*.rc -src/*.def -src/*.xbm -src/make*.* -src/*.txt -src/*.ico -src/*.bmp - -samples/ogledit/*.cpp -samples/ogledit/*.c -samples/ogledit/*.h -samples/ogledit/*.rc -samples/ogledit/*.def -samples/ogledit/*.xbm -samples/ogledit/make*.* -samples/ogledit/*.txt - -samples/ogledit/*.ico -samples/ogledit/*.bmp -samples/ogledit/bitmaps/*.bmp -samples/ogledit/bitmaps/*.gif -samples/ogledit/bitmaps/*.xbm - -distrib/*.rsp -distrib/*.bat - -docs/*.txt -docs/*.tex -docs/*.ini -docs/*.hpj -docs/*.ps -docs/*.eps -docs/*.cnt -docs/*.bmp -docs/*.gif -docs/*.hlp diff --git a/utils/ogl/distrib/tarogl.bat b/utils/ogl/distrib/tarogl.bat deleted file mode 100755 index 68202249c0..0000000000 --- a/utils/ogl/distrib/tarogl.bat +++ /dev/null @@ -1,48 +0,0 @@ -@echo off -rem Tar up an external distribution of OGL - -if "%1" == "" goto usage -if "%2" == "" goto usage -echo About to archive an external OGL distribution: -echo From %1 -echo To %2\ogl.tgz -echo CTRL-C if this is not correct. -inkey /W4 `Press any key to continue...` %%input - -erase %2\ogl.tgz -cd %1 - -rem First, expand the wildcards in the ogl.rsp file - -rem Create empty list file -erase %1\distrib\ogl.lis -c:\bin\touch %1\distrib\ogl.lis - -rem Create a .rsp file with backslashes instead -rem of forward slashes -rem No need if using ls2 (from UNIX95 distribution) -rem sed -e "s/\//\\/g" %1\distrib\ogl.rsp > %1\distrib\ogl.rs2 - -set len=%@LINES[%1\distrib\ogl.rsp] -rem set len=%@DEC[%len] -do i = 0 to %len by 1 - set line=%@LINE[%1\distrib\ogl.rsp,%i] - if NOT "%line" == "" ls2 -1 %line >> %1\distrib\ogl.lis -enddo - -tar -c -T %1\distrib\ogl.lis -move archive.tar ogl.tar -gzip ogl.tar -move ogl.taz %2\ogl.tgz - -echo OGL archived. -goto end - -:usage -echo DOS OGL distribution. -echo Usage: tarogl source destination -echo e.g. tarogl c:\wx\utils\ogl c:\wx\utils\ogl\deliver - -:end - - diff --git a/utils/ogl/distrib/zipogl.bat b/utils/ogl/distrib/zipogl.bat deleted file mode 100755 index 05c58347cf..0000000000 --- a/utils/ogl/distrib/zipogl.bat +++ /dev/null @@ -1,26 +0,0 @@ -@echo off -rem Zip up an external distribution of OGL - -if "%1" == "" goto usage -if "%2" == "" goto usage -echo About to archive an external OGL distribution: -echo From %1 -echo To %2\ogl.zip -echo CTRL-C if this is not correct. -inkey /W4 `Press any key to continue...` %%input - -erase %2\ogl.zip -cd %1 -zip -P %3 %4 %5 %6 %7 %8 %2\ogl.zip @%1\distrib\ogl.rsp - -echo OGL archived. -goto end - -:usage -echo DOS OGL distribution. -echo Usage: zipogl source destination -echo e.g. zipogl c:\wx\utils\ogl c:\wx\utils\ogl\deliver - -:end - - diff --git a/utils/ogl/docs/back.gif b/utils/ogl/docs/back.gif deleted file mode 100644 index 8a61076d3b..0000000000 Binary files a/utils/ogl/docs/back.gif and /dev/null differ diff --git a/utils/ogl/docs/books.bmp b/utils/ogl/docs/books.bmp deleted file mode 100644 index cf1e148734..0000000000 Binary files a/utils/ogl/docs/books.bmp and /dev/null differ diff --git a/utils/ogl/docs/bugs.tex b/utils/ogl/docs/bugs.tex deleted file mode 100644 index d66f64e613..0000000000 --- a/utils/ogl/docs/bugs.tex +++ /dev/null @@ -1,11 +0,0 @@ -\chapter{Bugs}\label{bugs}% -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage} - -These are the known bugs. - -\begin{itemize}\itemsep=0pt -\item In the OGLEdit sample, .dia files are output double-spaced -due to an unidentified bug in the way a stream is converted to a file. -\end{itemize} - diff --git a/utils/ogl/docs/bullet.bmp b/utils/ogl/docs/bullet.bmp deleted file mode 100644 index aad8fc793e..0000000000 Binary files a/utils/ogl/docs/bullet.bmp and /dev/null differ diff --git a/utils/ogl/docs/changes.tex b/utils/ogl/docs/changes.tex deleted file mode 100644 index 8b2f27e10d..0000000000 --- a/utils/ogl/docs/changes.tex +++ /dev/null @@ -1,9 +0,0 @@ -\chapter{Change log} -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage} - -Version 2.0, June 1st 1996 - -\begin{itemize}\itemsep=0pt -\item First publically released version. -\end{itemize} diff --git a/utils/ogl/docs/classes.tex b/utils/ogl/docs/classes.tex deleted file mode 100644 index 02bce73283..0000000000 --- a/utils/ogl/docs/classes.tex +++ /dev/null @@ -1,2505 +0,0 @@ -\chapter{Class reference}\label{classref} -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage} - -These are the main \ogl\ classes. - -\section{\class{OGLConstraint}: wxObject}\label{oglconstraint} - -\overview{wxCompositeShape overview}{compositeshapeoverview} - -An OGLConstraint object helps specify how child shapes are laid out with respect -to siblings and parents. - -\membersection{OGLConstraint::OGLConstraint}\label{oglconstraintconstr} - -\func{void}{OGLConstraint}{\void} - -Default constructor. - -\func{void}{OGLConstraint}{\param{int}{ type}, \param{wxShape *}{constraining}, \param{wxList\& }{constrained}} - -Constructor. - -{\it constraining} is the shape which is used as the reference for positioning the {\it constrained} objects. - -{\it constrained} contains a list of wxShapes which are to be constrained (with respect -to {\it constraining}) using {\it type}. - -{\it type} can be one of: - -\begin{itemize}\itemsep=0pt -\item {\bf gyCONSTRAINT\_CENTRED\_VERTICALLY}: the Y co-ordinates of the centres of the -bounding boxes of the constrained objects and the constraining object -will be the same -\item {\bf gyCONSTRAINT\_CENTRED\_HORIZONTALLY}: the X co-ordinates of the centres of the -bounding boxes of the constrained objects and the constraining object -will be the same -\item {\bf gyCONSTRAINT\_CENTRED\_BOTH}: the co-ordinates of the centres of the bounding boxes -of the constrained objects and the constraining object will be the same -\item {\bf gyCONSTRAINT\_LEFT\_OF}: the X co-ordinates of the right hand vertical edges -of the bounding boxes of the constrained objects will be less than -the X co-ordinate of the left hand vertical edge of the bounding box -of the constraining object -\item {\bf gyCONSTRAINT\_RIGHT\_OF}: the X co-ordinates of the left hand vertical edges -of the bounding boxes of the constrained objects will be greater than -the X co-ordinate of the right hand vertical edge of the bounding box -of the constraining object -\item {\bf gyCONSTRAINT\_ABOVE}: the Y co-ordinates of the bottom horizontal edges of the -bounding boxes of the constrained objects will be less than the -Y co-ordinate of the top horizontal edge of the bounding box of the -constraining object -\item {\bf gyCONSTRAINT\_BELOW}: the Y co-ordinates of the top horizontal edges of the -bounding boxes of the constrained objects will be greater than -the X co-ordinate of the bottom horizontal edge of the bounding box -of the constraining object -\item {\bf gyCONSTRAINT\_ALIGNED\_TOP}: the Y co-ordinates of the top horizontal edges of the -bounding boxes of the constrained objects will be the same as the -Y co-ordinate of the top horizontal edge of the bounding box of the -constraining object -\item {\bf gyCONSTRAINT\_ALIGNED\_BOTTOM}: the Y co-ordinates of the bottom horizontal edges -of the bounding boxes of the constrained objects will be the same as -the Y co-ordinate of the bottom horizontal edge of the bounding box -of the constraining object -\item {\bf gyCONSTRAINT\_ALIGNED\_LEFT}: the X co-ordinates of the left hand vertical edges -of the bounding boxes of the constrained objects will be the same as -the X co-ordinate of the left hand vertical edge of the bounding box -of the constraining object -\item {\bf gyCONSTRAINT\_ALIGNED\_RIGHT}: the X co-ordinates of the right hand vertical edges -of the bounding boxes of the constrained objects will be the same as -the X co-ordinate of the right hand vertical edge of the bounding box -of the constraining object -\item {\bf gyCONSTRAINT\_MIDALIGNED\_TOP}: the Y co-ordinates of the centres of -the bounding boxes of the constrained objects will be the same -as the Y co-ordinate of the top horizontal edge of -the bounding box of the constraining object -\item {\bf gyCONSTRAINT\_MIDALIGNED\_BOTTOM}: the Y co-ordinates of the centres of -the bounding boxes of the constrained objects will be the same -as the Y co-ordinate of the bottom horizontal edge of -the bounding box of the constraining object -\item {\bf gyCONSTRAINT\_MIDALIGNED\_LEFT}: the X co-ordinates of the centres of -the bounding boxes of the constrained objects will be the same -as the X co-ordinate of the left hand vertical edge of -the bounding box of the constraining object -\item {\bf gyCONSTRAINT\_MIDALIGNED\_RIGHT}: the X co-ordinates of the centres of -the bounding boxes of the constrained objects will be the same as -the X co-ordinate of the right hand vertical edge of -the bounding box of the constraining object -\end{itemize} - - -\membersection{OGLConstraint::\destruct{OGLConstraint}} - -\func{void}{\destruct{OGLConstraint}}{\void} - -Destructor. - -\membersection{OGLConstraint::Equals} - -\func{bool}{Equals}{\param{float}{ x}, \param{float}{ y}} - -Returns TRUE if {\it x} and {\it y} are approximately equal (for the purposes -of evaluating the constraint). - -\membersection{OGLConstraint::Evaluate} - -\func{bool}{Evaluate}{\void} - -Evaluates this constraint, returning TRUE if anything changed. - -\membersection{OGLConstraint::SetSpacing}\label{oglconstraintsetspacing} - -\func{void}{SetSpacing}{\param{float}{ x}, \param{float}{ y}} - -Sets the horizontal and vertical spacing for the constraint. - - -\section{\class{wxBitmapShape}: wxRectangleShape}\label{wxbitmapshape} - -Draws a bitmap (non-resizable). - -See also \helpref{wxRectangleShape}{wxrectangleshape}. - -\membersection{wxBitmapShape::wxBitmapShape} - -\func{void}{wxBitmapShape}{\void} - -Constructor. - -\membersection{wxBitmapShape::\destruct{wxBitmapShape}} - -\func{void}{\destruct{wxBitmapShape}}{\void} - -Destructor. - -\membersection{wxBitmapShape::GetDeleteBitmap} - -\func{bool}{GetDeleteBitmap}{\void} - -Returns TRUE if the bitmap will be deleted when the shape is deleted. - -\membersection{wxBitmapShape::GetBitmap} - -\func{wxBitmap\&}{GetBitmap}{\void} - -Returns a reference to the bitmap associated with this shape. - -\membersection{wxBitmapShape::GetFilename} - -\func{wxString}{GetFilename}{\void} - -Returns the bitmap filename. - -\membersection{wxBitmapShape::SetDeleteBitmap} - -\func{void}{SetDeleteBitmap}{\param{bool}{ deleteBitmap}} - -Determines whether the bitmap will be deleted when the shape is deleted. - -\membersection{wxBitmapShape::SetBitmap} - -\func{void}{SetBitmap}{\param{const wxBitmap\&}{ bitmap}} - -Sets the bitmap associated with this shape. You can delete the bitmap -from the calling application, since reference counting will take care of -holding on to the internal bitmap data. - -\membersection{wxBitmapShape::SetFilename} - -\func{void}{SetFilename}{\param{const wxString\& }{filename}} - -Sets the bitmap filename. - -\section{\class{wxDiagram}: wxObject}\label{wxdiagram} - -Encapsulates an entire diagram, with methods for reading/writing and drawing. - -\membersection{wxDiagram::wxDiagram} - -\func{void}{wxDiagram}{\void} - -Constructor. - -\membersection{wxDiagram::\destruct{wxDiagram}} - -\func{void}{\destruct{wxDiagram}}{\void} - -Destructor. - -\membersection{wxDiagram::AddShape} - -\func{void}{AddShape}{\param{wxShape *}{shape}, \param{wxShape *}{addAfter = NULL}} - -Adds a shape to the diagram. If {\it addAfter} is non-NULL, the shape will be added after this -one. - -\membersection{wxDiagram::Clear} - -\func{void}{Clear}{\void} - -Clears the device context associated with the diagram. - -\membersection{wxDiagram::DeleteAllShapes} - -\func{void}{DeletesAllShapes}{\void} - -Removes and deletes all shapes in the diagram. - -\membersection{wxDiagram::DrawOutline} - -\func{void}{DrawOutline}{\param{float}{ x1}, \param{float}{ y1}, \param{float}{ x2}, \param{float}{ y2}} - -Draws an outline rectangle on the current device context. - -\membersection{wxDiagram::GetCanvas} - -\func{wxCanvas *}{GetCanvas}{\void} - -Returns the canvas associated with this diagram. - -\membersection{wxDiagram::GetGridSpacing} - -\func{float}{GetGridSpacing}{\void} - -Returns the grid spacing. - -\membersection{wxDiagram::GetMouseTolerance} - -\func{int}{GetMouseTolerance}{\void} - -Returns the tolerance within which a mouse move is ignored. - -\membersection{wxDiagram::GetShapeList} - -\func{wxList *}{GetShapeList}{\void} - -Returns a pointer to the internal shape list. - -\membersection{wxDiagram::GetQuickEditMode} - -\func{bool}{GetQuickEditMode}{\void} - -Returns quick edit mode. - -\membersection{wxDiagram::GetSnapToGrid} - -\func{bool}{GetSnapToGrid}{\void} - -Returns snap-to-grid mode. - -\membersection{wxDiagram::InsertShape} - -\func{void}{InsertShape}{\param{wxShape *}{shape}} - -Inserts a shape at the front of the shape list. - -\membersection{wxDiagram::LoadFile} - -\func{bool}{LoadFile}{\param{const wxString\& }{filename}} - -Loads the diagram from a PrologIO file. - -\membersection{wxDiagram::OnDatabaseLoad} - -\func{void}{OnDatabaseLoad}{\param{PrologDatabase\&}{ database}} - -Called just after the nodes and lines have been read from the PrologDatabase. You may override this; -the default member does nothing. - - -\membersection{wxDiagram::OnDatabaseSave} - -\func{void}{OnDatabaseSave}{\param{PrologDatabase\&}{ database}} - -Called just after the nodes and lines have been written to the PrologDatabase. You may override this; -the default member does nothing. - -\membersection{wxDiagram::OnHeaderLoad} - -\func{bool}{OnHeaderLoad}{\param{PrologDatabase\&}{ database}, \param{PrologExpr\&}{ expr}} - -Called to allow the `diagram' header object to be read. The default member reads no further information. -You may wish to override this to read version information, author name, etc. - - -\membersection{wxDiagram::OnHeaderSave} - -\func{bool}{OnHeaderSave}{\param{PrologDatabase\&}{ database}, \param{PrologExpr\&}{ expr}} - -Called to allow instantiation of the `diagram' header object. The default member writes no further information. -You may wish to override this to include version information, author name, etc. - -\membersection{wxDiagram::OnShapeLoad} - -\func{bool}{OnShapeLoad}{\param{PrologDatabase\&}{ database}, \param{wxShape\&}{ shape}, \param{PrologExpr\&}{ expr}} - -Called to read the shape from the {\it expr}. You may override this, but call this function first. -The default member calls ReadPrologAttributes for the shape. - -\membersection{wxDiagram::OnShapeSave} - -\func{bool}{OnShapeSave}{\param{PrologDatabase\&}{ database}, \param{wxShape\&}{ shape}, \param{PrologExpr\&}{ expr}} - -Called to save the shape to the {\it expr} and {\it database}. You may override this, but call this function first. -The default member calls WritePrologAttributes for the shape, appends the shape to the database, and of the shape -is a composite, recursively calls OnShapeSave for its children. - -\membersection{wxDiagram::ReadContainerGeometry} - -\func{void}{ReadContainerGeometry}{\param{PrologDatabase\&}{ database}} - -Reads container geometry from a PrologDatabase, linking up nodes which -are part of a composite. You probably won't need to redefine this. - -\membersection{wxDiagram::ReadLines} - -\func{void}{ReadLines}{\param{PrologDatabase\&}{ database}} - -Reads lines from a PrologDatabase. You probably won't need to redefine this. - -\membersection{wxDiagram::ReadNodes} - -\func{void}{ReadNodes}{\param{PrologDatabase\&}{ database}} - -Reads nodes from a PrologDatabase. You probably won't need to redefine this. - - -\membersection{wxDiagram::RecentreAll} - -\func{void}{RecentreAll}{\void} - -Make sure all text that should be centred, is centred. - -\membersection{wxDiagram::Redraw} - -\func{void}{Redraw}{\void} - -Draws the shapes in the diagram on the currently set device context. - -\membersection{wxDiagram::RemoveAllShapes} - -\func{void}{RemoveAllShapes}{\void} - -Removes all shapes from the diagram but does not delete the shapes. - -\membersection{wxDiagram::RemoveShape} - -\func{void}{RemoveShape}{\param{wxShape *}{shape}} - -Removes the shape from the diagram (non-recursively) but does not delete it. - -\membersection{wxDiagram::SaveFile} - -\func{bool}{SaveFile}{\param{const wxString\& }{filename}} - -Saves the diagram in a PrologIO file. - -\membersection{wxDiagram::SetCanvas} - -\func{void}{SetCanvas}{\param{wxShapeCanvas *}{canvas}} - -Sets the canvas associated with this diagram. - -\membersection{wxDiagram::SetGridSpacing} - -\func{void}{SetGridSpacing}{\param{float}{ spacing}} - -Sets the grid spacing. The default is 5. - -\membersection{wxDiagram::SetMouseTolerance} - -\func{void}{SetMouseTolerance}{\param{int}{ tolerance}} - -Sets the tolerance within which a mouse move is ignored. The default is 3 pixels. - -\membersection{wxDiagram::SetQuickEditMode} - -\func{void}{SetQuickEditMode}{\param{bool}{ mode}} - -Sets quick-edit-mode on or off. In this mode, refreshes are minimized, but the -diagram may need manual refreshing occasionally. - -\membersection{wxDiagram::SetSnapToGrid} - -\func{void}{SetSnapToGrid}{\param{bool}{ snap}} - -Sets snap-to-grid mode on or off. The default is on. - -\membersection{wxDiagram::ShowAll} - -\func{void}{ShowAll}{\param{bool}{ show}} - -Calls Show for each shape in the diagram. - -\membersection{wxDiagram::Snap} - -\func{void}{Snap}{\param{float *}{x}, \param{float *}{y}} - -`Snaps' the coordinate to the nearest grid position, if snap-to-grid is on. - - -\section{\class{wxDrawnShape}: wxRectangleShape}\label{wxdrawnshape} - -Draws a pseduo-metafile shape, which can be loaded from a simple Windows metafile. - -See also \helpref{wxRectangleShape}{wxrectangleshape}. - -\membersection{wxDrawnShape::wxDrawnShape} - -\func{void}{wxDrawnShape}{\void} - -Constructor. - -\membersection{wxDrawnShape::\destruct{wxDrawnShape}} - -\func{void}{\destruct{wxDrawnShape}}{\void} - -Destructor. - -\membersection{wxDrawnShape::GetMetaFile} - -\func{wxPseudoMetaFile\& }{GetMetaFile}{\void} - -Returns a reference to the internal `pseudo-metafile'. - -\membersection{wxDrawnShape::LoadFromMetaFile} - -\func{bool}{LoadFromMetaFile}{\param{const wxString\& }{filename}} - -Loads a (very simple) Windows metafile, created for example by Top Draw, the Windows shareware graphics package. - -\membersection{wxDrawnShape::Rotate} - -\func{void}{Rotate}{\param{float }{x}, \param{float }{y}, \param{float }{theta}} - -Rotate about the given axis by the given amount in radians. - -\membersection{wxDrawnShape::Scale} - -\func{void}{Scale}{\param{float }{sx}, \param{float }{sy}} - -Scales the shape by the given amount. - -\membersection{wxDrawnShape::SetSaveToFile} - -\func{void}{SetSaveToFile}{\param{bool }{save}} - -If {\it save} is TRUE, the image will be saved along with the shape's other attributes. The reason -why this might not be desirable is that if there are many shapes with the same image, it would be -more efficient for the application to save one copy, and not duplicate the information for every -shape. The default is TRUE. - -\membersection{wxDrawnShape::Translate} - -\func{void}{Translate}{\param{float }{x}, \param{float }{y}} - -Translates the shape by the given amount. - -\section{\class{wxCircleShape}: wxEllipseShape}\label{wxcircleshape} - -An wxEllipseShape whose width and height are the same. - -See also \helpref{wxEllipseShape}{wxellipseshape}. - -\membersection{wxCircleShape::wxCircleShape} - -\func{void}{wxCircleShape}{\param{float}{ width = 0.0}} - -Constructor. - -\membersection{wxCircleShape::\destruct{wxCircleShape}} - -\func{void}{\destruct{wxCircleShape}}{\void} - -Destructor. - - -\section{\class{wxCompositeShape}: wxRectangleShape}\label{wxcompositeshape} - -\overview{wxCompositeShape overview}{compositeshapeoverview} - -This is an object with a list of child objects, and a list of size -and positioning constraints between the children. - -See also \helpref{wxRectangleShape}{wxrectangleshape}. - -\membersection{wxCompositeShape::wxCompositeShape} - -\func{void}{wxCompositeShape}{\void} - -Constructor. - -\membersection{wxCompositeShape::\destruct{wxCompositeShape}} - -\func{void}{\destruct{wxCompositeShape}}{\void} - -Destructor. - -\membersection{wxCompositeShape::AddChild}\label{wxcompositeshapeaddchild} - -\func{void}{AddChild}{\param{wxShape *}{child}, \param{wxShape *}{addAfter = NULL}} - -Adds a child shape to the composite. If {\it addAfter} is non-NULL, the shape will be added -after this shape. - -\membersection{wxCompositeShape::AddConstraint}\label{wxcompositeshapeaddconstraint} - -\func{OGLConstraint *}{AddConstraint}{\param{OGLConstraint *}{constraint}} - -\func{OGLConstraint *}{AddConstraint}{\param{int}{ type}, \param{wxShape *}{constraining}, \param{wxList\&}{constrained}} - -\func{OGLConstraint *}{AddConstraint}{\param{int}{ type}, \param{wxShape *}{constraining}, \param{wxShape *}{constrained}} - -Adds a constraint to the composite. - -\membersection{wxCompositeShape::CalculateSize} - -\func{void}{CalculateSize}{\void} - -Calculates the size and position of the composite based on child sizes and positions. - -\membersection{wxCompositeShape::ContainsDivision} - -\func{bool}{FindContainerImage}{\param{wxDivisionShape *}{division}} - -Returns TRUE if {\it division} is a descendant of this container. - -\membersection{wxCompositeShape::DeleteConstraint} - -\func{void}{DeleteConstraint}{\param{OGLConstraint *}{constraint}} - -Deletes constraint from composite. - -\membersection{wxCompositeShape::DeleteConstraintsInvolvingChild} - -\func{void}{DeleteConstraintsInvolvingChild}{\param{wxShape *}{child}} - -This function deletes constraints which mention the given child. Used when -deleting a child from the composite. - -\membersection{wxCompositeShape::FindConstraint} - -\func{OGLConstraint *}{FindConstraint}{\param{long}{ id}, \param{wxCompositeShape **}{actualComposite}} - -Finds the constraint with the given id, also returning the actual composite the constraint was in, -in case that composite was a descendant of this composite. - -\membersection{wxCompositeShape::FindContainerImage} - -\func{wxShape *}{FindContainerImage}{\void} - -Finds the image used to visualize a container. This is any child -of the composite that is not in the divisions list. - -\membersection{wxCompositeShape::GetConstraints} - -\func{wxList\&}{GetConstraints}{\void} - -Returns a reference to the list of constraints. - -\membersection{wxCompositeShape::GetDivisions} - -\func{wxList\&}{GetDivisions}{\void} - -Returns a reference to the list of divisions. - -\membersection{wxCompositeShape::MakeContainer}\label{wxcompositeshapemakecontainer} - -\func{void}{MakeContainer}{\void} - -Makes this composite into a container by creating one child wxDivisionShape. - -\membersection{wxCompositeShape::OnCreateDivision} - -\func{wxDivisionShape *}{OnCreateDivision}{\void} - -Called when a new division shape is required. Can be overriden to allow an application -to use a different class of division. - -\membersection{wxCompositeShape::Recompute}\label{wxcompositeshaperecompute} - -\func{bool}{Recompute}{\void} - -Recomputes any constraints associated with the object. If FALSE is returned, -the constraints could not be satisfied (there was an inconsistency). - -\membersection{wxCompositeShape::RemoveChild} - -\func{void}{RemoveChild}{\param{wxShape *}{child}} - -Removes the child from the composite and any constraint relationships, but does not -delete the child. - -\section{\class{wxDividedShape}: wxRectangleShape}\label{wxdividedshape} - -\overview{wxDividedShape overview}{dividedshapeoverview} - -A wxDividedShape is a rectangle with a number of vertical divisions. Each -division may have its text formatted with independent characteristics, and -the size of each division relative to the whole image may be specified. - -See also \helpref{wxRectangleShape}{wxrectangleshape}. - -\membersection{wxDividedShape::wxDividedShape} - -\func{void}{wxDividedShape}{\param{float}{ width = 0.0}, \param{float}{ height = 0.0}} - -Constructor. - -\membersection{wxDividedShape::\destruct{wxDividedShape}} - -\func{void}{\destruct{wxDividedShape}}{\void} - -Destructor. - -\membersection{wxDividedShape::EditRegions} - -\func{void}{EditRegions}{\void} - -Edit the region colours and styles. - -\membersection{wxDividedShape::SetRegionSizes} - -\func{void}{SetRegionSizes}{\void} - -Set all region sizes according to proportions and -this object total size. - - - - -\section{\class{wxDivisionShape}: wxCompositeShape}\label{wxdivisionshape} - -\overview{wxCompositeShape overview}{compositeshapeoverview} - -A division shape is like a composite in that it can contain further objects, but is used exclusively to -divide another shape into regions, or divisions. A wxDivisionShape is never free-standing. - -See also \helpref{wxCompositeShape}{wxcompositeshape}. - -\membersection{wxDivisionShape::wxDivisionShape} - -\func{void}{wxDivisionShape}{\void} - -Constructor. - -\membersection{wxDivisionShape::\destruct{wxDivisionShape}} - -\func{void}{\destruct{wxDivisionShape}}{\void} - -Destructor. - -\membersection{wxDivisionShape::AdjustBottom} - -\func{void}{AdjustBottom}{\param{float}{ bottom}, \param{bool}{ test}} - -Adjust a side, returning FALSE if it's not physically possible to adjust it to this point. - -\membersection{wxDivisionShape::AdjustLeft} - -\func{void}{AdjustLeft}{\param{float}{ left}, \param{bool}{ test}} - -Adjust a side, returning FALSE if it's not physically possible to adjust it to this point. - -\membersection{wxDivisionShape::AdjustRight} - -\func{void}{AdjustRight}{\param{float}{ right}, \param{bool}{ test}} - -Adjust a side, returning FALSE if it's not physically possible to adjust it to this point. - -\membersection{wxDivisionShape::AdjustTop} - -\func{void}{AdjustTop}{\param{float}{ top}, \param{bool}{ test}} - -Adjust a side, returning FALSE if it's not physically possible to adjust it to this point. - -\membersection{wxDivisionShape::Divide}\label{wxdivisionshapedivide} - -\func{void}{Divide}{\param{int}{ direction}} - -Divide this division into two further divisions, horizontally ({\it direction} is wxHORIZONTAL) or -vertically ({\it direction} is wxVERTICAL). - -\membersection{wxDivisionShape::EditEdge} - -\func{void}{EditEdge}{\param{int}{ side}} - -Interactively edit style of left or top side. - -\membersection{wxDivisionShape::GetBottomSide} - -\func{wxDivisionShape *}{GetBottomSide}{\void} - -Returns a pointer to the division on the bottom side of this division. - -\membersection{wxDivisionShape::GetHandleSide} - -\func{int}{GetHandleSide}{\void} - -Returns the side which the handle appears on (DIVISION\_SIDE\_LEFT or DIVISION\_SIDE\_TOP). - -\membersection{wxDivisionShape::GetLeftSide} - -\func{wxDivisionShape *}{GetLeftSide}{\void} - -Returns a pointer to the division on the left side of this division. - -\membersection{wxDivisionShape::GetLeftSideColour} - -\func{wxString}{GetLeftSideColour}{\void} - -Returns a pointer to the colour used for drawing the left side of the division. - -\membersection{wxDivisionShape::GetLeftSidePen} - -\func{wxPen *}{GetLeftSidePen}{\void} - -Returns a pointer to the pen used for drawing the left side of the division. - -\membersection{wxDivisionShape::GetRightSide} - -\func{wxDivisionShape *}{GetRightSide}{\void} - -Returns a pointer to the division on the right side of this division. - -\membersection{wxDivisionShape::GetTopSide} - -\func{wxDivisionShape *}{GetTopSide}{\void} - -Returns a pointer to the division on the top side of this division. - -\membersection{wxDivisionShape::GetTopSideColour} - -\func{wxString}{GetTopSideColour}{\void} - -Returns a pointer to the colour used for drawing the top side of the division. - -\membersection{wxDivisionShape::GetTopSidePen} - -\func{wxPen *}{GetTopSidePen}{\void} - -Returns a pointer to the pen used for drawing the left side of the division. - - -\membersection{wxDivisionShape::ResizeAdjoining} - -\func{void}{ResizeAdjoining}{\param{int}{ side}, \param{float}{ newPos}, \param{bool}{ test}} - -Resize adjoining divisions at the given side. If {\it test} is TRUE, -just see whether it's possible for each adjoining region, -returning FALSE if it's not. - -{\it side} can be one of: - -\begin{itemize}\itemsep=0pt -\item DIVISION\_SIDE\_NONE -\item DIVISION\_SIDE\_LEFT -\item DIVISION\_SIDE\_TOP -\item DIVISION\_SIDE\_RIGHT -\item DIVISION\_SIDE\_BOTTOM -\end{itemize} - -\membersection{wxDivisionShape::PopupMenu} - -\func{void}{PopupMenu}{\param{float}{ x}, \param{float}{ y}} - -Popup the division menu. - -\membersection{wxDivisionShape::SetBottomSide} - -\func{void}{SetBottomSide}{\param{wxDivisionShape *}{shape}} - -Set the pointer to the division on the bottom side of this division. - -\membersection{wxDivisionShape::SetHandleSide} - -\func{int}{SetHandleSide}{\void} - -Sets the side which the handle appears on (DIVISION\_SIDE\_LEFT or DIVISION\_SIDE\_TOP). - -\membersection{wxDivisionShape::SetLeftSide} - -\func{void}{SetLeftSide}{\param{wxDivisionShape *}{shape}} - -Set the pointer to the division on the left side of this division. - -\membersection{wxDivisionShape::SetLeftSideColour} - -\func{void}{SetLeftSideColour}{\param{const wxString\& }{colour}} - -Sets the colour for drawing the left side of the division. - -\membersection{wxDivisionShape::SetLeftSidePen} - -\func{void}{SetLeftSidePen}{\param{wxPen *}{pen}} - -Sets the pen for drawing the left side of the division. - -\membersection{wxDivisionShape::SetRightSide} - -\func{void}{SetRightSide}{\param{wxDivisionShape *}{shape}} - -Set the pointer to the division on the right side of this division. - -\membersection{wxDivisionShape::SetTopSide} - -\func{void}{SetTopSide}{\param{wxDivisionShape *}{shape}} - -Set the pointer to the division on the top side of this division. - -\membersection{wxDivisionShape::SetTopSideColour} - -\func{void}{SetTopSideColour}{\param{const wxString\& }{colour}} - -Sets the colour for drawing the top side of the division. - -\membersection{wxDivisionShape::SetTopSidePen} - -\func{void}{SetTopSidePen}{\param{wxPen *}{pen}} - -Sets the pen for drawing the top side of the division. - - - -\section{\class{wxEllipseShape}: wxShape}\label{wxellipseshape} - -The wxEllipseShape behaves similarly to the wxRectangleShape but is -elliptical. - -See also \helpref{wxShape}{wxshape}. - -\membersection{wxEllipseShape::wxEllipseShape} - -\func{void}{wxEllipseShape}{\param{float}{ width = 0.0}, \param{float}{ height = 0.0}} - -Constructor. - -\membersection{wxEllipseShape::\destruct{wxEllipseShape}} - -\func{void}{\destruct{wxEllipseShape}}{\void} - -Destructor. - -\section{\class{wxLineShape}: wxShape}\label{wxlineshape} - -A wxLineShape may be attached to two nodes; it may be segmented, in which -case a control point is drawn for each joint. - -See also \helpref{wxShape}{wxshape}. - -\membersection{wxLineShape::wxLineShape} - -\func{void}{wxLineShape}{\void} - -\func{void}{wxLineShape}{\param{wxList *}{list}} - -Constructors. In the second (usual) form, supply a list of wxPoints, each to be used -as a `control point' for the line. The minimum number of points is two. - -\membersection{wxLineShape::\destruct{wxLineShape}} - -\func{void}{\destruct{wxLineShape}}{\void} - -Destructor. - -\membersection{wxLineShape::AddArrow} - -\func{void}{AddArrow}{\param{WXTYPE}{ type}, \param{bool}{ end = ARROW\_POSITION\_END}, \param{float}{ arrowSize = 10.0}, - \param{float}{ xOffset = 0.0}, \param{const wxString\& }{name = NULL}, \param{wxPseudoMetaFile *}{mf = NULL}, \param{long}{ arrowId = -1}} - -Adds an arrow (or annotation) to the line. - -{\it type} may currently be one of: - -\begin{description}\itemsep=0pt -\item[ARROW\_HOLLOW\_CIRCLE] Hollow circle. -\item[ARROW\_FILLED\_CIRCLE] Filled circle. -\item[ARROW\_ARROW] Conventional arrowhead. -\item[ARROW\_SINGLE\_OBLIQUE] Single oblique stroke. -\item[ARROW\_DOUBLE\_OBLIQUE] Double oblique stroke. -\item[ARROW\_DOUBLE\_METAFILE] Custom arrowhead. -\end{description} - -{\it end} may currently be one of: - -\begin{description}\itemsep=0pt -\item[ARROW\_POSITION\_END] Arrow appears at the end. -\item[ARROW\_POSITION\_START] Arrow appears at the start. -\end{description} - -{\it arrowSize} specifies the length of the arrow. - -{\it xOffset} specifies the offset from the end of the line. - -{\it name} specifies a name for the arrow. - -{\it mf} can be a wxPseduoMetaFile, perhaps loaded from a simple Windows metafile. - -{\it arrowId} is the id for the arrow. - -\membersection{wxLineShape::AddArrowOrdered} - -\func{void}{AddArrowOrdered}{\param{wxArrowHead *}{arrow}, \param{wxList\&}{ referenceList}, \param{int}{ end}} - -Add an arrowhead in the position indicated by the reference -list of arrowheads, which contains all legal arrowheads for this -line, in the correct order. -E.g. - -\begin{verbatim} - Reference list: a b c d e - Current line list: a d -\end{verbatim} - -Add c, then line list is: a c d. - -If no legal arrowhead position, return FALSE. Assume reference list is -for one end only, since it potentially defines the ordering for any one -of the 3 positions. So we don't check the reference list for arrowhead -position. - -\membersection{wxLineShape::ClearArrow} - -\func{bool}{ClearArrow}{\param{const wxString\& }{name}} - -Delete the arrow with the given name. - -\membersection{wxLineShape::ClearArrowsAtPosition} - -\func{void}{ClearArrowsAtPosition}{\param{int}{ position = -1}} - -Delete the arrows at the specified position, or at any position if {\it position} is -1. - -\membersection{wxLineShape::DrawArrow} - -\func{void}{DrawArrow}{\param{ArrowHead *}{arrow}, \param{float}{ xOffset}, \param{bool}{ proportionalOffset}} - -Draws the given arrowhead (or annotation). - -\membersection{wxLineShape::DeleteArrowHead} - -\func{bool}{DeleteArrowHead}{\param{long}{ arrowId}} - -\func{bool}{DeleteArrowHead}{\param{int}{ position}, \param{const wxString\& }{name}} - -Delete arrowhead by id or position and name. - -\membersection{wxLineShape::DeleteLineControlPoint} - -\func{bool}{DeleteLineControlPoint}{\void} - -Deletes an arbitary point on the line. - -\membersection{wxLineShape::DrawArrows} - -\func{void}{DrawArrows}{\void} - -Draws all arrows. - -\membersection{wxLineShape::DrawRegion} - -\func{void}{DrawRegion}{\param{wxShapeRegion *}{region}, \param{float}{ x}, \param{float}{ y}} - -Format one region at this position. - -\membersection{wxLineShape::EraseRegion} - -\func{void}{EraseRegion}{\param{wxShapeRegion *}{region}, \param{float}{ x}, \param{float}{ y}} - -Format one region at this position. - -\membersection{wxLineShape::FindArrowHead} - -\func{wxArrowHead *}{FindArrowHead}{\param{long}{ arrowId}} - -\func{wxArrowHead *}{FindArrowHead}{\param{int}{ position}, \param{const wxString\& }{name}} - -Find arrowhead by id or position and name. - -\membersection{wxLineShape::FindLineEndPoints} - -\func{void}{FindLineEndPoints}{\param{float *}{fromX}, \param{float *}{fromY}, \param{float *}{toX}, \param{float *}{toY}} - -Finds the x, y points at the two ends of the line. This function can be -used by e.g. line-routing routines to get the actual points on the two -node images where the lines will be drawn to/from. - -\membersection{wxLineShape::FindLinePosition} - -\func{int}{FindLinePosition}{\param{float }{x}, \param{float }{y}} - -Find which position we're talking about at this x, y. -Returns ARROW\_POSITION\_START, ARROW\_POSITION\_MIDDLE, ARROW\_POSITION\_END. - -\membersection{wxLineShape::FindMinimumWidth} - -\func{float}{FindMinimumWidth}{\void} - -Finds the horizontal width for drawing a line with arrows in minimum -space. Assume arrows at end only. - -\membersection{wxLineShape::FindNth} - -\func{void}{FindNth}{\param{wxShape *}{image}, \param{int *}{nth}, \param{int *}{noArcs}, \param{bool}{ incoming}} - -Finds the position of the line on the given object. Specify whether incoming or outgoing lines are -being considered with {\it incoming}. - -\membersection{wxLineShape::GetAttachmentFrom} - -\func{int}{GetAttachmentFrom}{\void} - -Returns the attachment point on the `from' node. - -\membersection{wxLineShape::GetAttachmentTo} - -\func{int}{GetAttachmentTo}{\void} - -Returns the attachment point on the `to' node. - -\membersection{wxLineShape::GetEnds} - -\func{void}{GetEnds}{\param{float *}{x1}, \param{float *}{y1}, \param{float *}{x2}, \param{float *}{y2}} - -Gets the visible endpoints of the lines for drawing between two objects. - -\membersection{wxLineShape::GetFormatMode} - -\func{int}{GetFormatMode}{\param{int}{ regionId = 0}} - -Returns the format mode for this region. See als \helpref{SetFormatMode}{setformatmode}. - -\membersection{wxLineShape::GetFrom} - -\func{wxShape *}{GetFrom}{\void} - -Gets the `from' object. - -\membersection{wxLineShape::GetLabelPosition} - -\func{void}{GetLabelPosition}{\param{int}{ position}, \param{float *}{x}, \param{float *}{y}} - -Get the reference point for a label. Region x and y are offsets from this. -position is 0 (middle), 1 (start), 2 (end). - -\membersection{wxLineShape::GetNextControlPoint} - -\func{wxPoint *}{GetNextControlPoint}{\param{wxShape *}{shape}} - -Find the next control point in the line after the start/end point, -depending on whether the shape is at the start or end. - -\membersection{wxLineShape::GetTo} - -\func{wxShape *}{GetTo}{\void} - -Gets the `to' object. - -\membersection{wxLineShape::Initialise} - -\func{void}{Initialise}{\void} - -Initialises the line object. - -\membersection{wxLineShape::InsertLineControlPoint} - -\func{void}{InsertLineControlPoint}{\void} - -Inserts a control point at an arbitrary position. - -\membersection{wxLineShape::IsEnd} - -\func{bool}{IsEnd}{\param{wxShape *}{shape}} - -Returns TRUE if {\it shape} is at the end of the line. - -\membersection{wxLineShape::IsSpline} - -\func{bool}{IsSpline}{\void} - -Returns TRUE if a spline is drawn through the control points, and FALSE otherwise. - -\membersection{wxLineShape::MakeLineControlPoints} - -\func{void}{MakeLineControlPoints}{\param{int}{ n}} - -Make a given number of control points. - -\membersection{wxLineShape::OnMoveLink} - -\func{void}{OnMoveLink}{\void} - -Called when a connected object has moved, to move the link to -correct position. - -\membersection{wxLineShape::SetAttachments} - -\func{void}{SetAttachments}{\param{int}{ fromAttach}, \param{int}{ toAttach}} - -Specifies which object attachment points should be used at each end of the line. - -\membersection{wxLineShape::SetEnds} - -\func{void}{SetEnds}{\param{float}{ x1}, \param{float}{ y1}, \param{float}{ x2}, \param{float}{ y2}} - -Sets the end positions of the line. - -\membersection{wxLineShape::SetFrom} - -\func{void}{SetFrom}{\param{wxShape *}{object}} - -Sets the `from' object for the line. - -\membersection{wxLineShape::SetIgnoreOffsets} - -\func{void}{SetIgnoreOffsets}{\param{bool}{ ignore}} - -Tells the shape whether to ignore offsets from the end of the line when drawing. - -\membersection{wxLineShape::SetSpline} - -\func{void}{SetSpline}{\param{bool}{ spline}} - -Specifies whether a spline is to be drawn through the control points (TRUE), or a line (FALSE). - -\membersection{wxLineShape::SetTo} - -\func{void}{SetTo}{\param{wxShape *}{object}} - -Sets the `to' object for the line. - -\membersection{wxLineShape::Straighten} - -\func{void}{Straighten}{\void} - -Straighten verticals and horizontals. - -\membersection{wxLineShape::Unlink} - -\func{void}{Unlink}{\void} - -Unlinks the line from the nodes at either end. - - -\section{\class{wxPolygonShape}: wxShape}\label{wxpolygonshape} - -A wxPolygonShape's shape is defined by a number of points passed to the object's -constructor. It can be used to create new shapes such as diamonds and triangles. - -See also \helpref{wxShape}{wxshape}. - -\membersection{wxPolygonShape::wxPolygonShape} - -\func{void}{wxPolygonShape}{void} - -Constructor. Call Create to specify the polygon's vertices. - -\membersection{wxPolygonShape::\destruct{wxPolygonShape}} - -\func{void}{\destruct{wxPolygonShape}}{\void} - -Destructor. - -\membersection{wxPolygonShape::Create} - -\func{void}{Create}{\param{wxList *}{points}} - -Takes a list of wxPoints; each point is an {\it offset} from the centre. -The polygon's destructor will delete these points, so do not delete them yourself. - -\membersection{wxPolygonShape::AddPolygonPoint} - -\func{void}{AddPolygonPoint}{\param{int}{ pos = 0}} - -Add a control point after the given point. - -\membersection{wxPolygonShape::CalculatePolygonCentre} - -\func{void}{CalculatePolygonCentre}{\void} - -Recalculates the centre of the polygon. - -\membersection{wxPolygonShape::DeletePolygonPoint} - -\func{void}{DeletePolygonPoint}{\param{int}{ pos = 0}} - -Deletes a control point. - -\membersection{wxPolygonShape::GetPoints} - -\func{wxList *}{GetPoints}{\void} - -Returns a pointer to the internal list of polygon vertices. - -\membersection{wxPolygonShape::UpdateOriginalPoints} - -\func{void}{UpdateOriginalPoints}{\void} - -If we've changed the shape, must make the original -points match the working points with this function. - -\section{\class{wxRectangleShape}: wxShape}\label{wxrectangleshape} - -The wxRectangleShape has rounded or square corners. - -See also \helpref{wxShape}{wxshape}. - -\membersection{wxRectangleShape::wxRectangleShape} - -\func{void}{wxRectangleShape}{\param{float}{ width = 0.0}, \param{float}{ height = 0.0}} - -Constructor. - -\membersection{wxRectangleShape::\destruct{wxRectangleShape}} - -\func{void}{\destruct{wxRectangleShape}}{\void} - -Destructor. - -\membersection{wxRectangleShape::SetCornerRadius} - -\func{void}{SetCornerRadius}{\param{float}{ radius}} - -Sets the radius of the rectangle's rounded corners. If the radius is zero, a non-rounded -rectangle will be drawn. If the radius is negative, the value is the proportion of the -smaller dimension of the rectangle. - -\section{\class{wxPseudoMetaFile}: wxObject}\label{wxpseudometafile} - -A simple metafile-like class which can load data from a Windows metafile on all platforms. - - -\section{\class{wxShape}: wxShapeEvtHandler}\label{wxshape} - -The wxShape is the top-level, abstract object that all other -objects are derived from. All common functionality is represented by -wxShape's members, and overriden members that appear in derived -classes and have behaviour as documented for wxShape, are not -documented separately. - -See also \helpref{wxShapeEvtHandler}{wxshapeevthandler}. - -\membersection{wxShape::wxShape} - -\func{void}{wxShape}{\param{wxShapeCanvas *}{canvas = NULL}} - -Constructs a new wxShape. - -\membersection{wxShape::\destruct{wxShape}} - -\func{void}{\destruct{wxShape}}{\void} - -Destructor. - -\membersection{wxShape::AddLine} - -\func{void}{AddLine}{\param{wxLineShape *}{line}, \param{wxShape *}{other}, \param{int}{attachFrom = 0}, \param{int}{ attachTo = 0}} - -Adds a line between the specified canvas objects, at the specified attachment points. - -\membersection{wxShape::AddRegion} - -\func{void}{AddRegion}{\param{wxShapeRegion *}{region}} - -Adds a region to the shape. - -\membersection{wxShape::AddText} - -\func{void}{AddText}{\param{const wxString\& }{string}} - -Adds a line of text to the object's default text region. - -\membersection{wxShape::AddToCanvas} - -\func{void}{AddToCanvas}{\param{wxShapeCanvas *}{theCanvas}, \param{wxShape *}{addAfter=NULL}} - -Adds the object to the canvas's object list. If {\it addAfter} is -non-NULL, will add the shape after this one. - -\membersection{wxShape::AncestorSelected} - -\func{bool}{AncestorSelected}{\void} - -TRUE if the object's ancestor is currently selected. - -\membersection{wxShape::AssignNewIds} - -\func{void}{AssignNewIds}{\void} - -Assigns new ids to this image and its children. - -\membersection{wxShape::Attach} - -\func{void}{Attach}{\param{wxShapeCanvas *}{can}} - -Sets the object's internal canvas pointer to point to the given canvas. - -\membersection{wxShape::CalculateSize} - -\func{void}{CalculateSize}{\void} - -Called to calculate the object's size if dependent on children sizes. - -\membersection{wxShape::ClearAttachments} - -\func{void}{ClearAttachments}{\void} - -Clears internal custom attachment point objects (of class wxAttachmentPoint). - -\membersection{wxShape::ClearRegions} - -\func{void}{ClearRegions}{\void} - -Clears the wxShapeRegions from the shape. - -\membersection{wxShape::ClearText} - -\func{void}{ClearText}{\param{int}{ regionId = 0}} - -Clears the text from the specified text region. - -\membersection{wxShape::Constrain} - -\func{bool}{Constrain}{\void} - -Calculates the object's constraints (if any). Applicable -only to wxCompositeShape, does nothing if the object is of -a different class. - -\membersection{wxShape::Copy} - -\func{void}{Copy}{\param{wxShape\&}{ copy}} - -Copy the object into the given object. Every derived class must have one of these. - -\membersection{wxShape::CreateNewCopy} - -\func{wxShape *}{CreateNewCopy}{\param{wxShapeCanvas *}{theCanvas = NULL}} - -Creates and returns a new copy of this object (calling PrivateCopy). Do not override this function. - -This function should always be used to create a new copy, since it must do special processing -for copying constraints associated with constraints. - -\membersection{wxShape::DeleteControlPoints} - -\func{void}{DeleteControlPoints}{\void} - -Deletes the control points (or handles) for the object. Does not redraw -the object. - -\membersection{wxShape::Detach} - -\func{void}{Detach}{\void} - -Disassociates the object from its canvas by setting the internal object -canvas pointer to NULL. - -\membersection{wxShape::Draggable} - -\func{bool}{Draggable}{\void} - -TRUE if the object may be dragged by the user. - -\membersection{wxShape::Draw} - -\func{void}{Draw}{\void} - -Draws the whole object and any lines attached to it. - -Do not override this function: override OnDraw, which is called -by this function. - -\membersection{wxShape::DrawContents} - -\func{void}{DrawContents}{\void} - -Draws the internal graphic of the object (such as -text). - -Do not override this function: override OnDrawContents, which is called -by this function. - -\membersection{wxShape::DrawLines} - -\func{void}{DrawLinks}{\param{int}{ attachment = -1}} - -Draws any lines linked to this object. - -\membersection{wxShape::Erase} - -\func{void}{Erase}{\void} - -Erases the object, but does not repair damage caused to other -objects. - -\membersection{wxShape::EraseContents} - -\func{void}{EraseContents}{\void} - -Erases the object contents, that is, the area within the object's -minimum bounding box. - -\membersection{wxShape::EraseLinks} - -\func{void}{EraseLinks}{\param{int}{ attachment = -1}} - -Erases links attached to this object, but does not repair -damage caused to other objects. - -\membersection{wxShape::FindRegion} - -\func{wxShape *}{FindRegion}{\param{const wxString\& }{regionName}, \param{int *}{regionId}} - -Finds the actual image (`this' if non-composite) and region id for the given -region name. - -\membersection{wxShape::FindRegionNames} - -\func{void}{FindRegionNames}{\param{wxStringList\&}{ list}} - -Finds all region names for this image (composite or simple). -Supply an empty string list. - -\membersection{wxShape::Flash} - -\func{void}{Flash}{\void} - -Flashes the object. - -\membersection{wxShape::FormatText} - -\func{void}{FormatText}{\param{const wxString\& }{s}, \param{int}{ i = 0}} - -Reformats the given text region; defaults to formatting the default region. - -\membersection{wxShape::GetAttachmentMode} - -\func{void}{GetAttachmentMode}{\void} - -Returns the attachment mode. See \helpref{SetAttachmentMode}{setattachmentmode}. - -\membersection{wxShape::GetAttachmentPosition} - -\func{void}{GetAttachmentPosition}{\param{int}{ attachment}, \param{float *}{x}, \param{float *}{y}, \param{int}{ nth = 0}, \param{int}{ noArcs = 1}} - -Gets the position at which the given attachment point should be drawn. - -\membersection{wxShape::GetBoundingBoxMax} - -\func{void}{GetBoundingBoxMax}{\param{float *}{width}, \param{float *}{height}} - -Gets the maximum bounding box for the object, taking into -account external features such as shadows. - -\membersection{wxShape::GetBoundingBoxMin} - -\func{void}{GetBoundingBoxMin}{\param{float *}{width}, \param{float *}{height}} - -Gets the minimum bounding box for the object, that defines -the area available for drawing the contents (such as text). - -\membersection{wxShape::GetBrush} - -\func{wxBrush *}{GetBrush}{\void} - -Returns the brush used for filling the shape. - -\membersection{wxShape::GetCanvas} - -\func{wxShapeCanvas *}{GetCanvas}{\void} - -Gets the internal canvas pointer. - -\membersection{wxShape::GetCentreResize} - -\func{bool}{GetCentreResize}{\void} - -Returns TRUE if the shape is to be resized from the centre (the centre -stands still), or FALSE if from the corner or side being dragged (the -other corner or side stands still). - -\membersection{wxShape::GetChildren} - -\func{wxList\&}{GetChildren}{\void} - -Returns a reference to the list of children for this shape. - -\membersection{wxShape::GetClientData} - -\func{wxObject *}{GetClientData}{\void} - -Gets the client data associated with the object (NULL if there is -none). - -\membersection{wxShape::GetDisableLabel} - -\func{bool}{GetDisableLabel}{\void} - -Returns TRUE if the default region will not be shown, FALSE otherwise. - -\membersection{wxShape::GetEventHandler} - -\func{wxShapeEvtHandler *}{GetEventHandler}{\void} - -Returns the event handler for this shape. - -\membersection{wxShape::GetFixedHeight} - -\func{bool}{GetFixedHeight}{\void} - -Returns TRUE if the shape cannot be resized in the vertical plane. - -\membersection{wxShape::GetFixedSize} - -\func{void}{GetFixedSize}{\param{bool *}{ x}, \param{bool *}{ y}} - -Returns flags indicating whether the shape is of fixed size in either direction. - -\membersection{wxShape::GetFixedWidth} - -\func{bool}{GetFixedWidth}{\void} - -Returns TRUE if the shape cannot be resized in the horizontal plane. - -\membersection{wxShape::GetFont} - -\func{int}{GetFont}{\param{int}{ regionId = 0}} - -Gets the font for the specified text region. - -\membersection{wxShape::GetFunctor} - -\func{char*}{GetFunctor}{\void} - -Gets a string representing the type of the object, to be used when -writing out object descriptions to a file. This is overridden by -each derived object class to provide an appropriate type string. - -\membersection{wxShape::GetId} - -\func{long}{GetId}{\void} - -Returns the integer identifier for this shape. - -\membersection{wxShape::GetLines} - -\func{wxList\&}{GetLines}{\void} - -Returns a reference to the list of lines connected to this shape. - -\membersection{wxShape::GetNumberOfAttachments} - -\func{int}{GetNumberOfAttachments}{\void} - -Gets the number of attachment points for this object. - -\membersection{wxShape::GetNumberOfTextRegions} - -\func{int}{GetNumberOfTextRegions}{\void} - -Gets the number of text regions for this object. - -\membersection{wxShape::GetParent} - -\func{wxShape *}{GetParent}{\void} - -Returns the parent of this shape, if it is part of a composite. - -\membersection{wxShape::GetPen} - -\func{wxPen *}{GetPen}{\void} - -Returns the pen used for drawing the shape's outline. - -\membersection{wxShape::GetPerimeterPoint} - -\func{bool}{GetPerimeterPoint}{\param{float}{ x1}, \param{float}{ y1}, \param{float}{ x2}, \param{float}{ y2}, \param{float *}{x3}, \param{float *}{y3}} - -Gets the point at which the line from (x1, y1) to (x2, y2) hits the object. Returns TRUE if the -line hits the perimeter. - -\membersection{wxShape::GetRegionId}\label{getregionid} - -\func{int}{GetRegionId}{\param{const wxString\& }{name}} - -Gets the region's identifier by name. This is {\it not} unique for within an entire composite, but -is unique for the image. - -\membersection{wxShape::GetRegionName}\label{getregionname} - -\func{wxString}{GetRegionName}{\param{int}{ regionId = 0}} - -Gets the region's name. A region's name can be used to uniquely determine a region within -an entire composite image hierarchy. See also \helpref{SetRegionName}{setregionname}. - -\membersection{wxShape::GetRegions}\label{getregions} - -\func{wxList\&}{GetRegions}{\void} - -Returns the list of wxShapeRegions. - -\membersection{wxShape::GetRotation} - -\func{float}{GetRotatation}{\void} - -Returns the angle of rotation in radians. - -\membersection{wxShape::GetSensitivityFilter} - -\func{void}{GetSensitivityFilter}{\void} - -Returns the sensitivity filter, a bitlist of values. See \helpref{SetSensitivityFilter}{setsensitivityfilter}. - -\membersection{wxShape::GetShadowMode} - -\func{int}{SetShadowMode}{\void} - -Returns the shadow mode. See \helpref{SetShadowMode}{setshadowmode}. - -\membersection{wxShape::GetSpaceAttachments} - -\func{bool}{GetSpaceAttachments}{\void} - -Indicates whether lines should be spaced out evenly at the point they touch the node (TRUE), or whether they -should join at a single point (FALSE). - -\membersection{wxShape::GetTextColour} - -\func{wxString}{GetTextColour}{\param{int}{ regionId = 0}} - -Gets the colour for the specified text region. - -\membersection{wxShape::GetTopAncestor} - -\func{wxShape *}{GetTopAncestor}{\void} - -Returns the top-most ancestor of this shape (the root of the composite). - -\membersection{wxShape::GetX} - -\func{float}{GetX}{\void} - -Gets the x position of the centre of the object. - -\membersection{wxShape::GetY} - -\func{float}{GetY}{\void} - -Gets the y position of the centre of the object. - -\membersection{wxShape::HitTest} - -\func{bool}{HitTest}{\param{float}{ x}, \param{float}{ y}, \param{int *}{attachment}, \param{float *}{distance}} - -Given a point on a canvas, returns TRUE if the point was on the object, and returns -the nearest attachment point and distance from the given point and target. - -\membersection{wxShape::Insert} - -\func{void}{InsertInCanvas}{\param{wxShapeCanvas *}{canvas}} - -Inserts the shape at the front of the object list of {\it canvas}. - -\membersection{wxShape::IsHighlighted} - -\func{bool}{IsHighlighted}{\void} - -Returns TRUE if the shape is highlighted. Shape highlighting is unimplemented. - -\membersection{wxShape::IsShown} - -\func{bool}{IsShown}{\void} - -Returns TRUE if the shape is in a visible state, FALSE otherwise. Note -that this has nothing to do with whether the window is hidden or the -shape has scrolled off the canvas; it refers to the internal -visibility flag. - -\membersection{wxShape::MakeControlPoints} - -\func{void}{MakeControlPoints}{\void} - -Make a list of control points (draggable handles) appropriate to the object. - -\membersection{wxShape::MakeMandatoryControlPoints} - -\func{void}{MakeMandatoryControlPoints}{\void} - -Make the mandatory control points. For example, the control point on a dividing line should -appear even if the divided rectangle shape's handles should not appear (because it is the child of -a composite, and children are not resizable). - -\membersection{wxShape::Move} - -\func{void}{Move}{\param{float}{ x1}, \param{float}{ y1}, \param{bool}{ display = TRUE}} - -Move the object to the given position, redrawing if {\it display} is TRUE. - -\membersection{wxShape::MoveLineToNewAttachment} - -\func{void}{MoveLineToNewAttachment}{\param{wxLineShape *}{toMove}, \param{float}{ x}, \param{float}{ y}} - -Move the given line (which must already be attached to the object) to -a different attachment point on the object. - -\membersection{wxShape::MoveLinks} - -\func{void}{MoveLinks}{\void} - -Redraw all the lines attached to the object. - -\membersection{wxShape::NameRegions} - -\func{void}{NameRegions}{\param{const wxString\& }{parentName = ``"}} - -Make unique names for all the regions in a shape or composite shape. - -\membersection{wxShape::NewCopy} - -\func{wxShape *}{NewCopy}{\void} - -Returns a new instance, and does the copy for this class. Should be -defined for each object class. - -\membersection{wxShape::PrivateCopy} - -\func{wxShape *}{PrivateCopy}{\void} - -Returns a new instance, and does the copy for this class. This member -should be define for each class. - -\membersection{wxShape::Rotate} - -\func{void}{Rotate}{\param{float }{x}, \param{float }{y}, \param{float }{theta}} - -Rotate about the given axis by the given amount in radians (does nothing -for most objects). But even non-rotating objects should record their -notional rotation in case it's important (e.g. in dog-leg code). - -\membersection{wxShape::ReadConstraints} - -\func{void}{ReadConstraints}{\param{PrologExpr *}{clause}, \param{PrologDatabase *}{database}} - -If the object is a composite, it may have constraints that need to be read in in a separate pass. - -\membersection{wxShape::ReadPrologAttributes} - -\func{void}{ReadPrologAttributes}{\param{PrologExpr *}{clause}} - -Reads the attributes (data member values) from the given expression. - -\membersection{wxShape::ReadRegions} - -\func{void}{ReadRegions}{\param{PrologExpr *}{clause}} - -Reads in the regions. - -\membersection{wxShape::Recentre} - -\func{void}{Recentre}{\void} - -Does recentring (or other formatting) for all the text regions for this object. - -\membersection{wxShape::RemoveFromCanvas} - -\func{void}{RemoveFromCanvas}{\param{wxShapeCanvas *}{canvas}} - -Removes the shape from the canvas. - -\membersection{wxShape::ResetControlPoints} - -\func{void}{ResetControlPoints}{\void} - -Resets the positions of the control points (for instance when the -object's shape has changed). - -\membersection{wxShape::ResetMandatoryControlPoints} - -\func{void}{ResetMandatoryControlPoints}{\void} - -Reset the mandatory control points. For example, the control point on a dividing line should -appear even if the divided rectangle shape's handles should not appear (because it is the child of -a composite, and children are not resizable). - -\membersection{wxShape::Recompute} - -\func{bool}{Recompute}{\void} - -Recomputes any constraints associated with the object (normally -applicable to wxCompositeShapes only, but harmless for other -classes of object). - -\membersection{wxShape::RemoveLine} - -\func{void}{RemoveLine}{\param{wxLineShape *}{line}} - -Removes the given line from the object's list of attached lines. - -\membersection{wxShape::Select} - -\func{void}{Select}{\param{bool}{ select = TRUE}} - -Selects or deselects the given object, drawing or erasing control points -(handles) as necessary. - -\membersection{wxShape::Selected} - -\func{bool}{Selected}{\void} - -TRUE if the object is currently selected. - -\membersection{wxShape::SetAttachmentMode}\label{setattachmentmode} - -\func{void}{SetAttachmentMode}{\param{bool}{ flag}} - -Sets the attachment mode to TRUE or FALSE. If TRUE, attachment points -will be significant when drawing lines to and from this object. -If FALSE, lines will be drawn as if to the centre of the object. - -\membersection{wxShape::SetBrush} - -\func{void}{SetBrush}{\param{wxBrush *}{brush}} - -Sets the brush for filling the object's shape. - -\membersection{wxShape::SetCanvas} - -\func{void}{SetCanvas}{\param{wxShapeCanvas *}{theCanvas}} - -Identical to Attach. - -\membersection{wxShape::SetCentreResize} - -\func{void}{SetCentreResize}{\param{bool}{ cr}} - -Specify whether the shape is to be resized from the centre (the centre stands still) or from the corner or side -being dragged (the other corner or side stands still). - -\membersection{wxShape::SetClientData} - -\func{void}{SetClientData}{\param{wxObject *}{clientData}} - -Sets the client data. - - -\membersection{wxShape::SetDC} - -\func{void}{SetDC}{\param{wxDC *}{dc}} - -Sets the device context associated with the object. This may temporarily be set -to (for example) a printer device context, so that the object will be printed -instead of drawn on a canvas. - -\membersection{wxShape::SetDefaultRegionSize}\label{setdefaultregionsize} - -\func{void}{SetDefaultRegionSize}{\void} - -Set the default region to be consistent with the shape size. - -\membersection{wxShape::SetDisableLabel} - -\func{void}{SetDisableLabel}{\param{bool}{ flag}} - -Set {\it flag} to TRUE to stop the default region being shown, FALSE otherwise. - -\membersection{wxShape::SetDraggable} - -\func{void}{SetDraggable}{\param{bool}{ drag}, \param{bool}{ recursive = FALSE}} - -Sets the object to be draggable or not draggable. - -\membersection{wxShape::SetDrawHandles} - -\func{void}{SetDrawHandles}{\param{bool}{ drawH}} - -Sets the {\it drawHandles} flag for this shape and all descendants. If {\it drawH} is TRUE (the default), -any handles (control points) will be drawn. Otherwise, the handles will not be drawn. - -\membersection{wxShape::SetEventHandler} - -\func{void}{GetEventHandler}{\param{wxShapeEvtHandler *}{handler}} - -Sets the event handler for this shape. - -\membersection{wxShape::SetFixedSize} - -\func{void}{SetFixedSize}{\param{bool}{ x}, \param{bool}{ y}} - -Sets the object to be of the given, fixed size. - -\membersection{wxShape::SetFont} - -\func{void}{SetFont}{\param{wxFont *}{font}, \param{int}{ regionId = 0}} - -Sets the font for the specified text region. - -\membersection{wxShape::SetFormatMode}\label{setformatmode} - -\func{void}{SetFormatMode}{\param{int}{ mode}, \param{int}{ regionId = 0}} - -Sets the format mode of the default text region. The argument can be a bit list -of the following: - -\begin{description}\itemsep=0pt -\item[FORMAT\_NONE] No formatting. -\item[FORMAT\_CENTRE\_HORIZ] Horizontal centring. -\item[FORMAT\_CENTRE\_VERT] Vertical centring. -\end{description} - -\membersection{wxShape::SetHighlight} - -\func{void}{SetHighlight}{\param{bool}{ hi}, \param{bool}{ recurse = FALSE}} - -Sets the highlight for a shape. Shape highlighting is unimplemented. - -\membersection{wxShape::SetId} - -\func{void}{SetId}{\param{long}{ id}} - -Set the integer identifier for this shape. - -\membersection{wxShape::SetPen} - -\func{void}{SetPen}{\param{wxPen *}{pen}} - -Sets the pen for drawing the object's outline. - -\membersection{wxShape::SetRegionName}\label{setregionname} - -\func{void}{SetRegionName}{\param{const wxString\& }{name}, \param{int}{ regionId = 0}} - -Sets the name for this region. The name for a region is unique within the scope of the whole -composite, whereas a region id is unique only for a single image. - -\membersection{wxShape::SetSensitivityFilter}\label{setsensitivityfilter} - -\func{void}{SetSensitivityFilter}{\param{int}{ sens=OP\_ALL}, \param{bool}{ recursive = FALSE}} - -Sets the object to be sensitive or insensitive to specific mouse operations. - -{\it sens} is a bitlist of the following: - -\begin{itemize}\itemsep=0pt -\item OP\_CLICK\_LEFT -\item OP\_CLICK\_RIGHT -\item OP\_DRAG\_LEFT -\item OP\_DRAG\_RIGHT -\item OP\_ALL (equivalent to a combination of all the above). -\end{itemize} - -\membersection{wxShape::SetShadowMode}\label{setshadowmode} - -\func{void}{SetShadowMode}{\param{int}{ mode}, \param{bool}{ redraw = FALSE}} - -Sets the shadow mode (whether a shadow is drawn or not). {\it mode} can be one of -the following: - -\begin{description}\itemsep=0pt -\item[SHADOW\_NONE] No shadow (the default). -\item[SHADOW\_LEFT] Shadow on the left side. -\item[SHADOW\_RIGHT] Shadow on the right side. -\end{description} - -\membersection{wxShape::SetSize} - -\func{void}{SetSize}{\param{float}{ x}, \param{float}{ y}, \param{bool}{ recursive = TRUE}} - -Sets the object's size. - -\membersection{wxShape::SetSpaceAttachments} - -\func{void}{SetSpaceAttachments}{\param{bool}{ sp}} - -Indicate whether lines should be spaced out evenly at the point they touch the node (TRUE), or whether they -should join at a single point (FALSE). - -\membersection{wxShape::SetTextColour} - -\func{void}{SetTextColour}{\param{const wxString\& }{colour}, \param{int}{ regionId = 0}} - -Sets the colour for the specified text region. - -\membersection{wxShape::SetX} - -\func{void}{SetX}{\param{float}{ x}} - -Sets the {\it x} position of the shape. - -\membersection{wxShape::SetX} - -\func{void}{SetY}{\param{float}{ y}} - -Sets the {\it y} position of the shape. - -\membersection{wxShape::SpaceAttachments} - -\func{void}{SpaceAttachments}{\param{bool}{ sp}} - -Sets the spacing mode: if TRUE, lines at the same attachment point will be -spaced evenly across that side of the object. If false, all lines at the -same attachment point will emanate from the same point. - -\membersection{wxShape::Show} - -\func{void}{Show}{\param{bool}{ show}} - -Sets a flag indicating whether the object should be drawn. - -\membersection{wxShape::Unlink} - -\func{void}{Unlink}{\void} - -If the shape is a line, unlinks the nodes attached to the object, removing itself from the list of -lines for each of the `to' and `from' nodes. - -\membersection{wxShape::WritePrologAttributes} - -\func{void}{WritePrologAttributes}{\param{PrologExpr *}{clause}} - -Writes the object's attributes (data member values) into the given expression. - -\membersection{wxShape::WriteRegions} - -\func{void}{WriteRegions}{\param{PrologExpr *}{clause}} - -Writes the regions. - - - -\section{\class{wxShapeCanvas}: wxCanvas}\label{wxshapecanvas} - -A canvas for drawing diagrams on. - -\membersection{wxShapeCanvas::wxShapeCanvas} - -\func{void}{wxShapeCanvas}{\void} - -Constructor. - -\membersection{wxShapeCanvas::\destruct{wxShapeCanvas}} - -\func{void}{\destruct{wxShapeCanvas}}{\void} - -Destructor. - -\membersection{wxShapeCanvas::AddShape} - -\func{void}{AddShape}{\param{wxShape *}{shape}, \param{wxShape *}{addAfter = NULL}} - -Adds a shape to the diagram. If {\it addAfter} is non-NULL, the shape will be added after this -one. - -\membersection{wxShapeCanvas::Clear} - -\func{void}{Clear}{\void} - -Clears the device context associated with the diagram. - -\membersection{wxShapeCanvas::DrawOutline} - -\func{void}{DrawOutline}{\param{float}{ x1}, \param{float}{ y1}, \param{float}{ x2}, \param{float}{ y2}} - -Draws an outline rectangle on the current device context. - -\membersection{wxShapeCanvas::FindShape} - -\func{wxShape *}{FindShape}{\param{float}{ x1}, \param{float}{ y}, \param{int *}{attachment}, \param{wxClassInfo *}{info = NULL}, - \param{wxShape *}{notImage = NULL}} - -Find a shape under this mouse click. Returns the shape (or NULL), and the nearest attachment point. - -If {\it info} is non-NULL, a shape whose class which is a descendant of the desired class is found. - -If {\it notImage} is non-NULL, shapes which are descendants of {\it notImage} are ignored. - -\membersection{wxShapeCanvas::FindFirstSensitiveShape} - -\func{wxShape *}{FindFirstSensitiveShape}{\param{float}{ x1}, \param{float}{ y}, \param{int *}{attachment}, \param{int}{ op}} - -Finds the first sensitive shape whose sensitivity filter matches {\it op}, working up the hierarchy of composites until -one (or none) is found. - -\membersection{wxShapeCanvas::GetCanvas} - -\func{wxCanvas *}{GetCanvas}{\void} - -Returns the canvas associated with this diagram. - -\membersection{wxShapeCanvas::GetDC} - -\func{wxDC *}{GetDC}{\void} - -Returns the device context associated with this diagram. - -\membersection{wxShapeCanvas::GetGridSpacing} - -\func{float}{GetGridSpacing}{\void} - -Returns the grid spacing. - -\membersection{wxShapeCanvas::GetMouseTolerance} - -\func{int}{GetMouseTolerance}{\void} - -Returns the tolerance within which a mouse move is ignored. - -\membersection{wxShapeCanvas::GetShapeList} - -\func{wxList *}{GetShapeList}{\void} - -Returns a pointer to the internal shape list. - -\membersection{wxShapeCanvas::GetQuickEditMode} - -\func{bool}{GetQuickEditMode}{\void} - -Returns quick edit mode for the associated diagram. - -\membersection{wxShapeCanvas::InsertShape} - -\func{void}{InsertShape}{\param{wxShape *}{shape}} - -Inserts a shape at the front of the shape list. - -\membersection{wxShapeCanvas::OnBeginDragLeft}\label{onbegindragleft} - -\func{void}{OnBeginDragLeft}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys = 0}} - -Called when the start of a left-button drag event on the canvas background is detected by OnEvent. You may override this member; -by default it does nothing. - -{\it keys} is a bit list of the following: - -\begin{itemize}\itemsep=0pt -\item KEY\_SHIFT -\item KEY\_CTRL -\end{itemize} - -See also \helpref{OnDragLeft}{ondragleft}, \helpref{OnEndDragLeft}{onenddragleft}. - -\membersection{wxShapeCanvas::OnBeginDragRight}\label{onbegindragright} - -\func{void}{OnBeginDragRight}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys = 0}} - -Called when the start of a right-button drag event on the canvas background is detected by OnEvent. You may override this member; -by default it does nothing. - -{\it keys} is a bit list of the following: - -\begin{itemize}\itemsep=0pt -\item KEY\_SHIFT -\item KEY\_CTRL -\end{itemize} - -See also \helpref{OnDragRight}{ondragright}, \helpref{OnEndDragRight}{onenddragright}. - -\membersection{wxShapeCanvas::OnEndDragLeft}\label{onenddragleft} - -\func{void}{OnEndDragLeft}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys = 0}} - -Called when the end of a left-button drag event on the canvas background is detected by OnEvent. You may override this member; -by default it does nothing. - -{\it keys} is a bit list of the following: - -\begin{itemize}\itemsep=0pt -\item KEY\_SHIFT -\item KEY\_CTRL -\end{itemize} - -See also \helpref{OnDragLeft}{ondragleft}, \helpref{OnBeginDragLeft}{onbegindragleft}. - -\membersection{wxShapeCanvas::OnEndDragRight}\label{onenddragright} - -\func{void}{OnEndDragRight}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys = 0}} - -Called when the end of a right-button drag event on the canvas background is detected by OnEvent. You may override this member; -by default it does nothing. - -{\it keys} is a bit list of the following: - -\begin{itemize}\itemsep=0pt -\item KEY\_SHIFT -\item KEY\_CTRL -\end{itemize} - -See also \helpref{OnDragRight}{ondragright}, \helpref{OnBeginDragRight}{onbegindragright}. - -\membersection{wxShapeCanvas::OnDragLeft}\label{ondragleft} - -\func{void}{OnDragLeft}{\param{bool}{ draw}, \param{float}{ x}, \param{float}{ y}, \param{int}{ keys = 0}} - -Called when a left-button drag event on the canvas background is detected by OnEvent. You may override this member; -by default it does nothing. - -{\it draw} is alternately TRUE and FALSE, to assist drawing and erasing. - -{\it keys} is a bit list of the following: - -\begin{itemize}\itemsep=0pt -\item KEY\_SHIFT -\item KEY\_CTRL -\end{itemize} - -See also \helpref{OnBeginDragLeft}{onbegindragleft}, \helpref{OnEndDragLeft}{onenddragleft}. - -\membersection{wxShapeCanvas::OnDragRight}\label{ondragright} - -\func{void}{OnDragRight}{\param{bool}{ draw}, \param{float}{ x}, \param{float}{ y}, \param{int}{ keys = 0}} - -Called when a right-button drag event on the canvas background is detected by OnEvent. You may override this member; -by default it does nothing. - -{\it draw} is alternately TRUE and FALSE, to assist drawing and erasing. - -{\it keys} is a bit list of the following: - -\begin{itemize}\itemsep=0pt -\item KEY\_SHIFT -\item KEY\_CTRL -\end{itemize} - -See also \helpref{OnBeginDragRight}{onbegindragright}, \helpref{OnEndDragRight}{onenddragright}. - -\membersection{wxShapeCanvas::OnLeftClick}\label{onleftclick} - -\func{void}{OnLeftClick}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys = 0}} - -Called when a left click event on the canvas background is detected by OnEvent. You may override this member; -by default it does nothing. - -{\it keys} is a bit list of the following: - -\begin{itemize}\itemsep=0pt -\item KEY\_SHIFT -\item KEY\_CTRL -\end{itemize} - -\membersection{wxShapeCanvas::OnRightClick}\label{onrightclick} - -\func{void}{OnRightClick}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys = 0}} - -Called when a right click event on the canvas background is detected by OnEvent. You may override this member; -by default it does nothing. - -{\it keys} is a bit list of the following: - -\begin{itemize}\itemsep=0pt -\item KEY\_SHIFT -\item KEY\_CTRL -\end{itemize} - -\membersection{wxShapeCanvas::Redraw} - -\func{void}{Redraw}{\void} - -Calls wxDiagram::Redraw. - -\membersection{wxShapeCanvas::RemoveShape} - -\func{void}{RemoveShape}{\param{wxShape *}{shape}} - -Calls wxDiagram::RemoveShape. - -\membersection{wxShapeCanvas::SetDiagram} - -\func{void}{SetDiagram}{\param{wxDiagram *}{diagram}} - -Sets the diagram associated with this diagram. - -\membersection{wxShapeCanvas::Snap} - -\func{void}{Snap}{\param{float *}{x}, \param{float *}{y}} - -Calls wxDiagram::Snap. - - - -\section{\class{wxShapeEvtHandler}: wxObject}\label{wxshapeevthandler} - -wxShapeEvtHandler is a class from which wxShape (and therefore all shape classes) are derived. -A wxShape also contains a pointer to its current wxShapeEvtHandler. Event handlers -can be swapped in and out, altering the behaviour of a shape. This allows, for example, -a range of behaviours to be redefined in one class, rather than requiring -each shape class to be subclassed. - -\membersection{wxShapeEvtHandler::handlerShape} - -\member{wxShape *}{handlerShape} - -Pointer to the shape associated with this handler. - -\membersection{wxShapeEvtHandler::previousHandler} - -\member{wxShapeEvtHandler *}{previousHandler} - -Pointer to the previous handler. - -\membersection{wxShapeEvtHandler::wxShapeEvtHandler} - -\func{void}{wxShapeEvtHandler}{\param{wxShapeEvtHandler *}{previous = NULL}, \param{wxShape *}{shape = NULL}} - -Constructs a new event handler. - -\membersection{wxShapeEvtHandler::\destruct{wxShapeEvtHandler}} - -\func{void}{\destruct{wxShapeEvtHandler}}{\void} - -Destructor. - -\membersection{wxShapeEvtHandler::GetShape} - -\func{void}{GetShape}{\void} - -Returns the shape associated with this handler. - -\membersection{wxShapeEvtHandler::OnBeginDragLeft} - -\func{void}{OnBeginDragLeft}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys=0}, \param{int}{ attachment = 0}} - -Called when the user is beginning to drag using the left mouse button. - -\membersection{wxShapeEvtHandler::OnBeginDragRight} - -\func{void}{OnBeginDragRight}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys=0}, \param{int}{ attachment = 0}} - -Called when the user is beginning to drag using the right mouse button. - -\membersection{wxShapeEvtHandler::OnBeginSize} - -\func{void}{OnBeginSize}{\param{float}{ width}, \param{float}{ height}} - -Called when a shape starts to be resized. - -\membersection{wxShapeEvtHandler::OnDragLeft} - -\func{void}{OnDragLeft}{\param{bool}{ draw}, \param{float}{ x}, \param{float}{ y}, \param{int}{ keys=0}, \param{int}{ attachment = 0}} - -Called twice when the object is being dragged, once to allow erasing the old -image, and again to allow drawing at the new position. - -\membersection{wxShapeEvtHandler::OnDragRight} - -\func{void}{OnDragRight}{\param{bool}{ draw}, \param{float}{ x}, \param{float}{ y}, \param{int}{ keys=0}, \param{int}{ attachment = 0}} - -Called twice when the object is being dragged, once to allow erasing the old -image, and again to allow drawing at the new position. - -\membersection{wxShapeEvtHandler::OnDraw} - -\func{void}{OnDraw}{\void} - -Defined for each class to draw the main graphic, but -not the contents. - -\membersection{wxShapeEvtHandler::OnDrawContents} - -\func{void}{OnDrawContents}{\void} - -Defined for each class to draw the contents of the -object, such as text. - -\membersection{wxShapeEvtHandler::OnDrawControlPoints} - -\func{void}{OnDrawControlPoints}{\void} - -Called when the object's control points (handles) should -be drawn. - -\membersection{wxShapeEvtHandler::OnDrawOutline} - -\func{void}{OnDrawOutline}{\void} - -Called when the outline of the object should be drawn. - -\membersection{wxShapeEvtHandler::OnEndDragLeft} - -\func{void}{OnEndDragLeft}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys=0}, \param{int}{ attachment = 0}} - -Called when the user is stopping dragging using the left mouse button. - -\membersection{wxShapeEvtHandler::OnEndDragRight} - -\func{void}{OnEndDragRight}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys=0}, \param{int}{ attachment = 0}} - -Called when the user is stopping dragging using the right mouse button. - -\membersection{wxShapeEvtHandler::OnEndSize} - -\func{void}{OnEndSize}{\param{float}{ width}, \param{float}{ height}} - -Called after a shape is resized. - -\membersection{wxShapeEvtHandler::OnErase} - -\func{void}{OnErase}{\void} - -Called when the whole object should be erased. - -\membersection{wxShapeEvtHandler::OnEraseContents} - -\func{void}{OnEraseContents}{\void} - -Called when the contents should be erased. - -\membersection{wxShapeEvtHandler::OnEraseControlPoints} - -\func{void}{OnEraseControlPoints}{\void} - -Called when the object's control points (handles) should -be erased. - -\membersection{wxShapeEvtHandler::OnHighlight} - -\func{void}{OnHighlight}{\void} - -Called when the object should be highlighted. - -\membersection{wxShapeEvtHandler::OnLeftClick} - -\func{void}{OnLeftClick}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys =0}, \param{int}{ attachment = 0}} - -Called when the object receives a left mouse click event. - -\membersection{wxShapeEvtHandler::OnMove} - -\func{void}{OnMove}{\param{float}{ x}, \param{float}{ y}, \param{float}{ oldX}, \param{float}{ oldY}, \param{bool}{ display = TRUE}} - -Called when the object receives a move request. - -\membersection{wxShapeEvtHandler::OnMoveLink} - -\func{void}{OnMoveLink}{\param{bool}{ moveControlPoints=TRUE}} - -Called when the line attached to an object need to be repositioned, -because the object has moved. - -\membersection{wxShapeEvtHandler::OnMoveLinks} - -\func{void}{OnMoveLinks}{\void} - -Called when the lines attached to an object need to be repositioned, -because the object has moved. - -\membersection{wxShapeEvtHandler::OnMovePre} - -\func{bool}{OnMovePre}{\param{float}{ x}, \param{float}{ y}, \param{float}{ oldX}, \param{float}{ oldY}, \param{bool}{ display = TRUE}} - -Called just after the object receives a move request. - -\membersection{wxShapeEvtHandler::OnMovePre} - -\func{bool}{OnMovePre}{\param{float}{ x}, \param{float}{ y}, \param{float}{ oldX}, \param{float}{ oldY}, \param{bool}{ display = TRUE}} - -Called just before the object receives a move request. Returning TRUE -allows the move to be processed; returning FALSE vetoes the move. - -\membersection{wxShapeEvtHandler::OnRightClick} - -\func{void}{OnRightClick}{\param{float}{ x}, \param{float}{ y}, \param{int}{ keys = 0}, \param{int}{ attachment = 0}} - -Called when the object receives a mouse mouse click event. - -\membersection{wxShapeEvtHandler::OnSize} - -\func{void}{OnSize}{\param{float}{ x}, \param{float}{ y}} - -Called when the object receives a resize request. - - - -\section{\class{wxTextShape}: wxRectangleShape}\label{wxtextshape} - -As wxRectangleShape, but only the text is displayed. - -See also \helpref{wxRectangleShape}{wxrectangleshape}. - -\membersection{wxTextShape::wxTextShape} - -\func{void}{wxTextShape}{\param{float}{ width = 0.0}, \param{float}{ height = 0.0}} - -Constructor. - -\membersection{wxTextShape::\destruct{wxTextShape}} - -\func{void}{\destruct{wxTextShape}}{\void} - -Destructor. - -\section{Functions}\label{functions} - -These are the OGL functions. - -\membersection{::wxOGLInitialize} - -\func{void}{wxOGLInitialize}{\param{wxHelpInstance *}{helpInstance = NULL}, \param{const wxString\& }{helpFile = NULL}, - \param{wxFont *}{buttonFont = NULL}, \param{wxFont *}{labelFont = NULL}} - -Initializes OGL. The optional parameters tell OGL what to use for on-line help and font sizes. - -\membersection{::wxOGLCleanUp} - -\func{void}{wxOGLCleanUp}{\void} - -Cleans up OGL. diff --git a/utils/ogl/docs/contents.gif b/utils/ogl/docs/contents.gif deleted file mode 100644 index 3dddfa3dd5..0000000000 Binary files a/utils/ogl/docs/contents.gif and /dev/null differ diff --git a/utils/ogl/docs/forward.gif b/utils/ogl/docs/forward.gif deleted file mode 100644 index 9c81e8c92f..0000000000 Binary files a/utils/ogl/docs/forward.gif and /dev/null differ diff --git a/utils/ogl/docs/intro.tex b/utils/ogl/docs/intro.tex deleted file mode 100644 index 96c33653ef..0000000000 --- a/utils/ogl/docs/intro.tex +++ /dev/null @@ -1,45 +0,0 @@ -\chapter{Introduction} -\pagenumbering{arabic}% -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage} - -Object Graphics Library (\ogl) is a C++ library supporting the creation and -manipulation of simple and complex graphic images on a canvas. - -It can be found in the directory {\tt utils/ogl/src} in the -wxWindows distribution. The file {\tt ogl.h} must be included to make use -of the library. - -Please see \helpref{OGL overview}{ogloverview} for a general description how the object library works. For details, -please see the \helpref{class reference}{classref}. - -\section{File structure} - -These are the files that comprise the \ogl\ library. - -\begin{description}\itemsep=0pt -\item[basic.h] Header for basic objects such as wxShape and wxRectangleShape. -\item[basic.cpp] Basic objects implementation (1). -\item[basic2.cpp] Basic objects implementation (2). -\item[bitmap.cpp] wxBitmapShape class header. -\item[bitmap.cpp] wxBitmapShape implementation. -\item[canvas.h] wxShapeCanvas class header. -\item[canvas.cpp] wxShapeCanvas class implementation. -\item[composit.h] Composite object class header. -\item[composit.cpp] Composite object class implementation. -\item[constrnt.h] Constraint classes header. -\item[constrnt.cpp] Constraint classes implementation. -\item[divided.h] Divided object class header. -\item[divided.cpp] Divided object class implementation. -\item[drawn.h] Drawn (metafile) object class header. -\item[drawn.cpp] Drawn (metafile) object class implementation. -\item[graphics.h] Main include file. -\item[lines.h] wxLineShape class header. -\item[lines.cpp] wxLineShape class implementation. -\item[misc.h] Miscellaneous graphics functions header. -\item[misc.cpp] Miscellaneous graphics functions implementation. -\item[ogldiag.h] wxDiagram class header. -\item[ogldiag.cpp] wxDiagram implementation. -\end{description} - - diff --git a/utils/ogl/docs/ogl.hpj b/utils/ogl/docs/ogl.hpj deleted file mode 100644 index 7f8c9efa46..0000000000 --- a/utils/ogl/docs/ogl.hpj +++ /dev/null @@ -1,17 +0,0 @@ -[OPTIONS] -BMROOT=d:\wx2\wxwind~1\utils\ogl\docs ; Assume that bitmaps are where the source is -TITLE=OGL Manual -CONTENTS=Contents -COMPRESS=HIGH - -[FILES] -ogl.rtf - -[CONFIG] -CreateButton("Up", "&Up", "JumpId(`ogl.hlp', `Contents')") -BrowseButtons() - -[MAP] - -[BITMAPS] - diff --git a/utils/ogl/docs/ogl.tex b/utils/ogl/docs/ogl.tex deleted file mode 100644 index 6408591627..0000000000 --- a/utils/ogl/docs/ogl.tex +++ /dev/null @@ -1,38 +0,0 @@ -\documentstyle[a4,makeidx,verbatim,texhelp,fancyhea,mysober,mytitle]{report} -\newcommand{\ogl}[0]{{OGL}} -\input psbox.tex -\parindent 0pt -\parskip 11pt -\title{Manual for Object Graphics Library 3.0} -\author{Julian Smart} -\date{July 1998} - -\makeindex -\begin{document} -\maketitle - -\pagestyle{fancyplain} -\bibliographystyle{plain} -\pagenumbering{roman} -\setheader{{\it CONTENTS}}{}{}{}{}{{\it CONTENTS}} -\setfooter{\thepage}{}{}{}{}{\thepage} -\tableofcontents% - -\input{intro.tex} -% -\input{sample.tex} -% -\input{classes.tex} -% -\input{topics.tex} -% -\input{bugs.tex} -% -\input{changes.tex} - -% -\addcontentsline{toc}{chapter}{Index} -\setheader{{\it INDEX}}{}{}{}{}{{\it INDEX}} -\setfooter{\thepage}{}{}{}{}{\thepage}% -\printindex -\end{document} diff --git a/utils/ogl/docs/ogledit.bmp b/utils/ogl/docs/ogledit.bmp deleted file mode 100644 index e7cf417cf5..0000000000 Binary files a/utils/ogl/docs/ogledit.bmp and /dev/null differ diff --git a/utils/ogl/docs/ogledit.gif b/utils/ogl/docs/ogledit.gif deleted file mode 100644 index 9784681b2d..0000000000 Binary files a/utils/ogl/docs/ogledit.gif and /dev/null differ diff --git a/utils/ogl/docs/sample.tex b/utils/ogl/docs/sample.tex deleted file mode 100644 index ca69297758..0000000000 --- a/utils/ogl/docs/sample.tex +++ /dev/null @@ -1,128 +0,0 @@ -\chapter{OGLEdit: a sample OGL application}\label{ogledit}% -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage} - -OGLEdit is a sample OGL application that allows the user to draw, edit, -save and load a few shapes. It should clarify aspects of OGL usage, and -can act as a template for similar applications. OGLEdit can be found in\rtfsp -{\tt samples/ogledit} in the OGL distribution. - -$$\image{10cm;0cm}{ogledit.eps}$$\par - -The wxWindows document/view model has been used in OGL, to reduce the amount of -housekeeping logic required to get it up and running. OGLEdit also provides -a demonstration of the Undo/Redo capability supported by the document/view classes, -and how a typical application might implement this feature. - -{\it Note:} A bug in the wxWindows document/view implementation before -version 1.66C may cause Do/Undo to misbehave and get out of sync. If this is the case, -please replace wxCommandProcessor::Submit with the following in wx\_doc.cpp. - -{\small -\begin{verbatim} - Bool wxCommandProcessor::Submit(wxCommand *command, Bool storeIt) - { - Bool success = command->Do(); - if (success && storeIt) - { - if (commands.Number() == maxNoCommands) - { - wxNode *firstNode = commands.First(); - wxCommand *firstCommand = (wxCommand *)firstNode->Data(); - delete firstCommand; - delete firstNode; - } - - // Correct a bug: we must chop off the current 'branch' - // so that we're at the end of the command list. - if (currentCommand) - { - wxNode *node = currentCommand->Next(); - while (node) - { - wxNode *next = node->Next(); - delete node; - node = next; - } - } - - commands.Append(command); - currentCommand = commands.Last(); - SetMenuStrings(); - } - return success; - } -\end{verbatim} -} - -\section{OGLEdit files} - -OGLEdit comprises the following source files. - -\begin{itemize}\itemsep=0pt -\item doc.h, doc.cpp: MyDiagram, DiagramDocument, DiagramCommand, MyEvtHandler -classes related to diagram functionality and documents. -\item view.h, view.cpp: MyCanvas, DiagramView classes related to visualisation of -the diagram. -\item ogledit.h, ogledit.cpp: MyFrame, MyApp classes related to the overall application. -\item palette.h, palette.cpp: EditorToolPalette implementing the shape palette. -\end{itemize} - -\section{How OGLEdit works} - -OGLEdit defines a DiagramDocument class, each of instance of which holds a MyDiagram -member which itself contains the shapes. - -In order to implement specific mouse behaviour for shapes, a class MyEvtHandler is -defined which is `plugged into' each shape when it is created, instead of overriding each shape class -individually. This event handler class also holds a label string. - -The DiagramCommand class is the key to implementing Undo/Redo. Each instance of DiagramCommand -stores enough information about an operation (create, delete, change colour etc.) to allow -it to carry out (or undo) its command. In DiagramView::OnMenuCommand, when the user initiates the -command, a new DiagramCommand instance is created which is then sent to the document's -command processor (see wxWindows manual for more information about doc/view and command -processing). - -Apart from menu commands, another way commands are initiated is by the user left-clicking on -the canvas or right-dragging on a node. MyCanvas::OnLeftClick in view.cpp shows how -the appropriate wxClassInfo is passed to a DiagramCommand, to allow DiagramCommand::Do -to create a new shape given the wxClassInfo. - -The MyEvtHandler right-drag methods in doc.cpp implement drawing a line between -two shapes, detecting where the right mouse button was released and looking for a second -shape. Again, a new DiagramCommand instance is created and passed to the command -processor to carry out the command. - -DiagramCommand::Do and DiagramCommand::Undo embody much of the -interesting interaction with the OGL library. A complication of note -when implementing undo is the problem of deleting a node shape which has -one or more arcs attached to it. If you delete the node, the arc(s) -should be deleted too. But multiple arc deletion represents more information -that can be incorporated in the existing DiagramCommand scheme. OGLEdit -copes with this by treating each arc deletion as a separate command, and -sending Cut commands recursively, providing an undo path. Undoing such a -Cut will only undo one command at a time - not a one to one -correspondence with the original command - but it's a reasonable -compromise and preserves Do/Undo whilst keeping our DiagramCommand class -simple. - -\section{Possible enhancements} - -OGLEdit is very simplistic and does not employ the more advanced features -of OGL, such as: - -\begin{itemize}\itemsep=0pt -\item attachment points (arcs are drawn to particular points on a shape) -\item metafile and bitmaps shapes -\item divided rectangles -\item composite shapes, and constraints -\item creating labels in shape regions -\item arc labels (OGL has support for three movable labels per arc) -\item spline and multiple-segment line arcs -\item adding annotations to node and arc shapes -\item line-straightening (supported by OGL) and alignment (not supported directly by OGL) -\end{itemize} - -These could be added to OGLEdit, at the risk of making it a less -useful example for beginners. diff --git a/utils/ogl/docs/tex2rtf.ini b/utils/ogl/docs/tex2rtf.ini deleted file mode 100644 index f69000ef11..0000000000 --- a/utils/ogl/docs/tex2rtf.ini +++ /dev/null @@ -1,20 +0,0 @@ -runTwice = yes -titleFontSize = 12 -authorFontSize = 10 -chapterFontSize = 12 -sectionFontSize = 12 -subsectionFontSize = 12 -headerRule = yes -footerRule = yes -useHeadingStyles = yes -listItemIndent=40 -generateHPJ = no -htmlBrowseButtons = bitmap -winHelpVersion = 3 -winHelpContents = yes -winHelpTitle = "OGL Manual" -truncateFilenames = yes -combineSubSections = yes -\overview [2] {\rtfonly{See also }\sethotspotcolour{off}\sethotspotunderline{on}\winhelponly{\image{}{books.bmp}} -\htmlonly{\image{}{books.gif}}\helpref{#1}{#2} -\sethotspotcolour{on}\sethotspotunderline{on}} diff --git a/utils/ogl/docs/topics.tex b/utils/ogl/docs/topics.tex deleted file mode 100644 index 7f126e9bb1..0000000000 --- a/utils/ogl/docs/topics.tex +++ /dev/null @@ -1,163 +0,0 @@ -\chapter{Topic overviews} -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage} - -The following sections describe particular topics. - -\section{OGL overview}\label{ogloverview} - -\helpref{wxShapeCanvas}{wxshapecanvas}, derived from {\bf wxCanvas}, is the drawing area -for a number of \helpref{wxShape}{wxshape} instances. Everything drawn on a -wxShapeCanvas is derived from wxShape, which provides virtual -member functions for redrawing, creating and destroying -resize/selection `handles', movement and erasing behaviour, mouse -click behaviour, calculating the bounding box of the shape, linking -nodes with arcs, and so on. - -The way a client application copes with `damage' to the canvas is to -erase (white out) anything should no longer be displayed, redraw the shape, -and then redraw everything on the canvas to repair any damage. If quick edit -mode is on for the canvas, the complete should be omitted by OGL and the -application. - -Selection handles (called control points in the code) are implemented as -wxRectangleShapes. - -Events are passed to shapes by the canvas in a high-level form, for example {\bf OnLeftClick}, -{\bf OnBeginDragLeft}, {\bf OnDragLeft}, {\bf OnEndDragLeft}. The canvas decides -what is a click and what is a drag, whether it is on a shape or the canvas itself, -and (by interrogating the shape) which attachment point the click is associated with. - -In order to provide event-handling flexibility, each shapes has an `event handler' associated with it, -which by default is the shape itself (all shapes derive from wxShapeEvtHandler). -An application can modify the event-handling behaviour simply by plugging a new -event handler into the shape. This can avoid the need for multiple inheritance when -new properties and behaviour are required for a number of different shape classes: instead -of overriding each class, one new event handler class can be defined and used for all -existing shape classes. - -A range of shapes have been predefined in the library, including rectangles, ellipses, -polygons. A client application can derive from these shapes and/or derive entirely -new shapes from wxShape. - -Instances of a class called \helpref{wxDiagram}{wxdiagram} organise collections of -shapes, providing default file input and output behaviour. - - -\section{wxDividedShape overview}\label{dividedshapeoverview} - -Classes: \helpref{wxDividedShape}{wxdividedshape} - -A wxDividedShape is a rectangle with a number of vertical divisions. Each -division may have its text formatted with independent characteristics, and -the size of each division relative to the whole image may be specified. - -Once a wxDividedShape has been created, the user may move the divisions with the -mouse. By pressing Ctrl while right-clicking, the region attributes can be edited. - -Here are examples of creating wxDividedShape objects: - -{\small -\begin{verbatim} - /* - * Divided rectangle with 3 regions - * - */ - - wxDividedShape *dividedRect = new wxDividedShape(50, 60); - - wxShapeRegion *region = new wxShapeRegion; - region->SetProportions(0.0, 0.25); - dividedRect->AddRegion(region); - - region = new wxShapeRegion; - region->SetProportions(0.0, 0.5); - dividedRect->AddRegion(region); - - region = new wxShapeRegion; - region->SetProportions(0.0, 0.25); - dividedRect->AddRegion(region); - - dividedRect->SetSize(50, 60); // Allow it to calculate region sizes - dividedRect->SetPen(wxBLACK_PEN); - dividedRect->SetBrush(wxWHITE_BRUSH); - dividedRect->Show(TRUE); - dividedRect->NameRegions(); - - /* - * Divided rectangle with 3 regions, rounded - * - */ - - wxDividedShape *dividedRect3 = new wxDividedShape(50, 60); - dividedRect3->SetCornerRadius(-0.4); - - region = new wxShapeRegion; - region->SetProportions(0.0, 0.25); - dividedRect3->AddRegion(region); - - region = new wxShapeRegion; - region->SetProportions(0.0, 0.5); - dividedRect3->AddRegion(region); - - region = new wxShapeRegion; - region->SetProportions(0.0, 0.25); - dividedRect3->AddRegion(region); - - dividedRect3->SetSize(50, 60); // Allow it to calculate region sizes - dividedRect3->SetPen(wxBLACK_PEN); - dividedRect3->SetBrush(wxWHITE_BRUSH); - dividedRect3->Show(TRUE); - dividedRect3->NameRegions(); -\end{verbatim} -} - - -\section{wxCompositeShape overview}\label{compositeshapeoverview} - -Classes: \helpref{wxCompositeShape}{wxcompositeshape}, \helpref{OGLConstraint}{oglconstraint} - -The wxCompositeShape allows fairly complex shapes to be created, and maintains -a set of constraints which specify the layout and proportions of child shapes. - -Add child shapes to a wxCompositeShape using \helpref{AddChild}{wxcompositeshapeaddchild}, and -add constraints using \helpref{AddConstraint}{wxcompositeshapeaddconstraint}. - -After children and shapes have been added, call \helpref{Recompute}{wxcompositeshaperecompute} which -will return TRUE is the constraints could be satisfied, FALSE otherwise. If -constraints have been correctly and consistently specified, this call will succeed. - -If there is more than one child, constraints must be specified: OGL cannot calculate -the size and position of children otherwise. Don't assume that children will simply -move relative to the parent without the use of constraints. - -To specify a constraint, you need three things: - -\begin{enumerate}\itemsep=0pt -\item a constraint type, such as gyCONSTRAINT\_CENTRED\_VERTICALLY; -\item a reference shape, with respect to which other shapes are going to be positioned - the\rtfsp -{\it constraining} shape; -\item a list of one or more shapes to be constrained: the {\it constrained} shapes. -\end{enumerate} - -The constraining shape can be either the parent of the constrained shapes, or a sibling. The -constrained shapes must all be siblings of each other. - -For an exhaustive list and description of the available constraint types, see the \helpref{OGLConstraint constructor}{oglconstraintconstr}. -Note that most constraints operate in one dimension only (vertically or horizontally), so you will -usually need to specify constraints in pairs. - -You can set the spacing between constraining and constrained shapes by -calling \helpref{OGLConstraint::SetSpacing}{oglconstraintsetspacing}. - -Finally, a wxCompositeShape can have {\it divisions}, which are special child shapes of class -wxDivisionShape (not to be confused with wxDividedShape). The purpose of this is to allow -the composite to be divided into user-adjustable regions (divisions) into which other shapes -can be dropped dynamically, given suitable application code. Divisons allow the child -shapes to have an identity of their own - they can be manipulated independently of their container - -but to behave as if they are contained with the division, moving with the parent shape. -Divisions boundaries can themselves be moved using the mouse. - -To create an initial division, call \helpref{wxCompositeShape::MakeContainer}{wxcompositeshapemakecontainer}. -Make further divisions by calling \helpref{wxDivisionShape::Divide}{wxdivisionshapedivide}. - diff --git a/utils/ogl/docs/up.gif b/utils/ogl/docs/up.gif deleted file mode 100644 index 316d0d2a14..0000000000 Binary files a/utils/ogl/docs/up.gif and /dev/null differ diff --git a/utils/ogl/src/basic.cpp b/utils/ogl/src/basic.cpp deleted file mode 100644 index 12867bd404..0000000000 --- a/utils/ogl/src/basic.cpp +++ /dev/null @@ -1,2434 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: basic.cpp -// Purpose: Basic OGL classes -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "basic.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#ifdef PROLOGIO -#include -#endif - -#if USE_IOSTREAMH -#include -#else -#include -#endif - -#include -#include -#include - -#include "basic.h" -#include "basicp.h" -#include "composit.h" -#include "lines.h" -#include "canvas.h" -#include "divided.h" -#include "misc.h" - -// Control point types -// Rectangle and most other shapes -#define CONTROL_POINT_VERTICAL 1 -#define CONTROL_POINT_HORIZONTAL 2 -#define CONTROL_POINT_DIAGONAL 3 - -// Line -#define CONTROL_POINT_ENDPOINT_TO 4 -#define CONTROL_POINT_ENDPOINT_FROM 5 -#define CONTROL_POINT_LINE 6 - -IMPLEMENT_DYNAMIC_CLASS(wxShapeTextLine, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxAttachmentPoint, wxObject) - -wxShapeTextLine::wxShapeTextLine(float the_x, float the_y, const wxString& the_line) -{ - m_x = the_x; m_y = the_y; m_line = the_line; -} - -wxShapeTextLine::~wxShapeTextLine() -{ -} - -IMPLEMENT_ABSTRACT_CLASS(wxShapeEvtHandler, wxObject) - -wxShapeEvtHandler::wxShapeEvtHandler(wxShapeEvtHandler *prev, wxShape *shape) -{ - m_previousHandler = prev; - m_handlerShape = shape; -} - -wxShapeEvtHandler::~wxShapeEvtHandler() -{ -} - -void wxShapeEvtHandler::OnDelete() -{ - if (this != GetShape()) - delete this; -} - -void wxShapeEvtHandler::OnDraw(wxDC& dc) -{ - if (m_previousHandler) - m_previousHandler->OnDraw(dc); -} - -void wxShapeEvtHandler::OnMoveLinks(wxDC& dc) -{ - if (m_previousHandler) - m_previousHandler->OnMoveLinks(dc); -} - -void wxShapeEvtHandler::OnMoveLink(wxDC& dc, bool moveControlPoints) -{ - if (m_previousHandler) - m_previousHandler->OnMoveLink(dc, moveControlPoints); -} - -void wxShapeEvtHandler::OnDrawContents(wxDC& dc) -{ - if (m_previousHandler) - m_previousHandler->OnDrawContents(dc); -} - -void wxShapeEvtHandler::OnSize(float x, float y) -{ - if (m_previousHandler) - m_previousHandler->OnSize(x, y); -} - -bool wxShapeEvtHandler::OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display) -{ - if (m_previousHandler) - return m_previousHandler->OnMovePre(dc, x, y, old_x, old_y, display); - else - return TRUE; -} - -void wxShapeEvtHandler::OnMovePost(wxDC& dc, float x, float y, float old_x, float old_y, bool display) -{ - if (m_previousHandler) - m_previousHandler->OnMovePost(dc, x, y, old_x, old_y, display); -} - -void wxShapeEvtHandler::OnErase(wxDC& dc) -{ - if (m_previousHandler) - m_previousHandler->OnErase(dc); -} - -void wxShapeEvtHandler::OnEraseContents(wxDC& dc) -{ - if (m_previousHandler) - m_previousHandler->OnEraseContents(dc); -} - -void wxShapeEvtHandler::OnHighlight(wxDC& dc) -{ - if (m_previousHandler) - m_previousHandler->OnHighlight(dc); -} - -void wxShapeEvtHandler::OnLeftClick(float x, float y, int keys, int attachment) -{ - if (m_previousHandler) - m_previousHandler->OnLeftClick(x, y, keys, attachment); -} - -void wxShapeEvtHandler::OnRightClick(float x, float y, int keys, int attachment) -{ - if (m_previousHandler) - m_previousHandler->OnRightClick(x, y, keys, attachment); -} - -void wxShapeEvtHandler::OnDragLeft(bool draw, float x, float y, int keys, int attachment) -{ - if (m_previousHandler) - m_previousHandler->OnDragLeft(draw, x, y, keys, attachment); -} - -void wxShapeEvtHandler::OnBeginDragLeft(float x, float y, int keys, int attachment) -{ - if (m_previousHandler) - m_previousHandler->OnBeginDragLeft(x, y, keys, attachment); -} - -void wxShapeEvtHandler::OnEndDragLeft(float x, float y, int keys, int attachment) -{ - if (m_previousHandler) - m_previousHandler->OnEndDragLeft(x, y, keys, attachment); -} - -void wxShapeEvtHandler::OnDragRight(bool draw, float x, float y, int keys, int attachment) -{ - if (m_previousHandler) - m_previousHandler->OnDragRight(draw, x, y, keys, attachment); -} - -void wxShapeEvtHandler::OnBeginDragRight(float x, float y, int keys, int attachment) -{ - if (m_previousHandler) - m_previousHandler->OnBeginDragRight(x, y, keys, attachment); -} - -void wxShapeEvtHandler::OnEndDragRight(float x, float y, int keys, int attachment) -{ - if (m_previousHandler) - m_previousHandler->OnEndDragRight(x, y, keys, attachment); -} - -void wxShapeEvtHandler::OnDrawOutline(wxDC& dc, float x, float y, float w, float h) -{ - if (m_previousHandler) - m_previousHandler->OnDrawOutline(dc, x, y, w, h); -} - -void wxShapeEvtHandler::OnDrawControlPoints(wxDC& dc) -{ - if (m_previousHandler) - m_previousHandler->OnDrawControlPoints(dc); -} - -void wxShapeEvtHandler::OnEraseControlPoints(wxDC& dc) -{ - if (m_previousHandler) - m_previousHandler->OnEraseControlPoints(dc); -} - -IMPLEMENT_ABSTRACT_CLASS(wxShape, wxShapeEvtHandler) - -wxShape::wxShape(wxShapeCanvas *can) -{ - m_eventHandler = this; - SetHandlerShape(this); - m_id = 0; - m_formatted = FALSE; - m_canvas = can; - m_xpos = 0.0; m_ypos = 0.0; - m_pen = black_pen; - m_brush = wxWHITE_BRUSH; - m_font = g_oglNormalFont; - m_textColour = wxBLACK; - m_textColourName = "BLACK"; - m_visible = FALSE; - m_clientData = NULL; - m_selected = FALSE; - m_attachmentMode = FALSE; - m_spaceAttachments = TRUE; - m_disableLabel = FALSE; - m_fixedWidth = FALSE; - m_fixedHeight = FALSE; - m_drawHandles = TRUE; - m_sensitivity = OP_ALL; - m_draggable = TRUE; - m_parent = NULL; - m_formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT; - m_shadowMode = SHADOW_NONE; - m_shadowOffsetX = 6.0; - m_shadowOffsetY = 6.0; - m_shadowBrush = wxBLACK_BRUSH; - m_textMarginX = 5.0; - m_textMarginY = 5.0; - m_regionName = "0"; - m_centreResize = TRUE; - m_highlighted = FALSE; - m_rotation = 0.0; - - // Set up a default region. Much of the above will be put into - // the region eventually (the duplication is for compatibility) - wxShapeRegion *region = new wxShapeRegion; - m_regions.Append(region); - region->SetName("0"); - region->SetFont(g_oglNormalFont); - region->SetFormatMode(FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT); - region->SetColour("BLACK"); -} - -wxShape::~wxShape() -{ - if (m_parent) - m_parent->GetChildren().DeleteObject(this); - - ClearText(); - ClearRegions(); - ClearAttachments(); - - if (m_canvas) - m_canvas->RemoveShape(this); - - GetEventHandler()->OnDelete(); -} - -void wxShape::SetHighlight(bool hi, bool recurse) -{ - m_highlighted = hi; - if (recurse) - { - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->SetHighlight(hi, recurse); - node = node->Next(); - } - } -} - -void wxShape::SetSensitivityFilter(int sens, bool recursive) -{ - if (sens & OP_DRAG_LEFT) - m_draggable = TRUE; - else - m_draggable = FALSE; - - m_sensitivity = sens; - if (recursive) - { - wxNode *node = m_children.First(); - while (node) - { - wxShape *obj = (wxShape *)node->Data(); - obj->SetSensitivityFilter(sens, TRUE); - node = node->Next(); - } - } -} - -void wxShape::SetDraggable(bool drag, bool recursive) -{ - m_draggable = drag; - if (m_draggable) - m_sensitivity |= OP_DRAG_LEFT; - else - if (m_sensitivity & OP_DRAG_LEFT) - m_sensitivity = m_sensitivity - OP_DRAG_LEFT; - - if (recursive) - { - wxNode *node = m_children.First(); - while (node) - { - wxShape *obj = (wxShape *)node->Data(); - obj->SetDraggable(drag, TRUE); - node = node->Next(); - } - } -} - -void wxShape::SetDrawHandles(bool drawH) -{ - m_drawHandles = drawH; - wxNode *node = m_children.First(); - while (node) - { - wxShape *obj = (wxShape *)node->Data(); - obj->SetDrawHandles(drawH); - node = node->Next(); - } -} - -void wxShape::SetShadowMode(int mode, bool redraw) -{ - if (redraw && GetCanvas()) - { - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - Erase(dc); - - m_shadowMode = mode; - - Draw(dc); - } - else - { - m_shadowMode = mode; - } -} - -void wxShape::SetCanvas(wxShapeCanvas *theCanvas) -{ - m_canvas = theCanvas; - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->SetCanvas(theCanvas); - node = node->Next(); - } -} - -void wxShape::AddToCanvas(wxShapeCanvas *theCanvas, wxShape *addAfter) -{ - theCanvas->AddShape(this, addAfter); - wxNode *node = m_children.First(); - wxShape *lastImage = this; - while (node) - { - wxShape *object = (wxShape *)node->Data(); - object->AddToCanvas(theCanvas, lastImage); - lastImage = object; - - node = node->Next(); - } -} - -// Insert at front of canvas -void wxShape::InsertInCanvas(wxShapeCanvas *theCanvas) -{ - theCanvas->InsertShape(this); - wxNode *node = m_children.First(); - wxShape *lastImage = this; - while (node) - { - wxShape *object = (wxShape *)node->Data(); - object->AddToCanvas(theCanvas, lastImage); - lastImage = object; - - node = node->Next(); - } -} - -void wxShape::RemoveFromCanvas(wxShapeCanvas *theCanvas) -{ - if (Selected()) - Select(FALSE); - theCanvas->RemoveShape(this); - wxNode *node = m_children.First(); - while (node) - { - wxShape *object = (wxShape *)node->Data(); - object->RemoveFromCanvas(theCanvas); - - node = node->Next(); - } -} - -void wxShape::ClearAttachments() -{ - wxNode *node = m_attachmentPoints.First(); - while (node) - { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); - delete point; - node = node->Next(); - } - m_attachmentPoints.Clear(); -} - -void wxShape::ClearText(int regionId) -{ - if (regionId == 0) - { - m_text.DeleteContents(TRUE); - m_text.Clear(); - m_text.DeleteContents(FALSE); - } - wxNode *node = m_regions.Nth(regionId); - if (!node) - return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - region->ClearText(); -} - -void wxShape::ClearRegions() -{ - wxNode *node = m_regions.First(); - while (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - wxNode *next = node->Next(); - delete region; - delete node; - node = next; - } -} - -void wxShape::AddRegion(wxShapeRegion *region) -{ - m_regions.Append(region); -} - -void wxShape::SetDefaultRegionSize() -{ - wxNode *node = m_regions.First(); - if (!node) return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - float w, h; - GetBoundingBoxMin(&w, &h); - region->SetSize(w, h); -} - -bool wxShape::HitTest(float x, float y, int *attachment, float *distance) -{ -// if (!sensitive) -// return FALSE; - - float width = 0.0, height = 0.0; - GetBoundingBoxMin(&width, &height); - if (fabs(width) < 4.0) width = 4.0; - if (fabs(height) < 4.0) height = 4.0; - - width += (float)4.0; height += (float)4.0; // Allowance for inaccurate mousing - - float left = (float)(m_xpos - (width/2.0)); - float top = (float)(m_ypos - (height/2.0)); - float right = (float)(m_xpos + (width/2.0)); - float bottom = (float)(m_ypos + (height/2.0)); - - int nearest_attachment = 0; - - - // If within the bounding box, check the attachment points - // within the object. - - if (x >= left && x <= right && y >= top && y <= bottom) - { - int n = GetNumberOfAttachments(); - float nearest = 999999.0; - - for (int i = 0; i < n; i++) - { - float xp, yp; - if (GetAttachmentPosition(i, &xp, &yp)) - { - float l = (float)sqrt(((xp - x) * (xp - x)) + - ((yp - y) * (yp - y))); - - if (l < nearest) - { - nearest = l; - nearest_attachment = i; - } - } - } - *attachment = nearest_attachment; - *distance = nearest; - return TRUE; - } - else return FALSE; -} - -// Format a text string according to the region size, adding -// strings with positions to region text list - -static bool GraphicsInSizeToContents = FALSE; // Infinite recursion elimination -void wxShape::FormatText(wxDC& dc, const wxString& s, int i) -{ - float w, h; - ClearText(i); - - if (m_regions.Number() < 1) - return; - wxNode *node = m_regions.Nth(i); - if (!node) - return; - - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - region->SetText(s); - dc.SetFont(region->GetFont()); - - region->GetSize(&w, &h); - - wxList *string_list = ::FormatText(dc, s, (w-5), (h-5), region->GetFormatMode()); - node = string_list->First(); - while (node) - { - char *s = (char *)node->Data(); - wxShapeTextLine *line = new wxShapeTextLine(0.0, 0.0, s); - region->GetFormattedText().Append((wxObject *)line); - delete node; - node = string_list->First(); - } - delete string_list; - float actualW = w; - float actualH = h; - // Don't try to resize an object with more than one image (this case should be dealt - // with by overriden handlers) - if ((region->GetFormatMode() & FORMAT_SIZE_TO_CONTENTS) && - (region->GetFormattedText().Number() > 0) && - (m_regions.Number() == 1) && !GraphicsInSizeToContents) - { - GetCentredTextExtent(dc, &(region->GetFormattedText()), m_xpos, m_ypos, w, h, &actualW, &actualH); - if ((actualW+m_textMarginX != w ) || (actualH+m_textMarginY != h)) - { - // If we are a descendant of a composite, must make sure the composite gets - // resized properly - wxShape *topAncestor = GetTopAncestor(); - - if (topAncestor != this) - { - // Make sure we don't recurse infinitely - GraphicsInSizeToContents = TRUE; - - wxCompositeShape *composite = (wxCompositeShape *)topAncestor; - composite->Erase(dc); - SetSize(actualW+m_textMarginX, actualH+m_textMarginY); - Move(dc, m_xpos, m_ypos); - composite->CalculateSize(); - if (composite->Selected()) - { - composite->DeleteControlPoints(& dc); - composite->MakeControlPoints(); - composite->MakeMandatoryControlPoints(); - } - // Where infinite recursion might happen if we didn't stop it - composite->Draw(dc); - - GraphicsInSizeToContents = FALSE; - } - else - { - Erase(dc); - SetSize(actualW+m_textMarginX, actualH+m_textMarginY); - Move(dc, m_xpos, m_ypos); - } - SetSize(actualW+m_textMarginX, actualH+m_textMarginY); - Move(dc, m_xpos, m_ypos); - EraseContents(dc); - } - } - CentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, actualW, actualH, region->GetFormatMode()); - m_formatted = TRUE; -} - -void wxShape::Recentre(wxDC& dc) -{ - float w, h; - GetBoundingBoxMin(&w, &h); - - int noRegions = m_regions.Number(); - for (int i = 0; i < noRegions; i++) - { - wxNode *node = m_regions.Nth(i); - if (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - CentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, w, h, region->GetFormatMode()); - } - } -} - -bool wxShape::GetPerimeterPoint(float x1, float y1, - float x2, float y2, - float *x3, float *y3) -{ - return FALSE; -} - -void wxShape::SetPen(wxPen *the_pen) -{ - m_pen = the_pen; -} - -void wxShape::SetBrush(wxBrush *the_brush) -{ - m_brush = the_brush; -} - -// Get the top-most (non-division) ancestor, or self -wxShape *wxShape::GetTopAncestor() -{ - if (!GetParent()) - return this; - - if (GetParent()->IsKindOf(CLASSINFO(wxDivisionShape))) - return this; - else return GetParent()->GetTopAncestor(); -} - -/* - * Region functions - * - */ -void wxShape::SetFont(wxFont *the_font, int regionId) -{ - m_font = the_font; - wxNode *node = m_regions.Nth(regionId); - if (!node) - return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - region->SetFont(the_font); -} - -wxFont *wxShape::GetFont(int n) const -{ - wxNode *node = m_regions.Nth(n); - if (!node) - return NULL; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - return region->GetFont(); -} - -void wxShape::SetFormatMode(int mode, int regionId) -{ - wxNode *node = m_regions.Nth(regionId); - if (!node) - return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - region->SetFormatMode(mode); -} - -int wxShape::GetFormatMode(int regionId) const -{ - wxNode *node = m_regions.Nth(regionId); - if (!node) - return 0; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - return region->GetFormatMode(); -} - -void wxShape::SetTextColour(const wxString& the_colour, int regionId) -{ - wxColour *wxcolour = wxTheColourDatabase->FindColour(the_colour); - m_textColour = wxcolour; - m_textColourName = the_colour; - - wxNode *node = m_regions.Nth(regionId); - if (!node) - return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - region->SetColour(the_colour); -} - -wxString wxShape::GetTextColour(int regionId) const -{ - wxNode *node = m_regions.Nth(regionId); - if (!node) - return wxString(""); - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - return region->GetColour(); -} - -void wxShape::SetRegionName(const wxString& name, int regionId) -{ - wxNode *node = m_regions.Nth(regionId); - if (!node) - return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - region->SetName(name); -} - -wxString wxShape::GetRegionName(int regionId) -{ - wxNode *node = m_regions.Nth(regionId); - if (!node) - return wxString(""); - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - return region->GetName(); -} - -int wxShape::GetRegionId(const wxString& name) -{ - wxNode *node = m_regions.First(); - int i = 0; - while (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - if (region->GetName() == name) - return i; - node = node->Next(); - i ++; - } - return -1; -} - -// Name all m_regions in all subimages recursively. -void wxShape::NameRegions(const wxString& parentName) -{ - int n = GetNumberOfTextRegions(); - char buf[100]; - for (int i = 0; i < n; i++) - { - if (parentName.Length() > 0) - sprintf(buf, "%s.%d", (const char*) parentName, i); - else - sprintf(buf, "%d", i); - SetRegionName(buf, i); - } - wxNode *node = m_children.First(); - int j = 0; - while (node) - { - wxShape *child = (wxShape *)node->Data(); - if (parentName.Length() > 0) - sprintf(buf, "%s.%d", (const char*) parentName, j); - else - sprintf(buf, "%d", j); - child->NameRegions(buf); - node = node->Next(); - j ++; - } -} - -// Get a region by name, possibly looking recursively into composites. -wxShape *wxShape::FindRegion(const wxString& name, int *regionId) -{ - int id = GetRegionId(name); - if (id > -1) - { - *regionId = id; - return this; - } - - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - wxShape *actualImage = child->FindRegion(name, regionId); - if (actualImage) - return actualImage; - node = node->Next(); - } - return NULL; -} - -// Finds all region names for this image (composite or simple). -// Supply empty string list. -void wxShape::FindRegionNames(wxStringList& list) -{ - int n = GetNumberOfTextRegions(); - for (int i = 0; i < n; i++) - { - wxString name(GetRegionName(i)); - list.Add((const char*) name); - } - - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->FindRegionNames(list); - node = node->Next(); - } -} - -void wxShape::AssignNewIds() -{ - if (m_id == 0) - m_id = NewId(); - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->AssignNewIds(); - node = node->Next(); - } -} - -void wxShape::OnDraw(wxDC& dc) -{ -} - -void wxShape::OnMoveLinks(wxDC& dc) -{ - // Want to set the ends of all attached links - // to point to/from this object - - wxNode *current = m_lines.First(); - while (current) - { - wxLineShape *line = (wxLineShape *)current->Data(); - line->GetEventHandler()->OnMoveLink(dc); - current = current->Next(); - } -} - - -void wxShape::OnDrawContents(wxDC& dc) -{ - float bound_x, bound_y; - GetBoundingBoxMin(&bound_x, &bound_y); - if (m_regions.Number() < 1) return; - - if (m_pen) dc.SetPen(m_pen); - - wxShapeRegion *region = (wxShapeRegion *)m_regions.First()->Data(); - if (region->GetFont()) dc.SetFont(region->GetFont()); - - dc.SetTextForeground(* (region->GetActualColourObject())); - dc.SetBackgroundMode(wxTRANSPARENT); - if (!m_formatted) - { - CentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, bound_x, bound_y, region->GetFormatMode()); - m_formatted = TRUE; - } - if (!GetDisableLabel()) - { - DrawFormattedText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, bound_x, bound_y, region->GetFormatMode()); - } -} - -void wxShape::DrawContents(wxDC& dc) -{ - GetEventHandler()->OnDrawContents(dc); -} - -void wxShape::OnSize(float x, float y) -{ -} - -bool wxShape::OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display) -{ - return TRUE; -} - -void wxShape::OnMovePost(wxDC& dc, float x, float y, float old_x, float old_y, bool display) -{ -} - -void wxShape::OnErase(wxDC& dc) -{ - if (!m_visible) - return; - - // Erase links - wxNode *current = m_lines.First(); - while (current) - { - wxLineShape *line = (wxLineShape *)current->Data(); - line->GetEventHandler()->OnErase(dc); - current = current->Next(); - } - GetEventHandler()->OnEraseContents(dc); -} - -void wxShape::OnEraseContents(wxDC& dc) -{ - if (!m_visible) - return; - - float maxX, maxY, minX, minY; - float xp = GetX(); - float yp = GetY(); - GetBoundingBoxMin(&minX, &minY); - GetBoundingBoxMax(&maxX, &maxY); - float topLeftX = (float)(xp - (maxX / 2.0) - 2.0); - float topLeftY = (float)(yp - (maxY / 2.0) - 2.0); - - int penWidth = 0; - if (m_pen) - penWidth = m_pen->GetWidth(); - - dc.SetPen(white_background_pen); - dc.SetBrush(white_background_brush); - dc.DrawRectangle((float)(topLeftX - penWidth), (float)(topLeftY - penWidth), - (float)(maxX + penWidth*2.0 + 4.0), (float)(maxY + penWidth*2.0 + 4.0)); -} - -void wxShape::EraseLinks(wxDC& dc, int attachment, bool recurse) -{ - if (!m_visible) - return; - - wxNode *current = m_lines.First(); - while (current) - { - wxLineShape *line = (wxLineShape *)current->Data(); - if (attachment == -1 || ((line->GetTo() == this && line->GetAttachmentTo() == attachment) || - (line->GetFrom() == this && line->GetAttachmentFrom() == attachment))) - line->GetEventHandler()->OnErase(dc); - current = current->Next(); - } - if (recurse) - { - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->EraseLinks(dc, attachment, recurse); - node = node->Next(); - } - } -} - -void wxShape::DrawLinks(wxDC& dc, int attachment, bool recurse) -{ - if (!m_visible) - return; - - wxNode *current = m_lines.First(); - while (current) - { - wxLineShape *line = (wxLineShape *)current->Data(); - if (attachment == -1 || - (line->GetTo() == this && line->GetAttachmentTo() == attachment) || - (line->GetFrom() == this && line->GetAttachmentFrom() == attachment)) - line->Draw(dc); - current = current->Next(); - } - if (recurse) - { - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->DrawLinks(dc, attachment, recurse); - node = node->Next(); - } - } -} - -void wxShape::MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move, - float x, float y) -{ - int new_point; - float distance; - - // Is (x, y) on this object? If so, find the new attachment point - // the user has moved the point to - bool hit = HitTest(x, y, &new_point, &distance); - if (!hit) - return; - - EraseLinks(dc); - - int old_attachment; - if (to_move->GetTo() == this) - old_attachment = to_move->GetAttachmentTo(); - else - old_attachment = to_move->GetAttachmentFrom(); - - // Delete the line object from the list of links; we're going to move - // it to another position in the list - m_lines.DeleteObject(to_move); - - float old_x = (float) -9999.9; - float old_y = (float) -9999.9; - - wxNode *node = m_lines.First(); - bool found = FALSE; - - while (node && !found) - { - wxLineShape *line = (wxLineShape *)node->Data(); - if ((line->GetTo() == this && old_attachment == line->GetAttachmentTo()) || - (line->GetFrom() == this && old_attachment == line->GetAttachmentFrom())) - { - float startX, startY, endX, endY; - float xp, yp; - line->GetEnds(&startX, &startY, &endX, &endY); - if (line->GetTo() == this) - { -// xp = line->m_xpos2 + line->m_xpos; -// yp = line->m_ypos2 + line->m_ypos; - xp = startX; - yp = startY; - } else - { -// xp = line->m_xpos1 + line->m_xpos; -// yp = line->m_ypos1 + line->m_ypos; - xp = endX; - yp = endY; - } - - switch (old_attachment) - { - case 0: - case 2: - { - if (x > old_x && x <= xp) - { - found = TRUE; - m_lines.Insert(node, to_move); - } - break; - } - case 1: - case 3: - { - if (y > old_y && y <= yp) - { - found = TRUE; - m_lines.Insert(node, to_move); - } - break; - } - } - old_x = xp; - old_y = yp; - } - node = node->Next(); - } - if (!found) - m_lines.Append(to_move); -} - -// Reorders the lines coming into the node image at this attachment -// position, in the order in which they appear in linesToSort. -// Any remaining lines not in the list will be added to the end. -void wxShape::SortLines(int attachment, wxList& linesToSort) -{ - // This is a temporary store of all the lines at this attachment - // point. We'll tick them off as we've processed them. - wxList linesAtThisAttachment; - - wxNode *node = m_lines.First(); - while (node) - { - wxLineShape *line = (wxLineShape *)node->Data(); - wxNode *next = node->Next(); - if ((line->GetTo() == this && line->GetAttachmentTo() == attachment) || - (line->GetFrom() == this && line->GetAttachmentFrom() == attachment)) - { - linesAtThisAttachment.Append(line); - delete node; - node = next; - } - else node = node->Next(); - } - - node = linesToSort.First(); - while (node) - { - wxLineShape *line = (wxLineShape *)node->Data(); - if (linesAtThisAttachment.Member(line)) - { - // Done this one - linesAtThisAttachment.DeleteObject(line); - m_lines.Append(line); - } - node = node->Next(); - } - - // Now add any lines that haven't been listed in linesToSort. - node = linesAtThisAttachment.First(); - while (node) - { - wxLineShape *line = (wxLineShape *)node->Data(); - m_lines.Append(line); - node = node->Next(); - } -} - -void wxShape::OnHighlight(wxDC& dc) -{ -} - -void wxShape::OnLeftClick(float x, float y, int keys, int attachment) -{ - if ((m_sensitivity & OP_CLICK_LEFT) != OP_CLICK_LEFT) - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnLeftClick(x, y, keys, attachment); - } - return; - } -} - -void wxShape::OnRightClick(float x, float y, int keys, int attachment) -{ - if ((m_sensitivity & OP_CLICK_RIGHT) != OP_CLICK_RIGHT) - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnRightClick(x, y, keys, attachment); - } - return; - } -} - -float DragOffsetX = 0.0; -float DragOffsetY = 0.0; - -void wxShape::OnDragLeft(bool draw, float x, float y, int keys, int attachment) -{ - if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT) - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnDragLeft(draw, x, y, keys, attachment); - } - return; - } - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - dc.SetLogicalFunction(wxXOR); - - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush(* wxTRANSPARENT_BRUSH); - - float xx, yy; - xx = x + DragOffsetX; - yy = y + DragOffsetY; - - m_canvas->Snap(&xx, &yy); -// m_xpos = xx; m_ypos = yy; - float w, h; - GetBoundingBoxMax(&w, &h); - GetEventHandler()->OnDrawOutline(dc, xx, yy, w, h); -} - -void wxShape::OnBeginDragLeft(float x, float y, int keys, int attachment) -{ - if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT) - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnBeginDragLeft(x, y, keys, attachment); - } - return; - } - - DragOffsetX = m_xpos - x; - DragOffsetY = m_ypos - y; - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - Erase(dc); - float xx, yy; - xx = x + DragOffsetX; - yy = y + DragOffsetY; - m_canvas->Snap(&xx, &yy); -// m_xpos = xx; m_ypos = yy; - dc.SetLogicalFunction(wxXOR); - - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush((* wxTRANSPARENT_BRUSH)); - - float w, h; - GetBoundingBoxMax(&w, &h); - GetEventHandler()->OnDrawOutline(dc, xx, yy, w, h); - m_canvas->CaptureMouse(); -} - -void wxShape::OnEndDragLeft(float x, float y, int keys, int attachment) -{ - m_canvas->ReleaseMouse(); - if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT) - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnEndDragLeft(x, y, keys, attachment); - } - return; - } - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - dc.SetLogicalFunction(wxCOPY); - - float xx = x + DragOffsetX; - float yy = y + DragOffsetY; - m_canvas->Snap(&xx, &yy); -// canvas->Snap(&m_xpos, &m_ypos); - Move(dc, xx, yy); - if (m_canvas && !m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc); -} - -void wxShape::OnDragRight(bool draw, float x, float y, int keys, int attachment) -{ - if ((m_sensitivity & OP_DRAG_RIGHT) != OP_DRAG_RIGHT) - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnDragRight(draw, x, y, keys, attachment); - } - return; - } -} - -void wxShape::OnBeginDragRight(float x, float y, int keys, int attachment) -{ - if ((m_sensitivity & OP_DRAG_RIGHT) != OP_DRAG_RIGHT) - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnBeginDragRight(x, y, keys, attachment); - } - return; - } -} - -void wxShape::OnEndDragRight(float x, float y, int keys, int attachment) -{ - if ((m_sensitivity & OP_DRAG_RIGHT) != OP_DRAG_RIGHT) - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnEndDragRight(x, y, keys, attachment); - } - return; - } -} - -void wxShape::OnDrawOutline(wxDC& dc, float x, float y, float w, float h) -{ - float top_left_x = (float)(x - w/2.0); - float top_left_y = (float)(y - h/2.0); - float top_right_x = (float)(top_left_x + w); - float top_right_y = (float)top_left_y; - float bottom_left_x = (float)top_left_x; - float bottom_left_y = (float)(top_left_y + h); - float bottom_right_x = (float)top_right_x; - float bottom_right_y = (float)bottom_left_y; - - wxPoint points[5]; - points[0].x = top_left_x; points[0].y = top_left_y; - points[1].x = top_right_x; points[1].y = top_right_y; - points[2].x = bottom_right_x; points[2].y = bottom_right_y; - points[3].x = bottom_left_x; points[3].y = bottom_left_y; - points[4].x = top_left_x; points[4].y = top_left_y; - - dc.DrawLines(5, points); -} - -void wxShape::Attach(wxShapeCanvas *can) -{ - m_canvas = can; -} - -void wxShape::Detach() -{ - m_canvas = NULL; -} - -void wxShape::Move(wxDC& dc, float x, float y, bool display) -{ - float old_x = m_xpos; - float old_y = m_ypos; - - m_xpos = x; m_ypos = y; - - if (!GetEventHandler()->OnMovePre(dc, x, y, old_x, old_y, display)) - { - m_xpos = old_x; - m_ypos = old_y; - return; - } - - ResetControlPoints(); - - if (display) - Draw(dc); - - MoveLinks(dc); - - GetEventHandler()->OnMovePost(dc, x, y, old_x, old_y, display); -} - -void wxShape::MoveLinks(wxDC& dc) -{ - GetEventHandler()->OnMoveLinks(dc); -} - - -void wxShape::Draw(wxDC& dc) -{ - if (m_visible) - { - GetEventHandler()->OnDraw(dc); - GetEventHandler()->OnDrawContents(dc); - GetEventHandler()->OnDrawControlPoints(dc); - } -} - -void wxShape::Flash() -{ - if (GetCanvas()) - { - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - dc.SetLogicalFunction(wxXOR); - Draw(dc); - dc.SetLogicalFunction(wxCOPY); - Draw(dc); - } -} - -void wxShape::Show(bool show) -{ - m_visible = show; - wxNode *node = m_children.First(); - while (node) - { - wxShape *image = (wxShape *)node->Data(); - image->Show(show); - node = node->Next(); - } -} - -void wxShape::Erase(wxDC& dc) -{ - GetEventHandler()->OnErase(dc); - GetEventHandler()->OnEraseControlPoints(dc); -} - -void wxShape::EraseContents(wxDC& dc) -{ - GetEventHandler()->OnEraseContents(dc); -} - -void wxShape::AddText(const wxString& string) -{ - wxNode *node = m_regions.First(); - if (!node) - return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - region->ClearText(); - wxShapeTextLine *new_line = - new wxShapeTextLine(0.0, 0.0, string); - region->GetFormattedText().Append(new_line); - - m_formatted = FALSE; -} - -void wxShape::SetSize(float x, float y, bool recursive) -{ - SetAttachmentSize(x, y); - SetDefaultRegionSize(); -} - -void wxShape::SetAttachmentSize(float w, float h) -{ - float scaleX; - float scaleY; - float width, height; - GetBoundingBoxMin(&width, &height); - if (width == 0.0) - scaleX = 1.0; - else scaleX = w/width; - if (height == 0.0) - scaleY = 1.0; - else scaleY = h/height; - - wxNode *node = m_attachmentPoints.First(); - while (node) - { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); - point->m_x = (float)(point->m_x * scaleX); - point->m_y = (float)(point->m_y * scaleY); - node = node->Next(); - } -} - -// Add line FROM this object -void wxShape::AddLine(wxLineShape *line, wxShape *other, - int attachFrom, int attachTo) -{ - if (!m_lines.Member(line)) - m_lines.Append(line); - - if (!other->m_lines.Member(line)) - other->m_lines.Append(line); - - line->SetFrom(this); - line->SetTo(other); - line->SetAttachments(attachFrom, attachTo); -} - -void wxShape::RemoveLine(wxLineShape *line) -{ - if (line->GetFrom() == this) - line->GetTo()->m_lines.DeleteObject(line); - else - line->GetFrom()->m_lines.DeleteObject(line); - - m_lines.DeleteObject(line); -} - -#ifdef PROLOGIO -char *wxShape::GetFunctor() -{ - return "node_image"; -} - -void wxShape::WritePrologAttributes(wxExpr *clause) -{ - clause->AddAttributeValueString("type", GetClassInfo()->GetClassName()); - clause->AddAttributeValue("id", m_id); - - if (m_pen) - { - int penWidth = m_pen->GetWidth(); - int penStyle = m_pen->GetStyle(); - if (penWidth != 1) - clause->AddAttributeValue("pen_width", (long)penWidth); - if (penStyle != wxSOLID) - clause->AddAttributeValue("pen_style", (long)penStyle); - - wxString penColour = wxTheColourDatabase->FindName(m_pen->GetColour()); - if ((penColour != "") && (penColour != "BLACK")) - clause->AddAttributeValueString("pen_colour", penColour); - } - - if (m_brush) - { - wxString brushColour = wxTheColourDatabase->FindName(m_brush->GetColour()); - - if ((brushColour != "") && (brushColour != "WHITE")) - clause->AddAttributeValueString("brush_colour", brushColour); - - if (m_brush->GetStyle() != wxSOLID) - clause->AddAttributeValue("brush_style", (long)m_brush->GetStyle()); - } - - // Output line ids - - int n_lines = m_lines.Number(); - if (n_lines > 0) - { - wxExpr *list = new wxExpr(PrologList); - wxNode *node = m_lines.First(); - while (node) - { - wxShape *line = (wxShape *)node->Data(); - wxExpr *id_expr = new wxExpr(line->GetId()); - list->Append(id_expr); - node = node->Next(); - } - clause->AddAttributeValue("arcs", list); - } - - // Miscellaneous members - if (m_attachmentMode != 0) - clause->AddAttributeValue("use_attachments", (long)m_attachmentMode); - if (m_sensitivity != OP_ALL) - clause->AddAttributeValue("sensitivity", (long)m_sensitivity); - if (!m_spaceAttachments) - clause->AddAttributeValue("space_attachments", (long)m_spaceAttachments); - if (m_fixedWidth) - clause->AddAttributeValue("fixed_width", (long)m_fixedWidth); - if (m_fixedHeight) - clause->AddAttributeValue("fixed_height", (long)m_fixedHeight); - if (m_shadowMode != SHADOW_NONE) - clause->AddAttributeValue("shadow_mode", (long)m_shadowMode); - if (m_centreResize != TRUE) - clause->AddAttributeValue("centre_resize", (long)0); - if (m_highlighted != FALSE) - clause->AddAttributeValue("hilite", (long)m_highlighted); - - if (m_parent) // For composite objects - clause->AddAttributeValue("parent", (long)m_parent->GetId()); - - if (m_rotation != 0.0) - clause->AddAttributeValue("rotation", m_rotation); - - // Write user-defined attachment points, if any - if (m_attachmentPoints.Number() > 0) - { - wxExpr *attachmentList = new wxExpr(PrologList); - wxNode *node = m_attachmentPoints.First(); - while (node) - { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); - wxExpr *pointExpr = new wxExpr(PrologList); - pointExpr->Append(new wxExpr((long)point->m_id)); - pointExpr->Append(new wxExpr(point->m_x)); - pointExpr->Append(new wxExpr(point->m_y)); - attachmentList->Append(pointExpr); - node = node->Next(); - } - clause->AddAttributeValue("user_attachments", attachmentList); - } - - // Write text regions - WriteRegions(clause); -} - -void wxShape::WriteRegions(wxExpr *clause) -{ - // Output regions as region1 = (...), region2 = (...), etc - // and formatted text as text1 = (...), text2 = (...) etc. - int regionNo = 1; - char regionNameBuf[20]; - char textNameBuf[20]; - wxNode *node = m_regions.First(); - while (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - sprintf(regionNameBuf, "region%d", regionNo); - sprintf(textNameBuf, "text%d", regionNo); - - // Original text and region attributes: - // region1 = (regionName regionText x y width height minWidth minHeight proportionX proportionY - // formatMode fontSize fontFamily fontStyle fontWeight textColour) - wxExpr *regionExpr = new wxExpr(PrologList); - regionExpr->Append(new wxExpr(PrologString, (region->m_regionName ? region->m_regionName : ""))); - regionExpr->Append(new wxExpr(PrologString, (region->m_regionText ? region->m_regionText : ""))); - - regionExpr->Append(new wxExpr(region->m_x)); - regionExpr->Append(new wxExpr(region->m_y)); - regionExpr->Append(new wxExpr(region->GetWidth())); - regionExpr->Append(new wxExpr(region->GetHeight())); - - regionExpr->Append(new wxExpr(region->m_minWidth)); - regionExpr->Append(new wxExpr(region->m_minHeight)); - regionExpr->Append(new wxExpr(region->m_regionProportionX)); - regionExpr->Append(new wxExpr(region->m_regionProportionY)); - - regionExpr->Append(new wxExpr((long)region->m_formatMode)); - - regionExpr->Append(new wxExpr((long)(region->m_font ? region->m_font->GetPointSize() : 10))); - regionExpr->Append(new wxExpr((long)(region->m_font ? region->m_font->GetFamily() : wxDEFAULT))); - regionExpr->Append(new wxExpr((long)(region->m_font ? region->m_font->GetStyle() : wxDEFAULT))); - regionExpr->Append(new wxExpr((long)(region->m_font ? region->m_font->GetWeight() : wxNORMAL))); - regionExpr->Append(new wxExpr(PrologString, region->m_textColour ? region->m_textColour : "BLACK")); - - // New members for pen colour/style - regionExpr->Append(new wxExpr(PrologString, region->m_penColour ? region->m_penColour : "BLACK")); - regionExpr->Append(new wxExpr((long)region->m_penStyle)); - - // Formatted text: - // text1 = ((x y string) (x y string) ...) - wxExpr *textExpr = new wxExpr(PrologList); - - wxNode *textNode = region->m_formattedText.First(); - while (textNode) - { - wxShapeTextLine *line = (wxShapeTextLine *)textNode->Data(); - wxExpr *list2 = new wxExpr(PrologList); - list2->Append(new wxExpr(line->GetX())); - list2->Append(new wxExpr(line->GetY())); - list2->Append(new wxExpr(PrologString, line->GetText())); - textExpr->Append(list2); - textNode = textNode->Next(); - } - - // Now add both attributes to the clause - clause->AddAttributeValue(regionNameBuf, regionExpr); - clause->AddAttributeValue(textNameBuf, textExpr); - - node = node->Next(); - regionNo ++; - } -} - -void wxShape::ReadPrologAttributes(wxExpr *clause) -{ - clause->GetAttributeValue("id", m_id); - RegisterId(m_id); - - clause->GetAttributeValue("x", m_xpos); - clause->GetAttributeValue("y", m_ypos); - - // Input text strings (FOR COMPATIBILITY WITH OLD FILES ONLY. SEE REGION CODE BELOW.) - ClearText(); - wxExpr *strings = clause->AttributeValue("text"); - if (strings && strings->Type() == PrologList) - { - m_formatted = TRUE; // Assume text is formatted unless we prove otherwise - wxExpr *node = strings->value.first; - while (node) - { - wxExpr *string_expr = node; - float the_x = 0.0; - float the_y = 0.0; - wxString the_string(""); - - // string_expr can either be a string, or a list of - // 3 elements: x, y, and string. - if (string_expr->Type() == PrologString) - { - the_string = string_expr->StringValue(); - m_formatted = FALSE; - } - else if (string_expr->Type() == PrologList) - { - wxExpr *first = string_expr->value.first; - wxExpr *second = first ? first->next : NULL; - wxExpr *third = second ? second->next : NULL; - - if (first && second && third && - (first->Type() == PrologReal || first->Type() == PrologInteger) && - (second->Type() == PrologReal || second->Type() == PrologInteger) && - third->Type() == PrologString) - { - if (first->Type() == PrologReal) - the_x = first->RealValue(); - else the_x = (float)first->IntegerValue(); - - if (second->Type() == PrologReal) - the_y = second->RealValue(); - else the_y = (float)second->IntegerValue(); - - the_string = third->StringValue(); - } - } - wxShapeTextLine *line = - new wxShapeTextLine(the_x, the_y, (char*) (const char*) the_string); - m_text.Append(line); - - node = node->next; - } - } - - wxString pen_string = ""; - wxString brush_string = ""; - int pen_width = 1; - int pen_style = wxSOLID; - int brush_style = wxSOLID; - m_attachmentMode = FALSE; - - clause->GetAttributeValue("pen_colour", pen_string); - clause->GetAttributeValue("text_colour", m_textColourName); - - SetTextColour(m_textColourName); - - clause->GetAttributeValue("region_name", m_regionName); - - clause->GetAttributeValue("brush_colour", brush_string); - clause->GetAttributeValue("pen_width", pen_width); - clause->GetAttributeValue("pen_style", pen_style); - clause->GetAttributeValue("brush_style", brush_style); - - int iVal = (int) m_attachmentMode; - clause->GetAttributeValue("use_attachments", iVal); - m_attachmentMode = (iVal != 0); - - clause->GetAttributeValue("sensitivity", m_sensitivity); - - iVal = (int) m_spaceAttachments; - clause->GetAttributeValue("space_attachments", iVal); - m_spaceAttachments = (iVal != 0); - - iVal = (int) m_fixedWidth; - clause->GetAttributeValue("fixed_width", iVal); - m_fixedWidth = (iVal != 0); - - iVal = (int) m_fixedHeight; - clause->GetAttributeValue("fixed_height", iVal); - m_fixedHeight = (iVal != 0); - - clause->GetAttributeValue("format_mode", m_formatMode); - clause->GetAttributeValue("shadow_mode", m_shadowMode); - - iVal = (int) m_centreResize; - clause->GetAttributeValue("centre_resize", iVal); - m_centreResize = (iVal != 0); - - iVal = (int) m_highlighted; - clause->GetAttributeValue("hilite", iVal); - m_highlighted = (iVal != 0); - - clause->GetAttributeValue("rotation", m_rotation); - - if (pen_string == "") - pen_string = "BLACK"; - if (brush_string == "") - brush_string = "WHITE"; - - m_pen = wxThePenList->FindOrCreatePen(pen_string, pen_width, pen_style); - if (!m_pen) - m_pen = wxBLACK_PEN; - - m_brush = wxTheBrushList->FindOrCreateBrush(brush_string, brush_style); - if (!m_brush) - m_brush = wxWHITE_BRUSH; - - int point_size = 10; - clause->GetAttributeValue("point_size", point_size); - SetFont(MatchFont(point_size)); - - // Read user-defined attachment points, if any - wxExpr *attachmentList = clause->AttributeValue("user_attachments"); - if (attachmentList) - { - wxExpr *pointExpr = attachmentList->GetFirst(); - while (pointExpr) - { - wxExpr *idExpr = pointExpr->Nth(0); - wxExpr *xExpr = pointExpr->Nth(1); - wxExpr *yExpr = pointExpr->Nth(2); - if (idExpr && xExpr && yExpr) - { - wxAttachmentPoint *point = new wxAttachmentPoint; - point->m_id = (int)idExpr->IntegerValue(); - point->m_x = xExpr->RealValue(); - point->m_y = yExpr->RealValue(); - m_attachmentPoints.Append((wxObject *)point); - } - pointExpr = pointExpr->GetNext(); - } - } - - // Read text regions - ReadRegions(clause); -} - -void wxShape::ReadRegions(wxExpr *clause) -{ - ClearRegions(); - - // region1 = (regionName regionText x y width height minWidth minHeight proportionX proportionY - // formatMode fontSize fontFamily fontStyle fontWeight textColour) - int regionNo = 1; - char regionNameBuf[20]; - char textNameBuf[20]; - - wxExpr *regionExpr = NULL; - wxExpr *textExpr = NULL; - sprintf(regionNameBuf, "region%d", regionNo); - sprintf(textNameBuf, "text%d", regionNo); - - m_formatted = TRUE; // Assume text is formatted unless we prove otherwise - - while (regionExpr = clause->AttributeValue(regionNameBuf)) - { - /* - * Get the region information - * - */ - - wxString regionName(""); - wxString regionText(""); - float x = 0.0; - float y = 0.0; - float width = 0.0; - float height = 0.0; - float minWidth = 5.0; - float minHeight = 5.0; - float m_regionProportionX = -1.0; - float m_regionProportionY = -1.0; - int formatMode = FORMAT_NONE; - int fontSize = 10; - int fontFamily = wxSWISS; - int fontStyle = wxNORMAL; - int fontWeight = wxNORMAL; - wxString regionTextColour(""); - wxString penColour(""); - int penStyle = wxSOLID; - - if (regionExpr->Type() == PrologList) - { - wxExpr *nameExpr = regionExpr->Nth(0); - wxExpr *textExpr = regionExpr->Nth(1); - wxExpr *xExpr = regionExpr->Nth(2); - wxExpr *yExpr = regionExpr->Nth(3); - wxExpr *widthExpr = regionExpr->Nth(4); - wxExpr *heightExpr = regionExpr->Nth(5); - wxExpr *minWidthExpr = regionExpr->Nth(6); - wxExpr *minHeightExpr = regionExpr->Nth(7); - wxExpr *propXExpr = regionExpr->Nth(8); - wxExpr *propYExpr = regionExpr->Nth(9); - wxExpr *formatExpr = regionExpr->Nth(10); - wxExpr *sizeExpr = regionExpr->Nth(11); - wxExpr *familyExpr = regionExpr->Nth(12); - wxExpr *styleExpr = regionExpr->Nth(13); - wxExpr *weightExpr = regionExpr->Nth(14); - wxExpr *colourExpr = regionExpr->Nth(15); - wxExpr *penColourExpr = regionExpr->Nth(16); - wxExpr *penStyleExpr = regionExpr->Nth(17); - - regionName = nameExpr->StringValue(); - regionText = textExpr->StringValue(); - - x = xExpr->RealValue(); - y = yExpr->RealValue(); - - width = widthExpr->RealValue(); - height = heightExpr->RealValue(); - - minWidth = minWidthExpr->RealValue(); - minHeight = minHeightExpr->RealValue(); - - m_regionProportionX = propXExpr->RealValue(); - m_regionProportionY = propYExpr->RealValue(); - - formatMode = (formatExpr->IntegerValue() != 0); - fontSize = (int)sizeExpr->IntegerValue(); - fontFamily = (int)familyExpr->IntegerValue(); - fontStyle = (int)styleExpr->IntegerValue(); - fontWeight = (int)weightExpr->IntegerValue(); - - if (colourExpr) - { - regionTextColour = colourExpr->StringValue(); - } - else - regionTextColour = "BLACK"; - - if (penColourExpr) - penColour = penColourExpr->StringValue(); - if (penStyleExpr) - penStyle = (int)penStyleExpr->IntegerValue(); - } - wxFont *font = wxTheFontList->FindOrCreateFont(fontSize, fontFamily, fontStyle, fontWeight); - - wxShapeRegion *region = new wxShapeRegion; - region->SetProportions(m_regionProportionX, m_regionProportionY); - region->SetFont(font); - region->SetSize(width, height); - region->SetPosition(x, y); - region->SetMinSize(minWidth, minHeight); - region->SetFormatMode(formatMode); - region->SetPenStyle(penStyle); - if (penColour != "") - region->SetPenColour(penColour); - - region->m_textColour = regionTextColour; - region->m_regionText = regionText; - region->m_regionName = regionName; - - m_regions.Append(region); - - /* - * Get the formatted text strings - * - */ - textExpr = clause->AttributeValue(textNameBuf); - if (textExpr && (textExpr->Type() == PrologList)) - { - wxExpr *node = textExpr->value.first; - while (node) - { - wxExpr *string_expr = node; - float the_x = 0.0; - float the_y = 0.0; - wxString the_string(""); - - // string_expr can either be a string, or a list of - // 3 elements: x, y, and string. - if (string_expr->Type() == PrologString) - { - the_string = string_expr->StringValue(); - m_formatted = FALSE; - } - else if (string_expr->Type() == PrologList) - { - wxExpr *first = string_expr->value.first; - wxExpr *second = first ? first->next : NULL; - wxExpr *third = second ? second->next : NULL; - - if (first && second && third && - (first->Type() == PrologReal || first->Type() == PrologInteger) && - (second->Type() == PrologReal || second->Type() == PrologInteger) && - third->Type() == PrologString) - { - if (first->Type() == PrologReal) - the_x = first->RealValue(); - else the_x = (float)first->IntegerValue(); - - if (second->Type() == PrologReal) - the_y = second->RealValue(); - else the_y = (float)second->IntegerValue(); - - the_string = third->StringValue(); - } - } - if (the_string) - { - wxShapeTextLine *line = - new wxShapeTextLine(the_x, the_y, (char*) (const char*) the_string); - region->m_formattedText.Append(line); - } - node = node->next; - } - } - - regionNo ++; - sprintf(regionNameBuf, "region%d", regionNo); - sprintf(textNameBuf, "text%d", regionNo); - } - - // Compatibility: check for no regions (old file). - // Lines and divided rectangles must deal with this compatibility - // theirselves. Composites _may_ not have any regions anyway. - if ((m_regions.Number() == 0) && - !this->IsKindOf(CLASSINFO(wxLineShape)) && !this->IsKindOf(CLASSINFO(wxDividedShape)) && - !this->IsKindOf(CLASSINFO(wxCompositeShape))) - { - wxShapeRegion *newRegion = new wxShapeRegion; - newRegion->SetName("0"); - m_regions.Append((wxObject *)newRegion); - if (m_text.Number() > 0) - { - newRegion->ClearText(); - wxNode *node = m_text.First(); - while (node) - { - wxShapeTextLine *textLine = (wxShapeTextLine *)node->Data(); - wxNode *next = node->Next(); - newRegion->GetFormattedText().Append((wxObject *)textLine); - delete node; - node = next; - } - } - } -} - -#endif - -void wxShape::Copy(wxShape& copy) -{ - copy.m_xpos = m_xpos; - copy.m_ypos = m_ypos; - copy.m_pen = m_pen; - copy.m_brush = m_brush; - copy.m_textColour = m_textColour; - copy.m_centreResize = m_centreResize; - copy.m_attachmentMode = m_attachmentMode; - copy.m_spaceAttachments = m_spaceAttachments; - copy.m_highlighted = m_highlighted; - copy.m_rotation = m_rotation; - copy.m_textColourName = m_textColourName; - copy.m_regionName = m_regionName; - - copy.m_sensitivity = m_sensitivity; - copy.m_draggable = m_draggable; - copy.m_fixedWidth = m_fixedWidth; - copy.m_fixedHeight = m_fixedHeight; - copy.m_formatMode = m_formatMode; - copy.m_drawHandles = m_drawHandles; - - copy.m_visible = m_visible; - copy.m_shadowMode = m_shadowMode; - copy.m_shadowOffsetX = m_shadowOffsetX; - copy.m_shadowOffsetY = m_shadowOffsetY; - copy.m_shadowBrush = m_shadowBrush; - - // Copy text regions - copy.ClearRegions(); - wxNode *node = m_regions.First(); - while (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - wxShapeRegion *newRegion = new wxShapeRegion(*region); - copy.m_regions.Append(newRegion); - node = node->Next(); - } - - // Copy attachments - copy.ClearAttachments(); - node = m_attachmentPoints.First(); - while (node) - { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); - wxAttachmentPoint *newPoint = new wxAttachmentPoint; - newPoint->m_id = point->m_id; - newPoint->m_x = point->m_x; - newPoint->m_y = point->m_y; - copy.m_attachmentPoints.Append((wxObject *)newPoint); - node = node->Next(); - } -} - -// Create and return a new, fully copied object. -wxShape *wxShape::CreateNewCopy(wxShapeCanvas *theCanvas) -{ - wxObjectCopyMapping.Clear(); - wxShape *newObject = PrivateCopy(); - if (theCanvas) - newObject->AddToCanvas(theCanvas); - newObject->Recompute(); - return newObject; -} - -// Default - make 6 control points -void wxShape::MakeControlPoints() -{ - float maxX, maxY, minX, minY; - - GetBoundingBoxMax(&maxX, &maxY); - GetBoundingBoxMin(&minX, &minY); - - float widthMin = (float)(minX + CONTROL_POINT_SIZE + 2); - float heightMin = (float)(minY + CONTROL_POINT_SIZE + 2); - - // Offsets from main object - float top = (float)(- (heightMin / 2.0)); - float bottom = (float)(heightMin / 2.0 + (maxY - minY)); - float left = (float)(- (widthMin / 2.0)); - float right = (float)(widthMin / 2.0 + (maxX - minX)); - - wxControlPoint *control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, left, top, - CONTROL_POINT_DIAGONAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, 0, top, - CONTROL_POINT_VERTICAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, right, top, - CONTROL_POINT_DIAGONAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, right, 0, - CONTROL_POINT_HORIZONTAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, right, bottom, - CONTROL_POINT_DIAGONAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, 0, bottom, - CONTROL_POINT_VERTICAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, left, bottom, - CONTROL_POINT_DIAGONAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, left, 0, - CONTROL_POINT_HORIZONTAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - -} - -void wxShape::MakeMandatoryControlPoints() -{ - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->MakeMandatoryControlPoints(); - node = node->Next(); - } -} - -void wxShape::ResetMandatoryControlPoints() -{ - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->ResetMandatoryControlPoints(); - node = node->Next(); - } -} - -void wxShape::ResetControlPoints() -{ - ResetMandatoryControlPoints(); - - if (m_controlPoints.Number() < 1) - return; - - float maxX, maxY, minX, minY; - - GetBoundingBoxMax(&maxX, &maxY); - GetBoundingBoxMin(&minX, &minY); - - float widthMin = (float)(minX + CONTROL_POINT_SIZE + 2); - float heightMin = (float)(minY + CONTROL_POINT_SIZE + 2); - - // Offsets from main object - float top = (float)(- (heightMin / 2.0)); - float bottom = (float)(heightMin / 2.0 + (maxY - minY)); - float left = (float)(- (widthMin / 2.0)); - float right = (float)(widthMin / 2.0 + (maxX - minX)); - - wxNode *node = m_controlPoints.First(); - wxControlPoint *control = (wxControlPoint *)node->Data(); - control->m_xoffset = left; control->m_yoffset = top; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->m_xoffset = 0; control->m_yoffset = top; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->m_xoffset = right; control->m_yoffset = top; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->m_xoffset = right; control->m_yoffset = 0; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->m_xoffset = right; control->m_yoffset = bottom; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->m_xoffset = 0; control->m_yoffset = bottom; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->m_xoffset = left; control->m_yoffset = bottom; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->m_xoffset = left; control->m_yoffset = 0; -} - -void wxShape::DeleteControlPoints(wxDC *dc) -{ - wxNode *node = m_controlPoints.First(); - while (node) - { - wxControlPoint *control = (wxControlPoint *)node->Data(); - if (dc) - control->GetEventHandler()->OnErase(*dc); - m_canvas->RemoveShape(control); - delete control; - delete node; - node = m_controlPoints.First(); - } - // Children of divisions are contained objects, - // so stop here - if (!IsKindOf(CLASSINFO(wxDivisionShape))) - { - node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->DeleteControlPoints(dc); - node = node->Next(); - } - } -} - -void wxShape::OnDrawControlPoints(wxDC& dc) -{ - if (!m_drawHandles) - return; - - dc.SetBrush(wxBLACK_BRUSH); - dc.SetPen(wxBLACK_PEN); - - wxNode *node = m_controlPoints.First(); - while (node) - { - wxControlPoint *control = (wxControlPoint *)node->Data(); - control->Draw(dc); - node = node->Next(); - } - // Children of divisions are contained objects, - // so stop here. - // This test bypasses the type facility for speed - // (critical when drawing) - if (!IsKindOf(CLASSINFO(wxDivisionShape))) - { - node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->GetEventHandler()->OnDrawControlPoints(dc); - node = node->Next(); - } - } -} - -void wxShape::OnEraseControlPoints(wxDC& dc) -{ - wxNode *node = m_controlPoints.First(); - while (node) - { - wxControlPoint *control = (wxControlPoint *)node->Data(); - control->Erase(dc); - node = node->Next(); - } - if (!IsKindOf(CLASSINFO(wxDivisionShape))) - { - node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->GetEventHandler()->OnEraseControlPoints(dc); - node = node->Next(); - } - } -} - -void wxShape::Select(bool select, wxDC* dc) -{ - m_selected = select; - if (select) - { - MakeControlPoints(); - // Children of divisions are contained objects, - // so stop here - if (!IsKindOf(CLASSINFO(wxDivisionShape))) - { - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->MakeMandatoryControlPoints(); - node = node->Next(); - } - } - if (dc) - GetEventHandler()->OnDrawControlPoints(*dc); - } - if (!select) - { - DeleteControlPoints(dc); - if (!IsKindOf(CLASSINFO(wxDivisionShape))) - { - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - child->DeleteControlPoints(dc); - node = node->Next(); - } - } - } -} - -bool wxShape::Selected() const -{ - return m_selected; -} - -bool wxShape::AncestorSelected() const -{ - if (m_selected) return TRUE; - if (!GetParent()) - return FALSE; - else - return GetParent()->AncestorSelected(); -} - -int wxShape::GetNumberOfAttachments() -{ - // Should return the MAXIMUM attachment point id here, - // so higher-level functions can iterate through all attachments, - // even if they're not contiguous. - if (m_attachmentPoints.Number() == 0) - return 4; - else - { - int maxN = 3; - wxNode *node = m_attachmentPoints.First(); - while (node) - { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); - if (point->m_id > maxN) - maxN = point->m_id; - node = node->Next(); - } - return maxN+1;; - } -} - -bool wxShape::AttachmentIsValid(int attachment) -{ - if ((attachment >= 0) && (attachment < 4)) - return TRUE; - - wxNode *node = m_attachmentPoints.First(); - while (node) - { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); - if (point->m_id == attachment) - return TRUE; - node = node->Next(); - } - return FALSE; -} - -bool wxShape::GetAttachmentPosition(int attachment, float *x, float *y, - int nth, int no_arcs, wxLineShape *line) -{ - if (!m_attachmentMode) - { - *x = m_xpos; *y = m_ypos; - return TRUE; - } - else - { - wxNode *node = m_attachmentPoints.First(); - while (node) - { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); - if (point->m_id == attachment) - { - *x = (float)(m_xpos + point->m_x); - *y = (float)(m_ypos + point->m_y); - return TRUE; - } - node = node->Next(); - } - *x = m_xpos; *y = m_ypos; - return FALSE; - } -} - -void wxShape::GetBoundingBoxMax(float *w, float *h) -{ - float ww, hh; - GetBoundingBoxMin(&ww, &hh); - if (m_shadowMode != SHADOW_NONE) - { - ww += m_shadowOffsetX; - hh += m_shadowOffsetY; - } - *w = ww; - *h = hh; -} - -// Returns TRUE if image is a descendant of this composite -bool wxShape::HasDescendant(wxShape *image) -{ - if (image == this) - return TRUE; - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - bool ans = child->HasDescendant(image); - if (ans) - return TRUE; - node = node->Next(); - } - return FALSE; -} - -// Clears points from a list of wxRealPoints, and clears list -void wxShape::ClearPointList(wxList& list) -{ - wxNode* node = list.First(); - while (node) - { - wxRealPoint* pt = (wxRealPoint*) node->Data(); - delete pt; - - node = node->Next(); - } - list.Clear(); -} - diff --git a/utils/ogl/src/basic.h b/utils/ogl/src/basic.h deleted file mode 100644 index ad433d4bca..0000000000 --- a/utils/ogl/src/basic.h +++ /dev/null @@ -1,605 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: basic.h -// Purpose: Basic OGL classes and definitions -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_BASIC_H_ -#define _OGL_BASIC_H_ - -#ifdef __GNUG__ -#pragma interface "basic.h" -#endif - -#define OGL_VERSION 2.0 - -#ifndef DEFAULT_MOUSE_TOLERANCE -#define DEFAULT_MOUSE_TOLERANCE 3 -#endif - -// Edit these lines if you positively don't want PROLOGIO support -#ifndef PROLOGIO -#define PROLOGIO -#endif - -// Key identifiers -#define KEY_SHIFT 1 -#define KEY_CTRL 2 - -// Arrow styles - -#define ARROW_NONE 0 -#define ARROW_END 1 -#define ARROW_BOTH 2 -#define ARROW_MIDDLE 3 -#define ARROW_START 4 - -// Control point types -// Rectangle and most other shapes -#define CONTROL_POINT_VERTICAL 1 -#define CONTROL_POINT_HORIZONTAL 2 -#define CONTROL_POINT_DIAGONAL 3 - -// Line -#define CONTROL_POINT_ENDPOINT_TO 4 -#define CONTROL_POINT_ENDPOINT_FROM 5 -#define CONTROL_POINT_LINE 6 - -// Types of formatting: can be combined in a bit list -#define FORMAT_NONE 0 - // Left justification -#define FORMAT_CENTRE_HORIZ 1 - // Centre horizontally -#define FORMAT_CENTRE_VERT 2 - // Centre vertically -#define FORMAT_SIZE_TO_CONTENTS 4 - // Resize shape to contents - -// Shadow mode -#define SHADOW_NONE 0 -#define SHADOW_LEFT 1 -#define SHADOW_RIGHT 2 - -/* - * Declare types - * - */ - -#define SHAPE_BASIC wxTYPE_USER + 1 -#define SHAPE_RECTANGLE wxTYPE_USER + 2 -#define SHAPE_ELLIPSE wxTYPE_USER + 3 -#define SHAPE_POLYGON wxTYPE_USER + 4 -#define SHAPE_CIRCLE wxTYPE_USER + 5 -#define SHAPE_LINE wxTYPE_USER + 6 -#define SHAPE_DIVIDED_RECTANGLE wxTYPE_USER + 8 -#define SHAPE_COMPOSITE wxTYPE_USER + 9 -#define SHAPE_CONTROL_POINT wxTYPE_USER + 10 -#define SHAPE_DRAWN wxTYPE_USER + 11 -#define SHAPE_DIVISION wxTYPE_USER + 12 -#define SHAPE_LABEL_OBJECT wxTYPE_USER + 13 -#define SHAPE_BITMAP wxTYPE_USER + 14 -#define SHAPE_DIVIDED_OBJECT_CONTROL_POINT wxTYPE_USER + 15 - -#define OBJECT_REGION wxTYPE_USER + 20 - -#define OP_CLICK_LEFT 1 -#define OP_CLICK_RIGHT 2 -#define OP_DRAG_LEFT 4 -#define OP_DRAG_RIGHT 8 - -#define OP_ALL (OP_CLICK_LEFT | OP_CLICK_RIGHT | OP_DRAG_LEFT | OP_DRAG_RIGHT) - -class wxShapeTextLine; -class wxShapeCanvas; -class wxLineShape; -class wxControlPoint; -class wxShapeRegion; -class wxShape; - -#ifdef PROLOGIO -class wxExpr; -class wxDatabase; -#endif - -class wxShapeEvtHandler: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxShapeEvtHandler) - - public: - wxShapeEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL); - virtual ~wxShapeEvtHandler(); - - inline void SetHandlerShape(wxShape *sh) { m_handlerShape = sh; } - inline wxShape *GetShape() const { return m_handlerShape; } - - // This is called when the _shape_ is deleted. - virtual void OnDelete(); - virtual void OnDraw(wxDC& dc); - virtual void OnDrawContents(wxDC& dc); - virtual void OnMoveLinks(wxDC& dc); - virtual void OnErase(wxDC& dc); - virtual void OnEraseContents(wxDC& dc); - virtual void OnHighlight(wxDC& dc); - virtual void OnLeftClick(float x, float y, int keys = 0, int attachment = 0); - virtual void OnRightClick(float x, float y, int keys = 0, int attachment = 0); - virtual void OnSize(float x, float y); - virtual bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE); - virtual void OnMovePost(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE); - - virtual void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false - virtual void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); - virtual void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); - virtual void OnDragRight(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false - virtual void OnBeginDragRight(float x, float y, int keys=0, int attachment = 0); - virtual void OnEndDragRight(float x, float y, int keys=0, int attachment = 0); - virtual void OnDrawOutline(wxDC& dc, float x, float y, float w, float h); - virtual void OnDrawControlPoints(wxDC& dc); - virtual void OnEraseControlPoints(wxDC& dc); - virtual void OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE); - - virtual void OnBeginSize(float WXUNUSED(w), float WXUNUSED(h)) { } - virtual void OnEndSize(float WXUNUSED(w), float WXUNUSED(h)) { } - - private: - wxShapeEvtHandler* m_previousHandler; - wxShape* m_handlerShape; -}; - -class wxShape: public wxShapeEvtHandler -{ - DECLARE_ABSTRACT_CLASS(wxShape) - - public: - - wxShape(wxShapeCanvas *can = NULL); - virtual ~wxShape(); - virtual void GetBoundingBoxMax(float *width, float *height); - virtual void GetBoundingBoxMin(float *width, float *height) = 0; - virtual bool GetPerimeterPoint(float x1, float y1, - float x2, float y2, - float *x3, float *y3); - inline wxShapeCanvas *GetCanvas() { return m_canvas; } - void SetCanvas(wxShapeCanvas *the_canvas); - virtual void AddToCanvas(wxShapeCanvas *the_canvas, wxShape *addAfter = NULL); - virtual void InsertInCanvas(wxShapeCanvas *the_canvas); - - virtual void RemoveFromCanvas(wxShapeCanvas *the_canvas); - inline float GetX() const { return m_xpos; } - inline float GetY() const { return m_ypos; } - inline void SetX(float x) { m_xpos = x; } - inline void SetY(float y) { m_ypos = y; } - - inline wxShape *GetParent() const { return m_parent; } - inline void SetParent(wxShape *p) { m_parent = p; } - wxShape *GetTopAncestor(); - inline wxList& GetChildren() { return m_children; } - - virtual void OnDraw(wxDC& dc); - virtual void OnDrawContents(wxDC& dc); - virtual void OnMoveLinks(wxDC& dc); - virtual void Unlink() { }; - void SetDrawHandles(bool drawH); - inline bool GetDrawHandles() { return m_drawHandles; } - virtual void OnErase(wxDC& dc); - virtual void OnEraseContents(wxDC& dc); - virtual void OnHighlight(wxDC& dc); - virtual void OnLeftClick(float x, float y, int keys = 0, int attachment = 0); - virtual void OnRightClick(float x, float y, int keys = 0, int attachment = 0); - virtual void OnSize(float x, float y); - virtual bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE); - virtual void OnMovePost(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE); - - virtual void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false - virtual void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); - virtual void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); - virtual void OnDragRight(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false - virtual void OnBeginDragRight(float x, float y, int keys=0, int attachment = 0); - virtual void OnEndDragRight(float x, float y, int keys=0, int attachment = 0); - virtual void OnDrawOutline(wxDC& dc, float x, float y, float w, float h); - virtual void OnDrawControlPoints(wxDC& dc); - virtual void OnEraseControlPoints(wxDC& dc); - - virtual void OnBeginSize(float WXUNUSED(w), float WXUNUSED(h)) { } - virtual void OnEndSize(float WXUNUSED(w), float WXUNUSED(h)) { } - - virtual void MakeControlPoints(); - virtual void DeleteControlPoints(wxDC *dc = NULL); - virtual void ResetControlPoints(); - - inline wxShapeEvtHandler *GetEventHandler() { return m_eventHandler; } - inline void SetEventHandler(wxShapeEvtHandler *handler) { m_eventHandler = handler; } - - // Mandatory control points, e.g. the divided line moving handles - // should appear even if a child of the 'selected' image - virtual void MakeMandatoryControlPoints(); - virtual void ResetMandatoryControlPoints(); - - inline virtual bool Recompute() { return TRUE; }; - // Calculate size recursively, if size changes. Size might depend on children. - inline virtual void CalculateSize() { }; - virtual void Select(bool select = TRUE, wxDC* dc = NULL); - virtual void SetHighlight(bool hi = TRUE, bool recurse = FALSE); - inline virtual bool IsHighlighted() const { return m_highlighted; }; - virtual bool Selected() const; - virtual bool AncestorSelected() const; - void SetSensitivityFilter(int sens = OP_ALL, bool recursive = FALSE); - int GetSensitivityFilter() const { return m_sensitivity; } - void SetDraggable(bool drag, bool recursive = FALSE); - inline void SetFixedSize(bool x, bool y) { m_fixedWidth = x; m_fixedHeight = y; }; - inline void GetFixedSize(bool *x, bool *y) const { *x = m_fixedWidth; *y = m_fixedHeight; }; - inline bool GetFixedWidth() const { return m_fixedWidth; } - inline bool GetFixedHeight() const { return m_fixedHeight; } - inline void SetSpaceAttachments(bool sp) { m_spaceAttachments = sp; }; - inline bool GetSpaceAttachments() const { return m_spaceAttachments; }; - void SetShadowMode(int mode, bool redraw = FALSE); - inline int GetShadowMode() const { return m_shadowMode; } - virtual bool HitTest(float x, float y, int *attachment, float *distance); - inline void SetCentreResize(bool cr) { m_centreResize = cr; } - inline bool GetCentreResize() const { return m_centreResize; } - inline wxList& GetLines() { return m_lines; } - inline void SetDisableLabel(bool flag) { m_disableLabel = flag; } - inline bool GetDisableLabel() const { return m_disableLabel; } - inline void SetAttachmentMode(bool flag) { m_attachmentMode = flag; } - inline bool GetAttachmentMode() const { return m_attachmentMode; } - inline void SetId(long i) { m_id = i; } - inline long GetId() const { return m_id; } - - void SetPen(wxPen *pen); - void SetBrush(wxBrush *brush); - inline void SetClientData(wxObject *client_data) { m_clientData = client_data; }; - inline wxObject *GetClientData() const { return m_clientData; }; - - virtual void Show(bool show); - virtual bool IsShown() const { return m_visible; } - virtual void Move(wxDC& dc, float x1, float y1, bool display = TRUE); - virtual void Erase(wxDC& dc); - virtual void EraseContents(wxDC& dc); - virtual void Draw(wxDC& dc); - virtual void Flash(); - virtual void MoveLinks(wxDC& dc); - virtual void DrawContents(wxDC& dc); // E.g. for drawing text label - virtual void SetSize(float x, float y, bool recursive = TRUE); - virtual void SetAttachmentSize(float x, float y); - void Attach(wxShapeCanvas *can); - void Detach(); - - inline virtual bool Constrain() { return FALSE; } ; - - void AddLine(wxLineShape *line, wxShape *other, - int attachFrom = 0, int attachTo = 0); - void AddText(const wxString& string); - - inline wxPen *GetPen() const { return m_pen; } - inline wxBrush *GetBrush() const { return m_brush; } - - /* - * Region-specific functions (defaults to the default region - * for simple objects - */ - - // Set the default, single region size to be consistent - // with the object size - void SetDefaultRegionSize(); - virtual void FormatText(wxDC& dc, const wxString& s, int regionId = 0); - virtual void SetFormatMode(int mode, int regionId = 0); - virtual int GetFormatMode(int regionId = 0) const; - virtual void SetFont(wxFont *font, int regionId = 0); - virtual wxFont *GetFont(int regionId = 0) const; - virtual void SetTextColour(const wxString& colour, int regionId = 0); - virtual wxString GetTextColour(int regionId = 0) const; - virtual inline int GetNumberOfTextRegions() const { return m_regions.Number(); } - virtual void SetRegionName(const wxString& name, int regionId = 0); - - // Get the name representing the region for this image alone. - // I.e. this image's region ids go from 0 to N-1. - // But the names might be "0.2.0", "0.2.1" etc. depending on position in composite. - // So the last digit represents the region Id, the others represent positions - // in composites. - virtual wxString GetRegionName(int regionId); - - // Gets the region corresponding to the name, or -1 if not found. - virtual int GetRegionId(const wxString& name); - - // Construct names for regions, unique even for children of a composite. - virtual void NameRegions(const wxString& parentName = ""); - - // Get list of regions - inline wxList& GetRegions() { return m_regions; } - - virtual void AddRegion(wxShapeRegion *region); - - virtual void ClearRegions(); - - // Assign new ids to this image and children (if composite) - void AssignNewIds(); - - // Returns actual image (same as 'this' if non-composite) and region id - // for given region name. - virtual wxShape *FindRegion(const wxString& regionName, int *regionId); - - // Finds all region names for this image (composite or simple). - // Supply empty string list. - virtual void FindRegionNames(wxStringList& list); - - virtual void ClearText(int regionId = 0); - void RemoveLine(wxLineShape *line); - -#ifdef PROLOGIO - // Prolog database stuff - virtual char *GetFunctor(); - virtual void WritePrologAttributes(wxExpr *clause); - virtual void ReadPrologAttributes(wxExpr *clause); - - // In case the object has constraints it needs to read in in a different pass - inline virtual void ReadConstraints(wxExpr *WXUNUSED(clause), wxExprDatabase *WXUNUSED(database)) { }; - virtual void WriteRegions(wxExpr *clause); - virtual void ReadRegions(wxExpr *clause); -#endif - - // Does the WHOLE copy calling PrivateCopy - don't redefine. - // If canvas is non-null, set the canvas too. - wxShape *CreateNewCopy(wxShapeCanvas *theCanvas = NULL); - - // Attachment code - virtual bool GetAttachmentPosition(int attachment, float *x, float *y, - int nth = 0, int no_arcs = 1, wxLineShape *line = NULL); - virtual int GetNumberOfAttachments(); - virtual bool AttachmentIsValid(int attachment); - - virtual void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE); - virtual void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE); - - virtual void MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move, - float x, float y); - - // Reorders the lines coming into the node image at this attachment - // position, in the order in which they appear in linesToSort. - virtual void SortLines(int attachment, wxList& linesToSort); - - // This is really to distinguish between lines and other images. - // For lines, want to pass drag to canvas, since lines tend to prevent - // dragging on a canvas (they get in the way.) - virtual bool Draggable() const { return TRUE; } - - // Returns TRUE if image is a descendant of this image - bool HasDescendant(wxShape *image); - - // Does the copying for this object - void Copy(wxShape& copy); - // Returns a new instance, and does the copy for this class. Define for each class. - virtual wxShape *PrivateCopy() = 0; - - // Rotate about the given axis by the given amount in radians - // (does nothing for most objects) - // But even non-rotating objects should record their notional - // rotation in case it's important (e.g. in dog-leg code). - virtual inline void Rotate(float WXUNUSED(x), float WXUNUSED(y), float theta) { m_rotation = theta; } - virtual inline float GetRotation() const { return m_rotation; } - - void ClearAttachments(); - - // Recentres all the text regions for this object - void Recentre(wxDC& dc); - - // Clears points from a list of wxRealPoints - void ClearPointList(wxList& list); - - private: - wxObject* m_clientData; - - protected: - wxShapeEvtHandler* m_eventHandler; - bool m_formatted; - float m_xpos, m_ypos; - wxPen* m_pen; - wxBrush* m_brush; - wxFont* m_font; - wxColour* m_textColour; - wxString m_textColourName; - wxShapeCanvas* m_canvas; - wxList m_lines; - wxList m_text; - wxList m_controlPoints; - wxList m_regions; - wxList m_attachmentPoints; - bool m_visible; - bool m_disableLabel; - long m_id; - bool m_selected; - bool m_highlighted; // Different from selected: user-defined highlighting, - // e.g. thick border. - float m_rotation; - int m_sensitivity; - bool m_draggable; - bool m_attachmentMode; // TRUE if using attachments, FALSE otherwise - bool m_spaceAttachments; // TRUE if lines at one side should be spaced - bool m_fixedWidth; - bool m_fixedHeight; - bool m_centreResize; // Default is to resize keeping the centre constant (TRUE) - bool m_drawHandles; // Don't draw handles if FALSE, usually TRUE - wxList m_children; // In case it's composite - wxShape* m_parent; // In case it's a child - int m_formatMode; - int m_shadowMode; - wxBrush* m_shadowBrush; - int m_shadowOffsetX; - int m_shadowOffsetY; - int m_textMarginX; // Gap between text and border - int m_textMarginY; - wxString m_regionName; -}; - -class wxPolygonShape: public wxShape -{ - DECLARE_DYNAMIC_CLASS(wxPolygonShape) - public: - wxPolygonShape(); - ~wxPolygonShape(); - - // Takes a list of wxRealPoints; each point is an OFFSET from the centre. - // Deletes user's points in destructor. - virtual void Create(wxList *points); - - void GetBoundingBoxMin(float *w, float *h); - void CalculateBoundingBox(); - bool GetPerimeterPoint(float x1, float y1, - float x2, float y2, - float *x3, float *y3); - bool HitTest(float x, float y, int *attachment, float *distance); - void SetSize(float x, float y, bool recursive = TRUE); - void OnDraw(wxDC& dc); - void OnDrawOutline(wxDC& dc, float x, float y, float w, float h); - - // A polygon should have a control point at each vertex, - // with the option of moving the control points individually - // to change the shape. - void MakeControlPoints(); - void ResetControlPoints(); - - // If we've changed the shape, must make the original - // points match the working points - void UpdateOriginalPoints(); - - // Add a control point after the given point - virtual void AddPolygonPoint(int pos = 0); - - // Delete a control point - virtual void DeletePolygonPoint(int pos = 0); - - // Recalculates the centre of the polygon - virtual void CalculatePolygonCentre(); - -#ifdef PROLOGIO - // Prolog database stuff - void WritePrologAttributes(wxExpr *clause); - void ReadPrologAttributes(wxExpr *clause); -#endif - - int GetNumberOfAttachments(); - bool GetAttachmentPosition(int attachment, float *x, float *y, - int nth = 0, int no_arcs = 1, wxLineShape *line = NULL); - bool AttachmentIsValid(int attachment); - // Does the copying for this object - void Copy(wxPolygonShape& copy); - wxShape *PrivateCopy(); - - inline wxList *GetPoints() { return m_points; } - - private: - wxList* m_points; - wxList* m_originalPoints; - float m_boundWidth; - float m_boundHeight; - float m_originalWidth; - float m_originalHeight; -}; - -class wxRectangleShape: public wxShape -{ - DECLARE_DYNAMIC_CLASS(wxRectangleShape) - public: - wxRectangleShape(float w = 0.0, float h = 0.0); - void GetBoundingBoxMin(float *w, float *h); - bool GetPerimeterPoint(float x1, float y1, - float x2, float y2, - float *x3, float *y3); - void OnDraw(wxDC& dc); - void SetSize(float x, float y, bool recursive = TRUE); - void SetCornerRadius(float rad); // If > 0, rounded corners - -#ifdef PROLOGIO - // Prolog database stuff - void WritePrologAttributes(wxExpr *clause); - void ReadPrologAttributes(wxExpr *clause); -#endif - - int GetNumberOfAttachments(); - bool GetAttachmentPosition(int attachment, float *x, float *y, - int nth = 0, int no_arcs = 1, wxLineShape *line = NULL); - // Does the copying for this object - void Copy(wxRectangleShape& copy); - wxShape *PrivateCopy(); - - inline float GetWidth() const { return m_width; } - inline float GetHeight() const { return m_height; } - -protected: - float m_width; - float m_height; - float m_cornerRadius; -}; - -class wxTextShape: public wxRectangleShape -{ - DECLARE_DYNAMIC_CLASS(wxTextShape) - public: - wxTextShape(float width = 0.0, float height = 0.0); - - void OnDraw(wxDC& dc); - -#ifdef PROLOGIO - void WritePrologAttributes(wxExpr *clause); -#endif - - // Does the copying for this object - void Copy(wxTextShape& copy); - wxShape *PrivateCopy(); -}; - -class wxEllipseShape: public wxShape -{ - DECLARE_DYNAMIC_CLASS(wxEllipseShape) - public: - wxEllipseShape(float w = 0.0, float h = 0.0); - - void GetBoundingBoxMin(float *w, float *h); - bool GetPerimeterPoint(float x1, float y1, - float x2, float y2, - float *x3, float *y3); - - void OnDraw(wxDC& dc); - void SetSize(float x, float y, bool recursive = TRUE); - -#ifdef PROLOGIO - // Prolog database stuff - void WritePrologAttributes(wxExpr *clause); - void ReadPrologAttributes(wxExpr *clause); -#endif - - int GetNumberOfAttachments(); - bool GetAttachmentPosition(int attachment, float *x, float *y, - int nth = 0, int no_arcs = 1, wxLineShape *line = NULL); - - // Does the copying for this object - void Copy(wxEllipseShape& copy); - wxShape *PrivateCopy(); - - inline float GetWidth() const { return m_width; } - inline float GetHeight() const { return m_height; } - -protected: - float m_width; - float m_height; -}; - -class wxCircleShape: public wxEllipseShape -{ - DECLARE_DYNAMIC_CLASS(wxCircleShape) - public: - wxCircleShape(float w = 0.0); - - bool GetPerimeterPoint(float x1, float y1, - float x2, float y2, - float *x3, float *y3); - // Does the copying for this object - void Copy(wxCircleShape& copy); - wxShape *PrivateCopy(); -}; - -#endif - // _OGL_BASIC_H_ diff --git a/utils/ogl/src/basic2.cpp b/utils/ogl/src/basic2.cpp deleted file mode 100644 index bff1defda1..0000000000 --- a/utils/ogl/src/basic2.cpp +++ /dev/null @@ -1,2001 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: basic2.cpp -// Purpose: Basic OGL classes (2) -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#ifdef PROLOGIO -#include -#endif - -#if USE_IOSTREAMH -#include -#else -#include -#endif - -#include -#include -#include - -#include "basic.h" -#include "basicp.h" -#include "composit.h" -#include "lines.h" -#include "canvas.h" -#include "divided.h" -#include "misc.h" - -// Control point types -// Rectangle and most other shapes -#define CONTROL_POINT_VERTICAL 1 -#define CONTROL_POINT_HORIZONTAL 2 -#define CONTROL_POINT_DIAGONAL 3 - -// Line -#define CONTROL_POINT_ENDPOINT_TO 4 -#define CONTROL_POINT_ENDPOINT_FROM 5 -#define CONTROL_POINT_LINE 6 - -// Two stage construction: need to call Create -IMPLEMENT_DYNAMIC_CLASS(wxPolygonShape, wxShape) - -wxPolygonShape::wxPolygonShape() -{ - m_points = NULL; - m_originalPoints = NULL; -} - -void wxPolygonShape::Create(wxList *the_points) -{ - m_originalPoints = the_points; - - // Duplicate the list of points - m_points = new wxList; - - wxNode *node = the_points->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxRealPoint *new_point = new wxRealPoint(point->x, point->y); - m_points->Append((wxObject*) new_point); - node = node->Next(); - } - CalculateBoundingBox(); - m_originalWidth = m_boundWidth; - m_originalHeight = m_boundHeight; - SetDefaultRegionSize(); -} - -wxPolygonShape::~wxPolygonShape() -{ - if (m_points) - { - wxNode *node = m_points->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - delete point; - delete node; - node = m_points->First(); - } - delete m_points; - } - if (m_originalPoints) - { - wxNode *node = m_originalPoints->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - delete point; - delete node; - node = m_originalPoints->First(); - } - delete m_originalPoints; - } -} - - -// Width and height. Centre of object is centre of box. -void wxPolygonShape::GetBoundingBoxMin(float *width, float *height) -{ - *width = m_boundWidth; - *height = m_boundHeight; -} - -void wxPolygonShape::CalculateBoundingBox() -{ - // Calculate bounding box at construction (and presumably resize) time - float left = 10000; - float right = -10000; - float top = 10000; - float bottom = -10000; - - wxNode *node = m_points->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - if (point->x < left) left = point->x; - if (point->x > right) right = point->x; - - if (point->y < top) top = point->y; - if (point->y > bottom) bottom = point->y; - - node = node->Next(); - } - m_boundWidth = right - left; - m_boundHeight = bottom - top; -} - -// Recalculates the centre of the polygon, and -// readjusts the point offsets accordingly. -// Necessary since the centre of the polygon -// is expected to be the real centre of the bounding -// box. -void wxPolygonShape::CalculatePolygonCentre() -{ - float left = 10000; - float right = -10000; - float top = 10000; - float bottom = -10000; - - wxNode *node = m_points->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - if (point->x < left) left = point->x; - if (point->x > right) right = point->x; - - if (point->y < top) top = point->y; - if (point->y > bottom) bottom = point->y; - - node = node->Next(); - } - float bwidth = right - left; - float bheight = bottom - top; - - float newCentreX = (float)(left + (bwidth/2.0)); - float newCentreY = (float)(top + (bheight/2.0)); - - node = m_points->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - point->x -= newCentreX; - point->y -= newCentreY; - node = node->Next(); - } - m_xpos += newCentreX; - m_ypos += newCentreY; -} - -bool PolylineHitTest(float n, float xvec[], float yvec[], - float x1, float y1, float x2, float y2) -{ - bool isAHit = FALSE; - int i; - float lastx = xvec[0]; - float lasty = yvec[0]; - - float min_ratio = 1.0; - float line_ratio; - float other_ratio; - -// char buf[300]; - for (i = 1; i < n; i++) - { - check_line_intersection(x1, y1, x2, y2, lastx, lasty, xvec[i], yvec[i], - &line_ratio, &other_ratio); - if (line_ratio != 1.0) - isAHit = TRUE; -// sprintf(buf, "Line ratio = %.2f, other ratio = %.2f\n", line_ratio, other_ratio); -// ClipsErrorFunction(buf); - lastx = xvec[i]; - lasty = yvec[i]; - - if (line_ratio < min_ratio) - min_ratio = line_ratio; - } - - // Do last (implicit) line if last and first floats are not identical - if (!(xvec[0] == lastx && yvec[0] == lasty)) - { - check_line_intersection(x1, y1, x2, y2, lastx, lasty, xvec[0], yvec[0], - &line_ratio, &other_ratio); - if (line_ratio != 1.0) - isAHit = TRUE; -// sprintf(buf, "Line ratio = %.2f, other ratio = %.2f\n", line_ratio, other_ratio); -// ClipsErrorFunction(buf); - - if (line_ratio < min_ratio) - min_ratio = line_ratio; - } -// ClipsErrorFunction("\n"); - return isAHit; -} - -bool wxPolygonShape::HitTest(float x, float y, int *attachment, float *distance) -{ - // Imagine four lines radiating from this point. If all of these lines hit the polygon, - // we're inside it, otherwise we're not. Obviously we'd need more radiating lines - // to be sure of correct results for very strange (concave) shapes. - float endPointsX[4]; - float endPointsY[4]; - // North - endPointsX[0] = x; - endPointsY[0] = (float)(y - 1000.0); - // East - endPointsX[1] = (float)(x + 1000.0); - endPointsY[1] = y; - // South - endPointsX[2] = x; - endPointsY[2] = (float)(y + 1000.0); - // West - endPointsX[3] = (float)(x - 1000.0); - endPointsY[3] = y; - - // Store polygon points in an array - int np = m_points->Number(); - float *xpoints = new float[np]; - float *ypoints = new float[np]; - wxNode *node = m_points->First(); - int i = 0; - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - xpoints[i] = point->x + m_xpos; - ypoints[i] = point->y + m_ypos; - node = node->Next(); - i ++; - } - - // We assume it's inside the polygon UNLESS one or more - // lines don't hit the outline. - bool isContained = TRUE; - - int noPoints = 4; - for (i = 0; i < noPoints; i++) - { - if (!PolylineHitTest(np, xpoints, ypoints, x, y, endPointsX[i], endPointsY[i])) - isContained = FALSE; - } -/* - if (isContained) - ClipsErrorFunction("It's a hit!\n"); - else - ClipsErrorFunction("No hit.\n"); -*/ - delete[] xpoints; - delete[] ypoints; - - if (!isContained) - return FALSE; - - int nearest_attachment = 0; - - // If a hit, check the attachment points within the object. - int n = GetNumberOfAttachments(); - float nearest = 999999.0; - - for (i = 0; i < n; i++) - { - float xp, yp; - if (GetAttachmentPosition(i, &xp, &yp)) - { - float l = (float)sqrt(((xp - x) * (xp - x)) + - ((yp - y) * (yp - y))); - if (l < nearest) - { - nearest = l; - nearest_attachment = i; - } - } - } - *attachment = nearest_attachment; - *distance = nearest; - return TRUE; -} - -// Really need to be able to reset the shape! Otherwise, if the -// points ever go to zero, we've lost it, and can't resize. -void wxPolygonShape::SetSize(float new_width, float new_height, bool recursive) -{ - SetAttachmentSize(new_width, new_height); - - // Multiply all points by proportion of new size to old size - float x_proportion = (float)(fabs(new_width/m_originalWidth)); - float y_proportion = (float)(fabs(new_height/m_originalHeight)); - - wxNode *node = m_points->First(); - wxNode *original_node = m_originalPoints->First(); - while (node && original_node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxRealPoint *original_point = (wxRealPoint *)original_node->Data(); - - point->x = (original_point->x * x_proportion); - point->y = (original_point->y * y_proportion); - - node = node->Next(); - original_node = original_node->Next(); - } - -// CalculateBoundingBox(); - m_boundWidth = (float)fabs(new_width); - m_boundHeight = (float)fabs(new_height); - SetDefaultRegionSize(); -} - -// Make the original points the same as the working points -void wxPolygonShape::UpdateOriginalPoints() -{ - if (!m_originalPoints) m_originalPoints = new wxList; - wxNode *original_node = m_originalPoints->First(); - while (original_node) - { - wxNode *next_node = original_node->Next(); - wxRealPoint *original_point = (wxRealPoint *)original_node->Data(); - delete original_point; - delete original_node; - - original_node = next_node; - } - - wxNode *node = m_points->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxRealPoint *original_point = new wxRealPoint(point->x, point->y); - m_originalPoints->Append((wxObject*) original_point); - - node = node->Next(); - } - CalculateBoundingBox(); - m_originalWidth = m_boundWidth; - m_originalHeight = m_boundHeight; -} - -void wxPolygonShape::AddPolygonPoint(int pos) -{ - wxNode *node = m_points->Nth(pos); - if (!node) node = m_points->First(); - wxRealPoint *firstPoint = (wxRealPoint *)node->Data(); - - wxNode *node2 = m_points->Nth(pos + 1); - if (!node2) node2 = m_points->First(); - wxRealPoint *secondPoint = (wxRealPoint *)node2->Data(); - - float x = (float)((secondPoint->x - firstPoint->x)/2.0 + firstPoint->x); - float y = (float)((secondPoint->y - firstPoint->y)/2.0 + firstPoint->y); - wxRealPoint *point = new wxRealPoint(x, y); - - if (pos >= (m_points->Number() - 1)) - m_points->Append((wxObject*) point); - else - m_points->Insert(node2, (wxObject*) point); - - UpdateOriginalPoints(); - - if (m_selected) - { - DeleteControlPoints(); - MakeControlPoints(); - } -} - -void wxPolygonShape::DeletePolygonPoint(int pos) -{ - wxNode *node = m_points->Nth(pos); - if (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - delete point; - delete node; - UpdateOriginalPoints(); - if (m_selected) - { - DeleteControlPoints(); - MakeControlPoints(); - } - } -} - -// Assume (x1, y1) is centre of box (most generally, line end at box) -bool wxPolygonShape::GetPerimeterPoint(float x1, float y1, - float x2, float y2, - float *x3, float *y3) -{ - int n = m_points->Number(); - - // First check for situation where the line is vertical, - // and we would want to connect to a point on that vertical -- - // find_end_for_polyline can't cope with this (the arrow - // gets drawn to the wrong place). - if ((!m_attachmentMode) && (x1 == x2)) - { - // Look for the point we'd be connecting to. This is - // a heuristic... - wxNode *node = m_points->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - if (point->x == 0.0) - { - if ((y2 > y1) && (point->y > 0.0)) - { - *x3 = point->x + m_xpos; - *y3 = point->y + m_ypos; - return TRUE; - } - else if ((y2 < y1) && (point->y < 0.0)) - { - *x3 = point->x + m_xpos; - *y3 = point->y + m_ypos; - return TRUE; - } - } - node = node->Next(); - } - } - - float *xpoints = new float[n]; - float *ypoints = new float[n]; - - wxNode *node = m_points->First(); - int i = 0; - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - xpoints[i] = point->x + m_xpos; - ypoints[i] = point->y + m_ypos; - node = node->Next(); - i ++; - } -/* - wxRealPoint *point = (wxRealPoint *)m_points->First()->Data(); - xpoints[i] = point->x + m_xpos; - ypoints[i] = point->y + m_ypos; -*/ - - find_end_for_polyline(n, xpoints, ypoints, - x1, y1, x2, y2, x3, y3); - - delete xpoints; - delete ypoints; - - return TRUE; -} - -void wxPolygonShape::OnDraw(wxDC& dc) -{ - int n = m_points->Number(); - wxPoint *intPoints = new wxPoint[n]; - int i; - for (i = 0; i < n; i++) - { - wxRealPoint* point = (wxRealPoint*) m_points->Nth(i)->Data(); - intPoints[i].x = (int) point->x; - intPoints[i].y = (int) point->y; - } - - if (m_shadowMode != SHADOW_NONE) - { - if (m_shadowBrush) - dc.SetBrush(m_shadowBrush); - dc.SetPen(transparent_pen); - - dc.DrawPolygon(n, intPoints, m_xpos + m_shadowOffsetX, m_ypos + m_shadowOffsetY); - } - - if (m_pen) - { - if (m_pen->GetWidth() == 0) - dc.SetPen(transparent_pen); - else - dc.SetPen(m_pen); - } - if (m_brush) - dc.SetBrush(m_brush); - dc.DrawPolygon(n, intPoints, m_xpos, m_ypos); - - delete[] intPoints; -} - -void wxPolygonShape::OnDrawOutline(wxDC& dc, float x, float y, float w, float h) -{ - dc.SetBrush(wxTRANSPARENT_BRUSH); - - int n = m_points->Number(); - wxPoint *intPoints = new wxPoint[n]; - int i; - for (i = 0; i < n; i++) - { - wxRealPoint* point = (wxRealPoint*) m_points->Nth(i)->Data(); - intPoints[i].x = (int) point->x; - intPoints[i].y = (int) point->y; - } - dc.DrawPolygon(n, intPoints, x, y); -// wxShape::OnDrawOutline(x, y, w, h); -} - -// Make as many control points as there are vertices. -void wxPolygonShape::MakeControlPoints() -{ - wxNode *node = m_points->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxPolygonControlPoint *control = new wxPolygonControlPoint(m_canvas, this, CONTROL_POINT_SIZE, - point, point->x, point->y); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - node = node->Next(); - } - -/* - float maxX, maxY, minX, minY; - - GetBoundingBoxMax(&maxX, &maxY); - GetBoundingBoxMin(&minX, &minY); - - float widthMin = (float)(minX + CONTROL_POINT_SIZE + 2); - float heightMin = (float)(minY + CONTROL_POINT_SIZE + 2); - - // Offsets from main object - float top = (float)(- (heightMin / 2.0)); - float bottom = (float)(heightMin / 2.0 + (maxY - minY)); - float left = (float)(- (widthMin / 2.0)); - float right = (float)(widthMin / 2.0 + (maxX - minX)); - - wxControlPoint *control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, left, top, - CONTROL_POINT_DIAGONAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, 0, top, - CONTROL_POINT_VERTICAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, right, top, - CONTROL_POINT_DIAGONAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, right, 0, - CONTROL_POINT_HORIZONTAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, right, bottom, - CONTROL_POINT_DIAGONAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, 0, bottom, - CONTROL_POINT_VERTICAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, left, bottom, - CONTROL_POINT_DIAGONAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - control = new wxControlPoint(m_canvas, this, CONTROL_POINT_SIZE, left, 0, - CONTROL_POINT_HORIZONTAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); -*/ -} - -void wxPolygonShape::ResetControlPoints() -{ - wxNode *node = m_points->First(); - wxNode *controlPointNode = m_controlPoints.First(); - while (node && controlPointNode) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxPolygonControlPoint *controlPoint = (wxPolygonControlPoint *)controlPointNode->Data(); - - controlPoint->m_xoffset = point->x; - controlPoint->m_yoffset = point->y; - controlPoint->m_polygonVertex = point; - - node = node->Next(); - controlPointNode = controlPointNode->Next(); - } -/* - - if (m_controlPoints.Number() < 1) - return; - - float maxX, maxY, minX, minY; - - GetBoundingBoxMax(&maxX, &maxY); - GetBoundingBoxMin(&minX, &minY); - - float widthMin = (float)(minX + CONTROL_POINT_SIZE + 2); - float heightMin = (float)(minY + CONTROL_POINT_SIZE + 2); - - // Offsets from main object - float top = (float)(- (heightMin / 2.0)); - float bottom = (float)(heightMin / 2.0 + (maxY - minY)); - float left = (float)(- (widthMin / 2.0)); - float right = (float)(widthMin / 2.0 + (maxX - minX)); - - wxNode *node = m_controlPoints.First(); - wxControlPoint *control = (wxControlPoint *)node->Data(); - control->xoffset = left; control->yoffset = top; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->xoffset = 0; control->yoffset = top; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->xoffset = right; control->yoffset = top; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->xoffset = right; control->yoffset = 0; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->xoffset = right; control->yoffset = bottom; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->xoffset = 0; control->yoffset = bottom; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->xoffset = left; control->yoffset = bottom; - - node = node->Next(); control = (wxControlPoint *)node->Data(); - control->xoffset = left; control->yoffset = 0; -*/ -} - - -#ifdef PROLOGIO -void wxPolygonShape::WritePrologAttributes(wxExpr *clause) -{ - wxShape::WritePrologAttributes(clause); - - clause->AddAttributeValue("x", m_xpos); - clause->AddAttributeValue("y", m_ypos); - - // Make a list of lists for the coordinates - wxExpr *list = new wxExpr(PrologList); - wxNode *node = m_points->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxExpr *point_list = new wxExpr(PrologList); - wxExpr *x_expr = new wxExpr((float)point->x); - wxExpr *y_expr = new wxExpr((float)point->y); - - point_list->Append(x_expr); - point_list->Append(y_expr); - list->Append(point_list); - - node = node->Next(); - } - clause->AddAttributeValue("points", list); - - // Save the original (unscaled) points - list = new wxExpr(PrologList); - node = m_originalPoints->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxExpr *point_list = new wxExpr(PrologList); - wxExpr *x_expr = new wxExpr((float) point->x); - wxExpr *y_expr = new wxExpr((float) point->y); - point_list->Append(x_expr); - point_list->Append(y_expr); - list->Append(point_list); - - node = node->Next(); - } - clause->AddAttributeValue("m_originalPoints", list); -} - -void wxPolygonShape::ReadPrologAttributes(wxExpr *clause) -{ - wxShape::ReadPrologAttributes(clause); - - // Read a list of lists - m_points = new wxList; - m_originalPoints = new wxList; - - wxExpr *points_list = NULL; - clause->AssignAttributeValue("points", &points_list); - - // If no points_list, don't crash!! Assume a diamond instead. - float the_height = 100.0; - float the_width = 100.0; - if (!points_list) - { - wxRealPoint *point = new wxRealPoint(0.0, (-the_height/2)); - m_points->Append((wxObject*) point); - - point = new wxRealPoint((the_width/2), 0.0); - m_points->Append((wxObject*) point); - - point = new wxRealPoint(0.0, (the_height/2)); - m_points->Append((wxObject*) point); - - point = new wxRealPoint((-the_width/2), 0.0); - m_points->Append((wxObject*) point); - - point = new wxRealPoint(0.0, (-the_height/2)); - m_points->Append((wxObject*) point); - } - else - { - wxExpr *node = points_list->value.first; - - while (node) - { - wxExpr *xexpr = node->value.first; - long x = xexpr->IntegerValue(); - - wxExpr *yexpr = xexpr->next; - long y = yexpr->IntegerValue(); - - wxRealPoint *point = new wxRealPoint((float)x, (float)y); - m_points->Append((wxObject*) point); - - node = node->next; - } - } - - points_list = NULL; - clause->AssignAttributeValue("m_originalPoints", &points_list); - - // If no points_list, don't crash!! Assume a diamond instead. - if (!points_list) - { - wxRealPoint *point = new wxRealPoint(0.0, (-the_height/2)); - m_originalPoints->Append((wxObject*) point); - - point = new wxRealPoint((the_width/2), 0.0); - m_originalPoints->Append((wxObject*) point); - - point = new wxRealPoint(0.0, (the_height/2)); - m_originalPoints->Append((wxObject*) point); - - point = new wxRealPoint((-the_width/2), 0.0); - m_originalPoints->Append((wxObject*) point); - - point = new wxRealPoint(0.0, (-the_height/2)); - m_originalPoints->Append((wxObject*) point); - - m_originalWidth = the_width; - m_originalHeight = the_height; - } - else - { - wxExpr *node = points_list->value.first; - float min_x = 1000; - float min_y = 1000; - float max_x = -1000; - float max_y = -1000; - while (node) - { - wxExpr *xexpr = node->value.first; - long x = xexpr->IntegerValue(); - - wxExpr *yexpr = xexpr->next; - long y = yexpr->IntegerValue(); - - wxRealPoint *point = new wxRealPoint((float)x, (float)y); - m_originalPoints->Append((wxObject*) point); - - if (x < min_x) - min_x = (float)x; - if (y < min_y) - min_y = (float)y; - if (x > max_x) - max_x = (float)x; - if (y > max_y) - max_y = (float)y; - - node = node->next; - } - m_originalWidth = max_x - min_x; - m_originalHeight = max_y - min_y; - } - - CalculateBoundingBox(); -} -#endif - -void wxPolygonShape::Copy(wxPolygonShape& copy) -{ - wxShape::Copy(copy); - - if (copy.m_points) - delete copy.m_points; - - copy.m_points = new wxList; - - if (copy.m_originalPoints) - delete copy.m_originalPoints; - - copy.m_originalPoints = new wxList; - - wxNode *node = m_points->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxRealPoint *new_point = new wxRealPoint(point->x, point->y); - copy.m_points->Append((wxObject*) new_point); - node = node->Next(); - } - node = m_originalPoints->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxRealPoint *new_point = new wxRealPoint(point->x, point->y); - copy.m_originalPoints->Append((wxObject*) new_point); - node = node->Next(); - } - copy.m_boundWidth = m_boundWidth; - copy.m_boundHeight = m_boundHeight; - copy.m_originalWidth = m_originalWidth; - copy.m_originalHeight = m_originalHeight; -} - -wxShape *wxPolygonShape::PrivateCopy() -{ - wxPolygonShape *obj = new wxPolygonShape; - Copy(*obj); - return obj; -} - -int wxPolygonShape::GetNumberOfAttachments() -{ - int maxN = (m_points ? (m_points->Number() - 1) : 0); - wxNode *node = m_attachmentPoints.First(); - while (node) - { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); - if (point->m_id > maxN) - maxN = point->m_id; - node = node->Next(); - } - return maxN+1;; -} - -bool wxPolygonShape::GetAttachmentPosition(int attachment, float *x, float *y, - int nth, int no_arcs, wxLineShape *line) -{ - if (m_attachmentMode && m_points && attachment < m_points->Number()) - { - wxRealPoint *point = (wxRealPoint *)m_points->Nth(attachment)->Data(); - *x = point->x + m_xpos; - *y = point->y + m_ypos; - return TRUE; - } - else - { return wxShape::GetAttachmentPosition(attachment, x, y, nth, no_arcs, line); } -} - -bool wxPolygonShape::AttachmentIsValid(int attachment) -{ - if (!m_points) - return FALSE; - - if ((attachment >= 0) && (attachment < m_points->Number())) - return TRUE; - - wxNode *node = m_attachmentPoints.First(); - while (node) - { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); - if (point->m_id == attachment) - return TRUE; - node = node->Next(); - } - return FALSE; -} - -// Rectangle object - -IMPLEMENT_DYNAMIC_CLASS(wxRectangleShape, wxShape) - -wxRectangleShape::wxRectangleShape(float w, float h) -{ - m_width = w; m_height = h; m_cornerRadius = 0.0; - SetDefaultRegionSize(); -} - -void wxRectangleShape::OnDraw(wxDC& dc) -{ - float x1 = (float)(m_xpos - m_width/2.0); - float y1 = (float)(m_ypos - m_height/2.0); - - if (m_shadowMode != SHADOW_NONE) - { - if (m_shadowBrush) - dc.SetBrush(m_shadowBrush); - dc.SetPen(transparent_pen); - - if (m_cornerRadius != 0.0) - dc.DrawRoundedRectangle(x1 + m_shadowOffsetX, y1 + m_shadowOffsetY, - m_width, m_height, m_cornerRadius); - else - dc.DrawRectangle(x1 + m_shadowOffsetX, y1 + m_shadowOffsetY, m_width, m_height); - } - - if (m_pen) - { - if (m_pen->GetWidth() == 0) - dc.SetPen(transparent_pen); - else - dc.SetPen(m_pen); - } - if (m_brush) - dc.SetBrush(m_brush); - - if (m_cornerRadius != 0.0) - dc.DrawRoundedRectangle(x1, y1, m_width, m_height, m_cornerRadius); - else - dc.DrawRectangle(x1, y1, m_width, m_height); -} - -void wxRectangleShape::GetBoundingBoxMin(float *the_width, float *the_height) -{ - *the_width = m_width; - *the_height = m_height; -} - -void wxRectangleShape::SetSize(float x, float y, bool recursive) -{ - SetAttachmentSize(x, y); - m_width = (float)wxMax(x, 1.0); - m_height = (float)wxMax(y, 1.0); - SetDefaultRegionSize(); -} - -void wxRectangleShape::SetCornerRadius(float rad) -{ - m_cornerRadius = rad; -} - -// Assume (x1, y1) is centre of box (most generally, line end at box) -bool wxRectangleShape::GetPerimeterPoint(float x1, float y1, - float x2, float y2, - float *x3, float *y3) -{ - float bound_x, bound_y; - GetBoundingBoxMax(&bound_x, &bound_y); - find_end_for_box(bound_x, bound_y, m_xpos, m_ypos, x2, y2, x3, y3); - - return TRUE; -} - -#ifdef PROLOGIO -void wxRectangleShape::WritePrologAttributes(wxExpr *clause) -{ - wxShape::WritePrologAttributes(clause); - clause->AddAttributeValue("x", m_xpos); - clause->AddAttributeValue("y", m_ypos); - - clause->AddAttributeValue("width", m_width); - clause->AddAttributeValue("height", m_height); - if (m_cornerRadius != 0.0) - clause->AddAttributeValue("corner", m_cornerRadius); -} - -void wxRectangleShape::ReadPrologAttributes(wxExpr *clause) -{ - wxShape::ReadPrologAttributes(clause); - clause->AssignAttributeValue("width", &m_width); - clause->AssignAttributeValue("height", &m_height); - clause->AssignAttributeValue("corner", &m_cornerRadius); - - // In case we're reading an old file, set the region's size - if (m_regions.Number() == 1) - { - wxShapeRegion *region = (wxShapeRegion *)m_regions.First()->Data(); - region->SetSize(m_width, m_height); - } -} -#endif - -void wxRectangleShape::Copy(wxRectangleShape& copy) -{ - wxShape::Copy(copy); - copy.m_width = m_width; - copy.m_height = m_height; - copy.m_cornerRadius = m_cornerRadius; -} - -wxShape *wxRectangleShape::PrivateCopy() -{ - wxRectangleShape *obj = new wxRectangleShape(0.0, 0.0); - Copy(*obj); - return obj; -} - - -int wxRectangleShape::GetNumberOfAttachments() -{ - return wxShape::GetNumberOfAttachments(); -} - -// There are 4 attachment points on a rectangle - 0 = top, 1 = right, 2 = bottom, -// 3 = left. -bool wxRectangleShape::GetAttachmentPosition(int attachment, float *x, float *y, - int nth, int no_arcs, wxLineShape *line) -{ - if (m_attachmentMode) - { - float top = (float)(m_ypos + m_height/2.0); - float bottom = (float)(m_ypos - m_height/2.0); - float left = (float)(m_xpos - m_width/2.0); - float right = (float)(m_xpos + m_width/2.0); - - bool isEnd = (line && line->IsEnd(this)); - - switch (attachment) - { - case 0: - { - if (m_spaceAttachments) - { - if (line && (line->GetAlignmentType(isEnd) == LINE_ALIGNMENT_TO_NEXT_HANDLE)) - { - // Align line according to the next handle along - wxRealPoint *point = line->GetNextControlPoint(this); - if (point->x < left) - *x = left; - else if (point->x > right) - *x = right; - else - *x = point->x; - } - else - *x = left + (nth + 1)*m_width/(no_arcs + 1); - } - else *x = m_xpos; - - *y = bottom; - break; - } - case 1: - { - *x = right; - if (m_spaceAttachments) - { - if (line && (line->GetAlignmentType(isEnd) == LINE_ALIGNMENT_TO_NEXT_HANDLE)) - { - // Align line according to the next handle along - wxRealPoint *point = line->GetNextControlPoint(this); - if (point->y < bottom) - *y = bottom; - else if (point->y > top) - *y = top; - else - *y = point->y; - } - else - *y = bottom + (nth + 1)*m_height/(no_arcs + 1); - } - else *y = m_ypos; - break; - } - case 2: - { - if (m_spaceAttachments) - { - if (line && (line->GetAlignmentType(isEnd) == LINE_ALIGNMENT_TO_NEXT_HANDLE)) - { - // Align line according to the next handle along - wxRealPoint *point = line->GetNextControlPoint(this); - if (point->x < left) - *x = left; - else if (point->x > right) - *x = right; - else - *x = point->x; - } - else - *x = left + (nth + 1)*m_width/(no_arcs + 1); - } - else *x = m_xpos; - *y = top; - break; - } - case 3: - { - *x = left; - if (m_spaceAttachments) - { - if (line && (line->GetAlignmentType(isEnd) == LINE_ALIGNMENT_TO_NEXT_HANDLE)) - { - // Align line according to the next handle along - wxRealPoint *point = line->GetNextControlPoint(this); - if (point->y < bottom) - *y = bottom; - else if (point->y > top) - *y = top; - else - *y = point->y; - } - else - *y = bottom + (nth + 1)*m_height/(no_arcs + 1); - } - else *y = m_ypos; - break; - } - default: - { - return wxShape::GetAttachmentPosition(attachment, x, y, nth, no_arcs, line); - break; - } - } - return TRUE; - } - else - { *x = m_xpos; *y = m_ypos; return TRUE; } -} - -// Text object (no box) - -IMPLEMENT_DYNAMIC_CLASS(wxTextShape, wxRectangleShape) - -wxTextShape::wxTextShape(float width, float height): - wxRectangleShape(width, height) -{ -} - -void wxTextShape::OnDraw(wxDC& dc) -{ -} - -wxShape *wxTextShape::PrivateCopy() -{ - wxTextShape *obj = new wxTextShape(0.0, 0.0); - Copy(*obj); - return obj; -} - -void wxTextShape::Copy(wxTextShape& copy) -{ - wxRectangleShape::Copy(copy); -} - -#ifdef PROLOGIO -void wxTextShape::WritePrologAttributes(wxExpr *clause) -{ - wxRectangleShape::WritePrologAttributes(clause); -} -#endif - -// Ellipse object - -IMPLEMENT_DYNAMIC_CLASS(wxEllipseShape, wxShape) - -wxEllipseShape::wxEllipseShape(float w, float h) -{ - m_width = w; m_height = h; - SetDefaultRegionSize(); -} - -void wxEllipseShape::GetBoundingBoxMin(float *w, float *h) -{ - *w = m_width; *h = m_height; -} - -bool wxEllipseShape::GetPerimeterPoint(float x1, float y1, - float x2, float y2, - float *x3, float *y3) -{ - float bound_x, bound_y; - GetBoundingBoxMax(&bound_x, &bound_y); - -// find_end_for_box(bound_x, bound_y, m_xpos, m_ypos, x2, y2, x3, y3); - draw_arc_to_ellipse(m_xpos, m_ypos, bound_x, bound_y, x2, y2, x1, y1, x3, y3); - - return TRUE; -} - -void wxEllipseShape::OnDraw(wxDC& dc) -{ - if (m_shadowMode != SHADOW_NONE) - { - if (m_shadowBrush) - dc.SetBrush(m_shadowBrush); - dc.SetPen(transparent_pen); - dc.DrawEllipse((m_xpos - GetWidth()/2) + m_shadowOffsetX, - (m_ypos - GetHeight()/2) + m_shadowOffsetY, - GetWidth(), GetHeight()); - } - - if (m_pen) - { - if (m_pen->GetWidth() == 0) - dc.SetPen(transparent_pen); - else - dc.SetPen(m_pen); - } - if (m_brush) - dc.SetBrush(m_brush); - dc.DrawEllipse((m_xpos - GetWidth()/2), (m_ypos - GetHeight()/2), GetWidth(), GetHeight()); -} - -void wxEllipseShape::SetSize(float x, float y, bool recursive) -{ - SetAttachmentSize(x, y); - m_width = x; - m_height = y; - SetDefaultRegionSize(); -} - -#ifdef PROLOGIO -void wxEllipseShape::WritePrologAttributes(wxExpr *clause) -{ - wxShape::WritePrologAttributes(clause); - clause->AddAttributeValue("x", m_xpos); - clause->AddAttributeValue("y", m_ypos); - - clause->AddAttributeValue("width", m_width); - clause->AddAttributeValue("height", m_height); -} - -void wxEllipseShape::ReadPrologAttributes(wxExpr *clause) -{ - wxShape::ReadPrologAttributes(clause); - clause->AssignAttributeValue("width", &m_width); - clause->AssignAttributeValue("height", &m_height); - - // In case we're reading an old file, set the region's size - if (m_regions.Number() == 1) - { - wxShapeRegion *region = (wxShapeRegion *)m_regions.First()->Data(); - region->SetSize(m_width, m_height); - } -} -#endif - -void wxEllipseShape::Copy(wxEllipseShape& copy) -{ - wxShape::Copy(copy); - - copy.m_width = m_width; - copy.m_height = m_height; -} - -wxShape *wxEllipseShape::PrivateCopy() -{ - wxEllipseShape *obj = new wxEllipseShape(0.0, 0.0); - Copy(*obj); - return obj; -} - -int wxEllipseShape::GetNumberOfAttachments() -{ - return wxShape::GetNumberOfAttachments(); -} - -// There are 4 attachment points on an ellipse - 0 = top, 1 = right, 2 = bottom, -// 3 = left. -bool wxEllipseShape::GetAttachmentPosition(int attachment, float *x, float *y, - int nth, int no_arcs, wxLineShape *line) -{ - if (m_attachmentMode) - { - float top = (float)(m_ypos + m_height/2.0); - float bottom = (float)(m_ypos - m_height/2.0); - float left = (float)(m_xpos - m_width/2.0); - float right = (float)(m_xpos + m_width/2.0); - switch (attachment) - { - case 0: - { - if (m_spaceAttachments) - *x = left + (nth + 1)*m_width/(no_arcs + 1); - else *x = m_xpos; - *y = top; - // We now have the point on the bounding box: but get the point on the ellipse - // by imagining a vertical line from (*x, m_ypos - m_height- 500) to (*x, m_ypos) intersecting - // the ellipse. - draw_arc_to_ellipse(m_xpos, m_ypos, m_width, m_height, *x, (float)(m_ypos-m_height-500), *x, m_ypos, x, y); - break; - } - case 1: - { - *x = right; - if (m_spaceAttachments) - *y = bottom + (nth + 1)*m_height/(no_arcs + 1); - else *y = m_ypos; - draw_arc_to_ellipse(m_xpos, m_ypos, m_width, m_height, (float)(m_xpos+m_width+500), *y, m_xpos, *y, x, y); - break; - } - case 2: - { - if (m_spaceAttachments) - *x = left + (nth + 1)*m_width/(no_arcs + 1); - else *x = m_xpos; - *y = bottom; - draw_arc_to_ellipse(m_xpos, m_ypos, m_width, m_height, *x, (float)(m_ypos+m_height+500), *x, m_ypos, x, y); - break; - } - case 3: - { - *x = left; - if (m_spaceAttachments) - *y = bottom + (nth + 1)*m_height/(no_arcs + 1); - else *y = m_ypos; - draw_arc_to_ellipse(m_xpos, m_ypos, m_width, m_height, (float)(m_xpos-m_width-500), *y, m_xpos, *y, x, y); - break; - } - default: - { - return wxShape::GetAttachmentPosition(attachment, x, y, nth, no_arcs, line); - break; - } - } - return TRUE; - } - else - { *x = m_xpos; *y = m_ypos; return TRUE; } -} - - -// Circle object -IMPLEMENT_DYNAMIC_CLASS(wxCircleShape, wxEllipseShape) - -wxCircleShape::wxCircleShape(float diameter):wxEllipseShape(diameter, diameter) -{ -} - -wxShape *wxCircleShape::PrivateCopy() -{ - wxCircleShape *obj = new wxCircleShape(0.0); - Copy(*obj); - return obj; -} - -void wxCircleShape::Copy(wxCircleShape& copy) -{ - wxEllipseShape::Copy(copy); -} - -bool wxCircleShape::GetPerimeterPoint(float x1, float y1, - float x2, float y2, - float *x3, float *y3) -{ - find_end_for_circle(m_width/2, - m_xpos, m_ypos, // Centre of circle - x2, y2, // Other end of line - x3, y3); - - return TRUE; -} - -// Control points - -IMPLEMENT_DYNAMIC_CLASS(wxControlPoint, wxRectangleShape) - -wxControlPoint::wxControlPoint(wxShapeCanvas *theCanvas, wxShape *object, float size, float the_xoffset, float the_yoffset, int the_type):wxRectangleShape(size, size) -{ - m_canvas = theCanvas; - m_shape = object; - m_xoffset = the_xoffset; - m_yoffset = the_yoffset; - m_type = the_type; - SetPen(black_foreground_pen); - SetBrush(wxBLACK_BRUSH); - m_oldCursor = NULL; - m_visible = TRUE; - m_eraseObject = TRUE; -} - -wxControlPoint::~wxControlPoint() -{ -} - -// Don't even attempt to draw any text - waste of time! -void wxControlPoint::OnDrawContents(wxDC& dc) -{ -} - -void wxControlPoint::OnDraw(wxDC& dc) -{ - m_xpos = m_shape->GetX() + m_xoffset; - m_ypos = m_shape->GetY() + m_yoffset; - wxRectangleShape::OnDraw(dc); -} - -void wxControlPoint::OnErase(wxDC& dc) -{ - wxRectangleShape::OnErase(dc); -} - -/* - * Store original top-left, bottom-right coordinates - * in case we're doing non-vertical resizing. - */ -static float controlPointDragStartX = 0.0; -static float controlPointDragStartY = 0.0; -static float controlPointDragStartWidth = 0.0; -static float controlPointDragStartHeight = 0.0; -static float controlPointDragEndWidth = 0.0; -static float controlPointDragEndHeight = 0.0; -static float controlPointDragPosX = 0.0; -static float controlPointDragPosY = 0.0; - -// Implement resizing of canvas object -void wxControlPoint::OnDragLeft(bool draw, float x, float y, int keys, int attachment) -{ - float bound_x; - float bound_y; - m_shape->GetBoundingBoxMin(&bound_x, &bound_y); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - dc.SetLogicalFunction(wxXOR); - - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush((* wxTRANSPARENT_BRUSH)); - - if (m_shape->GetCentreResize()) - { - // Maintain the same centre point. - float new_width = (float)(2.0*fabs(x - m_shape->GetX())); - float new_height = (float)(2.0*fabs(y - m_shape->GetY())); - - // Constrain sizing according to what control point you're dragging - if (m_type == CONTROL_POINT_HORIZONTAL) - new_height = bound_y; - else if (m_type == CONTROL_POINT_VERTICAL) - new_width = bound_x; - else if (m_type == CONTROL_POINT_DIAGONAL && (keys & KEY_SHIFT)) - new_height = bound_y*(new_width/bound_x); - -// m_shape->OnBeginSize(m_shape->m_fixedWidth ? bound_x : new_width, -// m_shape->m_fixedHeight ? bound_y : new_height); - -// m_shape->SetSize(m_shape->m_fixedWidth ? bound_x : new_width, -// m_shape->m_fixedHeight ? bound_y : new_height); - if (m_shape->GetFixedWidth()) - new_width = bound_x; - - if (m_shape->GetFixedHeight()) - new_height = bound_y; - - controlPointDragEndWidth = new_width; - controlPointDragEndHeight = new_height; - - m_shape->GetEventHandler()->OnDrawOutline(dc, m_shape->GetX(), m_shape->GetY(), - new_width, new_height); - } - else - { - // Don't maintain the same centre point! - float newX1 = wxMin(controlPointDragStartX, x); - float newY1 = wxMin(controlPointDragStartY, y); - float newX2 = wxMax(controlPointDragStartX, x); - float newY2 = wxMax(controlPointDragStartY, y); - if (m_type == CONTROL_POINT_HORIZONTAL) - { - newY1 = controlPointDragStartY; - newY2 = newY1 + controlPointDragStartHeight; - } - else if (m_type == CONTROL_POINT_VERTICAL) - { - newX1 = controlPointDragStartX; - newX2 = newX1 + controlPointDragStartWidth; - } - else if (m_type == CONTROL_POINT_DIAGONAL && (keys & KEY_SHIFT)) - { - float newH = (float)((newX2 - newX1)*(controlPointDragStartHeight/controlPointDragStartWidth)); - if (GetY() > controlPointDragStartY) - newY2 = (float)(newY1 + newH); - else - newY1 = (float)(newY2 - newH); - } - float newWidth = (float)(newX2 - newX1); - float newHeight = (float)(newY2 - newY1); - -// m_shape->OnBeginSize(newWidth, -// newHeight); - -// m_shape->SetSize(newWidth, -// newHeight); - controlPointDragPosX = (float)(newX1 + (newWidth/2.0)); - controlPointDragPosY = (float)(newY1 + (newHeight/2.0)); - if (m_shape->GetFixedWidth()) - newWidth = bound_x; - - if (m_shape->GetFixedHeight()) - newHeight = bound_y; - - controlPointDragEndWidth = newWidth; - controlPointDragEndHeight = newHeight; - m_shape->GetEventHandler()->OnDrawOutline(dc, controlPointDragPosX, controlPointDragPosY, newWidth, newHeight); - } -} - -void wxControlPoint::OnBeginDragLeft(float x, float y, int keys, int attachment) -{ - m_canvas->CaptureMouse(); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - if (m_eraseObject) - m_shape->Erase(dc); - - dc.SetLogicalFunction(wxXOR); - - float bound_x; - float bound_y; - m_shape->GetBoundingBoxMin(&bound_x, &bound_y); - - // Choose the 'opposite corner' of the object as the stationary - // point in case this is non-centring resizing. - if (GetX() < m_shape->GetX()) - controlPointDragStartX = (float)(m_shape->GetX() + (bound_x/2.0)); - else - controlPointDragStartX = (float)(m_shape->GetX() - (bound_x/2.0)); - - if (GetY() < m_shape->GetY()) - controlPointDragStartY = (float)(m_shape->GetY() + (bound_y/2.0)); - else - controlPointDragStartY = (float)(m_shape->GetY() - (bound_y/2.0)); - - if (m_type == CONTROL_POINT_HORIZONTAL) - controlPointDragStartY = (float)(m_shape->GetY() - (bound_y/2.0)); - else if (m_type == CONTROL_POINT_VERTICAL) - controlPointDragStartX = (float)(m_shape->GetX() - (bound_x/2.0)); - - // We may require the old width and height. - controlPointDragStartWidth = bound_x; - controlPointDragStartHeight = bound_y; - - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush((* wxTRANSPARENT_BRUSH)); - - if (m_shape->GetCentreResize()) - { - float new_width = (float)(2.0*fabs(x - m_shape->GetX())); - float new_height = (float)(2.0*fabs(y - m_shape->GetY())); - - // Constrain sizing according to what control point you're dragging - if (m_type == CONTROL_POINT_HORIZONTAL) - new_height = bound_y; - else if (m_type == CONTROL_POINT_VERTICAL) - new_width = bound_x; - else if (m_type == CONTROL_POINT_DIAGONAL && (keys & KEY_SHIFT)) - new_height = bound_y*(new_width/bound_x); - - // Non-recursive SetSize for speed -// m_shape->SetSize(new_width, new_height, FALSE); - - if (m_shape->GetFixedWidth()) - new_width = bound_x; - - if (m_shape->GetFixedHeight()) - new_height = bound_y; - - controlPointDragEndWidth = new_width; - controlPointDragEndHeight = new_height; - m_shape->GetEventHandler()->OnDrawOutline(dc, m_shape->GetX(), m_shape->GetY(), - new_width, new_height); - } - else - { - // Don't maintain the same centre point! - float newX1 = wxMin(controlPointDragStartX, x); - float newY1 = wxMin(controlPointDragStartY, y); - float newX2 = wxMax(controlPointDragStartX, x); - float newY2 = wxMax(controlPointDragStartY, y); - if (m_type == CONTROL_POINT_HORIZONTAL) - { - newY1 = controlPointDragStartY; - newY2 = newY1 + controlPointDragStartHeight; - } - else if (m_type == CONTROL_POINT_VERTICAL) - { - newX1 = controlPointDragStartX; - newX2 = newX1 + controlPointDragStartWidth; - } - else if (m_type == CONTROL_POINT_DIAGONAL && (keys & KEY_SHIFT)) - { - float newH = (float)((newX2 - newX1)*(controlPointDragStartHeight/controlPointDragStartWidth)); - if (GetY() > controlPointDragStartY) - newY2 = (float)(newY1 + newH); - else - newY1 = (float)(newY2 - newH); - } - float newWidth = (float)(newX2 - newX1); - float newHeight = (float)(newY2 - newY1); - -// m_shape->OnBeginSize(newWidth, -// newHeight); - -// m_shape->SetSize(newWidth, -// newHeight); - controlPointDragPosX = (float)(newX1 + (newWidth/2.0)); - controlPointDragPosY = (float)(newY1 + (newHeight/2.0)); - if (m_shape->GetFixedWidth()) - newWidth = bound_x; - - if (m_shape->GetFixedHeight()) - newHeight = bound_y; - - controlPointDragEndWidth = newWidth; - controlPointDragEndHeight = newHeight; - m_shape->GetEventHandler()->OnDrawOutline(dc, controlPointDragPosX, controlPointDragPosY, newWidth, newHeight); - } -} - -void wxControlPoint::OnEndDragLeft(float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - m_canvas->ReleaseMouse(); - dc.SetLogicalFunction(wxCOPY); - m_shape->Recompute(); - m_shape->ResetControlPoints(); - - if (!m_eraseObject) - m_shape->Show(FALSE); - - m_shape->SetSize(controlPointDragEndWidth, controlPointDragEndHeight); - - // The next operation could destroy this control point (it does for label objects, - // via formatting the text), so save all values we're going to use, or - // we'll be accessing garbage. - wxShape *theObject = m_shape; - wxShapeCanvas *theCanvas = m_canvas; - bool eraseIt = m_eraseObject; - - if (theObject->GetCentreResize()) - theObject->Move(dc, theObject->GetX(), theObject->GetY()); - else - theObject->Move(dc, controlPointDragPosX, controlPointDragPosY); - - if (!eraseIt) - theObject->Show(TRUE); - - // Recursively redraw links if we have a composite. - if (theObject->GetChildren().Number() > 0) - theObject->DrawLinks(dc, -1, TRUE); - - float width, height; - theObject->GetBoundingBoxMax(&width, &height); - theObject->GetEventHandler()->OnEndSize(width, height); - - if (!theCanvas->GetQuickEditMode() && eraseIt) theCanvas->Redraw(dc); -} - -int wxControlPoint::GetNumberOfAttachments() -{ - return 1; -} - -bool wxControlPoint::GetAttachmentPosition(int attachment, float *x, float *y, - int nth, int no_arcs, wxLineShape *line) -{ - *x = m_xpos; *y = m_ypos; - return TRUE; -} - - -// Polygon control points - -IMPLEMENT_DYNAMIC_CLASS(wxPolygonControlPoint, wxControlPoint) - -wxPolygonControlPoint::wxPolygonControlPoint(wxShapeCanvas *theCanvas, wxShape *object, float size, - wxRealPoint *vertex, float the_xoffset, float the_yoffset): - wxControlPoint(theCanvas, object, size, the_xoffset, the_yoffset, 0) -{ - m_polygonVertex = vertex; -} - -wxPolygonControlPoint::~wxPolygonControlPoint() -{ -} - -// Implement resizing polygon or moving the vertex. -void wxPolygonControlPoint::OnDragLeft(bool draw, float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - dc.SetLogicalFunction(wxXOR); - - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush((* wxTRANSPARENT_BRUSH)); - - float bound_x; - float bound_y; - m_shape->GetBoundingBoxMin(&bound_x, &bound_y); -/* - float new_width = (float)(2.0*fabs(x - m_shape->GetX())); - float new_height = (float)(2.0*fabs(y - m_shape->GetY())); -*/ - float dist = (float)sqrt((x - m_shape->GetX())*(x - m_shape->GetX()) + - (y - m_shape->GetY())*(y - m_shape->GetY())); - - if (keys & KEY_CTRL) - { - m_canvas->Snap(&x, &y); - - // Move point - m_polygonVertex->x = x - m_shape->GetX(); - m_polygonVertex->y = y - m_shape->GetY(); - m_xpos = x; - m_xpos = y; - ((wxPolygonShape *)m_shape)->CalculateBoundingBox(); - ((wxPolygonShape *)m_shape)->CalculatePolygonCentre(); - } - else - { - float new_width = (float)(dist/m_originalDistance)*m_originalSize.x; - float new_height = (float)(dist/m_originalDistance)*m_originalSize.y; - - // Non-recursive SetSize for speed - m_shape->SetSize(new_width, new_height, FALSE); - } - float w, h; - m_shape->GetBoundingBoxMax(&w, &h); - m_shape->GetEventHandler()->OnDrawOutline(dc, m_shape->GetX(), m_shape->GetY(), w, h); -} - -void wxPolygonControlPoint::OnBeginDragLeft(float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - m_shape->Erase(dc); - - dc.SetLogicalFunction(wxXOR); - - float bound_x; - float bound_y; - m_shape->GetBoundingBoxMin(&bound_x, &bound_y); - - float dist = (float)sqrt((x - m_shape->GetX())*(x - m_shape->GetX()) + - (y - m_shape->GetY())*(y - m_shape->GetY())); - - m_originalDistance = dist; - m_originalSize.x = bound_x; - m_originalSize.y = bound_y; - - if (m_originalDistance == 0.0) m_originalDistance = (float) 0.0001; - - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush((* wxTRANSPARENT_BRUSH)); - - if (keys & KEY_CTRL) - { - m_canvas->Snap(&x, &y); - - // Move point - m_polygonVertex->x = x - m_shape->GetX(); - m_polygonVertex->y = y - m_shape->GetY(); - m_xpos = x; - m_xpos = y; - ((wxPolygonShape *)m_shape)->CalculateBoundingBox(); - ((wxPolygonShape *)m_shape)->CalculatePolygonCentre(); - } - else - { - float new_width = (float)(dist/m_originalDistance)*m_originalSize.x; - float new_height = (float)(dist/m_originalDistance)*m_originalSize.y; - - // Non-recursive SetSize for speed - m_shape->SetSize(new_width, new_height, FALSE); - } - - float w, h; - m_shape->GetBoundingBoxMax(&w, &h); - m_shape->GetEventHandler()->OnDrawOutline(dc, m_shape->GetX(), m_shape->GetY(), w, h); - - m_canvas->CaptureMouse(); -} - -void wxPolygonControlPoint::OnEndDragLeft(float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - m_canvas->ReleaseMouse(); - dc.SetLogicalFunction(wxCOPY); - - // If we're changing shape, must reset the original points - if (keys & KEY_CTRL) - { - ((wxPolygonShape *)m_shape)->CalculateBoundingBox(); - ((wxPolygonShape *)m_shape)->UpdateOriginalPoints(); - } - - ((wxPolygonShape *)m_shape)->CalculateBoundingBox(); - ((wxPolygonShape *)m_shape)->CalculatePolygonCentre(); - - m_shape->Recompute(); - m_shape->ResetControlPoints(); - m_shape->Move(dc, m_shape->GetX(), m_shape->GetY()); - if (!m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc); -} - - -/* - * Object region - * - */ -IMPLEMENT_DYNAMIC_CLASS(wxShapeRegion, wxObject) - -wxShapeRegion::wxShapeRegion() -{ - m_regionText = ""; - m_font = g_oglNormalFont; - m_minHeight = 5.0; - m_minWidth = 5.0; - m_width = 0.0; - m_height = 0.0; - m_x = 0.0; - m_y = 0.0; - - m_regionProportionX = -1.0; - m_regionProportionY = -1.0; - m_formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT; - m_regionName = ""; - m_textColour = "BLACK"; - m_penColour = "BLACK"; - m_penStyle = wxSOLID; - m_actualColourObject = NULL; - m_actualPenObject = NULL; -} - -wxShapeRegion::wxShapeRegion(wxShapeRegion& region) -{ - m_regionText = region.m_regionText; - m_regionName = region.m_regionName; - m_textColour = region.m_textColour; - - m_font = region.m_font; - m_minHeight = region.m_minHeight; - m_minWidth = region.m_minWidth; - m_width = region.m_width; - m_height = region.m_height; - m_x = region.m_x; - m_y = region.m_y; - - m_regionProportionX = region.m_regionProportionX; - m_regionProportionY = region.m_regionProportionY; - m_formatMode = region.m_formatMode; - m_actualColourObject = NULL; - m_actualPenObject = NULL; - m_penStyle = region.m_penStyle; - m_penColour = region.m_penColour; - - ClearText(); - wxNode *node = region.m_formattedText.First(); - while (node) - { - wxShapeTextLine *line = (wxShapeTextLine *)node->Data(); - wxShapeTextLine *new_line = - new wxShapeTextLine(line->GetX(), line->GetY(), line->GetText()); - m_formattedText.Append(new_line); - node = node->Next(); - } -} - -wxShapeRegion::~wxShapeRegion() -{ - ClearText(); -} - -void wxShapeRegion::ClearText() -{ - wxNode *node = m_formattedText.First(); - while (node) - { - wxShapeTextLine *line = (wxShapeTextLine *)node->Data(); - wxNode *next = node->Next(); - delete line; - delete node; - node = next; - } -} - -void wxShapeRegion::SetFont(wxFont *f) -{ - m_font = f; -} - -void wxShapeRegion::SetMinSize(float w, float h) -{ - m_minWidth = w; - m_minHeight = h; -} - -void wxShapeRegion::SetSize(float w, float h) -{ - m_width = w; - m_height = h; -} - -void wxShapeRegion::SetPosition(float xp, float yp) -{ - m_x = xp; - m_y = yp; -} - -void wxShapeRegion::SetProportions(float xp, float yp) -{ - m_regionProportionX = xp; - m_regionProportionY = yp; -} - -void wxShapeRegion::SetFormatMode(int mode) -{ - m_formatMode = mode; -} - -void wxShapeRegion::SetColour(const wxString& col) -{ - m_textColour = col; - m_actualColourObject = NULL; -} - -wxColour *wxShapeRegion::GetActualColourObject() -{ - if (!m_actualColourObject) - m_actualColourObject = wxTheColourDatabase->FindColour(GetColour()); - if (!m_actualColourObject) - m_actualColourObject = wxBLACK; - return m_actualColourObject; -} - -void wxShapeRegion::SetPenColour(const wxString& col) -{ - m_penColour = col; - m_actualPenObject = NULL; -} - -// Returns NULL if the pen is invisible -// (different to pen being transparent; indicates that -// region boundary should not be drawn.) -wxPen *wxShapeRegion::GetActualPen() -{ - if (m_actualPenObject) - return m_actualPenObject; - - if (!m_penColour) return NULL; - if (m_penColour == "Invisible") - return NULL; - m_actualPenObject = wxThePenList->FindOrCreatePen(m_penColour, 1, m_penStyle); - return m_actualPenObject; -} - - diff --git a/utils/ogl/src/basicp.h b/utils/ogl/src/basicp.h deleted file mode 100644 index 0b2214ed66..0000000000 --- a/utils/ogl/src/basicp.h +++ /dev/null @@ -1,195 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: basicp.h -// Purpose: Private OGL classes and definitions -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_BASICP_H_ -#define _OGL_BASICP_H_ - -#ifdef __GNUG__ -#pragma interface "basicp.h" -#endif - -#define CONTROL_POINT_SIZE 6 - -class wxShapeTextLine: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxShapeTextLine) -public: - wxShapeTextLine(float the_x = 0.0, float the_y = 0.0, const wxString& the_line = ""); - ~wxShapeTextLine(); - - inline float GetX() const { return m_x; } - inline float GetY() const { return m_y; } - - inline void SetX(float x) { m_x = x; } - inline void SetY(float y) { m_y = y; } - - inline void SetText(const wxString& text) { m_line = text; } - inline wxString GetText() const { return m_line; } - -protected: - wxString m_line; - float m_x; - float m_y; -}; - -class wxControlPoint: public wxRectangleShape -{ - DECLARE_DYNAMIC_CLASS(wxControlPoint) - - public: - wxControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, float size = 0.0, float the_xoffset = 0.0, - float the_yoffset = 0.0, int the_type = 0); - ~wxControlPoint(); - - void OnDraw(wxDC& dc); - void OnErase(wxDC& dc); - void OnDrawContents(wxDC& dc); - void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); - void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); - void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); - - bool GetAttachmentPosition(int attachment, float *x, float *y, - int nth = 0, int no_arcs = 1, wxLineShape *line = NULL); - int GetNumberOfAttachments(); - - inline void SetEraseObject(bool er) { m_eraseObject = er; } - -public: - int m_type; - float m_xoffset; - float m_yoffset; - wxShape* m_shape; - wxCursor* m_oldCursor; - bool m_eraseObject; // If TRUE, erases object before dragging handle. - -}; - -class wxPolygonControlPoint: public wxControlPoint -{ - DECLARE_DYNAMIC_CLASS(wxPolygonControlPoint) - - public: - wxPolygonControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, float size = 0.0, wxRealPoint *vertex = NULL, - float the_xoffset = 0.0, float the_yoffset = 0.0); - ~wxPolygonControlPoint(); - - void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); - void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); - void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); - -public: - wxRealPoint* m_polygonVertex; - wxRealPoint m_originalSize; - float m_originalDistance; -}; - -/* - * Object regions. - * Every shape has one or more text regions with various - * properties. Not all of a region's properties will be used - * by a shape. - * - */ - -class wxShapeRegion: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxShapeRegion) - - public: - // Constructor - wxShapeRegion(); - // Copy constructor - wxShapeRegion(wxShapeRegion& region); - // Destructor - ~wxShapeRegion(); - - // Accessors - inline void SetText(const wxString& s) { m_regionText = s; } - void SetFont(wxFont *f); - void SetMinSize(float w, float h); - void SetSize(float w, float h); - void SetPosition(float x, float y); - void SetProportions(float x, float y); - void SetFormatMode(int mode); - inline void SetName(const wxString& s) { m_regionName = s; }; - void SetColour(const wxString& col); // Text colour - - inline wxString GetText() const { return m_regionText; } - inline wxFont *GetFont() const { return m_font; } - inline void GetMinSize(float *x, float *y) const { *x = m_minWidth; *y = m_minHeight; } - inline void GetProportion(float *x, float *y) const { *x = m_regionProportionX; *y = m_regionProportionY; } - inline void GetSize(float *x, float *y) const { *x = m_width; *y = m_height; } - inline void GetPosition(float *xp, float *yp) const { *xp = m_x; *yp = m_y; } - inline int GetFormatMode() const { return m_formatMode; } - inline wxString GetName() const { return m_regionName; } - inline wxString GetColour() const { return m_textColour; } - wxColour *GetActualColourObject(); - inline wxList& GetFormattedText() { return m_formattedText; } - inline wxString GetPenColour() const { return m_penColour; } - inline int GetPenStyle() const { return m_penStyle; } - inline void SetPenStyle(int style) { m_penStyle = style; m_actualPenObject = NULL; } - void SetPenColour(const wxString& col); - wxPen *GetActualPen(); - inline float GetWidth() const { return m_width; } - inline float GetHeight() const { return m_height; } - - void ClearText(); - -public: - wxString m_regionText; - wxList m_formattedText; // List of wxShapeTextLines - wxFont* m_font; - float m_minHeight; // If zero, hide region. - float m_minWidth; // If zero, hide region. - float m_width; - float m_height; - float m_x; - float m_y; - - float m_regionProportionX; // Proportion of total object size; - // -1.0 indicates equal proportion - float m_regionProportionY; // Proportion of total object size; - // -1.0 indicates equal proportion - - int m_formatMode; // FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT | FORMAT_NONE - wxString m_regionName; - wxString m_textColour; - wxColour* m_actualColourObject; // For speed purposes - - // New members for specifying divided rectangle division colour/style 30/6/94 - wxString m_penColour; - int m_penStyle; - wxPen* m_actualPenObject; - -}; - -/* - * User-defined attachment point - */ - -class wxAttachmentPoint: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxAttachmentPoint) - -public: - inline wxAttachmentPoint() - { - m_id = 0; m_x = 0.0; m_y = 0.0; - } - -public: - int m_id; // Identifier - float m_x; // x offset from centre of object - float m_y; // y offset from centre of object -}; - -#endif - // _OGL_BASICP_H_ diff --git a/utils/ogl/src/bitmap.cpp b/utils/ogl/src/bitmap.cpp deleted file mode 100644 index cbbdae1ab2..0000000000 --- a/utils/ogl/src/bitmap.cpp +++ /dev/null @@ -1,126 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: bitmap.cpp -// Purpose: Bitmap shape class -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "bitmap.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#ifdef PROLOGIO -#include -#endif - -#include "basic.h" -#include "basicp.h" -#include "canvas.h" -#include "bitmap.h" -#include "misc.h" - -/* - * Bitmap object - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxBitmapShape, wxShape) - -wxBitmapShape::wxBitmapShape():wxRectangleShape(100.0, 50.0) -{ - m_filename = ""; -} - -wxBitmapShape::~wxBitmapShape() -{ -} - -void wxBitmapShape::OnDraw(wxDC& dc) -{ - if (!m_bitmap.Ok()) - return; - - wxMemoryDC tempDC; - tempDC.SelectObject(m_bitmap); - float x, y; - x = (long)(m_xpos - m_bitmap.GetWidth() / 2.0); - y = (long)(m_ypos - m_bitmap.GetHeight() / 2.0); - dc.Blit(x, y, m_bitmap.GetWidth(), m_bitmap.GetHeight(), &tempDC, 0, 0); -} - -void wxBitmapShape::SetSize(float w, float h, bool recursive) -{ - if (m_bitmap.Ok()) - { - w = m_bitmap.GetWidth(); - h = m_bitmap.GetHeight(); - } - - SetAttachmentSize(w, h); - - m_width = w; - m_height = h; - SetDefaultRegionSize(); -} - -#ifdef PROLOGIO -// Prolog database stuff -char *wxBitmapShape::GetFunctor() -{ - return "node_image"; -} - -void wxBitmapShape::WritePrologAttributes(wxExpr *clause) -{ - // Can't really save the bitmap; so instantiate the bitmap - // at a higher level in the application, from a symbol library. - wxRectangleShape::WritePrologAttributes(clause); - clause->AddAttributeValueString("filename", m_filename); -} - -void wxBitmapShape::ReadPrologAttributes(wxExpr *clause) -{ - wxRectangleShape::ReadPrologAttributes(clause); - clause->GetAttributeValue("filename", m_filename); -} -#endif - -// Does the copying for this object -void wxBitmapShape::Copy(wxBitmapShape& copy) -{ - wxRectangleShape::Copy(copy); - copy.m_bitmap = m_bitmap; - copy.SetFilename(m_filename); -} - -// Returns a new instance, and does the copy for this class. Define for each class. -wxShape *wxBitmapShape::PrivateCopy() -{ - wxBitmapShape *obj = new wxBitmapShape; - Copy(*obj); - return obj; -} - -void wxBitmapShape::SetBitmap(const wxBitmap& bm) -{ - m_bitmap = bm; - if (m_bitmap.Ok()) - SetSize(m_bitmap.GetWidth(), m_bitmap.GetHeight()); -} - - diff --git a/utils/ogl/src/bitmap.h b/utils/ogl/src/bitmap.h deleted file mode 100644 index 7f6e1b2b10..0000000000 --- a/utils/ogl/src/bitmap.h +++ /dev/null @@ -1,57 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: bitmap.h -// Purpose: wxBitmapShape -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_BITMAP_H_ -#define _OGL_BITMAP_H_ - -#ifdef __GNUG__ -#pragma interface "bitmap.h" -#endif - -#include "basic.h" - -class wxBitmapShape: public wxRectangleShape -{ - DECLARE_DYNAMIC_CLASS(wxBitmapShape) - public: - wxBitmapShape(); - ~wxBitmapShape(); - - void OnDraw(wxDC& dc); - -#ifdef PROLOGIO - // Prolog database stuff - char *GetFunctor(); - void WritePrologAttributes(wxExpr *clause); - void ReadPrologAttributes(wxExpr *clause); -#endif - - // Does the copying for this object - void Copy(wxBitmapShape& copy); - - // Returns a new instance, and does the copy for this class. Define for each class. - wxShape *PrivateCopy(); - - void SetSize(float w, float h, bool recursive = TRUE); - inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; } - void SetBitmap(const wxBitmap& bm); - inline void SetFilename(const wxString& f) { m_filename = f; }; - inline wxString GetFilename() const { return m_filename; } - -private: - wxBitmap m_bitmap; - wxString m_filename; -}; - -#endif - // _OGL_BITMAP_H_ - - diff --git a/utils/ogl/src/canvas.cpp b/utils/ogl/src/canvas.cpp deleted file mode 100644 index 8d75a44269..0000000000 --- a/utils/ogl/src/canvas.cpp +++ /dev/null @@ -1,511 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: canvas.cpp -// Purpose: Shape canvas class -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "canvas.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#ifdef PROLOGIO -#include -#endif - -#if USE_IOSTREAMH -#include -#else -#include -#endif - -#include -#include -#include - -#include "basic.h" -#include "basicp.h" -#include "canvas.h" -#include "ogldiag.h" -#include "misc.h" -#include "lines.h" -#include "composit.h" - -#define CONTROL_POINT_SIZE 6 - -// Control point types -// Rectangle and most other shapes -#define CONTROL_POINT_VERTICAL 1 -#define CONTROL_POINT_HORIZONTAL 2 -#define CONTROL_POINT_DIAGONAL 3 - -// Line -#define CONTROL_POINT_ENDPOINT_TO 4 -#define CONTROL_POINT_ENDPOINT_FROM 5 -#define CONTROL_POINT_LINE 6 - -extern wxCursor *GraphicsBullseyeCursor; - -IMPLEMENT_DYNAMIC_CLASS(wxShapeCanvas, wxScrolledWindow) - -BEGIN_EVENT_TABLE(wxShapeCanvas, wxScrolledWindow) - EVT_PAINT(wxShapeCanvas::OnPaint) - EVT_MOUSE_EVENTS(wxShapeCanvas::OnMouseEvent) -END_EVENT_TABLE() - -// Object canvas -wxShapeCanvas::wxShapeCanvas(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style): - wxScrolledWindow(parent, id, pos, size, style) -{ - m_shapeDiagram = NULL; - m_dragState = NoDragging; - m_draggedShape = NULL; - m_oldDragX = 0; - m_oldDragY = 0; - m_firstDragX = 0; - m_firstDragY = 0; - m_checkTolerance = TRUE; -} - -wxShapeCanvas::~wxShapeCanvas() -{ -} - -void wxShapeCanvas::OnPaint(wxPaintEvent& event) -{ - wxPaintDC dc(this); - - PrepareDC(dc); - - dc.Clear(); - - if (GetDiagram()) - GetDiagram()->Redraw(dc); -} - -void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event) -{ - wxClientDC dc(this); - PrepareDC(dc); - - wxPoint logPos(event.GetLogicalPosition(dc)); - - float x, y; - x = (float) logPos.x; - y = (float) logPos.y; - - int keys = 0; - if (event.ShiftDown()) - keys = keys | KEY_SHIFT; - if (event.ControlDown()) - keys = keys | KEY_CTRL; - - bool dragging = event.Dragging(); - - // Check if we're within the tolerance for mouse movements. - // If we're very close to the position we started dragging - // from, this may not be an intentional drag at all. - if (dragging) - { - int dx = abs(dc.LogicalToDeviceX(x - m_firstDragX)); - int dy = abs(dc.LogicalToDeviceY(y - m_firstDragY)); - if (m_checkTolerance && (dx <= GetDiagram()->GetMouseTolerance()) && (dy <= GetDiagram()->GetMouseTolerance())) - { - return; - } - else - // If we've ignored the tolerance once, then ALWAYS ignore - // tolerance in this drag, even if we come back within - // the tolerance range. - m_checkTolerance = FALSE; - } - - // Dragging - note that the effect of dragging is left entirely up - // to the object, so no movement is done unless explicitly done by - // object. - if (dragging && m_draggedShape && m_dragState == StartDraggingLeft) - { - m_dragState = ContinueDraggingLeft; - - // If the object isn't m_draggable, transfer message to canvas - if (m_draggedShape->Draggable()) - m_draggedShape->GetEventHandler()->OnBeginDragLeft((float)x, (float)y, keys, m_draggedAttachment); - else - { - m_draggedShape = NULL; - OnBeginDragLeft((float)x, (float)y, keys); - } - - m_oldDragX = x; m_oldDragY = y; - } - else if (dragging && m_draggedShape && m_dragState == ContinueDraggingLeft) - { - // Continue dragging - m_draggedShape->GetEventHandler()->OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys, m_draggedAttachment); - m_draggedShape->GetEventHandler()->OnDragLeft(TRUE, (float)x, (float)y, keys, m_draggedAttachment); - m_oldDragX = x; m_oldDragY = y; - } - else if (event.LeftUp() && m_draggedShape && m_dragState == ContinueDraggingLeft) - { - m_dragState = NoDragging; - m_checkTolerance = TRUE; - - m_draggedShape->GetEventHandler()->OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys, m_draggedAttachment); - - m_draggedShape->GetEventHandler()->OnEndDragLeft((float)x, (float)y, keys, m_draggedAttachment); - m_draggedShape = NULL; - } - else if (dragging && m_draggedShape && m_dragState == StartDraggingRight) - { - m_dragState = ContinueDraggingRight; - - if (m_draggedShape->Draggable()) - m_draggedShape->GetEventHandler()->OnBeginDragRight((float)x, (float)y, keys, m_draggedAttachment); - else - { - m_draggedShape = NULL; - OnBeginDragRight((float)x, (float)y, keys); - } - m_oldDragX = x; m_oldDragY = y; - } - else if (dragging && m_draggedShape && m_dragState == ContinueDraggingRight) - { - // Continue dragging - m_draggedShape->GetEventHandler()->OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys, m_draggedAttachment); - m_draggedShape->GetEventHandler()->OnDragRight(TRUE, (float)x, (float)y, keys, m_draggedAttachment); - m_oldDragX = x; m_oldDragY = y; - } - else if (event.RightUp() && m_draggedShape && m_dragState == ContinueDraggingRight) - { - m_dragState = NoDragging; - m_checkTolerance = TRUE; - - m_draggedShape->GetEventHandler()->OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys, m_draggedAttachment); - - m_draggedShape->GetEventHandler()->OnEndDragRight((float)x, (float)y, keys, m_draggedAttachment); - m_draggedShape = NULL; - } - - // All following events sent to canvas, not object - else if (dragging && !m_draggedShape && m_dragState == StartDraggingLeft) - { - m_dragState = ContinueDraggingLeft; - OnBeginDragLeft((float)x, (float)y, keys); - m_oldDragX = x; m_oldDragY = y; - } - else if (dragging && !m_draggedShape && m_dragState == ContinueDraggingLeft) - { - // Continue dragging - OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys); - OnDragLeft(TRUE, (float)x, (float)y, keys); - m_oldDragX = x; m_oldDragY = y; - } - else if (event.LeftUp() && !m_draggedShape && m_dragState == ContinueDraggingLeft) - { - m_dragState = NoDragging; - m_checkTolerance = TRUE; - - OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys); - OnEndDragLeft((float)x, (float)y, keys); - m_draggedShape = NULL; - } - else if (dragging && !m_draggedShape && m_dragState == StartDraggingRight) - { - m_dragState = ContinueDraggingRight; - OnBeginDragRight((float)x, (float)y, keys); - m_oldDragX = x; m_oldDragY = y; - } - else if (dragging && !m_draggedShape && m_dragState == ContinueDraggingRight) - { - // Continue dragging - OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys); - OnDragRight(TRUE, (float)x, (float)y, keys); - m_oldDragX = x; m_oldDragY = y; - } - else if (event.RightUp() && !m_draggedShape && m_dragState == ContinueDraggingRight) - { - m_dragState = NoDragging; - m_checkTolerance = TRUE; - - OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys); - OnEndDragRight((float)x, (float)y, keys); - m_draggedShape = NULL; - } - - // Non-dragging events - else if (event.IsButton()) - { - m_checkTolerance = TRUE; - - // Find the nearest object - int attachment = 0; - wxShape *nearest_object = FindShape(x, y, &attachment); - if (nearest_object) // Object event - { - if (event.LeftDown()) - { - m_draggedShape = nearest_object; - m_draggedAttachment = attachment; - m_dragState = StartDraggingLeft; - m_firstDragX = x; - m_firstDragY = y; - } - else if (event.LeftUp()) - { - // N.B. Only register a click if the same object was - // identified for down *and* up. - if (nearest_object == m_draggedShape) - nearest_object->GetEventHandler()->OnLeftClick((float)x, (float)y, keys, attachment); - - m_draggedShape = NULL; - m_dragState = NoDragging; - } - else if (event.RightDown()) - { - m_draggedShape = nearest_object; - m_draggedAttachment = attachment; - m_dragState = StartDraggingRight; - m_firstDragX = x; - m_firstDragY = y; - } - else if (event.RightUp()) - { - if (nearest_object == m_draggedShape) - nearest_object->GetEventHandler()->OnRightClick((float)x, (float)y, keys, attachment); - - m_draggedShape = NULL; - m_dragState = NoDragging; - } - } - else // Canvas event (no nearest object) - { - if (event.LeftDown()) - { - m_draggedShape = NULL; - m_dragState = StartDraggingLeft; - m_firstDragX = x; - m_firstDragY = y; - } - else if (event.LeftUp()) - { - OnLeftClick((float)x, (float)y, keys); - - m_draggedShape = NULL; - m_dragState = NoDragging; - } - else if (event.RightDown()) - { - m_draggedShape = NULL; - m_dragState = StartDraggingRight; - m_firstDragX = x; - m_firstDragY = y; - } - else if (event.RightUp()) - { - OnRightClick((float)x, (float)y, keys); - - m_draggedShape = NULL; - m_dragState = NoDragging; - } - } - } -} - -/* - * Try to find a sensitive object, working up the hierarchy of composites. - * - */ -wxShape *wxShapeCanvas::FindFirstSensitiveShape(float x, float y, int *new_attachment, int op) -{ - wxShape *image = FindShape(x, y, new_attachment); - if (!image) return NULL; - - wxShape *actualImage = FindFirstSensitiveShape1(image, op); - if (actualImage) - { - float dist; - // Find actual attachment - actualImage->HitTest(x, y, new_attachment, &dist); - } - return actualImage; -} - -wxShape *wxShapeCanvas::FindFirstSensitiveShape1(wxShape *image, int op) -{ - if (image->GetSensitivityFilter() & op) - return image; - if (image->GetParent()) - return FindFirstSensitiveShape1(image->GetParent(), op); - return NULL; -} - -// Helper function: TRUE if 'contains' wholly contains 'contained'. -static bool WhollyContains(wxShape *contains, wxShape *contained) -{ - float xp1, yp1, xp2, yp2; - float w1, h1, w2, h2; - float left1, top1, right1, bottom1, left2, top2, right2, bottom2; - - xp1 = contains->GetX(); yp1 = contains->GetY(); xp2 = contained->GetX(); yp2 = contained->GetY(); - contains->GetBoundingBoxMax(&w1, &h1); - contained->GetBoundingBoxMax(&w2, &h2); - - left1 = (float)(xp1 - (w1 / 2.0)); - top1 = (float)(yp1 - (h1 / 2.0)); - right1 = (float)(xp1 + (w1 / 2.0)); - bottom1 = (float)(yp1 + (h1 / 2.0)); - - left2 = (float)(xp2 - (w2 / 2.0)); - top2 = (float)(yp2 - (h2 / 2.0)); - right2 = (float)(xp2 + (w2 / 2.0)); - bottom2 = (float)(yp2 + (h2 / 2.0)); - - return ((left1 <= left2) && (top1 <= top2) && (right1 >= right2) && (bottom1 >= bottom2)); -} - -wxShape *wxShapeCanvas::FindShape(float x, float y, int *attachment, wxClassInfo *info, wxShape *notObject) -{ - float nearest = 100000.0; - int nearest_attachment = 0; - wxShape *nearest_object = NULL; - - // Go backward through the object list, since we want: - // (a) to have the control points drawn LAST to overlay - // the other objects - // (b) to find the control points FIRST if they exist - - wxNode *current = GetDiagram()->GetShapeList()->Last(); - while (current) - { - wxShape *object = (wxShape *)current->Data(); - - float dist; - int temp_attachment; - - // First pass for lines, which might be inside a container, so we - // want lines to take priority over containers. This first loop - // could fail if we clickout side a line, so then we'll - // try other shapes. - if (object->IsShown() && - object->IsKindOf(CLASSINFO(wxLineShape)) && - object->HitTest(x, y, &temp_attachment, &dist) && - ((info == NULL) || object->IsKindOf(info)) && - (!notObject || !notObject->HasDescendant(object))) - { - // A line is trickier to spot than a normal object. - // For a line, since it's the diagonal of the box - // we use for the hit test, we may have several - // lines in the box and therefore we need to be able - // to specify the nearest point to the centre of the line - // as our hit criterion, to give the user some room for - // manouevre. - if (dist < nearest) - { - nearest = dist; - nearest_object = object; - nearest_attachment = temp_attachment; - } - } - if (current) - current = current->Previous(); - } - - current = GetDiagram()->GetShapeList()->Last(); - while (current) - { - wxShape *object = (wxShape *)current->Data(); - float dist; - int temp_attachment; - - // On second pass, only ever consider non-composites or divisions. If children want to pass - // up control to the composite, that's up to them. - if (object->IsShown() && (object->IsKindOf(CLASSINFO(wxDivisionShape)) || !object->IsKindOf(CLASSINFO(wxCompositeShape))) - && object->HitTest(x, y, &temp_attachment, &dist) && ((info == NULL) || object->IsKindOf(info)) && - (!notObject || !notObject->HasDescendant(object))) - { - if (!object->IsKindOf(CLASSINFO(wxLineShape))) - { - // If we've hit a container, and we have already found a line in the - // first pass, then ignore the container in case the line is in the container. - // Check for division in case line straddles divisions (i.e. is not wholly contained). - if (!nearest_object || !(object->IsKindOf(CLASSINFO(wxDivisionShape)) || WhollyContains(object, nearest_object))) - { - nearest = dist; - nearest_object = object; - nearest_attachment = temp_attachment; - current = NULL; - } - } - } - if (current) - current = current->Previous(); - } - - *attachment = nearest_attachment; - return nearest_object; -} - -/* - * Higher-level events called by OnEvent - * - */ - -void wxShapeCanvas::OnLeftClick(float x, float y, int keys) -{ -} - -void wxShapeCanvas::OnRightClick(float x, float y, int keys) -{ -} - -void wxShapeCanvas::OnDragLeft(bool draw, float x, float y, int keys) -{ -} - -void wxShapeCanvas::OnBeginDragLeft(float x, float y, int keys) -{ -} - -void wxShapeCanvas::OnEndDragLeft(float x, float y, int keys) -{ -} - -void wxShapeCanvas::OnDragRight(bool draw, float x, float y, int keys) -{ -} - -void wxShapeCanvas::OnBeginDragRight(float x, float y, int keys) -{ -} - -void wxShapeCanvas::OnEndDragRight(float x, float y, int keys) -{ -} - -void wxShapeCanvas::AddShape(wxShape *object, wxShape *addAfter) - { GetDiagram()->AddShape(object, addAfter); } -void wxShapeCanvas::InsertShape(wxShape *object) - { GetDiagram()->InsertShape(object); } -void wxShapeCanvas::RemoveShape(wxShape *object) - { GetDiagram()->RemoveShape(object); } -bool wxShapeCanvas::GetQuickEditMode() - { return GetDiagram()->GetQuickEditMode(); } -void wxShapeCanvas::Redraw(wxDC& dc) - { GetDiagram()->Redraw(dc); } -void wxShapeCanvas::Snap(float *x, float *y) - { GetDiagram()->Snap(x, y); } diff --git a/utils/ogl/src/canvas.h b/utils/ogl/src/canvas.h deleted file mode 100644 index 4d33b2d5ec..0000000000 --- a/utils/ogl/src/canvas.h +++ /dev/null @@ -1,83 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: canvas.h -// Purpose: wxShapeCanvas -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_CANVAS_H_ -#define _OGL_CANVAS_H_ - -#ifdef __GNUG__ -#pragma interface "canvas.h" -#endif - -// Drag states -#define NoDragging 0 -#define StartDraggingLeft 1 -#define ContinueDraggingLeft 2 -#define StartDraggingRight 3 -#define ContinueDraggingRight 4 - -// When drag_count reaches 0, process drag message - -class wxDiagram; - -class wxShapeCanvas: public wxScrolledWindow -{ - DECLARE_DYNAMIC_CLASS(wxShapeCanvas) - public: - wxShapeCanvas(wxWindow *parent = NULL, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxBORDER | wxRETAINED); - ~wxShapeCanvas(); - - inline void SetDiagram(wxDiagram *diag) { m_shapeDiagram = diag; } - inline wxDiagram *GetDiagram() const { return m_shapeDiagram; } - - virtual void OnLeftClick(float x, float y, int keys = 0); - virtual void OnRightClick(float x, float y, int keys = 0); - - virtual void OnDragLeft(bool draw, float x, float y, int keys=0); // Erase if draw false - virtual void OnBeginDragLeft(float x, float y, int keys=0); - virtual void OnEndDragLeft(float x, float y, int keys=0); - - virtual void OnDragRight(bool draw, float x, float y, int keys=0); // Erase if draw false - virtual void OnBeginDragRight(float x, float y, int keys=0); - virtual void OnEndDragRight(float x, float y, int keys=0); - - // Find object for mouse click, of given wxClassInfo (NULL for any type). - // If notImage is non-NULL, don't find an object that is equal to or a descendant of notImage - virtual wxShape *FindShape(float x, float y, int *attachment, wxClassInfo *info = NULL, wxShape *notImage = NULL); - wxShape *FindFirstSensitiveShape(float x, float y, int *new_attachment, int op); - wxShape *FindFirstSensitiveShape1(wxShape *image, int op); - - // Redirect to wxDiagram object - virtual void AddShape(wxShape *object, wxShape *addAfter = NULL); - virtual void InsertShape(wxShape *object); - virtual void RemoveShape(wxShape *object); - virtual bool GetQuickEditMode(); - virtual void Redraw(wxDC& dc); - void Snap(float *x, float *y); - - // Events - void OnPaint(wxPaintEvent& event); - void OnMouseEvent(wxMouseEvent& event); - - protected: - wxDiagram* m_shapeDiagram; - int m_dragState; - float m_oldDragX, m_oldDragY; // Previous drag coordinates - float m_firstDragX, m_firstDragY; // INITIAL drag coordinates - bool m_checkTolerance; // Whether to check drag tolerance - wxShape* m_draggedShape; - int m_draggedAttachment; - -DECLARE_EVENT_TABLE() -}; - -#endif - // _OGL_CANVAS_H_ diff --git a/utils/ogl/src/composit.cpp b/utils/ogl/src/composit.cpp deleted file mode 100644 index 7cca70c056..0000000000 --- a/utils/ogl/src/composit.cpp +++ /dev/null @@ -1,1769 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: composit.cpp -// Purpose: Composite OGL class -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "composit.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#ifdef PROLOGIO -#include -#endif - -#include "basic.h" -#include "basicp.h" -#include "constrnt.h" -#include "composit.h" -#include "misc.h" -#include "canvas.h" - -// Sometimes, objects need to access the whole database to -// construct themselves. -wxExprDatabase *GlobalwxExprDatabase = NULL; - -// Popup menu for editing divisions -wxMenu *oglPopupDivisionMenu = NULL; - -/* - * Division control point - */ - -class wxDivisionControlPoint: public wxControlPoint -{ - DECLARE_DYNAMIC_CLASS(wxDivisionControlPoint) - public: - wxDivisionControlPoint() {} - wxDivisionControlPoint(wxShapeCanvas *the_canvas, wxShape *object, float size, float the_xoffset, float the_yoffset, int the_type); - ~wxDivisionControlPoint(); - - void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); - void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); - void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); -}; - -IMPLEMENT_DYNAMIC_CLASS(wxDivisionControlPoint, wxControlPoint) - -/* - * Composite object - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxCompositeShape, wxRectangleShape) - -wxCompositeShape::wxCompositeShape(): wxRectangleShape(10.0, 10.0) -{ -// selectable = FALSE; - m_oldX = m_xpos; - m_oldY = m_ypos; -} - -wxCompositeShape::~wxCompositeShape() -{ - wxNode *node = m_constraints.First(); - while (node) - { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); - delete constraint; - node = node->Next(); - } - node = m_children.First(); - while (node) - { - wxShape *object = (wxShape *)node->Data(); - wxNode *next = node->Next(); - object->Unlink(); - delete object; - node = next; - } -} - -void wxCompositeShape::OnDraw(wxDC& dc) -{ - float x1 = (float)(m_xpos - m_width/2.0); - float y1 = (float)(m_ypos - m_height/2.0); - - if (m_shadowMode != SHADOW_NONE) - { - if (m_shadowBrush) - dc.SetBrush(m_shadowBrush); - dc.SetPen(transparent_pen); - - if (m_cornerRadius != 0.0) - dc.DrawRoundedRectangle(x1 + m_shadowOffsetX, y1 + m_shadowOffsetY, - m_width, m_height, m_cornerRadius); - else - dc.DrawRectangle(x1 + m_shadowOffsetX, y1 + m_shadowOffsetY, m_width, m_height); - } -} - -void wxCompositeShape::OnDrawContents(wxDC& dc) -{ - wxNode *node = m_children.First(); - while (node) - { - wxShape *object = (wxShape *)node->Data(); - object->Draw(dc); - object->DrawLinks(dc); - node = node->Next(); - } - wxShape::OnDrawContents(dc); -} - -bool wxCompositeShape::OnMovePre(wxDC& dc, float x, float y, float oldx, float oldy, bool display) -{ - float diffX = x - oldx; - float diffY = y - oldy; - wxNode *node = m_children.First(); - while (node) - { - wxShape *object = (wxShape *)node->Data(); - - object->Erase(dc); - object->Move(dc, object->GetX() + diffX, object->GetY() + diffY, display); - - node = node->Next(); - } - return TRUE; -} - -void wxCompositeShape::OnErase(wxDC& dc) -{ - wxRectangleShape::OnErase(dc); - wxNode *node = m_children.First(); - while (node) - { - wxShape *object = (wxShape *)node->Data(); - object->Erase(dc); - node = node->Next(); - } -} - -static float objectStartX = 0.0; -static float objectStartY = 0.0; - -void wxCompositeShape::OnDragLeft(bool draw, float x, float y, int keys, int attachment) -{ - float xx = x; - float yy = y; - m_canvas->Snap(&xx, &yy); - float offsetX = xx - objectStartX; - float offsetY = yy - objectStartY; - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - dc.SetLogicalFunction(wxXOR); - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush((* wxTRANSPARENT_BRUSH)); - - GetEventHandler()->OnDrawOutline(dc, GetX() + offsetX, GetY() + offsetY, GetWidth(), GetHeight()); -// wxShape::OnDragLeft(draw, x, y, keys, attachment); -} - -void wxCompositeShape::OnBeginDragLeft(float x, float y, int keys, int attachment) -{ - objectStartX = x; - objectStartY = y; - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - Erase(dc); - - dc.SetLogicalFunction(wxXOR); - - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush((* wxTRANSPARENT_BRUSH)); - m_canvas->CaptureMouse(); - - float xx = x; - float yy = y; - m_canvas->Snap(&xx, &yy); - float offsetX = xx - objectStartX; - float offsetY = yy - objectStartY; - - GetEventHandler()->OnDrawOutline(dc, GetX() + offsetX, GetY() + offsetY, GetWidth(), GetHeight()); - -// wxShape::OnBeginDragLeft(x, y, keys, attachment); -} - -void wxCompositeShape::OnEndDragLeft(float x, float y, int keys, int attachment) -{ -// wxShape::OnEndDragLeft(x, y, keys, attachment); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - m_canvas->ReleaseMouse(); - - if (!m_draggable) - { - if (m_parent) m_parent->GetEventHandler()->OnEndDragLeft(x, y, keys, 0); - return; - } - - dc.SetLogicalFunction(wxCOPY); - float xx = x; - float yy = y; - m_canvas->Snap(&xx, &yy); - float offsetX = xx - objectStartX; - float offsetY = yy - objectStartY; - - Move(dc, GetX() + offsetX, GetY() + offsetY); - - if (m_canvas && !m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc); -} - -void wxCompositeShape::OnRightClick(float x, float y, int keys, int attachment) -{ - // If we get a ctrl-right click, this means send the message to - // the division, so we can invoke a user interface for dealing with regions. - if (keys & KEY_CTRL) - { - wxNode *node = m_divisions.First(); - while (node) - { - wxDivisionShape *division = (wxDivisionShape *)node->Data(); - wxNode *next = node->Next(); - int attach = 0; - float dist = 0.0; - if (division->HitTest(x, y, &attach, &dist)) - { - division->GetEventHandler()->OnRightClick(x, y, keys, attach); - node = NULL; - } - if (node) - node = next; - } - } -} - -void wxCompositeShape::SetSize(float w, float h, bool recursive) -{ - SetAttachmentSize(w, h); - - float xScale = (float)(w/(wxMax(1.0, GetWidth()))); - float yScale = (float)(h/(wxMax(1.0, GetHeight()))); - - m_width = w; - m_height = h; - - if (!recursive) return; - - wxNode *node = m_children.First(); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - float xBound, yBound; - while (node) - { - wxShape *object = (wxShape *)node->Data(); - - // Scale the position first - float newX = (float)(((object->GetX() - GetX())*xScale) + GetX()); - float newY = (float)(((object->GetY() - GetY())*yScale) + GetY()); - object->Show(FALSE); - object->Move(dc, newX, newY); - object->Show(TRUE); - - // Now set the scaled size - object->GetBoundingBoxMin(&xBound, &yBound); - object->SetSize(object->GetFixedWidth() ? xBound : xScale*xBound, - object->GetFixedHeight() ? yBound : yScale*yBound); - - node = node->Next(); - } - SetDefaultRegionSize(); -} - -void wxCompositeShape::AddChild(wxShape *child, wxShape *addAfter) -{ - m_children.Append(child); - child->SetParent(this); - if (m_canvas) - { - // Ensure we add at the right position - if (addAfter) - child->RemoveFromCanvas(m_canvas); - child->AddToCanvas(m_canvas, addAfter); - } -} - -void wxCompositeShape::RemoveChild(wxShape *child) -{ - m_children.DeleteObject(child); - m_divisions.DeleteObject(child); - RemoveChildFromConstraints(child); - child->SetParent(NULL); -} - -void wxCompositeShape::DeleteConstraintsInvolvingChild(wxShape *child) -{ - wxNode *node = m_constraints.First(); - while (node) - { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); - wxNode *nextNode = node->Next(); - - if ((constraint->m_constrainingObject == child) || - constraint->m_constrainedObjects.Member(child)) - { - delete constraint; - delete node; - } - node = nextNode; - } -} - -void wxCompositeShape::RemoveChildFromConstraints(wxShape *child) -{ - wxNode *node = m_constraints.First(); - while (node) - { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); - wxNode *nextNode = node->Next(); - - if (constraint->m_constrainedObjects.Member(child)) - constraint->m_constrainedObjects.DeleteObject(child); - if (constraint->m_constrainingObject == child) - constraint->m_constrainingObject = NULL; - - // Delete the constraint if no participants left - if (!constraint->m_constrainingObject) - { - delete constraint; - delete node; - } - - node = nextNode; - } -} - -void wxCompositeShape::Copy(wxCompositeShape& copy) -{ - wxRectangleShape::Copy(copy); - - // Associate old and new copies for copying constraints and division geometry - wxObjectCopyMapping.Append((long)this, ©); - - // Copy the children - wxNode *node = m_children.First(); - while (node) - { - wxShape *object = (wxShape *)node->Data(); - wxShape *newObject = object->PrivateCopy(); - if (newObject->GetId() == 0) - newObject->SetId(NewId()); - - newObject->SetParent(©); - copy.m_children.Append(newObject); - - // Some m_children may be divisions - if (m_divisions.Member(object)) - copy.m_divisions.Append(newObject); - - wxObjectCopyMapping.Append((long)object, newObject); - - node = node->Next(); - } - - // Copy the constraints - node = m_constraints.First(); - while (node) - { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); - - wxShape *newConstraining = (wxShape *)(wxObjectCopyMapping.Find((long)constraint->m_constrainingObject)->Data()); - - wxList newConstrainedList; - wxNode *node2 = constraint->m_constrainedObjects.First(); - while (node2) - { - wxShape *constrainedObject = (wxShape *)node2->Data(); - wxShape *newConstrained = (wxShape *)(wxObjectCopyMapping.Find((long)constrainedObject)->Data()); - newConstrainedList.Append(newConstrained); - node2 = node2->Next(); - } - - OGLConstraint *newConstraint = new OGLConstraint(constraint->m_constraintType, newConstraining, - newConstrainedList); - newConstraint->m_constraintId = constraint->m_constraintId; - if (constraint->m_constraintName) - { - newConstraint->m_constraintName = constraint->m_constraintName; - } - newConstraint->SetSpacing(constraint->m_xSpacing, constraint->m_ySpacing); - copy.m_constraints.Append(newConstraint); - - node = node->Next(); - } - - // Now copy the division geometry - node = m_divisions.First(); - while (node) - { - wxDivisionShape *division = (wxDivisionShape *)node->Data(); - wxNode *node1 = wxObjectCopyMapping.Find((long)division); - wxNode *leftNode = NULL; - wxNode *topNode = NULL; - wxNode *rightNode = NULL; - wxNode *bottomNode = NULL; - if (division->GetLeftSide()) - leftNode = wxObjectCopyMapping.Find((long)division->GetLeftSide()); - if (division->GetTopSide()) - topNode = wxObjectCopyMapping.Find((long)division->GetTopSide()); - if (division->GetRightSide()) - rightNode = wxObjectCopyMapping.Find((long)division->GetRightSide()); - if (division->GetBottomSide()) - bottomNode = wxObjectCopyMapping.Find((long)division->GetBottomSide()); - if (node1) - { - wxDivisionShape *newDivision = (wxDivisionShape *)node1->Data(); - if (leftNode) - newDivision->SetLeftSide((wxDivisionShape *)leftNode->Data()); - if (topNode) - newDivision->SetTopSide((wxDivisionShape *)topNode->Data()); - if (rightNode) - newDivision->SetRightSide((wxDivisionShape *)rightNode->Data()); - if (bottomNode) - newDivision->SetBottomSide((wxDivisionShape *)bottomNode->Data()); - } - node = node->Next(); - } -} - -wxShape *wxCompositeShape::PrivateCopy() -{ - wxCompositeShape *obj = new wxCompositeShape; - Copy(*obj); - return obj; -} - -OGLConstraint *wxCompositeShape::AddConstraint(OGLConstraint *constraint) -{ - m_constraints.Append(constraint); - if (constraint->m_constraintId == 0) - constraint->m_constraintId = NewId(); - return constraint; -} - -OGLConstraint *wxCompositeShape::AddConstraint(int type, wxShape *constraining, wxList& constrained) -{ - OGLConstraint *constraint = new OGLConstraint(type, constraining, constrained); - if (constraint->m_constraintId == 0) - constraint->m_constraintId = NewId(); - m_constraints.Append(constraint); - return constraint; -} - -OGLConstraint *wxCompositeShape::AddConstraint(int type, wxShape *constraining, wxShape *constrained) -{ - wxList l; - l.Append(constrained); - OGLConstraint *constraint = new OGLConstraint(type, constraining, l); - if (constraint->m_constraintId == 0) - constraint->m_constraintId = NewId(); - m_constraints.Append(constraint); - return constraint; -} - -OGLConstraint *wxCompositeShape::FindConstraint(long cId, wxCompositeShape **actualComposite) -{ - wxNode *node = m_constraints.First(); - while (node) - { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); - if (constraint->m_constraintId == cId) - { - if (actualComposite) - *actualComposite = this; - return constraint; - } - node = node->Next(); - } - // If not found, try children. - node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - if (child->IsKindOf(CLASSINFO(wxCompositeShape))) - { - OGLConstraint *constraint = ((wxCompositeShape *)child)->FindConstraint(cId, actualComposite); - if (constraint) - { - if (actualComposite) - *actualComposite = (wxCompositeShape *)child; - return constraint; - } - } - node = node->Next(); - } - return NULL; -} - -void wxCompositeShape::DeleteConstraint(OGLConstraint *constraint) -{ - m_constraints.DeleteObject(constraint); - delete constraint; -} - -void wxCompositeShape::CalculateSize() -{ - float maxX = (float) -999999.9; - float maxY = (float) -999999.9; - float minX = (float) 999999.9; - float minY = (float) 999999.9; - - float w, h; - wxNode *node = m_children.First(); - while (node) - { - wxShape *object = (wxShape *)node->Data(); - - // Recalculate size of composite objects because may not conform - // to size it was set to - depends on the children. - object->CalculateSize(); - - object->GetBoundingBoxMax(&w, &h); - if ((object->GetX() + (w/2.0)) > maxX) - maxX = (float)(object->GetX() + (w/2.0)); - if ((object->GetX() - (w/2.0)) < minX) - minX = (float)(object->GetX() - (w/2.0)); - if ((object->GetY() + (h/2.0)) > maxY) - maxY = (float)(object->GetY() + (h/2.0)); - if ((object->GetY() - (h/2.0)) < minY) - minY = (float)(object->GetY() - (h/2.0)); - - node = node->Next(); - } - m_width = maxX - minX; - m_height = maxY - minY; - m_xpos = (float)(m_width/2.0 + minX); - m_ypos = (float)(m_height/2.0 + minY); -} - -bool wxCompositeShape::Recompute() -{ - int noIterations = 0; - bool changed = TRUE; - while (changed && (noIterations < 500)) - { - changed = Constrain(); - noIterations ++; - } -/* -#ifdef wx_x - if (changed) - cerr << "Warning: constraint algorithm failed after 500 iterations.\n"; -#endif -*/ - return (!changed); -} - -bool wxCompositeShape::Constrain() -{ - CalculateSize(); - - bool changed = FALSE; - wxNode *node = m_children.First(); - while (node) - { - wxShape *object = (wxShape *)node->Data(); - if (object->Constrain()) - changed = TRUE; - node = node->Next(); - } - - node = m_constraints.First(); - while (node) - { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); - if (constraint->Evaluate()) changed = TRUE; - node = node->Next(); - } - return changed; -} - -#ifdef PROLOGIO -void wxCompositeShape::WritePrologAttributes(wxExpr *clause) -{ - wxRectangleShape::WritePrologAttributes(clause); - -// clause->AddAttributeValue("selectable", (long)selectable); - - // Output constraints as constraint1 = (...), constraint2 = (...), etc. - int constraintNo = 1; - char m_constraintNameBuf[20]; - wxNode *node = m_constraints.First(); - while (node) - { - OGLConstraint *constraint = (OGLConstraint *)node->Data(); - sprintf(m_constraintNameBuf, "constraint%d", constraintNo); - - // Each constraint is stored in the form - // (type name id xspacing yspacing m_constrainingObjectId constrainedObjectIdList) - wxExpr *constraintExpr = new wxExpr(PrologList); - constraintExpr->Append(new wxExpr((long)constraint->m_constraintType)); - constraintExpr->Append(new wxExpr(PrologString, constraint->m_constraintName)); - constraintExpr->Append(new wxExpr(constraint->m_constraintId)); - constraintExpr->Append(new wxExpr(constraint->m_xSpacing)); - constraintExpr->Append(new wxExpr(constraint->m_ySpacing)); - constraintExpr->Append(new wxExpr(constraint->m_constrainingObject->GetId())); - - wxExpr *objectList = new wxExpr(PrologList); - wxNode *node1 = constraint->m_constrainedObjects.First(); - while (node1) - { - wxShape *obj = (wxShape *)node1->Data(); - objectList->Append(new wxExpr(obj->GetId())); - node1 = node1->Next(); - } - constraintExpr->Append(objectList); - - clause->AddAttributeValue(m_constraintNameBuf, constraintExpr); - - node = node->Next(); - constraintNo ++; - } - - // Write the ids of all the child images - wxExpr *childrenExpr = new wxExpr(PrologList); - node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - childrenExpr->Append(new wxExpr(child->GetId())); - node = node->Next(); - } - clause->AddAttributeValue("children", childrenExpr); - - // Write the ids of all the division images - if (m_divisions.Number() > 0) - { - wxExpr *divisionsExpr = new wxExpr(PrologList); - node = m_divisions.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - divisionsExpr->Append(new wxExpr(child->GetId())); - node = node->Next(); - } - clause->AddAttributeValue("divisions", divisionsExpr); - } -} - -// Problem. Child images are always written AFTER the parent -// so as to be able to link up to parent. So we may not be able -// to find the constraint participants until we've read everything -// in. Need to have another pass for composites. -void wxCompositeShape::ReadPrologAttributes(wxExpr *clause) -{ - wxRectangleShape::ReadPrologAttributes(clause); - -// clause->GetAttributeValue("selectable", selectable); -} - -void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database) -{ - // Constraints are output as constraint1 = (...), constraint2 = (...), etc. - int constraintNo = 1; - char m_constraintNameBuf[20]; - bool haveConstraints = TRUE; - - while (haveConstraints) - { - sprintf(m_constraintNameBuf, "constraint%d", constraintNo); - wxExpr *constraintExpr = NULL; - clause->GetAttributeValue(m_constraintNameBuf, &constraintExpr); - if (!constraintExpr) - { - haveConstraints = FALSE; - break; - } - int cType = 0; - float cXSpacing = 0.0; - float cYSpacing = 0.0; - wxString cName(""); - long cId = 0; - wxShape *m_constrainingObject = NULL; - wxList m_constrainedObjects; - - // Each constraint is stored in the form - // (type name id xspacing yspacing m_constrainingObjectId constrainedObjectIdList) - - wxExpr *typeExpr = constraintExpr->Nth(0); - wxExpr *nameExpr = constraintExpr->Nth(1); - wxExpr *idExpr = constraintExpr->Nth(2); - wxExpr *xExpr = constraintExpr->Nth(3); - wxExpr *yExpr = constraintExpr->Nth(4); - wxExpr *constrainingExpr = constraintExpr->Nth(5); - wxExpr *constrainedExpr = constraintExpr->Nth(6); - - cType = (int)typeExpr->IntegerValue(); - cXSpacing = xExpr->RealValue(); - cYSpacing = yExpr->RealValue(); - cName = nameExpr->StringValue(); - cId = idExpr->IntegerValue(); - - wxExpr *objExpr1 = database->HashFind("node_image", constrainingExpr->IntegerValue()); - if (objExpr1 && objExpr1->GetClientData()) - m_constrainingObject = (wxShape *)objExpr1->GetClientData(); - else - wxFatalError("Couldn't find constraining image of composite.", "Object graphics error"); - - int i = 0; - wxExpr *currentIdExpr = constrainedExpr->Nth(i); - while (currentIdExpr) - { - long currentId = currentIdExpr->IntegerValue(); - wxExpr *objExpr2 = database->HashFind("node_image", currentId); - if (objExpr2 && objExpr2->GetClientData()) - { - m_constrainedObjects.Append((wxShape *)objExpr2->GetClientData()); - } - else - { - wxFatalError("Couldn't find constrained image of composite.", "Object graphics error"); - } - - i ++; - currentIdExpr = constrainedExpr->Nth(i); - } - OGLConstraint *newConstraint = AddConstraint(cType, m_constrainingObject, m_constrainedObjects); - newConstraint->SetSpacing(cXSpacing, cYSpacing); - newConstraint->m_constraintId = cId; - newConstraint->m_constraintName = (const char*) cName; - constraintNo ++; - } -} -#endif - -// Make this composite into a container by creating one wxDivisionShape -void wxCompositeShape::MakeContainer() -{ - wxDivisionShape *division = OnCreateDivision(); - m_divisions.Append(division); - AddChild(division); - - division->SetSize(m_width, m_height); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - division->Move(dc, GetX(), GetY()); - Recompute(); - division->Show(TRUE); -} - -wxDivisionShape *wxCompositeShape::OnCreateDivision() -{ - return new wxDivisionShape; -} - -wxShape *wxCompositeShape::FindContainerImage() -{ - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - if (!m_divisions.Member(child)) - return child; - node = node->Next(); - } - return NULL; -} - -// Returns TRUE if division is a descendant of this container -bool wxCompositeShape::ContainsDivision(wxDivisionShape *division) -{ - if (m_divisions.Member(division)) - return TRUE; - wxNode *node = m_children.First(); - while (node) - { - wxShape *child = (wxShape *)node->Data(); - if (child->IsKindOf(CLASSINFO(wxCompositeShape))) - { - bool ans = ((wxCompositeShape *)child)->ContainsDivision(division); - if (ans) - return TRUE; - } - node = node->Next(); - } - return FALSE; -} - -/* - * Division object - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxDivisionShape, wxCompositeShape) - -wxDivisionShape::wxDivisionShape() -{ - SetSensitivityFilter(OP_CLICK_LEFT | OP_CLICK_RIGHT | OP_DRAG_RIGHT); - SetCentreResize(FALSE); - SetAttachmentMode(TRUE); - m_leftSide = NULL; - m_rightSide = NULL; - m_topSide = NULL; - m_bottomSide = NULL; - m_handleSide = DIVISION_SIDE_NONE; - m_leftSidePen = wxBLACK_PEN; - m_topSidePen = wxBLACK_PEN; - m_leftSideColour = "BLACK"; - m_topSideColour = "BLACK"; - m_leftSideStyle = "Solid"; - m_topSideStyle = "Solid"; - ClearRegions(); -} - -wxDivisionShape::~wxDivisionShape() -{ -} - -void wxDivisionShape::OnDraw(wxDC& dc) -{ - dc.SetBrush(wxTRANSPARENT_BRUSH); - dc.SetBackgroundMode(wxTRANSPARENT); - - float x1 = (float)(GetX() - (GetWidth()/2.0)); - float y1 = (float)(GetY() - (GetHeight()/2.0)); - float x2 = (float)(GetX() + (GetWidth()/2.0)); - float y2 = (float)(GetY() + (GetHeight()/2.0)); - - // Should subtract 1 pixel if drawing under Windows -#ifdef __WXMSW__ - y2 -= (float)1.0; -#endif - - if (m_leftSide) - { - dc.SetPen(m_leftSidePen); - dc.DrawLine(x1, y2, x1, y1); - } - if (m_topSide) - { - dc.SetPen(m_topSidePen); - dc.DrawLine(x1, y1, x2, y1); - } - - // For testing purposes, draw a rectangle so we know - // how big the division is. -// SetBrush(wxCYAN_BRUSH); -// wxRectangleShape::OnDraw(dc); -} - -void wxDivisionShape::OnDrawContents(wxDC& dc) -{ - wxCompositeShape::OnDrawContents(dc); -} - -bool wxDivisionShape::OnMovePre(wxDC& dc, float x, float y, float oldx, float oldy, bool display) -{ - float diffX = x - oldx; - float diffY = y - oldy; - wxNode *node = m_children.First(); - while (node) - { - wxShape *object = (wxShape *)node->Data(); - object->Erase(dc); - object->Move(dc, object->GetX() + diffX, object->GetY() + diffY, display); - node = node->Next(); - } - return TRUE; -} - -void wxDivisionShape::OnDragLeft(bool draw, float x, float y, int keys, int attachment) -{ - if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT) - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnDragLeft(draw, x, y, keys, attachment); - } - return; - } - wxShape::OnDragLeft(draw, x, y, keys, attachment); -} - -void wxDivisionShape::OnBeginDragLeft(float x, float y, int keys, int attachment) -{ - if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT) - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnBeginDragLeft(x, y, keys, attachment); - } - return; - } - - wxShape::OnBeginDragLeft(x, y, keys, attachment); -} - -void wxDivisionShape::OnEndDragLeft(float x, float y, int keys, int attachment) -{ - m_canvas->ReleaseMouse(); - if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT) - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnEndDragLeft(x, y, keys, attachment); - } - return; - } - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - dc.SetLogicalFunction(wxCOPY); - - m_canvas->Snap(&m_xpos, &m_ypos); - GetEventHandler()->OnMovePre(dc, x, y, m_oldX, m_oldY); - - ResetControlPoints(); - Draw(dc); - MoveLinks(dc); - GetEventHandler()->OnDrawControlPoints(dc); - - if (m_canvas && !m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc); -} - -void wxDivisionShape::SetSize(float w, float h, bool recursive) -{ - m_width = w; - m_height = h; - wxRectangleShape::SetSize(w, h, recursive); -} - -void wxDivisionShape::CalculateSize() -{ -} - -void wxDivisionShape::Copy(wxDivisionShape& copy) -{ - wxCompositeShape::Copy(copy); - - copy.m_leftSideStyle = m_leftSideStyle; - copy.m_topSideStyle = m_topSideStyle; - copy.m_leftSideColour = m_leftSideColour; - copy.m_topSideColour = m_topSideColour; - - copy.m_leftSidePen = m_leftSidePen; - copy.m_topSidePen = m_topSidePen; - copy.m_handleSide = m_handleSide; - - // Division geometry copying is handled at the wxCompositeShape level. -} - -wxShape *wxDivisionShape::PrivateCopy() -{ - wxDivisionShape *obj = new wxDivisionShape; - Copy(*obj); - return obj; -} - -#ifdef PROLOGIO -void wxDivisionShape::WritePrologAttributes(wxExpr *clause) -{ - wxCompositeShape::WritePrologAttributes(clause); - - if (m_leftSide) - clause->AddAttributeValue("left_side", (long)m_leftSide->GetId()); - if (m_topSide) - clause->AddAttributeValue("top_side", (long)m_topSide->GetId()); - if (m_rightSide) - clause->AddAttributeValue("right_side", (long)m_rightSide->GetId()); - if (m_bottomSide) - clause->AddAttributeValue("bottom_side", (long)m_bottomSide->GetId()); - - clause->AddAttributeValue("handle_side", (long)m_handleSide); - clause->AddAttributeValueString("left_colour", m_leftSideColour); - clause->AddAttributeValueString("top_colour", m_topSideColour); - clause->AddAttributeValueString("left_style", m_leftSideStyle); - clause->AddAttributeValueString("top_style", m_topSideStyle); -} - -void wxDivisionShape::ReadPrologAttributes(wxExpr *clause) -{ - wxCompositeShape::ReadPrologAttributes(clause); - - clause->GetAttributeValue("handle_side", m_handleSide); - clause->GetAttributeValue("left_colour", m_leftSideColour); - clause->GetAttributeValue("top_colour", m_topSideColour); - clause->GetAttributeValue("left_style", m_leftSideStyle); - clause->GetAttributeValue("top_style", m_topSideStyle); -} -#endif - -// Experimental -void wxDivisionShape::OnRightClick(float x, float y, int keys, int attachment) -{ - if (keys & KEY_CTRL) - { - PopupMenu(x, y); - } -/* - else if (keys & KEY_SHIFT) - { - if (m_leftSide || m_topSide || m_rightSide || m_bottomSide) - { - if (Selected()) - { - Select(FALSE); - GetParent()->Draw(dc); - } - else - Select(TRUE); - } - } -*/ - else - { - attachment = 0; - float dist; - if (m_parent) - { - m_parent->HitTest(x, y, &attachment, &dist); - m_parent->GetEventHandler()->OnRightClick(x, y, keys, attachment); - } - return; - } -} - - -// Divide wxHORIZONTALly or wxVERTICALly -bool wxDivisionShape::Divide(int direction) -{ - // Calculate existing top-left, bottom-right - float x1 = (float)(GetX() - (GetWidth()/2.0)); - float y1 = (float)(GetY() - (GetHeight()/2.0)); - wxCompositeShape *compositeParent = (wxCompositeShape *)GetParent(); - float oldWidth = GetWidth(); - float oldHeight = GetHeight(); - if (Selected()) - Select(FALSE); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - if (direction == wxVERTICAL) - { - // Dividing vertically means notionally putting a horizontal line through it. - // Break existing piece into two. - float newXPos1 = GetX(); - float newYPos1 = (float)(y1 + (GetHeight()/4.0)); - float newXPos2 = GetX(); - float newYPos2 = (float)(y1 + (3.0*GetHeight()/4.0)); - wxDivisionShape *newDivision = compositeParent->OnCreateDivision(); - newDivision->Show(TRUE); - - Erase(dc); - - // Anything adjoining the bottom of this division now adjoins the - // bottom of the new division. - wxNode *node = compositeParent->GetDivisions().First(); - while (node) - { - wxDivisionShape *obj = (wxDivisionShape *)node->Data(); - if (obj->GetTopSide() == this) - obj->SetTopSide(newDivision); - node = node->Next(); - } - newDivision->SetTopSide(this); - newDivision->SetBottomSide(m_bottomSide); - newDivision->SetLeftSide(m_leftSide); - newDivision->SetRightSide(m_rightSide); - m_bottomSide = newDivision; - - compositeParent->GetDivisions().Append(newDivision); - - // CHANGE: Need to insert this division at start of divisions in the object - // list, because e.g.: - // 1) Add division - // 2) Add contained object - // 3) Add division - // Division is now receiving mouse events _before_ the contained object, - // because it was added last (on top of all others) - - // Add after the image that visualizes the container - compositeParent->AddChild(newDivision, compositeParent->FindContainerImage()); - - m_handleSide = DIVISION_SIDE_BOTTOM; - newDivision->SetHandleSide(DIVISION_SIDE_TOP); - - SetSize(oldWidth, (float)(oldHeight/2.0)); - Move(dc, newXPos1, newYPos1); - - newDivision->SetSize(oldWidth, (float)(oldHeight/2.0)); - newDivision->Move(dc, newXPos2, newYPos2); - } - else - { - // Dividing horizontally means notionally putting a vertical line through it. - // Break existing piece into two. - float newXPos1 = (float)(x1 + (GetWidth()/4.0)); - float newYPos1 = GetY(); - float newXPos2 = (float)(x1 + (3.0*GetWidth()/4.0)); - float newYPos2 = GetY(); - wxDivisionShape *newDivision = compositeParent->OnCreateDivision(); - newDivision->Show(TRUE); - - Erase(dc); - - // Anything adjoining the left of this division now adjoins the - // left of the new division. - wxNode *node = compositeParent->GetDivisions().First(); - while (node) - { - wxDivisionShape *obj = (wxDivisionShape *)node->Data(); - if (obj->GetLeftSide() == this) - obj->SetLeftSide(newDivision); - node = node->Next(); - } - newDivision->SetTopSide(m_topSide); - newDivision->SetBottomSide(m_bottomSide); - newDivision->SetLeftSide(this); - newDivision->SetRightSide(m_rightSide); - m_rightSide = newDivision; - - compositeParent->GetDivisions().Append(newDivision); - compositeParent->AddChild(newDivision, compositeParent->FindContainerImage()); - - m_handleSide = DIVISION_SIDE_RIGHT; - newDivision->SetHandleSide(DIVISION_SIDE_LEFT); - - SetSize((float)(oldWidth/2.0), oldHeight); - Move(dc, newXPos1, newYPos1); - - newDivision->SetSize((float)(oldWidth/2.0), oldHeight); - newDivision->Move(dc, newXPos2, newYPos2); - } - if (compositeParent->Selected()) - { - compositeParent->DeleteControlPoints(& dc); - compositeParent->MakeControlPoints(); - compositeParent->MakeMandatoryControlPoints(); - } - compositeParent->Draw(dc); - return TRUE; -} - -// Make one control point for every visible line -void wxDivisionShape::MakeControlPoints() -{ - MakeMandatoryControlPoints(); -} - -void wxDivisionShape::MakeMandatoryControlPoints() -{ - float maxX, maxY; - - GetBoundingBoxMax(&maxX, &maxY); - float x, y; - int direction; -/* - if (m_leftSide) - { - x = (float)(-maxX/2.0); - y = 0.0; - wxDivisionControlPoint *control = new wxDivisionControlPoint(m_canvas, this, CONTROL_POINT_SIZE, x, y, - CONTROL_POINT_HORIZONTAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - } - if (m_topSide) - { - x = 0.0; - y = (float)(-maxY/2.0); - wxDivisionControlPoint *control = new wxDivisionControlPoint(m_canvas, this, CONTROL_POINT_SIZE, x, y, - CONTROL_POINT_VERTICAL); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - } -*/ - switch (m_handleSide) - { - case DIVISION_SIDE_LEFT: - { - x = (float)(-maxX/2.0); - y = 0.0; - direction = CONTROL_POINT_HORIZONTAL; - break; - } - case DIVISION_SIDE_TOP: - { - x = 0.0; - y = (float)(-maxY/2.0); - direction = CONTROL_POINT_VERTICAL; - break; - } - case DIVISION_SIDE_RIGHT: - { - x = (float)(maxX/2.0); - y = 0.0; - direction = CONTROL_POINT_HORIZONTAL; - break; - } - case DIVISION_SIDE_BOTTOM: - { - x = 0.0; - y = (float)(maxY/2.0); - direction = CONTROL_POINT_VERTICAL; - break; - } - default: - break; - } - if (m_handleSide != DIVISION_SIDE_NONE) - { - wxDivisionControlPoint *control = new wxDivisionControlPoint(m_canvas, this, CONTROL_POINT_SIZE, x, y, - direction); - m_canvas->AddShape(control); - m_controlPoints.Append(control); - } -} - -void wxDivisionShape::ResetControlPoints() -{ - ResetMandatoryControlPoints(); -} - -void wxDivisionShape::ResetMandatoryControlPoints() -{ - if (m_controlPoints.Number() < 1) - return; - - float maxX, maxY; - - GetBoundingBoxMax(&maxX, &maxY); -/* - wxNode *node = m_controlPoints.First(); - while (node) - { - wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data(); - if (control->type == CONTROL_POINT_HORIZONTAL) - { - control->xoffset = (float)(-maxX/2.0); control->m_yoffset = 0.0; - } - else if (control->type == CONTROL_POINT_VERTICAL) - { - control->xoffset = 0.0; control->m_yoffset = (float)(-maxY/2.0); - } - node = node->Next(); - } -*/ - wxNode *node = m_controlPoints.First(); - if ((m_handleSide == DIVISION_SIDE_LEFT) && node) - { - wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data(); - control->m_xoffset = (float)(-maxX/2.0); control->m_yoffset = 0.0; - } - - if ((m_handleSide == DIVISION_SIDE_TOP) && node) - { - wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data(); - control->m_xoffset = 0.0; control->m_yoffset = (float)(-maxY/2.0); - } - - if ((m_handleSide == DIVISION_SIDE_RIGHT) && node) - { - wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data(); - control->m_xoffset = (float)(maxX/2.0); control->m_yoffset = 0.0; - } - - if ((m_handleSide == DIVISION_SIDE_BOTTOM) && node) - { - wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data(); - control->m_xoffset = 0.0; control->m_yoffset = (float)(maxY/2.0); - } -} - -// Adjust a side, returning FALSE if it's not physically possible. -bool wxDivisionShape::AdjustLeft(float left, bool test) -{ - float x2 = (float)(GetX() + (GetWidth()/2.0)); - - if (left >= x2) - return FALSE; - if (test) - return TRUE; - - float newW = x2 - left; - float newX = (float)(left + newW/2.0); - SetSize(newW, GetHeight()); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - Move(dc, newX, GetY()); - - return TRUE; -} - -bool wxDivisionShape::AdjustTop(float top, bool test) -{ - float y2 = (float)(GetY() + (GetHeight()/2.0)); - - if (top >= y2) - return FALSE; - if (test) - return TRUE; - - float newH = y2 - top; - float newY = (float)(top + newH/2.0); - SetSize(GetWidth(), newH); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - Move(dc, GetX(), newY); - - return TRUE; -} - -bool wxDivisionShape::AdjustRight(float right, bool test) -{ - float x1 = (float)(GetX() - (GetWidth()/2.0)); - - if (right <= x1) - return FALSE; - if (test) - return TRUE; - - float newW = right - x1; - float newX = (float)(x1 + newW/2.0); - SetSize(newW, GetHeight()); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - Move(dc, newX, GetY()); - - return TRUE; -} - -bool wxDivisionShape::AdjustBottom(float bottom, bool test) -{ - float y1 = (float)(GetY() - (GetHeight()/2.0)); - - if (bottom <= y1) - return FALSE; - if (test) - return TRUE; - - float newH = bottom - y1; - float newY = (float)(y1 + newH/2.0); - SetSize(GetWidth(), newH); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - Move(dc, GetX(), newY); - - return TRUE; -} - -wxDivisionControlPoint::wxDivisionControlPoint(wxShapeCanvas *the_canvas, wxShape *object, float size, float the_xoffset, float the_yoffset, int the_type): - wxControlPoint(the_canvas, object, size, the_xoffset, the_yoffset, the_type) -{ - SetEraseObject(FALSE); -} - -wxDivisionControlPoint::~wxDivisionControlPoint() -{ -} - -static float originalX = 0.0; -static float originalY = 0.0; -static float originalW = 0.0; -static float originalH = 0.0; - -// Implement resizing of canvas object -void wxDivisionControlPoint::OnDragLeft(bool draw, float x, float y, int keys, int attachment) -{ - wxControlPoint::OnDragLeft(draw, x, y, keys, attachment); -} - -void wxDivisionControlPoint::OnBeginDragLeft(float x, float y, int keys, int attachment) -{ - wxDivisionShape *division = (wxDivisionShape *)m_shape; - originalX = division->GetX(); - originalY = division->GetY(); - originalW = division->GetWidth(); - originalH = division->GetHeight(); - - wxControlPoint::OnBeginDragLeft(x, y, keys, attachment); -} - -void wxDivisionControlPoint::OnEndDragLeft(float x, float y, int keys, int attachment) -{ - wxControlPoint::OnEndDragLeft(x, y, keys, attachment); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - wxDivisionShape *division = (wxDivisionShape *)m_shape; - wxCompositeShape *divisionParent = (wxCompositeShape *)division->GetParent(); - - // Need to check it's within the bounds of the parent composite. - float x1 = (float)(divisionParent->GetX() - (divisionParent->GetWidth()/2.0)); - float y1 = (float)(divisionParent->GetY() - (divisionParent->GetHeight()/2.0)); - float x2 = (float)(divisionParent->GetX() + (divisionParent->GetWidth()/2.0)); - float y2 = (float)(divisionParent->GetY() + (divisionParent->GetHeight()/2.0)); - - // Need to check it has not made the division zero or negative width/height - float dx1 = (float)(division->GetX() - (division->GetWidth()/2.0)); - float dy1 = (float)(division->GetY() - (division->GetHeight()/2.0)); - float dx2 = (float)(division->GetX() + (division->GetWidth()/2.0)); - float dy2 = (float)(division->GetY() + (division->GetHeight()/2.0)); - - bool success = TRUE; - switch (division->GetHandleSide()) - { - case DIVISION_SIDE_LEFT: - { - if ((x <= x1) || (x >= x2) || (x >= dx2)) - success = FALSE; - // Try it out first... - else if (!division->ResizeAdjoining(DIVISION_SIDE_LEFT, x, TRUE)) - success = FALSE; - else - division->ResizeAdjoining(DIVISION_SIDE_LEFT, x, FALSE); - - break; - } - case DIVISION_SIDE_TOP: - { - if ((y <= y1) || (y >= y2) || (y >= dy2)) - success = FALSE; - else if (!division->ResizeAdjoining(DIVISION_SIDE_TOP, y, TRUE)) - success = FALSE; - else - division->ResizeAdjoining(DIVISION_SIDE_TOP, y, FALSE); - - break; - } - case DIVISION_SIDE_RIGHT: - { - if ((x <= x1) || (x >= x2) || (x <= dx1)) - success = FALSE; - else if (!division->ResizeAdjoining(DIVISION_SIDE_RIGHT, x, TRUE)) - success = FALSE; - else - division->ResizeAdjoining(DIVISION_SIDE_RIGHT, x, FALSE); - - break; - } - case DIVISION_SIDE_BOTTOM: - { - if ((y <= y1) || (y >= y2) || (y <= dy1)) - success = FALSE; - else if (!division->ResizeAdjoining(DIVISION_SIDE_BOTTOM, y, TRUE)) - success = FALSE; - else - division->ResizeAdjoining(DIVISION_SIDE_BOTTOM, y, FALSE); - - break; - } - } - if (!success) - { - division->SetSize(originalW, originalH); - division->Move(dc, originalX, originalY); - } - divisionParent->Draw(dc); - division->GetEventHandler()->OnDrawControlPoints(dc); -} - -/* Resize adjoining divisions. - * - Behaviour should be as follows: - If right edge moves, find all objects whose left edge - adjoins this object, and move left edge accordingly. - If left..., move ... right. - If top..., move ... bottom. - If bottom..., move top. - If size goes to zero or end position is other side of start position, - resize to original size and return. - */ -bool wxDivisionShape::ResizeAdjoining(int side, float newPos, bool test) -{ - wxCompositeShape *divisionParent = (wxCompositeShape *)GetParent(); - wxNode *node = divisionParent->GetDivisions().First(); - while (node) - { - wxDivisionShape *division = (wxDivisionShape *)node->Data(); - switch (side) - { - case DIVISION_SIDE_LEFT: - { - if (division->m_rightSide == this) - { - bool success = division->AdjustRight(newPos, test); - if (!success && test) - return FALSE; - } - break; - } - case DIVISION_SIDE_TOP: - { - if (division->m_bottomSide == this) - { - bool success = division->AdjustBottom(newPos, test); - if (!success && test) - return FALSE; - } - break; - } - case DIVISION_SIDE_RIGHT: - { - if (division->m_leftSide == this) - { - bool success = division->AdjustLeft(newPos, test); - if (!success && test) - return FALSE; - } - break; - } - case DIVISION_SIDE_BOTTOM: - { - if (division->m_topSide == this) - { - bool success = division->AdjustTop(newPos, test); - if (!success && test) - return FALSE; - } - break; - } - default: - break; - } - node = node->Next(); - } - - return TRUE; -} - -/* - * Popup menu for editing divisions - * - */ - -void oglGraphicsDivisionMenuProc(wxMenu& menu, wxCommandEvent& event) -{ - wxDivisionShape *division = (wxDivisionShape *)menu.GetClientData(); - switch (event.GetInt()) - { - case DIVISION_MENU_SPLIT_HORIZONTALLY: - { - division->Divide(wxHORIZONTAL); - break; - } - case DIVISION_MENU_SPLIT_VERTICALLY: - { - division->Divide(wxVERTICAL); - break; - } - case DIVISION_MENU_EDIT_LEFT_EDGE: - { - division->EditEdge(DIVISION_SIDE_LEFT); - break; - } - case DIVISION_MENU_EDIT_TOP_EDGE: - { - division->EditEdge(DIVISION_SIDE_TOP); - break; - } - default: - break; - } -} - -void wxDivisionShape::EditEdge(int side) -{ - wxMessageBox("EditEdge() not implemented", "OGL", wxOK); - -#if 0 - wxBeginBusyCursor(); - - wxPen *currentPen = NULL; - char **pColour = NULL; - char **pStyle = NULL; - if (side == DIVISION_SIDE_LEFT) - { - currentPen = m_leftSidePen; - pColour = &m_leftSideColour; - pStyle = &m_leftSideStyle; - } - else - { - currentPen = m_topSidePen; - pColour = &m_topSideColour; - pStyle = &m_topSideStyle; - } - - GraphicsForm *form = new GraphicsForm("Containers"); - int lineWidth = currentPen->GetWidth(); - - form->Add(wxMakeFormShort("Width", &lineWidth, wxFORM_DEFAULT, NULL, NULL, wxVERTICAL, - 150)); - form->Add(wxMakeFormString("Colour", pColour, wxFORM_CHOICE, - new wxList(wxMakeConstraintStrings( - "BLACK" , - "BLUE" , - "BROWN" , - "CORAL" , - "CYAN" , - "DARK GREY" , - "DARK GREEN" , - "DIM GREY" , - "GREY" , - "GREEN" , - "LIGHT BLUE" , - "LIGHT GREY" , - "MAGENTA" , - "MAROON" , - "NAVY" , - "ORANGE" , - "PURPLE" , - "RED" , - "TURQUOISE" , - "VIOLET" , - "WHITE" , - "YELLOW" , - NULL), - NULL), NULL, wxVERTICAL, 150)); - form->Add(wxMakeFormString("Style", pStyle, wxFORM_CHOICE, - new wxList(wxMakeConstraintStrings( - "Solid" , - "Short Dash" , - "Long Dash" , - "Dot" , - "Dot Dash" , - NULL), - NULL), NULL, wxVERTICAL, 100)); - - wxDialogBox *dialog = new wxDialogBox(m_canvas->GetParent(), "Division properties", 10, 10, 500, 500); - if (GraphicsLabelFont) - dialog->SetLabelFont(GraphicsLabelFont); - if (GraphicsButtonFont) - dialog->SetButtonFont(GraphicsButtonFont); - - form->AssociatePanel(dialog); - form->dialog = dialog; - - dialog->Fit(); - dialog->Centre(wxBOTH); - - wxEndBusyCursor(); - dialog->Show(TRUE); - - int lineStyle = wxSOLID; - if (*pStyle) - { - if (strcmp(*pStyle, "Solid") == 0) - lineStyle = wxSOLID; - else if (strcmp(*pStyle, "Dot") == 0) - lineStyle = wxDOT; - else if (strcmp(*pStyle, "Short Dash") == 0) - lineStyle = wxSHORT_DASH; - else if (strcmp(*pStyle, "Long Dash") == 0) - lineStyle = wxLONG_DASH; - else if (strcmp(*pStyle, "Dot Dash") == 0) - lineStyle = wxDOT_DASH; - } - - wxPen *newPen = wxThePenList->FindOrCreatePen(*pColour, lineWidth, lineStyle); - if (!pen) - pen = wxBLACK_PEN; - if (side == DIVISION_SIDE_LEFT) - m_leftSidePen = newPen; - else - m_topSidePen = newPen; - - // Need to draw whole image again - wxCompositeShape *compositeParent = (wxCompositeShape *)GetParent(); - compositeParent->Draw(dc); -#endif -} - -// Popup menu -void wxDivisionShape::PopupMenu(float x, float y) -{ - oglPopupDivisionMenu->SetClientData((char *)this); - if (m_leftSide) - oglPopupDivisionMenu->Enable(DIVISION_MENU_EDIT_LEFT_EDGE, TRUE); - else - oglPopupDivisionMenu->Enable(DIVISION_MENU_EDIT_LEFT_EDGE, FALSE); - if (m_topSide) - oglPopupDivisionMenu->Enable(DIVISION_MENU_EDIT_TOP_EDGE, TRUE); - else - oglPopupDivisionMenu->Enable(DIVISION_MENU_EDIT_TOP_EDGE, FALSE); - - int x1, y1; - m_canvas->ViewStart(&x1, &y1); - - int unit_x, unit_y; - m_canvas->GetScrollPixelsPerUnit(&unit_x, &unit_y); - - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - int mouse_x = (int)(dc.LogicalToDeviceX(x - x1*unit_x)); - int mouse_y = (int)(dc.LogicalToDeviceY(y - y1*unit_y)); - - m_canvas->PopupMenu(oglPopupDivisionMenu, mouse_x, mouse_y); -} - -void wxDivisionShape::SetLeftSideColour(const wxString& colour) -{ - m_leftSideColour = colour; -} - -void wxDivisionShape::SetTopSideColour(const wxString& colour) -{ - m_topSideColour = colour; -} - -void wxDivisionShape::SetLeftSideStyle(const wxString& style) -{ - m_leftSideStyle = style; -} - -void wxDivisionShape::SetTopSideStyle(const wxString& style) -{ - m_topSideStyle = style; -} - diff --git a/utils/ogl/src/composit.h b/utils/ogl/src/composit.h deleted file mode 100644 index eac0eff62a..0000000000 --- a/utils/ogl/src/composit.h +++ /dev/null @@ -1,244 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: composit.h -// Purpose: wxCompositeShape -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_COMPOSIT_H_ -#define _OGL_COMPOSIT_H_ - -#ifdef __GNUG__ -#pragma interface "composit.h" -#endif - -class wxDivisionShape; -class OGLConstraint; - -/* - * A composite object is an invisible rectangle surrounding all children - * - */ - -class wxCompositeShape: public wxRectangleShape -{ - DECLARE_DYNAMIC_CLASS(wxCompositeShape) -public: - - wxCompositeShape(); - ~wxCompositeShape(); - - void OnDraw(wxDC& dc); - void OnDrawContents(wxDC& dc); - void OnErase(wxDC& dc); - bool OnMovePre(wxDC& dc, float x, float y, float oldX, float oldY, bool display = TRUE); - void OnDragLeft(bool draw, float x, float y, int keys, int attachment = 0); - void OnBeginDragLeft(float x, float y, int keys, int attachment = 0); - void OnEndDragLeft(float x, float y, int keys, int attachment = 0); - - void OnRightClick(float x, float y, int keys, int attachment = 0); - - void SetSize(float w, float h, bool recursive = TRUE); - - // Returns TRUE if it settled down - bool Recompute(); - - // New members - void AddChild(wxShape *child, wxShape *addAfter = NULL); - void RemoveChild(wxShape *child); - - OGLConstraint *AddConstraint(OGLConstraint *constraint); - OGLConstraint *AddConstraint(int type, wxShape *constraining, wxList& constrained); - OGLConstraint *AddConstraint(int type, wxShape *constraining, wxShape *constrained); - - void DeleteConstraint(OGLConstraint *constraint); - - // Delete constraints that involve this child. - void DeleteConstraintsInvolvingChild(wxShape *child); - - // Remove the image from any constraints involving it, but DON'T - // remove any constraints. - void RemoveChildFromConstraints(wxShape *child); - - // Find constraint, also returning actual composite the constraint was in, - // in case it had to find it recursively. - OGLConstraint *FindConstraint(long id, wxCompositeShape **actualComposite = NULL); - - // Returns TRUE if something changed - bool Constrain(); - - // Make this composite into a container by creating one wxDivisionShape - void MakeContainer(); - - // Calculates size and position of composite object based on children - void CalculateSize(); - -#ifdef PROLOGIO - // Prolog database stuff - void WritePrologAttributes(wxExpr *clause); - void ReadPrologAttributes(wxExpr *clause); - // In case the object has constraints it needs to read in in a different pass - void ReadConstraints(wxExpr *clause, wxExprDatabase *database); -#endif - // Does the copying for this object - void Copy(wxCompositeShape& copy); - wxShape *PrivateCopy(); - - virtual wxDivisionShape *OnCreateDivision(); - - // Finds the image used to visualize a container. This is any child - // of the composite that is not in the divisions list. - wxShape *FindContainerImage(); - - // Returns TRUE if division is a descendant of this container - bool ContainsDivision(wxDivisionShape *division); - - inline wxList& GetDivisions() const { return (wxList&) m_divisions; } - inline wxList& GetConstraints() const { return (wxList&) m_constraints; } - -protected: - float m_oldX; - float m_oldY; - wxList m_constraints; - wxList m_divisions; // In case it's a container -}; - -/* - * A division object is a composite with special properties, - * to be used for containment. It's a subdivision of a container. - * A containing node image consists of a composite with a main child shape - * such as rounded rectangle, plus a list of division objects. - * It needs to be a composite because a division contains pieces - * of diagram. - * NOTE a container has at least one wxDivisionShape for consistency. - * This can be subdivided, so it turns into two objects, then each of - * these can be subdivided, etc. - */ -#define DIVISION_SIDE_NONE 0 -#define DIVISION_SIDE_LEFT 1 -#define DIVISION_SIDE_TOP 2 -#define DIVISION_SIDE_RIGHT 3 -#define DIVISION_SIDE_BOTTOM 4 - -class wxDivisionShape: public wxCompositeShape -{ - DECLARE_DYNAMIC_CLASS(wxDivisionShape) - public: - - wxDivisionShape(); - ~wxDivisionShape(); - - void OnDraw(wxDC& dc); - void OnDrawContents(wxDC& dc); - bool OnMovePre(wxDC& dc, float x, float y, float oldX, float oldY, bool display = TRUE); - void OnDragLeft(bool draw, float x, float y, int keys, int attachment = 0); - void OnBeginDragLeft(float x, float y, int keys, int attachment = 0); - void OnEndDragLeft(float x, float y, int keys, int attachment = 0); - - void OnRightClick(float x, float y, int keys = 0, int attachment = 0); - - // Don't want this kind of composite to resize its subdiagrams, so - // override composite's SetSize. - void SetSize(float w, float h, bool recursive = TRUE); - - // Similarly for calculating size: it's fixed at whatever SetSize - // set it to, not in terms of children. - void CalculateSize(); - - void MakeControlPoints(); - void ResetControlPoints(); - void MakeMandatoryControlPoints(); - void ResetMandatoryControlPoints(); - -#ifdef PROLOGIO - // Prolog database stuff - void WritePrologAttributes(wxExpr *clause); - void ReadPrologAttributes(wxExpr *clause); -#endif - // Does the copying for this object - void Copy(wxDivisionShape& copy); - wxShape *PrivateCopy(); - - // Divide horizontally (wxHORIZONTAL) or vertically (wxVERTICAL) - bool Divide(int direction); - - // Resize adjoining divisions at the given side. If test is TRUE, - // just see whether it's possible for each adjoining region, - // returning FALSE if it's not. - bool ResizeAdjoining(int side, float newPos, bool test); - - // Adjust a side, returning FALSE if it's not physically possible. - bool AdjustLeft(float left, bool test); - bool AdjustTop(float top, bool test); - bool AdjustRight(float right, bool test); - bool AdjustBottom(float bottom, bool test); - - // Edit style of left or top side - void EditEdge(int side); - - // Popup menu - void PopupMenu(float x, float y); - - inline void SetLeftSide(wxDivisionShape *shape) { m_leftSide = shape; } - inline void SetTopSide(wxDivisionShape *shape) { m_topSide = shape; } - inline void SetRightSide(wxDivisionShape *shape) { m_rightSide = shape; } - inline void SetBottomSide(wxDivisionShape *shape) { m_bottomSide = shape; } - inline wxDivisionShape *GetLeftSide() const { return m_leftSide; } - inline wxDivisionShape *GetTopSide() const { return m_topSide; } - inline wxDivisionShape *GetRightSide() const { return m_rightSide; } - inline wxDivisionShape *GetBottomSide() const { return m_bottomSide; } - - inline void SetHandleSide(int side) { m_handleSide = side; } - inline int GetHandleSide() const { return m_handleSide; } - - inline void SetLeftSidePen(wxPen *pen) { m_leftSidePen = pen; } - inline wxPen *GetLeftSidePen() const { return m_leftSidePen; } - inline void SetTopSidePen(wxPen *pen) { m_topSidePen = pen; } - inline wxPen *GetTopSidePen() const { return m_topSidePen; } - - void SetLeftSideColour(const wxString& colour); - void SetTopSideColour(const wxString& colour); - void SetLeftSideStyle(const wxString& style); - void SetTopSideStyle(const wxString& style); - - inline wxString GetLeftSideColour() const { return m_leftSideColour; } - inline wxString GetTopSideColour() const { return m_topSideColour; } - inline wxString GetLeftSideStyle() const { return m_leftSideStyle; } - inline wxString GetTopSideStyle() const { return m_topSideStyle; } - - protected: - // Adjoining divisions. NULL indicates edge - // of container, and that side shouldn't be - // drawn. - wxDivisionShape* m_leftSide; - wxDivisionShape* m_rightSide; - wxDivisionShape* m_topSide; - wxDivisionShape* m_bottomSide; - - int m_handleSide; // Side at which handle is legal - - wxPen* m_leftSidePen; - wxPen* m_topSidePen; - wxString m_leftSideColour; - wxString m_topSideColour; - wxString m_leftSideStyle; - wxString m_topSideStyle; -}; - -extern wxMenu *oglPopupDivisionMenu; -extern void oglGraphicsDivisionMenuProc(wxMenu& menu, wxCommandEvent& event); - -#define DIVISION_MENU_SPLIT_HORIZONTALLY 1 -#define DIVISION_MENU_SPLIT_VERTICALLY 2 -#define DIVISION_MENU_EDIT_LEFT_EDGE 3 -#define DIVISION_MENU_EDIT_TOP_EDGE 4 -#define DIVISION_MENU_EDIT_RIGHT_EDGE 5 -#define DIVISION_MENU_EDIT_BOTTOM_EDGE 6 -#define DIVISION_MENU_DELETE_ALL 7 - -#endif - // _OGL_COMPOSIT_H_ diff --git a/utils/ogl/src/constrnt.cpp b/utils/ogl/src/constrnt.cpp deleted file mode 100644 index 55542d3b94..0000000000 --- a/utils/ogl/src/constrnt.cpp +++ /dev/null @@ -1,600 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: constrnt.cpp -// Purpose: OGL Constraint classes -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "constrnt.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#ifdef PROLOGIO -#include -#endif - -#include "basic.h" -#include "constrnt.h" -#include "canvas.h" - -wxList OGLConstraintTypes(wxKEY_INTEGER); - -/* - * Constraint type - * - */ - -IMPLEMENT_DYNAMIC_CLASS(OGLConstraintType, wxObject) - -OGLConstraintType::OGLConstraintType(int theType, const wxString& theName, const wxString& thePhrase) -{ - m_type = theType; - m_name = theName; - m_phrase = thePhrase; -} - -OGLConstraintType::~OGLConstraintType() -{ -} - -void OGLInitializeConstraintTypes() -{ - OGLConstraintTypes.Append(gyCONSTRAINT_CENTRED_VERTICALLY, - new OGLConstraintType(gyCONSTRAINT_CENTRED_VERTICALLY, "Centre vertically", "centred vertically w.r.t.")); - - OGLConstraintTypes.Append(gyCONSTRAINT_CENTRED_HORIZONTALLY, - new OGLConstraintType(gyCONSTRAINT_CENTRED_HORIZONTALLY, "Centre horizontally", "centred horizontally w.r.t.")); - - OGLConstraintTypes.Append(gyCONSTRAINT_CENTRED_BOTH, - new OGLConstraintType(gyCONSTRAINT_CENTRED_BOTH, "Centre", "centred w.r.t.")); - - OGLConstraintTypes.Append(gyCONSTRAINT_LEFT_OF, - new OGLConstraintType(gyCONSTRAINT_LEFT_OF, "Left of", "left of")); - - OGLConstraintTypes.Append(gyCONSTRAINT_RIGHT_OF, - new OGLConstraintType(gyCONSTRAINT_RIGHT_OF, "Right of", "right of")); - - OGLConstraintTypes.Append(gyCONSTRAINT_ABOVE, - new OGLConstraintType(gyCONSTRAINT_ABOVE, "Above", "above")); - - OGLConstraintTypes.Append(gyCONSTRAINT_BELOW, - new OGLConstraintType(gyCONSTRAINT_BELOW, "Below", "below")); - - // Alignment - OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_TOP, - new OGLConstraintType(gyCONSTRAINT_ALIGNED_TOP, "Top-aligned", "aligned to the top of")); - - OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_BOTTOM, - new OGLConstraintType(gyCONSTRAINT_ALIGNED_BOTTOM, "Bottom-aligned", "aligned to the bottom of")); - - OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_LEFT, - new OGLConstraintType(gyCONSTRAINT_ALIGNED_LEFT, "Left-aligned", "aligned to the left of")); - - OGLConstraintTypes.Append(gyCONSTRAINT_ALIGNED_RIGHT, - new OGLConstraintType(gyCONSTRAINT_ALIGNED_RIGHT, "Right-aligned", "aligned to the right of")); - - // Mid-alignment - OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_TOP, - new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_TOP, "Top-midaligned", "centred on the top of")); - - OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_BOTTOM, - new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_BOTTOM, "Bottom-midaligned", "centred on the bottom of")); - - OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_LEFT, - new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_LEFT, "Left-midaligned", "centred on the left of")); - - OGLConstraintTypes.Append(gyCONSTRAINT_MIDALIGNED_RIGHT, - new OGLConstraintType(gyCONSTRAINT_MIDALIGNED_RIGHT, "Right-midaligned", "centred on the right of")); -} - -/* - * Constraint Stuff - * - */ - -IMPLEMENT_DYNAMIC_CLASS(OGLConstraint, wxObject) - -OGLConstraint::OGLConstraint(int type, wxShape *constraining, wxList& constrained) -{ - m_xSpacing = 0.0; - m_ySpacing = 0.0; - - m_constraintType = type; - m_constrainingObject = constraining; - - m_constraintId = 0; - m_constraintName = "noname"; - - wxNode *node = constrained.First(); - while (node) - { - m_constrainedObjects.Append(node->Data()); - node = node->Next(); - } -} - -OGLConstraint::~OGLConstraint() -{ -} - -bool OGLConstraint::Equals(float a, float b) -{ - float marg = 0.5; - - bool eq = ((b <= a + marg) && (b >= a - marg)); - return eq; -} - -// Return TRUE if anything changed -bool OGLConstraint::Evaluate() -{ - float maxWidth, maxHeight, minWidth, minHeight, x, y; - m_constrainingObject->GetBoundingBoxMax(&maxWidth, &maxHeight); - m_constrainingObject->GetBoundingBoxMin(&minWidth, &minHeight); - x = m_constrainingObject->GetX(); - y = m_constrainingObject->GetY(); - - wxClientDC dc(m_constrainingObject->GetCanvas()); - m_constrainingObject->GetCanvas()->PrepareDC(dc); - - switch (m_constraintType) - { - case gyCONSTRAINT_CENTRED_VERTICALLY: - { - int n = m_constrainedObjects.Number(); - float totalObjectHeight = 0.0; - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - totalObjectHeight += height2; - node = node->Next(); - } - float startY; - float spacingY; - // Check if within the constraining object... - if ((totalObjectHeight + (n + 1)*m_ySpacing) <= minHeight) - { - spacingY = (float)((minHeight - totalObjectHeight)/(n + 1)); - startY = (float)(y - (minHeight/2.0)); - } - // Otherwise, use default spacing - else - { - spacingY = m_ySpacing; - startY = (float)(y - ((totalObjectHeight + (n+1)*spacingY)/2.0)); - } - - // Now position the objects - bool changed = FALSE; - node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - startY += (float)(spacingY + (height2/2.0)); - if (!Equals(startY, constrainedObject->GetY())) - { - constrainedObject->Move(dc, constrainedObject->GetX(), startY, FALSE); - changed = TRUE; - } - startY += (float)(height2/2.0); - node = node->Next(); - } - return changed; - } - case gyCONSTRAINT_CENTRED_HORIZONTALLY: - { - int n = m_constrainedObjects.Number(); - float totalObjectWidth = 0.0; - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - totalObjectWidth += width2; - node = node->Next(); - } - float startX; - float spacingX; - // Check if within the constraining object... - if ((totalObjectWidth + (n + 1)*m_xSpacing) <= minWidth) - { - spacingX = (float)((minWidth - totalObjectWidth)/(n + 1)); - startX = (float)(x - (minWidth/2.0)); - } - // Otherwise, use default spacing - else - { - spacingX = m_xSpacing; - startX = (float)(x - ((totalObjectWidth + (n+1)*spacingX)/2.0)); - } - - // Now position the objects - bool changed = FALSE; - node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - startX += (float)(spacingX + (width2/2.0)); - if (!Equals(startX, constrainedObject->GetX())) - { - constrainedObject->Move(dc, startX, constrainedObject->GetY(), FALSE); - changed = TRUE; - } - startX += (float)(width2/2.0); - node = node->Next(); - } - return changed; - } - case gyCONSTRAINT_CENTRED_BOTH: - { - int n = m_constrainedObjects.Number(); - float totalObjectWidth = 0.0; - float totalObjectHeight = 0.0; - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - totalObjectWidth += width2; - totalObjectHeight += height2; - node = node->Next(); - } - float startX; - float spacingX; - float startY; - float spacingY; - - // Check if within the constraining object... - if ((totalObjectWidth + (n + 1)*m_xSpacing) <= minWidth) - { - spacingX = (float)((minWidth - totalObjectWidth)/(n + 1)); - startX = (float)(x - (minWidth/2.0)); - } - // Otherwise, use default spacing - else - { - spacingX = m_xSpacing; - startX = (float)(x - ((totalObjectWidth + (n+1)*spacingX)/2.0)); - } - - // Check if within the constraining object... - if ((totalObjectHeight + (n + 1)*m_ySpacing) <= minHeight) - { - spacingY = (float)((minHeight - totalObjectHeight)/(n + 1)); - startY = (float)(y - (minHeight/2.0)); - } - // Otherwise, use default spacing - else - { - spacingY = m_ySpacing; - startY = (float)(y - ((totalObjectHeight + (n+1)*spacingY)/2.0)); - } - - // Now position the objects - bool changed = FALSE; - node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - startX += (float)(spacingX + (width2/2.0)); - startY += (float)(spacingY + (height2/2.0)); - - if ((!Equals(startX, constrainedObject->GetX())) || (!Equals(startY, constrainedObject->GetY()))) - { - constrainedObject->Move(dc, startX, startY, FALSE); - changed = TRUE; - } - - startX += (float)(width2/2.0); - startY += (float)(height2/2.0); - - node = node->Next(); - } - return changed; - } - case gyCONSTRAINT_LEFT_OF: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - - float x3 = (float)(x - (minWidth/2.0) - (width2/2.0) - m_xSpacing); - if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } - - node = node->Next(); - } - return changed; - } - case gyCONSTRAINT_RIGHT_OF: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - - float x3 = (float)(x + (minWidth/2.0) + (width2/2.0) + m_xSpacing); - if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } - - node = node->Next(); - } - return changed; - - return FALSE; - } - case gyCONSTRAINT_ABOVE: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - - float y3 = (float)(y - (minHeight/2.0) - (height2/2.0) - m_ySpacing); - if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } - - node = node->Next(); - } - return changed; - } - case gyCONSTRAINT_BELOW: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - - float y3 = (float)(y + (minHeight/2.0) + (height2/2.0) + m_ySpacing); - if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } - - node = node->Next(); - } - return changed; - } - case gyCONSTRAINT_ALIGNED_LEFT: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - - float x3 = (float)(x - (minWidth/2.0) + (width2/2.0) + m_xSpacing); - if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } - - node = node->Next(); - } - return changed; - } - case gyCONSTRAINT_ALIGNED_RIGHT: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - - float x3 = (float)(x + (minWidth/2.0) - (width2/2.0) - m_xSpacing); - if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } - - node = node->Next(); - } - return changed; - - return FALSE; - } - case gyCONSTRAINT_ALIGNED_TOP: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - - float y3 = (float)(y - (minHeight/2.0) + (height2/2.0) + m_ySpacing); - if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } - - node = node->Next(); - } - return changed; - } - case gyCONSTRAINT_ALIGNED_BOTTOM: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float width2, height2; - constrainedObject->GetBoundingBoxMax(&width2, &height2); - - float y3 = (float)(y + (minHeight/2.0) - (height2/2.0) - m_ySpacing); - if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } - - node = node->Next(); - } - return changed; - } - case gyCONSTRAINT_MIDALIGNED_LEFT: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float x3 = (float)(x - (minWidth/2.0)); - if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } - - node = node->Next(); - } - return changed; - } - case gyCONSTRAINT_MIDALIGNED_RIGHT: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float x3 = (float)(x + (minWidth/2.0)); - if (!Equals(x3, constrainedObject->GetX())) - { - changed = TRUE; - constrainedObject->Move(dc, x3, constrainedObject->GetY(), FALSE); - } - - node = node->Next(); - } - return changed; - - return FALSE; - } - case gyCONSTRAINT_MIDALIGNED_TOP: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float y3 = (float)(y - (minHeight/2.0)); - if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } - - node = node->Next(); - } - return changed; - } - case gyCONSTRAINT_MIDALIGNED_BOTTOM: - { - bool changed = FALSE; - - wxNode *node = m_constrainedObjects.First(); - while (node) - { - wxShape *constrainedObject = (wxShape *)node->Data(); - - float y3 = (float)(y + (minHeight/2.0)); - if (!Equals(y3, constrainedObject->GetY())) - { - changed = TRUE; - constrainedObject->Move(dc, constrainedObject->GetX(), y3, FALSE); - } - - node = node->Next(); - } - return changed; - } - - default: - return FALSE; - } - return FALSE; -} - diff --git a/utils/ogl/src/constrnt.h b/utils/ogl/src/constrnt.h deleted file mode 100644 index 36538803c9..0000000000 --- a/utils/ogl/src/constrnt.h +++ /dev/null @@ -1,86 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: constrnt.h -// Purpose: OGL constraint definitions -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_CONSTRNT_H_ -#define _OGL_CONSTRNT_H_ - -#ifdef __GNUG__ -#pragma interface "constrnt.h" -#endif - -/* - * OGL Constraints - * - */ - -class OGLConstraintType: public wxObject -{ - DECLARE_DYNAMIC_CLASS(OGLConstraintType) -public: - OGLConstraintType(int type = 0, const wxString& name = "", const wxString& phrase = ""); - ~OGLConstraintType(); - -public: - int m_type; // E.g. gyCONSTRAINT_CENTRED_VERTICALLY - wxString m_name; // E.g. "Centre vertically" - wxString m_phrase; // E.g. "centred vertically with respect to", "left of" - -}; - -extern wxList OGLConstraintTypes; - -#define gyCONSTRAINT_CENTRED_VERTICALLY 1 -#define gyCONSTRAINT_CENTRED_HORIZONTALLY 2 -#define gyCONSTRAINT_CENTRED_BOTH 3 -#define gyCONSTRAINT_LEFT_OF 4 -#define gyCONSTRAINT_RIGHT_OF 5 -#define gyCONSTRAINT_ABOVE 6 -#define gyCONSTRAINT_BELOW 7 -#define gyCONSTRAINT_ALIGNED_TOP 8 -#define gyCONSTRAINT_ALIGNED_BOTTOM 9 -#define gyCONSTRAINT_ALIGNED_LEFT 10 -#define gyCONSTRAINT_ALIGNED_RIGHT 11 - -// Like aligned, but with the objects centred on the respective edge -// of the reference object. -#define gyCONSTRAINT_MIDALIGNED_TOP 12 -#define gyCONSTRAINT_MIDALIGNED_BOTTOM 13 -#define gyCONSTRAINT_MIDALIGNED_LEFT 14 -#define gyCONSTRAINT_MIDALIGNED_RIGHT 15 - -class OGLConstraint: public wxObject -{ - DECLARE_DYNAMIC_CLASS(OGLConstraint) - public: - OGLConstraint() { m_xSpacing = 0.0; m_ySpacing = 0.0; m_constraintType = 0; m_constraintName = ""; m_constraintId = 0; - m_constrainingObject = NULL; } - OGLConstraint(int type, wxShape *constraining, wxList& constrained); - ~OGLConstraint(); - - // Returns TRUE if anything changed - bool Evaluate(); - inline void SetSpacing(float x, float y) { m_xSpacing = x; m_ySpacing = y; }; - bool Equals(float a, float b); - - float m_xSpacing; - float m_ySpacing; - int m_constraintType; - wxString m_constraintName; - long m_constraintId; - wxShape* m_constrainingObject; - wxList m_constrainedObjects; - -}; - -void OGLInitializeConstraintTypes(); - -#endif - // _OGL_CONSTRNT_H_ diff --git a/utils/ogl/src/divided.cpp b/utils/ogl/src/divided.cpp deleted file mode 100644 index 38b74e07d6..0000000000 --- a/utils/ogl/src/divided.cpp +++ /dev/null @@ -1,729 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: divided.cpp -// Purpose: wxDividedShape class -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "divided.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#ifdef PROLOGIO -#include -#endif - -#include "basic.h" -#include "basicp.h" -#include "canvas.h" -#include "divided.h" -#include "lines.h" -#include "misc.h" - -class wxDividedShapeControlPoint: public wxControlPoint -{ - DECLARE_DYNAMIC_CLASS(wxDividedShapeControlPoint) - private: - int regionId; - public: - wxDividedShapeControlPoint() { regionId = 0; } - wxDividedShapeControlPoint(wxShapeCanvas *the_canvas, wxShape *object, int region, - float size, float the_xoffset, float the_yoffset, int the_type); - ~wxDividedShapeControlPoint(); - - void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); - void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); - void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); -}; - -IMPLEMENT_DYNAMIC_CLASS(wxDividedShapeControlPoint, wxControlPoint) - -/* - * Divided object - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxDividedShape, wxRectangleShape) - -wxDividedShape::wxDividedShape(float w, float h): wxRectangleShape(w, h) -{ - ClearRegions(); -} - -wxDividedShape::~wxDividedShape() -{ -} - -void wxDividedShape::OnDraw(wxDC& dc) -{ - wxRectangleShape::OnDraw(dc); -} - -void wxDividedShape::OnDrawContents(wxDC& dc) -{ - float defaultProportion = (float)(GetRegions().Number() > 0 ? (1.0/((float)(GetRegions().Number()))) : 0.0); - float currentY = (float)(m_ypos - (m_height / 2.0)); - float maxY = (float)(m_ypos + (m_height / 2.0)); - - float leftX = (float)(m_xpos - (m_width / 2.0)); - float rightX = (float)(m_xpos + (m_width / 2.0)); - - if (m_pen) dc.SetPen(m_pen); - - if (m_textColour) dc.SetTextForeground(* m_textColour); - -#ifdef __WXMSW__ - // For efficiency, don't do this under X - doesn't make - // any visible difference for our purposes. - if (m_brush) - dc.SetTextBackground(m_brush->GetColour()); -#endif -/* - if (!formatted) - { - FormatRegionText(); - formatted = TRUE; - } -*/ - if (GetDisableLabel()) return; - - float xMargin = 2; - float yMargin = 2; - dc.SetBackgroundMode(wxTRANSPARENT); - - wxNode *node = GetRegions().First(); - while (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - dc.SetFont(region->GetFont()); - dc.SetTextForeground(* region->GetActualColourObject()); - - float proportion = - region->m_regionProportionY < 0.0 ? defaultProportion : region->m_regionProportionY; - - float y = currentY + m_height*proportion; - float actualY = maxY < y ? maxY : y; - - float centreX = m_xpos; - float centreY = (float)(currentY + (actualY - currentY)/2.0); - - DrawFormattedText(dc, ®ion->m_formattedText, - (float)(centreX), (float)(centreY), (float)(m_width-2*xMargin), (float)(actualY - currentY - 2*yMargin), - region->m_formatMode); - if ((y <= maxY) && (node->Next())) - { - wxPen *regionPen = region->GetActualPen(); - if (regionPen) - { - dc.SetPen(regionPen); - dc.DrawLine(leftX, y, rightX, y); - } - } - - currentY = actualY; - - node = node->Next(); - } -} - -void wxDividedShape::SetSize(float w, float h, bool recursive) -{ - SetAttachmentSize(w, h); - m_width = w; - m_height = h; - SetRegionSizes(); -} - -void wxDividedShape::SetRegionSizes() -{ - if (GetRegions().Number() == 0) - return; - - float defaultProportion = (float)(GetRegions().Number() > 0 ? (1.0/((float)(GetRegions().Number()))) : 0.0); - float currentY = (float)(m_ypos - (m_height / 2.0)); - float maxY = (float)(m_ypos + (m_height / 2.0)); - -// float leftX = (float)(m_xpos - (m_width / 2.0)); -// float rightX = (float)(m_xpos + (m_width / 2.0)); - - wxNode *node = GetRegions().First(); - while (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - float proportion = - region->m_regionProportionY <= 0.0 ? defaultProportion : region->m_regionProportionY; - - float sizeY = (float)proportion*m_height; - float y = currentY + sizeY; - float actualY = maxY < y ? maxY : y; - - float centreY = (float)(currentY + (actualY - currentY)/2.0); - - region->SetSize(m_width, sizeY); - region->SetPosition(0.0, (float)(centreY - m_ypos)); - currentY = actualY; - node = node->Next(); - } -} - -// Attachment points correspond to regions in the divided box -bool wxDividedShape::GetAttachmentPosition(int attachment, float *x, float *y, int nth, int no_arcs, - wxLineShape *line) -{ - int totalNumberAttachments = (GetRegions().Number() * 2) + 2; - if (!GetAttachmentMode() || (attachment >= totalNumberAttachments)) - { - return wxShape::GetAttachmentPosition(attachment, x, y, nth, no_arcs); - } - - int n = GetRegions().Number(); - bool isEnd = (line && line->IsEnd(this)); - - float left = (float)(m_xpos - m_width/2.0); - float right = (float)(m_xpos + m_width/2.0); - float top = (float)(m_ypos - m_height/2.0); - float bottom = (float)(m_ypos + m_height/2.0); - - // Zero is top, n+1 is bottom. - if (attachment == 0) - { - *y = top; - if (m_spaceAttachments) - { - if (line && (line->GetAlignmentType(isEnd) == LINE_ALIGNMENT_TO_NEXT_HANDLE)) - { - // Align line according to the next handle along - wxRealPoint *point = line->GetNextControlPoint(this); - if (point->x < left) - *x = left; - else if (point->x > right) - *x = right; - else - *x = point->x; - } - else - *x = left + (nth + 1)*m_width/(no_arcs + 1); - } - else - *x = m_xpos; - } - else if (attachment == (n+1)) - { - *y = bottom; - if (m_spaceAttachments) - { - if (line && (line->GetAlignmentType(isEnd) == LINE_ALIGNMENT_TO_NEXT_HANDLE)) - { - // Align line according to the next handle along - wxRealPoint *point = line->GetNextControlPoint(this); - if (point->x < left) - *x = left; - else if (point->x > right) - *x = right; - else - *x = point->x; - } - else - *x = left + (nth + 1)*m_width/(no_arcs + 1); - } - else - *x = m_xpos; - } - // Left or right. - else - { - int i = 0; - bool isLeft = FALSE; - if (attachment < (n+1)) - { - i = attachment-1; - isLeft = FALSE; - } - else - { - i = (totalNumberAttachments - attachment - 1); - isLeft = TRUE; - } - wxNode *node = GetRegions().Nth(i); - if (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - - if (isLeft) - *x = left; - else - *x = right; - - // Calculate top and bottom of region - top = (float)((m_ypos + region->m_y) - (region->m_height/2.0)); - bottom = (float)((m_ypos + region->m_y) + (region->m_height/2.0)); - - // Assuming we can trust the absolute size and - // position of these regions... - if (m_spaceAttachments) - { - if (line && (line->GetAlignmentType(isEnd) == LINE_ALIGNMENT_TO_NEXT_HANDLE)) - { - // Align line according to the next handle along - wxRealPoint *point = line->GetNextControlPoint(this); - if (point->y < bottom) - *y = bottom; - else if (point->y > top) - *y = top; - else - *y = point->y; - } - else -// *y = (float)(((m_ypos + region->m_y) - (region->m_height/2.0)) + (nth + 1)*region->m_height/(no_arcs+1)); - *y = (float)(top + (nth + 1)*region->m_height/(no_arcs+1)); - } - else - *y = (float)(m_ypos + region->m_y); - } - else - { - *x = m_xpos; - *y = m_ypos; - return FALSE; - } - } - return TRUE; -} - -int wxDividedShape::GetNumberOfAttachments() -{ - // There are two attachments for each region (left and right), - // plus one on the top and one on the bottom. - int n = (GetRegions().Number() * 2) + 2; - - int maxN = n - 1; - wxNode *node = m_attachmentPoints.First(); - while (node) - { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); - if (point->m_id > maxN) - maxN = point->m_id; - node = node->Next(); - } - return maxN + 1; -} - -bool wxDividedShape::AttachmentIsValid(int attachment) -{ - int totalNumberAttachments = (GetRegions().Number() * 2) + 2; - if (attachment >= totalNumberAttachments) - { - return wxShape::AttachmentIsValid(attachment); - } - else if (attachment >= 0) - return TRUE; - else - return FALSE; -} - -void wxDividedShape::Copy(wxDividedShape& copy) -{ - wxRectangleShape::Copy(copy); -} - -wxShape *wxDividedShape::PrivateCopy() -{ - wxDividedShape *obj = new wxDividedShape(m_width, m_height); - Copy(*obj); - return obj; -} - -// Region operations - -void wxDividedShape::MakeControlPoints() -{ - wxRectangleShape::MakeControlPoints(); - - MakeMandatoryControlPoints(); -} - -void wxDividedShape::MakeMandatoryControlPoints() -{ - float currentY = (float)(GetY() - (m_height / 2.0)); - float maxY = (float)(GetY() + (m_height / 2.0)); - - wxNode *node = GetRegions().First(); - int i = 0; - while (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - - float proportion = region->m_regionProportionY; - - float y = currentY + m_height*proportion; - float actualY = (float)(maxY < y ? maxY : y); - - if (node->Next()) - { - wxDividedShapeControlPoint *controlPoint = - new wxDividedShapeControlPoint(m_canvas, this, i, CONTROL_POINT_SIZE, 0.0, (float)(actualY - GetY()), 0); - m_canvas->AddShape(controlPoint); - m_controlPoints.Append(controlPoint); - } - currentY = actualY; - i ++; - node = node->Next(); - } -} - -void wxDividedShape::ResetControlPoints() -{ - // May only have the region handles, (n - 1) of them. - if (m_controlPoints.Number() > (GetRegions().Number() - 1)) - wxRectangleShape::ResetControlPoints(); - - ResetMandatoryControlPoints(); -} - -void wxDividedShape::ResetMandatoryControlPoints() -{ - float currentY = (float)(GetY() - (m_height / 2.0)); - float maxY = (float)(GetY() + (m_height / 2.0)); - - wxNode *node = m_controlPoints.First(); - int i = 0; - while (node) - { - wxControlPoint *controlPoint = (wxControlPoint *)node->Data(); - if (controlPoint->IsKindOf(CLASSINFO(wxDividedShapeControlPoint))) - { - wxNode *node1 = GetRegions().Nth(i); - wxShapeRegion *region = (wxShapeRegion *)node1->Data(); - - float proportion = region->m_regionProportionY; - - float y = currentY + m_height*proportion; - float actualY = (float)(maxY < y ? maxY : y); - - controlPoint->m_xoffset = 0.0; - controlPoint->m_yoffset = (float)(actualY - GetY()); - currentY = actualY; - i ++; - } - node = node->Next(); - } -} - -#ifdef PROLOGIO -void wxDividedShape::WritePrologAttributes(wxExpr *clause) -{ - wxRectangleShape::WritePrologAttributes(clause); -} - -void wxDividedShape::ReadPrologAttributes(wxExpr *clause) -{ - wxRectangleShape::ReadPrologAttributes(clause); -} -#endif - -/* - * Edit the division colour/style - * - */ - -void wxDividedShape::EditRegions() -{ - wxMessageBox("EditRegions() is unimplemented.", "OGL", wxOK); - - // TODO -#if 0 - if (GetRegions().Number() < 2) - return; - - wxBeginBusyCursor(); - - GraphicsForm *form = new GraphicsForm("Divided nodes"); - // Need an array to store all the style strings, - // since they need to be converted to integers - char **styleStrings = new char *[GetRegions().Number()]; - for (int j = 0; j < GetRegions().Number(); j++) - styleStrings[j] = NULL; - - int i = 0; - wxNode *node = GetRegions().First(); - while (node && node->Next()) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - char buf[50]; - sprintf(buf, "Region %d", (i+1)); - form->Add(wxMakeFormMessage(buf)); - form->Add(wxMakeFormNewLine()); - - form->Add(wxMakeFormString("Colour", ®ion->penColour, wxFORM_CHOICE, - new wxList(wxMakeConstraintStrings( - "Invisible" , - "BLACK" , - "BLUE" , - "BROWN" , - "CORAL" , - "CYAN" , - "DARK GREY" , - "DARK GREEN" , - "DIM GREY" , - "GREY" , - "GREEN" , - "LIGHT BLUE" , - "LIGHT GREY" , - "MAGENTA" , - "MAROON" , - "NAVY" , - "ORANGE" , - "PURPLE" , - "RED" , - "TURQUOISE" , - "VIOLET" , - "WHITE" , - "YELLOW" , - NULL), - NULL), NULL, wxVERTICAL, 150)); - - char *styleString = NULL; - switch (region->penStyle) - { - case wxSHORT_DASH: - styleString = "Short Dash"; - break; - case wxLONG_DASH: - styleString = "Long Dash"; - break; - case wxDOT: - styleString = "Dot"; - break; - case wxDOT_DASH: - styleString = "Dot Dash"; - break; - case wxSOLID: - default: - styleString = "Solid"; - break; - } - styleStrings[i] = copystring(styleString); - form->Add(wxMakeFormString("Style", &(styleStrings[i]), wxFORM_CHOICE, - new wxList(wxMakeConstraintStrings( - "Solid" , - "Short Dash" , - "Long Dash" , - "Dot" , - "Dot Dash" , - NULL), - NULL), NULL, wxVERTICAL, 100)); - node = node->Next(); - i ++; - if (node && node->Next()) - form->Add(wxMakeFormNewLine()); - } - wxDialogBox *dialog = new wxDialogBox(m_canvas->GetParent(), "Divided object properties", 10, 10, 500, 500); - if (GraphicsLabelFont) - dialog->SetLabelFont(GraphicsLabelFont); - if (GraphicsButtonFont) - dialog->SetButtonFont(GraphicsButtonFont); - form->AssociatePanel(dialog); - form->dialog = dialog; - - dialog->Fit(); - dialog->Centre(wxBOTH); - - wxEndBusyCursor(); - - dialog->Show(TRUE); - - node = GetRegions().First(); - i = 0; - while (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - - if (styleStrings[i]) - { - if (strcmp(styleStrings[i], "Solid") == 0) - region->penStyle = wxSOLID; - else if (strcmp(styleStrings[i], "Dot") == 0) - region->penStyle = wxDOT; - else if (strcmp(styleStrings[i], "Short Dash") == 0) - region->penStyle = wxSHORT_DASH; - else if (strcmp(styleStrings[i], "Long Dash") == 0) - region->penStyle = wxLONG_DASH; - else if (strcmp(styleStrings[i], "Dot Dash") == 0) - region->penStyle = wxDOT_DASH; - delete[] styleStrings[i]; - } - region->m_actualPenObject = NULL; - node = node->Next(); - i ++; - } - delete[] styleStrings; - Draw(dc); -#endif -} - -void wxDividedShape::OnRightClick(float x, float y, int keys, int attachment) -{ - if (keys & KEY_CTRL) - { - EditRegions(); - } - else - { - wxRectangleShape::OnRightClick(x, y, keys, attachment); - } -} - -wxDividedShapeControlPoint::wxDividedShapeControlPoint(wxShapeCanvas *the_canvas, wxShape *object, - int region, float size, float the_m_xoffset, float the_m_yoffset, int the_type): - wxControlPoint(the_canvas, object, size, the_m_xoffset, the_m_yoffset, the_type) -{ - regionId = region; -} - -wxDividedShapeControlPoint::~wxDividedShapeControlPoint() -{ -} - -// Implement resizing of divided object division -void wxDividedShapeControlPoint::OnDragLeft(bool draw, float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - dc.SetLogicalFunction(wxXOR); - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush((* wxTRANSPARENT_BRUSH)); - - wxDividedShape *dividedObject = (wxDividedShape *)m_shape; - float x1 = (float)(dividedObject->GetX() - (dividedObject->GetWidth()/2.0)); - float y1 = y; - float x2 = (float)(dividedObject->GetX() + (dividedObject->GetWidth()/2.0)); - float y2 = y; - dc.DrawLine(x1, y1, x2, y2); -} - -void wxDividedShapeControlPoint::OnBeginDragLeft(float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - wxDividedShape *dividedObject = (wxDividedShape *)m_shape; - dc.SetLogicalFunction(wxXOR); - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush((* wxTRANSPARENT_BRUSH)); - - float x1 = (float)(dividedObject->GetX() - (dividedObject->GetWidth()/2.0)); - float y1 = y; - float x2 = (float)(dividedObject->GetX() + (dividedObject->GetWidth()/2.0)); - float y2 = y; - dc.DrawLine(x1, y1, x2, y2); - m_canvas->CaptureMouse(); -} - -void wxDividedShapeControlPoint::OnEndDragLeft(float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - wxDividedShape *dividedObject = (wxDividedShape *)m_shape; - wxNode *node = dividedObject->GetRegions().Nth(regionId); - if (!node) - return; - - wxShapeRegion *thisRegion = (wxShapeRegion *)node->Data(); - wxShapeRegion *nextRegion = NULL; // Region below this one - - dc.SetLogicalFunction(wxCOPY); - - m_canvas->ReleaseMouse(); - - // Find the old top and bottom of this region, - // and calculate the new proportion for this region - // if legal. - - float currentY = (float)(dividedObject->GetY() - (dividedObject->GetHeight() / 2.0)); - float maxY = (float)(dividedObject->GetY() + (dividedObject->GetHeight() / 2.0)); - - // Save values - float thisRegionTop = 0.0; - float thisRegionBottom = 0.0; - float nextRegionBottom = 0.0; - - node = dividedObject->GetRegions().First(); - while (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - - float proportion = region->m_regionProportionY; - float yy = currentY + (dividedObject->GetHeight()*proportion); - float actualY = (float)(maxY < yy ? maxY : yy); - - if (region == thisRegion) - { - thisRegionTop = currentY; - thisRegionBottom = actualY; - if (node->Next()) - nextRegion = (wxShapeRegion *)node->Next()->Data(); - } - if (region == nextRegion) - { - nextRegionBottom = actualY; - } - - currentY = actualY; - node = node->Next(); - } - if (!nextRegion) - return; - - // Check that we haven't gone above this region or below - // next region. - if ((y <= thisRegionTop) || (y >= nextRegionBottom)) - return; - - dividedObject->EraseLinks(dc); - - // Now calculate the new proportions of this region and the next region. - float thisProportion = (float)((y - thisRegionTop)/dividedObject->GetHeight()); - float nextProportion = (float)((nextRegionBottom - y)/dividedObject->GetHeight()); - thisRegion->SetProportions(0.0, thisProportion); - nextRegion->SetProportions(0.0, nextProportion); - m_yoffset = (float)(y - dividedObject->GetY()); - - // Now reformat text - int i = 0; - node = dividedObject->GetRegions().First(); - while (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - if (region->GetText()) - { - char *s = copystring(region->GetText()); - dividedObject->FormatText(dc, s, i); - delete[] s; - } - node = node->Next(); - i++; - } - dividedObject->SetRegionSizes(); - dividedObject->Draw(dc); - dividedObject->GetEventHandler()->OnMoveLinks(dc); -} - diff --git a/utils/ogl/src/divided.h b/utils/ogl/src/divided.h deleted file mode 100644 index aaf23de330..0000000000 --- a/utils/ogl/src/divided.h +++ /dev/null @@ -1,77 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: divided.h -// Purpose: wxDividedShape -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_DIVIDED_H_ -#define _OGL_DIVIDED_H_ - -#ifdef __GNUG__ -#pragma interface "basic.h" -#endif - -/* - * Definition of a region - * - */ - -/* - * Box divided into horizontal regions - * - */ - -extern wxFont *g_oglNormalFont; -class wxDividedShape: public wxRectangleShape -{ - DECLARE_DYNAMIC_CLASS(wxDividedShape) - - public: - wxDividedShape(float w = 0.0, float h = 0.0); - ~wxDividedShape(); - - void OnDraw(wxDC& dc); - void OnDrawContents(wxDC& dc); - - void SetSize(float w, float h, bool recursive = TRUE); - - void MakeControlPoints(); - void ResetControlPoints(); - - void MakeMandatoryControlPoints(); - void ResetMandatoryControlPoints(); - -#ifdef PROLOGIO - // Prolog database stuff - void WritePrologAttributes(wxExpr *clause); - void ReadPrologAttributes(wxExpr *clause); -#endif - - void Copy(wxDividedShape ©); - wxShape *PrivateCopy(); - - // Set all region sizes according to proportions and - // this object total size - void SetRegionSizes(); - - // Edit region colours/styles - void EditRegions(); - - // Attachment points correspond to regions in the divided box - bool GetAttachmentPosition(int attachment, float *x, float *y, - int nth = 0, int no_arcs = 1, wxLineShape *line = NULL); - bool AttachmentIsValid(int attachment); - int GetNumberOfAttachments(); - - // Invoke editor on CTRL-right click - void OnRightClick(float x, float y, int keys = 0, int attachment = 0); -}; - -#endif - // _OGL_DIVIDED_H_ - diff --git a/utils/ogl/src/drawn.cpp b/utils/ogl/src/drawn.cpp deleted file mode 100644 index d71a144f3c..0000000000 --- a/utils/ogl/src/drawn.cpp +++ /dev/null @@ -1,1764 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: drawn.cpp -// Purpose: wxDrawnShape -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "drawn.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#ifdef PROLOGIO -#include -#endif - -#include "basic.h" -#include "basicp.h" -#include "canvas.h" -#include "mfutils.h" -#include "drawn.h" -#include "drawnp.h" -#include "misc.h" - -static void IntToHex(unsigned int dec, char *buf); -static unsigned long HexToInt(char *buf); -extern char *GraphicsBuffer; - -#define gyTYPE_PEN 40 -#define gyTYPE_BRUSH 41 -#define gyTYPE_FONT 42 - -/* - * Drawn object - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxDrawnShape, wxShape) - -wxDrawnShape::wxDrawnShape():wxRectangleShape(100.0, 50.0) -{ - m_saveToFile = TRUE; -} - -wxDrawnShape::~wxDrawnShape() -{ -} - -void wxDrawnShape::OnDraw(wxDC& dc) -{ - // Pass pen and brush in case we have force outline - // and fill colours - if (m_shadowMode != SHADOW_NONE) - { - if (m_shadowBrush) - m_metafile.m_fillBrush = m_shadowBrush; - m_metafile.m_outlinePen = transparent_pen; - m_metafile.Draw(dc, m_xpos + m_shadowOffsetX, m_ypos + m_shadowOffsetY); - } - - m_metafile.m_outlinePen = m_pen; - m_metafile.m_fillBrush = m_brush; - m_metafile.Draw(dc, m_xpos, m_ypos); -} - -void wxDrawnShape::SetSize(float w, float h, bool recursive) -{ - SetAttachmentSize(w, h); - - float scaleX; - float scaleY; - if (GetWidth() == 0.0) - scaleX = 1.0; - else scaleX = w/GetWidth(); - if (GetHeight() == 0.0) - scaleY = 1.0; - else scaleY = h/GetHeight(); - - m_metafile.Scale(scaleX, scaleY); - m_width = w; - m_height = h; - SetDefaultRegionSize(); -} - -void wxDrawnShape::Scale(float sx, float sy) -{ - m_metafile.Scale(sx, sy); -} - -void wxDrawnShape::Translate(float x, float y) -{ - m_metafile.Translate(x, y); -} - -void wxDrawnShape::Rotate(float x, float y, float theta) -{ - if (!m_metafile.GetRotateable()) - return; - - float actualTheta = theta-m_metafile.m_currentRotation; - - // Rotate metafile - m_metafile.Rotate(x, y, theta); - - // Rotate attachment points - float sinTheta = (float)sin(actualTheta); - float cosTheta = (float)cos(actualTheta); - wxNode *node = m_attachmentPoints.First(); - while (node) - { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); - float x1 = point->m_x; - float y1 = point->m_y; - point->m_x = x1*cosTheta - y1*sinTheta + x*(1 - cosTheta) + y*sinTheta; - point->m_y = x1*sinTheta + y1*cosTheta + y*(1 - cosTheta) + x*sinTheta; - node = node->Next(); - } - m_rotation = theta; -} - -#ifdef PROLOGIO -// Prolog database stuff -char *wxDrawnShape::GetFunctor() -{ - return "node_image"; -} - -void wxDrawnShape::WritePrologAttributes(wxExpr *clause) -{ - wxRectangleShape::WritePrologAttributes(clause); - - clause->AddAttributeValue("save_metafile", (long)m_saveToFile); - if (m_saveToFile) - m_metafile.WritePrologAttributes(clause); -} - -void wxDrawnShape::ReadPrologAttributes(wxExpr *clause) -{ - wxRectangleShape::ReadPrologAttributes(clause); - - int iVal = (int) m_saveToFile; - clause->AssignAttributeValue("save_metafile", &iVal); - m_saveToFile = (iVal != 0); - - if (m_saveToFile) - m_metafile.ReadPrologAttributes(clause); -} -#endif - -// Does the copying for this object -void wxDrawnShape::Copy(wxDrawnShape& copy) -{ - wxRectangleShape::Copy(copy); - m_metafile.Copy(copy.m_metafile); - copy.m_saveToFile = m_saveToFile; -} - -// Returns a new instance, and does the copy for this class. Define for each class. -wxShape *wxDrawnShape::PrivateCopy() -{ - wxDrawnShape *obj = new wxDrawnShape; - Copy(*obj); - return obj; -} - -bool wxDrawnShape::LoadFromMetaFile(char *filename) -{ - return m_metafile.LoadFromMetaFile(filename, &m_width, &m_height); -} - -/* - * Individual operations - * - */ - -/* - * Set font, brush, text colour - * - */ - -wxOpSetGDI::wxOpSetGDI(int theOp, wxPseudoMetaFile *theImage, int theGdiIndex, int theMode): - wxDrawOp(theOp) -{ - gdiIndex = theGdiIndex; - image = theImage; - mode = theMode; -} - -void wxOpSetGDI::Do(wxDC& dc, float xoffset, float yoffset) -{ - switch (op) - { - case DRAWOP_SET_PEN: - { - // Check for overriding this operation for outline - // colour - if (image->m_outlineColours.Member((wxObject *)gdiIndex)) - { - if (image->m_outlinePen) - dc.SetPen(image->m_outlinePen); - } - else - { - wxNode *node = image->m_gdiObjects.Nth(gdiIndex); - if (node) - { - wxPen *pen = (wxPen *)node->Data(); - if (pen) - dc.SetPen(pen); - } - } - break; - } - case DRAWOP_SET_BRUSH: - { - // Check for overriding this operation for outline or fill - // colour - if (image->m_outlineColours.Member((wxObject *)gdiIndex)) - { - // Need to construct a brush to match the outline pen's colour - if (image->m_outlinePen) - { - wxBrush *br = wxTheBrushList->FindOrCreateBrush(image->m_outlinePen->GetColour(), wxSOLID); - if (br) - dc.SetBrush(br); - } - } - else if (image->m_fillColours.Member((wxObject *)gdiIndex)) - { - if (image->m_fillBrush) - { - dc.SetBrush(image->m_fillBrush); - } - } - else - { - wxNode *node = image->m_gdiObjects.Nth(gdiIndex); - if (node) - { - wxBrush *brush = (wxBrush *)node->Data(); - if (brush) - dc.SetBrush(brush); - } - } - break; - } - case DRAWOP_SET_FONT: - { - wxNode *node = image->m_gdiObjects.Nth(gdiIndex); - if (node) - { - wxFont *font = (wxFont *)node->Data(); - if (font) - dc.SetFont(font); - } - break; - } - case DRAWOP_SET_TEXT_COLOUR: - { - wxColour col(r,g,b); - dc.SetTextForeground(col); - break; - } - case DRAWOP_SET_BK_COLOUR: - { - wxColour col(r,g,b); - dc.SetTextBackground(col); - break; - } - case DRAWOP_SET_BK_MODE: - { - dc.SetBackgroundMode(mode); - break; - } - default: - break; - } -} - -wxDrawOp *wxOpSetGDI::Copy(wxPseudoMetaFile *newImage) -{ - wxOpSetGDI *newOp = new wxOpSetGDI(op, newImage, gdiIndex, mode); - newOp->r = r; - newOp->g = g; - newOp->b = b; - return newOp; -} - -wxExpr *wxOpSetGDI::WritewxExpr(wxPseudoMetaFile *image) -{ - wxExpr *expr = new wxExpr(PrologList); - expr->Append(new wxExpr((long)op)); - switch (op) - { - case DRAWOP_SET_PEN: - case DRAWOP_SET_BRUSH: - case DRAWOP_SET_FONT: - { - expr->Append(new wxExpr((long)gdiIndex)); - break; - } - case DRAWOP_SET_TEXT_COLOUR: - case DRAWOP_SET_BK_COLOUR: - { - expr->Append(new wxExpr((long)r)); - expr->Append(new wxExpr((long)g)); - expr->Append(new wxExpr((long)b)); - break; - } - case DRAWOP_SET_BK_MODE: - { - expr->Append(new wxExpr((long)mode)); - break; - } - default: - break; - } - return expr; -} - -void wxOpSetGDI::ReadwxExpr(wxPseudoMetaFile *image, wxExpr *expr) -{ - switch (op) - { - case DRAWOP_SET_PEN: - case DRAWOP_SET_BRUSH: - case DRAWOP_SET_FONT: - { - gdiIndex = (int)expr->Nth(1)->IntegerValue(); - break; - } - case DRAWOP_SET_TEXT_COLOUR: - case DRAWOP_SET_BK_COLOUR: - { - r = (unsigned char)expr->Nth(1)->IntegerValue(); - g = (unsigned char)expr->Nth(2)->IntegerValue(); - b = (unsigned char)expr->Nth(3)->IntegerValue(); - break; - } - case DRAWOP_SET_BK_MODE: - { - mode = (int)expr->Nth(1)->IntegerValue(); - break; - } - default: - break; - } -} - -/* - * Set/destroy clipping - * - */ - -wxOpSetClipping::wxOpSetClipping(int theOp, float theX1, float theY1, - float theX2, float theY2):wxDrawOp(theOp) -{ - x1 = theX1; - y1 = theY1; - x2 = theX2; - y2 = theY2; -} - -wxDrawOp *wxOpSetClipping::Copy(wxPseudoMetaFile *newImage) -{ - wxOpSetClipping *newOp = new wxOpSetClipping(op, x1, y1, x2, y2); - return newOp; -} - -void wxOpSetClipping::Do(wxDC& dc, float xoffset, float yoffset) -{ - switch (op) - { - case DRAWOP_SET_CLIPPING_RECT: - { - dc.SetClippingRegion(x1 + xoffset, y1 + yoffset, x2 + xoffset, y2 + yoffset); - break; - } - case DRAWOP_DESTROY_CLIPPING_RECT: - { - dc.DestroyClippingRegion(); - break; - } - default: - break; - } -} - -void wxOpSetClipping::Scale(float xScale, float yScale) -{ - x1 *= xScale; - y1 *= yScale; - x2 *= xScale; - y2 *= yScale; -} - -void wxOpSetClipping::Translate(float x, float y) -{ - x1 += x; - y1 += y; -} - -wxExpr *wxOpSetClipping::WritewxExpr(wxPseudoMetaFile *image) -{ - wxExpr *expr = new wxExpr(PrologList); - expr->Append(new wxExpr((long)op)); - switch (op) - { - case DRAWOP_SET_CLIPPING_RECT: - { - expr->Append(new wxExpr(x1)); - expr->Append(new wxExpr(y1)); - expr->Append(new wxExpr(x2)); - expr->Append(new wxExpr(y2)); - break; - } - default: - break; - } - return expr; -} - -void wxOpSetClipping::ReadwxExpr(wxPseudoMetaFile *image, wxExpr *expr) -{ - switch (op) - { - case DRAWOP_SET_CLIPPING_RECT: - { - x1 = expr->Nth(1)->RealValue(); - y1 = expr->Nth(2)->RealValue(); - x2 = expr->Nth(3)->RealValue(); - y2 = expr->Nth(4)->RealValue(); - break; - } - default: - break; - } -} - -/* - * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text - * - */ - -wxOpDraw::wxOpDraw(int theOp, float theX1, float theY1, float theX2, float theY2, - float theRadius, char *s):wxDrawOp(theOp) -{ - x1 = theX1; - y1 = theY1; - x2 = theX2; - y2 = theY2; - radius = theRadius; - if (s) textString = copystring(s); - else textString = NULL; -} - -wxOpDraw::~wxOpDraw() -{ - if (textString) delete[] textString; -} - -wxDrawOp *wxOpDraw::Copy(wxPseudoMetaFile *newImage) -{ - wxOpDraw *newOp = new wxOpDraw(op, x1, y1, x2, y2, radius, textString); - return newOp; -} - -void wxOpDraw::Do(wxDC& dc, float xoffset, float yoffset) -{ - switch (op) - { - case DRAWOP_DRAW_LINE: - { - dc.DrawLine(x1+xoffset, y1+yoffset, x2+xoffset, y2+yoffset); - break; - } - case DRAWOP_DRAW_RECT: - { - dc.DrawRectangle(x1+xoffset, y1+yoffset, x2+xoffset, y2+yoffset); - break; - } - case DRAWOP_DRAW_ROUNDED_RECT: - { - dc.DrawRoundedRectangle(x1+xoffset, y1+yoffset, x2+xoffset, y2+yoffset, radius); - break; - } - case DRAWOP_DRAW_ELLIPSE: - { - dc.DrawEllipse(x1+xoffset, y1+yoffset, x2+xoffset, y2+yoffset); - break; - } - case DRAWOP_DRAW_POINT: - { - dc.DrawPoint(x1+xoffset, y1+yoffset); - break; - } - case DRAWOP_DRAW_TEXT: - { - dc.DrawText(textString, x1+xoffset, y1+yoffset); - break; - } - default: - break; - } -} - -void wxOpDraw::Scale(float scaleX, float scaleY) -{ - x1 *= scaleX; - y1 *= scaleY; - x2 *= scaleX; - y2 *= scaleY; - radius *= scaleX; -} - -void wxOpDraw::Translate(float x, float y) -{ - x1 += x; - y1 += y; -} - -void wxOpDraw::Rotate(float x, float y, float sinTheta, float cosTheta) -{ - x1 = x1*cosTheta - y1*sinTheta + x*(1 - cosTheta) + y*sinTheta; - y1 = x1*sinTheta + y1*cosTheta + y*(1 - cosTheta) + x*sinTheta; - - switch (op) - { - case DRAWOP_DRAW_LINE: - { - x2 = x2*cosTheta - y2*sinTheta + x*(1 - cosTheta) + y*sinTheta; - y2 = x2*sinTheta + y2*cosTheta + y*(1 - cosTheta) + x*sinTheta; - break; - } - default: - break; - } -} - -wxExpr *wxOpDraw::WritewxExpr(wxPseudoMetaFile *image) -{ - wxExpr *expr = new wxExpr(PrologList); - expr->Append(new wxExpr((long)op)); - switch (op) - { - case DRAWOP_DRAW_LINE: - case DRAWOP_DRAW_RECT: - case DRAWOP_DRAW_ELLIPSE: - { - expr->Append(new wxExpr(x1)); - expr->Append(new wxExpr(y1)); - expr->Append(new wxExpr(x2)); - expr->Append(new wxExpr(y2)); - break; - } - case DRAWOP_DRAW_ROUNDED_RECT: - { - expr->Append(new wxExpr(x1)); - expr->Append(new wxExpr(y1)); - expr->Append(new wxExpr(x2)); - expr->Append(new wxExpr(y2)); - expr->Append(new wxExpr(radius)); - break; - } - case DRAWOP_DRAW_POINT: - { - expr->Append(new wxExpr(x1)); - expr->Append(new wxExpr(y1)); - break; - } - case DRAWOP_DRAW_TEXT: - { - expr->Append(new wxExpr(x1)); - expr->Append(new wxExpr(y1)); - expr->Append(new wxExpr(PrologString, textString)); - break; - } - case DRAWOP_DRAW_ARC: - default: - { - break; - } - } - return expr; -} - -void wxOpDraw::ReadwxExpr(wxPseudoMetaFile *image, wxExpr *expr) -{ - switch (op) - { - case DRAWOP_DRAW_LINE: - case DRAWOP_DRAW_RECT: - case DRAWOP_DRAW_ELLIPSE: - { - x1 = expr->Nth(1)->RealValue(); - y1 = expr->Nth(2)->RealValue(); - x2 = expr->Nth(3)->RealValue(); - y2 = expr->Nth(4)->RealValue(); - break; - } - case DRAWOP_DRAW_ROUNDED_RECT: - { - x1 = expr->Nth(1)->RealValue(); - y1 = expr->Nth(2)->RealValue(); - x2 = expr->Nth(3)->RealValue(); - y2 = expr->Nth(4)->RealValue(); - radius = expr->Nth(5)->RealValue(); - break; - } - case DRAWOP_DRAW_POINT: - { - x1 = expr->Nth(1)->RealValue(); - y1 = expr->Nth(2)->RealValue(); - break; - } - case DRAWOP_DRAW_TEXT: - { - x1 = expr->Nth(1)->RealValue(); - y1 = expr->Nth(2)->RealValue(); - textString = copystring(expr->Nth(3)->StringValue()); - break; - } - case DRAWOP_DRAW_ARC: - default: - { - break; - } - } -} - -/* - * Draw polygon, polyline, spline - * - */ - -wxOpPolyDraw::wxOpPolyDraw(int theOp, int n, wxRealPoint *thePoints):wxDrawOp(theOp) -{ - noPoints = n; - points = thePoints; -} - -wxOpPolyDraw::~wxOpPolyDraw() -{ - delete[] points; -} - -wxDrawOp *wxOpPolyDraw::Copy(wxPseudoMetaFile *newImage) -{ - wxRealPoint *newPoints = new wxRealPoint[noPoints]; - for (int i = 0; i < noPoints; i++) - { - newPoints[i].x = points[i].x; - newPoints[i].y = points[i].y; - } - wxOpPolyDraw *newOp = new wxOpPolyDraw(op, noPoints, newPoints); - return newOp; -} - -void wxOpPolyDraw::Do(wxDC& dc, float xoffset, float yoffset) -{ - switch (op) - { - case DRAWOP_DRAW_POLYLINE: - { - wxPoint *actualPoints = new wxPoint[noPoints]; - int i; - for (i = 0; i < noPoints; i++) - { - actualPoints[i].x = (long) points[i].x; - actualPoints[i].y = (long) points[i].y; - } - - dc.DrawLines(noPoints, actualPoints, xoffset, yoffset); - - delete[] actualPoints; - break; - } - case DRAWOP_DRAW_POLYGON: - { - wxPoint *actualPoints = new wxPoint[noPoints]; - int i; - for (i = 0; i < noPoints; i++) - { - actualPoints[i].x = (long) points[i].x; - actualPoints[i].y = (long) points[i].y; - } - - dc.DrawPolygon(noPoints, actualPoints, xoffset, yoffset); - - delete[] actualPoints; - break; - } - case DRAWOP_DRAW_SPLINE: - { -// dc.DrawSpline(noPoints, points, xoffset, yoffset); - break; - } - default: - break; - } -} - -void wxOpPolyDraw::Scale(float scaleX, float scaleY) -{ - for (int i = 0; i < noPoints; i++) - { - points[i].x *= scaleX; - points[i].y *= scaleY; - } -} - -void wxOpPolyDraw::Translate(float x, float y) -{ - for (int i = 0; i < noPoints; i++) - { - points[i].x += x; - points[i].y += y; - } -} - -void wxOpPolyDraw::Rotate(float x, float y, float sinTheta, float cosTheta) -{ - for (int i = 0; i < noPoints; i++) - { - float x1 = points[i].x; - float y1 = points[i].y; - points[i].x = x1*cosTheta - y1*sinTheta + x*(1 - cosTheta) + y*sinTheta; - points[i].y = x1*sinTheta + y1*cosTheta + y*(1 - cosTheta) + x*sinTheta; - } -} - -wxExpr *wxOpPolyDraw::WritewxExpr(wxPseudoMetaFile *image) -{ - wxExpr *expr = new wxExpr(PrologList); - expr->Append(new wxExpr((long)op)); - expr->Append(new wxExpr((long)noPoints)); - -// char buf1[9]; - char buf2[5]; - char buf3[5]; - - GraphicsBuffer[0] = 0; - - /* - * Store each coordinate pair in a hex string to save space. - * E.g. "1B9080CD". 4 hex digits per coordinate pair. - * - */ - - for (int i = 0; i < noPoints; i++) - { - long signedX = (long)(points[i].x*100.0); - long signedY = (long)(points[i].y*100.0); - - // Scale to 0 -> 64K - long unSignedX = (long)(signedX + 32767.0); - long unSignedY = (long)(signedY + 32767.0); - -// IntToHex((unsigned int)signedX, buf2); -// IntToHex((unsigned int)signedY, buf3); - IntToHex((int)unSignedX, buf2); - IntToHex((int)unSignedY, buf3); - - // Don't overrun the buffer - if ((i*8) < 3000) - { - strcat(GraphicsBuffer, buf2); - strcat(GraphicsBuffer, buf3); - } - } - expr->Append(new wxExpr(PrologString, GraphicsBuffer)); - return expr; -} - -void wxOpPolyDraw::ReadwxExpr(wxPseudoMetaFile *image, wxExpr *expr) -{ - noPoints = (int)expr->Nth(1)->IntegerValue(); - - char buf1[5]; - char buf2[5]; - - points = new wxRealPoint[noPoints]; - int i = 0; - int bufPtr = 0; - wxString hexString = expr->Nth(2)->StringValue(); - while (i < noPoints) - { - buf1[0] = hexString[bufPtr]; - buf1[1] = hexString[bufPtr + 1]; - buf1[2] = hexString[bufPtr + 2]; - buf1[3] = hexString[bufPtr + 3]; - buf1[4] = 0; - - buf2[0] = hexString[bufPtr + 4]; - buf2[1] = hexString[bufPtr + 5]; - buf2[2] = hexString[bufPtr + 6]; - buf2[3] = hexString[bufPtr + 7]; - buf2[4] = 0; - - bufPtr += 8; - -// int signedX = (signed int)HexToInt(buf1); -// int signedY = (signed int)HexToInt(buf2); - long unSignedX = HexToInt(buf1); - long unSignedY = HexToInt(buf2); - // Scale -32K -> +32K - long signedX = unSignedX - 32767; - long signedY = unSignedY - 32767; -#ifdef __WXMSW__ - int testX = (signed int)unSignedX; - int testY = (signed int)unSignedY; -#endif - - points[i].x = (float)(signedX / 100.0); - points[i].y = (float)(signedY / 100.0); - - i ++; - } -} - - -/* - * Utilities - * - */ - -static char hexArray[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', - 'C', 'D', 'E', 'F' }; - -// Convert unsigned 16-bit integer to 4-character hex string -static void IntToHex(unsigned int dec, char *buf) -{ - int digit1 = (int)(dec/4096); - int digit2 = (int)((dec - (digit1*4096))/256); - int digit3 = (int)((dec - (digit1*4096) - (digit2*256))/16); - int digit4 = dec - (digit1*4096 + digit2*256 + digit3*16); - - buf[0] = hexArray[digit1]; - buf[1] = hexArray[digit2]; - buf[2] = hexArray[digit3]; - buf[3] = hexArray[digit4]; - buf[4] = 0; -} - -// One hex digit to decimal number -static int HexToInt1(char hex) -{ - switch (hex) - { - case '0': - return 0; - case '1': - return 1; - case '2': - return 2; - case '3': - return 3; - case '4': - return 4; - case '5': - return 5; - case '6': - return 6; - case '7': - return 7; - case '8': - return 8; - case '9': - return 9; - case 'A': - return 10; - case 'B': - return 11; - case 'C': - return 12; - case 'D': - return 13; - case 'E': - return 14; - case 'F': - return 15; - default: - return 0; - } - return 0; -} - -// 4-digit hex string to unsigned integer -static unsigned long HexToInt(char *buf) -{ - long d1 = (long)(HexToInt1(buf[0])*4096.0) ; - long d2 = (long)(HexToInt1(buf[1])*256.0) ; - long d3 = (long)(HexToInt1(buf[2])*16.0) ; - long d4 = (long)(HexToInt1(buf[3])) ; - unsigned long n = (long)(d1 + d2 + d3 + d4) ; - return n; -} - -/* - * wxPseudo meta-file - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxPseudoMetaFile, wxObject) - -wxPseudoMetaFile::wxPseudoMetaFile() -{ - m_currentRotation = 0; - m_rotateable = TRUE; - m_width = 0.0; - m_height = 0.0; -} - -wxPseudoMetaFile::wxPseudoMetaFile(wxPseudoMetaFile& mf) -{ - mf.Copy(*this); -} - -wxPseudoMetaFile::~wxPseudoMetaFile() -{ - Clear(); -} - -void wxPseudoMetaFile::Clear() -{ - wxNode *node = m_ops.First(); - while (node) - { - wxDrawOp *op = (wxDrawOp *)node->Data(); - delete op; - node = node->Next(); - } - m_ops.Clear(); - m_gdiObjects.Clear(); -} - -void wxPseudoMetaFile::Draw(wxDC& dc, float xoffset, float yoffset) -{ - wxNode *node = m_ops.First(); - while (node) - { - wxDrawOp *op = (wxDrawOp *)node->Data(); - op->Do(dc, xoffset, yoffset); - node = node->Next(); - } -} - -void wxPseudoMetaFile::Scale(float sx, float sy) -{ - wxNode *node = m_ops.First(); - while (node) - { - wxDrawOp *op = (wxDrawOp *)node->Data(); - op->Scale(sx, sy); - node = node->Next(); - } - m_width *= sx; - m_height *= sy; -} - -void wxPseudoMetaFile::Translate(float x, float y) -{ - wxNode *node = m_ops.First(); - while (node) - { - wxDrawOp *op = (wxDrawOp *)node->Data(); - op->Translate(x, y); - node = node->Next(); - } -} - -void wxPseudoMetaFile::Rotate(float x, float y, float theta) -{ - float theta1 = theta-m_currentRotation; - if (theta1 == 0.0) return; - float cosTheta = (float)cos(theta1); - float sinTheta = (float)sin(theta1); - - wxNode *node = m_ops.First(); - while (node) - { - wxDrawOp *op = (wxDrawOp *)node->Data(); - op->Rotate(x, y, sinTheta, cosTheta); - node = node->Next(); - } - m_currentRotation = theta; -} - -#ifdef PROLOGIO -void wxPseudoMetaFile::WritePrologAttributes(wxExpr *clause) -{ - // Write width and height - clause->AddAttributeValue("meta_width", m_width); - clause->AddAttributeValue("meta_height", m_height); - clause->AddAttributeValue("meta_rotateable", (long)m_rotateable); - - // Write GDI objects - char buf[50]; - int i = 1; - wxNode *node = m_gdiObjects.First(); - while (node) - { - sprintf(buf, "gdi%d", i); - wxObject *obj = (wxObject *)node->Data(); - wxExpr *expr = NULL; - if (obj) - { - if (obj->IsKindOf(CLASSINFO(wxPen))) - { - wxPen *thePen = (wxPen *)obj; - expr = new wxExpr(PrologList); - expr->Append(new wxExpr((long)gyTYPE_PEN)); - expr->Append(new wxExpr((long)thePen->GetWidth())); - expr->Append(new wxExpr((long)thePen->GetStyle())); - expr->Append(new wxExpr((long)thePen->GetColour().Red())); - expr->Append(new wxExpr((long)thePen->GetColour().Green())); - expr->Append(new wxExpr((long)thePen->GetColour().Blue())); - } - else if (obj->IsKindOf(CLASSINFO(wxBrush))) - { - wxBrush *theBrush = (wxBrush *)obj; - expr = new wxExpr(PrologList); - expr->Append(new wxExpr((long)gyTYPE_BRUSH)); - expr->Append(new wxExpr((long)theBrush->GetStyle())); - expr->Append(new wxExpr((long)theBrush->GetColour().Red())); - expr->Append(new wxExpr((long)theBrush->GetColour().Green())); - expr->Append(new wxExpr((long)theBrush->GetColour().Blue())); - } - else if (obj->IsKindOf(CLASSINFO(wxFont))) - { - wxFont *theFont = (wxFont *)obj; - expr = new wxExpr(PrologList); - expr->Append(new wxExpr((long)gyTYPE_FONT)); - expr->Append(new wxExpr((long)theFont->GetPointSize())); - expr->Append(new wxExpr((long)theFont->GetFamily())); - expr->Append(new wxExpr((long)theFont->GetStyle())); - expr->Append(new wxExpr((long)theFont->GetWeight())); - expr->Append(new wxExpr((long)theFont->GetUnderlined())); - } - } - else - { - // If no recognised GDI object, append a place holder anyway. - expr = new wxExpr(PrologList); - expr->Append(new wxExpr((long)0)); - } - - if (expr) - { - clause->AddAttributeValue(buf, expr); - i ++; - } - node = node->Next(); - } - - // Write drawing operations - i = 1; - node = m_ops.First(); - while (node) - { - sprintf(buf, "op%d", i); - wxDrawOp *op = (wxDrawOp *)node->Data(); - wxExpr *expr = op->WritewxExpr(this); - if (expr) - { - clause->AddAttributeValue(buf, expr); - i ++; - } - node = node->Next(); - } - - // Write outline and fill GDI op lists (if any) - if (m_outlineColours.Number() > 0) - { - wxExpr *outlineExpr = new wxExpr(PrologList); - node = m_outlineColours.First(); - while (node) - { - outlineExpr->Append(new wxExpr((long)node->Data())); - node = node->Next(); - } - clause->AddAttributeValue("outline_objects", outlineExpr); - } - if (m_fillColours.Number() > 0) - { - wxExpr *fillExpr = new wxExpr(PrologList); - node = m_fillColours.First(); - while (node) - { - fillExpr->Append(new wxExpr((long)node->Data())); - node = node->Next(); - } - clause->AddAttributeValue("fill_objects", fillExpr); - } - -} - -void wxPseudoMetaFile::ReadPrologAttributes(wxExpr *clause) -{ - clause->AssignAttributeValue("meta_width", &m_width); - clause->AssignAttributeValue("meta_height", &m_height); - - int iVal = (int) m_rotateable; - clause->AssignAttributeValue("meta_rotateable", &iVal); - m_rotateable = (iVal != 0); - - // Read GDI objects - char buf[50]; - int i = 1; - bool keepGoing = TRUE; - while (keepGoing) - { - sprintf(buf, "gdi%d", i); - wxExpr *expr = NULL; - clause->AssignAttributeValue(buf, &expr); - if (!expr) - { - keepGoing = FALSE; - } - else - { - wxExpr *idExpr = expr->Nth(0); - switch (idExpr->IntegerValue()) - { - case gyTYPE_PEN: - { - int penWidth = (int)expr->Nth(1)->IntegerValue(); - int penStyle = (int)expr->Nth(2)->IntegerValue(); - int penRed = (int)expr->Nth(3)->IntegerValue(); - int penGreen = (int)expr->Nth(4)->IntegerValue(); - int penBlue = (int)expr->Nth(5)->IntegerValue(); - wxColour col(penRed, penGreen, penBlue); - wxPen *p = wxThePenList->FindOrCreatePen(col, penWidth, penStyle); - if (!p) - p = wxBLACK_PEN; - m_gdiObjects.Append(p); - break; - } - case gyTYPE_BRUSH: - { - int brushStyle = (int)expr->Nth(1)->IntegerValue(); - int brushRed = (int)expr->Nth(2)->IntegerValue(); - int brushGreen = (int)expr->Nth(3)->IntegerValue(); - int brushBlue = (int)expr->Nth(4)->IntegerValue(); - wxColour col(brushRed, brushGreen, brushBlue); - wxBrush *b = wxTheBrushList->FindOrCreateBrush(col, brushStyle); - if (!b) - b = wxWHITE_BRUSH; - m_gdiObjects.Append(b); - break; - } - case gyTYPE_FONT: - { - int fontPointSize = (int)expr->Nth(1)->IntegerValue(); - int fontFamily = (int)expr->Nth(2)->IntegerValue(); - int fontStyle = (int)expr->Nth(3)->IntegerValue(); - int fontWeight = (int)expr->Nth(4)->IntegerValue(); - int fontUnderlined = (int)expr->Nth(5)->IntegerValue(); - m_gdiObjects.Append(wxTheFontList->FindOrCreateFont(fontPointSize, - fontFamily, fontStyle, fontWeight, (fontUnderlined != 0))); - break; - } - default: - { - // Place holder - m_gdiObjects.Append(NULL); - break; - } - } - i ++; - } - } - - // Now read in the operations - keepGoing = TRUE; - i = 1; - while (keepGoing) - { - sprintf(buf, "op%d", i); - wxExpr *expr = NULL; - clause->AssignAttributeValue(buf, &expr); - if (!expr) - { - keepGoing = FALSE; - } - else - { - wxExpr *idExpr = expr->Nth(0); - int opId = (int)idExpr->IntegerValue(); - switch (opId) - { - case DRAWOP_SET_PEN: - case DRAWOP_SET_BRUSH: - case DRAWOP_SET_FONT: - case DRAWOP_SET_TEXT_COLOUR: - case DRAWOP_SET_BK_COLOUR: - case DRAWOP_SET_BK_MODE: - { - wxOpSetGDI *theOp = new wxOpSetGDI(opId, this, 0); - theOp->ReadwxExpr(this, expr); - m_ops.Append(theOp); - break; - } - - case DRAWOP_SET_CLIPPING_RECT: - case DRAWOP_DESTROY_CLIPPING_RECT: - { - wxOpSetClipping *theOp = new wxOpSetClipping(opId, 0.0, 0.0, 0.0, 0.0); - theOp->ReadwxExpr(this, expr); - m_ops.Append(theOp); - break; - } - - case DRAWOP_DRAW_LINE: - case DRAWOP_DRAW_RECT: - case DRAWOP_DRAW_ROUNDED_RECT: - case DRAWOP_DRAW_ELLIPSE: - case DRAWOP_DRAW_POINT: - case DRAWOP_DRAW_ARC: - case DRAWOP_DRAW_TEXT: - { - wxOpDraw *theOp = new wxOpDraw(opId, 0.0, 0.0, 0.0, 0.0); - theOp->ReadwxExpr(this, expr); - m_ops.Append(theOp); - break; - } - case DRAWOP_DRAW_SPLINE: - case DRAWOP_DRAW_POLYLINE: - case DRAWOP_DRAW_POLYGON: - { - wxOpPolyDraw *theOp = new wxOpPolyDraw(opId, 0, NULL); - theOp->ReadwxExpr(this, expr); - m_ops.Append(theOp); - break; - } - default: - break; - } - } - i ++; - } - - // Now read in the list of outline and fill operations, if any - wxExpr *expr1 = clause->AttributeValue("outline_objects"); - if (expr1) - { - wxExpr *eachExpr = expr1->GetFirst(); - while (eachExpr) - { - m_outlineColours.Append((wxObject *)eachExpr->IntegerValue()); - eachExpr = eachExpr->GetNext(); - } - } - expr1 = clause->AttributeValue("fill_objects"); - if (expr1) - { - wxExpr *eachExpr = expr1->GetFirst(); - while (eachExpr) - { - m_fillColours.Append((wxObject *)eachExpr->IntegerValue()); - eachExpr = eachExpr->GetNext(); - } - } -} -#endif - -// Does the copying for this object -void wxPseudoMetaFile::Copy(wxPseudoMetaFile& copy) -{ - copy.m_currentRotation = m_currentRotation; - copy.m_width = m_width; - copy.m_height = m_height; - copy.m_rotateable = m_rotateable; - - // Copy the GDI objects - wxNode *node = m_gdiObjects.First(); - while (node) - { - wxObject *obj = (wxObject *)node->Data(); - copy.m_gdiObjects.Append(obj); - node = node->Next(); - } - - // Copy the operations - node = m_ops.First(); - while (node) - { - wxDrawOp *op = (wxDrawOp *)node->Data(); - copy.m_ops.Append(op->Copy(©)); - node = node->Next(); - } - - // Copy the outline/fill operations - copy.m_outlineColours.Clear(); - node = m_outlineColours.First(); - while (node) - { - copy.m_outlineColours.Append((wxObject *)node->Data()); - node = node->Next(); - } - copy.m_fillColours.Clear(); - node = m_fillColours.First(); - while (node) - { - copy.m_fillColours.Append((wxObject *)node->Data()); - node = node->Next(); - } -} - -/* - * Pass size of existing image; scale height to - * fit width and return new width and height. - * - */ - -bool wxPseudoMetaFile::LoadFromMetaFile(char *filename, float *rwidth, float *rheight) -{ - if (!FileExists(filename)) - return NULL; - - wxXMetaFile *metaFile = new wxXMetaFile; - - if (!metaFile->ReadFile(filename)) - { - delete metaFile; - return FALSE; - } - - float lastX = 0.0; - float lastY = 0.0; - - // Convert from metafile records to wxDrawnShape records - wxNode *node = metaFile->metaRecords.First(); - while (node) - { - wxMetaRecord *record = (wxMetaRecord *)node->Data(); - switch (record->metaFunction) - { - case META_SETBKCOLOR: - { - wxOpSetGDI *op = new wxOpSetGDI(DRAWOP_SET_BK_COLOUR, this, 0); - op->r = (unsigned char)record->param1; - op->g = (unsigned char)record->param2; - op->b = (unsigned char)record->param3; - m_ops.Append(op); - break; - } - case META_SETBKMODE: - { - wxOpSetGDI *op = new wxOpSetGDI(DRAWOP_SET_BK_MODE, this, 0, (int)record->param1); - m_ops.Append(op); - break; - } - case META_SETMAPMODE: - { - break; - } -// case META_SETROP2: -// case META_SETRELABS: -// case META_SETPOLYFILLMODE: -// case META_SETSTRETCHBLTMODE: -// case META_SETTEXTCHAREXTRA: - case META_SETTEXTCOLOR: - { - wxOpSetGDI *op = new wxOpSetGDI(DRAWOP_SET_TEXT_COLOUR, this, 0); - op->r = (unsigned char)record->param1; - op->g = (unsigned char)record->param2; - op->b = (unsigned char)record->param3; - m_ops.Append(op); - break; - } -// case META_SETTEXTJUSTIFICATION: -// case META_SETWINDOWORG: -// case META_SETWINDOWEXT: -// case META_SETVIEWPORTORG: -// case META_SETVIEWPORTEXT: -// case META_OFFSETWINDOWORG: -// case META_SCALEWINDOWEXT: -// case META_OFFSETVIEWPORTORG: -// case META_SCALEVIEWPORTEXT: - case META_LINETO: - { - wxOpDraw *op = new wxOpDraw(DRAWOP_DRAW_LINE, (float)lastX, (float)lastY, - (float)record->param1, (float)record->param2); - m_ops.Append(op); - break; - } - case META_MOVETO: - { - lastX = (float)record->param1; - lastY = (float)record->param2; - break; - } - case META_EXCLUDECLIPRECT: - { -/* - wxMetaRecord *rec = new wxMetaRecord(META_EXCLUDECLIPRECT); - rec->param4 = getshort(handle); // y2 - rec->param3 = getshort(handle); // x2 - rec->param2 = getshort(handle); // y1 - rec->param1 = getshort(handle); // x1 -*/ - break; - } - case META_INTERSECTCLIPRECT: - { -/* - rec->param4 = getshort(handle); // y2 - rec->param3 = getshort(handle); // x2 - rec->param2 = getshort(handle); // y1 - rec->param1 = getshort(handle); // x1 -*/ - break; - } -// case META_ARC: // DO!!! - case META_ELLIPSE: - { - wxOpDraw *op = new wxOpDraw(DRAWOP_DRAW_ELLIPSE, - (float)record->param1, (float)record->param2, - (float)(record->param3 - record->param1), - (float)(record->param4 - record->param2)); - m_ops.Append(op); - break; - } -// case META_FLOODFILL: -// case META_PIE: // DO!!! - case META_RECTANGLE: - { - wxOpDraw *op = new wxOpDraw(DRAWOP_DRAW_RECT, - (float)record->param1, (float)record->param2, - (float)(record->param3 - record->param1), - (float)(record->param4 - record->param2)); - m_ops.Append(op); - break; - } - case META_ROUNDRECT: - { - wxOpDraw *op = new wxOpDraw(DRAWOP_DRAW_ROUNDED_RECT, - (float)record->param1, (float)record->param2, - (float)(record->param3 - record->param1), - (float)(record->param4 - record->param2), (float)record->param5); - m_ops.Append(op); - break; - } -// case META_PATBLT: -// case META_SAVEDC: - case META_SETPIXEL: - { - wxOpDraw *op = new wxOpDraw(DRAWOP_DRAW_POINT, - (float)record->param1, (float)record->param2, - 0.0, 0.0); - -// SHOULD SET THE COLOUR - SET PEN? -// rec->param3 = getint(handle); // COLORREF - m_ops.Append(op); - break; - } -// case META_OFFSETCLIPRGN: - case META_TEXTOUT: - { - wxOpDraw *op = new wxOpDraw(DRAWOP_DRAW_TEXT, - (float)record->param1, (float)record->param2, - 0.0, 0.0, 0.0, record->stringParam); - m_ops.Append(op); - break; - } -// case META_BITBLT: -// case META_STRETCHBLT: - case META_POLYGON: - { - int n = (int)record->param1; - wxRealPoint *newPoints = new wxRealPoint[n]; - for (int i = 0; i < n; i++) - { - newPoints[i].x = record->points[i].x; - newPoints[i].y = record->points[i].y; - } - - wxOpPolyDraw *op = new wxOpPolyDraw(DRAWOP_DRAW_POLYGON, n, newPoints); - m_ops.Append(op); - break; - } - case META_POLYLINE: - { - int n = (int)record->param1; - wxRealPoint *newPoints = new wxRealPoint[n]; - for (int i = 0; i < n; i++) - { - newPoints[i].x = record->points[i].x; - newPoints[i].y = record->points[i].y; - } - - wxOpPolyDraw *op = new wxOpPolyDraw(DRAWOP_DRAW_POLYLINE, n, newPoints); - m_ops.Append(op); - break; - } -// case META_ESCAPE: -// case META_RESTOREDC: -// case META_FILLREGION: -// case META_FRAMEREGION: -// case META_INVERTREGION: -// case META_PAINTREGION: -// case META_SELECTCLIPREGION: // DO THIS! - case META_SELECTOBJECT: - { - // The pen, brush etc. has already been created when the metafile - // was read in, so we don't create it - we set it. - wxNode *recNode = metaFile->gdiObjects.Nth((int)record->param2); - if (recNode) - { - wxMetaRecord *gdiRec = (wxMetaRecord *)recNode->Data(); - if (gdiRec && (gdiRec->param1 != 0)) - { - wxObject *obj = (wxObject *)gdiRec->param1; - if (obj->IsKindOf(CLASSINFO(wxPen))) - { - wxOpSetGDI *op = new wxOpSetGDI(DRAWOP_SET_PEN, this, (int)record->param2); - m_ops.Append(op); - } - else if (obj->IsKindOf(CLASSINFO(wxBrush))) - { - wxOpSetGDI *op = new wxOpSetGDI(DRAWOP_SET_BRUSH, this, (int)record->param2); - m_ops.Append(op); - } - else if (obj->IsKindOf(CLASSINFO(wxFont))) - { - wxOpSetGDI *op = new wxOpSetGDI(DRAWOP_SET_FONT, this, (int)record->param2); - m_ops.Append(op); - } - } - } - break; - } -// case META_SETTEXTALIGN: -// case META_DRAWTEXT: -// case META_CHORD: -// case META_SETMAPPERFLAGS: -// case META_EXTTEXTOUT: -// case META_SETDIBTODEV: -// case META_SELECTPALETTE: -// case META_REALIZEPALETTE: -// case META_ANIMATEPALETTE: -// case META_SETPALENTRIES: -// case META_POLYPOLYGON: -// case META_RESIZEPALETTE: -// case META_DIBBITBLT: -// case META_DIBSTRETCHBLT: - case META_DIBCREATEPATTERNBRUSH: - { - // Place holder - m_gdiObjects.Append(NULL); - break; - } -// case META_STRETCHDIB: -// case META_EXTFLOODFILL: -// case META_RESETDC: -// case META_STARTDOC: -// case META_STARTPAGE: -// case META_ENDPAGE: -// case META_ABORTDOC: -// case META_ENDDOC: -// case META_DELETEOBJECT: // DO!! - case META_CREATEPALETTE: - { - // Place holder - m_gdiObjects.Append(NULL); - break; - } - case META_CREATEBRUSH: - { - // Place holder - m_gdiObjects.Append(NULL); - break; - } - case META_CREATEPATTERNBRUSH: - { - // Place holder - m_gdiObjects.Append(NULL); - break; - } - case META_CREATEPENINDIRECT: - { - // The pen is created when the metafile is read in. - // We keep track of all the GDI objects needed for this - // image so when reading the wxDrawnShape from file, - // we can read in all the GDI objects, then refer - // to them by an index starting from zero thereafter. - m_gdiObjects.Append((wxObject *)record->param1); - break; - } - case META_CREATEFONTINDIRECT: - { - m_gdiObjects.Append((wxObject *)record->param1); - break; - } - case META_CREATEBRUSHINDIRECT: - { - // Don't have to do anything here: the pen is created - // when the metafile is read in. - m_gdiObjects.Append((wxObject *)record->param1); - break; - } - case META_CREATEBITMAPINDIRECT: - { - // Place holder - m_gdiObjects.Append(NULL); - break; - } - case META_CREATEBITMAP: - { - // Place holder - m_gdiObjects.Append(NULL); - break; - } - case META_CREATEREGION: - { - // Place holder - m_gdiObjects.Append(NULL); - break; - } - default: - { - break; - } - } - node = node->Next(); - } - float actualWidth = (float)fabs(metaFile->right - metaFile->left); - float actualHeight = (float)fabs(metaFile->bottom - metaFile->top); - - float initialScaleX = 1.0; - float initialScaleY = 1.0; - - float xoffset, yoffset; - - // Translate so origin is at centre of rectangle - if (metaFile->bottom > metaFile->top) - yoffset = - (float)((metaFile->bottom - metaFile->top)/2.0); - else - yoffset = - (float)((metaFile->top - metaFile->bottom)/2.0); - - if (metaFile->right > metaFile->left) - xoffset = - (float)((metaFile->right - metaFile->left)/2.0); - else - xoffset = - (float)((metaFile->left - metaFile->right)/2.0); - - Translate(xoffset, yoffset); - - // Scale to a reasonable size (take the width of this wxDrawnShape - // as a guide) - if (actualWidth != 0.0) - { - initialScaleX = (float)((*rwidth) / actualWidth); - initialScaleY = initialScaleX; - (*rheight) = initialScaleY*actualHeight; - } - Scale(initialScaleX, initialScaleY); - - m_width = (actualWidth*initialScaleX); - m_height = *rheight; - - delete metaFile; - return TRUE; -} - -// Scale to fit size -void wxPseudoMetaFile::ScaleTo(float w, float h) -{ - float scaleX = (float)(w/m_width); - float scaleY = (float)(h/m_height); - - // Do the scaling - Scale(scaleX, scaleY); -} - -void wxPseudoMetaFile::GetBounds(float *boundMinX, float *boundMinY, float *boundMaxX, float *boundMaxY) -{ - float maxX = (float) -99999.9; - float maxY = (float) -99999.9; - float minX = (float) 99999.9; - float minY = (float) 99999.9; - - wxNode *node = m_ops.First(); - while (node) - { - wxDrawOp *op = (wxDrawOp *)node->Data(); - switch (op->op) - { - case DRAWOP_DRAW_LINE: - case DRAWOP_DRAW_RECT: - case DRAWOP_DRAW_ROUNDED_RECT: - case DRAWOP_DRAW_ELLIPSE: - case DRAWOP_DRAW_POINT: - case DRAWOP_DRAW_ARC: - case DRAWOP_DRAW_TEXT: - { - wxOpDraw *opDraw = (wxOpDraw *)op; - if (opDraw->x1 < minX) minX = opDraw->x1; - if (opDraw->x1 > maxX) maxX = opDraw->x1; - if (opDraw->y1 < minY) minY = opDraw->y1; - if (opDraw->y1 > maxY) maxY = opDraw->y1; - if (op->op == DRAWOP_DRAW_LINE) - { - if (opDraw->x2 < minX) minX = opDraw->x2; - if (opDraw->x2 > maxX) maxX = opDraw->x2; - if (opDraw->y2 < minY) minY = opDraw->y2; - if (opDraw->y2 > maxY) maxY = opDraw->y2; - } - else if (op->op == DRAWOP_DRAW_RECT || - op->op == DRAWOP_DRAW_ROUNDED_RECT || - op->op == DRAWOP_DRAW_ELLIPSE) - { - if ((opDraw->x1 + opDraw->x2) < minX) minX = (opDraw->x1 + opDraw->x2); - if ((opDraw->x1 + opDraw->x2) > maxX) maxX = (opDraw->x1 + opDraw->x2); - if ((opDraw->y1 + opDraw->y2) < minY) minY = (opDraw->y1 + opDraw->y2); - if ((opDraw->y1 + opDraw->y2) > maxY) maxY = (opDraw->y1 + opDraw->y2); - } - break; - } - case DRAWOP_DRAW_POLYLINE: - case DRAWOP_DRAW_POLYGON: - case DRAWOP_DRAW_SPLINE: - { - wxOpPolyDraw *poly = (wxOpPolyDraw *)op; - for (int i = 0; i < poly->noPoints; i++) - { - if (poly->points[i].x < minX) minX = poly->points[i].x; - if (poly->points[i].x > maxX) maxX = poly->points[i].x; - if (poly->points[i].y < minY) minY = poly->points[i].y; - if (poly->points[i].y > maxY) maxY = poly->points[i].y; - } - break; - } - default: - break; - } - node = node->Next(); - } - - *boundMinX = minX; - *boundMinY = minY; - *boundMaxX = maxX; - *boundMaxY = maxY; -/* - *w = (float)fabs(maxX - minX); - *h = (float)fabs(maxY - minY); -*/ -} - - diff --git a/utils/ogl/src/drawn.h b/utils/ogl/src/drawn.h deleted file mode 100644 index ee8f321b7e..0000000000 --- a/utils/ogl/src/drawn.h +++ /dev/null @@ -1,119 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: drawn.h -// Purpose: wxDrawnShape -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_DRAWN_H_ -#define _OGL_DRAWN_H_ - -#ifdef __GNUG__ -#pragma interface "drawn.h" -#endif - -#include "basic.h" - -class wxPseudoMetaFile: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxPseudoMetaFile) - public: - wxPseudoMetaFile(); - wxPseudoMetaFile(wxPseudoMetaFile& mf); - ~wxPseudoMetaFile(); - - void Draw(wxDC& dc, float xoffset, float yoffset); - -#ifdef PROLOGIO - void WritePrologAttributes(wxExpr *clause); - void ReadPrologAttributes(wxExpr *clause); -#endif - - void Clear(); - - void Copy(wxPseudoMetaFile& copy); - - void Scale(float sx, float sy); - void ScaleTo(float w, float h); // Scale to fit size - void Translate(float x, float y); - - // Rotate about the given axis by theta radians from the x axis. - void Rotate(float x, float y, float theta); - - bool LoadFromMetaFile(char *filename, float *width, float *height); - - void GetBounds(float *minX, float *minY, float *maxX, float *maxY); - - inline wxList& GetOutlineColours() const { return (wxList&) m_outlineColours; } - inline wxList& GetFillColours() const { return (wxList&) m_fillColours; } - inline void SetRotateable(bool rot) { m_rotateable = rot; } - inline bool GetRotateable() const { return m_rotateable; } - -public: - bool m_rotateable; - float m_width; - float m_height; - wxList m_ops; // List of drawing operations (see drawnp.h) - wxList m_gdiObjects; // List of pens, brushes and fonts for this object. - - // Pen/brush specifying outline/fill colours - // to override operations. - wxPen* m_outlinePen; - wxBrush* m_fillBrush; - wxList m_outlineColours; // List of the GDI operations that comprise the outline - wxList m_fillColours; // List of the GDI operations that fill the shape - float m_currentRotation; -}; - -class wxDrawnShape: public wxRectangleShape -{ - DECLARE_DYNAMIC_CLASS(wxDrawnShape) - public: - wxDrawnShape(); - ~wxDrawnShape(); - - void OnDraw(wxDC& dc); - -#ifdef PROLOGIO - // Prolog database stuff - char *GetFunctor(); - void WritePrologAttributes(wxExpr *clause); - void ReadPrologAttributes(wxExpr *clause); -#endif - - // Does the copying for this object - void Copy(wxDrawnShape& copy); - - // Returns a new instance, and does the copy for this class. Define for each class. - wxShape *PrivateCopy(); - - void Scale(float sx, float sy); - void Translate(float x, float y); - // Rotate about the given axis by theta radians from the x axis. - void Rotate(float x, float y, float theta); - - // Get current rotation - inline float GetRotation() const { return m_rotation; } - - void SetSize(float w, float h, bool recursive = TRUE); - bool LoadFromMetaFile(char *filename); - - inline void SetSaveToFile(bool save) { m_saveToFile = save; } - inline wxPseudoMetaFile& GetMetaFile() const { return (wxPseudoMetaFile&) m_metafile; } - -private: - wxPseudoMetaFile m_metafile; - - // Don't save all wxDrawnShape metafiles to file: sometimes - // we take the metafile data from a symbol library. - bool m_saveToFile; - -}; - -#endif - // _DRAWN_H_ - diff --git a/utils/ogl/src/drawnp.h b/utils/ogl/src/drawnp.h deleted file mode 100644 index a08aef7bb5..0000000000 --- a/utils/ogl/src/drawnp.h +++ /dev/null @@ -1,168 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: drawnp.h -// Purpose: Private header for wxDrawnShape -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_DRAWNP_H_ -#define _OGL_DRAWNP_H_ - -#ifdef __GNUG__ -#pragma interface "drawnp.h" -#endif - -#include "drawn.h" - -/* - * Drawing operations - * - */ - -#define DRAWOP_SET_PEN 1 -#define DRAWOP_SET_BRUSH 2 -#define DRAWOP_SET_FONT 3 -#define DRAWOP_SET_TEXT_COLOUR 4 -#define DRAWOP_SET_BK_COLOUR 5 -#define DRAWOP_SET_BK_MODE 6 -#define DRAWOP_SET_CLIPPING_RECT 7 -#define DRAWOP_DESTROY_CLIPPING_RECT 8 - -/* -#define DRAWOP_CREATE_PEN 10 -#define DRAWOP_CREATE_BRUSH 11 -#define DRAWOP_CREATE_FONT 12 -*/ - -#define DRAWOP_DRAW_LINE 20 -#define DRAWOP_DRAW_POLYLINE 21 -#define DRAWOP_DRAW_POLYGON 22 -#define DRAWOP_DRAW_RECT 23 -#define DRAWOP_DRAW_ROUNDED_RECT 24 -#define DRAWOP_DRAW_ELLIPSE 25 -#define DRAWOP_DRAW_POINT 26 -#define DRAWOP_DRAW_ARC 27 -#define DRAWOP_DRAW_TEXT 28 -#define DRAWOP_DRAW_SPLINE 29 - -/* - * Base, virtual class - * - */ - -class wxDrawOp: public wxObject -{ - public: - int op; - - inline wxDrawOp(int theOp) { op = theOp; } - inline ~wxDrawOp() {} - inline virtual void Scale(float xScale, float yScale) {}; - inline virtual void Translate(float x, float y) {}; - inline virtual void Rotate(float x, float y, float sinTheta, float cosTheta) {}; - virtual void Do(wxDC& dc, float xoffset, float yoffset) = 0; - virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0; - virtual wxExpr *WritewxExpr(wxPseudoMetaFile *image) = 0; - virtual void ReadwxExpr(wxPseudoMetaFile *image, wxExpr *expr) = 0; -}; - -/* - * Set font, brush, text colour - * - */ - -class wxOpSetGDI: public wxDrawOp -{ - public: - int mode; - int gdiIndex; - wxPseudoMetaFile *image; - unsigned char r; - unsigned char g; - unsigned char b; - wxOpSetGDI(int theOp, wxPseudoMetaFile *theImage, int theGdiIndex, int theMode = 0); - void Do(wxDC& dc, float xoffset, float yoffset); - wxDrawOp *Copy(wxPseudoMetaFile *newImage); - wxExpr *WritewxExpr(wxPseudoMetaFile *image); - void ReadwxExpr(wxPseudoMetaFile *image, wxExpr *expr); -}; - -/* - * Set/destroy clipping - * - */ - -class wxOpSetClipping: public wxDrawOp -{ - public: - float x1; - float y1; - float x2; - float y2; - wxOpSetClipping(int theOp, float theX1, float theY1, float theX2, float theY2); - void Do(wxDC& dc, float xoffset, float yoffset); - void Scale(float xScale, float yScale); - void Translate(float x, float y); - wxDrawOp *Copy(wxPseudoMetaFile *newImage); - wxExpr *WritewxExpr(wxPseudoMetaFile *image); - void ReadwxExpr(wxPseudoMetaFile *image, wxExpr *expr); -}; - -/* - * Draw line, rectangle, rounded rectangle, ellipse, point, arc, text - * - */ - -class wxOpDraw: public wxDrawOp -{ - public: - float x1; - float y1; - float x2; - float y2; - float x3; - float radius; - char *textString; - - wxOpDraw(int theOp, float theX1, float theY1, float theX2, float theY2, - float radius = 0.0, char *s = NULL); - ~wxOpDraw(); - void Do(wxDC& dc, float xoffset, float yoffset); - void Scale(float scaleX, float scaleY); - void Translate(float x, float y); - void Rotate(float x, float y, float sinTheta, float cosTheta); - wxDrawOp *Copy(wxPseudoMetaFile *newImage); - wxExpr *WritewxExpr(wxPseudoMetaFile *image); - void ReadwxExpr(wxPseudoMetaFile *image, wxExpr *expr); -}; - -/* - * Draw polyline, spline, polygon - * - */ - -class wxOpPolyDraw: public wxDrawOp -{ - public: - wxRealPoint *points; - int noPoints; - - wxOpPolyDraw(int theOp, int n, wxRealPoint *thePoints); - ~wxOpPolyDraw(); - void Do(wxDC& dc, float xoffset, float yoffset); - void Scale(float scaleX, float scaleY); - void Translate(float x, float y); - void Rotate(float x, float y, float sinTheta, float cosTheta); - wxDrawOp *Copy(wxPseudoMetaFile *newImage); - wxExpr *WritewxExpr(wxPseudoMetaFile *image); - void ReadwxExpr(wxPseudoMetaFile *image, wxExpr *expr); -}; - -#endif - // _OGL_DRAWNP_H_ - - diff --git a/utils/ogl/src/lines.cpp b/utils/ogl/src/lines.cpp deleted file mode 100644 index ed7b240715..0000000000 --- a/utils/ogl/src/lines.cpp +++ /dev/null @@ -1,2481 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: lines.cpp -// Purpose: wxLineShape -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "lines.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#ifdef PROLOGIO -#include -#endif - -#if USE_IOSTREAMH -#include -#else -#include -#endif - -#include -#include - -#include "basic.h" -#include "basicp.h" -#include "lines.h" -#include "linesp.h" -#include "drawn.h" -#include "misc.h" -#include "canvas.h" - -// Line shape -IMPLEMENT_DYNAMIC_CLASS(wxLineShape, wxShape) - -wxLineShape::wxLineShape() -{ - m_sensitivity = OP_CLICK_LEFT | OP_CLICK_RIGHT; - m_draggable = FALSE; - m_attachmentTo = 0; - m_attachmentFrom = 0; -/* - m_actualTextWidth = 0.0; - m_actualTextHeight = 0.0; -*/ - m_from = NULL; - m_to = NULL; - m_erasing = FALSE; - m_arrowSpacing = 5.0; // For the moment, don't bother saving this to file. - m_ignoreArrowOffsets = FALSE; - m_isSpline = FALSE; - m_maintainStraightLines = FALSE; - m_alignmentStart = 0; - m_alignmentEnd = 0; - - m_lineControlPoints = NULL; - - // Clear any existing regions (created in an earlier constructor) - // and make the three line regions. - ClearRegions(); - wxShapeRegion *newRegion = new wxShapeRegion; - newRegion->SetName("Middle"); - newRegion->SetSize(150, 50); - m_regions.Append((wxObject *)newRegion); - - newRegion = new wxShapeRegion; - newRegion->SetName("Start"); - newRegion->SetSize(150, 50); - m_regions.Append((wxObject *)newRegion); - - newRegion = new wxShapeRegion; - newRegion->SetName("End"); - newRegion->SetSize(150, 50); - m_regions.Append((wxObject *)newRegion); - - for (int i = 0; i < 3; i++) - m_labelObjects[i] = NULL; -} - -wxLineShape::~wxLineShape() -{ - if (m_lineControlPoints) - { - ClearPointList(*m_lineControlPoints); - delete m_lineControlPoints; - } - for (int i = 0; i < 3; i++) - { - if (m_labelObjects[i]) - { - m_labelObjects[i]->Select(FALSE); - m_labelObjects[i]->RemoveFromCanvas(m_canvas); - delete m_labelObjects[i]; - m_labelObjects[i] = NULL; - } - } -} - -void wxLineShape::MakeLineControlPoints(int n) -{ - if (m_lineControlPoints) - { - ClearPointList(*m_lineControlPoints); - delete m_lineControlPoints; - } - m_lineControlPoints = new wxList; - - int i = 0; - for (i = 0; i < n; i++) - { - wxRealPoint *point = new wxRealPoint(-999, -999); - m_lineControlPoints->Append((wxObject*) point); - } -} - -wxNode *wxLineShape::InsertLineControlPoint(wxDC* dc) -{ - if (dc) - Erase(*dc); - - wxNode *last = m_lineControlPoints->Last(); - wxNode *second_last = last->Previous(); - wxRealPoint *last_point = (wxRealPoint *)last->Data(); - wxRealPoint *second_last_point = (wxRealPoint *)second_last->Data(); - - // Choose a point half way between the last and penultimate points - float line_x = ((last_point->x + second_last_point->x)/2); - float line_y = ((last_point->y + second_last_point->y)/2); - - wxRealPoint *point = new wxRealPoint(line_x, line_y); - wxNode *node = m_lineControlPoints->Insert(last, (wxObject*) point); - return node; -} - -bool wxLineShape::DeleteLineControlPoint() -{ - if (m_lineControlPoints->Number() < 3) - return FALSE; - - wxNode *last = m_lineControlPoints->Last(); - wxNode *second_last = last->Previous(); - - wxRealPoint *second_last_point = (wxRealPoint *)second_last->Data(); - delete second_last_point; - delete second_last; - - return TRUE; -} - -void wxLineShape::Initialise() -{ - if (m_lineControlPoints) - { - // Just move the first and last control points - wxNode *first = m_lineControlPoints->First(); - wxRealPoint *first_point = (wxRealPoint *)first->Data(); - - wxNode *last = m_lineControlPoints->Last(); - wxRealPoint *last_point = (wxRealPoint *)last->Data(); - - // If any of the line points are at -999, we must - // initialize them by placing them half way between the first - // and the last. - wxNode *node = first->Next(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - if (point->x == -999) - { - float x1, y1, x2, y2; - if (first_point->x < last_point->x) - { x1 = first_point->x; x2 = last_point->x; } - else - { x2 = first_point->x; x1 = last_point->x; } - - if (first_point->y < last_point->y) - { y1 = first_point->y; y2 = last_point->y; } - else - { y2 = first_point->y; y1 = last_point->y; } - - point->x = ((x2 - x1)/2 + x1); - point->y = ((y2 - y1)/2 + y1); - } - node = node->Next(); - } - } -} - -// Format a text string according to the region size, adding -// strings with positions to region text list -void wxLineShape::FormatText(wxDC& dc, const wxString& s, int i) -{ - float w, h; - ClearText(i); - - if (m_regions.Number() < 1) - return; - wxNode *node = m_regions.Nth(i); - if (!node) - return; - - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - region->SetText(s); - dc.SetFont(region->GetFont()); - - region->GetSize(&w, &h); - // Initialize the size if zero - if (((w == 0) || (h == 0)) && (strlen(s) > 0)) - { - w = 100; h = 50; - region->SetSize(w, h); - } - - wxList *string_list = ::FormatText(dc, s, (w-5), (h-5), region->GetFormatMode()); - node = string_list->First(); - while (node) - { - char *s = (char *)node->Data(); - wxShapeTextLine *line = new wxShapeTextLine(0.0, 0.0, s); - region->GetFormattedText().Append((wxObject *)line); - delete node; - node = string_list->First(); - } - delete string_list; - float actualW = w; - float actualH = h; - if (region->GetFormatMode() & FORMAT_SIZE_TO_CONTENTS) - { - GetCentredTextExtent(dc, &(region->GetFormattedText()), m_xpos, m_ypos, w, h, &actualW, &actualH); - if ((actualW != w ) || (actualH != h)) - { - float xx, yy; - GetLabelPosition(i, &xx, &yy); - EraseRegion(dc, region, xx, yy); - if (m_labelObjects[i]) - { - m_labelObjects[i]->Select(FALSE); - m_labelObjects[i]->Erase(dc); - m_labelObjects[i]->SetSize(actualW, actualH); - } - - region->SetSize(actualW, actualH); - - if (m_labelObjects[i]) - { - m_labelObjects[i]->Select(TRUE, & dc); - m_labelObjects[i]->Draw(dc); - } - } - } - CentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, actualW, actualH, region->GetFormatMode()); - m_formatted = TRUE; -} - -void wxLineShape::DrawRegion(wxDC& dc, wxShapeRegion *region, float x, float y) -{ - if (GetDisableLabel()) - return; - - float w, h; - float xx, yy; - region->GetSize(&w, &h); - - // Get offset from x, y - region->GetPosition(&xx, &yy); - - float xp = xx + x; - float yp = yy + y; - - // First, clear a rectangle for the text IF there is any - if (region->GetFormattedText().Number() > 0) - { - dc.SetPen(white_background_pen); - dc.SetBrush(white_background_brush); - - // Now draw the text - if (region->GetFont()) dc.SetFont(region->GetFont()); - - dc.DrawRectangle((float)(xp - w/2.0), (float)(yp - h/2.0), (float)w, (float)h); - - if (m_pen) dc.SetPen(m_pen); - dc.SetTextForeground(* region->GetActualColourObject()); - -#ifdef __WXMSW__ - dc.SetTextBackground(white_background_brush->GetColour()); -#endif - - DrawFormattedText(dc, &(region->GetFormattedText()), xp, yp, w, h, region->GetFormatMode()); - } -} - -void wxLineShape::EraseRegion(wxDC& dc, wxShapeRegion *region, float x, float y) -{ - if (GetDisableLabel()) - return; - - float w, h; - float xx, yy; - region->GetSize(&w, &h); - - // Get offset from x, y - region->GetPosition(&xx, &yy); - - float xp = xx + x; - float yp = yy + y; - - if (region->GetFormattedText().Number() > 0) - { - dc.SetPen(white_background_pen); - dc.SetBrush(white_background_brush); - - dc.DrawRectangle((float)(xp - w/2.0), (float)(yp - h/2.0), (float)w, (float)h); - } -} - -// Get the reference point for a label. Region x and y -// are offsets from this. -// position is 0, 1, 2 -void wxLineShape::GetLabelPosition(int position, float *x, float *y) -{ - switch (position) - { - case 0: - { - // Want to take the middle section for the label - int n = m_lineControlPoints->Number(); - int half_way = (int)(n/2); - - // Find middle of this line - wxNode *node = m_lineControlPoints->Nth(half_way - 1); - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxNode *next_node = node->Next(); - wxRealPoint *next_point = (wxRealPoint *)next_node->Data(); - - float dx = (next_point->x - point->x); - float dy = (next_point->y - point->y); - *x = (float)(point->x + dx/2.0); - *y = (float)(point->y + dy/2.0); - break; - } - case 1: - { - wxNode *node = m_lineControlPoints->First(); - *x = ((wxRealPoint *)node->Data())->x; - *y = ((wxRealPoint *)node->Data())->y; - break; - } - case 2: - { - wxNode *node = m_lineControlPoints->Last(); - *x = ((wxRealPoint *)node->Data())->x; - *y = ((wxRealPoint *)node->Data())->y; - break; - } - default: - break; - } -} - -/* - * Find whether line is supposed to be vertical or horizontal and - * make it so. - * - */ -void GraphicsStraightenLine(wxRealPoint *point1, wxRealPoint *point2) -{ - float dx = point2->x - point1->x; - float dy = point2->y - point1->y; - - if (dx == 0.0) - return; - else if (fabs(dy/dx) > 1.0) - { - point2->x = point1->x; - } - else point2->y = point1->y; -} - -void wxLineShape::Straighten(wxDC& dc) -{ - if (!m_lineControlPoints || m_lineControlPoints->Number() < 3) - return; - - Erase(dc); - - wxNode *first_point_node = m_lineControlPoints->First(); - wxNode *last_point_node = m_lineControlPoints->Last(); - wxNode *second_last_point_node = last_point_node->Previous(); - - wxRealPoint *last_point = (wxRealPoint *)last_point_node->Data(); - wxRealPoint *second_last_point = (wxRealPoint *)second_last_point_node->Data(); - - GraphicsStraightenLine(last_point, second_last_point); - - wxNode *node = first_point_node; - while (node && (node != second_last_point_node)) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxRealPoint *next_point = (wxRealPoint *)(node->Next()->Data()); - - GraphicsStraightenLine(point, next_point); - node = node->Next(); - } - - Draw(dc); -} - - -void wxLineShape::Unlink() -{ - if (m_to) - m_to->GetLines().DeleteObject(this); - if (m_from) - m_from->GetLines().DeleteObject(this); - m_to = NULL; - m_from = NULL; -} - -void wxLineShape::SetEnds(float x1, float y1, float x2, float y2) -{ - // Find centre point - wxNode *first_point_node = m_lineControlPoints->First(); - wxNode *last_point_node = m_lineControlPoints->Last(); - wxRealPoint *first_point = (wxRealPoint *)first_point_node->Data(); - wxRealPoint *last_point = (wxRealPoint *)last_point_node->Data(); - - first_point->x = x1; - first_point->y = y1; - last_point->x = x2; - last_point->y = y2; - - m_xpos = (float)((x1 + x2)/2.0); - m_ypos = (float)((y1 + y2)/2.0); -} - -// Get absolute positions of ends -void wxLineShape::GetEnds(float *x1, float *y1, float *x2, float *y2) -{ - wxNode *first_point_node = m_lineControlPoints->First(); - wxNode *last_point_node = m_lineControlPoints->Last(); - wxRealPoint *first_point = (wxRealPoint *)first_point_node->Data(); - wxRealPoint *last_point = (wxRealPoint *)last_point_node->Data(); - - *x1 = first_point->x; *y1 = first_point->y; - *x2 = last_point->x; *y2 = last_point->y; -} - -void wxLineShape::SetAttachments(int from_attach, int to_attach) -{ - m_attachmentFrom = from_attach; - m_attachmentTo = to_attach; -} - -bool wxLineShape::HitTest(float x, float y, int *attachment, float *distance) -{ - if (!m_lineControlPoints) - return FALSE; - - // Look at label regions in case mouse is over a label - bool inLabelRegion = FALSE; - for (int i = 0; i < 3; i ++) - { - wxNode *regionNode = m_regions.Nth(i); - if (regionNode) - { - wxShapeRegion *region = (wxShapeRegion *)regionNode->Data(); - if (region->m_formattedText.Number() > 0) - { - float xp, yp, cx, cy, cw, ch; - GetLabelPosition(i, &xp, &yp); - // Offset region from default label position - region->GetPosition(&cx, &cy); - region->GetSize(&cw, &ch); - cx += xp; - cy += yp; - float rLeft = (float)(cx - (cw/2.0)); - float rTop = (float)(cy - (ch/2.0)); - float rRight = (float)(cx + (cw/2.0)); - float rBottom = (float)(cy + (ch/2.0)); - if (x > rLeft && x < rRight && y > rTop && y < rBottom) - { - inLabelRegion = TRUE; - i = 3; - } - } - } - } - - wxNode *node = m_lineControlPoints->First(); - - while (node && node->Next()) - { - wxRealPoint *point1 = (wxRealPoint *)node->Data(); - wxRealPoint *point2 = (wxRealPoint *)node->Next()->Data(); - - // Allow for inaccurate mousing or vert/horiz lines - int extra = 4; - float left = wxMin(point1->x, point2->x) - extra; - float right = wxMax(point1->x, point2->x) + extra; - - float bottom = wxMin(point1->y, point2->y) - extra; - float top = wxMax(point1->y, point2->y) + extra; - - if ((x > left && x < right && y > bottom && y < top) || inLabelRegion) - { - // Work out distance from centre of line - float centre_x = (float)(left + (right - left)/2.0); - float centre_y = (float)(bottom + (top - bottom)/2.0); - - *attachment = 0; - *distance = (float)sqrt((centre_x - x)*(centre_x - x) + (centre_y - y)*(centre_y - y)); - return TRUE; - } - - node = node->Next(); - } - return FALSE; -} - -void wxLineShape::DrawArrows(wxDC& dc) -{ - // Distance along line of each arrow: space them out evenly. - float startArrowPos = 0.0; - float endArrowPos = 0.0; - float middleArrowPos = 0.0; - - wxNode *node = m_arcArrows.First(); - while (node) - { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); - switch (arrow->GetArrowEnd()) - { - case ARROW_POSITION_START: - { - if ((arrow->GetXOffset() != 0.0) && !m_ignoreArrowOffsets) - // If specified, x offset is proportional to line length - DrawArrow(dc, arrow, arrow->GetXOffset(), TRUE); - else - { - DrawArrow(dc, arrow, startArrowPos, FALSE); // Absolute distance - startArrowPos += arrow->GetSize() + arrow->GetSpacing(); - } - break; - } - case ARROW_POSITION_END: - { - if ((arrow->GetXOffset() != 0.0) && !m_ignoreArrowOffsets) - DrawArrow(dc, arrow, arrow->GetXOffset(), TRUE); - else - { - DrawArrow(dc, arrow, endArrowPos, FALSE); - endArrowPos += arrow->GetSize() + arrow->GetSpacing(); - } - break; - } - case ARROW_POSITION_MIDDLE: - { - arrow->SetXOffset(middleArrowPos); - if ((arrow->GetXOffset() != 0.0) && !m_ignoreArrowOffsets) - DrawArrow(dc, arrow, arrow->GetXOffset(), TRUE); - else - { - DrawArrow(dc, arrow, middleArrowPos, FALSE); - middleArrowPos += arrow->GetSize() + arrow->GetSpacing(); - } - break; - } - } - node = node->Next(); - } -} - -void wxLineShape::DrawArrow(wxDC& dc, wxArrowHead *arrow, float xOffset, bool proportionalOffset) -{ - wxNode *first_line_node = m_lineControlPoints->First(); - wxRealPoint *first_line_point = (wxRealPoint *)first_line_node->Data(); - wxNode *second_line_node = first_line_node->Next(); - wxRealPoint *second_line_point = (wxRealPoint *)second_line_node->Data(); - - wxNode *last_line_node = m_lineControlPoints->Last(); - wxRealPoint *last_line_point = (wxRealPoint *)last_line_node->Data(); - wxNode *second_last_line_node = last_line_node->Previous(); - wxRealPoint *second_last_line_point = (wxRealPoint *)second_last_line_node->Data(); - - // Position where we want to start drawing - float positionOnLineX, positionOnLineY; - - // Position of start point of line, at the end of which we draw the arrow. - float startPositionX, startPositionY; - - switch (arrow->GetPosition()) - { - case ARROW_POSITION_START: - { - // If we're using a proportional offset, calculate just where this will - // be on the line. - float realOffset = xOffset; - if (proportionalOffset) - { - float totalLength = - (float)sqrt((second_line_point->x - first_line_point->x)*(second_line_point->x - first_line_point->x) + - (second_line_point->y - first_line_point->y)*(second_line_point->y - first_line_point->y)); - realOffset = (float)(xOffset * totalLength); - } - GetPointOnLine(second_line_point->x, second_line_point->y, - first_line_point->x, first_line_point->y, - realOffset, &positionOnLineX, &positionOnLineY); - startPositionX = second_line_point->x; - startPositionY = second_line_point->y; - break; - } - case ARROW_POSITION_END: - { - // If we're using a proportional offset, calculate just where this will - // be on the line. - float realOffset = xOffset; - if (proportionalOffset) - { - float totalLength = - (float)sqrt((second_last_line_point->x - last_line_point->x)*(second_last_line_point->x - last_line_point->x) + - (second_last_line_point->y - last_line_point->y)*(second_last_line_point->y - last_line_point->y)); - realOffset = (float)(xOffset * totalLength); - } - GetPointOnLine(second_last_line_point->x, second_last_line_point->y, - last_line_point->x, last_line_point->y, - realOffset, &positionOnLineX, &positionOnLineY); - startPositionX = second_last_line_point->x; - startPositionY = second_last_line_point->y; - break; - } - case ARROW_POSITION_MIDDLE: - { - // Choose a point half way between the last and penultimate points - float x = ((last_line_point->x + second_last_line_point->x)/2); - float y = ((last_line_point->y + second_last_line_point->y)/2); - - // If we're using a proportional offset, calculate just where this will - // be on the line. - float realOffset = xOffset; - if (proportionalOffset) - { - float totalLength = - (float)sqrt((second_last_line_point->x - x)*(second_last_line_point->x - x) + - (second_last_line_point->y - y)*(second_last_line_point->y - y)); - realOffset = (float)(xOffset * totalLength); - } - - GetPointOnLine(second_last_line_point->x, second_last_line_point->y, - x, y, realOffset, &positionOnLineX, &positionOnLineY); - startPositionX = second_last_line_point->x; - startPositionY = second_last_line_point->y; - break; - } - } - - /* - * Add yOffset to arrow, if any - */ - - const float myPi = (float) 3.14159265; - // The translation that the y offset may give - float deltaX = 0.0; - float deltaY = 0.0; - if ((arrow->GetYOffset() != 0.0) && !m_ignoreArrowOffsets) - { - /* - |(x4, y4) - |d - | - (x1, y1)--------------(x3, y3)------------------(x2, y2) - x4 = x3 - d * sin(theta) - y4 = y3 + d * cos(theta) - - Where theta = tan(-1) of (y3-y1)/(x3-x1) - */ - float x1 = startPositionX; - float y1 = startPositionY; - float x3 = positionOnLineX; - float y3 = positionOnLineY; - float d = -arrow->GetYOffset(); // Negate so +offset is above line - - float theta = 0.0; - if (x3 == x1) - theta = (float)(myPi/2.0); - else - theta = (float)atan((y3-y1)/(x3-x1)); - - float x4 = (float)(x3 - (d*sin(theta))); - float y4 = (float)(y3 + (d*cos(theta))); - - deltaX = x4 - positionOnLineX; - deltaY = y4 - positionOnLineY; - } - - switch (arrow->_GetType()) - { - case ARROW_ARROW: - { - float arrowLength = arrow->GetSize(); - float arrowWidth = (float)(arrowLength/3.0); - - float tip_x, tip_y, side1_x, side1_y, side2_x, side2_y; - get_arrow_points(startPositionX+deltaX, startPositionY+deltaY, - positionOnLineX+deltaX, positionOnLineY+deltaY, - arrowLength, arrowWidth, &tip_x, &tip_y, - &side1_x, &side1_y, &side2_x, &side2_y); - - wxPoint points[4]; - points[0].x = tip_x; points[0].y = tip_y; - points[1].x = side1_x; points[1].y = side1_y; - points[2].x = side2_x; points[2].y = side2_y; - points[3].x = tip_x; points[3].y = tip_y; - - dc.SetPen(m_pen); - dc.SetBrush(m_brush); - dc.DrawPolygon(4, points); - break; - } - case ARROW_HOLLOW_CIRCLE: - case ARROW_FILLED_CIRCLE: - { - // Find point on line of centre of circle, which is a radius away - // from the end position - float diameter = (float)(arrow->GetSize()); - float x, y; - GetPointOnLine(startPositionX+deltaX, startPositionY+deltaY, - positionOnLineX+deltaX, positionOnLineY+deltaY, - (float)(diameter/2.0), - &x, &y); - - // Convert ellipse centre to top-left coordinates - float x1 = (float)(x - (diameter/2.0)); - float y1 = (float)(y - (diameter/2.0)); - - dc.SetPen(m_pen); - if (arrow->_GetType() == ARROW_HOLLOW_CIRCLE) - dc.SetBrush(white_background_brush); - else - dc.SetBrush(m_brush); - - dc.DrawEllipse(x1, y1, diameter, diameter); - break; - } - case ARROW_SINGLE_OBLIQUE: - { - break; - } - case ARROW_METAFILE: - { - if (arrow->GetMetaFile()) - { - // Find point on line of centre of object, which is a half-width away - // from the end position - /* - * width - * <-- start pos <-----><-- positionOnLineX - * _____ - * --------------| x | <-- e.g. rectangular arrowhead - * ----- - */ - float x, y; - GetPointOnLine(startPositionX, startPositionY, - positionOnLineX, positionOnLineY, - (float)(arrow->GetMetaFile()->m_width/2.0), - &x, &y); - - // Calculate theta for rotating the metafile. - /* - | - | o(x2, y2) 'o' represents the arrowhead. - | / - | / - | /theta - | /(x1, y1) - |______________________ - */ - float theta = 0.0; - float x1 = startPositionX; - float y1 = startPositionY; - float x2 = positionOnLineX; - float y2 = positionOnLineY; - - if ((x1 == x2) && (y1 == y2)) - theta = 0.0; - - else if ((x1 == x2) && (y1 > y2)) - theta = (float)(3.0*myPi/2.0); - - else if ((x1 == x2) && (y2 > y1)) - theta = (float)(myPi/2.0); - - else if ((x2 > x1) && (y2 >= y1)) - theta = (float)atan((y2 - y1)/(x2 - x1)); - - else if (x2 < x1) - theta = (float)(myPi + atan((y2 - y1)/(x2 - x1))); - - else if ((x2 > x1) && (y2 < y1)) - theta = (float)(2*myPi + atan((y2 - y1)/(x2 - x1))); - - else - { - wxFatalError("Unknown arrowhead rotation case in lines.cc"); - } - - // Rotate about the centre of the object, then place - // the object on the line. - if (arrow->GetMetaFile()->GetRotateable()) - arrow->GetMetaFile()->Rotate(0.0, 0.0, theta); - - if (m_erasing) - { - // If erasing, just draw a rectangle. - float minX, minY, maxX, maxY; - arrow->GetMetaFile()->GetBounds(&minX, &minY, &maxX, &maxY); - // Make erasing rectangle slightly bigger or you get droppings. - int extraPixels = 4; - dc.DrawRectangle((float)(deltaX + x + minX - (extraPixels/2.0)), (float)(deltaY + y + minY - (extraPixels/2.0)), - (float)(maxX - minX + extraPixels), (float)(maxY - minY + extraPixels)); - } - else - arrow->GetMetaFile()->Draw(dc, x+deltaX, y+deltaY); - } - break; - } - default: - { - } - } -} - -void wxLineShape::OnErase(wxDC& dc) -{ - wxPen *old_pen = m_pen; - wxBrush *old_brush = m_brush; - SetPen(white_background_pen); - SetBrush(white_background_brush); - - float bound_x, bound_y; - GetBoundingBoxMax(&bound_x, &bound_y); - if (m_font) dc.SetFont(m_font); - - // Undraw text regions - for (int i = 0; i < 3; i++) - { - wxNode *node = m_regions.Nth(i); - if (node) - { - float x, y; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - GetLabelPosition(i, &x, &y); - EraseRegion(dc, region, x, y); - } - } - - // Undraw line - dc.SetPen(white_background_pen); - dc.SetBrush(white_background_brush); - - // Drawing over the line only seems to work if the line has a thickness - // of 1. - if (old_pen && (old_pen->GetWidth() > 1)) - { - dc.DrawRectangle((float)(m_xpos - (bound_x/2.0) - 2.0), (float)(m_ypos - (bound_y/2.0) - 2.0), - (float)(bound_x+4.0), (float)(bound_y+4.0)); - } - else - { - m_erasing = TRUE; - GetEventHandler()->OnDraw(dc); - GetEventHandler()->OnEraseControlPoints(dc); - m_erasing = FALSE; - } - - if (old_pen) SetPen(old_pen); - if (old_brush) SetBrush(old_brush); -} - -void wxLineShape::GetBoundingBoxMin(float *w, float *h) -{ - float x1 = 10000; - float y1 = 10000; - float x2 = -10000; - float y2 = -10000; - - wxNode *node = m_lineControlPoints->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - - if (point->x < x1) x1 = point->x; - if (point->y < y1) y1 = point->y; - if (point->x > x2) x2 = point->x; - if (point->y > y2) y2 = point->y; - - node = node->Next(); - } - *w = (float)(x2 - x1); - *h = (float)(y2 - y1); -} - -/* - * For a node image of interest, finds the position of this arc - * amongst all the arcs which are attached to THIS SIDE of the node image, - * and the number of same. - */ -void wxLineShape::FindNth(wxShape *image, int *nth, int *no_arcs, bool incoming) -{ - int n = -1; - int num = 0; - wxNode *node = image->GetLines().First(); - int this_attachment; - if (image == m_to) - this_attachment = m_attachmentTo; - else - this_attachment = m_attachmentFrom; - - // Find number of lines going into/out of this particular attachment point - while (node) - { - wxLineShape *line = (wxLineShape *)node->Data(); - - if (line->m_from == image) - { - // This is the nth line attached to 'image' - if ((line == this) && !incoming) - n = num; - - // Increment num count if this is the same side (attachment number) - if (line->m_attachmentFrom == this_attachment) - num ++; - } - - if (line->m_to == image) - { - // This is the nth line attached to 'image' - if ((line == this) && incoming) - n = num; - - // Increment num count if this is the same side (attachment number) - if (line->m_attachmentTo == this_attachment) - num ++; - } - - node = node->Next(); - } - *nth = n; - *no_arcs = num; -} - -void wxLineShape::OnDrawOutline(wxDC& dc, float x, float y, float w, float h) -{ - wxPen *old_pen = m_pen; - wxBrush *old_brush = m_brush; - - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - SetPen(& dottedPen); - SetBrush( wxTRANSPARENT_BRUSH ); - -/* - if (m_isSpline) - dc.DrawSpline(m_lineControlPoints); - else - dc.DrawLines(m_lineControlPoints); -*/ - GetEventHandler()->OnDraw(dc); - - if (old_pen) SetPen(old_pen); - else SetPen(NULL); - if (old_brush) SetBrush(old_brush); - else SetBrush(NULL); -} - -bool wxLineShape::OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display) -{ - float x_offset = x - old_x; - float y_offset = y - old_y; - - if (m_lineControlPoints && !(x_offset == 0.0 && y_offset == 0.0)) - { - wxNode *node = m_lineControlPoints->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - point->x += x_offset; - point->y += y_offset; - node = node->Next(); - } - - } - - // Move temporary label rectangles if necessary - for (int i = 0; i < 3; i++) - { - if (m_labelObjects[i]) - { - m_labelObjects[i]->Erase(dc); - float xp, yp, xr, yr; - GetLabelPosition(i, &xp, &yp); - wxNode *node = m_regions.Nth(i); - if (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - region->GetPosition(&xr, &yr); - } - else - { - xr = 0.0; yr = 0.0; - } - - m_labelObjects[i]->Move(dc, xp+xr, yp+yr); - } - } - return TRUE; -} - -void wxLineShape::OnMoveLink(wxDC& dc, bool moveControlPoints) -{ - if (!m_from || !m_to) - return; - - if (m_lineControlPoints->Number() > 2) - Initialise(); - - // Do each end - nothing in the middle. User has to move other points - // manually if necessary. - float end_x, end_y; - float other_end_x, other_end_y; - - FindLineEndPoints(&end_x, &end_y, &other_end_x, &other_end_y); - - wxNode *first = m_lineControlPoints->First(); - wxRealPoint *first_point = (wxRealPoint *)first->Data(); - wxNode *last = m_lineControlPoints->Last(); - wxRealPoint *last_point = (wxRealPoint *)last->Data(); - -/* This is redundant, surely? Done by SetEnds. - first_point->x = end_x; first_point->y = end_y; - last_point->x = other_end_x; last_point->y = other_end_y; -*/ - - float oldX = m_xpos; - float oldY = m_ypos; - - SetEnds(end_x, end_y, other_end_x, other_end_y); - - // Do a second time, because one may depend on the other. - FindLineEndPoints(&end_x, &end_y, &other_end_x, &other_end_y); - SetEnds(end_x, end_y, other_end_x, other_end_y); - - // Try to move control points with the arc - float x_offset = m_xpos - oldX; - float y_offset = m_ypos - oldY; - -// if (moveControlPoints && m_lineControlPoints && !(x_offset == 0.0 && y_offset == 0.0)) - // Only move control points if it's a self link. And only works if attachment mode is ON. - if ((m_from == m_to) && m_from->GetAttachmentMode() && moveControlPoints && m_lineControlPoints && !(x_offset == 0.0 && y_offset == 0.0)) - { - wxNode *node = m_lineControlPoints->First(); - while (node) - { - if ((node != m_lineControlPoints->First()) && (node != m_lineControlPoints->Last())) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - point->x += x_offset; - point->y += y_offset; - } - node = node->Next(); - } - } - - Move(dc, m_xpos, m_ypos); -} - -// Finds the x, y points at the two ends of the line. -// This function can be used by e.g. line-routing routines to -// get the actual points on the two node images where the lines will be drawn -// to/from. -void wxLineShape::FindLineEndPoints(float *fromX, float *fromY, float *toX, float *toY) -{ - if (!m_from || !m_to) - return; - - // Do each end - nothing in the middle. User has to move other points - // manually if necessary. - float end_x, end_y; - float other_end_x, other_end_y; - - wxNode *first = m_lineControlPoints->First(); - wxRealPoint *first_point = (wxRealPoint *)first->Data(); - wxNode *last = m_lineControlPoints->Last(); - wxRealPoint *last_point = (wxRealPoint *)last->Data(); - - wxNode *second = first->Next(); - wxRealPoint *second_point = (wxRealPoint *)second->Data(); - - wxNode *second_last = last->Previous(); - wxRealPoint *second_last_point = (wxRealPoint *)second_last->Data(); - - if (m_lineControlPoints->Number() > 2) - { - if (m_from->GetAttachmentMode()) - { - int nth, no_arcs; - FindNth(m_from, &nth, &no_arcs, FALSE); // Not incoming - m_from->GetAttachmentPosition(m_attachmentFrom, &end_x, &end_y, nth, no_arcs, this); - } - else - (void) m_from->GetPerimeterPoint(m_from->GetX(), m_from->GetY(), - (float)second_point->x, (float)second_point->y, - &end_x, &end_y); - - if (m_to->GetAttachmentMode()) - { - int nth, no_arcs; - FindNth(m_to, &nth, &no_arcs, TRUE); // Incoming - m_to->GetAttachmentPosition(m_attachmentTo, &other_end_x, &other_end_y, nth, no_arcs, this); - } - else - (void) m_to->GetPerimeterPoint(m_to->GetX(), m_to->GetY(), - (float)second_last_point->x, (float)second_last_point->y, - &other_end_x, &other_end_y); - } - else - { - float fromX = m_from->GetX(); - float fromY = m_from->GetY(); - float toX = m_to->GetX(); - float toY = m_to->GetY(); - - if (m_from->GetAttachmentMode()) - { - int nth, no_arcs; - FindNth(m_from, &nth, &no_arcs, FALSE); - m_from->GetAttachmentPosition(m_attachmentFrom, &end_x, &end_y, nth, no_arcs, this); - fromX = end_x; - fromY = end_y; - } - - if (m_to->GetAttachmentMode()) - { - int nth, no_arcs; - FindNth(m_to, &nth, &no_arcs, TRUE); - m_to->GetAttachmentPosition(m_attachmentTo, &other_end_x, &other_end_y, nth, no_arcs, this); - toX = other_end_x; - toY = other_end_y; - } - - if (!m_from->GetAttachmentMode()) - (void) m_from->GetPerimeterPoint(m_from->GetX(), m_from->GetY(), - toX, toY, - &end_x, &end_y); - - if (!m_to->GetAttachmentMode()) - (void) m_to->GetPerimeterPoint(m_to->GetX(), m_to->GetY(), - fromX, fromY, - &other_end_x, &other_end_y); - } - *fromX = end_x; - *fromY = end_y; - *toX = other_end_x; - *toY = other_end_y; -} - -void wxLineShape::OnDraw(wxDC& dc) -{ - if (m_lineControlPoints) - { - if (m_pen) - dc.SetPen(m_pen); - if (m_brush) - dc.SetBrush(m_brush); - - int n = m_lineControlPoints->Number(); - wxPoint *points = new wxPoint[n]; - int i; - for (i = 0; i < n; i++) - { - wxRealPoint* point = (wxRealPoint*) m_lineControlPoints->Nth(i)->Data(); - points[i].x = (int) point->x; - points[i].y = (int) point->y; - } - - if (m_isSpline) - dc.DrawSpline(n, points); - else - dc.DrawLines(n, points); - - delete[] points; - - // Problem with pen - if not a solid pen, does strange things - // to the arrowhead. So make (get) a new pen that's solid. - if (m_pen && (m_pen->GetStyle() != wxSOLID)) - { - wxPen *solid_pen = - wxThePenList->FindOrCreatePen(m_pen->GetColour(), 1, wxSOLID); - if (solid_pen) - dc.SetPen(solid_pen); - } - DrawArrows(dc); - } -} - -void wxLineShape::OnDrawControlPoints(wxDC& dc) -{ - if (!m_drawHandles) - return; - - // Draw temporary label rectangles if necessary - for (int i = 0; i < 3; i++) - { - if (m_labelObjects[i]) - m_labelObjects[i]->Draw(dc); - } - wxShape::OnDrawControlPoints(dc); -} - -void wxLineShape::OnEraseControlPoints(wxDC& dc) -{ - // Erase temporary label rectangles if necessary - for (int i = 0; i < 3; i++) - { - if (m_labelObjects[i]) - m_labelObjects[i]->Erase(dc); - } - wxShape::OnEraseControlPoints(dc); -} - -void wxLineShape::OnDragLeft(bool draw, float x, float y, int keys, int attachment) -{ -} - -void wxLineShape::OnBeginDragLeft(float x, float y, int keys, int attachment) -{ -} - -void wxLineShape::OnEndDragLeft(float x, float y, int keys, int attachment) -{ -} - -/* -void wxLineShape::SetArrowSize(float length, float width) -{ - arrow_length = length; - arrow_width = width; -} - -void wxLineShape::SetStartArrow(int style) -{ - start_style = style; -} - -void wxLineShape::SetMiddleArrow(int style) -{ - middle_style = style; -} - -void wxLineShape::SetEndArrow(int style) -{ - end_style = style; -} -*/ - -void wxLineShape::OnDrawContents(wxDC& dc) -{ - if (GetDisableLabel()) - return; - - for (int i = 0; i < 3; i++) - { - wxNode *node = m_regions.Nth(i); - if (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - float x, y; - GetLabelPosition(i, &x, &y); - DrawRegion(dc, region, x, y); - } - } -} - - -#ifdef PROLOGIO -char *wxLineShape::GetFunctor() -{ - return "arc_image"; -} -#endif - -void wxLineShape::SetTo(wxShape *object) -{ - m_to = object; -} - -void wxLineShape::SetFrom(wxShape *object) -{ - m_from = object; -} - -void wxLineShape::MakeControlPoints() -{ - if (m_canvas && m_lineControlPoints) - { - wxNode *first = m_lineControlPoints->First(); - wxNode *last = m_lineControlPoints->Last(); - wxRealPoint *first_point = (wxRealPoint *)first->Data(); - wxRealPoint *last_point = (wxRealPoint *)last->Data(); - - wxLineControlPoint *control = new wxLineControlPoint(m_canvas, this, CONTROL_POINT_SIZE, - first_point->x, first_point->y, - CONTROL_POINT_ENDPOINT_FROM); - control->m_point = first_point; - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - - wxNode *node = first->Next(); - while (node != last) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - - control = new wxLineControlPoint(m_canvas, this, CONTROL_POINT_SIZE, - point->x, point->y, - CONTROL_POINT_LINE); - control->m_point = point; - - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - node = node->Next(); - } - control = new wxLineControlPoint(m_canvas, this, CONTROL_POINT_SIZE, - last_point->x, last_point->y, - CONTROL_POINT_ENDPOINT_TO); - control->m_point = last_point; - m_canvas->AddShape(control); - m_controlPoints.Append(control); - - } - -} - -void wxLineShape::ResetControlPoints() -{ - if (m_canvas && m_lineControlPoints && m_controlPoints.Number() > 0) - { - wxNode *node = m_controlPoints.First(); - wxNode *control_node = m_lineControlPoints->First(); - while (node && control_node) - { - wxRealPoint *point = (wxRealPoint *)control_node->Data(); - wxLineControlPoint *control = (wxLineControlPoint *)node->Data(); - control->SetX(point->x); - control->SetY(point->y); - - node = node->Next(); - control_node = control_node->Next(); - } - } -} - -#ifdef PROLOGIO -void wxLineShape::WritePrologAttributes(wxExpr *clause) -{ - wxShape::WritePrologAttributes(clause); - - if (m_from) - clause->AddAttributeValue("from", m_from->GetId()); - if (m_to) - clause->AddAttributeValue("to", m_to->GetId()); - - if (m_attachmentTo != 0) - clause->AddAttributeValue("attachment_to", (long)m_attachmentTo); - if (m_attachmentFrom != 0) - clause->AddAttributeValue("attachment_from", (long)m_attachmentFrom); - - if (m_alignmentStart != 0) - clause->AddAttributeValue("align_start", (long)m_alignmentStart); - if (m_alignmentEnd != 0) - clause->AddAttributeValue("align_end", (long)m_alignmentEnd); - - clause->AddAttributeValue("is_spline", (long)m_isSpline); - if (m_maintainStraightLines) - clause->AddAttributeValue("keep_lines_straight", (long)m_maintainStraightLines); - - // Make a list of lists for the (sp)line controls - wxExpr *list = new wxExpr(PrologList); - wxNode *node = m_lineControlPoints->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxExpr *point_list = new wxExpr(PrologList); - wxExpr *x_expr = new wxExpr((float) point->x); - wxExpr *y_expr = new wxExpr((float) point->y); - point_list->Append(x_expr); - point_list->Append(y_expr); - list->Append(point_list); - - node = node->Next(); - } - clause->AddAttributeValue("controls", list); - - // Write arc arrows in new OGL format, if there are any. - // This is a list of lists. Each sublist comprises: - // (arrowType arrowEnd xOffset arrowSize) - if (m_arcArrows.Number() > 0) - { - wxExpr *arrow_list = new wxExpr(PrologList); - node = m_arcArrows.First(); - while (node) - { - wxArrowHead *head = (wxArrowHead *)node->Data(); - wxExpr *head_list = new wxExpr(PrologList); - head_list->Append(new wxExpr((long)head->_GetType())); - head_list->Append(new wxExpr((long)head->GetArrowEnd())); - head_list->Append(new wxExpr(head->GetXOffset())); - head_list->Append(new wxExpr(head->GetArrowSize())); - head_list->Append(new wxExpr(PrologString, (head->GetName() ? head->GetName() : ""))); - head_list->Append(new wxExpr(head->GetId())); - - // New members of wxArrowHead - head_list->Append(new wxExpr(head->GetYOffset())); - head_list->Append(new wxExpr(head->GetSpacing())); - - arrow_list->Append(head_list); - - node = node->Next(); - } - clause->AddAttributeValue("arrows", arrow_list); - } -} - -void wxLineShape::ReadPrologAttributes(wxExpr *clause) -{ - wxShape::ReadPrologAttributes(clause); - - int iVal = (int) m_isSpline; - clause->AssignAttributeValue("is_spline", &iVal); - m_isSpline = (iVal != 0); - - iVal = (int) m_maintainStraightLines; - clause->AssignAttributeValue("keep_lines_straight", &iVal); - m_maintainStraightLines = (iVal != 0); - - clause->AssignAttributeValue("align_start", &m_alignmentStart); - clause->AssignAttributeValue("align_end", &m_alignmentEnd); - - // Compatibility: check for no regions. - if (m_regions.Number() == 0) - { - wxShapeRegion *newRegion = new wxShapeRegion; - newRegion->SetName("Middle"); - newRegion->SetSize(150, 50); - m_regions.Append((wxObject *)newRegion); - if (m_text.Number() > 0) - { - newRegion->ClearText(); - wxNode *node = m_text.First(); - while (node) - { - wxShapeTextLine *textLine = (wxShapeTextLine *)node->Data(); - wxNode *next = node->Next(); - newRegion->GetFormattedText().Append((wxObject *)textLine); - delete node; - node = next; - } - } - - newRegion = new wxShapeRegion; - newRegion->SetName("Start"); - newRegion->SetSize(150, 50); - m_regions.Append((wxObject *)newRegion); - - newRegion = new wxShapeRegion; - newRegion->SetName("End"); - newRegion->SetSize(150, 50); - m_regions.Append((wxObject *)newRegion); - } - - m_attachmentTo = 0; - m_attachmentFrom = 0; - - clause->AssignAttributeValue("attachment_to", &m_attachmentTo); - clause->AssignAttributeValue("attachmen_from", &m_attachmentFrom); - - wxExpr *line_list = NULL; - - // When image is created, there are default control points. Override - // them if there are some in the file. - clause->AssignAttributeValue("controls", &line_list); - - if (line_list) - { - // Read a list of lists for the spline controls - if (m_lineControlPoints) - { - ClearPointList(*m_lineControlPoints); - } - else - m_lineControlPoints = new wxList; - - wxExpr *node = line_list->value.first; - - while (node) - { - wxExpr *xexpr = node->value.first; - float x = xexpr->RealValue(); - - wxExpr *yexpr = xexpr->next; - float y = yexpr->RealValue(); - - wxRealPoint *point = new wxRealPoint(x, y); - m_lineControlPoints->Append((wxObject*) point); - - node = node->next; - } - } - - // Read arrow list, for new OGL code - wxExpr *arrow_list = NULL; - - clause->AssignAttributeValue("arrows", &arrow_list); - if (arrow_list) - { - wxExpr *node = arrow_list->value.first; - - while (node) - { - WXTYPE arrowType = ARROW_ARROW; - int arrowEnd = 0; - float xOffset = 0.0; - float arrowSize = 0.0; - wxString arrowName(""); - long arrowId = -1; - - wxExpr *type_expr = node->Nth(0); - wxExpr *end_expr = node->Nth(1); - wxExpr *dist_expr = node->Nth(2); - wxExpr *size_expr = node->Nth(3); - wxExpr *name_expr = node->Nth(4); - wxExpr *id_expr = node->Nth(5); - - // New members of wxArrowHead - wxExpr *yOffsetExpr = node->Nth(6); - wxExpr *spacingExpr = node->Nth(7); - - if (type_expr) - arrowType = (int)type_expr->IntegerValue(); - if (end_expr) - arrowEnd = (int)end_expr->IntegerValue(); - if (dist_expr) - xOffset = dist_expr->RealValue(); - if (size_expr) - arrowSize = size_expr->RealValue(); - if (name_expr) - arrowName = name_expr->StringValue(); - if (id_expr) - arrowId = id_expr->IntegerValue(); - - if (arrowId == -1) - arrowId = NewId(); - else - RegisterId(arrowId); - - wxArrowHead *arrowHead = AddArrow(arrowType, arrowEnd, arrowSize, xOffset, (char*) (const char*) arrowName, NULL, arrowId); - if (yOffsetExpr) - arrowHead->SetYOffset(yOffsetExpr->RealValue()); - if (spacingExpr) - arrowHead->SetSpacing(spacingExpr->RealValue()); - - node = node->next; - } - } -} -#endif - -void wxLineShape::Copy(wxLineShape& copy) -{ - wxShape::Copy(copy); - - copy.m_isSpline = m_isSpline; - copy.m_alignmentStart = m_alignmentStart; - copy.m_alignmentEnd = m_alignmentEnd; - copy.m_maintainStraightLines = m_maintainStraightLines; - copy.m_lineOrientations.Clear(); - wxNode *node = m_lineOrientations.First(); - while (node) - { - copy.m_lineOrientations.Append(node->Data()); - node = node->Next(); - } - - if (copy.m_lineControlPoints) - { - ClearPointList(*copy.m_lineControlPoints); - delete copy.m_lineControlPoints; - } - - copy.m_lineControlPoints = new wxList; - - node = m_lineControlPoints->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - wxRealPoint *new_point = new wxRealPoint(point->x, point->y); - copy.m_lineControlPoints->Append((wxObject*) new_point); - node = node->Next(); - } - -/* - copy.start_style = start_style; - copy.end_style = end_style; - copy.middle_style = middle_style; - - copy.arrow_length = arrow_length; - copy.arrow_width = arrow_width; -*/ - - // Copy new OGL stuff - copy.ClearArrowsAtPosition(-1); - node = m_arcArrows.First(); - while (node) - { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); - copy.m_arcArrows.Append(new wxArrowHead(*arrow)); - node = node->Next(); - } -} - -wxShape *wxLineShape::PrivateCopy() -{ - wxLineShape *line = new wxLineShape; - Copy(*line); - return line; -} - -// Override select, to create/delete temporary label-moving objects -void wxLineShape::Select(bool select, wxDC* dc) -{ - wxShape::Select(select); - if (select) - { - for (int i = 0; i < 3; i++) - { - wxNode *node = m_regions.Nth(i); - if (node) - { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - if (region->m_formattedText.Number() > 0) - { - float w, h, x, y, xx, yy; - region->GetSize(&w, &h); - region->GetPosition(&x, &y); - GetLabelPosition(i, &xx, &yy); - if (m_labelObjects[i]) - { - m_labelObjects[i]->Select(FALSE); - m_labelObjects[i]->RemoveFromCanvas(m_canvas); - delete m_labelObjects[i]; - } - m_labelObjects[i] = new wxLabelShape(this, region, w, h); - m_labelObjects[i]->AddToCanvas(m_canvas); - m_labelObjects[i]->Show(TRUE); - if (dc) - m_labelObjects[i]->Move(*dc, (float)(x + xx), (float)(y + yy)); - m_labelObjects[i]->Select(TRUE); - } - } - } - } - else - { - for (int i = 0; i < 3; i++) - { - if (m_labelObjects[i]) - { - m_labelObjects[i]->Select(FALSE, dc); - m_labelObjects[i]->RemoveFromCanvas(m_canvas); - delete m_labelObjects[i]; - m_labelObjects[i] = NULL; - } - } - } -} - -/* - * Line control point - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxLineControlPoint, wxControlPoint) - -wxLineControlPoint::wxLineControlPoint(wxShapeCanvas *theCanvas, wxShape *object, float size, float x, float y, int the_type): - wxControlPoint(theCanvas, object, size, x, y, the_type) -{ - m_xpos = x; - m_ypos = y; - m_type = the_type; -} - -wxLineControlPoint::~wxLineControlPoint() -{ -} - -void wxLineControlPoint::OnDraw(wxDC& dc) -{ - wxRectangleShape::OnDraw(dc); -} - -// Implement movement of Line point -void wxLineControlPoint::OnDragLeft(bool draw, float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - dc.SetLogicalFunction(wxXOR); - - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush((* wxTRANSPARENT_BRUSH)); - - if (m_type == CONTROL_POINT_LINE) - { - m_canvas->Snap(&x, &y); - - m_xpos = x; m_ypos = y; - m_point->x = x; m_point->y = y; - - wxLineShape *lineShape = (wxLineShape *)m_shape; - - wxPen *old_pen = lineShape->GetPen(); - wxBrush *old_brush = lineShape->GetBrush(); - - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - lineShape->SetPen(& dottedPen); - lineShape->SetBrush(wxTRANSPARENT_BRUSH); - - lineShape->GetEventHandler()->OnMoveLink(dc, FALSE); - - lineShape->SetPen(old_pen); - lineShape->SetBrush(old_brush); - } - - if (m_type == CONTROL_POINT_ENDPOINT_FROM || m_type == CONTROL_POINT_ENDPOINT_TO) - { - m_xpos = x; m_ypos = y; - } - -} - -void wxLineControlPoint::OnBeginDragLeft(float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - wxLineShape *lineShape = (wxLineShape *)m_shape; - if (m_type == CONTROL_POINT_LINE) - { - m_canvas->Snap(&x, &y); - - m_shape->Erase(dc); - - // Redraw start and end objects because we've left holes - // when erasing the line - lineShape->GetFrom()->OnDraw(dc); - lineShape->GetFrom()->OnDrawContents(dc); - lineShape->GetTo()->OnDraw(dc); - lineShape->GetTo()->OnDrawContents(dc); - - m_shape->SetDisableLabel(TRUE); - dc.SetLogicalFunction(wxXOR); - - m_xpos = x; m_ypos = y; - m_point->x = x; m_point->y = y; - - wxPen *old_pen = lineShape->GetPen(); - wxBrush *old_brush = lineShape->GetBrush(); - - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - lineShape->SetPen(& dottedPen); - lineShape->SetBrush(wxTRANSPARENT_BRUSH); - - lineShape->GetEventHandler()->OnMoveLink(dc, FALSE); - - lineShape->SetPen(old_pen); - lineShape->SetBrush(old_brush); - } - - if (m_type == CONTROL_POINT_ENDPOINT_FROM || m_type == CONTROL_POINT_ENDPOINT_TO) - { - Erase(dc); - lineShape->OnDraw(dc); - if (m_type == CONTROL_POINT_ENDPOINT_FROM) - { - lineShape->GetFrom()->OnDraw(dc); - lineShape->GetFrom()->OnDrawContents(dc); - } - else - { - lineShape->GetTo()->OnDraw(dc); - lineShape->GetTo()->OnDrawContents(dc); - } - m_canvas->SetCursor(GraphicsBullseyeCursor); - m_oldCursor = wxSTANDARD_CURSOR; - } -} - -void wxLineControlPoint::OnEndDragLeft(float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - m_shape->SetDisableLabel(FALSE); - wxLineShape *lineShape = (wxLineShape *)m_shape; - - if (m_type == CONTROL_POINT_LINE) - { - m_canvas->Snap(&x, &y); - - dc.SetLogicalFunction(wxCOPY); - m_xpos = x; m_ypos = y; - m_point->x = x; m_point->y = y; - - lineShape->GetEventHandler()->OnMoveLink(dc); - } - if (m_type == CONTROL_POINT_ENDPOINT_FROM) - { - if (m_oldCursor) - m_canvas->SetCursor(m_oldCursor); - m_shape->Erase(dc); - - m_xpos = x; m_ypos = y; - - if (lineShape->GetFrom()) - { - lineShape->GetFrom()->MoveLineToNewAttachment(dc, lineShape, x, y); - lineShape->GetFrom()->MoveLinks(dc); - } - } - if (m_type == CONTROL_POINT_ENDPOINT_TO) - { - if (m_oldCursor) - m_canvas->SetCursor(m_oldCursor); - - m_xpos = x; m_ypos = y; - - if (lineShape->GetTo()) - { - lineShape->GetTo()->MoveLineToNewAttachment(dc, lineShape, x, y); - lineShape->GetTo()->MoveLinks(dc); - } - } - int i = 0; - for (i = 0; i < lineShape->GetLineControlPoints()->Number(); i++) - if (((wxRealPoint *)(lineShape->GetLineControlPoints()->Nth(i)->Data())) == m_point) - break; - - // N.B. in OnMoveControlPoint, an event handler in Hardy could have deselected - // the line and therefore deleted 'this'. -> GPF, intermittently. - // So assume at this point that we've been blown away. - wxLineShape *lineObj = lineShape; - wxShapeCanvas *objCanvas = m_canvas; - - lineObj->OnMoveControlPoint(i+1, x, y); - - if (!objCanvas->GetQuickEditMode()) objCanvas->Redraw(dc); -} - -// Implement movement of endpoint to a new attachment -void wxLineControlPoint::OnDragRight(bool draw, float x, float y, int keys, int attachment) -{ - if (m_type == CONTROL_POINT_ENDPOINT_FROM || m_type == CONTROL_POINT_ENDPOINT_TO) - { - m_xpos = x; m_ypos = y; - } -} - -void wxLineControlPoint::OnBeginDragRight(float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - wxLineShape *lineShape = (wxLineShape *)m_shape; - if (m_type == CONTROL_POINT_ENDPOINT_FROM || m_type == CONTROL_POINT_ENDPOINT_TO) - { - Erase(dc); - lineShape->GetEventHandler()->OnDraw(dc); - if (m_type == CONTROL_POINT_ENDPOINT_FROM) - { - lineShape->GetFrom()->GetEventHandler()->OnDraw(dc); - lineShape->GetFrom()->GetEventHandler()->OnDrawContents(dc); - } - else - { - lineShape->GetTo()->GetEventHandler()->OnDraw(dc); - lineShape->GetTo()->GetEventHandler()->OnDrawContents(dc); - } - m_canvas->SetCursor(GraphicsBullseyeCursor); - m_oldCursor = wxSTANDARD_CURSOR; - } -} - -void wxLineControlPoint::OnEndDragRight(float x, float y, int keys, int attachment) -{ - wxClientDC dc(GetCanvas()); - GetCanvas()->PrepareDC(dc); - - wxLineShape *lineShape = (wxLineShape *)m_shape; - if (m_type == CONTROL_POINT_ENDPOINT_FROM) - { - if (m_oldCursor) - m_canvas->SetCursor(m_oldCursor); - - m_xpos = x; m_ypos = y; - - if (lineShape->GetFrom()) - { - lineShape->GetFrom()->EraseLinks(dc); - - int new_attachment; - float distance; - - if (lineShape->GetFrom()->HitTest(x, y, &new_attachment, &distance)) - lineShape->SetAttachments(new_attachment, lineShape->GetAttachmentTo()); - - lineShape->GetFrom()->MoveLinks(dc); - } - } - if (m_type == CONTROL_POINT_ENDPOINT_TO) - { - if (m_oldCursor) - m_canvas->SetCursor(m_oldCursor); - m_shape->Erase(dc); - - m_xpos = x; m_ypos = y; - - if (lineShape->GetTo()) - { - lineShape->GetTo()->EraseLinks(dc); - - int new_attachment; - float distance; - if (lineShape->GetTo()->HitTest(x, y, &new_attachment, &distance)) - lineShape->SetAttachments(lineShape->GetAttachmentFrom(), new_attachment); - - lineShape->GetTo()->MoveLinks(dc); - } - } - int i = 0; - for (i = 0; i < lineShape->GetLineControlPoints()->Number(); i++) - if (((wxRealPoint *)(lineShape->GetLineControlPoints()->Nth(i)->Data())) == m_point) - break; - lineShape->OnMoveControlPoint(i+1, x, y); - if (!m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc); -} - -/* - * Get the point on the given line (x1, y1) (x2, y2) - * distance 'length' along from the end, - * returned values in x and y - */ - -void GetPointOnLine(float x1, float y1, float x2, float y2, - float length, float *x, float *y) -{ - float l = (float)sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)); - - if (l < 0.01) - l = (float) 0.01; - - float i_bar = (x2 - x1)/l; - float j_bar = (y2 - y1)/l; - - *x = (- length*i_bar) + x2; - *y = (- length*j_bar) + y2; -} - -wxArrowHead *wxLineShape::AddArrow(WXTYPE type, int end, float size, float xOffset, - const wxString& name, wxPseudoMetaFile *mf, long arrowId) -{ - wxArrowHead *arrow = new wxArrowHead(type, end, size, xOffset, name, mf, arrowId); - m_arcArrows.Append(arrow); - return arrow; -} - -/* - * Add arrowhead at a particular position in the arrowhead list. - */ -bool wxLineShape::AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int end) -{ - wxNode *refNode = referenceList.First(); - wxNode *currNode = m_arcArrows.First(); - wxString targetName(arrow->GetName()); - if (!refNode) return FALSE; - - // First check whether we need to insert in front of list, - // because this arrowhead is the first in the reference - // list and should therefore be first in the current list. - wxArrowHead *refArrow = (wxArrowHead *)refNode->Data(); - if (refArrow->GetName() == targetName) - { - m_arcArrows.Insert(arrow); - return TRUE; - } - - while (refNode && currNode) - { - wxArrowHead *currArrow = (wxArrowHead *)currNode->Data(); - refArrow = (wxArrowHead *)refNode->Data(); - - // Matching: advance current arrow pointer - if ((currArrow->GetArrowEnd() == end) && - (currArrow->GetName() == refArrow->GetName())) - { - currNode = currNode->Next(); // Could be NULL now - if (currNode) - currArrow = (wxArrowHead *)currNode->Data(); - } - - // Check if we're at the correct position in the - // reference list - if (targetName == refArrow->GetName()) - { - if (currNode) - m_arcArrows.Insert(currNode, arrow); - else - m_arcArrows.Append(arrow); - return TRUE; - } - refNode = refNode->Next(); - } - m_arcArrows.Append(arrow); - return TRUE; -} - -void wxLineShape::ClearArrowsAtPosition(int end) -{ - wxNode *node = m_arcArrows.First(); - while (node) - { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); - wxNode *next = node->Next(); - switch (end) - { - case -1: - { - delete arrow; - delete node; - break; - } - case ARROW_POSITION_START: - { - if (arrow->GetArrowEnd() == ARROW_POSITION_START) - { - delete arrow; - delete node; - } - break; - } - case ARROW_POSITION_END: - { - if (arrow->GetArrowEnd() == ARROW_POSITION_END) - { - delete arrow; - delete node; - } - break; - } - case ARROW_POSITION_MIDDLE: - { - if (arrow->GetArrowEnd() == ARROW_POSITION_MIDDLE) - { - delete arrow; - delete node; - } - break; - } - } - node = next; - } -} - -bool wxLineShape::ClearArrow(const wxString& name) -{ - wxNode *node = m_arcArrows.First(); - while (node) - { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); - if (arrow->GetName() == name) - { - delete arrow; - delete node; - return TRUE; - } - node = node->Next(); - } - return FALSE; -} - -/* - * Finds an arrowhead at the given position (if -1, any position) - * - */ - -wxArrowHead *wxLineShape::FindArrowHead(int position, const wxString& name) -{ - wxNode *node = m_arcArrows.First(); - while (node) - { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); - if (((position == -1) || (position == arrow->GetArrowEnd())) && - (arrow->GetName() == name)) - return arrow; - node = node->Next(); - } - return NULL; -} - -wxArrowHead *wxLineShape::FindArrowHead(long arrowId) -{ - wxNode *node = m_arcArrows.First(); - while (node) - { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); - if (arrowId == arrow->GetId()) - return arrow; - node = node->Next(); - } - return NULL; -} - -/* - * Deletes an arrowhead at the given position (if -1, any position) - * - */ - -bool wxLineShape::DeleteArrowHead(int position, const wxString& name) -{ - wxNode *node = m_arcArrows.First(); - while (node) - { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); - if (((position == -1) || (position == arrow->GetArrowEnd())) && - (arrow->GetName() == name)) - { - delete arrow; - delete node; - return TRUE; - } - node = node->Next(); - } - return FALSE; -} - -// Overloaded DeleteArrowHead: pass arrowhead id. -bool wxLineShape::DeleteArrowHead(long id) -{ - wxNode *node = m_arcArrows.First(); - while (node) - { - wxArrowHead *arrow = (wxArrowHead *)node->Data(); - if (arrow->GetId() == id) - { - delete arrow; - delete node; - return TRUE; - } - node = node->Next(); - } - return FALSE; -} - -/* - * Calculate the minimum width a line - * occupies, for the purposes of drawing lines in tools. - * - */ - -float wxLineShape::FindMinimumWidth() -{ - float minWidth = 0.0; - wxNode *node = m_arcArrows.First(); - while (node) - { - wxArrowHead *arrowHead = (wxArrowHead *)node->Data(); - minWidth += arrowHead->GetSize(); - if (node->Next()) - minWidth += arrowHead->GetSpacing(); - - node = node->Next(); - } - // We have ABSOLUTE minimum now. So - // scale it to give it reasonable aesthetics - // when drawing with line. - if (minWidth > 0.0) - minWidth = (float)(minWidth * 1.4); - else - minWidth = 20.0; - - SetEnds(0.0, 0.0, minWidth, 0.0); - Initialise(); - - return minWidth; -} - -// Find which position we're talking about at this (x, y). -// Returns ARROW_POSITION_START, ARROW_POSITION_MIDDLE, ARROW_POSITION_END -int wxLineShape::FindLinePosition(float x, float y) -{ - float startX, startY, endX, endY; - GetEnds(&startX, &startY, &endX, &endY); - - // Find distances from centre, start and end. The smallest wins. - float centreDistance = (float)(sqrt((x - m_xpos)*(x - m_xpos) + (y - m_ypos)*(y - m_ypos))); - float startDistance = (float)(sqrt((x - startX)*(x - startX) + (y - startY)*(y - startY))); - float endDistance = (float)(sqrt((x - endX)*(x - endX) + (y - endY)*(y - endY))); - - if (centreDistance < startDistance && centreDistance < endDistance) - return ARROW_POSITION_MIDDLE; - else if (startDistance < endDistance) - return ARROW_POSITION_START; - else - return ARROW_POSITION_END; -} - -// Set alignment flags -void wxLineShape::SetAlignmentOrientation(bool isEnd, bool isHoriz) -{ - if (isEnd) - { - if (isHoriz && ((m_alignmentEnd & LINE_ALIGNMENT_HORIZ) != LINE_ALIGNMENT_HORIZ)) - m_alignmentEnd |= LINE_ALIGNMENT_HORIZ; - else if (!isHoriz && ((m_alignmentEnd & LINE_ALIGNMENT_HORIZ) == LINE_ALIGNMENT_HORIZ)) - m_alignmentEnd -= LINE_ALIGNMENT_HORIZ; - } - else - { - if (isHoriz && ((m_alignmentStart & LINE_ALIGNMENT_HORIZ) != LINE_ALIGNMENT_HORIZ)) - m_alignmentStart |= LINE_ALIGNMENT_HORIZ; - else if (!isHoriz && ((m_alignmentStart & LINE_ALIGNMENT_HORIZ) == LINE_ALIGNMENT_HORIZ)) - m_alignmentStart -= LINE_ALIGNMENT_HORIZ; - } -} - -void wxLineShape::SetAlignmentType(bool isEnd, int alignType) -{ - if (isEnd) - { - if (alignType == LINE_ALIGNMENT_TO_NEXT_HANDLE) - { - if ((m_alignmentEnd & LINE_ALIGNMENT_TO_NEXT_HANDLE) != LINE_ALIGNMENT_TO_NEXT_HANDLE) - m_alignmentEnd |= LINE_ALIGNMENT_TO_NEXT_HANDLE; - } - else if ((m_alignmentEnd & LINE_ALIGNMENT_TO_NEXT_HANDLE) == LINE_ALIGNMENT_TO_NEXT_HANDLE) - m_alignmentEnd -= LINE_ALIGNMENT_TO_NEXT_HANDLE; - } - else - { - if (alignType == LINE_ALIGNMENT_TO_NEXT_HANDLE) - { - if ((m_alignmentStart & LINE_ALIGNMENT_TO_NEXT_HANDLE) != LINE_ALIGNMENT_TO_NEXT_HANDLE) - m_alignmentStart |= LINE_ALIGNMENT_TO_NEXT_HANDLE; - } - else if ((m_alignmentStart & LINE_ALIGNMENT_TO_NEXT_HANDLE) == LINE_ALIGNMENT_TO_NEXT_HANDLE) - m_alignmentStart -= LINE_ALIGNMENT_TO_NEXT_HANDLE; - } -} - -bool wxLineShape::GetAlignmentOrientation(bool isEnd) -{ - if (isEnd) - return ((m_alignmentEnd & LINE_ALIGNMENT_HORIZ) == LINE_ALIGNMENT_HORIZ); - else - return ((m_alignmentStart & LINE_ALIGNMENT_HORIZ) == LINE_ALIGNMENT_HORIZ); -} - -int wxLineShape::GetAlignmentType(bool isEnd) -{ - if (isEnd) - return (m_alignmentEnd & LINE_ALIGNMENT_TO_NEXT_HANDLE); - else - return (m_alignmentStart & LINE_ALIGNMENT_TO_NEXT_HANDLE); -} - -wxRealPoint *wxLineShape::GetNextControlPoint(wxShape *nodeObject) -{ - int n = m_lineControlPoints->Number(); - int nn = 0; - if (m_to == nodeObject) - { - // Must be END of line, so we want (n - 1)th control point. - // But indexing ends at n-1, so subtract 2. - nn = n - 2; - } - else nn = 1; - wxNode *node = m_lineControlPoints->Nth(nn); - if (node) - { - return (wxRealPoint *)node->Data(); - } - else - return FALSE; -} - -/* - * Arrowhead - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxArrowHead, wxObject) - -wxArrowHead::wxArrowHead(WXTYPE type, int end, float size, float dist, const wxString& name, - wxPseudoMetaFile *mf, long arrowId) -{ - m_arrowType = type; m_arrowEnd = end; m_arrowSize = size; - m_xOffset = dist; - m_yOffset = 0.0; - m_spacing = 5.0; - - m_arrowName = name; - m_metaFile = mf; - m_id = arrowId; - if (m_id == -1) - m_id = NewId(); -} - -wxArrowHead::wxArrowHead(wxArrowHead& toCopy) -{ - m_arrowType = toCopy.m_arrowType; m_arrowEnd = toCopy.GetArrowEnd(); - m_arrowSize = toCopy.m_arrowSize; - m_xOffset = toCopy.m_xOffset; - m_yOffset = toCopy.m_yOffset; - m_spacing = toCopy.m_spacing; - m_arrowName = toCopy.m_arrowName ; - if (toCopy.m_metaFile) - m_metaFile = new wxPseudoMetaFile(*(toCopy.m_metaFile)); - else - m_metaFile = NULL; - m_id = NewId(); -} - -wxArrowHead::~wxArrowHead() -{ - if (m_metaFile) delete m_metaFile; -} - -void wxArrowHead::SetSize(float size) -{ - m_arrowSize = size; - if ((m_arrowType == ARROW_METAFILE) && m_metaFile) - { - float oldWidth = m_metaFile->m_width; - if (oldWidth == 0.0) - return; - - float scale = (float)(size/oldWidth); - if (scale != 1.0) - m_metaFile->Scale(scale, scale); - } -} - -/* - * Label object - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxLabelShape, wxRectangleShape) - -wxLabelShape::wxLabelShape(wxLineShape *parent, wxShapeRegion *region, float w, float h):wxRectangleShape(w, h) -{ - m_lineShape = parent; - m_shapeRegion = region; - SetPen(wxThePenList->FindOrCreatePen(wxColour(0, 0, 0), 1, wxDOT)); -} - -wxLabelShape::~wxLabelShape() -{ -} - -void wxLabelShape::OnDraw(wxDC& dc) -{ - if (m_lineShape && !m_lineShape->GetDrawHandles()) - return; - - float x1 = (float)(m_xpos - m_width/2.0); - float y1 = (float)(m_ypos - m_height/2.0); - - if (m_pen) - { - if (m_pen->GetWidth() == 0) - dc.SetPen(transparent_pen); - else - dc.SetPen(m_pen); - } - dc.SetBrush(wxTRANSPARENT_BRUSH); - - if (m_cornerRadius > 0.0) - dc.DrawRoundedRectangle(x1, y1, m_width, m_height, m_cornerRadius); - else - dc.DrawRectangle(x1, y1, m_width, m_height); -} - -void wxLabelShape::OnDrawContents(wxDC& dc) -{ -} - -void wxLabelShape::OnDragLeft(bool draw, float x, float y, int keys, int attachment) -{ - wxRectangleShape::OnDragLeft(draw, x, y, keys, attachment); -} - -void wxLabelShape::OnBeginDragLeft(float x, float y, int keys, int attachment) -{ - wxRectangleShape::OnBeginDragLeft(x, y, keys, attachment); -} - -void wxLabelShape::OnEndDragLeft(float x, float y, int keys, int attachment) -{ - wxRectangleShape::OnEndDragLeft(x, y, keys, attachment); -} - -bool wxLabelShape::OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display) -{ - m_shapeRegion->SetSize(m_width, m_height); - - // Find position in line's region list - int i = 0; - wxNode *node = m_lineShape->GetRegions().First(); - while (node) - { - if (m_shapeRegion == (wxShapeRegion *)node->Data()) - node = NULL; - else - { - node = node->Next(); - i ++; - } - } - float xx, yy; - m_lineShape->GetLabelPosition(i, &xx, &yy); - // Set the region's offset, relative to the default position for - // each region. - m_shapeRegion->SetPosition((float)(x - xx), (float)(y - yy)); - - // Need to reformat to fit region. - if (m_shapeRegion->GetText()) - { - - wxString s(m_shapeRegion->GetText()); - m_lineShape->FormatText(dc, s, i); - m_lineShape->DrawRegion(dc, m_shapeRegion, xx, yy); - } - return TRUE; -} - -// Divert left and right clicks to line object -void wxLabelShape::OnLeftClick(float x, float y, int keys, int attachment) -{ - m_lineShape->GetEventHandler()->OnLeftClick(x, y, keys, attachment); -} - -void wxLabelShape::OnRightClick(float x, float y, int keys, int attachment) -{ - m_lineShape->GetEventHandler()->OnRightClick(x, y, keys, attachment); -} - diff --git a/utils/ogl/src/lines.h b/utils/ogl/src/lines.h deleted file mode 100644 index 7adecf1246..0000000000 --- a/utils/ogl/src/lines.h +++ /dev/null @@ -1,286 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: lines.h -// Purpose: wxLineShape -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_LINES_H_ -#define _OGL_LINES_H_ - -#ifdef __GNUG__ -#pragma interface "lines.h" -#endif - -class wxLabelShape; -class wxPseudoMetaFile; -class wxLineControlPoint; -/* - * Arcs with multiple arrowheads - * - */ - -// Types of arrowhead -// (i) Built-in -#define ARROW_HOLLOW_CIRCLE 1 -#define ARROW_FILLED_CIRCLE 2 -#define ARROW_ARROW 3 -#define ARROW_SINGLE_OBLIQUE 4 -#define ARROW_DOUBLE_OBLIQUE 5 -// (ii) Custom -#define ARROW_METAFILE 20 - -// Position of arrow on line -#define ARROW_POSITION_START 0 -#define ARROW_POSITION_END 1 -#define ARROW_POSITION_MIDDLE 2 - -// Line alignment flags -// Vertical by default -#define LINE_ALIGNMENT_HORIZ 1 -#define LINE_ALIGNMENT_VERT 0 -#define LINE_ALIGNMENT_TO_NEXT_HANDLE 2 -#define LINE_ALIGNMENT_NONE 0 - -class wxArrowHead: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxArrowHead) - - public: - wxArrowHead(WXTYPE type = 0, int end = 0, float size = 0.0, float dist = 0.0, const wxString& name = "", wxPseudoMetaFile *mf = NULL, - long arrowId = -1); - ~wxArrowHead(); - wxArrowHead(wxArrowHead& toCopy); - - inline WXTYPE _GetType() const { return m_arrowType; } - inline int GetPosition() const { return m_arrowEnd; } - inline float GetXOffset() const { return m_xOffset; } - inline float GetYOffset() const { return m_yOffset; } - inline float GetSpacing() const { return m_spacing; } - inline float GetSize() const { return m_arrowSize; } - inline wxString GetName() const { return m_arrowName; } - inline void SetXOffset(float x) { m_xOffset = x; } - inline void SetYOffset(float y) { m_yOffset = y; } - inline wxPseudoMetaFile *GetMetaFile() const { return m_metaFile; } - inline long GetId() const { return m_id; } - inline int GetArrowEnd() const { return m_arrowEnd; } - inline float GetArrowSize() const { return m_arrowSize; } - void SetSize(float size); - inline void SetSpacing(float sp) { m_spacing = sp; } - - protected: - WXTYPE m_arrowType; - int m_arrowEnd; // Position on line - float m_xOffset; // Distance from arc start or end, w.r.t. point on arrowhead - // nearest start or end. If zero, use default spacing. - float m_yOffset; // vertical offset (w.r.t. a horizontal line). Normally zero. - float m_spacing; // Spacing from the last arrowhead - float m_arrowSize; // Length of arrowhead - wxString m_arrowName; // Name of arrow - bool m_saveToFile; // TRUE if we want to save custom arrowheads to file. - wxPseudoMetaFile* m_metaFile; // Pseudo metafile if this is a custom arrowhead - long m_id; // identifier -}; - -// Line object -class wxLineShape: public wxShape -{ - DECLARE_DYNAMIC_CLASS(wxLineShape) - - public: - wxLineShape(); - ~wxLineShape(); - - // Called when a connected object has moved, to move the link to - // correct position - // moveControlPoints must be disabled when a control point is being - // dragged. - void OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE); - bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE); - void OnDraw(wxDC& dc); - void OnDrawContents(wxDC& dc); - void OnDrawControlPoints(wxDC& dc); - void OnEraseControlPoints(wxDC& dc); - void OnErase(wxDC& dc); - virtual inline void OnMoveControlPoint(int WXUNUSED(which), float WXUNUSED(x), float WXUNUSED(y)) {} - void OnDrawOutline(wxDC& dc, float x, float y, float w, float h); - void GetBoundingBoxMin(float *w, float *h); - void FormatText(wxDC& dc, const wxString& s, int regionId = 0); - virtual void SetEnds(float x1, float y1, float x2, float y2); - virtual void GetEnds(float *x1, float *y1, float *x2, float *y2); - inline virtual wxShape *GetFrom() { return m_from; } - inline virtual wxShape *GetTo() { return m_to; } - inline virtual int GetAttachmentFrom() { return m_attachmentFrom; } - inline virtual int GetAttachmentTo() { return m_attachmentTo; } - - virtual void SetFrom(wxShape *object); - virtual void SetTo(wxShape *object); - virtual void DrawArrows(wxDC& dc); - - // Finds the x, y points at the two ends of the line. - // This function can be used by e.g. line-routing routines to - // get the actual points on the two node images where the lines will be drawn - // to/from. - void FindLineEndPoints(float *fromX, float *fromY, float *toX, float *toY); - - // Format one region at this position - void DrawRegion(wxDC& dc, wxShapeRegion *region, float x, float y); - - // Erase one region at this position - void EraseRegion(wxDC& dc, wxShapeRegion *region, float x, float y); - - // Get the reference point for a label. Region x and y - // are offsets from this. - // position is 0 (middle), 1 (start), 2 (end) - void GetLabelPosition(int position, float *x, float *y); - - // Straighten verticals and horizontals - virtual void Straighten(wxDC& dc); - - // Not implemented - inline void SetMaintainStraightLines(bool flag) { m_maintainStraightLines = flag; } - inline bool GetMaintainStraightLines() const { return m_maintainStraightLines; } - - // Make handle control points - void MakeControlPoints(); - void ResetControlPoints(); - - // Make a given number of control points - virtual void MakeLineControlPoints(int n); - virtual wxNode *InsertLineControlPoint(wxDC* dc); - virtual bool DeleteLineControlPoint(); - virtual void Initialise(); - inline wxList *GetLineControlPoints() { return m_lineControlPoints; } - - // Override dragging behaviour - don't want to be able to drag lines! - void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); - void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); - void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); - - // Override select, to create/delete temporary label-moving objects - void Select(bool select = TRUE, wxDC* dc = NULL); - - // Set to spline (TRUE) or line (FALSE) - inline void SetSpline(bool spl) { m_isSpline = spl; } - inline bool IsSpline() const { return m_isSpline; } - - void Unlink(); - void SetAttachments(int from_attach, int to_attach); - - bool HitTest(float x, float y, int *attachment, float *distance); - -#ifdef PROLOGIO - // Prolog database stuff - virtual char *GetFunctor(); - virtual void WritePrologAttributes(wxExpr *clause); - virtual void ReadPrologAttributes(wxExpr *clause); -#endif - - virtual void FindNth(wxShape *image, int *nth, int *no_arcs, bool incoming); - - // Find which position we're talking about at this (x, y). - // Returns ARROW_POSITION_START, ARROW_POSITION_MIDDLE, ARROW_POSITION_END - int FindLinePosition(float x, float y); - - // This is really to distinguish between lines and other images. - // For lines, want to pass drag to canvas, since lines tend to prevent - // dragging on a canvas (they get in the way.) - virtual bool Draggable() const { return FALSE; } - - // Does the copying for this object - void Copy(wxLineShape& copy); - wxShape *PrivateCopy(); - - // New OGL stuff - wxArrowHead *AddArrow(WXTYPE type, int end = ARROW_POSITION_END, - float arrowSize = 10.0, float xOffset = 0.0, const wxString& name = "", - wxPseudoMetaFile *mf = NULL, long arrowId = -1); - - // Add an arrowhead in the position indicated by the reference - // list of arrowheads, which contains all legal arrowheads for this - // line, in the correct order. - // E.g. reference list: a b c d e - // Current line list: a d - // Add c, then line list is: a c d - // If no legal arrowhead position, return FALSE. - // Assume reference list is for one end only, since it potentially defines - // the ordering for any one of the 3 positions. So we don't check - // the reference list for arrowhead position. - bool AddArrowOrdered(wxArrowHead *arrow, wxList& referenceList, int end); - - // Delete arrowhead(s) - void ClearArrowsAtPosition(int end = -1); - bool ClearArrow(const wxString& name); - wxArrowHead *FindArrowHead(int position, const wxString& name); - wxArrowHead *FindArrowHead(long arrowId); - bool DeleteArrowHead(int position, const wxString& name); - bool DeleteArrowHead(long arrowId); - void DrawArrow(wxDC& dc, wxArrowHead *arrow, float xOffset, bool proportionalOffset); - inline void SetIgnoreOffsets(bool ignore) { m_ignoreArrowOffsets = ignore; } - - // Find horizontal width for drawing a line with - // arrows in minimum space. Assume arrows at - // END only - float FindMinimumWidth(); - - // Set alignment flags. ALIGNMENT NOT IMPLEMENTED. - void SetAlignmentOrientation(bool isEnd, bool isHoriz); - void SetAlignmentType(bool isEnd, int alignType); - bool GetAlignmentOrientation(bool isEnd); - int GetAlignmentType(bool isEnd); - - // Find next control point in line after the start/end point - // (depending on whether the node object is at start or end) - wxRealPoint *GetNextControlPoint(wxShape *nodeObject); - inline bool IsEnd(wxShape *nodeObject) const { return (m_to == nodeObject); } - -private: - bool m_erasing; // flag to say whether we're erasing or drawing - // this line (really so metafiles can draw a - // blank rectangle) - bool m_ignoreArrowOffsets; // Don't always want to draw arrowhead offsets - // because they may not work on tool palettes (for example) - bool m_isSpline; - bool m_maintainStraightLines; - -protected: - // Temporary list of line segment orientations - // so we know what direction the line is supposed to be dog-legging - // in. The values are integer: 0 for vertical, 1 for horizontal. - wxList m_lineOrientations; - - // Temporary pointers for start, middle and end label editing objects - // (active only when the line is selected) - wxLabelShape* m_labelObjects[3]; - - // These define the segmented line - not to be confused with temporary control - // points which appear when object is selected (although in this case they'll - // probably be the same) - wxList* m_lineControlPoints; - - float m_arrowSpacing; // Separation between adjacent arrows - - wxShape* m_to; - wxShape* m_from; - -/* - float m_actualTextWidth; // Space the text takes up - float m_actualTextHeight; // (depends on text content unlike nodes) -*/ - int m_attachmentTo; // Attachment point at one end - int m_attachmentFrom; // Attachment point at other end - - // Alignment flags - int m_alignmentStart; - int m_alignmentEnd; - - wxList m_arcArrows; - -}; - -#endif - // _OGL_LINES_H_ diff --git a/utils/ogl/src/linesp.h b/utils/ogl/src/linesp.h deleted file mode 100644 index 3228ca3116..0000000000 --- a/utils/ogl/src/linesp.h +++ /dev/null @@ -1,83 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: linesp.h -// Purpose: Lines private header file -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_LINESP_H_ -#define _OGL_LINESP_H_ - -#ifdef __GNUG__ -#pragma interface "linesp.h" -#endif - -class wxLineControlPoint: public wxControlPoint -{ - DECLARE_DYNAMIC_CLASS(wxLineControlPoint) - - public: - - wxLineControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, float size = 0.0, - float x = 0.0, float y = 0.0, int the_type = 0); - ~wxLineControlPoint(); - - void OnDraw(wxDC& dc); - void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); - void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); - void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); - - void OnDragRight(bool draw, float x, float y, int keys=0, int attachment = 0); - void OnBeginDragRight(float x, float y, int keys=0, int attachment = 0); - void OnEndDragRight(float x, float y, int keys=0, int attachment = 0); - -public: - - int m_type; - wxRealPoint* m_point; // Line point - -}; - -/* - * Temporary arc label object - */ - -class wxLabelShape: public wxRectangleShape -{ - DECLARE_DYNAMIC_CLASS(wxLabelShape) - - public: - wxLabelShape(wxLineShape *parent = NULL, wxShapeRegion *region = NULL, float w = 0.0, float h = 0.0); - ~wxLabelShape(); - - void OnDraw(wxDC& dc); - void OnDrawContents(wxDC& dc); - void OnLeftClick(float x, float y, int keys = 0, int attachment = 0); - void OnRightClick(float x, float y, int keys = 0, int attachment = 0); - void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); - void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0); - void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0); - bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE); - -public: - wxLineShape* m_lineShape; - wxShapeRegion* m_shapeRegion; - -}; - -/* - * Get the point on the given line (x1, y1) (x2, y2) - * distance 'length' along from the end, - * returned values in x and y - */ - -void GetPointOnLine(float x1, float y1, float x2, float y2, - float length, float *x, float *y); - -#endif - // _OGL_LINESP_H_ - diff --git a/utils/ogl/src/makefile.b32 b/utils/ogl/src/makefile.b32 deleted file mode 100644 index 7945902454..0000000000 --- a/utils/ogl/src/makefile.b32 +++ /dev/null @@ -1,106 +0,0 @@ -# -# File: makefile.b32 -# Author: Julian Smart -# Created: 1996 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds OGL for BC++, 32-bit. - -!if "$(BCCDIR)" == "" -!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4 -!endif - -!if "$(WXWIN)" == "" -!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx -!endif - -# Change WXDIR to wherever wxWindows is found -WXDIR = $(WXWIN) -!include $(WXDIR)\src\makeb32.env - -WXLIB = $(WXDIR)\lib\wx32.lib -WXINC = $(WXDIR)\include -CFG=$(WXWIN)\src\wxwin32.cfg - -OGLDIR = $(WXDIR)\utils\ogl -OGLLIB = $(WXDIR)\lib\ogl.lib -DOCDIR = $(OGLDIR)\docs - -INC=/DPROLOGIO=1 # /I$(WXDIR)\include\base /I$(WXDIR)\include\msw - -LIBS=$(WXLIB) $(OGLLIB) mathwl cwl import mathwl - -!ifndef FINAL -FINAL=0 -!endif - -!if "$(FINAL)" == "0" -LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib -OPT = -Od -DEBUG_FLAGS= -v -DDEBUG=$(DEBUG) -!else -LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib -OPT = -O2 -DEBUG_FLAGS = -DDEBUG=$(DEBUG) -!endif - -CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) -CFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) - -OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj misc.obj divided.obj constrnt.obj\ - composit.obj drawn.obj bitmap.obj mfutils.obj - -all: $(OGLLIB) - -.$(SRCSUFF).obj: - bcc32 $(CPPFLAGS) $(INC) -c {$< } - -$(OGLLIB): $(OBJECTS) - erase $(OGLLIB) - tlib /P128 @&&! -$(OGLLIB) & -+$(OBJECTS:.obj =.obj +) -! - -# Making documents -docs: hlp -hlp: $(DOCDIR)/ogl.hlp -hlp32: $(DOCDIR)/hlp32/ogl.hlp -rtf: $(DOCDIR)/ogl.rtf - -$(DOCDIR)/ogl.hlp: $(DOCDIR)/ogl.rtf $(DOCDIR)/ogl.hpj - cd $(DOCDIR) - -erase ogl.ph - hc ogl - cd $(THISDIR) - -$(DOCDIR)/hlp32/ogl.hlp: $(DOCDIR)/hlp32/ogl.rtf $(DOCDIR)/hlp32/ogl.hpj - cd $(DOCDIR)/hlp32 - -erase ogl.ph - start /w hcw /c /e ogl.hpj - cd $(THISDIR) - -$(DOCDIR)/ogl.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/intro.tex $(DOCDIR)/ogl.tex - cd $(DOCDIR) - start /w tex2rtf $(DOCDIR)/ogl.tex $(DOCDIR)/ogl.rtf -twice -winhelp - cd $(THISDIR) - -$(DOCDIR)/hlp32/ogl.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/intro.tex $(DOCDIR)/ogl.tex - cd $(DOCDIR) - start /w tex2rtf $(DOCDIR)/ogl.tex $(DOCDIR)/hlp32/ogl.rtf -twice -winhelp -macros $(DOCDIR)/t2rtf32.ini - cd $(THISDIR) - -wordrtf: - cd $(DOCDIR) - -wx /W tex2rtf $(DOCDIR)/ogl.tex $(DOCDIR)/ogl.rtf -twice -rtf - cd $(THISDIR) - -clean: - -erase *.obj - -erase *.exe - -erase *.res - -erase ..\lib\*.lib $(OGLLIB) - diff --git a/utils/ogl/src/makefile.bcc b/utils/ogl/src/makefile.bcc deleted file mode 100644 index 92a3d67369..0000000000 --- a/utils/ogl/src/makefile.bcc +++ /dev/null @@ -1,105 +0,0 @@ -# -# File: makefile.bcc -# Author: Julian Smart -# Created: 1996 -# Updated: -# Copyright: (c) 1996 -# -# "%W% %G%" -# -# Makefile : Builds OGL for BC++, 16-bit. - -!if "$(BCCDIR)" == "" -!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4 -!endif - -!if "$(WXWIN)" == "" -!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx -!endif - -# Change WXDIR to wherever wxWindows is found -WXDIR = $(WXWIN) -!include $(WXDIR)\src\makebcc.env - -WXLIB = $(WXDIR)\lib\wx.lib -WXINC = $(WXDIR)\include -CFG=$(WXWIN)\src\wxwin.cfg - -OGLDIR = $(WXDIR)\utils\ogl -OGLLIB = $(OGLDIR)\lib\ogl.lib -DOCDIR = $(OGLDIR)\docs - -INC=/DPROLOGIO=1 # /I$(WXDIR)\include\base /I$(WXDIR)\include\msw - -LIBS=$(WXLIB) $(OGLLIB) mathwl cwl import mathwl - -!ifndef FINAL -FINAL=0 -!endif - -!if "$(FINAL)" == "0" -LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib -OPT = -Od -DEBUG_FLAGS= -v -!else -LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib -OPT = -O2 -DEBUG_FLAGS= -!endif -CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) -CFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) - -OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj misc.obj divided.obj constrnt.obj\ - composit.obj drawn.obj bitmap.obj mfutils.obj - -all: $(OGLLIB) - -.$(SRCSUFF).obj: - bcc $(CPPFLAGS) $(INC) -c {$< } - -$(OGLLIB): $(OBJECTS) - erase $(OGLLIB) - tlib /P128 @&&! -$(OGLLIB) & -+$(OBJECTS:.obj =.obj +) -! - -# Making documents -docs: hlp -hlp: $(DOCDIR)/ogl.hlp -hlp32: $(DOCDIR)/hlp32/ogl.hlp -rtf: $(DOCDIR)/ogl.rtf - -$(DOCDIR)/ogl.hlp: $(DOCDIR)/ogl.rtf $(DOCDIR)/ogl.hpj - cd $(DOCDIR) - -erase ogl.ph - hc ogl - cd $(THISDIR) - -$(DOCDIR)/hlp32/ogl.hlp: $(DOCDIR)/hlp32/ogl.rtf $(DOCDIR)/hlp32/ogl.hpj - cd $(DOCDIR)/hlp32 - -erase ogl.ph - start /w hcw /c /e ogl.hpj - cd $(THISDIR) - -$(DOCDIR)/ogl.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/intro.tex $(DOCDIR)/ogl.tex - cd $(DOCDIR) - start /w tex2rtf $(DOCDIR)/ogl.tex $(DOCDIR)/ogl.rtf -twice -winhelp - cd $(THISDIR) - -$(DOCDIR)/hlp32/ogl.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/intro.tex $(DOCDIR)/ogl.tex - cd $(DOCDIR) - start /w tex2rtf $(DOCDIR)/ogl.tex $(DOCDIR)/hlp32/ogl.rtf -twice -winhelp -macros $(DOCDIR)/t2rtf32.ini - cd $(THISDIR) - -wordrtf: - cd $(DOCDIR) - -wx /W tex2rtf $(DOCDIR)/ogl.tex $(DOCDIR)/ogl.rtf -twice -rtf - cd $(THISDIR) - -clean: - -erase *.obj - -erase *.exe - -erase *.res - -erase ..\lib\*.lib - diff --git a/utils/ogl/src/makefile.dos b/utils/ogl/src/makefile.dos deleted file mode 100644 index 179e52a37f..0000000000 --- a/utils/ogl/src/makefile.dos +++ /dev/null @@ -1,161 +0,0 @@ -# -# File: makefile.dos -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile: Builds object graphics library (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 - -OGLDIR = $(WXDIR)\utils\ogl -THISDIR = $(OGLDIR)\src -DOCDIR = $(OGLDIR)\docs -WXLIB = $(WXDIR)\lib\wx.lib -LIBS=$(WXLIB) libw llibcew commdlg shell ctl3dv2 - -GRAPHICSLIB = $(WXDIR)\lib\ogl.lib -INC = /I$(WXDIR)\include - -# Normally set OPTIONS = -# to disable PROLOGIO-dependent code -OPTIONS = -DPROLOGIO - -OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj misc.obj divided.obj constrnt.obj\ - composit.obj drawn.obj bitmap.obj mfutils.obj - -all: $(GRAPHICSLIB) - -wx: - cd $(WXDIR)\src\msw - nmake -f makefile.dos $(WXLIB) FINAL=$(FINAL) - cd $(THISDIR) - -$(GRAPHICSLIB): $(OBJECTS) - erase $(GRAPHICSLIB) - lib /PAGESIZE:128 @<< -$(GRAPHICSLIB) -y -$(OBJECTS) -nul -; -<< - -# NOTE: This causes a floating point stack error when optimized, -# so DON'T optimize! - -basic.obj: basic.$(SRCSUFF) basic.h lines.h misc.h canvas.h - cl @<< -$(CPPFLAGS) /Od /c /Tp $*.$(SRCSUFF) -<< - -basic2.obj: basic2.$(SRCSUFF) basic.h lines.h misc.h canvas.h - cl @<< -$(CPPFLAGS) /Od /c /Tp $*.$(SRCSUFF) -<< - -canvas.obj: canvas.$(SRCSUFF) basic.h misc.h canvas.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -ogldiag.obj: ogldiag.$(SRCSUFF) ogldiag.h canvas.h basic.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -lines.obj: lines.$(SRCSUFF) basic.h misc.h canvas.h lines.h basicp.h linesp.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -misc.obj: misc.$(SRCSUFF) basic.h misc.h constrnt.h basicp.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -divided.obj: divided.$(SRCSUFF) basic.h misc.h canvas.h divided.h basicp.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -constrnt.obj: constrnt.$(SRCSUFF) basic.h constrnt.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -composit.obj: composit.$(SRCSUFF) basic.h misc.h canvas.h constrnt.h composit.h basicp.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -drawn.obj: drawn.$(SRCSUFF) basic.h misc.h canvas.h drawn.h drawnp.h basicp.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -bitmap.obj: bitmap.$(SRCSUFF) basic.h misc.h canvas.h bitmap.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -mfutils.obj: mfutils.$(SRCSUFF) mfutils.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -# Making documents -docs: hlp -hlp: $(DOCDIR)/ogl.hlp -hlp32: $(DOCDIR)/hlp32/ogl.hlp -rtf: $(DOCDIR)/ogl.rtf - -$(DOCDIR)/ogl.hlp: $(DOCDIR)/ogl.rtf $(DOCDIR)/ogl.hpj - cd $(DOCDIR) - -erase ogl.ph - hc ogl - cd $(THISDIR) - -$(DOCDIR)/hlp32/ogl.hlp: $(DOCDIR)/hlp32/ogl.rtf $(DOCDIR)/hlp32/ogl.hpj - cd $(DOCDIR)/hlp32 - -erase ogl.ph - start /w hcw /c /e ogl.hpj - cd $(THISDIR) - -$(DOCDIR)/ogl.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/intro.tex $(DOCDIR)/ogl.tex - cd $(DOCDIR) - start /w tex2rtf $(DOCDIR)/ogl.tex $(DOCDIR)/ogl.rtf -twice -winhelp - cd $(THISDIR) - -$(DOCDIR)/hlp32/ogl.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/intro.tex $(DOCDIR)/ogl.tex - cd $(DOCDIR) - start /w tex2rtf $(DOCDIR)/ogl.tex $(DOCDIR)/hlp32/ogl.rtf -twice -winhelp -macros $(DOCDIR)/t2rtf32.ini - cd $(THISDIR) - -wordrtf: - cd $(DOCDIR) - -wx /W tex2rtf $(DOCDIR)/ogl.tex $(DOCDIR)/ogl.rtf -twice -rtf - cd $(THISDIR) - -clean: - -erase *.obj - -erase *.sbr - -erase *.exe - -erase *.res - -erase *.map - -erase *.pdb - -erase *.lib - -erase ..\lib\*.lib - -wxclean: - cd $(WXDIR)\src\msw - nmake -f makefile.dos clean - cd $(THISDIR) diff --git a/utils/ogl/src/makefile.nt b/utils/ogl/src/makefile.nt deleted file mode 100644 index dfd5a0b159..0000000000 --- a/utils/ogl/src/makefile.nt +++ /dev/null @@ -1,180 +0,0 @@ -# -# File: makefile.nt -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds OGL classes library (MS VC++). -# Use FINAL=1 argument to nmake to build final version with no debugging -# info - -# Set WXDIR for your system -WXDIR = $(WXWIN) -OBJECTSDIR = $(WXDIR)\utils\ogl -THISDIR = $(WXDIR)\utils\ogl\src -EXTRALIBS=$(WXDIR)\lib\ogl.lib $(WXDIR)\lib\mfutils.lib -EXTRAINC=/I$(WXDIR)\utils\mfutils\src /I$(WXDIR)\utils\prologio\src -EXTRAFLAGS=/DPROLOGIO=1 -DOCDIR=$(WXDIR)\docs -LOCALDOCDIR=$(WXDIR)\utils\ogl\docs - -!include $(WXDIR)\src\ntwxwin.mak - -PROGRAM=test - -OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj misc.obj divided.obj constrnt.obj\ - composit.obj drawn.obj bitmap.obj mfutils.obj - -LIBTARGET=$(WXDIR)\lib\ogl.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) -<< - -# NOTE: This causes a floating point stack error when optimized, -# so DON'T optimize! -basic.obj: basic.$(SRCSUFF) basic.h lines.h misc.h canvas.h - cl @<< -$(CPPFLAGS) /Od /c /Tp $*.$(SRCSUFF) -<< - -basic2.obj: basic2.$(SRCSUFF) basic.h lines.h misc.h canvas.h - cl @<< -$(CPPFLAGS) /Od /c /Tp $*.$(SRCSUFF) -<< - -canvas.obj: canvas.$(SRCSUFF) basic.h misc.h canvas.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -ogldiag.obj: ogldiag.$(SRCSUFF) ogldiag.h canvas.h basic.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -lines.obj: lines.$(SRCSUFF) basic.h misc.h canvas.h lines.h basicp.h linesp.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -misc.obj: misc.$(SRCSUFF) basic.h misc.h constrnt.h basicp.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -divided.obj: divided.$(SRCSUFF) basic.h misc.h canvas.h divided.h basicp.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -constrnt.obj: constrnt.$(SRCSUFF) basic.h constrnt.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -composit.obj: composit.$(SRCSUFF) basic.h misc.h canvas.h constrnt.h composit.h basicp.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -drawn.obj: drawn.$(SRCSUFF) basic.h misc.h canvas.h drawn.h drawnp.h basicp.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -bitmap.obj: bitmap.$(SRCSUFF) basic.h misc.h canvas.h bitmap.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -mfutils.obj: mfutils.$(SRCSUFF) mfutils.h - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -clean: - -erase *.obj - -erase *.sbr - -erase *.exe - -erase *.res - -erase *.map - -erase *.pdb - -erase $(LIBTARGET) - -DOCSOURCES=$(LOCALDOCDIR)\ogl.tex \ - $(LOCALDOCDIR)\bugs.tex $(LOCALDOCDIR)\changes.tex\ - $(LOCALDOCDIR)\classes.tex $(LOCALDOCDIR)\intro.tex\ - $(LOCALDOCDIR)\topics.tex $(LOCALDOCDIR)\sample.tex - -html: $(DOCDIR)\html\ogl\ogl.htm -hlp: $(DOCDIR)\winhelp\ogl.hlp -pdfrtf: $(DOCDIR)\pdf\ogl.rtf -ps: $(DOCDIR)\ps\ogl.ps - -$(DOCDIR)\winhelp\ogl.hlp: $(LOCALDOCDIR)\ogl.rtf $(LOCALDOCDIR)\ogl.hpj - cd $(LOCALDOCDIR) - -erase ogl.ph - hc ogl - move ogl.hlp $(DOCDIR)\winhelp\ogl.hlp - move ogl.cnt $(DOCDIR)\winhelp\ogl.cnt - cd $(THISDIR) - -$(LOCALDOCDIR)\ogl.rtf: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -start /w tex2rtf $(LOCALDOCDIR)\ogl.tex $(LOCALDOCDIR)\ogl.rtf -twice -winhelp - cd $(THISDIR) - -$(DOCDIR)\pdf\ogl.rtf: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -copy *.bmp $(DOCDIR)\pdf - -start /w tex2rtf $(LOCALDOCDIR)\ogl.tex $(DOCDIR)\pdf\ogl.rtf -twice -rtf - cd $(THISDIR) - -$(DOCDIR)\html\ogl\ogl.htm: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -mkdir $(DOCDIR)\html\ogl - cp *.gif $(DOCDIR)\html\ogl - -start /w tex2rtf $(LOCALDOCDIR)\ogl.tex $(DOCDIR)\html\ogl\ogl.htm -twice -html - -erase $(DOCDIR)\html\ogl\*.con - -erase $(DOCDIR)\html\ogl\*.ref - cd $(THISDIR) - -$(LOCALDOCDIR)\ogl.dvi: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -latex ogl - -latex ogl - -makeindx ogl - -bibtex ogl - -latex ogl - -latex ogl - cd $(THISDIR) - -$(WXDIR)\docs\ps\ogl.ps: $(LOCALDOCDIR)\ogl.dvi - cd $(LOCALDOCDIR) - -dvips32 -o ogl.ps ogl - move ogl.ps $(WXDIR)\docs\ps\ogl.ps - cd $(THISDIR) - - diff --git a/utils/ogl/src/makefile.unx b/utils/ogl/src/makefile.unx deleted file mode 100644 index 83ef912268..0000000000 --- a/utils/ogl/src/makefile.unx +++ /dev/null @@ -1,125 +0,0 @@ -# -# File: makefile.unx -# Author: Julian Smart -# Created: 1996 -# Updated: -# Copyright: (c) 1996 Julian Smart -# -# "%W% %G%" -# -# Makefile for object graphics library (UNIX). - -WXDIR = ../../.. - -# All common UNIX compiler flags and options are now in -# this central makefile. -include $(WXDIR)/src/make.env - -PRODIR = $(WXDIR)/utils/prologio -PROINC = $(PRODIR)/src -PROLIB = $(PRODIR)/lib/libproio$(GUISUFFIX).a - -MFDIR = $(WXDIR)/utils/mfutils -MFINC = $(MFDIR)/src - -OGLDIR = $(WXDIR)/utils/ogl -OGLLIB = $(OGLDIR)/lib/libogl$(GUISUFFIX).a - -OBJECTS = $(OBJDIR)/basic.o $(OBJDIR)/basic2.o $(OBJDIR)/canvas.o $(OBJDIR)/lines.o $(OBJDIR)/misc.o\ - $(OBJDIR)/divided.o $(OBJDIR)/constrnt.o $(OBJDIR)/composit.o $(OBJDIR)/drawn.o\ - $(OBJDIR)/bitmap.o $(OBJDIR)/ogldiag.o - -CPPFLAGS = -I$(PROINC) -I$(MFINC) $(XINCLUDE) $(INC) $(GUI) -DDEBUG='$(DEBUG)' $(DEBUGFLAGS) $(WARN) $(OPTIONS) -DPROLOGIO - -all: $(OBJDIR) $(OGLLIB) - -.SUFFIXES: - -wx: - cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx OPT=$(OPT) GUI=$(GUI) - -motif: - $(MAKE) -f makefile.unx GUI=-Dwx_motif OPT=$(OPT) GUISUFFIX=_motif LDLIBS='$(MOTIFLDLIBS)' XVIEW_LINK= - -xview: - $(MAKE) -f makefile.unx GUI=-Dwx_xview OPT=$(OPT) GUISUFFIX=_ol - -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='' \ - LDLIBS='$(HPLDLIBS)' - -$(OBJDIR): - mkdir $(OBJDIR) - -$(OGLLIB): $(OBJECTS) - rm -f $@ - ar $(AROPTIONS) $@ $(OBJECTS) - $(RANLIB) $@ - -$(OBJDIR)/basic.o: basic.$(SRCSUFF) basic.h lines.h misc.h canvas.h - $(CC) -c $(CPPFLAGS) -o $@ basic.$(SRCSUFF) - -$(OBJDIR)/basic2.o: basic2.$(SRCSUFF) basic.h lines.h misc.h canvas.h - $(CC) -c $(CPPFLAGS) -o $@ basic2.$(SRCSUFF) - -$(OBJDIR)/canvas.o: canvas.$(SRCSUFF) basic.h misc.h canvas.h - $(CC) -c $(CPPFLAGS) -o $@ canvas.$(SRCSUFF) - -$(OBJDIR)/lines.o: lines.$(SRCSUFF) basic.h misc.h canvas.h lines.h - $(CC) -c $(CPPFLAGS) -o $@ lines.$(SRCSUFF) - -$(OBJDIR)/misc.o: misc.$(SRCSUFF) basic.h misc.h constrnt.h - $(CC) -c $(CPPFLAGS) -o $@ misc.$(SRCSUFF) - -$(OBJDIR)/divided.o: divided.$(SRCSUFF) basic.h misc.h canvas.h divided.h - $(CC) -c $(CPPFLAGS) -o $@ divided.$(SRCSUFF) - -$(OBJDIR)/constrnt.o: constrnt.$(SRCSUFF) basic.h constrnt.h - $(CC) -c $(CPPFLAGS) -o $@ constrnt.$(SRCSUFF) - -$(OBJDIR)/composit.o: composit.$(SRCSUFF) basic.h misc.h canvas.h constrnt.h composit.h - $(CC) -c $(CPPFLAGS) -o $@ composit.$(SRCSUFF) - -$(OBJDIR)/drawn.o: drawn.$(SRCSUFF) basic.h misc.h canvas.h drawn.h drawnp.h - $(CC) -c $(CPPFLAGS) -o $@ drawn.$(SRCSUFF) - -$(OBJDIR)/bitmap.o: bitmap.$(SRCSUFF) basic.h misc.h canvas.h bitmap.h - $(CC) -c $(CPPFLAGS) -o $@ bitmap.$(SRCSUFF) - -$(OBJDIR)/ogldiag.o: ogldiag.$(SRCSUFF) basic.h misc.h canvas.h bitmap.h ogldiag.h - $(CC) -c $(CPPFLAGS) -o $@ ogldiag.$(SRCSUFF) - -HTMLDIR=/home/hardy/html/wx/manuals - -docs: ps xlp -ps: $(OGLDIR)/docs/ogl.ps -xlp: $(OGLDIR)/docs/ogl.xlp -html: $(HTMLDIR)/ogl/ogl_contents.html - -$(OGLDIR)/docs/ogl.xlp: $(OGLDIR)/docs/classes.tex $(OGLDIR)/docs/ogl.tex $(OGLDIR)/docs/topics.tex $(OGLDIR)/docs/changes.tex $(OGLDIR)/docs/intro.tex - cd ../docs; tex2rtf ogl.tex tmp.xlp -xlp -twice - sed -e "s/WXHELPCONTENTS/OGL Manual/g" < $(OGLDIR)/docs/tmp.xlp > $(OGLDIR)/docs/ogl.xlp - /bin/rm -f $(OGLDIR)/docs/tmp.xlp - -$(HTMLDIR)/ogl/ogl_contents.html: $(OGLDIR)/docs/classes.tex $(OGLDIR)/docs/ogl.tex $(OGLDIR)/docs/topics.tex $(OGLDIR)/docs/changes.tex $(OGLDIR)/docs/intro.tex - cd ../docs; tex2rtf ogl.tex $(HTMLDIR)/ogl/ogl -twice -html - -$(OGLDIR)/docs/ogl.dvi: $(OGLDIR)/docs/ogl.tex $(OGLDIR)/docs/classes.tex $(OGLDIR)/docs/topics.tex $(OGLDIR)/docs/changes.tex $(OGLDIR)/docs/intro.tex - cd $(OGLDIR)/docs; latex ogl; latex ogl; makeindex ogl; latex ogl; \ - -$(OGLDIR)/docs/ogl.ps: $(OGLDIR)/docs/ogl.dvi - cd $(OGLDIR)/docs; dvips -f -r < ogl.dvi > ogl.ps - -cleaneach: - rm -f $(OBJECTS) $(OGLLIB) core - -clean_motif: - $(MAKE) -f makefile.unx GUISUFFIX=_motif cleaneach - -clean_ol: - $(MAKE) -f makefile.unx GUISUFFIX=_ol cleaneach - -clean_hp: - $(MAKE) -f makefile.unx GUISUFFIX=_hp cleaneach - diff --git a/utils/ogl/src/makefile.wat b/utils/ogl/src/makefile.wat deleted file mode 100644 index 1ba7250c92..0000000000 --- a/utils/ogl/src/makefile.wat +++ /dev/null @@ -1,28 +0,0 @@ -# Objects makefile - -WXDIR = ..\..\.. - -!include $(WXDIR)\src\makewat.env - -EXTRACPPFLAGS=/DPROLOGIO - -OBJECTSLIB = $(WXDIR)\utils\objects\lib\graphics.lib -THISDIR = $(WXDIR)\utils\objects\src - -NAME = graphics -LNK = $(name).lnk - -IFLAGS = -i=$(WXINC) -i=$(WXBASEINC) -i=..\..\mfutils\src -i=..\..\prologio\src - -OBJECTS = basic.obj basic2.obj canvas.obj lines.obj misc.obj divided.obj constrnt.obj composit.obj drawn.obj bitmap.obj - -all: $(OBJECTSLIB) - -$(OBJECTSLIB): $(OBJECTS) - *wlib /b /c /n /P=256 $(OBJECTSLIB) $(OBJECTS) - -clean: .SYMBOLIC - -erase *.obj *.bak *.err *.pch $(OBJECTSLIB) *.lbc - - - diff --git a/utils/ogl/src/mfutils.cpp b/utils/ogl/src/mfutils.cpp deleted file mode 100644 index c6ee6f2e7c..0000000000 --- a/utils/ogl/src/mfutils.cpp +++ /dev/null @@ -1,1085 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: mfutils.cpp -// Purpose: Metafile utillities -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "mfutils.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#include -#include - -#include "mfutils.h" -#include - -static char hexArray[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', - 'C', 'D', 'E', 'F' }; - -static void DecToHex(int dec, char *buf) -{ - int firstDigit = (int)(dec/16.0); - int secondDigit = (int)(dec - (firstDigit*16.0)); - buf[0] = hexArray[firstDigit]; - buf[1] = hexArray[secondDigit]; - buf[2] = 0; -} - -// 16-bit unsigned integer -static unsigned int getshort(FILE *fp) -{ - int c, c1; - c = getc(fp); c1 = getc(fp); - unsigned int res = ((unsigned int) c) + (((unsigned int) c1) << 8); - return res; -} - -// 16-bit signed integer -static int getsignedshort(FILE *fp) -{ - int c, c1; - c = getc(fp); c1 = getc(fp); - int testRes = ((unsigned int) c) + (((unsigned int) c1) << 8); - unsigned long res1 = ((unsigned int) c) + (((unsigned int) c1) << 8); - int res = 0; - if (res1 > 32767) - res = (int)(res1 - 65536); - else - res = (int)(res1); - return res; -} - -// 32-bit integer -static long getint(FILE *fp) -{ - int c, c1, c2, c3; - c = getc(fp); c1 = getc(fp); c2 = getc(fp); c3 = getc(fp); - long res = (long)((long) c) + - (((long) c1) << 8) + - (((long) c2) << 16) + - (((long) c3) << 24); - return res; -} - - -/* Placeable metafile header -struct mfPLACEABLEHEADER { - DWORD key; // 32-bit - HANDLE hmf; // 16-bit - RECT bbox; // 4x16 bit - WORD inch; // 16-bit - DWORD reserved; // 32-bit - WORD checksum; // 16-bit -}; -*/ - -wxMetaRecord::~wxMetaRecord(void) -{ - if (points) delete[] points; - if (stringParam) delete[] stringParam; -} - -wxXMetaFile::wxXMetaFile(char *file) -{ - ok = FALSE; - top = 0.0; - bottom = 0.0; - left = 0.0; - right = 0.0; - - if (file) - ok = ReadFile(file); -} - -/* - Handle table gdiObjects - ------------ ---------- - [0] wxPen - [1]----param2--- wxBrush - [2] | wxFont - [3] | -> wxPen - - The handle table works as follows. - When a GDI object is created whilst reading in the - metafile, the (e.g.) createpen record is added to the - first free entry in the handle table. The createpen - record's param1 is a pointer to the actual wxPen, and - its param2 is the index into the gdiObjects list, which only - grows and never shrinks (unlike the handle table.) - - When SelectObject(index) is found, the index in the file - refers to the position in the handle table. BUT we then - set param2 to be the position of the wxPen in gdiObjects, - i.e. to param2 of the CreatePen record, itself found in - the handle table. - - When an object is deleted, the entry in the handletable is - NULLed but the gdiObjects entry is not removed (no point, and - allows us to create all GDI objects in advance of playing the - metafile). -*/ - - -static wxMetaRecord *HandleTable[100]; -static int HandleTableSize = 0; - -void DeleteMetaRecordHandle(int index) -{ - HandleTable[index] = NULL; -} - -int AddMetaRecordHandle(wxMetaRecord *record) -{ - for (int i = 0; i < HandleTableSize; i++) - if (!HandleTable[i]) - { - HandleTable[i] = record; - return i; - } - // No free spaces in table, so append. - - HandleTable[HandleTableSize] = record; - HandleTableSize ++; - return (HandleTableSize - 1); -} - -bool wxXMetaFile::ReadFile(char *file) -{ - HandleTableSize = 0; - - FILE *handle = fopen(file, "rb"); - if (!handle) return FALSE; - - // Read placeable metafile header, if any - long key = getint(handle); - - if (key == 0x9AC6CDD7) - { - long hmf = getshort(handle); - int iLeft, iTop, iRight, iBottom; - iLeft = getsignedshort(handle); - iTop = getsignedshort(handle); - iRight = getsignedshort(handle); - iBottom = getsignedshort(handle); - - left = (float)iLeft; - top = (float)iTop; - right = (float)iRight; - bottom = (float)iBottom; - - int inch = getshort(handle); - long reserved = getint(handle); - int checksum = getshort(handle); -/* - float widthInUnits = (float)right - left; - float heightInUnits = (float)bottom - top; - *width = (int)((widthInUnits*1440.0)/inch); - *height = (int)((heightInUnits*1440.0)/inch); -*/ - } - else rewind(handle); - - // Read METAHEADER - int mtType = getshort(handle); - - if (mtType != 1 && mtType != 2) - { - fclose(handle); - return FALSE; - } - - int mtHeaderSize = getshort(handle); - int mtVersion = getshort(handle); - - if (mtVersion != 0x0300 && mtVersion != 0x0100) - { - fclose(handle); - return FALSE; - } - - long mtSize = getint(handle); - int mtNoObjects = getshort(handle); - long mtMaxRecord = getint(handle); - int mtNoParameters = getshort(handle); - - while (!feof(handle)) - { - long rdSize = getint(handle); // 4 bytes - int rdFunction = getshort(handle); // 2 bytes - if (feof(handle)) - break; - - switch (rdFunction) - { - case META_SETBKCOLOR: - { - wxMetaRecord *rec = new wxMetaRecord(META_SETBKCOLOR); - long colorref = getint(handle); // COLORREF - rec->param1 = GetRValue(colorref); - rec->param2 = GetGValue(colorref); - rec->param3 = GetBValue(colorref); - metaRecords.Append(rec); - break; - } - case META_SETBKMODE: - { - wxMetaRecord *rec = new wxMetaRecord(META_SETBKMODE); - rec->param1 = getshort(handle); // Background mode - if (rec->param1 == OPAQUE) rec->param1 = wxSOLID; - else rec->param1 = wxTRANSPARENT; - metaRecords.Append(rec); - break; - } - case META_SETMAPMODE: - { - wxMetaRecord *rec = new wxMetaRecord(META_SETMAPMODE); - rec->param1 = getshort(handle); - metaRecords.Append(rec); - break; - } -// case META_SETROP2: -// case META_SETRELABS: -// case META_SETPOLYFILLMODE: -// case META_SETSTRETCHBLTMODE: -// case META_SETTEXTCHAREXTRA: - case META_SETTEXTCOLOR: - { - wxMetaRecord *rec = new wxMetaRecord(META_SETTEXTCOLOR); - long colorref = getint(handle); // COLORREF - rec->param1 = GetRValue(colorref); - rec->param2 = GetGValue(colorref); - rec->param3 = GetBValue(colorref); - metaRecords.Append(rec); - break; - } -// case META_SETTEXTJUSTIFICATION: - case META_SETWINDOWORG: - { - wxMetaRecord *rec = new wxMetaRecord(META_SETWINDOWORG); - rec->param2 = getshort(handle); - rec->param1 = getshort(handle); - metaRecords.Append(rec); - break; - } - case META_SETWINDOWEXT: - { - wxMetaRecord *rec = new wxMetaRecord(META_SETWINDOWEXT); - rec->param2 = getshort(handle); - rec->param1 = getshort(handle); - metaRecords.Append(rec); - break; - } -// case META_SETVIEWPORTORG: -// case META_SETVIEWPORTEXT: -// case META_OFFSETWINDOWORG: -// case META_SCALEWINDOWEXT: -// case META_OFFSETVIEWPORTORG: -// case META_SCALEVIEWPORTEXT: - case META_LINETO: - { - wxMetaRecord *rec = new wxMetaRecord(META_LINETO); - rec->param1 = getshort(handle); // x1 - rec->param2 = getshort(handle); // y1 - metaRecords.Append(rec); - break; - } - case META_MOVETO: - { - wxMetaRecord *rec = new wxMetaRecord(META_MOVETO); - rec->param1 = getshort(handle); // x1 - rec->param2 = getshort(handle); // y1 - metaRecords.Append(rec); - break; - } - case META_EXCLUDECLIPRECT: - { - wxMetaRecord *rec = new wxMetaRecord(META_EXCLUDECLIPRECT); - rec->param4 = getshort(handle); // y2 - rec->param3 = getshort(handle); // x2 - rec->param2 = getshort(handle); // y1 - rec->param1 = getshort(handle); // x1 - metaRecords.Append(rec); - break; - } - case META_INTERSECTCLIPRECT: - { - wxMetaRecord *rec = new wxMetaRecord(META_INTERSECTCLIPRECT); - rec->param4 = getshort(handle); // y2 - rec->param3 = getshort(handle); // x2 - rec->param2 = getshort(handle); // y1 - rec->param1 = getshort(handle); // x1 - metaRecords.Append(rec); - break; - } -// case META_ARC: // DO!!! - case META_ELLIPSE: - { - wxMetaRecord *rec = new wxMetaRecord(META_ELLIPSE); - rec->param4 = getshort(handle); // y2 - rec->param3 = getshort(handle); // x2 - rec->param2 = getshort(handle); // y1 - rec->param1 = getshort(handle); // x1 - metaRecords.Append(rec); - break; - } -// case META_FLOODFILL: -// case META_PIE: // DO!!! - case META_RECTANGLE: - { - wxMetaRecord *rec = new wxMetaRecord(META_RECTANGLE); - rec->param4 = getshort(handle); // y2 - rec->param3 = getshort(handle); // x2 - rec->param2 = getshort(handle); // y1 - rec->param1 = getshort(handle); // x1 - metaRecords.Append(rec); - break; - } - case META_ROUNDRECT: - { - wxMetaRecord *rec = new wxMetaRecord(META_ROUNDRECT); - rec->param6 = getshort(handle); // width - rec->param5 = getshort(handle); // height - rec->param4 = getshort(handle); // y2 - rec->param3 = getshort(handle); // x2 - rec->param2 = getshort(handle); // y1 - rec->param1 = getshort(handle); // x1 - metaRecords.Append(rec); - break; - } -// case META_PATBLT: -// case META_SAVEDC: - case META_SETPIXEL: - { - wxMetaRecord *rec = new wxMetaRecord(META_SETPIXEL); - rec->param1 = getshort(handle); // x1 - rec->param2 = getshort(handle); // y1 - rec->param3 = getint(handle); // COLORREF - metaRecords.Append(rec); - break; - } -// case META_OFFSETCLIPRGN: - case META_TEXTOUT: - { - wxMetaRecord *rec = new wxMetaRecord(META_TEXTOUT); - int count = getshort(handle); - rec->stringParam = new char[count+1]; - fread((void *)rec->stringParam, sizeof(char), count, handle); - rec->stringParam[count] = 0; - rec->param2 = getshort(handle); // Y - rec->param1 = getshort(handle); // X - metaRecords.Append(rec); - break; - } -/* - case META_EXTTEXTOUT: - { - wxMetaRecord *rec = new wxMetaRecord(META_EXTTEXTOUT); - int cellSpacing = getshort(handle); - int count = getshort(handle); - rec->stringParam = new char[count+1]; - fread((void *)rec->stringParam, sizeof(char), count, handle); - rec->stringParam[count] = 0; - // Rectangle - int rectY2 = getshort(handle); - int rectX2 = getshort(handle); - int rectY1 = getshort(handle); - int rectX1 = getshort(handle); - int rectType = getshort(handle); - rec->param2 = getshort(handle); // Y - rec->param1 = getshort(handle); // X - metaRecords.Append(rec); - break; - } -*/ -// case META_BITBLT: -// case META_STRETCHBLT: - case META_POLYGON: - { - wxMetaRecord *rec = new wxMetaRecord(META_POLYGON); - rec->param1 = getshort(handle); - rec->points = new wxRealPoint[(int)rec->param1]; - for (int i = 0; i < rec->param1; i++) - { - rec->points[i].x = getshort(handle); - rec->points[i].y = getshort(handle); - } - - metaRecords.Append(rec); - break; - } - case META_POLYLINE: - { - wxMetaRecord *rec = new wxMetaRecord(META_POLYLINE); - rec->param1 = (long)getshort(handle); - rec->points = new wxRealPoint[(int)rec->param1]; - for (int i = 0; i < rec->param1; i++) - { - rec->points[i].x = getshort(handle); - rec->points[i].y = getshort(handle); - } - - metaRecords.Append(rec); - break; - } -// case META_ESCAPE: -// case META_RESTOREDC: -// case META_FILLREGION: -// case META_FRAMEREGION: -// case META_INVERTREGION: -// case META_PAINTREGION: -// case META_SELECTCLIPREGION: // DO THIS! - case META_SELECTOBJECT: - { - wxMetaRecord *rec = new wxMetaRecord(META_SELECTOBJECT); - rec->param1 = (long)getshort(handle); // Position of object in gdiObjects list - metaRecords.Append(rec); - // param2 gives the index into gdiObjects, which is different from - // the index into the handle table. - rec->param2 = HandleTable[(int)rec->param1]->param2; - break; - } -// case META_SETTEXTALIGN: -// case META_DRAWTEXT: -// case META_CHORD: -// case META_SETMAPPERFLAGS: -// case META_EXTTEXTOUT: -// case META_SETDIBTODEV: -// case META_SELECTPALETTE: -// case META_REALIZEPALETTE: -// case META_ANIMATEPALETTE: -// case META_SETPALENTRIES: -// case META_POLYPOLYGON: -// case META_RESIZEPALETTE: -// case META_DIBBITBLT: -// case META_DIBSTRETCHBLT: - case META_DIBCREATEPATTERNBRUSH: - { - wxMetaRecord *rec = new wxMetaRecord(META_DIBCREATEPATTERNBRUSH); - fread((void *)wxBuffer, sizeof(char), (int)((2*rdSize) - 6), handle); - - metaRecords.Append(rec); - gdiObjects.Append(rec); - AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); - break; - } -// case META_STRETCHDIB: -// case META_EXTFLOODFILL: -// case META_RESETDC: -// case META_STARTDOC: -// case META_STARTPAGE: -// case META_ENDPAGE: -// case META_ABORTDOC: -// case META_ENDDOC: - case META_DELETEOBJECT: - { - int index = getshort(handle); - DeleteMetaRecordHandle(index); - break; - } - case META_CREATEPALETTE: - { - wxMetaRecord *rec = new wxMetaRecord(META_CREATEPALETTE); - fread((void *)wxBuffer, sizeof(char), (int)((2*rdSize) - 6), handle); - - metaRecords.Append(rec); - gdiObjects.Append(rec); - AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); - break; - } - case META_CREATEBRUSH: - { - wxMetaRecord *rec = new wxMetaRecord(META_CREATEBRUSH); - fread((void *)wxBuffer, sizeof(char), (int)((2*rdSize) - 6), handle); - metaRecords.Append(rec); - gdiObjects.Append(rec); - AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); - break; - } - case META_CREATEPATTERNBRUSH: - { - wxMetaRecord *rec = new wxMetaRecord(META_CREATEPATTERNBRUSH); - fread((void *)wxBuffer, sizeof(char), (int)((2*rdSize) - 6), handle); - metaRecords.Append(rec); - gdiObjects.Append(rec); - AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); - break; - } - case META_CREATEPENINDIRECT: - { - wxMetaRecord *rec = new wxMetaRecord(META_CREATEPENINDIRECT); - int msStyle = getshort(handle); // Style: 2 bytes - int x = getshort(handle); // X: 2 bytes - int y = getshort(handle); // Y: 2 bytes - long colorref = getint(handle); // COLORREF 4 bytes - - int style; - if (msStyle == PS_DOT) - style = wxDOT; - else if (msStyle == PS_DASH) - style = wxSHORT_DASH; - else if (msStyle == PS_NULL) - style = wxTRANSPARENT; - else style = wxSOLID; - - wxColour colour(GetRValue(colorref), GetGValue(colorref), GetBValue(colorref)); - rec->param1 = (long)wxThePenList->FindOrCreatePen(colour, x, style); - metaRecords.Append(rec); - gdiObjects.Append(rec); - - AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); - - // For some reason, the size of this record is sometimes 9 words!!! - // instead of the usual 8. So read 2 characters extra. - if (rdSize == 9) - { - (void) getshort(handle); - } - break; - } - case META_CREATEFONTINDIRECT: - { - wxMetaRecord *rec = new wxMetaRecord(META_CREATEFONTINDIRECT); - int lfHeight = getshort(handle); // 2 bytes - int lfWidth = getshort(handle); // 2 bytes - int lfEsc = getshort(handle); // 2 bytes - int lfOrient = getshort(handle); // 2 bytes - int lfWeight = getshort(handle); // 2 bytes - char lfItalic = getc(handle); // 1 byte - char lfUnderline = getc(handle); // 1 byte - char lfStrikeout = getc(handle); // 1 byte - char lfCharSet = getc(handle); // 1 byte - char lfOutPrecision = getc(handle); // 1 byte - char lfClipPrecision = getc(handle); // 1 byte - char lfQuality = getc(handle); // 1 byte - char lfPitchAndFamily = getc(handle); // 1 byte (18th) - char lfFacename[32]; - // Read the rest of the record, which is total record size - // minus the number of bytes already read (18 record, 6 metarecord - // header) - fread((void *)lfFacename, sizeof(char), (int)((2*rdSize) - 18 - 6), handle); - - int family; - if (lfPitchAndFamily & FF_MODERN) - family = wxMODERN; - else if (lfPitchAndFamily & FF_MODERN) - family = wxMODERN; - else if (lfPitchAndFamily & FF_ROMAN) - family = wxROMAN; - else if (lfPitchAndFamily & FF_SWISS) - family = wxSWISS; - else if (lfPitchAndFamily & FF_DECORATIVE) - family = wxDECORATIVE; - else - family = wxDEFAULT; - - int weight; - if (lfWeight == 300) - weight = wxLIGHT; - else if (lfWeight == 400) - weight = wxNORMAL; - else if (lfWeight == 900) - weight = wxBOLD; - else weight = wxNORMAL; - - int style; - if (lfItalic != 0) - style = wxITALIC; - else - style = wxNORMAL; - - // About how many pixels per inch??? - int logPixelsY = 100; - int pointSize = (int)(lfHeight*72.0/logPixelsY); - - wxFont *theFont = - wxTheFontList->FindOrCreateFont(pointSize, family, style, weight, (lfUnderline != 0)); - - rec->param1 = (long) theFont; - metaRecords.Append(rec); - gdiObjects.Append(rec); - AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); - break; - } - case META_CREATEBRUSHINDIRECT: - { - wxMetaRecord *rec = new wxMetaRecord(META_CREATEBRUSHINDIRECT); - int msStyle = getshort(handle); // Style: 2 bytes - long colorref = getint(handle); // COLORREF: 4 bytes - int hatchStyle = getshort(handle); // Hatch style 2 bytes - - int style; - switch (msStyle) - { - case BS_HATCHED: - { - switch (hatchStyle) - { - case HS_BDIAGONAL: - style = wxBDIAGONAL_HATCH; - break; - case HS_DIAGCROSS: - style = wxCROSSDIAG_HATCH; - break; - case HS_FDIAGONAL: - style = wxFDIAGONAL_HATCH; - break; - case HS_HORIZONTAL: - style = wxHORIZONTAL_HATCH; - break; - case HS_VERTICAL: - style = wxVERTICAL_HATCH; - break; - default: - case HS_CROSS: - style = wxCROSS_HATCH; - break; - } - break; - } - case BS_SOLID: - default: - style = wxSOLID; - break; - } - if (msStyle == PS_DOT) - style = wxDOT; - else if (msStyle == PS_DASH) - style = wxSHORT_DASH; - else if (msStyle == PS_NULL) - style = wxTRANSPARENT; - else style = wxSOLID; - - wxColour colour(GetRValue(colorref), GetGValue(colorref), GetBValue(colorref)); - rec->param1 = (long)wxTheBrushList->FindOrCreateBrush(colour, style); - metaRecords.Append(rec); - gdiObjects.Append(rec); - AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); - break; - } - case META_CREATEBITMAPINDIRECT: - { - wxMetaRecord *rec = new wxMetaRecord(META_CREATEBITMAPINDIRECT); - fread((void *)wxBuffer, sizeof(char), (int)((2*rdSize) - 6), handle); - - metaRecords.Append(rec); - gdiObjects.Append(rec); - AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); - break; - } - case META_CREATEBITMAP: - { - wxMetaRecord *rec = new wxMetaRecord(META_CREATEBITMAP); - fread((void *)wxBuffer, sizeof(char), (int)((2*rdSize) - 6), handle); - - metaRecords.Append(rec); - gdiObjects.Append(rec); - AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); - break; - } - case META_CREATEREGION: - { - wxMetaRecord *rec = new wxMetaRecord(META_CREATEREGION); - fread((void *)wxBuffer, sizeof(char), (int)((2*rdSize) - 6), handle); - - metaRecords.Append(rec); - gdiObjects.Append(rec); - AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); - break; - } - default: - { - fread((void *)wxBuffer, sizeof(char), (int)((2*rdSize) - 6), handle); - break; - } - } - } - fclose(handle); - return TRUE; -} - -wxXMetaFile::~wxXMetaFile(void) -{ - wxNode *node = metaRecords.First(); - while (node) - { - wxMetaRecord *rec = (wxMetaRecord *)node->Data(); - delete rec; - wxNode *next = node->Next(); - delete node; - node = next; - } -} - -bool wxXMetaFile::SetClipboard(int width, int height) -{ - return FALSE; -} - -bool wxXMetaFile::Play(wxDC *dc) -{ - wxNode *node = metaRecords.First(); - while (node) - { - wxMetaRecord *rec = (wxMetaRecord *)node->Data(); - int rdFunction = rec->metaFunction; - - switch (rdFunction) - { - case META_SETBKCOLOR: - { - break; - } - case META_SETBKMODE: - { - break; - } - case META_SETMAPMODE: - { - break; - } -// case META_SETROP2: -// case META_SETRELABS: -// case META_SETPOLYFILLMODE: -// case META_SETSTRETCHBLTMODE: -// case META_SETTEXTCHAREXTRA: - case META_SETTEXTCOLOR: - { - break; - } -// case META_SETTEXTJUSTIFICATION: - case META_SETWINDOWORG: - { - break; - } - case META_SETWINDOWEXT: - { - break; - } -// case META_SETVIEWPORTORG: -// case META_SETVIEWPORTEXT: -// case META_OFFSETWINDOWORG: -// case META_SCALEWINDOWEXT: -// case META_OFFSETVIEWPORTORG: -// case META_SCALEVIEWPORTEXT: - case META_LINETO: - { - long x1 = rec->param1; - long y1 = rec->param2; - dc->DrawLine(lastX, lastY, (float)x1, (float)y1); - break; - } - case META_MOVETO: - { - lastX = (float)rec->param1; - lastY = (float)rec->param2; - break; - } - case META_EXCLUDECLIPRECT: - { - break; - } - case META_INTERSECTCLIPRECT: - { - break; - } -// case META_ARC: // DO!!! - case META_ELLIPSE: - { - break; - } -// case META_FLOODFILL: -// case META_PIE: // DO!!! - case META_RECTANGLE: - { - dc->DrawRectangle((float)rec->param1, (float)rec->param2, - (float)rec->param3 - rec->param1, - (float)rec->param4 - rec->param2); - break; - } - case META_ROUNDRECT: - { - dc->DrawRoundedRectangle((float)rec->param1, (float)rec->param2, - (float)rec->param3 - rec->param1, - (float)rec->param4 - rec->param2, - (float)rec->param5); - break; - } -// case META_PATBLT: -// case META_SAVEDC: - case META_SETPIXEL: - { -// rec->param1 = getshort(handle); // x1 -// rec->param2 = getshort(handle); // y1 -// rec->param3 = getint(handle); // COLORREF - break; - } -// case META_OFFSETCLIPRGN: - case META_TEXTOUT: - { -/* - int count = getshort(handle); - rec->stringParam = new char[count+1]; - fread((void *)rec->stringParam, sizeof(char), count, handle); - rec->stringParam[count] = 0; - rec->param2 = getshort(handle); // Y - rec->param1 = getshort(handle); // X -*/ - break; - } -// case META_BITBLT: -// case META_STRETCHBLT: - case META_POLYGON: - { -/* - rec->param1 = getshort(handle); - rec->points = new wxRealPoint[(int)rec->param1]; - for (int i = 0; i < rec->param1; i++) - { - rec->points[i].x = getshort(handle); - rec->points[i].y = getshort(handle); - } -*/ - break; - } - case META_POLYLINE: - { -/* - wxMetaRecord *rec = new wxMetaRecord(META_POLYLINE); - rec->param1 = (long)getshort(handle); - rec->points = new wxRealPoint[(int)rec->param1]; - for (int i = 0; i < rec->param1; i++) - { - rec->points[i].x = getshort(handle); - rec->points[i].y = getshort(handle); - } -*/ - break; - } -// case META_ESCAPE: -// case META_RESTOREDC: -// case META_FILLREGION: -// case META_FRAMEREGION: -// case META_INVERTREGION: -// case META_PAINTREGION: -// case META_SELECTCLIPREGION: // DO THIS! - case META_SELECTOBJECT: - { -/* - wxMetaRecord *rec = new wxMetaRecord(META_SELECTOBJECT); - rec->param1 = (long)getshort(handle); // Position of object in gdiObjects list -*/ - break; - } -// case META_SETTEXTALIGN: -// case META_DRAWTEXT: -// case META_CHORD: -// case META_SETMAPPERFLAGS: -// case META_EXTTEXTOUT: -// case META_SETDIBTODEV: -// case META_SELECTPALETTE: -// case META_REALIZEPALETTE: -// case META_ANIMATEPALETTE: -// case META_SETPALENTRIES: -// case META_POLYPOLYGON: -// case META_RESIZEPALETTE: -// case META_DIBBITBLT: -// case META_DIBSTRETCHBLT: - case META_DIBCREATEPATTERNBRUSH: - { -/* - fread((void *)wxBuffer, sizeof(char), (int)(rdSize - 3), handle); -*/ - break; - } -// case META_STRETCHDIB: -// case META_EXTFLOODFILL: -// case META_RESETDC: -// case META_STARTDOC: -// case META_STARTPAGE: -// case META_ENDPAGE: -// case META_ABORTDOC: -// case META_ENDDOC: -// case META_DELETEOBJECT: // DO!! - case META_CREATEPALETTE: - { -/* - wxMetaRecord *rec = new wxMetaRecord(META_CREATEPALETTE); - fread((void *)wxBuffer, sizeof(char), (int)(rdSize - 3), handle); -*/ - break; - } - case META_CREATEBRUSH: - { -/* - fread((void *)wxBuffer, sizeof(char), (int)(rdSize - 3), handle); -*/ - break; - } - case META_CREATEPATTERNBRUSH: - { -/* - fread((void *)wxBuffer, sizeof(char), (int)(rdSize - 3), handle); -*/ - break; - } - case META_CREATEPENINDIRECT: - { -/* - int msStyle = getshort(handle); // Style: 2 bytes - int x = getshort(handle); // X: 2 bytes - int y = getshort(handle); // Y: 2 bytes - int colorref = getint(handle); // COLORREF 4 bytes - - int style; - if (msStyle == PS_DOT) - style = wxDOT; - else if (msStyle == PS_DASH) - style = wxSHORT_DASH; - else if (msStyle == PS_NULL) - style = wxTRANSPARENT; - else style = wxSOLID; - - wxColour colour(GetRValue(colorref), GetGValue(colorref), GetBValue(colorref)); - rec->param1 = (long)wxThePenList->FindOrCreatePen(&colour, x, style); -*/ - break; - } - case META_CREATEFONTINDIRECT: - { -/* - int lfHeight = getshort(handle); - int lfWidth = getshort(handle); - int lfEsc = getshort(handle); - int lfOrient = getshort(handle); - int lfWeight = getshort(handle); - char lfItalic = getc(handle); - char lfUnderline = getc(handle); - char lfStrikeout = getc(handle); - char lfCharSet = getc(handle); - char lfOutPrecision = getc(handle); - char lfClipPrecision = getc(handle); - char lfQuality = getc(handle); - char lfPitchAndFamily = getc(handle); - char lfFacename[32]; - fread((void *)lfFacename, sizeof(char), 32, handle); - - int family; - if (lfPitchAndFamily & FF_MODERN) - family = wxMODERN; - else if (lfPitchAndFamily & FF_MODERN) - family = wxMODERN; - else if (lfPitchAndFamily & FF_ROMAN) - family = wxROMAN; - else if (lfPitchAndFamily & FF_SWISS) - family = wxSWISS; - else if (lfPitchAndFamily & FF_DECORATIVE) - family = wxDECORATIVE; - else - family = wxDEFAULT; - - int weight; - if (lfWeight == 300) - weight = wxLIGHT; - else if (lfWeight == 400) - weight = wxNORMAL; - else if (lfWeight == 900) - weight = wxBOLD; - else weight = wxNORMAL; - - int style; - if ((bool)lfItalic) - style = wxITALIC; - else - style = wxNORMAL; - - // About how many pixels per inch??? - int logPixelsY = 100; - int pointSize = (int)(lfHeight*72.0/logPixelsY); - - wxFont *theFont = - wxTheFontList->FindOrCreateFont(pointSize, family, style, weight, (bool)lfUnderline); - - rec->param1 = (long)theFont; -*/ - break; - } - case META_CREATEBRUSHINDIRECT: - { -/* - int msStyle = getshort(handle); // Style: 2 bytes - int colorref = getint(handle); // COLORREF: 4 bytes - int hatchStyle = getshort(handle); // Hatch style 2 bytes - - int style; - if (msStyle == PS_DOT) - style = wxDOT; - else if (msStyle == PS_DASH) - style = wxSHORT_DASH; - else if (msStyle == PS_NULL) - style = wxTRANSPARENT; - else style = wxSOLID; - - wxColour colour(GetRValue(colorref), GetGValue(colorref), GetBValue(colorref)); - rec->param1 = (long)wxTheBrushList->FindOrCreateBrush(&colour, wxSOLID); -*/ - break; - } - case META_CREATEBITMAPINDIRECT: - { -/* - fread((void *)wxBuffer, sizeof(char), (int)(rdSize - 3), handle); -*/ - break; - } - case META_CREATEBITMAP: - { -/* - fread((void *)wxBuffer, sizeof(char), (int)(rdSize - 3), handle); -*/ - break; - } - case META_CREATEREGION: - { - dc->DestroyClippingRegion(); -/* - rec->param1 = getshort(handle); // Style: 2 bytes -*/ - break; - } - default: - { - break; - } - } - node = node->Next(); - } - return TRUE; -} - diff --git a/utils/ogl/src/mfutils.h b/utils/ogl/src/mfutils.h deleted file mode 100644 index 00117940ee..0000000000 --- a/utils/ogl/src/mfutils.h +++ /dev/null @@ -1,211 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: mfutils.h -// Purpose: Metafile utilities: reading a placeable metafile independently -// of Windows. -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _MFUTILS_H_ -#define _MFUTILS_H_ - -#ifdef __GNUG__ -#pragma interface "mfutils.h" -#endif - -#include - -#ifndef __WXMSW__ -#define GetRValue(rgb) ((unsigned char)(rgb)) -#define GetGValue(rgb) ((unsigned char)(((int)(rgb)) >> 8)) -#define GetBValue(rgb) ((unsigned char)((rgb)>>16)) -#endif - -/* Metafile Functions */ -/* Win32s/Borland need these macros, although META_SETBKCOLOR is defined */ -#if !defined(META_SETBKCOLOR) || defined(WIN32) - -#define META_SETBKCOLOR 0x0201 -#define META_SETBKMODE 0x0102 -#define META_SETMAPMODE 0x0103 -#define META_SETROP2 0x0104 -#define META_SETRELABS 0x0105 -#define META_SETPOLYFILLMODE 0x0106 -#define META_SETSTRETCHBLTMODE 0x0107 -#define META_SETTEXTCHAREXTRA 0x0108 -#define META_SETTEXTCOLOR 0x0209 -#define META_SETTEXTJUSTIFICATION 0x020A -#define META_SETWINDOWORG 0x020B -#define META_SETWINDOWEXT 0x020C -#define META_SETVIEWPORTORG 0x020D -#define META_SETVIEWPORTEXT 0x020E -#define META_OFFSETWINDOWORG 0x020F -#define META_SCALEWINDOWEXT 0x0410 -#define META_OFFSETVIEWPORTORG 0x0211 -#define META_SCALEVIEWPORTEXT 0x0412 -#define META_LINETO 0x0213 -#define META_MOVETO 0x0214 -#define META_EXCLUDECLIPRECT 0x0415 -#define META_INTERSECTCLIPRECT 0x0416 -#define META_ARC 0x0817 -#define META_ELLIPSE 0x0418 -#define META_FLOODFILL 0x0419 -#define META_PIE 0x081A -#define META_RECTANGLE 0x041B -#define META_ROUNDRECT 0x061C -#define META_PATBLT 0x061D -#define META_SAVEDC 0x001E -#define META_SETPIXEL 0x041F -#define META_OFFSETCLIPRGN 0x0220 -#define META_TEXTOUT 0x0521 -#define META_BITBLT 0x0922 -#define META_STRETCHBLT 0x0B23 -#define META_POLYGON 0x0324 -#define META_POLYLINE 0x0325 -#define META_ESCAPE 0x0626 -#define META_RESTOREDC 0x0127 -#define META_FILLREGION 0x0228 -#define META_FRAMEREGION 0x0429 -#define META_INVERTREGION 0x012A -#define META_PAINTREGION 0x012B -#define META_SELECTCLIPREGION 0x012C -#define META_SELECTOBJECT 0x012D -#define META_SETTEXTALIGN 0x012E -#define META_DRAWTEXT 0x062F - -#define META_CHORD 0x0830 -#define META_SETMAPPERFLAGS 0x0231 -#define META_EXTTEXTOUT 0x0a32 -#define META_SETDIBTODEV 0x0d33 -#define META_SELECTPALETTE 0x0234 -#define META_REALIZEPALETTE 0x0035 -#define META_ANIMATEPALETTE 0x0436 -#define META_SETPALENTRIES 0x0037 -#define META_POLYPOLYGON 0x0538 -#define META_RESIZEPALETTE 0x0139 - -#define META_DIBBITBLT 0x0940 -#define META_DIBSTRETCHBLT 0x0b41 -#define META_DIBCREATEPATTERNBRUSH 0x0142 -#define META_STRETCHDIB 0x0f43 - -#define META_EXTFLOODFILL 0x0548 - -#define META_RESETDC 0x014C -#define META_STARTDOC 0x014D -#define META_STARTPAGE 0x004F -#define META_ENDPAGE 0x0050 -#define META_ABORTDOC 0x0052 -#define META_ENDDOC 0x005E - -#define META_DELETEOBJECT 0x01f0 - -#define META_CREATEPALETTE 0x00f7 -#define META_CREATEBRUSH 0x00F8 -#define META_CREATEPATTERNBRUSH 0x01F9 -#define META_CREATEPENINDIRECT 0x02FA -#define META_CREATEFONTINDIRECT 0x02FB -#define META_CREATEBRUSHINDIRECT 0x02FC -#define META_CREATEBITMAPINDIRECT 0x02FD -#define META_CREATEBITMAP 0x06FE -#define META_CREATEREGION 0x06FF - -/* Background Modes */ -#define TRANSPARENT 1 -#define OPAQUE 2 - -/* Pen Styles */ -#define PS_SOLID 0 -#define PS_DASH 1 -#define PS_DOT 2 -#define PS_DASHDOT 3 -#define PS_DASHDOTDOT 4 -#define PS_NULL 5 -#define PS_INSIDEFRAME 6 - -/* PitchAndFamily family values (high 4 bits) */ -/* Win32s/Borland don't need this */ -#if !defined(__BORLANDC__) && !defined(WIN32) -#define FF_DONTCARE 0x00 -#define FF_ROMAN 0x10 -#define FF_SWISS 0x20 -#define FF_MODERN 0x30 -#define FF_SCRIPT 0x40 -#define FF_DECORATIVE 0x50 -#endif - -/* Brush Styles */ -#define BS_SOLID 0 -#define BS_NULL 1 -#define BS_HOLLOW BS_NULL -#define BS_HATCHED 2 -#define BS_PATTERN 3 -#define BS_INDEXED 4 -#define BS_DIBPATTERN 5 - -/* Hatch Styles */ -#define HS_HORIZONTAL 0 -#define HS_VERTICAL 1 -#define HS_FDIAGONAL 2 -#define HS_BDIAGONAL 3 -#define HS_CROSS 4 -#define HS_DIAGCROSS 5 - -#endif // metafile functions - -class wxMetaRecord: public wxObject -{ - public: - int metaFunction; - long param1; - long param2; - long param3; - long param4; - long param5; - long param6; - long param7; - long param8; - char *stringParam; - wxRealPoint *points; - - wxMetaRecord(int fun) - { - metaFunction = fun; points = NULL; stringParam = NULL; - param1 = 0; - } - ~wxMetaRecord(void); -}; - -class wxXMetaFile: public wxObject -{ - public: - float lastX; - float lastY; - bool ok; - - float left; - float top; - float right; - float bottom; - - wxList metaRecords; - wxList gdiObjects; // List of wxMetaRecord objects created with Create..., - // referenced by position in list by SelectObject - wxXMetaFile(char *file = NULL); - ~wxXMetaFile(void); - - // After this is called, the metafile cannot be used for anything - // since it is now owned by the clipboard. - bool SetClipboard(int width = 0, int height = 0); - - bool Play(wxDC *dc); - inline bool Ok(void) const { return ok; } - bool ReadFile(char *file); -}; - -#endif - // _MFUTILS_H_ diff --git a/utils/ogl/src/misc.cpp b/utils/ogl/src/misc.cpp deleted file mode 100644 index 3607408975..0000000000 --- a/utils/ogl/src/misc.cpp +++ /dev/null @@ -1,805 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: misc.cpp -// Purpose: Miscellaneous OGL support functions -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "misc.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#ifdef PROLOGIO -#include -#endif - -#include - -#if USE_IOSTREAMH -#include -#else -#include -#endif -#include -#include -#include - -#include "basic.h" -#include "basicp.h" -#include "misc.h" -#include "constrnt.h" -#include "composit.h" - -wxFont *g_oglNormalFont; - -wxPen *black_pen; -wxPen *white_background_pen; -wxPen *transparent_pen; -wxBrush *white_background_brush; -wxPen *black_foreground_pen; - -char *GraphicsBuffer = NULL; -wxCursor *GraphicsBullseyeCursor = NULL; - -wxList wxObjectCopyMapping(wxKEY_INTEGER); - -void wxOGLInitialize() -{ - GraphicsBullseyeCursor = new wxCursor(wxCURSOR_BULLSEYE); - - g_oglNormalFont = new wxFont(12, wxMODERN, wxNORMAL, wxNORMAL); - - black_pen = new wxPen("BLACK", 1, wxSOLID); - - white_background_pen = new wxPen("WHITE", 1, wxSOLID); - transparent_pen = new wxPen("WHITE", 1, wxTRANSPARENT); - white_background_brush = new wxBrush("WHITE", wxSOLID); - black_foreground_pen = new wxPen("BLACK", 1, wxSOLID); - - OGLInitializeConstraintTypes(); - - // Initialize big buffer used when writing images - GraphicsBuffer = new char[3000]; - - if (!oglPopupDivisionMenu) - { - oglPopupDivisionMenu = new wxMenu("", (wxFunction)oglGraphicsDivisionMenuProc); - oglPopupDivisionMenu->Append(DIVISION_MENU_SPLIT_HORIZONTALLY, "Split horizontally"); - oglPopupDivisionMenu->Append(DIVISION_MENU_SPLIT_VERTICALLY, "Split vertically"); - oglPopupDivisionMenu->AppendSeparator(); - oglPopupDivisionMenu->Append(DIVISION_MENU_EDIT_LEFT_EDGE, "Edit left edge"); - oglPopupDivisionMenu->Append(DIVISION_MENU_EDIT_TOP_EDGE, "Edit top edge"); - } -} - -void wxOGLCleanUp() -{ - if (GraphicsBuffer) - { - delete[] GraphicsBuffer; - GraphicsBuffer = NULL; - } - GraphicsBuffer = NULL; - if (oglPopupDivisionMenu) - { - delete oglPopupDivisionMenu; - oglPopupDivisionMenu = NULL; - } -} - -wxFont *MatchFont(int point_size) -{ - wxFont *font = wxTheFontList->FindOrCreateFont(point_size, wxSWISS, wxNORMAL, wxNORMAL); -#if 0 - switch (point_size) - { - case 4: - font = swiss_font_4; - break; - case 6: - font = swiss_font_6; - break; - case 8: - font = swiss_font_8; - break; - case 12: - font = swiss_font_12; - break; - case 14: - font = swiss_font_14; - break; - case 18: - font = swiss_font_18; - break; - case 24: - font = swiss_font_24; - break; - default: - case 10: - font = swiss_font_10; - break; - } -#endif - return font; -} - -int FontSizeDialog(wxFrame *parent, int old_size) -{ - if (old_size <= 0) - old_size = 10; - char buf[40]; - sprintf(buf, "%d", old_size); - wxString ans = wxGetTextFromUser("Enter point size", "Font size", buf, parent); - if (ans == "") - return 0; - - int new_size = atoi(ans); - if ((new_size <= 0) || (new_size > 40)) - { - wxMessageBox("Invalid point size!", "Error", wxOK); - return 0; - } - return new_size; -/* - char *strings[8]; - strings[0] = "4"; - strings[1] = "6"; - strings[2] = "8"; - strings[3] = "10"; - strings[4] = "12"; - strings[5] = "14"; - strings[6] = "18"; - strings[7] = "24"; - char *ans = wxGetSingleChoice("Choose", "Choose a font size", 8, strings, parent); - if (ans) - { - int size; - sscanf(ans, "%d", &size); - return MatchFont(size); - } - else return NULL; -*/ -} - -// Centre a list of strings in the given box. xOffset and yOffset are the -// the positions that these lines should be relative to, and this might be -// the same as m_xpos, m_ypos, but might be zero if formatting from left-justifying. -void CentreText(wxDC& dc, wxList *text_list, - float m_xpos, float m_ypos, float width, float height, - int formatMode) -{ - int n = text_list->Number(); - - if (!text_list || (n == 0)) - return; - - // First, get maximum dimensions of box enclosing text - - float char_height = 0; - float max_width = 0; - float current_width = 0; - - // Store text extents for speed - float *widths = new float[n]; - - wxNode *current = text_list->First(); - int i = 0; - while (current) - { - wxShapeTextLine *line = (wxShapeTextLine *)current->Data(); - dc.GetTextExtent(line->GetText(), ¤t_width, &char_height); - widths[i] = current_width; - - if (current_width > max_width) - max_width = current_width; - current = current->Next(); - i ++; - } - - float max_height = n*char_height; - - float xoffset, yoffset, xOffset, yOffset; - - if (formatMode & FORMAT_CENTRE_VERT) - { - if (max_height < height) - yoffset = (float)(m_ypos - (height/2.0) + (height - max_height)/2.0); - else - yoffset = (float)(m_ypos - (height/2.0)); - yOffset = m_ypos; - } - else - { - yoffset = 0.0; - yOffset = 0.0; - } - - if (formatMode & FORMAT_CENTRE_HORIZ) - { - xoffset = (float)(m_xpos - width/2.0); - xOffset = m_xpos; - } - else - { - xoffset = 0.0; - xOffset = 0.0; - } - - current = text_list->First(); - i = 0; - - while (current) - { - wxShapeTextLine *line = (wxShapeTextLine *)current->Data(); - - float x; - if ((formatMode & FORMAT_CENTRE_HORIZ) && (widths[i] < width)) - x = (float)((width - widths[i])/2.0 + xoffset); - else - x = xoffset; - float y = (float)(i*char_height + yoffset); - - line->SetX( x - xOffset ); line->SetY( y - yOffset ); - current = current->Next(); - i ++; - } - - delete widths; -} - -// Centre a list of strings in the given box -void CentreTextNoClipping(wxDC& dc, wxList *text_list, - float m_xpos, float m_ypos, float width, float height) -{ - int n = text_list->Number(); - - if (!text_list || (n == 0)) - return; - - // First, get maximum dimensions of box enclosing text - - float char_height = 0; - float max_width = 0; - float current_width = 0; - - // Store text extents for speed - float *widths = new float[n]; - - wxNode *current = text_list->First(); - int i = 0; - while (current) - { - wxShapeTextLine *line = (wxShapeTextLine *)current->Data(); - dc.GetTextExtent(line->GetText(), ¤t_width, &char_height); - widths[i] = current_width; - - if (current_width > max_width) - max_width = current_width; - current = current->Next(); - i ++; - } - - float max_height = n*char_height; - - float yoffset = (float)(m_ypos - (height/2.0) + (height - max_height)/2.0); - - float xoffset = (float)(m_xpos - width/2.0); - - current = text_list->First(); - i = 0; - - while (current) - { - wxShapeTextLine *line = (wxShapeTextLine *)current->Data(); - - float x = (float)((width - widths[i])/2.0 + xoffset); - float y = (float)(i*char_height + yoffset); - - line->SetX( x - m_xpos ); line->SetY( y - m_ypos ); - current = current->Next(); - i ++; - } - delete widths; -} - -void GetCentredTextExtent(wxDC& dc, wxList *text_list, - float m_xpos, float m_ypos, float width, float height, - float *actual_width, float *actual_height) -{ - int n = text_list->Number(); - - if (!text_list || (n == 0)) - { - *actual_width = 0; - *actual_height = 0; - return; - } - - // First, get maximum dimensions of box enclosing text - - float char_height = 0; - float max_width = 0; - float current_width = 0; - - wxNode *current = text_list->First(); - int i = 0; - while (current) - { - wxShapeTextLine *line = (wxShapeTextLine *)current->Data(); - dc.GetTextExtent(line->GetText(), ¤t_width, &char_height); - - if (current_width > max_width) - max_width = current_width; - current = current->Next(); - i ++; - } - - *actual_height = n*char_height; - *actual_width = max_width; -} - -// Format a string to a list of strings that fit in the given box. -// Interpret %n and 10 or 13 as a new line. -wxList *FormatText(wxDC& dc, const wxString& text, float width, float height, int formatMode) -{ - // First, parse the string into a list of words - wxList word_list; - - // Make new lines into NULL strings at this point - int i = 0; int j = 0; int len = strlen(text); - char word[200]; word[0] = 0; - bool end_word = FALSE; bool new_line = FALSE; - while (i < len) - { - switch (text[i]) - { - case '%': - { - i ++; - if (i == len) - { word[j] = '%'; j ++; } - else - { - if (text[i] == 'n') - { new_line = TRUE; end_word = TRUE; i++; } - else - { word[j] = '%'; j ++; word[j] = text[i]; j ++; i ++; } - } - break; - } - case 10: - { - new_line = TRUE; end_word = TRUE; i++; - break; - } - case 13: - { - new_line = TRUE; end_word = TRUE; i++; - } - case ' ': - { - end_word = TRUE; - i ++; - break; - } - default: - { - word[j] = text[i]; - j ++; i ++; - break; - } - } - if (i == len) end_word = TRUE; - if (end_word) - { - word[j] = 0; - j = 0; - word_list.Append((wxObject *)copystring(word)); - end_word = FALSE; - } - if (new_line) - { - word_list.Append((wxObject *)NULL); - new_line = FALSE; - } - } - // Now, make a list of strings which can fit in the box - wxList *string_list = new wxList; - - char buffer[400]; - buffer[0] = 0; - wxNode *node = word_list.First(); - float x, y; - - while (node) - { - char *keep_string = copystring(buffer); - - char *s = (char *)node->Data(); - if (!s) - { - // FORCE NEW LINE - if (strlen(keep_string) > 0) - string_list->Append((wxObject *)keep_string); - else - delete[] keep_string; - - buffer[0] = 0; - } - else - { - if (buffer[0] != 0) - strcat(buffer, " "); - - strcat(buffer, s); - dc.GetTextExtent(buffer, &x, &y); - - // Don't fit within the bounding box if we're fitting shape to contents - if ((x > width) && !(formatMode & FORMAT_SIZE_TO_CONTENTS)) - { - // Deal with first word being wider than box - if (strlen(keep_string) > 0) - string_list->Append((wxObject *)keep_string); - else - delete[] keep_string; - - buffer[0] = 0; - strcat(buffer, s); - delete[] s; - } - else - delete[] keep_string; - } - - node = node->Next(); - } - if (buffer[0] != 0) - string_list->Append((wxObject *)copystring(buffer)); - - return string_list; -} - -void DrawFormattedText(wxDC& dc, wxList *text_list, - float m_xpos, float m_ypos, float width, float height, - int formatMode) -{ - float xoffset, yoffset; - if (formatMode & FORMAT_CENTRE_HORIZ) - xoffset = m_xpos; - else - xoffset = (float)(m_xpos - (width / 2.0)); - - if (formatMode & FORMAT_CENTRE_VERT) - yoffset = m_ypos; - else - yoffset = (float)(m_ypos - (height / 2.0)); - - dc.SetClippingRegion( - (float)(m_xpos - width/2.0), (float)(m_ypos - height/2.0), - (float)width, (float)height); - - wxNode *current = text_list->First(); - while (current) - { - wxShapeTextLine *line = (wxShapeTextLine *)current->Data(); - - dc.DrawText(line->GetText(), xoffset + line->GetX(), yoffset + line->GetY()); - current = current->Next(); - } - - dc.DestroyClippingRegion(); -} - -/* - * Find centroid given list of points comprising polyline - * - */ - -void find_polyline_centroid(wxList *points, float *x, float *y) -{ - float xcount = 0; - float ycount = 0; - - wxNode *node = points->First(); - while (node) - { - wxRealPoint *point = (wxRealPoint *)node->Data(); - xcount += point->x; - ycount += point->y; - node = node->Next(); - } - - *x = (xcount/points->Number()); - *y = (ycount/points->Number()); -} - -/* - * Check that (x1, y1) -> (x2, y2) hits (x3, y3) -> (x4, y4). - * If so, ratio1 gives the proportion along the first line - * that the intersection occurs (or something like that). - * Used by functions below. - * - */ -void check_line_intersection(float x1, float y1, float x2, float y2, - float x3, float y3, float x4, float y4, - float *ratio1, float *ratio2) -{ - float denominator_term = (y4 - y3)*(x2 - x1) - (y2 - y1)*(x4 - x3); - float numerator_term = (x3 - x1)*(y4 - y3) + (x4 - x3)*(y1 - y3); - - float line_constant; - float length_ratio = 1.0; - float k_line = 1.0; - - // Check for parallel lines - if ((denominator_term < 0.005) && (denominator_term > -0.005)) - line_constant = -1.0; - else - line_constant = numerator_term/denominator_term; - - // Check for intersection - if ((line_constant < 1.0) && (line_constant > 0.0)) - { - // Now must check that other line hits - if (((y4 - y3) < 0.005) && ((y4 - y3) > -0.005)) - k_line = ((x1 - x3) + line_constant*(x2 - x1))/(x4 - x3); - else - k_line = ((y1 - y3) + line_constant*(y2 - y1))/(y4 - y3); - - if ((k_line >= 0.0) && (k_line < 1.0)) - length_ratio = line_constant; - else - k_line = 1.0; - } - *ratio1 = length_ratio; - *ratio2 = k_line; -} - -/* - * Find where (x1, y1) -> (x2, y2) hits one of the lines in xvec, yvec. - * (*x3, *y3) is the point where it hits. - * - */ -void find_end_for_polyline(float n, float xvec[], float yvec[], - float x1, float y1, float x2, float y2, float *x3, float *y3) -{ - int i; - float lastx = xvec[0]; - float lasty = yvec[0]; - - float min_ratio = 1.0; - float line_ratio; - float other_ratio; - - for (i = 1; i < n; i++) - { - check_line_intersection(x1, y1, x2, y2, lastx, lasty, xvec[i], yvec[i], - &line_ratio, &other_ratio); - lastx = xvec[i]; - lasty = yvec[i]; - - if (line_ratio < min_ratio) - min_ratio = line_ratio; - } - - // Do last (implicit) line if last and first floats are not identical - if (!(xvec[0] == lastx && yvec[0] == lasty)) - { - check_line_intersection(x1, y1, x2, y2, lastx, lasty, xvec[0], yvec[0], - &line_ratio, &other_ratio); - - if (line_ratio < min_ratio) - min_ratio = line_ratio; - } - - *x3 = (x1 + (x2 - x1)*min_ratio); - *y3 = (y1 + (y2 - y1)*min_ratio); - -} - -/* - * Find where the line hits the box. - * - */ - -void find_end_for_box(float width, float height, - float x1, float y1, // Centre of box (possibly) - float x2, float y2, // other end of line - float *x3, float *y3) // End on box edge -{ - float xvec[5]; - float yvec[5]; - - xvec[0] = (float)(x1 - width/2.0); - yvec[0] = (float)(y1 - height/2.0); - xvec[1] = (float)(x1 - width/2.0); - yvec[1] = (float)(y1 + height/2.0); - xvec[2] = (float)(x1 + width/2.0); - yvec[2] = (float)(y1 + height/2.0); - xvec[3] = (float)(x1 + width/2.0); - yvec[3] = (float)(y1 - height/2.0); - xvec[4] = (float)(x1 - width/2.0); - yvec[4] = (float)(y1 - height/2.0); - - find_end_for_polyline(5, xvec, yvec, x2, y2, x1, y1, x3, y3); -} - -/* - * Find where the line hits the circle. - * - */ - -void find_end_for_circle(float radius, - float x1, float y1, // Centre of circle - float x2, float y2, // Other end of line - float *x3, float *y3) -{ - float H = (float)sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)); - - if (H == 0.0) - { - *x3 = x1; - *y3 = y1; - } - else - { - *y3 = radius * (y2 - y1)/H + y1; - *x3 = radius * (x2 - x1)/H + x1; - } -} - -/* - * Given the line (x1, y1) -> (x2, y2), and an arrow size of given length and width, - * return the position of the tip of the arrow and the left and right vertices of the arrow. - * - */ - -void get_arrow_points(float x1, float y1, float x2, float y2, - float length, float width, - float *tip_x, float *tip_y, - float *side1_x, float *side1_y, - float *side2_x, float *side2_y) -{ - float l = (float)sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1)); - - if (l < 0.01) - l = (float) 0.01; - - float i_bar = (x2 - x1)/l; - float j_bar = (y2 - y1)/l; - - float x3 = (- length*i_bar) + x2; - float y3 = (- length*j_bar) + y2; - - *side1_x = width*(-j_bar) + x3; - *side1_y = width*i_bar + y3; - - *side2_x = -width*(-j_bar) + x3; - *side2_y = -width*i_bar + y3; - - *tip_x = x2; *tip_y = y2; -} - -/* - * Given an ellipse and endpoints of a line, returns the point at which - * the line touches the ellipse in values x4, y4. - * This function assumes that the centre of the ellipse is at x1, y1, and the - * ellipse has a width of width1 and a height of height1. It also assumes you are - * wanting to draw an arc FROM point x2, y2 TOWARDS point x3, y3. - * This function calculates the x,y coordinates of the intersection point of - * the arc with the ellipse. - * Author: Ian Harrison - */ - -void draw_arc_to_ellipse(float x1, float y1, float width1, float height1, float x2, float y2, float x3, float y3, - float *x4, float *y4) -{ - float a1 = (float)(width1/2.0); - float b1 = (float)(height1/2.0); - - // These are required to give top left x and y coordinates for DrawEllipse -// float top_left_x1 = (float)(x1 - a1); -// float top_left_y1 = (float)(y1 - b1); -/* - // Check for vertical line - if (fabs(x2 - x3) < 0.05) - { - *x4 = x3; - if (y2 < y3) - *y4 = (float)(y1 - b1); - else - *y4 = (float)(y1 + b1); - return; - } -*/ - // Check that x2 != x3 - if (fabs(x2 - x3) < 0.05) - { - *x4 = x2; - if (y3 > y2) - *y4 = (float)(y1 - sqrt((b1*b1 - (((x2-x1)*(x2-x1))*(b1*b1)/(a1*a1))))); - else - *y4 = (float)(y1 + sqrt((b1*b1 - (((x2-x1)*(x2-x1))*(b1*b1)/(a1*a1))))); - return; - } - - // Calculate the x and y coordinates of the point where arc intersects ellipse - - float A, B, C, D, E, F, G, H, K; - float ellipse1_x, ellipse1_y; - - A = (float)(1/(a1 * a1)); - B = (float)((y3 - y2) * (y3 - y2)) / ((x3 - x2) * (x3 - x2) * b1 * b1); - C = (float)(2 * (y3 - y2) * (y2 - y1)) / ((x3 - x2) * b1 * b1); - D = (float)((y2 - y1) * (y2 - y1)) / (b1 * b1); - E = (float)(A + B); - F = (float)(C - (2 * A * x1) - (2 * B * x2)); - G = (float)((A * x1 * x1) + (B * x2 * x2) - (C * x2) + D - 1); - H = (float)((y3 - y2) / (x3 - x2)); - K = (float)((F * F) - (4 * E * G)); - - if (K >= 0) - // In this case the line intersects the ellipse, so calculate intersection - { - if(x2 >= x1) - { - ellipse1_x = (float)(((F * -1) + sqrt(K)) / (2 * E)); - ellipse1_y = (float)((H * (ellipse1_x - x2)) + y2); - } - else - { - ellipse1_x = (float)(((F * -1) - sqrt(K)) / (2 * E)); - ellipse1_y = (float)((H * (ellipse1_x - x2)) + y2); - } - } - else - // in this case, arc does not intersect ellipse, so just draw arc - { - ellipse1_x = x3; - ellipse1_y = y3; - } - *x4 = ellipse1_x; - *y4 = ellipse1_y; - -/* - // Draw a little circle (radius = 2) at the end of the arc where it hits - // the ellipse . - - float circle_x = ellipse1_x - 2.0; - float circle_y = ellipse1_y - 2.0; - m_canvas->DrawEllipse(circle_x, circle_y, 4.0, 4.0); -*/ -} - -// Update a list item from a list of strings -void UpdateListBox(wxListBox *item, wxList *list) -{ - item->Clear(); - if (!list) - return; - - wxNode *node = list->First(); - while (node) - { - char *s = (char *)node->Data(); - item->Append(s); - node = node->Next(); - } -} - - diff --git a/utils/ogl/src/misc.h b/utils/ogl/src/misc.h deleted file mode 100644 index fb4ca0144b..0000000000 --- a/utils/ogl/src/misc.h +++ /dev/null @@ -1,107 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: misc.h -// Purpose: Miscellaneous utilities for OGL -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_MISC_H_ -#define _OGL_MISC_H_ - -#ifdef __GNUG__ -#pragma interface "misc.h" -#endif - -// List to use when copying objects; may need to associate elements of new objects -// with elements of old objects, e.g. when copying constraint.s -extern wxList wxObjectCopyMapping; - -/* - * TEXT FORMATTING FUNCTIONS - * - */ - -// Centres the given list of wxShapeTextLine strings in the given box -// (changing the positions in situ). Doesn't actually draw into the DC. -void CentreText(wxDC& dc, wxList *text, float m_xpos, float m_ypos, - float width, float height, - int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT); - -// Given a string, returns a list of strings that fit within the given -// width of box. Height is ignored. -wxList *FormatText(wxDC& dc, const wxString& text, float width, float height, int formatMode = 0); - -// Centres the list of wxShapeTextLine strings, doesn't clip. -// Doesn't actually draw into the DC. -void CentreTextNoClipping(wxDC& dc, wxList *text_list, - float m_xpos, float m_ypos, float width, float height); - -// Gets the maximum width and height of the given list of wxShapeTextLines. -void GetCentredTextExtent(wxDC& dc, wxList *text_list, - float m_xpos, float m_ypos, float width, float height, - float *actual_width, float *actual_height); - -// Actually draw the preformatted list of wxShapeTextLines. -void DrawFormattedText(wxDC& context, wxList *text_list, - float m_xpos, float m_ypos, float width, float height, - int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT); - -// Give it a list of points, finds the centre. -void find_polyline_centroid(wxList *points, float *x, float *y); - -void check_line_intersection(float x1, float y1, float x2, float y2, - float x3, float y3, float x4, float y4, - float *ratio1, float *ratio2); - -void find_end_for_polyline(float n, float xvec[], float yvec[], - float x1, float y1, float x2, float y2, float *x3, float *y3); - - -void find_end_for_box(float width, float height, - float x1, float y1, // Centre of box (possibly) - float x2, float y2, // other end of line - float *x3, float *y3); // End on box edge - -void find_end_for_circle(float radius, - float x1, float y1, // Centre of circle - float x2, float y2, // Other end of line - float *x3, float *y3); - -void get_arrow_points(float x1, float y1, float x2, float y2, - float length, float width, - float *tip_x, float *tip_y, - float *side1_x, float *side1_y, - float *side2_x, float *side2_y); - -/* - * Given an ellipse and endpoints of a line, returns the point at which - * the line touches the ellipse in values x4, y4. - * This function assumes that the centre of the ellipse is at x1, y1, and the - * ellipse has a width of a1 and a height of b1. It also assumes you are - * wanting to draw an arc FROM point x2, y2 TOWARDS point x3, y3. - * This function calculates the x,y coordinates of the intersection point of - * the arc with the ellipse. - * Author: Ian Harrison - */ - -void draw_arc_to_ellipse(float x1, float y1, float a1, float b1, float x2, float y2, float x3, float y3, - float *x4, float *y4); - -extern wxFont *g_oglNormalFont; -extern wxPen *black_pen; - -extern wxPen *white_background_pen; -extern wxPen *transparent_pen; -extern wxBrush *white_background_brush; -extern wxPen *black_foreground_pen; - -extern wxCursor *GraphicsBullseyeCursor; - -extern wxFont *MatchFont(int point_size); - -#endif - // _OGL_MISC_H_ diff --git a/utils/ogl/src/ogl.h b/utils/ogl/src/ogl.h deleted file mode 100644 index 7f5080da11..0000000000 --- a/utils/ogl/src/ogl.h +++ /dev/null @@ -1,26 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: ogl.h -// Purpose: OGL main include -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_OGL_H_ -#define _OGL_OGL_H_ - -#include "basic.h" // Basic shapes -#include "lines.h" // Lines and splines -#include "divided.h" // Vertically-divided rectangle -#include "composit.h" // Composite images -#include "canvas.h" // wxShapeCanvas for displaying objects -#include "ogldiag.h" // wxDiagram - -extern void wxOGLInitialize(); -extern void wxOGLCleanUp(); - -#endif - // _OGL_OGL_H_ diff --git a/utils/ogl/src/ogldiag.cpp b/utils/ogl/src/ogldiag.cpp deleted file mode 100644 index 198b3073d4..0000000000 --- a/utils/ogl/src/ogldiag.cpp +++ /dev/null @@ -1,580 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: ogldiag.cpp -// Purpose: wxDiagram -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "ogldiag.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include -#endif - -#ifdef PROLOGIO -#include -#endif - -#if USE_IOSTREAMH -#include -#else -#include -#endif - -#include -#include -#include -#include - -#include "basic.h" -#include "basicp.h" -#include "canvas.h" -#include "ogldiag.h" -#include "lines.h" -#include "composit.h" -#include "misc.h" - -IMPLEMENT_DYNAMIC_CLASS(wxDiagram, wxObject) - -// Object canvas -wxDiagram::wxDiagram() -{ - m_diagramCanvas = NULL; - m_quickEditMode = FALSE; - m_snapToGrid = TRUE; - m_gridSpacing = 5.0; - m_shapeList = new wxList; - m_mouseTolerance = DEFAULT_MOUSE_TOLERANCE; -} - -wxDiagram::~wxDiagram() -{ - if (m_shapeList) - delete m_shapeList; -} - -void wxDiagram::SetSnapToGrid(bool snap) -{ - m_snapToGrid = snap; -} - -void wxDiagram::SetGridSpacing(float spacing) -{ - m_gridSpacing = spacing; -} - -void wxDiagram::Snap(float *x, float *y) -{ - if (m_snapToGrid) - { - *x = m_gridSpacing * ((int)(*x/m_gridSpacing + 0.5)); - *y = m_gridSpacing * ((int)(*y/m_gridSpacing + 0.5)); - } -} - - -void wxDiagram::Redraw(wxDC& dc) -{ - if (m_shapeList) - { - if (GetCanvas()) - GetCanvas()->SetCursor(wxHOURGLASS_CURSOR); - wxNode *current = m_shapeList->First(); - - while (current) - { - wxShape *object = (wxShape *)current->Data(); - if (!object->GetParent()) - object->Draw(dc); - - current = current->Next(); - } - if (GetCanvas()) - GetCanvas()->SetCursor(wxSTANDARD_CURSOR); - } -} - -void wxDiagram::Clear(wxDC& dc) -{ - dc.Clear(); -} - -// Insert object after addAfter, or at end of list. -void wxDiagram::AddShape(wxShape *object, wxShape *addAfter) -{ - wxNode *nodeAfter = NULL; - if (addAfter) - nodeAfter = m_shapeList->Member(addAfter); - - if (!m_shapeList->Member(object)) - { - if (nodeAfter) - { - if (nodeAfter->Next()) - m_shapeList->Insert(nodeAfter->Next(), object); - else - m_shapeList->Append(object); - } - else - m_shapeList->Append(object); - object->SetCanvas(GetCanvas()); - } -} - -void wxDiagram::InsertShape(wxShape *object) -{ - m_shapeList->Insert(object); - object->SetCanvas(GetCanvas()); -} - -void wxDiagram::RemoveShape(wxShape *object) -{ - m_shapeList->DeleteObject(object); -} - -// Should this delete the actual objects too? I think not. -void wxDiagram::RemoveAllShapes() -{ - m_shapeList->Clear(); -} - -void wxDiagram::DeleteAllShapes() -{ - wxNode *node = m_shapeList->First(); - while (node) - { - wxShape *shape = (wxShape *)node->Data(); - if (!shape->GetParent()) - { - RemoveShape(shape); - delete shape; - node = m_shapeList->First(); - } - else - node = node->Next(); - } -} - -void wxDiagram::ShowAll(bool show) -{ - wxNode *current = m_shapeList->First(); - - while (current) - { - wxShape *object = (wxShape *)current->Data(); - object->Show(show); - - current = current->Next(); - } -} - -void wxDiagram::DrawOutline(wxDC& dc, float x1, float y1, float x2, float y2) -{ - wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT); - dc.SetPen(dottedPen); - dc.SetBrush((* wxTRANSPARENT_BRUSH)); - - wxPoint points[5]; - - points[0].x = x1; - points[0].y = y1; - - points[1].x = x2; - points[1].y = y1; - - points[2].x = x2; - points[2].y = y2; - - points[3].x = x1; - points[3].y = y2; - - points[4].x = x1; - points[4].y = y1; - dc.DrawLines(5, points); -} - -// Make sure all text that should be centred, is centred. -void wxDiagram::RecentreAll(wxDC& dc) -{ - wxNode *object_node = m_shapeList->First(); - while (object_node) - { - wxShape *obj = (wxShape *)object_node->Data(); - obj->Recentre(dc); - object_node = object_node->Next(); - } -} - -// Input/output -#ifdef PROLOGIO -bool wxDiagram::SaveFile(const wxString& filename) -{ - wxBeginBusyCursor(); - - wxExprDatabase *database = new wxExprDatabase; - - // First write the diagram type - wxExpr *header = new wxExpr("diagram"); - OnHeaderSave(*database, *header); - - database->Append(header); - - wxNode *node = m_shapeList->First(); - while (node) - { - wxShape *shape = (wxShape *)node->Data(); - - if (!shape->IsKindOf(CLASSINFO(wxControlPoint))) - { - wxExpr *expr = NULL; - if (shape->IsKindOf(CLASSINFO(wxLineShape))) - expr = new wxExpr("line"); - else - expr = new wxExpr("shape"); - - OnShapeSave(*database, *shape, *expr); - } - node = node->Next(); - } - OnDatabaseSave(*database); - - char tempFile[400]; - wxGetTempFileName("diag", tempFile); - ofstream stream(tempFile); - if (stream.bad()) - { - wxEndBusyCursor(); - delete database; - return FALSE; - } - - database->Write(stream); - stream.close(); - delete database; - -/* - // Save backup - if (FileExists(filename)) - { - char buf[400]; -#ifdef __X__ - sprintf(buf, "%s.bak", filename); -#endif -#ifdef __WXMSW__ - sprintf(buf, "_diagram.bak"); -#endif - if (FileExists(buf)) wxRemoveFile(buf); - if (!wxRenameFile(filename, buf)) - { - wxCopyFile(filename, buf); - wxRemoveFile(filename); - } - } -*/ - - // Copy the temporary file to the correct filename - if (!wxRenameFile(tempFile, filename)) - { - wxCopyFile(tempFile, filename); - wxRemoveFile(tempFile); - } - - wxEndBusyCursor(); - return TRUE; -} - -bool wxDiagram::LoadFile(const wxString& filename) -{ - wxBeginBusyCursor(); - - wxExprDatabase database(PrologInteger, "id"); - if (!database.Read(filename)) - { - wxEndBusyCursor(); - return FALSE; - } - - DeleteAllShapes(); - - database.BeginFind(); - wxExpr *header = database.FindClauseByFunctor("diagram"); - - if (header) - OnHeaderLoad(database, *header); - - // Scan through all clauses and register the ids - wxNode *node = database.First(); - while (node) - { - wxExpr *clause = (wxExpr *)node->Data(); - long id = -1; - clause->GetAttributeValue("id", id); - RegisterId(id); - node = node->Next(); - } - - ReadNodes(database); - ReadContainerGeometry(database); - ReadLines(database); - - OnDatabaseLoad(database); - - wxEndBusyCursor(); - - return TRUE; -} - -void wxDiagram::ReadNodes(wxExprDatabase& database) -{ - // Find and create the node images - database.BeginFind(); - wxExpr *clause = database.FindClauseByFunctor("shape"); - while (clause) - { - char *type = NULL; - long parentId = -1; - - clause->AssignAttributeValue("type", &type); - clause->AssignAttributeValue("parent", &parentId); - wxClassInfo *classInfo = wxClassInfo::FindClass(type); - if (classInfo) - { - wxShape *shape = (wxShape *)classInfo->CreateObject(); - OnShapeLoad(database, *shape, *clause); - - shape->SetCanvas(GetCanvas()); - shape->Show(TRUE); - - m_shapeList->Append(shape); - - // If child of composite, link up - if (parentId > -1) - { - wxExpr *parentExpr = database.HashFind("shape", parentId); - if (parentExpr && parentExpr->GetClientData()) - { - wxShape *parent = (wxShape *)parentExpr->GetClientData(); - shape->SetParent(parent); - parent->GetChildren().Append(shape); - } - } - - clause->SetClientData(shape); - } - if (type) - delete[] type; - - clause = database.FindClauseByFunctor("shape"); - } - return; -} - -void wxDiagram::ReadLines(wxExprDatabase& database) -{ - database.BeginFind(); - wxExpr *clause = database.FindClauseByFunctor("line"); - while (clause) - { - wxString type(""); - long parentId = -1; - - clause->GetAttributeValue("type", type); - clause->GetAttributeValue("parent", parentId); - wxClassInfo *classInfo = wxClassInfo::FindClass((char*) (const char*) type); - if (classInfo) - { - wxLineShape *shape = (wxLineShape *)classInfo->CreateObject(); - shape->Show(TRUE); - - OnShapeLoad(database, *shape, *clause); - - long image_to = -1; long image_from = -1; - clause->GetAttributeValue("to", image_to); - clause->GetAttributeValue("from", image_from); - - wxExpr *image_to_expr = database.HashFind("shape", image_to); - - if (!image_to_expr) - { - // Error - } - wxExpr *image_from_expr = database.HashFind("shape", image_from); - - if (!image_from_expr) - { - // Error - } - - if (image_to_expr && image_from_expr) - { - wxShape *image_to_object = (wxShape *)image_to_expr->GetClientData(); - wxShape *image_from_object = (wxShape *)image_from_expr->GetClientData(); - - if (image_to_object && image_from_object) - { - image_from_object->AddLine(shape, image_to_object, shape->GetAttachmentFrom(), shape->GetAttachmentTo()); - } - } - clause->SetClientData(shape); - - m_shapeList->Append(shape); - } - - clause = database.FindClauseByFunctor("line"); - } -} - -// Containers have divisions that reference adjoining divisions, -// so we need a separate pass to link everything up. -// Also used by Symbol Library. -void wxDiagram::ReadContainerGeometry(wxExprDatabase& database) -{ - database.BeginFind(); - wxExpr *clause = database.FindClauseByFunctor("shape"); - while (clause) - { - wxShape *image = (wxShape *)clause->GetClientData(); - if (image && image->IsKindOf(CLASSINFO(wxCompositeShape))) - { - wxCompositeShape *composite = (wxCompositeShape *)image; - wxExpr *divisionExpr = NULL; - - // Find the list of divisions in the composite - clause->GetAttributeValue("divisions", &divisionExpr); - if (divisionExpr) - { - int i = 0; - wxExpr *idExpr = divisionExpr->Nth(i); - while (idExpr) - { - long divisionId = idExpr->IntegerValue(); - wxExpr *childExpr = database.HashFind("shape", divisionId); - if (childExpr && childExpr->GetClientData()) - { - wxDivisionShape *child = (wxDivisionShape *)childExpr->GetClientData(); - composite->GetDivisions().Append(child); - - // Find the adjoining shapes - long leftSideId = -1; - long topSideId = -1; - long rightSideId = -1; - long bottomSideId = -1; - childExpr->GetAttributeValue("left_side", leftSideId); - childExpr->GetAttributeValue("top_side", topSideId); - childExpr->GetAttributeValue("right_side", rightSideId); - childExpr->GetAttributeValue("bottom_side", bottomSideId); - if (leftSideId > -1) - { - wxExpr *leftExpr = database.HashFind("shape", leftSideId); - if (leftExpr && leftExpr->GetClientData()) - { - wxDivisionShape *leftSide = (wxDivisionShape *)leftExpr->GetClientData(); - child->SetLeftSide(leftSide); - } - } - if (topSideId > -1) - { - wxExpr *topExpr = database.HashFind("shape", topSideId); - if (topExpr && topExpr->GetClientData()) - { - wxDivisionShape *topSide = (wxDivisionShape *)topExpr->GetClientData(); - child->SetTopSide(topSide); - } - } - if (rightSideId > -1) - { - wxExpr *rightExpr = database.HashFind("shape", rightSideId); - if (rightExpr && rightExpr->GetClientData()) - { - wxDivisionShape *rightSide = (wxDivisionShape *)rightExpr->GetClientData(); - child->SetRightSide(rightSide); - } - } - if (bottomSideId > -1) - { - wxExpr *bottomExpr = database.HashFind("shape", bottomSideId); - if (bottomExpr && bottomExpr->GetClientData()) - { - wxDivisionShape *bottomSide = (wxDivisionShape *)bottomExpr->GetClientData(); - child->SetBottomSide(bottomSide); - } - } - } - i ++; - idExpr = divisionExpr->Nth(i); - } - } - } - - clause = database.FindClauseByFunctor("shape"); - } -} - -// Allow for modifying file -bool wxDiagram::OnDatabaseLoad(wxExprDatabase& db) -{ - return TRUE; -} - -bool wxDiagram::OnDatabaseSave(wxExprDatabase& db) -{ - return TRUE; -} - -bool wxDiagram::OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr) -{ - shape.WritePrologAttributes(&expr); - db.Append(&expr); - - if (shape.IsKindOf(CLASSINFO(wxCompositeShape))) - { - wxNode *node = shape.GetChildren().First(); - while (node) - { - wxShape *childShape = (wxShape *)node->Data(); - wxExpr *childExpr = new wxExpr("shape"); - OnShapeSave(db, *childShape, *childExpr); - node = node->Next(); - } - } - - return TRUE; -} - -bool wxDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr) -{ - shape.ReadPrologAttributes(&expr); - return TRUE; -} - -bool wxDiagram::OnHeaderSave(wxExprDatabase& db, wxExpr& expr) -{ - return TRUE; -} - -bool wxDiagram::OnHeaderLoad(wxExprDatabase& db, wxExpr& expr) -{ - return TRUE; -} - -#endif - -void wxDiagram::SetCanvas(wxShapeCanvas *can) -{ - m_diagramCanvas = can; -} - - diff --git a/utils/ogl/src/ogldiag.h b/utils/ogl/src/ogldiag.h deleted file mode 100644 index 4f45eb0d42..0000000000 --- a/utils/ogl/src/ogldiag.h +++ /dev/null @@ -1,94 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: ogldiag.h -// Purpose: OGL - wxDiagram class -// Author: Julian Smart -// Modified by: -// Created: 12/07/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OGL_OGLDIAG_H_ -#define _OGL_OGLDIAG_H_ - -#ifdef __GNUG__ -#pragma interface "ogldiag.h" -#endif - -#include "basic.h" - -class wxDiagram: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxDiagram) - -public: - - wxDiagram(); - virtual ~wxDiagram(); - - void SetCanvas(wxShapeCanvas *can); - - inline wxShapeCanvas *GetCanvas() const { return m_diagramCanvas; } - - virtual void Redraw(wxDC& dc); - virtual void Clear(wxDC& dc); - virtual void DrawOutline(wxDC& dc, float x1, float y1, float x2, float y2); - - // Add object to end of object list (if addAfter is NULL) - // or just after addAfter. - virtual void AddShape(wxShape *object, wxShape *addAfter = NULL); - - // Add object to front of object list - virtual void InsertShape(wxShape *object); - - void SetSnapToGrid(bool snap); - void SetGridSpacing(float spacing); - inline float GetGridSpacing() { return m_gridSpacing; } - inline bool GetSnapToGrid() const { return m_snapToGrid; } - void Snap(float *x, float *y); - - inline void SetQuickEditMode(bool qem) { m_quickEditMode = qem; } - inline bool GetQuickEditMode() const { return m_quickEditMode; } - - virtual void RemoveShape(wxShape *object); - virtual void RemoveAllShapes(); - virtual void DeleteAllShapes(); - virtual void ShowAll(bool show); - - inline void SetMouseTolerance(int tol) { m_mouseTolerance = tol; } - inline int GetMouseTolerance() const { return m_mouseTolerance; } - inline wxList *GetShapeList() const { return m_shapeList; } - - // Make sure all text that should be centred, is centred. - void RecentreAll(wxDC& dc); - -#ifdef PROLOGIO - // Prolog database stuff - virtual bool SaveFile(const wxString& filename); - virtual bool LoadFile(const wxString& filename); - - virtual void ReadNodes(wxExprDatabase& database); - virtual void ReadLines(wxExprDatabase& database); - virtual void ReadContainerGeometry(wxExprDatabase& database); - - // Allow for modifying file - virtual bool OnDatabaseLoad(wxExprDatabase& db); - virtual bool OnDatabaseSave(wxExprDatabase& db); - virtual bool OnShapeSave(wxExprDatabase& db, wxShape& shape, wxExpr& expr); - virtual bool OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr); - virtual bool OnHeaderSave(wxExprDatabase& db, wxExpr& expr); - virtual bool OnHeaderLoad(wxExprDatabase& db, wxExpr& expr); -#endif - -protected: - wxShapeCanvas* m_diagramCanvas; - bool m_quickEditMode; - bool m_snapToGrid; - float m_gridSpacing; - int m_mouseTolerance; - wxList* m_shapeList; -}; - -#endif - // _OGL_OGLDIAG_H_ diff --git a/utils/wxprop/docs/back.gif b/utils/wxprop/docs/back.gif deleted file mode 100644 index 8a61076d3b..0000000000 Binary files a/utils/wxprop/docs/back.gif and /dev/null differ diff --git a/utils/wxprop/docs/body.tex b/utils/wxprop/docs/body.tex deleted file mode 100644 index 1a03a2533e..0000000000 --- a/utils/wxprop/docs/body.tex +++ /dev/null @@ -1,106 +0,0 @@ -\chapter{Introduction}\label{introduction} -\pagenumbering{arabic}% -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage}% - -The Property Sheet Classes help the programmer to specify complex dialogs and -their relationship with their associated data. By specifying data as a -wxPropertySheet containing wxProperty objects, the programmer can use -a range of available or custom wxPropertyView classes to allow the user to -edit this data. Classes derived from wxPropertyView act as mediators between the -wxPropertySheet and the actual window (and associated panel items). - -For example, the wxPropertyListView is a kind of wxPropertyView which displays -data in a Visual Basic-style property list (see \helpref{the next section}{appearance} for -screen shots). This is a listbox containing names and values, with -an edit control and other optional controls via which the user edits the selected -data item. - -wxPropertyFormView is another kind of wxPropertyView which mediates between -the data and a panel or dialog box which has already been created. This makes it a contender for -the replacement of wxForm, since programmer-controlled layout is going to be much more -satisfactory. If automatic layout is desired, then wxPropertyListView could be used instead. - -The main intention of this class library was to provide property {\it list} behaviour, but -it has been generalised as much as possible so that the concept of a property sheet and its viewers -can reduce programming effort in a range of user interface tasks. - -For further details on the classes and how they are used, please see \helpref{Property classes overview}{propertyoverview}. - -\section{The appearance and behaviour of a property list view}\label{appearance} - -The property list, as seen in an increasing number of development tools -such as Visual Basic and Delphi, is a convenient and compact method for -displaying and editing a number of items without the need for one -control per item, and without the need for designing a special form. The -controls are as follows: - -\begin{itemize}\itemsep=0pt -\item A listbox showing the properties and their current values, which has double-click -properties dependent on the nature of the current property; -\item a text editing area at the top of the display, allowing the user to edit -the currently selected property if appropriate; -\item `confirm' and `cancel' buttons to confirm or cancel an edit (for the property, not the -whole sheet); -\item an optional list that appears when the user can make a choice from several known possible values; -\item a small Edit button to invoke `detailed editing' (perhaps showing or hiding the above value list, or -maybe invoking a common dialog); -\item optional OK/Close, Cancel and Help buttons for the whole dialog. -\end{itemize} - -The concept of `detailed editing' versus quick editing gives the user a choice -of editing mode, so novice and expert behaviour can be catered for, or the user can just -use what he feels comfortable with. - -Behaviour alters depending on the kind of property being edited. For example, a boolean value has -the following behaviour: - -\begin{itemize}\itemsep=0pt -\item Double-clicking on the item toggles between TRUE and FALSE. -\item Showing the value list enables the user to select TRUE or FALSE. -\item The user may be able to type in the word TRUE or FALSE, or the edit control -may be read-only to disallow this since it is error-prone. -\end{itemize} - -A list of strings may pop up a dialog for editing them, a simple string just allows text editing, -double-clicking a colour property may show a colour selector, double-clicking on a filename property may -show a file selector (in addition to being able to type in the name in the edit control), etc. - -Note that the `type' of property, such as string or integer, does not -necessarily determine the behaviour of the property. The programmer has -to be able to specify different behaviours for the same type, depending -on the meaning of the property. For example, a colour and a filename may -both be strings, but their editing behaviour should be different. This -is why objects of type wxPropertyValidator need to be used, to define -behaviour for a given class of properties or even specific property -name. Objects of class wxPropertyView contain a list of property -registries, which enable reuse of bunches of these validators in -different circumstances. Or a wxProperty can be explicitly set to use a -particular validator object. - -The following screen shot of the property classes test program shows the -user editing a string, which is constrained to be one of three possible -values. - -$$\image{8cm;0cm}{prop1.eps}$$\\ - -The second picture shows the user having entered a integer that -was outside the range specified to the validator. Note that in this picture, -the value list is hidden because it is not used when editing an integer. - -$$\image{8cm;0cm}{prop2.eps}$$ - -\chapter{Files}\label{files} -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage}% - -The property class library comprises the following files: - -\begin{itemize}\itemsep=0pt -\item wx\_prop.h: base property class header -\item wx\_plist.h: wxPropertyListView and associated classes -\item wx\_pform.h: wxPropertyListView and associated classes -\item wx\_prop.cc: base property class implementation -\item wx\_plist.cc: wxPropertyListView and associated class implementions -\item wx\_pform.cc: wxPropertyFormView and associated class implementions -\end{itemize} diff --git a/utils/wxprop/docs/books.bmp b/utils/wxprop/docs/books.bmp deleted file mode 100644 index cf1e148734..0000000000 Binary files a/utils/wxprop/docs/books.bmp and /dev/null differ diff --git a/utils/wxprop/docs/books.gif b/utils/wxprop/docs/books.gif deleted file mode 100644 index 036d016fb1..0000000000 Binary files a/utils/wxprop/docs/books.gif and /dev/null differ diff --git a/utils/wxprop/docs/bullet.bmp b/utils/wxprop/docs/bullet.bmp deleted file mode 100644 index aad8fc793e..0000000000 Binary files a/utils/wxprop/docs/bullet.bmp and /dev/null differ diff --git a/utils/wxprop/docs/changes.tex b/utils/wxprop/docs/changes.tex deleted file mode 100644 index 83c0a81188..0000000000 --- a/utils/wxprop/docs/changes.tex +++ /dev/null @@ -1,22 +0,0 @@ -\chapter{Change log}\label{changes} -\pagenumbering{arabic}% -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage}% - -November 26th 1995, Version 1.1 - -\begin{itemize}\itemsep=0pt -\item Added wxListOfStringsListValidator - allows adding, deleting, editing -strings. -\item Added wxPropertyValue::ClearList, wxPropertyValue::Delete, -wxPropertyValue::wxPropertyValue(wxStringList *). -\item Added wxPropertyValue::Set/GetModified, wxPropertySheet::SetAllModified. -\item Added wxPropertyView::OnPropertyChanged support, for immediate feedback. -\end{itemize} - -October 1995, Version 1.0 - -\begin{itemize}\itemsep=0pt -\item First release. -\end{itemize} - diff --git a/utils/wxprop/docs/classes.tex b/utils/wxprop/docs/classes.tex deleted file mode 100644 index d197d77d6d..0000000000 --- a/utils/wxprop/docs/classes.tex +++ /dev/null @@ -1,1756 +0,0 @@ -\chapter{Alphabetical class reference}\label{classref} -\setheader{{\it CHAPTER \thechapter}}{}{}{}{}{{\it CHAPTER \thechapter}}% -\setfooter{\thepage}{}{}{}{}{\thepage}% - -\overview{Property classes overview}{propertyoverview} - - -\section{\class{wxBoolFormValidator}: wxPropertyFormValidator}\label{wxboolformvalidator} - -\overview{Validator classes}{validatorclasses} - -This class validates a boolean value for a form view. The associated panel item must be a wxCheckBox. - -\membersection{wxBoolFormValidator::wxBoolFormValidator} - -\func{void}{wxBoolFormValidator}{\param{long }{flags=0}} - -Constructor. - -\section{\class{wxBoolListValidator}: wxPropertyListValidator}\label{wxboollistvalidator} - -\overview{Validator classes}{validatorclasses} - -This class validates a boolean value for a list view. - -\membersection{wxBoolListValidator::wxBoolListValidator} - -\func{void}{wxBoolListValidator}{\param{long }{flags=0}} - -Constructor. - -\section{\class{wxIntegerFormValidator}: wxPropertyFormValidator}\label{wxintegerformvalidator} - -\overview{Validator classes}{validatorclasses} - -This class validates a range of integer values for a form view. The associated panel item must be a wxText -or wxSlider. - -\membersection{wxIntegerFormValidator::wxIntegerFormValidator} - -\func{void}{wxIntegerFormValidator}{\param{long }{min=0}, \param{long }{max=0}, - \param{long}{ flags=0}} - -Constructor. Assigning zero to minimum and maximum values indicates that there is no range to check. - - -\section{\class{wxIntegerListValidator}: wxPropertyListValidator}\label{wxintegerlistvalidator} - -\overview{Validator classes}{validatorclasses} - -This class validates a range of integer values for a list view. - -\membersection{wxIntegerListValidator::wxIntegerListValidator} - -\func{void}{wxIntegerListValidator}{\param{long }{min=0}, \param{long }{max=0}, - \param{long}{ flags=wxPROP\_ALLOW\_TEXT\_EDITING}} - -Constructor. Assigning zero to minimum and maximum values indicates that there is no range to check. - -\section{\class{wxFilenameListValidator}: wxPropertyListValidator}\label{wxfilenamelistvalidator} - -\overview{Validator classes}{validatorclasses} - -This class validates a filename for a list view, allowing the user to edit it textually and also popping up -a file selector in ``detailed editing" mode. - -\membersection{wxFilenameListValidator::wxFilenameListValidator} - -\func{void}{wxFilenameListValidator}{\param{wxString }{message = ``Select a file"}, \param{wxString }{wildcard = ``*.*"}, - \param{long}{ flags=0}} - -Constructor. Supply an optional message and wildcard. - -\section{\class{wxListOfStringsListValidator}: wxPropertyListValidator}\label{wxlistofstringslistvalidator} - -\overview{Validator classes}{validatorclasses} - -This class validates a list of strings for a list view. When editing the property, -a dialog box is presented for adding, deleting or editing entries in the list. -At present no constraints may be supplied. - -You can construct a string list property value by constructing a wxStringList object. - -For example: - -\begin{verbatim} - myListValidatorRegistry.RegisterValidator((wxString)"stringlist", - new wxListOfStringsListValidator); - - wxStringList *strings = new wxStringList("earth", "fire", "wind", "water", NULL); - - sheet->AddProperty(new wxProperty("fred", strings, "stringlist")); -\end{verbatim} - -\membersection{wxListOfStringsListValidator::wxListofStringsListValidator} - -\func{void}{wxListOfStringsListValidator}{\param{long}{ flags=0}} - -Constructor. - -\section{\class{wxProperty}: wxObject}\label{wxproperty} - -The {\bf wxProperty} class represents a property, with a \helpref{wxPropertyValue}{wxpropertyvalue}\rtfsp -containing the actual value, a name a role, an optional validator, and -an optional associated window. - -A property might correspond to an actual C++ data member, or it -might correspond to a conceptual property, such as the width of a window. -There is no explicit data member {\it wxWindow::width}, but it may be convenient -to invent such a property for the purposes of editing attributes of the window. -The properties in the property sheet can be mapped to ``reality" by -whatever means (in this case by calling wxWindow::SetSize when the user has -finished editing the property sheet). - -A validator may be associated with the property in order to ensure that this and -only this validator will be used for editing and validating the property. -An alternative method is to use the {\it role} parameter to specify what kind -of validator would be appropriate; for example, specifying ``filename" for the role -would allow the property view to find an appropriate validator at edit time. - - -\membersection{wxProperty::wxProperty} - -\func{void}{wxProperty}{\void} - -\func{void}{wxProperty}{\param{wxProperty\& }{prop}} - -\func{void}{wxProperty}{\param{wxString}{ name}, \param{wxString}{ role}, \param{wxPropertyValidator *}{validator=NULL}} - -\func{void}{wxProperty}{\param{wxString}{ name}, \param{const wxPropertyValue\&}{ val}, \param{wxString}{ role}, \param{wxPropertyValidator *}{validator=NULL}} - -Constructors. - -\membersection{wxProperty::\destruct{wxProperty}} - -\func{void}{\destruct{wxProperty}}{\void} - -Destructor. Destroys the wxPropertyValue, and the property validator if there is one. However, if the -actual C++ value in the wxPropertyValue is a pointer, the data in that variable is not destroyed. - -\membersection{wxProperty::GetValue} - -\func{wxPropertyValue\&}{GetValue}{\void} - -Returns a reference to the property value. - -\membersection{wxProperty::GetValidator} - -\func{wxPropertyValidator *}{GetValidator}{\void} - -Returns a pointer to the associated property validator (if any). - -\membersection{wxProperty::GetName} - -\func{wxString\&}{GetName}{\void} - -Returns the name of the property. - -\membersection{wxProperty::GetRole} - -\func{wxRole\&}{GetRole}{\void} - -Returns the role of the property, to be used when choosing an appropriate validator. - -\membersection{wxProperty::GetWindow} - -\func{wxWindow *}{GetWindow}{\void} - -Returns the window associated with the property (if any). - -\membersection{wxProperty::SetValue} - -\func{void}{SetValue}{\param{wxPropertyValue\&}{ val}} - -Sets the value of the property. - -\membersection{wxProperty::SetName} - -\func{void}{SetName}{\param{wxString\&}{ name}} - -Sets the name of the property. - -\membersection{wxProperty::SetRole} - -\func{void}{SetRole}{\param{wxString\&}{ role}} - -Sets the role of the property. - -\membersection{wxProperty::SetValidator} - -\func{void}{SetValidator}{\param{wxPropertyValidator *}{validator}} - -Sets the validator: this will be deleted when the property is deleted. - -\membersection{wxProperty::SetWindow} - -\func{void}{SetWindow}{\param{wxWindow *}{win}} - -Sets the window associated with the property. - -\membersection{wxProperty::operator $=$} - -\func{void}{operator $=$}{\param{const wxPropertyValue\&}{ val}} - -Assignment operator. - -\section{\class{wxPropertyFormValidator}: wxPropertyValidator}\label{wxpropertyformvalidator} - -The {\bf wxPropertyFormValidator} abstract class is the root of classes that define validation -for a wxPropertyFormView. - - -\section{\class{wxPropertyFormDialog}: wxDialogBox}\label{wxpropertyformdialog} - -The {\bf wxPropertyFormDialog} class is a prepackaged dialog which can -be used for viewing a form property sheet. Pass a property form view object, and the dialog -will pass OnClose and OnDefaultAction listbox messages to the view class for -processing. - -\membersection{wxPropertyFormDialog::wxPropertyFormDialog} - -\func{void}{wxPropertyFormDialog}{\param{wxPropertyFormView *}{view}, \param{wxWindow *}{parent}, \param{char *}{title}, - \param{Bool}{ modal=FALSE}, \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, - \param{long}{ style=wxDEFAULT\_DIALOG\_STYLE}, \param{char *}{name=``dialogBox"}} - -Constructor. - -\membersection{wxPropertyFormDialog::\destruct{wxPropertyFormDialog}} - -\func{void}{\destruct{wxPropertyFormDialog}}{\void} - -Destructor. - - -\section{\class{wxPropertyFormFrame}: wxFrame}\label{wxpropertyformframe} - -The {\bf wxPropertyFormFrame} class is a prepackaged frame which can -be used for viewing a property form. Pass a property form view object, and the frame -will pass OnClose messages to the view class for processing. - -Call Initialize to create the panel and associate the view; override OnCreatePanel -if you wish to use a panel class other than the default wxPropertyFormPanel. - -\membersection{wxPropertyFormFrame::wxPropertyFormFrame} - -\func{void}{wxPropertyFormFrame}{\param{wxPropertyFormView *}{view}, \param{wxFrame *}{parent}, \param{char *}{title}, - \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, - \param{long}{ style=wxSDI $\|$ wxDEFAULT\_FRAME}, \param{char *}{name=``frame"}} - -Constructor. - -\membersection{wxPropertyFormFrame::\destruct{wxPropertyFormFrame}} - -\func{void}{\destruct{wxPropertyFormFrame}}{\void} - -Destructor. - -\membersection{wxPropertyFormFrame::GetPropertyPanel} - -\func{wxPanel *}{GetPropertyPanel}{\void} - -Returns the panel associated with the frame. - -\membersection{wxPropertyFormFrame::Initialize} - -\func{Bool}{Initialize}{\void} - -Must be called to create the panel and associate the view with the panel and frame. - -\membersection{wxPropertyFormFrame::OnCreatePanel} - -\func{wxPanel *}{OnCreatePanel}{\param{wxFrame *}{parent}, \param{wxPropertyFormView *}{view}} - -Creates a panel. Override this to create a panel type other than wxPropertyFormPanel. - - -\section{\class{wxPropertyFormPanel}: wxPanel}\label{wxpropertyformpanel} - -The {\bf wxPropertyFormPanel} class is a prepackaged panel which can -be used for viewing a property form. Pass a property form view object, and the panel -will pass OnDefaultAction listbox messages to the view class for -processing. - -\membersection{wxPropertyFormPanel::wxPropertyFormPanel} - -\func{void}{wxPropertyFormPanel}{\param{wxPropertyFormView *}{view}, \param{wxWindow *}{parent}, - \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, - \param{long}{ style=0}, \param{char *}{name=``panel"}} - -Constructor. - -\membersection{wxPropertyFormPanel::\destruct{wxPropertyFormPanel}} - -\func{void}{\destruct{wxPropertyFormPanel}}{\void} - -Destructor. - - - -\section{\class{wxPropertyFormValidator}: wxPropertyValidator}\label{wxpropertyformvalidatir} - -\overview{wxPropertyFormValidator overview}{wxpropertyformvalidatoroverview} - -The {\bf wxPropertyFormValidator} class defines a base class for form validators. By overriding virtual functions, -the programmer can create custom behaviour for kinds of property. - -\membersection{wxPropertyFormValidator::wxPropertyFormValidator} - -\func{void}{wxPropertyFormValidator}{\param{long}{ flags = 0}} - -Constructor. - -\membersection{wxPropertyFormValidator::\destruct{wxPropertyFormValidator}} - -\func{void}{\destruct{wxPropertyFormValidator}}{\void} - -Destructor. - -\membersection{wxPropertyFormValidator::OnCommand} - -\func{Bool}{OnCommand}{\param{wxProperty *}{property}, \param{wxPropertyFormView *}{view}, - \param{wxWindow *}{parentWindow}, \param{wxCommandEvent\& }{event}} - -Called when the control corresponding to the property receives a command (if not intercepted -by a callback associated with the actual control). - -\membersection{wxPropertyFormValidator::OnCheckValue} - -\func{Bool}{OnCheckValue}{\param{wxProperty *}{property}, \param{wxPropertyFormView *}{view}, - \param{wxWindow *}{parentWindow}} - -Called when the view checks the property value. The value checked by this validator should be taken from the -panel item corresponding to the property. - -\membersection{wxPropertyFormValidator::OnDisplayValue} - -\func{Bool}{OnDisplayValue}{\param{wxProperty *}{property}, \param{wxPropertyFormView *}{view}, - \param{wxWindow *}{parentWindow}} - -Should display the property value in the appropriate control. - -\membersection{wxPropertyFormValidator::OnDoubleClick} - -\func{Bool}{OnDoubleClick}{\param{wxProperty *}{property}, \param{wxPropertyFormView *}{view}, - \param{wxWindow *}{parentWindow}} - -Called when the control corresponding to the property is double clicked (listboxes only). - -\membersection{wxPropertyFormValidator::OnRetrieveValue} - -\func{Bool}{OnRetrieveValue}{\param{wxProperty *}{property}, \param{wxPropertyFormView *}{view}, - \param{wxWindow *}{parentWindow}} - -Should do the transfer from the property editing area to the property itself. - - -\section{\class{wxPropertyFormView}: wxPropertyView}\label{wxpropertyformview} - -\overview{wxPropertyFormView overview}{wxpropertyformviewoverview} - -The {\bf wxPropertyFormView} class shows a wxPropertySheet as a view onto a panel or dialog -box which has already been created. - -\membersection{wxPropertyFormView::wxPropertyFormView} - -\func{void}{wxPropertyFormView}{\param{long}{ flags = 0}} - -Constructor. - -\membersection{wxPropertyFormView::\destruct{wxPropertyFormView}} - -\func{void}{\destruct{wxPropertyFormView}}{\void} - -Destructor. - -\membersection{wxPropertyFormView::AssociateNames}\label{wxpropertyformviewassociatenames} - -\func{void}{AssociateNames}{\void} - -Associates the properties with the controls on the panel. For each panel item, if the -panel item name is the same as a property name, the two objects will be associated. -This function should be called manually since the programmer may wish to do the -association manually. - -\membersection{wxPropertyFormView::Check}\label{wxpropertyformviewcheck} - -\func{Bool}{Check}{\void} - -Checks all properties by calling the appropriate validators; returns FALSE if a validation failed. - -\membersection{wxPropertyFormView::GetPanel}\label{wxpropertyformviewgetpanel} - -\func{wxPanel *}{GetPanel}{\void} - -Returns the panel associated with the view. - -\membersection{wxPropertyFormView::GetManagedWindow}\label{wxpropertyformviewgetmanagedwindow} - -\func{wxWindow *}{GetManagedWindow}{\void} - -Returns the managed window (a frame or dialog) associated with the view. - -\membersection{wxPropertyFormView::OnOk}\label{wxpropertyformviewonok} - -\func{void}{OnOk}{\void} - -Virtual function that will be called when the OK button on the physical window is pressed. -By default, checks and updates the form values, closes and deletes the frame or dialog, then deletes the view. - -\membersection{wxPropertyFormView::OnCancel}\label{wxpropertyformviewoncancel} - -\func{void}{OnCancel}{\void} - -Virtual function that will be called when the Cancel button on the physical window is pressed. -By default, closes and deletes the frame or dialog, then deletes the view. - -\membersection{wxPropertyFormView::OnHelp}\label{wxpropertyformviewonhelp} - -\func{void}{OnHelp}{\void} - -Virtual function that will be called when the Help button on the physical window is pressed. -This needs to be overridden by the application for anything interesting to happen. - -\membersection{wxPropertyFormView::OnRevert}\label{wxpropertyformviewonrevert} - -\func{void}{OnRevert}{\void} - -Virtual function that will be called when the Revert button on the physical window is pressed. -By default transfers the wxProperty values to the panel items (in effect -undoing any unsaved changes in the items). - -\membersection{wxPropertyFormView::OnUpdate}\label{wxpropertyformviewonupdate} - -\func{void}{OnUpdate}{\void} - -Virtual function that will be called when the Update button on the physical window is pressed. -By defaults transfers the displayed values to the wxProperty objects. - -\membersection{wxPropertyFormView::SetManagedWindow}\label{wxpropertyformviewsetmanagedwindow} - -\func{void}{SetManagedWindow}{\param{wxWindow *}{win}} - -Sets the managed window (a frame or dialog) associated with the view. - -\membersection{wxPropertyFormView::TransferToDialog}\label{wxpropertyformviewtransfertodialog} - -\func{Bool}{TransferToDialog}{\void} - -Transfers property values to the controls in the dialog. - -\membersection{wxPropertyFormView::TransferToPropertySheet}\label{wxpropertyformviewtransfertopropertysheet} - -\func{Bool}{TransferToPropertySheet}{\void} - -Transfers property values from the controls in the dialog to the property sheet. - - -\section{\class{wxPropertyListDialog}: wxDialogBox}\label{wxpropertylistdialog} - -The {\bf wxPropertyListDialog} class is a prepackaged dialog which can -be used for viewing a property list. Pass a property list view object, and the dialog -will pass OnClose and OnDefaultAction listbox messages to the view class for -processing. - -\membersection{wxPropertyListDialog::wxPropertyListDialog} - -\func{void}{wxPropertyListDialog}{\param{wxPropertyListView *}{view}, \param{wxWindow *}{parent}, \param{char *}{title}, - \param{Bool}{ modal=FALSE}, \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, - \param{long}{ style=wxDEFAULT\_DIALOG\_STYLE}, \param{char *}{name=``dialogBox"}} - -Constructor. - -\membersection{wxPropertyListDialog::\destruct{wxPropertyListDialog}} - -\func{void}{\destruct{wxPropertyListDialog}}{\void} - -Destructor. - - -\section{\class{wxPropertyListFrame}: wxFrame}\label{wxpropertylistframe} - -The {\bf wxPropertyListFrame} class is a prepackaged frame which can -be used for viewing a property list. Pass a property list view object, and the frame -will pass OnClose messages to the view class for processing. - -Call Initialize to create the panel and associate the view; override OnCreatePanel -if you wish to use a panel class other than the default wxPropertyListPanel. - -\membersection{wxPropertyListFrame::wxPropertyListFrame} - -\func{void}{wxPropertyListFrame}{\param{wxPropertyListView *}{view}, \param{wxFrame *}{parent}, \param{char *}{title}, - \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, - \param{long}{ style=wxSDI $\|$ wxDEFAULT\_FRAME}, \param{char *}{name=``frame"}} - -Constructor. - -\membersection{wxPropertyListFrame::\destruct{wxPropertyListFrame}} - -\func{void}{\destruct{wxPropertyListFrame}}{\void} - -Destructor. - -\membersection{wxPropertyListFrame::GetPropertyPanel} - -\func{wxPanel *}{GetPropertyPanel}{\void} - -Returns the panel associated with the frame. - -\membersection{wxPropertyListFrame::Initialize} - -\func{Bool}{Initialize}{\void} - -Must be called to create the panel and associate the view with the panel and frame. - -\membersection{wxPropertyListFrame::OnCreatePanel} - -\func{wxPanel *}{OnCreatePanel}{\param{wxFrame *}{parent}, \param{wxPropertyListView *}{view}} - -Creates a panel. Override this to create a panel type other than wxPropertyListPanel. - - -\section{\class{wxPropertyListPanel}: wxPanel}\label{wxpropertylistpanel} - -The {\bf wxPropertyListPanel} class is a prepackaged panel which can -be used for viewing a property list. Pass a property list view object, and the panel -will pass OnDefaultAction listbox messages to the view class for -processing. - -\membersection{wxPropertyListPanel::wxPropertyListPanel} - -\func{void}{wxPropertyListPanel}{\param{wxPropertyListView *}{view}, \param{wxWindow *}{parent}, - \param{int}{ x=-1}, \param{int}{ y=-1}, \param{int}{ width=-1}, \param{int}{height=-1}, - \param{long}{ style=0}, \param{char *}{name=``panel"}} - -Constructor. - -\membersection{wxPropertyListPanel::\destruct{wxPropertyListPanel}} - -\func{void}{\destruct{wxPropertyListPanel}}{\void} - -Destructor. - - - - -\section{\class{wxPropertyListValidator}: wxPropertyValidator}\label{wxpropertylistvalidator} - -\overview{wxPropertyListValidator overview}{wxpropertylistvalidatoroverview} - -The {\bf wxPropertyListValidator} abstract class is the base class for -deriving validators for property lists. - -\membersection{wxPropertyListValidator::wxPropertyListValidator} - -\func{void}{wxPropertyListValidator}{\param{long}{ flags = wxPROP\_ALLOW\_TEXT\_EDITING}} - -Constructor. - -\membersection{wxPropertyListValidator::\destruct{wxPropertyListValidator}} - -\func{void}{\destruct{wxPropertyListValidator}}{\void} - -Destructor. - -\membersection{wxPropertyListValidator::OnCheckValue} - -\func{Bool}{OnCheckValue}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, - \param{wxWindow *}{parentWindow}} - -Called when the Tick (Confirm) button is pressed or focus is list. Return FALSE if the value -was invalid, which is a signal restores the old value. Return TRUE if the value was valid. - -\membersection{wxPropertyListValidator::OnClearControls} - -\func{Bool}{OnClearControls}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, - \param{wxWindow *}{parentWindow}} - -Allows the clearing (enabling, disabling) of property list controls, when the focus leaves the current property. - -\membersection{wxPropertyListValidator::OnClearDetailControls} - -\func{Bool}{OnClearDetailControls}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, - \param{wxWindow *}{parentWindow}} - -Called when the focus is lost, if the validator is in detailed editing mode. - -\membersection{wxPropertyListValidator::OnDisplayValue} - -\func{Bool}{OnDisplayValue}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, - \param{wxWindow *}{parentWindow}} - -Should display the value in the appropriate controls. The default implementation gets the -textual value from the property and inserts it into the text edit control. - -\membersection{wxPropertyListValidator::OnDoubleClick} - -\func{Bool}{OnDoubleClick}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, - \param{wxWindow *}{parentWindow}} - -Called when the property is double clicked. Extra functionality can be provided, -such as cycling through possible values. - -\membersection{wxPropertyListValidator::OnEdit} - -\func{Bool}{OnEdit}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, - \param{wxWindow *}{parentWindow}} - -Called when the Edit (detailed editing) button is pressed. The default implementation -calls wxPropertyListView::BeginDetailedEditing; a filename validator (for example) overrides -this function to show the file selector. - -\membersection{wxPropertyListValidator::OnPrepareControls} - -\func{Bool}{OnPrepareControls}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, - \param{wxWindow *}{parentWindow}} - -Called to allow the validator to setup the display, such enabling or disabling buttons, and -setting the values and selection in the standard listbox control (the one optionally used for displaying -value options). - -\membersection{wxPropertyListValidator::OnPrepareDetailControls} - -\func{Bool}{OnPrepareDetailControls}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, - \param{wxWindow *}{parentWindow}} - -Called when the property is edited `in detail', i.e. when the Edit button is pressed. - -\membersection{wxPropertyListValidator::OnRetrieveValue} - -\func{Bool}{OnRetrieveValue}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, - \param{wxWindow *}{parentWindow}} - -Called when Tick (Confirm) is pressed or focus is lost or view wants to update -the property list. Should do the transfer from the property editing area to the property itself - -\membersection{wxPropertyListValidator::OnSelect} - -\func{Bool}{OnSelect}{\param{Bool}{ select}, \param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, - \param{wxWindow *}{parentWindow}} - -Called when the property is selected or deselected: typically displays the value -in the edit control (having chosen a suitable control to display: (non)editable text or listbox). - -\membersection{wxPropertyListValidator::OnValueListSelect} - -\func{Bool}{OnValueListSelect}{\param{wxProperty *}{property}, \param{wxPropertyListView *}{view}, - \param{wxWindow *}{parentWindow}} - -Called when the value listbox is selected. The default behaviour is to copy -string to text control, and retrieve the value into the property. - - - -\section{\class{wxPropertyListView}: wxPropertyView}\label{wxpropertylistview} - -\overview{wxPropertyListView overview}{wxpropertylistviewoverview} - -The {\bf wxPropertyListView} class shows a wxPropertySheet as a Visual Basic-style property list. - -\membersection{wxPropertyListView::wxPropertyListView} - -\func{void}{wxPropertyListView}{\param{long}{ flags = wxPROP\_BUTTON\_DEFAULT}} - -Constructor. - -The {\it flags} argument can be a bit list of the following: - -\begin{itemize}\itemsep=0pt -\item wxPROP\_BUTTON\_CLOSE -\item wxPROP\_BUTTON\_OK -\item wxPROP\_BUTTON\_CANCEL -\item wxPROP\_BUTTON\_CHECK\_CROSS -\item wxPROP\_BUTTON\_HELP -\item wxPROP\_DYNAMIC\_VALUE\_FIELD -\item wxPROP\_PULLDOWN -\end{itemize} - -\membersection{wxPropertyListView::\destruct{wxPropertyListView}} - -\func{void}{\destruct{wxPropertyListView}}{\void} - -Destructor. - -\membersection{wxPropertyListView::AssociatePanel}\label{wxpropertylistviewassociatepanel} - -\func{void}{AssociatePanel}{\param{wxPanel *}{panel}} - -Associates the window on which the controls will be displayed, with the view (sets an internal pointer to the window). - -\membersection{wxPropertyListView::BeginShowingProperty}\label{wxpropertylistviewbeginshowingproperty} - -\func{Bool}{BeginShowingProperty}{\param{wxProperty *}{property}} - -Finds the appropriate validator and loads the property into the controls, by calling -wxPropertyValidator::OnPrepareControls and then wxPropertyListView::DisplayProperty. - -\membersection{wxPropertyListView::DisplayProperty}\label{wxpropertylistviewdisplayproperty} - -\func{Bool}{DisplayProperty}{\param{wxProperty *}{property}} - -Calls wxPropertyValidator::OnDisplayValue for the current property's validator. This function -gets called by wxPropertyListView::BeginShowingProperty, which is in turn called -from ShowProperty, called by OnPropertySelect, called by the listbox callback when selected. - -\membersection{wxPropertyListView::EndShowingProperty}\label{wxpropertylistviewendshowingproperty} - -\func{Bool}{EndShowingProperty}{\param{wxProperty *}{property}} - -Finds the appropriate validator and unloads the property from the controls, by calling -wxPropertyListView::RetrieveProperty, wxPropertyValidator::OnClearControls and (if we're in -detailed editing mdoe) wxPropertyValidator::OnClearDetailControls. - -\membersection{wxPropertyListView::GetPanel}\label{wxpropertylistviewgetpanel} - -\func{wxPanel *}{GetPanel}{\void} - -Returns the panel associated with the view. - -\membersection{wxPropertyListView::GetManagedWindow}\label{wxpropertylistviewgetmanagedwindow} - -\func{wxWindow *}{GetManagedWindow}{\void} - -Returns the managed window (a frame or dialog) associated with the view. - -\membersection{wxPropertyListView::GetWindowCancelButton}\label{wxpropertylistviewgetwindowcancelbutton} - -\func{wxButton *}{GetWindowCancelButton}{\void} - -Returns the window cancel button, if any. - -\membersection{wxPropertyListView::GetWindowCloseButton}\label{wxpropertylistviewgetwindowclosebutton} - -\func{wxButton *}{GetWindowCloseButton}{\void} - -Returns the window close or OK button, if any. - -\membersection{wxPropertyListView::GetWindowHelpButton}\label{wxpropertylistviewgetwindowhelpbutton} - -\func{wxButton *}{GetWindowHelpButton}{\void} - -Returns the window help button, if any. - -\membersection{wxPropertyListView::SetManagedWindow}\label{wxpropertylistviewsetmanagedwindow} - -\func{void}{SetManagedWindow}{\param{wxWindow *}{win}} - -Sets the managed window (a frame or dialog) associated with the view. - -\membersection{wxPropertyListView::UpdatePropertyDisplayInList}\label{wxpropertylistviewupdatepropdisplay} - -\func{Bool}{UpdatePropertyDisplayInList}{\param{wxProperty *}{property}} - -Updates the display for the given changed property. - -\membersection{wxPropertyListView::UpdatePropertyList}\label{wxpropertylistviewupdateproplist} - -\func{Bool}{UpdatePropertyList}{\param{Bool }{clearEditArea = TRUE}} - -Updates the whole property list display. - - -\section{\class{wxPropertySheet}: wxObject}\label{wxpropertysheet} - -\overview{wxPropertySheet overview}{wxpropertysheetoverview} - -The {\bf wxPropertySheet} class is used for storing a number of -wxProperty objects (essentially names and values). - -\membersection{wxPropertySheet::wxPropertySheet} - -\func{void}{wxPropertySheet}{\void} - -Constructor. - -\membersection{wxPropertySheet::\destruct{wxPropertySheet}} - -\func{void}{\destruct{wxPropertySheet}}{\void} - -Destructor. Destroys all contained properties. - -\membersection{wxPropertySheet::AddProperty}\label{wxpropertysheetaddproperty} - -\func{void}{AddProperty}{\param{wxProperty *}{property}} - -Adds a property to the sheet. - -\membersection{wxPropertySheet::Clear}\label{wxpropertysheetclear} - -\func{void}{Clear}{\void} - -Clears all the properties from the sheet (deleting them). - -\membersection{wxPropertySheet::GetProperties}\label{wxpropertysheetgetproperties} - -\func{wxList\&}{GetProperties}{\void} - -Returns a reference to the internal list of properties. - -\membersection{wxPropertySheet::GetProperty}\label{wxpropertysheetgetproperty} - -\func{wxProperty *}{GetProperty}{\param{char *}{name}} - -Gets a property by name. - -\membersection{wxPropertySheet::SetAllModified} - -\func{void}{SetAllModified}{\param{Bool}{ flag}} - -Sets the `modified' flag of each property value. - - - -\section{\class{wxPropertyValidator}: wxEvtHandler}\label{wxpropertyvalidator} - -\overview{wxPropertyValidator overview}{wxpropertyvalidatoroverview} - -The {\bf wxPropertyValidator} abstract class is the base class for deriving -validators for properties. - -\membersection{wxPropertyValidator::wxPropertyValidator} - -\func{void}{wxPropertyValidator}{\param{long}{ flags = 0}} - -Constructor. - -\membersection{wxPropertyValidator::\destruct{wxPropertyValidator}} - -\func{void}{\destruct{wxPropertyValidator}}{\void} - -Destructor. - -\membersection{wxPropertyValidator::GetFlags} - -\func{long}{GetFlags}{\void} - -Returns the flags for the validator. - -\membersection{wxPropertyValidator::GetValidatorProperty} - -\func{wxProperty *}{GetValidatorProperty}{\void} - -Gets the property for the validator. - -\membersection{wxPropertyValidator::SetValidatorProperty} - -\func{void}{SetValidatorProperty}{\param{wxProperty *}{property}} - -Sets the property for the validator. - - -\section{\class{wxPropertyValidatorRegistry}: wxHashTable}\label{wxpropertyvalidatorregistry} - -The {\bf wxPropertyValidatorRegistry} class is used for storing validators, -indexed by the `role name' of the property, by which groups of property -can be identified for the purpose of validation and editing. - -\membersection{wxPropertyValidatorRegistry::wxPropertyValidatorRegistry} - -\func{void}{wxPropertyValidatorRegistry}{\void} - -Constructor. - -\membersection{wxPropertyValidatorRegistry::\destruct{wxPropertyValidatorRegistry}} - -\func{void}{\destruct{wxPropertyValidatorRegistry}}{\void} - -Destructor. - -\membersection{wxPropertyValidatorRegistry::Clear} - -\func{void}{ClearRegistry}{\void} - -Clears the registry, deleting the validators. - -\membersection{wxPropertyValidatorRegistry::GetValidator} - -\func{wxPropertyValidator *}{GetValidator}{\param{wxString\& }{roleName}} - -Retrieve a validator by the property role name. - -\membersection{wxPropertyValidatorRegistry::RegisterValidator}\label{wxpropertyvalidatorregistervalidator} - -\func{void}{RegisterValidator}{\param{wxString\& }{roleName}, \param{wxPropertyValidator *}{validator}} - -Register a validator with the registry. {\it roleName} is a name indicating the -role of the property, such as ``filename''. Later, when a validator is chosen for -editing a property, this role name is matched against the class names of the property, -if the property does not already have a validator explicitly associated with it. - - -\section{\class{wxPropertyValue}: wxObject}\label{wxpropertyvalue} - -The {\bf wxPropertyValue} class represents the value of a property, -and is normally associated with a wxProperty object. - -A wxPropertyValue has one of the following types: - -\begin{itemize}\itemsep=0pt -\item wxPropertyValueNull -\item wxPropertyValueInteger -\item wxPropertyValueReal -\item wxPropertyValueBool -\item wxPropertyValueString -\item wxPropertyValueList -\item wxPropertyValueIntegerPtr -\item wxPropertyValueRealPtr -\item wxPropertyValueBoolPtr -\item wxPropertyValueStringPtr -\end{itemize} - -\membersection{wxPropertyValue::wxPropertyValue} - -\func{void}{wxPropertyValue}{\void} - -Default constructor. - -\func{void}{wxPropertyValue}{\param{const wxPropertyValue\& }{copyFrom}} - -Copy constructor. - -\func{void}{wxPropertyValue}{\param{char *}{val}} - -Construction from a string value. - -\func{void}{wxPropertyValue}{\param{long}{ val}} - -Construction from an integer value. You may need to cast to (long) to -avoid confusion with other constructors (such as the Bool constructor). - -\func{void}{wxPropertyValue}{\param{Bool}{ val}} - -Construction from a boolean value. - -\func{void}{wxPropertyValue}{\param{float}{ val}} - -Construction from a floating point value. - -\func{void}{wxPropertyValue}{\param{double}{ val}} - -Construction from a floating point value. - -\func{void}{wxPropertyValue}{\param{wxList *}{ val}} - -Construction from a list of wxPropertyValue objects. The -list, but not each contained wxPropertyValue, will be deleted -by the constructor. The wxPropertyValues will be assigned to -this wxPropertyValue list. In other words, so do not delete wxList or -its data after calling this constructor. - -\func{void}{wxPropertyValue}{\param{wxStringList *}{ val}} - -Construction from a list of strings. The list (including the strings -contained in it) will be deleted by the constructor, so do not -destroy {\it val} explicitly. - -\func{void}{wxPropertyValue}{\param{char **}{val}} - -Construction from a string pointer. - -\func{void}{wxPropertyValue}{\param{long *}{val}} - -Construction from an integer pointer. - -\func{void}{wxPropertyValue}{\param{Bool *}{val}} - -Construction from an boolean pointer. - -\func{void}{wxPropertyValue}{\param{float *}{val}} - -Construction from a floating point pointer. - -The last four constructors use pointers to various C++ types, and do not -store the types themselves; this allows the values to stand in for actual -data values defined elsewhere. - -\membersection{wxPropertyValue::\destruct{wxPropertyValue}} - -\func{void}{\destruct{wxPropertyValue}}{\void} - -Destructor. - -\membersection{wxPropertyValue::Append} - -\func{void}{Append}{\param{wxPropertyValue *}{expr}} - -Appends a property value to the list. - -\membersection{wxPropertyValue::BoolValue} - -\func{Bool}{BoolValue}{\void} - -Returns the boolean value. - -\membersection{wxPropertyValue::BoolValuePtr} - -\func{Bool *}{BoolValuePtr}{\void} - -Returns the pointer to the boolean value. - -\membersection{wxPropertyValue::ClearList} - -\func{void}{ClearList}{\void} - -Deletes the contents of the list. - -\membersection{wxPropertyValue::Delete} - -\func{void}{Delete}{\param{wxPropertyValue *}{expr}} - -Deletes {\it expr} from this list. - -\membersection{wxPropertyValue::GetFirst} - -\func{wxPropertyValue *}{GetFirst}{\void} - -Gets the first value in the list. - -\membersection{wxPropertyValue::GetLast} - -\func{wxPropertyValue *}{GetFirst}{\void} - -Gets the last value in the list. - -\membersection{wxPropertyValue::GetModified} - -\func{Bool}{GetModified}{\void} - -Returns TRUE if the value was modified since being created -(or since SetModified was called). - -\membersection{wxPropertyValue::GetNext} - -\func{wxPropertyValue *}{GetNext}{\void} - -Gets the next value in the list (the one after `this'). - -\membersection{wxPropertyValue::GetStringRepresentation} - -\func{wxString}{GetStringRepresentation}{\void} - -Gets a string representation of the value. - -\membersection{wxPropertyValue::IntegerValue} - -\func{long}{IntegerValue}{\void} - -Returns the integer value. - -\membersection{wxPropertyValue::Insert} - -\func{void}{Insert}{\param{wxPropertyValue *}{expr}} - -Inserts a property value at the front of a list. - -\membersection{wxPropertyValue::IntegerValuePtr} - -\func{long *}{IntegerValuePtr}{\void} - -Returns the pointer to the integer value. - -\membersection{wxPropertyValue::Nth} - -\func{wxPropertyValue *}{Nth}{\param{int}{ n}} - -Returns the nth value of a list expression (starting from zero). - -\membersection{wxPropertyValue::Number} - -\func{int}{Number}{\void} - -Returns the number of elements in a list expression. - -\membersection{wxPropertyValue::RealValue} - -\func{float}{RealValue}{\void} - -Returns the floating point value. - -\membersection{wxPropertyValue::RealValuePtr} - -\func{float *}{RealValuePtr}{\void} - -Returns the pointer to the floating point value. - -\membersection{wxPropertyValue::SetModified} - -\func{void}{SetModified}{\param{Bool}{ flag}} - -Sets the `modified' flag. - -\membersection{wxPropertyValue::StringValue} - -\func{char *}{StringValue}{\void} - -Returns the string value. - -\membersection{wxPropertyValue::StringValuePtr} - -\func{char **}{StringValuePtr}{\void} - -Returns the pointer to the string value. - -\membersection{wxPropertyValue::Type} - -\func{wxPropertyValueType}{Type}{\void} - -Returns the value type. - -\membersection{wxPropertyValue::operator $=$} - -\func{void}{operator $=$}{\param{const wxPropertyValue\& }{val}} - -\func{void}{operator $=$}{\param{const char *}{val}} - -\func{void}{operator $=$}{\param{const long }{val}} - -\func{void}{operator $=$}{\param{const Bool }{val}} - -\func{void}{operator $=$}{\param{const float }{val}} - -\func{void}{operator $=$}{\param{const char **}{val}} - -\func{void}{operator $=$}{\param{const long *}{val}} - -\func{void}{operator $=$}{\param{const Bool *}{val}} - -\func{void}{operator $=$}{\param{const float *}{val}} - -Assignment operators. - - - -\section{\class{wxPropertyView}: wxEvtHandler}\label{wxpropertyview} - -\overview{wxPropertyView overview}{wxpropertyviewoverview} - -The {\bf wxPropertyView} abstract class is the base class for views -of property sheets, acting as intermediaries between properties and -actual windows. - -\membersection{wxPropertyView::wxPropertyView} - -\func{void}{wxPropertyView}{\param{long}{ flags = wxPROP\_BUTTON\_DEFAULT}} - -Constructor. - -The {\it flags} argument can be a bit list of the following: - -\begin{itemize}\itemsep=0pt -\item wxPROP\_BUTTON\_CLOSE -\item wxPROP\_BUTTON\_OK -\item wxPROP\_BUTTON\_CANCEL -\item wxPROP\_BUTTON\_CHECK\_CROSS -\item wxPROP\_BUTTON\_HELP -\item wxPROP\_DYNAMIC\_VALUE\_FIELD -\item wxPROP\_PULLDOWN -\end{itemize} - -\membersection{wxPropertyView::\destruct{wxPropertyView}} - -\func{void}{\destruct{wxPropertyView}}{\void} - -Destructor. - -\membersection{wxPropertyView::AddRegistry}\label{wxpropertyviewaddregistry} - -\func{void}{AddRegistry}{\param{wxPropertyValidatorRegistry *}{registry}} - -Adds a registry (list of property validators) the view's list of registries, which is initially empty. - -\membersection{wxPropertyView::FindPropertyValidator}\label{wxpropertyviewfindpropertyvalidator} - -\func{wxPropertyValidator *}{FindPropertyValidator}{\param{wxProperty *}{property}} - -Finds the property validator that is most appropriate to this property. - -\membersection{wxPropertyView::GetPropertySheet}\label{wxpropertyviewgetpropertysheet} - -\func{wxPropertySheet *}{GetPropertySheet}{\void} - -Gets the property sheet for this view. - -\membersection{wxPropertyView::GetRegistryList}\label{wxpropertyviewgetregistrylist} - -\func{wxList\&}{GetRegistryList}{\void} - -Returns a reference to the list of property validator registries. - -\membersection{wxPropertyView::OnOk}\label{wxpropertyviewonok} - -\func{void}{OnOk}{\void} - -Virtual function that will be called when the OK button on the physical window is pressed (if it exists). - -\membersection{wxPropertyView::OnCancel}\label{wxpropertyviewoncancel} - -\func{void}{OnCancel}{\void} - -Virtual function that will be called when the Cancel button on the physical window is pressed (if it exists). - -\membersection{wxPropertyView::OnClose}\label{wxpropertyviewonclose} - -\func{Bool}{OnClose}{\void} - -Virtual function that will be called when the physical window is closed. The default implementation returns FALSE. - -\membersection{wxPropertyView::OnHelp}\label{wxpropertyviewonhelp} - -\func{void}{OnHelp}{\void} - -Virtual function that will be called when the Help button on the physical window is pressed (if it exists). - -\membersection{wxPropertyView::OnPropertyChanged}\label{wxpropertyviewonpropertychanged} - -\func{void}{OnPropertyChanged}{\param{wxProperty *}{property}} - -Virtual function called by a view or validator when a property's value changed. Validators -must be written correctly for this to be called. You can override this function -to respond immediately to property value changes. - -\membersection{wxPropertyView::OnUpdateView}\label{wxpropertyviewonupdateview} - -\func{Bool}{OnUpdateView}{\void} - -Called by the viewed object to update the view. The default implementation just returns -FALSE. - -\membersection{wxPropertyView::SetPropertySheet}\label{wxpropertyviewsetpropertysheet} - -\func{void}{SetPropertySheet}{\param{wxPropertySheet *}{sheet}} - -Sets the property sheet for this view. - -\membersection{wxPropertyView::ShowView}\label{wxpropertyviewshowview} - -\func{void}{ShowView}{\param{wxPropertySheet *}{sheet}, \param{wxPanel *}{panel}} - -Associates this view with the given panel, and shows the view. - -\section{\class{wxRealFormValidator}: wxPropertyFormValidator}\label{wxrealformvalidator} - -\overview{Validator classes}{validatorclasses} - -This class validates a range of real values for form views. The associated panel item must be a wxText. - -\membersection{wxRealFormValidator::wxRealFormValidator} - -\func{void}{wxRealFormValidator}{\param{float }{min=0.0}, \param{float }{max=0.0}, - \param{long}{ flags=0}} - -Constructor. Assigning zero to minimum and maximum values indicates that there is no range to check. - - -\section{\class{wxStringFormValidator}: wxPropertyFormValidator}\label{wxstringformvalidator} - -\overview{Validator classes}{validatorclasses} - -This class validates a string value for a form view, with an optional choice of possible values. -The associated panel item must be a wxText, wxListBox or wxChoice. For wxListBox and wxChoice items, -if the item is empty, the validator attempts to initialize the item from the strings in -the validator. Note that this does not happen for XView wxChoice items since XView cannot reinitialize a wxChoice. - -\membersection{wxStringFormValidator::wxStringFormValidator} - -\func{void}{wxStringFormValidator}{\param{wxStringList *}{list=NULL}, \param{long}{ flags=0}} - -Constructor. Supply a list of strings to indicate a choice, or no strings to allow the -user to freely edit the string. The string list will be deleted when the validator is deleted. - - -\section{\class{wxRealListValidator}: wxPropertyListValidator}\label{wxreallistvalidator} - -\overview{Validator classes}{validatorclasses} - -This class validates a range of real values for property lists. - -\membersection{wxRealListValidator::wxreallistvalidator} - -\func{void}{wxRealListValidator}{\param{float }{min=0.0}, \param{float }{max=0.0}, - \param{long}{ flags=wxPROP\_ALLOW\_TEXT\_EDITING}} - -Constructor. Assigning zero to minimum and maximum values indicates that there is no range to check. - - -\section{\class{wxStringListValidator}: wxPropertyListValidator}\label{wxstringlistvalidator} - -\overview{Validator classes}{validatorclasses} - -This class validates a string value, with an optional choice of possible values. - -\membersection{wxStringListValidator::wxStringListValidator} - -\func{void}{wxStringListValidator}{\param{wxStringList *}{list=NULL}, \param{long}{ flags=0}} - -Constructor. Supply a list of strings to indicate a choice, or no strings to allow the -user to freely edit the string. The string list will be deleted when the validator is deleted. - - -\chapter{Classes by category}\label{classesbycat} - -A classification of property sheet classes by category. - -\section{Data classes} - -\begin{itemize}\itemsep=0pt -\item \helpref{wxProperty}{wxproperty} -\item \helpref{wxPropertyValue}{wxpropertyvalue} -\item \helpref{wxPropertySheet}{wxpropertysheet} -\end{itemize} - - -\section{Validator classes}\label{validatorclasses} - -Validators check that the values the user has entered for a property are -valid. They can also define specific ways of entering data, such as a -file selector for a filename, and they are responsible for transferring -values between the wxProperty and the physical display. - -Base classes: - -\begin{itemize}\itemsep=0pt -\item \helpref{wxPropertyValidator}{wxproperty} -\item \helpref{wxPropertyListValidator}{wxpropertylistvalidator} -\item \helpref{wxPropertyFormValidator}{wxpropertyformvalidator} -\end{itemize} - -List view validators: - -\begin{itemize}\itemsep=0pt -\item \helpref{wxBoolListValidator}{wxboollistvalidator} -\item \helpref{wxFilenameListValidator}{wxfilenamelistvalidator} -\item \helpref{wxIntegerListValidator}{wxintegerlistvalidator} -\item \helpref{wxListOfStringsListValidator}{wxlistofstringslistvalidator} -\item \helpref{wxRealListValidator}{wxreallistvalidator} -\item \helpref{wxStringListValidator}{wxstringlistvalidator} -\end{itemize} - -Form view validators: - -\begin{itemize}\itemsep=0pt -\item \helpref{wxBoolFormValidator}{wxboolformvalidator} -\item \helpref{wxIntegerFormValidator}{wxintegerformvalidator} -\item \helpref{wxRealFormValidator}{wxrealformvalidator} -\item \helpref{wxStringFormValidator}{wxstringformvalidator} -\end{itemize} - -\section{View classes}\label{viewclasses} - -View classes mediate between a property sheet and a physical window. - -\begin{itemize}\itemsep=0pt -\item \helpref{wxPropertyView}{wxpropertyview} -\item \helpref{wxPropertyListView}{wxpropertylistview} -\item \helpref{wxPropertyFormView}{wxpropertyformview} -\end{itemize} - -\section{Window classes}\label{windowclasses} - -The class library defines some window classes that can be used as-is with a suitable -view class and property sheet. - -\begin{itemize}\itemsep=0pt -\item \helpref{wxPropertyFormFrame}{wxpropertyformframe} -\item \helpref{wxPropertyFormDialog}{wxpropertyformdialog} -\item \helpref{wxPropertyFormPanel}{wxpropertyformpanel} -\item \helpref{wxPropertyListFrame}{wxpropertylistframe} -\item \helpref{wxPropertyListDialog}{wxpropertylistdialog} -\item \helpref{wxPropertyListPanel}{wxpropertylistpanel} -\end{itemize} - -\section{Registry classes} - -A validator registry is a list of validators that can be applied to properties in a property sheet. -There may be one or more registries per property view. - -\begin{itemize}\itemsep=0pt -\item \helpref{wxPropertyValidatorRegistry}{wxpropertyvalidatorregistry} -\end{itemize} - - -\chapter{Topic overviews}\label{overviews} - -This chapter contains a selection of topic overviews. - -\section{Property classes overview}\label{propertyoverview} - -The property classes help a programmer to express relationships between -data and physical windows, in particular: - -\begin{itemize}\itemsep=0pt -\item the transfer of data to and from the physical controls; -\item the behaviour of various controls and custom windows for particular -types of data; -\item the validation of data, notifying the user when incorrect data is entered, -or even better, constraining the input so only valid data can be entered. -\end{itemize} - -With a consistent framework, the programmer should be able to use existing -components and design new ones in a principled manner, to solve many data entry -requirements. - -Each datum is represented in a \helpref{wxProperty}{wxproperty}, which has a name and a value. -Various C++ types are permitted in the value of a property, and the property can store a pointer -to the data instead of a copy of the data. A \helpref{wxPropertySheet}{wxpropertysheet} represents a number of these properties. - -These two classes are independent from the way in which the data is visually manipulated. To -mediate between property sheets and windows, the abstract class \helpref{wxPropertyView}{wxpropertyview} is -available for programmers to derive new kinds of view. One kind of view that is available is the \helpref{wxPropertyListView}{wxpropertylistview}, -which displays the data in a Visual Basic-style list, with a small number of controls for editing -the currently selected property. Another is \helpref{wxPropertyFormView}{wxpropertyformview} which -mediates between an existing dialog or panel and the property sheet. - -The hard work of mediation is actually performed by validators, which are instances of classes -derived from \helpref{wxPropertyValidator}{wxpropertyvalidator}. A validator is associated with -a particular property and is responsible for -responding to user interface events, and displaying, updating and checking the property value. -Because a validator's behaviour depends largely on the kind of view being used, there has to be -a separate hierarchy of validators for each class of view. So for wxPropertyListView, there is -an abstract class \helpref{wxPropertyListValidator}{wxpropertylistvalidator} from which concrete -classes are derived, such as \helpref{wxRealListValidator}{wxreallistvalidator} and -\rtfsp\helpref{wxStringListValidator}{wxstringlistvalidator}. - -A validator can be explicitly set for a property, so there is no doubt which validator -should be used to edit that property. However, it is also possible to define a registry -of validators, and have the validator chosen on the basis of the {\it role} of the property. -So a property with a ``filename" role would match the ``filename" validator, which pops -up a file selector when the user double clicks on the property. - -You don't have to define your own frame or window classes: there are some predefined -that will work with the property list view. See \helpref{Window classes}{windowclasses} for -further details. - -\subsection{Example 1: Property list view} - -The following code fragment shows the essentials of creating a registry of -standard validators, a property sheet containing some properties, and -a property list view and dialog or frame. RegisterValidators will be -called on program start, and PropertySheetTest is called in response to a -menu command. - -Note how some properties are created with an explicit reference to -a validator, and others are provided with a ``role'' which can be matched -against a validator in the registry. - -The interface generated by this test program is shown in the section \helpref{Appearance and -behaviour of a property list view}{appearance}. - -\begin{verbatim} -void RegisterValidators(void) -{ - myListValidatorRegistry.RegisterValidator((wxString)"real", new wxRealListValidator); - myListValidatorRegistry.RegisterValidator((wxString)"string", new wxStringListValidator); - myListValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerListValidator); - myListValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolListValidator); -} - -void PropertyListTest(Bool useDialog) -{ - wxPropertySheet *sheet = new wxPropertySheet; - - sheet->AddProperty(new wxProperty("fred", 1.0, "real")); - sheet->AddProperty(new wxProperty("tough choice", (Bool)TRUE, "bool")); - sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerListValidator(-50, 50))); - sheet->AddProperty(new wxProperty("bill", 25.0, "real", new wxRealListValidator(0.0, 100.0))); - sheet->AddProperty(new wxProperty("julian", "one", "string")); - sheet->AddProperty(new wxProperty("bitmap", "none", "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"))); - wxStringList *strings = new wxStringList("one", "two", "three", NULL); - sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringListValidator(strings))); - - wxPropertyListView *view = - new wxPropertyListView(NULL, - wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN); - - wxDialogBox *propDialog = NULL; - wxPropertyListFrame *propFrame = NULL; - if (useDialog) - { - propDialog = new wxPropertyListDialog(view, NULL, "Property Sheet Test", TRUE, -1, -1, 400, 500); - } - else - { - propFrame = new wxPropertyListFrame(view, NULL, "Property Sheet Test", -1, -1, 400, 500); - } - - view->AddRegistry(&myListValidatorRegistry); - - if (useDialog) - { - view->ShowView(sheet, propDialog); - propDialog->Centre(wxBOTH); - propDialog->Show(TRUE); - } - else - { - propFrame->Initialize(); - view->ShowView(sheet, propFrame->GetPropertyPanel()); - propFrame->Centre(wxBOTH); - propFrame->Show(TRUE); - } -} -\end{verbatim} - -\subsection{Example 2: Property form view} - -This example is similar to Example 1, but uses a property form view to -edit a property sheet using a predefined dialog box. - -\begin{verbatim} -void RegisterValidators(void) -{ - myFormValidatorRegistry.RegisterValidator((wxString)"real", new wxRealFormValidator); - myFormValidatorRegistry.RegisterValidator((wxString)"string", new wxStringFormValidator); - myFormValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerFormValidator); - myFormValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolFormValidator); -} - -void PropertyFormTest(Bool useDialog) -{ - wxPropertySheet *sheet = new wxPropertySheet; - - sheet->AddProperty(new wxProperty("fred", 25.0, "real", new wxRealFormValidator(0.0, 100.0))); - sheet->AddProperty(new wxProperty("tough choice", (Bool)TRUE, "bool")); - sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerFormValidator(-50, 50))); - sheet->AddProperty(new wxProperty("julian", "one", "string")); - wxStringList *strings = new wxStringList("one", "two", "three", NULL); - sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringFormValidator(strings))); - - wxPropertyFormView *view = new wxPropertyFormView(NULL); - - wxDialogBox *propDialog = NULL; - wxPropertyFormFrame *propFrame = NULL; - if (useDialog) - { - propDialog = new wxPropertyFormDialog(view, NULL, "Property Form Test", TRUE, -1, -1, 400, 300); - } - else - { - propFrame = new wxPropertyFormFrame(view, NULL, "Property Form Test", -1, -1, 400, 300); - propFrame->Initialize(); - } - - wxPanel *panel = propDialog ? propDialog : propFrame->GetPropertyPanel(); - panel->SetLabelPosition(wxVERTICAL); - - // Add items to the panel - - (void) new wxButton(panel, (wxFunction)NULL, "OK", -1, -1, -1, -1, 0, "ok"); - (void) new wxButton(panel, (wxFunction)NULL, "Cancel", -1, -1, 80, -1, 0, "cancel"); - (void) new wxButton(panel, (wxFunction)NULL, "Update", -1, -1, 80, -1, 0, "update"); - (void) new wxButton(panel, (wxFunction)NULL, "Revert", -1, -1, -1, -1, 0, "revert"); - panel->NewLine(); - - // The name of this text item matches the "fred" property - (void) new wxText(panel, (wxFunction)NULL, "Fred", "", -1, -1, 90, -1, 0, "fred"); - (void) new wxCheckBox(panel, (wxFunction)NULL, "Yes or no", -1, -1, -1, -1, 0, "tough choice"); - (void) new wxSlider(panel, (wxFunction)NULL, "Sliding scale", 0, -50, 50, 100, -1, -1, wxHORIZONTAL, "ian"); - panel->NewLine(); - (void) new wxListBox(panel, (wxFunction)NULL, "Constrained", wxSINGLE, -1, -1, 100, 90, 0, NULL, 0, "constrained"); - - view->AddRegistry(&myFormValidatorRegistry); - - if (useDialog) - { - view->ShowView(sheet, propDialog); - view->AssociateNames(); - view->TransferToDialog(); - propDialog->Centre(wxBOTH); - propDialog->Show(TRUE); - } - else - { - view->ShowView(sheet, propFrame->GetPropertyPanel()); - view->AssociateNames(); - view->TransferToDialog(); - propFrame->Centre(wxBOTH); - propFrame->Show(TRUE); - } -} -\end{verbatim} - -\section{Validator classes overview}\label{validatoroverview} - -Classes: \helpref{Validator classes}{validatorclasses} - -The validator classes provide functionality for mediating between a wxProperty and -the actual display. There is a separate family of validator classes for each -class of view, since the differences in user interface for these views implies -that little common functionality can be shared amongst validators. - -\subsection{wxPropertyValidator overview}\label{wxpropertyvalidatoroverview} - -Class: \helpref{wxPropertyValidator}{wxpropertyvalidator} - -This class is the root of all property validator classes. It contains a small -amount of common functionality, including functions to convert between -strings and C++ values. - -A validator is notionally an object which sits between a property and its displayed -value, and checks that the value the user enters is correct, giving an error message -if the validation fails. In fact, the validator does more than that, and is akin to -a view class but at a finer level of detail. It is also responsible for -loading the dialog box control with the value from the property, putting it back -into the property, preparing special controls for editing the value, and -may even invoke special dialogs for editing the value in a convenient way. - -In a property list dialog, there is quite a lot of scope for supplying custom dialogs, -such as file or colour selectors. For a form dialog, there is less scope because -there is no concept of `detailed editing' of a value: one control is associated with -one property, and there is no provision for invoking further dialogs. The reader -may like to work out how the form view could be extended to provide some of the -functionality of the property list! - -Validator objects may be associated explictly with a wxProperty, or they may be -indirectly associated by virtue of a property `kind' that matches validators having -that kind. In the latter case, such validators are stored in a validator registry -which is passed to the view before the dialog is shown. If the validator takes -arguments, such as minimum and maximum values in the case of a wxIntegerListValidator, -then the validator must be associated explicitly with the property. The validator -will be deleted when the property is deleted. - -\subsection{wxPropertyListValidator overview}\label{wxpropertylistvalidatoroverview} - -Class: \helpref{wxPropertyListValidator}{wxpropertylistvalidator} - -This class is the abstract base class for property list view validators. -The list view acts upon a user interface containing a list of properties, -a text item for direct property value editing, confirm/cancel buttons for the value, -a pulldown list for making a choice between values, and OK/Cancel/Help buttons -for the dialog (see \helpref{property list appearance}{appearance}). - -By overriding virtual functions, the programmer can create custom -behaviour for different kinds of property. Custom behaviour can use just the -available controls on the property list dialog, or the validator can -invoke custom editors with quite different controls, which pop up in -`detailed editing' mode. - -See the detailed class documentation for the members you should override -to give your validator appropriate behaviour. - -\subsection{wxPropertyFormValidator overview}\label{wxpropertyformvalidatoroverview} - -This class is the abstract base class for property form view validators. -The form view acts upon an existing dialog box or panel, where either the -panel item names correspond to property names, or the programmer has explicitly -associated the panel item with the property. - -By overriding virtual functions, the programmer determines how -values are displayed or retrieved, and the checking that the validator does. - -See the detailed class documentation for the members you should override -to give your validator appropriate behaviour. - -\section{View classes overview}\label{viewoverview} - -Classes: \helpref{View classes}{viewclasses} - -An instance of a view class relates a property sheet with an actual window. -Currently, there are two classes of view: wxPropertyListView and wxPropertyFormView. - -\subsection{wxPropertyView overview}\label{wxpropertyviewoverview} - -Class: \helpref{wxPropertyView}{wxpropertyview} - -This is the abstract base class for property views. - -\subsection{wxPropertyListView overview}\label{wxpropertylistviewoverview} - -Class: \helpref{wxPropertyListView}{wxpropertylistview} - -The property list view defines the relationship between a property sheet and -a property list dialog or panel. It manages user interface events such as -clicking on a property, pressing return in the text edit field, and clicking -on Confirm or Cancel. These events cause member functions of the -class to be called, and these in turn may call member functions of -the appropriate validator to be called, to prepare controls, check the property value, -invoke detailed editing, etc. - -\subsection{wxPropertyFormView overview}\label{wxpropertyformviewoverview} - -Class: \helpref{wxPropertyFormView}{wxpropertyformview} - -The property form view manages the relationship between a property sheet -and an existing dialog or panel. - -You must first create a panel or dialog box for the view to work on. -The panel should contain panel items with names that correspond to -properties in your property sheet; or you can explicitly set the -panel item for each property. - -Apart from any custom panel items that you wish to control independently -of the property-editing items, wxPropertyFormView takes over the -processing of item events. It can also control normal dialog behaviour such -as OK, Cancel, so you should also create some standard buttons that the property view -can recognise. Just create the buttons with standard names and the view -will do the rest. The following button names are recognised: - -\begin{itemize}\itemsep=0pt -\item {\bf ok}: indicates the OK button. Calls wxPropertyFormView::OnOk. By default, -checks and updates the form values, closes and deletes the frame or dialog, then deletes the view. -\item {\bf cancel}: indicates the Cancel button. Calls wxPropertyFormView::OnCancel. By default, -closes and deletes the frame or dialog, then deletes the view. -\item {\bf help}: indicates the Help button. Calls wxPropertyFormView::OnHelp. This needs -to be overridden by the application for anything interesting to happen. -\item {\bf revert}: indicates the Revert button. Calls wxPropertyFormView::OnRevert, -which by default transfers the wxProperty values to the panel items (in effect -undoing any unsaved changes in the items). -\item {\bf update}: indicates the Revert button. Calls wxPropertyFormView::OnUpdate, which -by defaults transfers the displayed values to the wxProperty objects. -\end{itemize} - -\section{wxPropertySheet overview}\label{wxpropertysheetoverview} - -Classes: \helpref{wxPropertySheet}{wxpropertysheet}, \helpref{wxProperty}{wxproperty}, \helpref{wxPropertyValue}{wxpropertyvalue} - -A property sheet defines zero or more properties. This is a bit like an explicit representation of -a C++ object. wxProperty objects can have values which are pointers to C++ values, or they -can allocate their own storage for values. - -Because the property sheet representation is explicit and can be manipulated by -a program, it is a convenient form to be used for a variety of -editing purposes. wxPropertyListView and wxPropertyFormView are two classes that -specify the relationship between a property sheet and a user interface. You could imagine -other uses for wxPropertySheet, for example to generate a form-like user interface without -the need for GUI programming. Or for storing the names and values of command-line switches, with the -option to subsequently edit these values using a wxPropertyListView. - -A typical use for a property sheet is to represent values of an object -which are only implicit in the current representation of it. For -example, in Visual Basic and similar programming environments, you can -`edit a button', or rather, edit the button's properties. One of the -properties you can edit is {\it width} - but there is no explicit -representation of width in a wxWindows button; instead, you call SetSize -and GetSize members. To translate this into a consisent, -property-oriented scheme, we could derive a new class -wxButtonWithProperties, which has two new functions: SetProperty and -GetProperty. SetProperty accepts a property name and a value, and calls -an appropriate function for the property that is being passed. -GetProperty accepts a property name, returning a property value. So -instead of having to use the usual arbitrary set of C++ member functions -to set or access attributes of a window, programmer deals merely with -SetValue/GetValue, and property names and values. -We now have a single point at which we can modify or query an object by specifying -names and values at run-time. (The implementation of SetProperty and GetProperty -is probably quite messy and involves a large if-then-else statement to -test the property name and act accordingly.) - -When the user invokes the property editor for a wxButtonWithProperties, the system -creates a wxPropertySheet with `imaginary' properties such as width, height, font size -and so on. For each property, wxButtonWithProperties::GetProperty is called, and the result is -passed to the corresponding wxProperty. The wxPropertySheet is passed to a wxPropertyListView -as described elsewhere, and the user edits away. When the user has finished editing, the system calls -wxButtonWithProperties::SetProperty to transfer the wxProperty value back into the button -by way of an appropriate call, wxWindow::SetSize in the case of width and height properties. - - - diff --git a/utils/wxprop/docs/contents.gif b/utils/wxprop/docs/contents.gif deleted file mode 100644 index 3dddfa3dd5..0000000000 Binary files a/utils/wxprop/docs/contents.gif and /dev/null differ diff --git a/utils/wxprop/docs/forward.gif b/utils/wxprop/docs/forward.gif deleted file mode 100644 index 7e3a96d480..0000000000 Binary files a/utils/wxprop/docs/forward.gif and /dev/null differ diff --git a/utils/wxprop/docs/prop.hpj b/utils/wxprop/docs/prop.hpj deleted file mode 100644 index a8226a4b96..0000000000 --- a/utils/wxprop/docs/prop.hpj +++ /dev/null @@ -1,17 +0,0 @@ -[OPTIONS] -BMROOT=c:\wx\utils\wxprop\docs ; Assume that bitmaps are where the source is -TITLE=Property Classes Manual -CONTENTS=Contents -COMPRESS=HIGH - -[FILES] -Prop.rtf - -[CONFIG] -CreateButton("Up", "&Up", "JumpId(`Prop.hlp', `Contents')") -BrowseButtons() - -[MAP] - -[BITMAPS] - diff --git a/utils/wxprop/docs/prop.tex b/utils/wxprop/docs/prop.tex deleted file mode 100644 index 89f12f7713..0000000000 --- a/utils/wxprop/docs/prop.tex +++ /dev/null @@ -1,55 +0,0 @@ -\documentstyle[a4,makeidx,verbatim,texhelp,fancyhea,mysober,mytitle]{report} -\input psbox.tex -% Remove this for processing with dvi2ps instead of dvips -%\special{!/@scaleunit 1 def} -\parskip=10pt -\parindent=0pt -\title{User Manual for wxWindows Property Sheet Classes Version 2.0} -\winhelponly{\author{by Julian Smart, Anthemion Software\\$$\image{}{prop1}$$}} -\winhelpignore{\author{Julian Smart, Anthemion Software} -\date{October 1997} -} -\makeindex -\begin{document} -\maketitle -\pagestyle{fancyplain} -\bibliographystyle{plain} -\setheader{{\it CONTENTS}}{}{}{}{}{{\it CONTENTS}} -\setfooter{\thepage}{}{}{}{}{\thepage}% -\pagenumbering{roman} -\tableofcontents - -\chapter*{Copyright notice} -\setheader{{\it COPYRIGHT}}{}{}{}{}{{\it COPYRIGHT}}% -\setfooter{\thepage}{}{}{}{}{\thepage}% - -\begin{center} -Copyright (c) 1997 Julian Smart, Anthemion Software -\end{center} - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose is hereby granted without fee, provided that the -above copyright notice, author statement and this permission notice appear in -all copies of this software and related documentation. - -THE SOFTWARE IS PROVIDED ``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 JULIAN SMART OR ANTHEMION SOFTWARE BE LIABLE FOR ANY SPECIAL, -INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED -OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -\input{body.tex} -\input{classes.tex} -\input{changes.tex} - -\newpage - -\addcontentsline{toc}{chapter}{Index} -\setheader{{\it INDEX}}{}{}{}{}{{\it INDEX}}% -\setfooter{\thepage}{}{}{}{}{\thepage}% -\printindex -\end{document} diff --git a/utils/wxprop/docs/prop1.bmp b/utils/wxprop/docs/prop1.bmp deleted file mode 100644 index 92c6beec8b..0000000000 Binary files a/utils/wxprop/docs/prop1.bmp and /dev/null differ diff --git a/utils/wxprop/docs/prop1.eps b/utils/wxprop/docs/prop1.eps deleted file mode 100644 index 02ac7d68cf..0000000000 --- a/utils/wxprop/docs/prop1.eps +++ /dev/null @@ -1,539 +0,0 @@ -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: prop1.eps -%%Creator: XV Version 2.20 Rev: 4/24/92 - by John Bradley -%%BoundingBox: 167 292 445 500 -%%Pages: 1 -%%DocumentFonts: -%%EndComments -%%EndProlog - -%%Page: 1 1 - -% remember original state -/origstate save def - -% build a temporary dictionary -20 dict begin - -% lower left corner -167 292 translate - -% size of image (on paper, in 1/72inch coords) -278 208 scale - -% define 'colorimage' if it isn't defined -% ('colortogray' and 'mergeprocs' come from xwd2ps -% via xgrab) -/colorimage where % do we know about 'colorimage'? - { pop } % yes: pop off the 'dict' returned - { % no: define one - /colortogray { % define an RGB->I function - /rgbdata exch store % call input 'rgbdata' - rgbdata length 3 idiv - /npixls exch store - /rgbindx 0 store - /grays npixls string store % str to hold the result - 0 1 npixls 1 sub { - grays exch - rgbdata rgbindx get 20 mul % Red - rgbdata rgbindx 1 add get 32 mul % Green - rgbdata rgbindx 2 add get 12 mul % Blue - add add 64 idiv % I = .5G + .31R + .18B - put - /rgbindx rgbindx 3 add store - } for - grays - } bind def - - % Utility procedure for colorimage operator. - % This procedure takes two procedures off the - % stack and merges them into a single procedure. - - /mergeprocs { % def - dup length - 3 -1 roll - dup - length - dup - 5 1 roll - 3 -1 roll - add - array cvx - dup - 3 -1 roll - 0 exch - putinterval - dup - 4 2 roll - putinterval - } bind def - - /colorimage { % def - pop pop % remove 'false 3' operands - {colortogray} mergeprocs - image - } bind def - } ifelse % end of 'false' case - - - -% define the colormap -/cmap 42 string def - - -% load up the colormap -currentfile cmap readhexstring -000000 bf0000 00bf00 bfbf00 0000bf 00bfbf c0c0c0 808080 ff0000 00ff00 -ffff00 0000ff 00ffff ffffff -pop pop % lose return values from readhexstring - - -% rlecmapimage expects to have 'w h bits matrix' on stack -/rlecmapimage { - /buffer 1 string def - /rgbval 3 string def - /block 384 string def - - % proc to read a block from file, and return RGB data - { currentfile buffer readhexstring pop - /bcount exch 0 get store - bcount 128 ge - { % it's a non-run block - 0 1 bcount 128 sub - { currentfile buffer readhexstring pop pop - - % look up value in color map - /rgbval cmap buffer 0 get 3 mul 3 getinterval store - - % and put it in position i*3 in block - block exch 3 mul rgbval putinterval - } for - block 0 bcount 127 sub 3 mul getinterval - } - - { % else it's a run block - currentfile buffer readhexstring pop pop - - % look up value in colormap - /rgbval cmap buffer 0 get 3 mul 3 getinterval store - - 0 1 bcount { block exch 3 mul rgbval putinterval } for - - block 0 bcount 1 add 3 mul getinterval - } ifelse - } % end of proc - false 3 colorimage -} bind def - - -278 208 8 % dimensions of data -[278 0 0 -208 0 208] % mapping matrix -rlecmapimage - -7f067f0614060000 -81060d7f0d7f0d110d810700 -82060d067f067f061006810700 -82060d067f067f061006810700 -82060d068106047f047f040c040106810700 -82060d068106048204060d820d060783070d0702010203098102047f047a040106810700 - -82060d068106048704060b060001020781070283020702098109028102047f0446040e0d -81000d0d0d81000481040d0d0d81000481040682060700 -82060d0681060482040806810600820002078507020902070201028109047f044604810d -060b068307000d060b068207000482040d060b068207000481040682060700 -82060d0681060481040685060800040307820702098409020702098109040104050d2d04 -030d0204010d1a04050d6604810d060b068307000d06810600070001068207000482040d -060b068207000481040682060700 -82060d068106048704060b0604000a0789070209020702070209040104010d0204010d1d -04010d0b04010d0104010d0104010d1204010d0704010d1004010d5504810d060b068307 -000d06810600070001068207000482040d06010601000306010001068207000481040682 -060700 -82060d068106048204070681060001000107010286070209020702040104010d0204010d -1d04010d0b04010d0504010d1204010d0704010d1004010d5504810d060b068307000d06 -820600060506810006830607000482040d06020601000106010002068207000481040682 -060700 -82060d0681060485040d0607060d010d8407020002090109820200040104010d0204010d -81040d010d0104030d0104040d0204030d0104020d81040d010d81040d820d040d810d04 -0304010d0504040d0204030d0204030d0104020d0604010d0404030d0204020d0104020d -5404810d060b068307000d06820600060506810006830607000482040d06030603000306 -8207000481040682060700 -82060d068106048104070507010006020204050d0104010d0104010d0104010d81040d81 -0d0481040d820d040d810d0481040d820d040d810d0481040d810d0481040d820d040d81 -0d040404030d0204020d81040d820d040d810d0481040d820d040d810d0481040d820d04 -0d810d040604010d0304010d0104010d81040d820d040d820d040d810d045404810d060b -068307000d06820600060506810006830607000482040d06040601000406820700048104 -0682060700 -82060d068106048104050505010006030204010d0504010d0104010d0104010d81040d81 -0d0481040d820d040d040d81040d810d0481040d810d0481040d820d040d810d04070401 -0d0104010d0104010d81040d040d81040d040d81040d810d040604010d0304050d010401 -0d0204010d5504810d060b068307000d06820600060506810006830607000482040d0603 -06030003068207000481040682060700 -82060d0681060481040c010c8205080c830c05030a020a81030a810a040104010d050401 -0d0104010d0104010d81040d810d0481040d820d040d810d040304010d0104010d010401 -0d81040d810d040704010d0104010d0104010d81040d810d040304010d0404010d070401 -0d0304010d0604010d0104010d5504810d060b068307000d068206000605068100068306 -07000482040d06020601000106010002068207000481040682060700 -82060d068106048c040c05070507050c05030a030a840a03000a040104010d0504010d01 -04010d0104010d81040d810d0481040d820d040d810d0481040d820d040d810d0481040d -810d040104020d0504010d0104010d0104010d0104010d81040d810d0481040d820d040d -810d0481040d820d040d810d040604010d0304010d0104010d81040d820d040d820d040d -810d045404810d060106050003068307000d06820600060506810006830607000482040d -06010601000306010001068207000481040682060700 -82060d0681060482040c08020886070c05030a030a010a82030a040104010d0504010d02 -04030d0104040d0204030d0104010d0204010d0104010d0704030d0204010d0104010d01 -04030d0204030d0204010d0604010d0404030d0204020d0204010d5404810d0601060500 -03068307000d06810600070001068207000482040d060b068207000481040682060700 -82060d0681060482040c080208010c8205030a810a0384030a030a041404010d1404010d -7f041804810d060b068307000d060b068207000482040d060b0682070004810406820607 -00 -82060d0681060482040c080308850c05030a030a010a82000a041404010d1204020d7f04 -1904810d070c0782000d070c0781000482040d070c0781000481040682060700 -82060d0681060483040c05080208850c05030a030a810a0382030a047f0446041f000104 -0f0001040106810700 -82060d0681060481040c050c8205030a050a7f047b040106810700 -82060d068106047f047f040c040106810700 -82060d067f067f061006810700 -82060d067f067f061006810700 -82060d0637067f073907810d061c06810700 -82060d06030616000306160001068107007f00360082060d0681060015000406810700 -82060d06020681000d140d820700068206000d140d8507000607000d7f0d350d84060d06 -000d140d820700060206810700 -82060d06020682000d06120601078100068306000d061206010784000607000d7f0d350d -84060d06000d130d01078100060206810700 -82060d06020682000d06120601078100068306000d061206010784000607000d7f0d350d -84060d06000d810d06110601078100060206810700 -82060d06020682000d06120601078100068306000d061206010784000607000d7f0d350d -84060d06000d810d06110601078100060206810700 -82060d06020682000d0603068100060606810006030601078100068306000d0612060107 -84000607000d820d000d7f0d320d84060d06000d810d06110601078100060206810700 -82060d06020682000d06030683000600060306810006040601078100068306000d061206 -010785000607000d0081000d7f0d320d84060d06000d810d061106010781000602068107 -00 -82060d06020682000d06040683000600060106810006050601078100068306000d060b06 -8100060406010785000607000d000100810d0081000d820d000d810d0081000d810d0002 -007f0d220d84060d06000d810d06110601078100060206810700 -82060d06020682000d06050685000600060006060601078100068306000d060a06830006 -00060306010785000607000d0081000d810d0082000d000100810d0082000d0081000d81 -0d0081000d7f0d200d84060d06000d810d06110601078100060206810700 -82060d06020682000d0606068300060006070601078100068306000d0609068300060006 -0406010785000607000d0081000d810d0082000d000100810d0082000d0081000d810d00 -81000d7f0d200d84060d06000d810d06110601078100060206810700 -82060d06020682000d0607068300060006060601078100068306000d0604068100060106 -83000600060506010785000607000d0081000d010d0200810d000100010d0100010d0100 -7f0d210d84060d06000d810d06110601078100060206810700 -82060d06020682000d06060685000600060006050601078100068306000d060306870006 -0006000600060606010785000607000d0081000d010d0200810d000100010d0100010d01 -007f0d210d84060d06000d810d06110601078100060206810700 -82060d06020682000d06050681000601068300060006040601078100068306000d060406 -850006000600060706010784000607000d810d0081000d810d0081000d010d0100020d03 -007f0d220d84060d06000d810d0603060100810600820006008100060406010781000602 -06810700 -82060d06020682000d06040681000603068300060006030601078100068306000d060506 -83000600060806010784000607000d7f0d350d84060d06000d810d060306010081060082 -000600810006040601078100060206810700 -82060d06020682000d060306010005060100040601078100068306000d06060681000609 -06010784000607000d7f0d350d84060d06000d810d06110601078100060206810700 -82060d06020682000d06120601078100068306000d061206010784000607000d7f0d350d -84060d06000d810d06110601078100060206810700 -82060d06020682000d06120601078100068306000d061206010784000607000d7f0d350d -84060d06000d810d06110601078100060206810700 -82060d06020682000d0714078100068306000d07140784000607000d7f0d350d85060d06 -000d0714078100060206810700 -82060d06020682000d0714078100068306000d07140784000607000d7f0d350d84060d06 -000715078100060206810700 -82060d06030616000306160001068207000d7f0d350d82060d0681060015000406810700 - -82060d0637068107067f063706810d061c06810700 -82060d0637067f0d3a0d1d06810700 -82060d0601067f077f070a07810d060106810700 -82060d0601068107007f007f00070082060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d010d0300010d0400020d03007f0d720d82060d060106810700 -82060d0601068207000d810d0081000d810d0082000d0081000d810d0082000d0081000d -810d0081000d7f0d700d82060d060106810700 -82060d0601068207000d810d0081000d810d0082000d0081000d810d0082000d0004007f -0d710d82060d060106810700 -82060d0601068207000d810d0081000d810d0082000d0081000d810d0082000d0081000d -7f0d740d82060d060106810700 -82060d0601068207000d810d0081000d810d0082000d0081000d810d0082000d0081000d -810d0081000d7f0d700d82060d060106810700 -82060d0601068207000d010d0300010d0100010d0100010d03007f0d720d82060d060106 -810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d060106ff0700040a040a040a040a040a040a040a040a040a040a040a040a040a04 -0a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a04 -0a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a04 -0a040a040a040a040a040a040a040a040a040a040a040a040a040aff040a040a040a040a -040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a -040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a -040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a -040a040a040a040a040a040a8c040a040a040a040a040a060d060106810700 -82060d0601068307000a047f047f04050482060d060106810700 -82060d060106820700047f047f040504830a060d060106810700 -82060d0601068307000a0482040d047f047f04020482060d060106810700 -82060d0601068207000481040d810d047f047f040104830a060d060106810700 -82060d0601068307000a0d020d81040d810d0482040d0481040d810d0481040d020d7f04 -720482060d060106810700 -82060d0601068207000481040d810d0481040d820d040d010d81040d820d040d810d0481 -040d810d047f046f04830a060d060106810700 -82060d0601068407000a040d810d0481040d820d040d010d81040d820d040d810d048104 -0d810d047f04700482060d060106810700 -82060d0601068207000481040d810d040104020d81040d010d0104010d0104010d7f0470 -04830a060d060106810700 -82060d0601068407000a040d810d040104020d81040d010d0104010d0104010d7f047104 -82060d060106810700 -82060d060106820700040104010d0104010d0204010d0204030d7f047104830a060d0601 -06810700 -82060d0601068307000a047f047f04050482060d060106810700 -82060d060106820700047f047f040504830a060d060106810700 -82060d060106ff07000a040a040a040a040a040a040a040a040a040a040a040a040a040a -040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a -040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a -040a040a040a040a040a040a040a040a040a040a040a040a040a04ff0a040a040a040a04 -0a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a04 -0a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a04 -0a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a040a04 -0a040a040a040a040a040a048c0a040a040a040a040a04060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d010d81000d810d0081000d7f0d7e0d82060d060106810700 -82060d0601068207000d810d0081000d810d0081000d7f0d7e0d82060d060106810700 -82060d0601068307000d000200810d000300010d0300010d0300020d03007f0d690d8206 -0d060106810700 -82060d0601068207000d810d0081000d810d0081000d810d0082000d0081000d010d0100 -010d0100810d0081000d810d0081000d7f0d670d82060d060106810700 -82060d0601068207000d810d0081000d810d0081000d810d0082000d0081000d010d0500 -810d0004007f0d680d82060d060106810700 -82060d0601068207000d810d0081000d810d0081000d810d0082000d0081000d010d0100 -040d01007f0d6c0d82060d060106810700 -82060d0601068207000d810d0081000d810d0081000d810d0082000d0081000d010d0100 -010d0100810d0081000d810d0081000d7f0d670d82060d060106810700 -82060d0601068207000d010d0100810d0081000d810d0082000d0081000d020d0300020d -03007f0d690d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068207000d7f0d7f0d060d82060d060106810700 -82060d0601068107067f067f060806810d060106810700 -82060d0601067f0d7f0d0b0d0206810700 -82060d067f067f061006810700 -82060d067f067f061006810700 -82060d0601067f077f070b070206810700 -82060d0601068107007f007f000800810d060106810700 -82060d0601068207000d7f0d760d0e060100810d060106810700 -82060d0601068207000d7f0d760d81060d0b0d81070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d1c0d0100120d01000e0d81000d6b0d0400400d82060d060a0681 -070082000d060106810700 -82060d0601068207000d010d81000d190d81000d120d81000d7b0d85000d000d000d3f0d -82060d060a0681070082000d060106810700 -82060d0601068207000d810d000300030d0200010d0100010d0100020d0100810d008400 -0d000d0081000d090d0300010d82000d0081000d020d0200020d0200040d0300020d0200 -5f0d81000d020d0100810d0082000d0081000d810d0081000d010d02002c0d82060d0603 -06810006040681070082000d060106810700 -82060d0601068207000d010d81000d040d81000d010d81000d820d000d010d81000d820d -000d810d0081000d810d0081000d820d000d070d81000d010d81000d810d0081000d820d -000d820d000d010d81000d020d81000d020d81000d010d81000d820d000d010d81000d5d -0d81000d030d0100030d81000d010d81000d820d000d010d81000d2a0d82060d06020602 -00040681070082000d060106810700 -82060d0601068207000d010d81000d040d81000d010d81000d820d000d010d81000d820d -000d010d81000d820d000d010d81000d070d81000d040d81000d010d81000d820d000d01 -0d81000d020d81000d020d81000d040d04005e0d81000d030d81000d030d81000d010d81 -000d810d0003002b0d82060d0601060400030681070082000d060106810700 -82060d0601068207000d010d81000d010d81000d820d000d010d81000d820d000d810d00 -81000d820d000d010d81000d820d000d010d81000d070d81000d040d81000d010d81000d -820d000d010d81000d020d81000d020d81000d040d81000d610d81000d030d81000d030d -81000d810d0081000d820d000d2e0d82060d068106000500020681070082000d06010681 -0700 -82060d0601068207000d020d0200030d0200030d0100810d0081000d810d000200810d00 -0100810d000100080d0300810d000100810d000100010d0200020d0400020d0300020d03 -005d0d0200020d0300030d0100810d0081000d810d0002002b0d82060d060a0681070082 -000d060106810700 -82060d0601068207000d1a0d81000d7f0d590d82060d060a0681070082000d0601068107 -00 -82060d0601068207000d170d02007f0d5b0d82060d060a0681070082000d060106810700 - -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d8106070c070100810d060106810700 -82060d0601068207000d7f0d760d1000810d060106810700 -82060d0601068207000d7f0d760d92060d060d060d060d060d060d060d060d000d060106 -810700 -82060d0601068207000d7f0d770d91060d060d060d060d060d060d060d06000d06010681 -0700 -82060d0601068207000d030d81000d7f0d2d0d81000d020d0300390d92060d060d060d06 -0d060d060d060d060d000d060106810700 -82060d0601068207000d7f0d320d0100030d81000d3c0d91060d060d060d060d060d060d -060d06000d060106810700 -82060d0601068207000d010d0200040d0200010d0100810d0081000d7f0d1c0d83000d00 -0d020d81000d3b0d92060d060d060d060d060d060d060d060d000d060106810700 -82060d0601068207000d030d81000d020d81000d010d81000d810d0081000d820d000d7f -0d1a0d81000d820d000d020d02003b0d91060d060d060d060d060d060d060d06000d0601 -06810700 -82060d0601068207000d030d81000d030d0300010d81000d010d81000d7f0d1a0d040005 -0d81000d380d92060d060d060d060d060d060d060d060d000d060106810700 -82060d0601068207000d030d81000d020d81000d010d81000d820d000d010d81000d7f0d -1d0d81000d010d81000d010d81000d380d0e060100810d060106810700 -82060d0601068207000d010d0400010d0800810d0001007f0d1c0d0200020d02003a0d81 -060d0b0d81070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d810d0081000d060d81000d030d0100040d01007f0d170d020003 -0d0300390d82060d060a0681070082000d060106810700 -82060d0601068207000d010d81000d0d0d81000d040d81000d7f0d150d81000d010d8100 -0d010d81000d3b0d82060d060a0681070082000d060106810700 -82060d0601068207000d010d82000d0081000d010d0200050d81000d040d81000d7f0d18 -0d81000d020d81000d3b0d82060d060a0681070082000d060106810700 -82060d0601068207000d010d0100010d81000d020d81000d040d81000d040d81000d7f0d -170d81000d030d02003a0d82060d060a0681070082000d060106810700 -82060d0601068207000d010d81000d010d81000d020d81000d040d81000d040d81000d7f -0d160d81000d070d81000d380d82060d060a0681070082000d060106810700 -82060d0601068207000d010d81000d010d81000d020d81000d040d81000d040d81000d7f -0d150d81000d040d81000d010d81000d380d82060d060a0681070082000d060106810700 - -82060d0601068207000d810d000300020d0400010d0400010d04007f0d140d0400020d02 -003a0d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d030d81000d0a0d0100050d81000d7f0d5b0d82060d060a068107 -0082000d060106810700 -82060d0601068207000d110d81000d7f0d620d82060d060a0681070082000d0601068107 -00 -82060d0601068207000d010d0300010d0100010d0100030d81000d020d0200040d020001 -0d0100810d0081000d7f0d070d0200010d0100810d0081000d020d0200330d82060d060a -0681070082000d060106810700 -82060d0601068207000d040d81000d010d81000d010d81000d020d81000d040d81000d02 -0d81000d010d81000d810d0081000d820d000d7f0d050d81000d010d81000d810d008100 -0d820d000d820d000d010d81000d310d82060d060a0681070082000d060106810700 -82060d0601068207000d040d81000d010d81000d010d81000d020d81000d040d81000d03 -0d0300010d81000d010d81000d7f0d050d81000d010d81000d820d000d010d81000d810d -000300320d82060d060a0681070082000d060106810700 -82060d0601068207000d040d81000d010d81000d810d0081000d020d81000d040d81000d -020d81000d010d81000d820d000d010d81000d7f0d050d81000d010d81000d820d000d01 -0d81000d820d000d350d82060d060a0681070082000d060106810700 -82060d0601068207000d040d81000d020d0100810d0082000d000300010d0400010d0800 -810d0001007f0d060d0200010d0200810d000100010d0300320d82060d060a0681070082 -000d060106810700 -82060d0601068207000d040d81000d7f0d6f0d82060d060a0681070082000d0601068107 -00 -82060d0601068207000d010d02007f0d710d82060d060a0681070082000d060106810700 - -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d7f0d760d82060d060a0681070082000d060106810700 -82060d0601068207000d810d0081000d060d81000d7f0d690d82060d060a068107008200 -0d060106810700 -82060d0601068207000d010d81000d0b0d81000d7f0d640d82060d060a0681070082000d -060106810700 -82060d0601068207000d010d82000d0081000d010d0200020d0400010d0200820d000d02 -0d0200010d0100810d0081000d7f0d050d0100810d0081000d020d0200010d0100810d00 -81000d020d02002c0d82060d060a0681070082000d060106810700 -82060d0601068207000d010d0100010d81000d020d81000d020d81000d040d85000d000d -000d820d000d010d81000d810d0081000d820d000d7f0d050d0100010d81000d820d000d -010d81000d810d0081000d820d000d820d000d010d81000d2a0d82060d060a0681070082 -000d060106810700 -82060d0601068207000d010d81000d010d81000d020d81000d020d81000d040d85000d00 -0d000d010d0300010d81000d010d81000d7f0d050d81000d010d81000d820d000d010d81 -000d820d000d010d81000d810d0003002b0d82060d060a0681070082000d060106810700 - -82060d0601068207000d010d81000d010d81000d020d81000d020d81000d010d81000d86 -0d000d000d000d820d000d010d81000d820d000d010d81000d7f0d050d81000d010d8100 -0d820d000d010d81000d820d000d010d81000d820d000d2e0d82060d060a068107008200 -0d060106810700 -82060d0601068207000d810d000300020d0400020d0200010d0600810d000400810d0002 -007f0d060d0200810d000100010d0200010d0200810d000100010d03002b0d8106070c07 -0100810d060106810700 -82060d0601068207000d240d81000d7f0d4f0d1000810d060106810700 -82060d0601068207000d230d02007f0d4f0d0e060100810d060106810700 -82060d0601068207000d7f0d760d81060d0b0d81070082000d060106810700 -82060d060106820700047f04760482060d060a0681070082000d060106810700 -82060d060106820700047f04760482060d060a0681070082000d060106810700 -82060d060106820700047f04760482060d060a0681070082000d060106810700 -82060d060106820700047f04760482060d060a0681070082000d060106810700 -82060d060106820700043404810d041304010d7f04290482060d06810600050002068107 -0082000d060106810700 -82060d060106820700041d04810d042b04810d046204810d04430482060d060106040003 -0681070082000d060106810700 -82060d060106820700040204030d0204020d0104010d81040d810d040204030d81040d03 -0d0204010d81040d810d040104020d0204020d0204010d81040d810d040204020d030401 -0d82040d046104040d0104020d81040d010d0104020d330482060d060206020004068107 -0082000d060106810700 -82060d060106820700040104810d040104810d0482040d040104810d0481040d810d0482 -040d0482040d040404810d040504010d0304810d040104810d040204810d040204010d01 -04810d0482040d040104810d0482040d0481040d810d046204810d040404810d04010481 -0d0482040d040104810d04310482060d060306810006040681070082000d060106810700 - -82060d060106820700040104810d040404810d040104810d0482040d040104810d040104 -020d0204810d040504810d040404030d0304810d040204810d040104810d0481040d030d -0104810d040104810d046204810d040404850d040d040d0482040d040104810d04310482 -060d060a0681070082000d060106810700 -82060d060106820700040104810d040404810d040104810d0482040d040104810d040404 -810d0482040d040104810d040104810d040304810d040104810d040204810d040204810d -040104810d0482040d040404810d040104810d046204810d040104810d0486040d040d04 -0d0482040d040104810d04310482060d060a0681070082000d060106810700 -82060d060106820700040204030d0204020d0104020d81040d010d81040d020d0304020d -0204030d0204050d81040d030d81040d010d81040d010d0104030d0204040d6304020d03 -04830d040d040204020d330482060d060a0681070082000d060106810700 -82060d060106820700047f04760482060d060a0681070082000d060106810700 -82060d060106820700047f0476048106070c070100810d060106810700 -82060d060106820700047f0476041000810d060106810700 -82060d0601068107067f0677061000810d060106810700 -82060d0601067f0d7f0d0b0d0206810700 -82060d067f067f061006810700 -82060d067f067f061006810700 -82060d067f067f061006810700 -82060d067f067f061006810700 -82060d067f067f061006810700 -82060d067f067f061006810700 -82060d067f067f061006810700 -82060d067f067f061006810700 -82060d067f067f061006810700 -8106077f077f0712070000 -7f007f001500 - -% -% Compression made this file 6.27% of the uncompressed size. -% - - -showpage - -% stop using temporary dictionary -end - -% restore original state -origstate restore - -%%Trailer diff --git a/utils/wxprop/docs/prop1.gif b/utils/wxprop/docs/prop1.gif deleted file mode 100644 index 48715b5525..0000000000 Binary files a/utils/wxprop/docs/prop1.gif and /dev/null differ diff --git a/utils/wxprop/docs/prop2.bmp b/utils/wxprop/docs/prop2.bmp deleted file mode 100644 index d909f41abc..0000000000 Binary files a/utils/wxprop/docs/prop2.bmp and /dev/null differ diff --git a/utils/wxprop/docs/prop2.eps b/utils/wxprop/docs/prop2.eps deleted file mode 100644 index 398e70c553..0000000000 --- a/utils/wxprop/docs/prop2.eps +++ /dev/null @@ -1,664 +0,0 @@ -%!PS-Adobe-2.0 EPSF-2.0 -%%Title: prop2.eps -%%Creator: XV Version 2.20 Rev: 4/24/92 - by John Bradley -%%BoundingBox: 167 221 466 500 -%%Pages: 1 -%%DocumentFonts: -%%EndComments -%%EndProlog - -%%Page: 1 1 - -% remember original state -/origstate save def - -% build a temporary dictionary -20 dict begin - -% lower left corner -167 221 translate - -% size of image (on paper, in 1/72inch coords) -299 279 scale - -% define 'colorimage' if it isn't defined -% ('colortogray' and 'mergeprocs' come from xwd2ps -% via xgrab) -/colorimage where % do we know about 'colorimage'? - { pop } % yes: pop off the 'dict' returned - { % no: define one - /colortogray { % define an RGB->I function - /rgbdata exch store % call input 'rgbdata' - rgbdata length 3 idiv - /npixls exch store - /rgbindx 0 store - /grays npixls string store % str to hold the result - 0 1 npixls 1 sub { - grays exch - rgbdata rgbindx get 20 mul % Red - rgbdata rgbindx 1 add get 32 mul % Green - rgbdata rgbindx 2 add get 12 mul % Blue - add add 64 idiv % I = .5G + .31R + .18B - put - /rgbindx rgbindx 3 add store - } for - grays - } bind def - - % Utility procedure for colorimage operator. - % This procedure takes two procedures off the - % stack and merges them into a single procedure. - - /mergeprocs { % def - dup length - 3 -1 roll - dup - length - dup - 5 1 roll - 3 -1 roll - add - array cvx - dup - 3 -1 roll - 0 exch - putinterval - dup - 4 2 roll - putinterval - } bind def - - /colorimage { % def - pop pop % remove 'false 3' operands - {colortogray} mergeprocs - image - } bind def - } ifelse % end of 'false' case - - - -% define the colormap -/cmap 42 string def - - -% load up the colormap -currentfile cmap readhexstring -000000 bf0000 00bf00 bfbf00 0000bf 00bfbf c0c0c0 808080 ff0000 00ff00 -ffff00 0000ff 00ffff ffffff -pop pop % lose return values from readhexstring - - -% rlecmapimage expects to have 'w h bits matrix' on stack -/rlecmapimage { - /buffer 1 string def - /rgbval 3 string def - /block 384 string def - - % proc to read a block from file, and return RGB data - { currentfile buffer readhexstring pop - /bcount exch 0 get store - bcount 128 ge - { % it's a non-run block - 0 1 bcount 128 sub - { currentfile buffer readhexstring pop pop - - % look up value in color map - /rgbval cmap buffer 0 get 3 mul 3 getinterval store - - % and put it in position i*3 in block - block exch 3 mul rgbval putinterval - } for - block 0 bcount 127 sub 3 mul getinterval - } - - { % else it's a run block - currentfile buffer readhexstring pop pop - - % look up value in colormap - /rgbval cmap buffer 0 get 3 mul 3 getinterval store - - 0 1 bcount { block exch 3 mul rgbval putinterval } for - - block 0 bcount 1 add 3 mul getinterval - } ifelse - } % end of proc - false 3 colorimage -} bind def - - -299 279 8 % dimensions of data -[299 0 0 -279 0 279] % mapping matrix -rlecmapimage - -7f0003007f072607 -07077f067f0618068100070707 -070781060d7f0d7f0d150d820700070707 -070782060d067f067f061406820700070707 -070782060d067f067f061406820700070707 -070782060d068106077f077f0710070106820700070707 -070782060d068106078207060d820d060783070d0702010203098102077f077e07010682 -0700070707 -070782060d068106078707060b060001020781070283020702098109028102077f074a07 -0e0d81000d0d0d81000781070d0d0d81000781070683060700070707 -070782060d0681060782070806810600820002078507020902070201028109077f074a07 -810d060b068307000d060b068207000782070d060b068207000781070683060700070707 - -070782060d06810607810706850608000403078207020984090207020981090701070506 -2d070306020701061a0705066a07810d060b068307000d06810600070001068207000782 -070d060b068207000781070683060700070707 -070782060d068106078707060b0604000a07890702090207020702090701070106020701 -061d0701060b07010601070106010701061207010607070106100701065907810d060b06 -8307000d06810600070001068207000782070d0601060100030601000106820700078107 -0683060700070707 -070782060d0681060701070106020001070102860702090207020701070106020701061d -0701060b070106050701061207010607070106100701065907810d060b068307000d0682 -0600060506810006830607000782070d0602060100010601000206820700078107068306 -0700070707 -070782060d0681060785070d0607060d010d840702000209010982020007010701060207 -010681070601060107030601070406020703060107020681070601068107068206070681 -060703070106050704060207030602070306010702060607010604070306020702060107 -02065807810d060b068307000d06820600060506810006830607000782070d0603060300 -03068207000781070683060700070707 -070782060d06810607070701000602020705060107010601070106010701068107068106 -078107068206070681060781070682060706810607810706810607810706820607068106 -070407030602070206810706820607068106078107068206070681060781070682060706 -81060706070106030701060107010681070682060706820607068106075807810d060b06 -8307000d06820600060506810006830607000782070d0604060100040682070007810706 -83060700070707 -070782060d06810607810705050501000603020701060507010601070106010701068107 -068106078107068206070604068107068106078107068106078107068206070681060707 -070106010701060107010681070604068107060406810706810607060701060307050601 -070106020701065907810d060b068307000d06820600060506810006830607000782070d -060306030003068207000781070683060700070707 -070782060d0681060781070c010c8205080c830c05030a020a81030a810a070107010605 -070106010701060107010681070681060781070682060706810607030701060107010601 -070106810706810607070701060107010601070106810706810607030701060407010607 -0701060307010606070106010701065907810d060b068307000d06820600060506810006 -830607000782070d06020601000106010002068207000781070683060700070707 -070782060d068106078c070c05070507050c05030a030a840a03000a0701070106050701 -060107010601070106810706810607810706820607068106078107068206070681060781 -070681060701070206050701060107010601070106010701068107068106078107068206 -070681060781070682060706810607060701060307010601070106810706820607068206 -07068106075807810d060106050003068307000d06820600060506810006830607000782 -070d06010601000306010001068207000781070683060700070707 -070782060d0681060782070c08020886070c05030a030a010a82030a0701070106050701 -060207030601070406020703060107010602070106010701060707030602070106010701 -06010703060207030602070106060701060407030602070206020701065807810d060106 -050003068307000d06810600070001068207000782070d060b0682070007810706830607 -00070707 -070782060d0681060782070c080208010c8205030a810a0384030a030a07140701061407 -01067f071c07810d060b068307000d060b068207000782070d060b068207000781070683 -060700070707 -070782060d0681060782070c080308850c05030a030a010a82000a071407010612070206 -7f071d07810d070c0782000d070c0781000782070d070c07810007810706830607000707 -07 -070782060d0681060783070c05080208850c05030a030a810a0382030a077f074a071f00 -01070f0001070106820700070707 -070782060d0681060781070c050c8205030a050a7f077f070106820700070707 -070782060d068106077f077f0710070106820700070707 -070782060d067f067f061406820700070707 -070782060d067f067f061406820700070707 -070782060d0637067f073d07810d061c06820700070707 -070782060d06030616000306160001068107007f003a0082060d06810600150004068207 -00070707 -070782060d06020681000d140d820700068206000d140d8507000607000d7f0d390d8406 -0d06000d140d820700060206820700070707 -070782060d06020682000d06120601078100068306000d061206010784000607000d7f0d -390d84060d06000d130d01078100060206820700070707 -070782060d06020682000d06120601078100068306000d061206010784000607000d7f0d -390d84060d06000d810d06110601078100060206820700070707 -070782060d06020682000d06120601078100068306000d061206010784000607000d7f0d -390d84060d06000d810d06110601078100060206820700070707 -070782060d06020682000d0603068100060606810006030601078100068306000d061206 -010784000607000d010d0100020d0200020d0200020d02007f0d230d84060d06000d810d -06110601078100060206820700070707 -070782060d06020682000d060306020003060200040601078100068306000d060b068100 -060406010784000607000d810d000100010d0100810d0082000d0082000d0082000d0082 -000d0081000d7f0d210d84060d06000d810d06110601078100060206820700070707 -070782060d06020682000d060406020001060200050601078100068306000d060a060200 -0406010785000607000d000200010d0100810d0082000d0082000d0082000d0082000d00 -81000d7f0d210d84060d06000d810d06110601078100060206820700070707 -070782060d06020682000d0605060500060601078100068306000d060906030004060107 -87000607000d000d0081000d810d0082000d0082000d0082000d0082000d0082000d0081 -000d7f0d210d84060d06000d810d06110601078100060206820700070707 -070782060d06020682000d0606060300070601078100068306000d060806030005060107 -84000607000d010d0100010d0100810d0082000d0082000d0082000d0082000d0081000d -7f0d210d84060d06000d810d06110601078100060206820700070707 -070782060d06020682000d0606060300070601078100068306000d060306010001060300 -0606010784000607000d010d0100010d0100810d0082000d0082000d0082000d0082000d -0081000d7f0d210d84060d06000d810d06110601078100060206820700070707 -070782060d06020682000d0605060500060601078100068306000d060306060007060107 -84000607000d010d0100010d0100810d0082000d0082000d0082000d0082000d0081000d -7f0d210d84060d06000d810d06110601078100060206820700070707 -070782060d06020682000d060406020001060200050601078100068306000d0604060400 -0806010784000607000d010d0100020d0200020d0200020d02007f0d230d84060d06000d -810d060306010781060782070607810706040601078100060206820700070707 -070782060d06020682000d060306020003060200040601078100068306000d0605060200 -0906010784000607000d7f0d390d84060d06000d810d0603060107810607820706078107 -06040601078100060206820700070707 -070782060d06020682000d060306010005060100040601078100068306000d0606068100 -060906010784000607000d7f0d390d84060d06000d810d06110601078100060206820700 -070707 -070782060d06020682000d06120601078100068306000d061206010784000607000d7f0d -390d84060d06000d810d06110601078100060206820700070707 -070782060d06020682000d06120601078100068306000d061206010784000607000d7f0d -390d84060d06000d810d06110601078100060206820700070707 -070782060d06020682000d0714078100068306000d07140784000607000d7f0d390d8506 -0d06000d0714078100060206820700070707 -070782060d06020682000d0714078100068306000d07140784000607000d7f0d390d8406 -0d06000715078100060206820700070707 -070782060d06030616000306160001068207000d7f0d390d82060d068106001500040682 -0700070707 -070782060d0637068107067f063b06810d061c06820700070707 -070782060d0637067f0d3e0d1d06820700070707 -070782060d0601067f077f070e07810d060106820700070707 -070782060d0601068107007f007f000b0082060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d040d0100120d01007f0d150d0200550d82060d0601068207 -00070707 -070782060d0601068207000d030d81000d140d81000d7f0d130d81000d010d81000d530d -82060d060106820700070707 -070782060d0601068207000d020d0300010d0100810d0081000d010d0200030d0100820d -000d7f0d130d81000d010d81000d530d82060d060106820700070707 -070782060d0601068207000d030d81000d030d0100030d81000d010d81000d820d000d81 -0d0081000d7f0d130d81000d010d81000d530d82060d060106820700070707 -070782060d0601068207000d030d81000d030d81000d030d0400010d81000d010d81000d -7f0d130d81000d010d81000d530d82060d060106820700070707 -070782060d0601068207000d030d81000d030d81000d030d81000d040d81000d010d8100 -0d7f0d130d81000d010d81000d530d82060d060106820700070707 -070782060d0601068207000d020d0300010d0300030d0300020d04007f0d140d0200550d -82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d1c0d0100120d01000e0d81000d6b0d0400090d0100480d82 -060d060106820700070707 -070782060d0601068207000d010d81000d190d81000d120d81000d7c0d81000d820d000d -090d81000d470d82060d060106820700070707 -070782060d0601068207000d810d000300030d0200010d0100010d0100020d0100810d00 -84000d000d0081000d090d0300010d82000d0081000d020d0200020d0200040d0300020d -02005e0d83000d000d020d0200040d81000d030d0300020d0200390d82060d0601068207 -00070707 -070782060d0601068207000d010d81000d040d81000d010d81000d820d000d010d81000d -820d000d810d0081000d810d0081000d820d000d070d81000d010d81000d810d0081000d -820d000d820d000d010d81000d020d81000d020d81000d010d81000d820d000d010d8100 -0d5c0d0200020d81000d010d81000d020d81000d020d81000d040d81000d010d81000d37 -0d82060d060106820700070707 -070782060d0601068207000d010d81000d040d81000d010d81000d820d000d010d81000d -820d000d010d81000d820d000d010d81000d070d81000d040d81000d010d81000d820d00 -0d010d81000d020d81000d020d81000d040d04005d0d83000d000d020d0300030d81000d -030d0200020d0400380d82060d060106820700070707 -070782060d0601068207000d010d81000d010d81000d820d000d010d81000d820d000d81 -0d0081000d820d000d010d81000d820d000d010d81000d070d81000d040d81000d010d81 -000d820d000d010d81000d020d81000d020d81000d040d81000d600d81000d030d81000d -010d81000d020d81000d060d81000d820d000d3b0d82060d060106820700070707 -070782060d0601068207000d020d0200030d0200030d0100810d0081000d810d00020081 -0d000100810d000100080d0300810d000100810d000100010d0200020d0400020d030002 -0d03005c0d0200030d0500810d000300010d0300030d0300380d82060d06010682070007 -0707 -070782060d0601068207000d1a0d81000d7f0d6d0d82060d060106820700070707 -070782060d0601068207000d170d02007f0d6f0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d060106820700047f047f040a0482060d060106820700070707 -070782060d060106820700047f047f040a0482060d060106820700070707 -070782060d060106820700047f047f040a0482060d060106820700070707 -070782060d060106820700047f047f040a0482060d060106820700070707 -070782060d060106820700040304810d047f043204010d4f0482060d0601068207000707 -07 -070782060d060106820700047f043904810d044e0482060d060106820700070707 -070782060d060106820700040104020d0404020d0104010d81040d810d047f042404810d -044e0482060d060106820700070707 -070782060d060106820700040304810d040204810d040104810d0481040d810d0482040d -047f041a04040d0304810d044e0482060d060106820700070707 -070782060d060106820700040304810d040304030d0104810d040104810d047f04230481 -0d044e0482060d060106820700070707 -070782060d060106820700040304810d040204810d040104810d0482040d040104810d04 -7f042304810d044e0482060d060106820700070707 -070782060d060106820700040104040d0104080d81040d010d7f042104040d4d0482060d -060106820700070707 -070782060d060106820700047f047f040a0482060d060106820700070707 -070782060d060106820700047f047f040a0482060d060106820700070707 -070782060d060106820700047f047f040a0482060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d810d0081000d060d81000d030d0100040d01007f0d170d02 -00030d03004d0d82060d060106820700070707 -070782060d0601068207000d010d81000d0d0d81000d040d81000d7f0d150d81000d010d -81000d010d81000d4f0d82060d060106820700070707 -070782060d0601068207000d010d82000d0081000d010d0200050d81000d040d81000d7f -0d180d81000d020d81000d4f0d82060d060106820700070707 -070782060d0601068207000d010d0100010d81000d020d81000d040d81000d040d81000d -7f0d170d81000d030d02004e0d82060d060106820700070707 -070782060d0601068207000d010d81000d010d81000d020d81000d040d81000d040d8100 -0d7f0d160d81000d070d81000d4c0d82060d060106820700070707 -070782060d0601068207000d010d81000d010d81000d020d81000d040d81000d040d8100 -0d7f0d150d81000d040d81000d010d81000d4c0d82060d060106820700070707 -070782060d0601068207000d810d000300020d0400010d0400010d04007f0d140d040002 -0d02004e0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d030d81000d0a0d0100050d81000d7f0d6f0d82060d060106 -820700070707 -070782060d0601068207000d110d81000d7f0d760d82060d060106820700070707 -070782060d0601068207000d010d0300010d0100010d0100030d81000d020d0200040d02 -00010d0100810d0081000d7f0d070d0200010d0100810d0081000d020d0200470d82060d -060106820700070707 -070782060d0601068207000d040d81000d010d81000d010d81000d020d81000d040d8100 -0d020d81000d010d81000d810d0081000d820d000d7f0d050d81000d010d81000d810d00 -81000d820d000d820d000d010d81000d450d82060d060106820700070707 -070782060d0601068207000d040d81000d010d81000d010d81000d020d81000d040d8100 -0d030d0300010d81000d010d81000d7f0d050d81000d010d81000d820d000d010d81000d -810d000300460d82060d060106820700070707 -070782060d0601068207000d040d81000d010d81000d810d0081000d020d81000d040d81 -000d020d81000d010d81000d820d000d010d81000d7f0d050d81000d010d81000d820d00 -0d010d81000d820d000d490d82060d060106820700070707 -070782060d0601068207000d040d81000d020d0100810d0082000d000300010d0400010d -0800810d0001007f0d060d0200010d0200810d000100010d0300460d82060d0601068207 -00070707 -070782060d0601068207000d040d81000d7f0d7f0d030d82060d060106820700070707 -070782060d0601068207000d010d02007f0d7f0d050d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d810d0081000d060d81000d7f0d7d0d82060d060106820700 -070707 -070782060d0601068207000d010d81000d0b0d81000d7f0d780d82060d06010682070007 -0707 -070782060d0601068207000d010d82000d0081000d010d0200020d0400010d0200820d00 -0d020d0200010d0100810d0081000d7f0d050d0100810d0081000d020d0200010d010081 -0d0081000d020d0200400d82060d060106820700070707 -070782060d0601068207000d010d0100010d81000d020d81000d020d81000d040d85000d -000d000d820d000d010d81000d810d0081000d820d000d7f0d050d0100010d81000d820d -000d010d81000d810d0081000d820d000d820d000d010d81000d3e0d82060d0601068207 -00070707 -070782060d0601068207000d010d81000d010d81000d020d81000d020d81000d040d8500 -0d000d000d010d0300010d81000d010d81000d7f0d050d81000d010d81000d820d000d01 -0d81000d820d000d010d81000d810d0003003f0d82060d060106820700070707 -070782060d0601068207000d010d81000d010d81000d020d81000d020d81000d010d8100 -0d860d000d000d000d820d000d010d81000d820d000d010d81000d7f0d050d81000d010d -81000d820d000d010d81000d820d000d010d81000d820d000d420d82060d060106820700 -070707 -070782060d0601068207000d810d000300020d0400020d0200010d0600810d000400810d -0002007f0d060d0200810d000100010d0200010d0200810d000100010d03003f0d82060d -060106820700070707 -070782060d0601068207000d240d81000d7f0d630d82060d060106820700070707 -070782060d0601068207000d230d02007f0d630d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d340d81000d130d01007f0d3d0d82060d0601068207000707 -07 -070782060d0601068207000d1d0d81000d2b0d81000d620d81000d570d82060d06010682 -0700070707 -070782060d0601068207000d020d0300020d0200010d0100810d0081000d020d0300810d -000300020d0100810d0081000d010d0200020d0200020d0100810d0081000d020d020003 -0d0100820d000d610d0400010d0200810d000100010d0200470d82060d06010682070007 -0707 -070782060d0601068207000d010d81000d010d81000d820d000d010d81000d810d008100 -0d820d000d820d000d040d81000d050d0100030d81000d010d81000d020d81000d020d01 -00010d81000d820d000d010d81000d820d000d810d0081000d620d81000d040d81000d01 -0d81000d820d000d010d81000d450d82060d060106820700070707 -070782060d0601068207000d010d81000d040d81000d010d81000d820d000d010d81000d -010d0200020d81000d050d81000d040d0300030d81000d020d81000d010d81000d810d00 -0300010d81000d010d81000d620d81000d040d85000d000d000d820d000d010d81000d45 -0d82060d060106820700070707 -070782060d0601068207000d010d81000d040d81000d010d81000d820d000d010d81000d -040d81000d820d000d010d81000d010d81000d030d81000d010d81000d020d81000d020d -81000d010d81000d820d000d040d81000d010d81000d620d81000d010d81000d860d000d -000d000d820d000d010d81000d450d82060d060106820700070707 -070782060d0601068207000d020d0300020d0200010d0200810d000100810d000200030d -0200020d0300020d0500810d000300810d000100810d000100010d0300020d0400630d02 -00030d83000d000d020d0200470d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -070782060d0601068207000d7f0d7f0d0a0d82060d060106820700070707 -7f077f0726078100070107 -03077f0d7f0d210d820700070107 -0307820d06077f077f071c07840d060700070107 -0307830d0607047f047f041c0483060700070107 -0307830d0607047f047f041c0483060700070107 -0307830d0607047f047f040a040e0d8100048404060700070107 -0307830d0607047f047f040a04810d060b06820700048404060700070107 -0307830d06070481040d040d3a04010d7f044604810d060b068207000484040607000701 -07 -0307830d06070481040d810d040104010d1d04010d1904010d7f044604810d0601060107 -030601070106820700048404060700070107 -0307830d06070481040d810d040104010d1d04010d1904010d7f044604810d0602060107 -01060107010d83060700048404060700070107 -0307830d06070481040d810d040104010d81040d010d0104030d0104040d0204030d0104 -020d81040d010d81040d820d040d810d040304010d0104010d0104030d0104010d81040d -810d0481040d810d0481040d020d0604030d0104020d81040d010d0104030d0104020d7f -041a04810d0603060307010d0106820700048404060700070107 -0307830d06070481040d040d0104010d0104010d0104010d81040d810d0481040d820d04 -0d810d0481040d820d040d810d0481040d810d0481040d820d040d810d040304010d0104 -010d0404010d81040d820d040d810d0481040d820d040d810d0481040d810d040304010d -0104010d81040d810d0481040d810d0481040d810d0481040d820d040d810d047f041a04 -810d0604060107010d0206820700048404060700070107 -0307830d06070481040d810d040404010d0104010d0104010d81040d810d0481040d820d -040d040d81040d810d0481040d810d0481040d820d040d810d040404030d0204040d8104 -0d820d040d810d0481040d820d040d040d0404050d81040d810d0481040d810d0481040d -810d0481040d820d040d810d047f041a04810d0603060307030682070004840406070007 -0107 -0307830d06070481040d810d040404010d0104010d0104010d81040d810d0481040d820d -040d810d040304010d0104010d0104010d81040d810d040404030d0104010d0104010d81 -040d820d040d810d0481040d820d040d810d040704010d0404010d0104010d0104010d01 -04010d81040d810d047f041a04810d0602060107010d0107020682070004840406070007 -0107 -0307830d06070481040d810d040404010d0104010d0104010d81040d810d0481040d820d -040d810d0481040d820d040d810d0481040d810d040104020d0704010d0204010d010401 -0d81040d820d040d820d040d010d81040d810d0481040d810d040304010d0104010d8104 -0d810d0481040d810d0481040d810d0481040d820d040d810d047f041a04810d06010601 -07010d010601070106820700048404060700070107 -0307830d06070481040d810d040404010d0204030d0104040d0204030d0104010d020401 -0d0104010d0804010d0304040d81040d810d0481040d030d0104030d0604030d0104010d -0104010d0204030d0104010d7f041b04810d060206010d0306010d830607000484040607 -00070107 -0307830d0607041304010d1404010d7f045d04810d060b06820700048404060700070107 - -0307830d0607041304010d1204020d7f045e04810d070c078100048404060700070107 -0307830d0607047f047f040a040f00010483060700070107 -0307830d0607047f047f041c0483060700070107 -0307830d0607047f047f041c0483060700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d06170602037f067f060406820700070107 -0307810d06160681030a830a0600067f067f060206820700070107 -0307810d06150681030a020a83060007067f067f0683060700070107 -0307810d06150681030a030a8100078107067f067f06820700070107 -0307810d06140681030a040a820600078107067f067e06820700070107 -0307810d06140681030a050a8100078107067f067e06820700070107 -0307810d06130681030a060a820600078107067f067d06820700070107 -0307810d06130681030a070a8100078107067f067d06820700070107 -0307810d06120681030a080a820600078107067f067c06820700070107 -0307810d06120681030a010a810600010081060a010a8100078107067f067c0682070007 -0107 -0307810d06110681030a020a0400020a820600078107067f067b06820700070107 -0307810d06110681030a020a0400030a8100078107061606810006030681000605068100 -0627068100061b0681000620068100062c06040001060200140681000602060400010602 -0001068100060a06820700070107 -0307810d06100681030a030a0400030a8206000781070615068100060306810006050681 -000621068100060306810006230681000618068100060906810006200681000603068100 -060106810006120681000602068100060306810006010683000600060a06820700070107 - -0307810d06100681030a030a0400040a8100078107061606810006010681000606068100 -062106810006030681000623068100061806810006090681000620068100060306810006 -0106810006120681000602068100060306810006010683000600060a06820700070107 -0307810d060f0681030a040a0400040a8206000781070615068100060106810006010602 -000106830006000601068100068106000100040602008106008100068206000601068100 -068106008100068106008100060206030002060200050602000106820006008100060306 -840006000600810006810600810006810600010002060300010602000106010003060300 -020602000106010082060006820600068206000681060001000206020001068200060081 -000606060300010681000601068100060306020001068200060081000601060300030603 -000106810006010683000600060a06820700070107 -0307810d060f0681030a040a810300010081030a040a8100078107061506810006010681 -000604068500060006000601068300060006010681000602068100068206000684060006 -000601068300060006840600060006030681000601068300060006010681000606068200 -060081000682060006020682000600810006840600060006820600060106830006000601 -068300060006010683000600060306810006010683000600060106830006000682060006 -820600068406000600060106830006000601068200060081000682060006050681000601 -068300060006010681000606068200060081000684060006000601068100060206810006 -01068300060006010683000600060a06820700070107 -0307810d060e0681030a050a810600010081060a040a8206000781070615068300060006 -020603008406000600060106820006000300030681000682060006840600060006010681 -000682060006010681000603068100060106820006000300040603008206000601068100 -060206830006000601068300060006810600030082060006010682000600030082060006 -030681000601068200060003008206000689060006000600060006000300810600030082 -060006010681000602060100040683000600060106810006030603008206000601068300 -060006010681000606068300060006010683000600060a06820700070107 -0307810d060e0681030a060a0200070a8100078107061506830006000601068100060106 -850006000600060106830006000606068100068206000684060006000601068100060106 -810006820600060306810006010683000600060606810006010683000600060106810006 -020683000600060106830006000682060006030681000601068300060006030681000603 -068100060106830006000603068100068a06000600060006000600060306810006030681 -000601068100060906830006000601068100060206810006010683000600060106830006 -0006010681000606068300060006010683000600060a06820700070107 -0307810d060d0681030a070a830300030a060a8206000781070615068100060206810006 -010685000600060006810600830006000601068100060206810006820600068406000600 -068106008300060006840600060006030681000601068300060006010681000602068100 -060106830006000601068100060206830006000601068300060006820600060106830006 -000601068300060006010683000600060306810006010683000600060106830006000601 -068100060106810006820600060106830006000601068300060006010681000605068100 -060106830006000601068100060206810006010683000600060106830006000601068100 -0602068100060106830006000601068100060c06820700070107 -0307810d060d0681030a070a830600060a070a8100078107061506810006030603008206 -000681060083000600068106000100040681000682060006820600068106008300060006 -810600810006010681000602060300020602000506030082060006010681000602068300 -060006010681000682060006810600010002060300010602000106810006030603000206 -020002068100068206000601068100060106020002060200010681000601068100060606 -020002060200050603008206000601068100068106000200040602000206020001068100 -060a06820700070107 -0307810d060c0681030a090a81000a080a820600078107067c0681000677068207000701 -07 -0307810d060c0681030a150a810007810706780603007906820700070107 -0307810d060b0681030a090a8106008200060a070a820600078107067f06750682070007 -0107 -0307810d060b0681030a090a0300090a8100078107067f067506820700070107 -0307810d060a0681030a0a0a0300090a820600078107067f067406820700070107 -0307810d060a0681030a0a0a8106008200060a090a8100078107067f0674068207000701 -07 -0307810d060a0681030a190a81000701077f067406820700070107 -0307810d060a0681030a180a8206000701077f067406820700070107 -0307810d060b0681030a160a8206000702077f067406820700070107 -0307810d060c06810300160004077f067406820700070107 -0307810d060e061a077f067506820700070107 -0307810d060f0618077f067606820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d066b0648006a06820700070107 -0307810d066a064a006906820700070107 -0307810d066a060100450d8107008100066806820700070107 -0307810d066a060100440d010701006906820700070107 -0307810d066a060100010d18069100060006000600060006000600060006000617060107 -01006906820700070107 -0307810d066a060100010d4206010701006906820700070107 -0307810d066a060100010d18068100060d068100061706010701006906820700070107 -0307810d066a060100010d1b060300020681000601068100061906010701006906820700 -070107 -0307810d066a060100010d18068300060006020681000682060006820600068206000617 -06010701006906820700070107 -0307810d066a060100010d1a0681000602068100068406000600061b0601070100690682 -0700070107 -0307810d066a060100010d18068300060006020681000681060081000602068100061706 -010701006906820700070107 -0307810d066a060100010d1a0681000602068100068106008100061c0601070100690682 -0700070107 -0307810d066a060100010d18068300060006020681000684060006000601068100061706 -010701006906820700070107 -0307810d066a060100010d1a06810006020681000682060006820600061a060107010069 -06820700070107 -0307810d066a060100010d18068300060006020681000682060006010683000600061706 -010701006906820700070107 -0307810d066a060100010d1b060300020681000602068100061806010701006906820700 -070107 -0307810d066a060100010d18068100060d068100061706010701006906820700070107 -0307810d066a060100010d4206010701006906820700070107 -0307810d066a060100010d18069100060006000600060006000600060006000617060107 -01006906820700070107 -0307810d066a060100810d07440701006906820700070107 -0307810d066a060100460701006906820700070107 -0307810d066a064a006906820700070107 -0307810d066b0648006a06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -0307810d067f067f061f06820700070107 -7f077f0726078100070107 -02077f007f0024000207 -7f077f072a07 -7f077f072a07 -7f077f072a07 -7f077f072a07 -7f077f072a07 -7f077f072a07 - -% -% Compression made this file 5.68% of the uncompressed size. -% - - -showpage - -% stop using temporary dictionary -end - -% restore original state -origstate restore - -%%Trailer diff --git a/utils/wxprop/docs/prop2.gif b/utils/wxprop/docs/prop2.gif deleted file mode 100644 index f7395c48fa..0000000000 Binary files a/utils/wxprop/docs/prop2.gif and /dev/null differ diff --git a/utils/wxprop/docs/readme.txt b/utils/wxprop/docs/readme.txt deleted file mode 100644 index f54a18a687..0000000000 --- a/utils/wxprop/docs/readme.txt +++ /dev/null @@ -1,39 +0,0 @@ - -Prototype dialog editor and property sheet classes --------------------------------------------------- - -Julian Smart, October 4th 1995 ------------------------------- - -Here's what I've done so far on a lightweight dialog editor. The 16-bit -Windows binaries in the bin directory are dialoged.exe (the dialog -editor) and test.exe (a small property sheet demo). - -Main points: - - - You can create a new dialog box and add items to it. - - You can move items around, and right-click - to edit a few properties (very incomplete). - - Can't write out .wxr files yet. Loading code is in - wxWindows, but writing code is absent: should be put - into wxWindows. - - No attempt at resources other than dialogs yet. - Should have menu editor too. - - Should *somehow* have a protocol to allow - existing resources e.g. in wxCLIPS/wxPython - to be edited in situ. - This should be made simpler by the existance of - the plug-in event handler mechanism, which means you - can temporarily handle all the events yourself. - - See dialoged.cc: the main program is tiny because - it's meant to be embeddable. - - The wxPropertySheet (set of) classes are very - general and should be put into wxWin and documented. - -Comments, chivvying and help all appreciated. Maybe if -I documented what I had, it would be easier for others -to do some work on it. - -Regards, - -Julian \ No newline at end of file diff --git a/utils/wxprop/docs/tex2rtf.ini b/utils/wxprop/docs/tex2rtf.ini deleted file mode 100644 index 90c6676d9c..0000000000 --- a/utils/wxprop/docs/tex2rtf.ini +++ /dev/null @@ -1,21 +0,0 @@ -runTwice = yes -titleFontSize = 12 -authorFontSize = 10 -chapterFontSize = 12 -sectionFontSize = 12 -subsectionFontSize = 12 -headerRule = yes -footerRule = yes -useHeadingStyles = yes -contentsDepth = 2 -listItemIndent=40 -generateHPJ = yes -htmlBrowseButtons = bitmap -winHelpVersion = 3 -winHelpContents = yes -winHelpTitle = "Property Classes Manual" -truncateFilenames = yes -\overview [2] {\rtfonly{See also }\sethotspotcolour{off}\sethotspotunderline{on}\winhelponly{\image{}{books.bmp}} -\htmlonly{\image{}{books.gif}}\helpref{#1}{#2} -\sethotspotcolour{on}\sethotspotunderline{on}} - diff --git a/utils/wxprop/docs/up.gif b/utils/wxprop/docs/up.gif deleted file mode 100644 index 617948f2a2..0000000000 Binary files a/utils/wxprop/docs/up.gif and /dev/null differ diff --git a/utils/wxprop/docs/wxprop.hpj b/utils/wxprop/docs/wxprop.hpj deleted file mode 100644 index 5492173d51..0000000000 --- a/utils/wxprop/docs/wxprop.hpj +++ /dev/null @@ -1,17 +0,0 @@ -[OPTIONS] -BMROOT=d:\wx2\wxwind~1\utils\wxprop\docs ; Assume that bitmaps are where the source is -TITLE=Property Classes Manual -CONTENTS=Contents -COMPRESS=HIGH - -[FILES] -wxprop.rtf - -[CONFIG] -CreateButton("Up", "&Up", "JumpId(`wxprop.hlp', `Contents')") -BrowseButtons() - -[MAP] - -[BITMAPS] - diff --git a/utils/wxprop/lib/dummy b/utils/wxprop/lib/dummy deleted file mode 100644 index bfdf726d49..0000000000 --- a/utils/wxprop/lib/dummy +++ /dev/null @@ -1 +0,0 @@ -I'm just here to force the creation of a LIB directory. diff --git a/utils/wxprop/src/aiai.ico b/utils/wxprop/src/aiai.ico deleted file mode 100644 index 46afdd1b61..0000000000 Binary files a/utils/wxprop/src/aiai.ico and /dev/null differ diff --git a/utils/wxprop/src/cross.bmp b/utils/wxprop/src/cross.bmp deleted file mode 100644 index 079cb0dd58..0000000000 Binary files a/utils/wxprop/src/cross.bmp and /dev/null differ diff --git a/utils/wxprop/src/makefile.b32 b/utils/wxprop/src/makefile.b32 deleted file mode 100644 index 57b94770dd..0000000000 --- a/utils/wxprop/src/makefile.b32 +++ /dev/null @@ -1,74 +0,0 @@ -# -# File: makefile.b32 -# Author: Patrick Halke -# Created: 1995 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds 32bit wxProperty library for Windows -# and Borland C++ 4.x - -WXDIR = $(WXWIN) -!include $(WXDIR)\src\makeb32.env - -WXINC = $(WXDIR)\include -TARGET=test -TESTOBJECTS=test.obj -LIBTARGET= $(WXLIBDIR)\wxprop.lib -LIBS=$(WXLIB)\wx32.lib $(LIBTARGET) cw32 import32 - -!ifndef DEBUG -DEBUG=0 -!endif - -!if "$(FINAL)" == "0" -LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib -OPT = -Od -DEBUG_FLAGS= -v -DDEBUG=$(DEBUG) -!else -LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib -OPT = -O2 -DEBUG_FLAGS = -DDEBUG=$(DEBUG) -!endif - -CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) - -.$(SRCSUFF).obj: - bcc32 $(CPPFLAGS) -c {$< } - -.c.obj: - bcc32 $(CPPFLAGS) -P- -c {$< } - -OBJECTS = prop.obj proplist.obj propform.obj - -all: $(LIBTARGET) - -$(LIBTARGET): $(OBJECTS) - erase $(LIBTARGET) - tlib $(LIBTARGET) /P32 @&&! -+$(OBJECTS:.obj =.obj +) -! - -prop.obj: prop.$(SRCSUFF) prop.h -proplist.obj: proplist.$(SRCSUFF) prop.h proplist.h -propform.obj: propform.$(SRCSUFF) prop.h propform.h - -$(TARGET).exe: $(TESTOBJECTS) $(LIBTARGET) $(TARGET).def $(TARGET).res - tlink32 $(LINKFLAGS) @&&! -c0w32.obj $(TESTOBJECTS) -$(TARGET) -nul -$(LIBS) $(LIBTARGET) -$(TARGET).def -! - brc32 -K $(TARGET).res - -$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc - brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET) - -test.obj: test.$(SRCSUFF) test.h - -clean: - -erase *.obj $(LIBTARGET) *.exe *.res *.map *.rws diff --git a/utils/wxprop/src/makefile.bcc b/utils/wxprop/src/makefile.bcc deleted file mode 100644 index 198eaec21c..0000000000 --- a/utils/wxprop/src/makefile.bcc +++ /dev/null @@ -1,95 +0,0 @@ -# -# File: makefile.bcc -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds wxProperty library - -# Change WXDIR to wherever wxWindows is found -WXDIR = $(WXWIN) -!include $(WXDIR)\src\makebcc.env - -WXLIB = $(WXDIR)\lib\wx.lib -WXINC = $(WXDIR)\include -CFG = $(WXWIN)\src\wxwin.cfg -BCCDIR = d:\bc4 - -WXPROPDIR = $(WXDIR)\utils\wxprop -WXPROPINC = $(WXPROPDIR)\src -WXPROPLIB = $(WXPROPDIR)\lib\wxprop.lib - -FAFALIB = $(WXDIR)\contrib\fafa\fafa.lib -ITSYLIB = $(WXDIR)\contrib\itsybits\itsy.lib - -DOCDIR = $(WXPROPDIR)\docs -DOCUTILSDIR = $(WXDIR)\utils\tex2rtf\src -THISDIR = $(WXPROPDIR)\src - -# Default is to output RTF for WinHelp -!ifndef WINHELP -WINHELP=-winhelp -!endif - -INC=/I$(WXDIR)\include\base /I$(WXDIR)\include\msw - -LIBS=$(WXLIB) $(WXPROPLIB) mathwl cwl import - -!if "$(FINAL)" == "0" -LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib -OPT = -Od -DEBUG_FLAGS= -v -!else -LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib -OPT = -O2 -DEBUG_FLAGS= -!endif -CFLAGS=$(DEBUG_FLAGS) $(OPT) /DUSE_DEFINE @$(CFG) -CPPFLAGS=$(DEBUG_FLAGS) $(OPT) /DUSE_DEFINE @$(CFG) - -OBJECTS = wx_prop.obj wx_plist.obj wx_pform.obj - -all: $(WXPROPLIB) # test.exe - -.$(SRCSUFF).obj: - bcc $(CPPFLAGS) -c {$< } -.c.obj: - bcc $(CPPFLAGS) -P- -c {$< } - -$(WXPROPLIB): $(OBJECTS) - erase $(WXPROPLIB) - tlib /P128 @&&! -$(WXPROPLIB) & -+$(OBJECTS:.obj =.obj +) -! - -test.obj: test.h wx_prop.h test.$(SRCSUFF) - -wx_prop.obj: wx_prop.h wx_prop.$(SRCSUFF) - -wx_plist.obj: wx_prop.h wx_plist.h wx_plist.$(SRCSUFF) - -wx_pform.obj: wx_prop.h wx_pform.h wx_pform.$(SRCSUFF) - -test.res : test.rc $(WXDIR)\include\msw\wx.rc $(WXPROPLIB) - rc /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa -r test - -test.exe: test.obj test.def test.res $(WXPROPLIB) - tlink $(LINKFLAGS) @&&! -c0wl.obj test.obj -test -nul -$(LIBS) -test.def -! - rc -K test.res - -clean: - -erase *.obj - -erase *.exe - -erase *.res - -erase ..\lib\*.lib - diff --git a/utils/wxprop/src/makefile.dos b/utils/wxprop/src/makefile.dos deleted file mode 100644 index 61da857733..0000000000 --- a/utils/wxprop/src/makefile.dos +++ /dev/null @@ -1,138 +0,0 @@ -# -# File: makefile.dos -# Author: Julian Smart -# Created: 1995 -# Updated: -# Copyright: (c) 1995, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds wxPropertySheet library and example (DOS). -# Use FINAL=1 argument to nmake to build final version with no debugging -# info - -WXDIR = $(WXWIN) - -!include $(WXDIR)\src\makemsc.env - -THISDIR = $(WXDIR)\utils\wxprop\src -WXLIB = $(WXDIR)\lib\wx.lib - -PROPLIB = $(WXDIR)\utils\wxprop\lib\wxprop.lib -DOCDIR = $(WXDIR)\utils\wxprop\docs - -LIBS=$(WXLIB) $(PROPLIB) oldnames libw llibcew commdlg shell ddeml -INC=/I$(WXDIR)\include\base /I$(WXDIR)\include\msw - -# Default is to output RTF for WinHelp -!ifndef RTFSTYLE -RTFSTYLE=-winhelp -!endif - -OBJECTS = prop.obj proplist.obj propform.obj -TESTOBJECTS = test.obj - -all: $(PROPLIB) - -test: test.exe - -wx: - cd $(WXDIR)\src\msw - nmake -f makefile.dos - cd $(THISDIR) - -wxclean: - cd $(WXDIR)\src\msw - nmake -f makefile.dos clean - cd $(THISDIR) - -$(PROPLIB): $(OBJECTS) - -erase $(PROPLIB) - lib /PAGESIZE:128 @<< -$(PROPLIB) -y -$(OBJECTS) -nul -; -<< - -test.exe: $(WXDIR)\src\msw\dummy.obj $(WXLIB) $(PROPLIB) $(TESTOBJECTS) test.def test.res - link $(LINKFLAGS) @<< -$(WXDIR)\src\msw\dummy.obj $(TESTOBJECTS), -test, -NUL, -$(LIBS), -test.def -; -<< - rc -30 -K test.res - -test.obj: test.h wx_prop.h test.$(SRCSUFF) - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -prop.obj: prop.h prop.$(SRCSUFF) - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -proplist.obj: prop.h proplist.h proplist.$(SRCSUFF) - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -propform.obj: prop.h propform.h propform.$(SRCSUFF) - cl @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -test.res : test.rc $(WXDIR)\include\wx\msw\wx.rc - rc -r /i$(WXDIR)\include\wx test - -# Making documents -docs: hlp -hlp: $(DOCDIR)/prop.hlp -hlp32: $(DOCDIR)/hlp32/prop.hlp -rtf: $(DOCDIR)/prop.rtf - -$(DOCDIR)/prop.hlp: $(DOCDIR)/prop.rtf $(DOCDIR)/prop.hpj - cd $(DOCDIR) - -erase prop.ph - hc prop - cd $(THISDIR) - -$(DOCDIR)/hlp32/prop.hlp: $(DOCDIR)/hlp32/prop.rtf $(DOCDIR)/hlp32/prop.hpj - cd $(DOCDIR)/hlp32 - -erase prop.ph - start /w hcw /c /e clockwrk.hpj - cd $(THISDIR) - -$(DOCDIR)/prop.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/body.tex $(DOCDIR)/prop.tex - cd $(DOCDIR) - -wx /W tex2rtf $(DOCDIR)/prop.tex $(DOCDIR)/prop.rtf -twice $(RTFSTYLE) - cd $(THISDIR) - -$(DOCDIR)/hlp32/prop.rtf: $(DOCDIR)/classes.tex $(DOCDIR)/body.tex $(DOCDIR)/prop.tex - cd $(DOCDIR) - -wx /W tex2rtf $(DOCDIR)/prop.tex $(DOCDIR)/hlp32/prop.rtf -twice -winhelp -macros $(DOCDIR)/t2rtf32.ini - cd $(THISDIR) - -wordrtf: - cd $(DOCDIR) - -wx /W tex2rtf $(DOCDIR)/prop.tex $(DOCDIR)/prop.rtf -twice -rtf - cd $(THISDIR) - -cleanrtf: - cd $(DOCDIR) - -erase *.rtf - cd $(THISDIR) - -clean: - -erase *.obj - -erase *.sbr - -erase *.exe - -erase *.res - -erase *.map - -erase *.pdb - -erase $(PROPLIB) diff --git a/utils/wxprop/src/makefile.g95 b/utils/wxprop/src/makefile.g95 deleted file mode 100644 index c56fe98d2c..0000000000 --- a/utils/wxprop/src/makefile.g95 +++ /dev/null @@ -1,54 +0,0 @@ -# -# File: makefile.g95 -# Author: Julian Smart -# Created: 1996 -# -# "%W% %G%" -# -# Makefile : Builds wxProp library and example under GNU-WIN32 -# -WXDIR = ../../.. -include $(WXDIR)/src/makeg95.env - -PROPDIR = $(WXDIR)/utils/wxprop -PROPLIB = $(PROPDIR)/lib/$(LIBPREFIX)wxprop.$(LIBSUFF) -THISDIR = $(PROPDIR)/src - -OBJECTS = $(OBJDIR)/prop.$(OBJSUFF) $(OBJDIR)/proplist.$(OBJSUFF) $(OBJDIR)/propform.$(OBJSUFF) -TESTOBJECTS = $(OBJDIR)/test.$(OBJSUFF) $(OBJDIR)/test_resources.$(OBJSUFF) - -LDFLAGS = -Wl,--subsystem,windows -mwindows -L$(WXDIR)/lib -L../lib -LDLIBS=-lwxprop $(LIBS) - -all: $(OBJDIR) $(PROPLIB) - -test: $(OBJDIR) test.exe - -$(OBJDIR): - mkdir $(OBJDIR) - -$(PROPLIB): $(OBJECTS) - rm -f $@ - ar $(AROPTIONS) $@ $(OBJECTS) - $(RANLIB) $@ - -$(OBJDIR)/test.$(OBJSUFF): test.h test.$(SRCSUFF) $(PROPLIB) - $(CC) -c $(CPPFLAGS) -o $@ test.$(SRCSUFF) - -test.exe: $(TESTOBJECTS) - $(CC) $(LDFLAGS) -o test$(GUISUFFIX)$(EXESUFF) $(TESTOBJECTS) $(LDLIBS) - -$(OBJDIR)/prop.$(OBJSUFF): prop.h prop.$(SRCSUFF) - $(CC) -c $(CPPFLAGS) -o $@ prop.$(SRCSUFF) - -$(OBJDIR)/proplist.$(OBJSUFF): proplist.h prop.h proplist.$(SRCSUFF) - $(CC) -c $(CPPFLAGS) -o $@ proplist.$(SRCSUFF) - -$(OBJDIR)/propform.$(OBJSUFF): propform.h prop.h propform.$(SRCSUFF) - $(CC) -c $(CPPFLAGS) -o $@ propform.$(SRCSUFF) - -$(OBJDIR)/test_resources.o: test.rc - $(RESCOMP) -i test.rc -o $(OBJDIR)/test_resources.o $(RESFLAGS) - -clean: - rm -f *.$(OBJSUFF) $(PROPLIB) objects/test.o *.exe *.res *.map *.rsc diff --git a/utils/wxprop/src/makefile.nt b/utils/wxprop/src/makefile.nt deleted file mode 100644 index 4f67e6ac47..0000000000 --- a/utils/wxprop/src/makefile.nt +++ /dev/null @@ -1,143 +0,0 @@ -# -# File: makefile.nt -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds wxProperty 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) -PROPDIR = $(WXDIR)\utils\wxprop -THISDIR = $(WXDIR)\utils\wxprop\src -EXTRALIBS=$(PROPDIR)\lib\wxprop.lib -DOCDIR=$(WXDIR)\docs -LOCALDOCDIR=$(WXDIR)\utils\wxprop\docs - -!include $(WXDIR)\src\ntwxwin.mak - -PROGRAM=test - -OBJECTS = prop.obj proplist.obj propform.obj -PROGOBJECTS = $(PROGRAM).obj -LIBTARGET=$(PROPDIR)\lib\wxprop.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) -<< - -prop.obj: prop.h prop.$(SRCSUFF) $(DUMMYOBJ) - $(cc) @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -proplist.obj: prop.h proplist.$(SRCSUFF) $(DUMMYOBJ) - $(cc) @<< -$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) -<< - -propform.obj: propform.h propform.$(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)\prop.tex $(LOCALDOCDIR)\classes.tex $(LOCALDOCDIR)\body.tex $(LOCALDOCDIR)\changes.tex - -html: $(DOCDIR)\html\wxprop\prop.htm -hlp: $(DOCDIR)\winhelp\wxprop.hlp -pdfrtf: $(DOCDIR)\pdf\wxprop.rtf -ps: $(WXDIR)\docs\ps\wxprop.ps - -$(DOCDIR)\winhelp\wxprop.hlp: $(LOCALDOCDIR)\wxprop.rtf $(LOCALDOCDIR)\wxprop.hpj - cd $(LOCALDOCDIR) - -erase wxprop.ph - hc wxprop - move wxprop.hlp $(DOCDIR)\winhelp\wxprop.hlp - move wxprop.cnt $(DOCDIR)\winhelp\wxprop.cnt - cd $(THISDIR) - -$(LOCALDOCDIR)\wxprop.rtf: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -start /w tex2rtf $(LOCALDOCDIR)\prop.tex $(LOCALDOCDIR)\wxprop.rtf -twice -winhelp - cd $(THISDIR) - -$(DOCDIR)\pdf\wxprop.rtf: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -copy *.bmp *.wmf $(DOCDIR)\pdf - -start /w tex2rtf $(LOCALDOCDIR)\prop.tex $(DOCDIR)\pdf\wxprop.rtf -twice -rtf - cd $(THISDIR) - -$(DOCDIR)\html\wxprop\prop.htm: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -mkdir $(DOCDIR)\html\wxprop - -start /w tex2rtf $(LOCALDOCDIR)\prop.tex $(DOCDIR)\html\wxprop\prop.htm -twice -html - -erase $(DOCDIR)\html\wxprop\*.con - -erase $(DOCDIR)\html\wxprop\*.ref - cd $(THISDIR) - -$(LOCALDOCDIR)\prop.dvi: $(DOCSOURCES) - cd $(LOCALDOCDIR) - -latex prop - -latex prop - -makeindx prop - -bibtex prop - -latex prop - -latex prop - cd $(THISDIR) - -$(WXDIR)\docs\ps\wxprop.ps: $(LOCALDOCDIR)\prop.dvi - cd $(LOCALDOCDIR) - -dvips32 -o wxprop.ps prop - move wxprop.ps $(WXDIR)\docs\ps\wxprop.ps - cd $(THISDIR) - - diff --git a/utils/wxprop/src/makefile.unx b/utils/wxprop/src/makefile.unx deleted file mode 100644 index 3d8d5f5423..0000000000 --- a/utils/wxprop/src/makefile.unx +++ /dev/null @@ -1,105 +0,0 @@ -# -# File: makefile.unx -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile for dialoged example (UNIX). - -WXDIR = ../../.. - -# All common UNIX compiler flags and options are now in -# this central makefile. -include $(WXDIR)/src/make.env - -PROPDIR = $(WXDIR)/utils/wxprop -PROPLIB = ../lib/libwxprop$(GUISUFFIX).a -XVIEWLDLIBS = -lwxprop_ol -lwx_ol -lxview -lolgx -lX11 -lm $(COMPLIBS) -MOTIFLDLIBS = -lwxprop_motif -lwx_motif -lXm -lXt -lX11 -lm $(COMPLIBS) -HPLDLIBS = -lwxprop_hp -lwx_hp -lXm -lXt -lX11 -lm $(COMPLIBS) -LDFLAGS = $(XLIB) -L$(WXDIR)/lib -L../lib - -OBJECTS = $(OBJDIR)/wx_prop.o $(OBJDIR)/wx_pform.o $(OBJDIR)/wx_plist.o -TESTOBJECTS = $(OBJDIR)/test.o - -.SUFFIXES: - -all: $(OBJDIR) $(PROPLIB) - -demo: test$(GUISUFFIX) - -motifdemo: - $(MAKE) -f makefile.unx all test_motif GUI=-Dwx_motif DEBUG='$(DEBUG)' GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' XVIEW_LINK= - -xviewdemo: - $(MAKE) -f makefile.unx all test_ol GUI=-Dwx_xview OPT='$(OPT)' DEBUG='$(DEBUG)' - -$(PROPLIB): $(OBJECTS) - rm -f $@ - ar $(AROPTIONS) $@ $(OBJECTS) - $(RANLIB) $@ - -motif: - $(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)'\ - OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK= - -xview: - $(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)'\ - DEBUG='$(DEBUG)' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' - -hp: - $(MAKE) -f makefile.unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='' DEBUGFLAGS='$(DEBUGFLAGS)' WARN='-w' \ - XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)' - -$(OBJDIR): - mkdir $(OBJDIR) - -test$(GUISUFFIX): $(TESTOBJECTS) $(WXLIB) $(PROPLIB) - $(CC) $(LDFLAGS) -o test$(GUISUFFIX) $(TESTOBJECTS) $(XVIEW_LINK) $(LDLIBS) - -$(OBJDIR)/wx_prop.o: wx_prop.$(SRCSUFF) wx_prop.h - $(CC) -c $(CPPFLAGS) -o $@ wx_prop.$(SRCSUFF) - -$(OBJDIR)/wx_pform.o: wx_pform.$(SRCSUFF) wx_prop.h wx_pform.h wx_prop.h - $(CC) -c $(CPPFLAGS) -o $@ wx_pform.$(SRCSUFF) - -$(OBJDIR)/wx_plist.o: wx_plist.$(SRCSUFF) wx_plist.h wx_prop.h - $(CC) -c $(CPPFLAGS) -o $@ wx_plist.$(SRCSUFF) - -$(OBJDIR)/test.o: test.$(SRCSUFF) test.h - $(CC) -c $(CPPFLAGS) -o $@ test.$(SRCSUFF) - -HTMLDIR=/home/hardy/html/wx/manuals -docs: ps xlp -ps: $(PROPDIR)/docs/prop.ps -xlp: $(PROPDIR)/docs/prop.xlp -html: $(HTMLDIR)/wxprop/prop_contents.html - -$(PROPDIR)/docs/prop.xlp: $(PROPDIR)/docs/prop.tex $(PROPDIR)/docs/classes.tex $(PROPDIR)/docs/body.tex - cd ../docs; tex2rtf prop.tex tmp.xlp -xlp -twice - sed -e "s/WXHELPCONTENTS/Property Classes Manual/g" < $(PROPDIR)/docs/tmp.xlp > $(PROPDIR)/docs/prop.xlp - /bin/rm -f $(PROPDIR)/docs/tmp.xlp - -$(HTMLDIR)/wxprop/prop_contents.html: $(PROPDIR)/docs/prop.tex $(PROPDIR)/docs/classes.tex $(PROPDIR)/docs/body.tex - cd ../docs; tex2rtf prop.tex $(HTMLDIR)/wxprop/prop.html -html -twice - -$(PROPDIR)/docs/prop.dvi: $(PROPDIR)/docs/prop.tex $(PROPDIR)/docs/classes.tex $(PROPDIR)/docs/body.tex - cd $(PROPDIR)/docs; latex prop; latex prop; makeindex prop; latex prop - -$(PROPDIR)/docs/prop.ps: $(PROPDIR)/docs/prop.dvi - cd $(PROPDIR)/docs; dvips -f -r < prop.dvi > prop.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) $(TESTOBJECTS) test$(GUISUFFIX) core $(PROPLIB) diff --git a/utils/wxprop/src/makefile.wat b/utils/wxprop/src/makefile.wat deleted file mode 100644 index c1cd6a0e31..0000000000 --- a/utils/wxprop/src/makefile.wat +++ /dev/null @@ -1,47 +0,0 @@ -WXDIR = ..\..\.. - -EXTRACPPFLAGS = /DUSE_DEFINE - -!include $(WXDIR)\src\makewat.env - -WXLIB = $(WXDIR)\lib -LIBTARGET = ..\lib\wxprop.lib - -OBJECTS = prop.obj proplist.obj propform.obj -TESTOBJECTS = test.obj -NAME = test -LNK = $(name).lnk - -all: erasepch $(OBJECTS) $(LIBTARGET) - -test: test.exe - -test.obj: test.$(SRCSUFF) - -$(LIBTARGET): $(OBJECTS) - wlib /b /c /n /P=256 $(LIBTARGET) $(OBJECTS) - -$(name).exe : $(TESTOBJECTS) $(name).res $(LNK) $(WXLIB)\wx$(LEVEL).lib - wlink @$(LNK) - $(BINDCOMMAND) $(name).res - -$(name).res : $(name).rc $(WXDIR)\include\msw\wx.rc - $(RC) $(RESFLAGS1) $(name).rc - -$(LNK) : makefile.wat - %create $(LNK) - @%append $(LNK) debug all - @%append $(LNK) system $(LINKOPTION) - @%append $(LNK) $(MINDATA) - @%append $(LNK) $(MAXDATA) - @%append $(LNK) $(STACK) - @%append $(LNK) name $(name) - @%append $(LNK) file $(WXLIB)\wx$(LEVEL).lib - @%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 *.obj *.bak *.err *.pch $(LIBTARGET) *.lbc - - diff --git a/utils/wxprop/src/prop.cpp b/utils/wxprop/src/prop.cpp deleted file mode 100644 index 4bd8d72efe..0000000000 --- a/utils/wxprop/src/prop.cpp +++ /dev/null @@ -1,1112 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: prop.cpp -// Purpose: Propert sheet classes implementation -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "prop.h" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include -#include -#include -#include - -#if defined(__WXMSW__) && !defined(__GNUWIN32__) -#include -#else -#include -#endif - -#include "wx/window.h" -#include "wx/utils.h" -#include "wx/list.h" -#include "prop.h" - -IMPLEMENT_DYNAMIC_CLASS(wxPropertyValue, wxObject) - -wxPropertyValue::wxPropertyValue(void) -{ - type = wxPropertyValueNull; - next = NULL; - last = NULL; - value.first = NULL; - client_data = NULL; - modifiedFlag = FALSE; -} - -wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom) -{ - modifiedFlag = FALSE; - Copy((wxPropertyValue& )copyFrom); -} - -wxPropertyValue::wxPropertyValue(const char *val) -{ - modifiedFlag = FALSE; - type = wxPropertyValueString; - - value.string = copystring(val); - client_data = NULL; - next = NULL; - last = NULL; -} - -wxPropertyValue::wxPropertyValue(const wxString& val) -{ - modifiedFlag = FALSE; - type = wxPropertyValueString; - - value.string = copystring((const char *)val); - client_data = NULL; - next = NULL; - last = NULL; -} - -wxPropertyValue::wxPropertyValue(long the_integer) -{ - modifiedFlag = FALSE; - type = wxPropertyValueInteger; - value.integer = the_integer; - client_data = NULL; - next = NULL; -} - -wxPropertyValue::wxPropertyValue(bool val) -{ - modifiedFlag = FALSE; - type = wxPropertyValuebool; - value.integer = val; - client_data = NULL; - next = NULL; -} - -wxPropertyValue::wxPropertyValue(float the_real) -{ - modifiedFlag = FALSE; - type = wxPropertyValueReal; - value.real = the_real; - client_data = NULL; - next = NULL; -} - -wxPropertyValue::wxPropertyValue(double the_real) -{ - modifiedFlag = FALSE; - type = wxPropertyValueReal; - value.real = (float)the_real; - client_data = NULL; - next = NULL; -} - -// Pointer versions: we have a pointer to the real C++ value. -wxPropertyValue::wxPropertyValue(char **val) -{ - modifiedFlag = FALSE; - type = wxPropertyValueStringPtr; - - value.stringPtr = val; - client_data = NULL; - next = NULL; - last = NULL; -} - -wxPropertyValue::wxPropertyValue(long *val) -{ - modifiedFlag = FALSE; - type = wxPropertyValueIntegerPtr; - value.integerPtr = val; - client_data = NULL; - next = NULL; -} - -wxPropertyValue::wxPropertyValue(bool *val) -{ - modifiedFlag = FALSE; - type = wxPropertyValueboolPtr; - value.boolPtr = val; - client_data = NULL; - next = NULL; -} - -wxPropertyValue::wxPropertyValue(float *val) -{ - modifiedFlag = FALSE; - type = wxPropertyValueRealPtr; - value.realPtr = val; - client_data = NULL; - next = NULL; -} - -wxPropertyValue::wxPropertyValue(wxList *the_list) -{ - modifiedFlag = FALSE; - type = wxPropertyValueList; - client_data = NULL; - last = NULL; - value.first = NULL; - - wxNode *node = the_list->First(); - while (node) - { - wxPropertyValue *expr = (wxPropertyValue *)node->Data(); - Append(expr); - node = node->Next(); - } - - delete the_list; -} - -wxPropertyValue::wxPropertyValue(wxStringList *the_list) -{ - modifiedFlag = FALSE; - type = wxPropertyValueList; - client_data = NULL; - last = NULL; - value.first = NULL; - - wxNode *node = the_list->First(); - while (node) - { - char *s = (char *)node->Data(); - Append(new wxPropertyValue(s)); - node = node->Next(); - } - delete the_list; -} - -wxPropertyValue::~wxPropertyValue(void) -{ - switch (type) - { - case wxPropertyValueInteger: - case wxPropertyValuebool: - case wxPropertyValueReal: - { - break; - } - case wxPropertyValueString: - { - delete value.string; - break; - } - case wxPropertyValueList: - { - wxPropertyValue *expr = value.first; - while (expr) - { - wxPropertyValue *expr1 = expr->next; - - delete expr; - expr = expr1; - } - break; - } - default: - case wxPropertyValueNull: break; - } -} - -void wxPropertyValue::Append(wxPropertyValue *expr) -{ - modifiedFlag = TRUE; - if (!value.first) - value.first = expr; - - if (last) - last->next = expr; - last = expr; -} - -void wxPropertyValue::Insert(wxPropertyValue *expr) -{ - modifiedFlag = TRUE; - expr->next = value.first; - value.first = expr; - - if (!last) - last = expr; -} - -// Delete from list -void wxPropertyValue::Delete(wxPropertyValue *node) -{ - wxPropertyValue *expr = GetFirst(); - - wxPropertyValue *previous = NULL; - while (expr && (expr != node)) - { - previous = expr; - expr = expr->GetNext(); - } - - if (expr) - { - if (previous) - previous->next = expr->next; - - // If node was the first in the list, - // make the list point to the NEXT one. - if (GetFirst() == expr) - { - value.first = expr->next; - } - - // If node was the last in the list, - // make the list 'last' pointer point to the PREVIOUS one. - if (GetLast() == expr) - { - if (previous) - last = previous; - else - last = NULL; - } - modifiedFlag = TRUE; - delete expr; - } - -} - -void wxPropertyValue::ClearList(void) -{ - wxPropertyValue *val = GetFirst(); - if (val) - modifiedFlag = TRUE; - - while (val) - { - wxPropertyValue *next = val->GetNext(); - delete val; - val = next; - } - value.first = NULL; - last = NULL; -} - -wxPropertyValue *wxPropertyValue::NewCopy(void) -{ - switch (type) - { - case wxPropertyValueInteger: - return new wxPropertyValue(value.integer); - case wxPropertyValuebool: - return new wxPropertyValue((bool) (value.integer != 0)); - case wxPropertyValueReal: - return new wxPropertyValue(value.real); - case wxPropertyValueString: - return new wxPropertyValue(value.string); - case wxPropertyValueList: - { - wxPropertyValue *expr = value.first; - wxPropertyValue *new_list = new wxPropertyValue; - new_list->SetType(wxPropertyValueList); - while (expr) - { - wxPropertyValue *expr2 = expr->NewCopy(); - new_list->Append(expr2); - expr = expr->next; - } - return new_list; - } - case wxPropertyValueIntegerPtr: - return new wxPropertyValue(value.integerPtr); - case wxPropertyValueRealPtr: - return new wxPropertyValue(value.realPtr); - case wxPropertyValueboolPtr: - return new wxPropertyValue(value.boolPtr); - case wxPropertyValueStringPtr: - return new wxPropertyValue(value.stringPtr); - - case wxPropertyValueNull: -#ifdef __X__ - cerr << "Should never get here!\n"; -#endif - break; - } - return NULL; -} - -void wxPropertyValue::Copy(wxPropertyValue& copyFrom) -{ - type = copyFrom.Type(); - - switch (type) - { - case wxPropertyValueInteger: - (*this) = copyFrom.IntegerValue(); - return ; - - case wxPropertyValueReal: - (*this) = copyFrom.RealValue(); - return ; - - case wxPropertyValueString: - (*this) = wxString(copyFrom.StringValue()); - return ; - - case wxPropertyValuebool: - (*this) = copyFrom.BoolValue(); - return ; - - // Pointers - case wxPropertyValueboolPtr: - (*this) = copyFrom.BoolValuePtr(); - return ; - case wxPropertyValueRealPtr: - (*this) = copyFrom.RealValuePtr(); - return ; - case wxPropertyValueIntegerPtr: - (*this) = copyFrom.IntegerValuePtr(); - return ; - case wxPropertyValueStringPtr: - (*this) = copyFrom.StringValuePtr(); - return ; - - case wxPropertyValueList: - { - value.first = NULL; - next = NULL; - last = NULL; - wxPropertyValue *expr = copyFrom.value.first; - while (expr) - { - wxPropertyValue *expr2 = expr->NewCopy(); - Append(expr2); - expr = expr->next; - } - return; - } - case wxPropertyValueNull: -#ifdef __X__ - cerr << "Should never get here!\n"; -#endif - break; - } -} - -// Return nth argument of a clause (starting from 1) -wxPropertyValue *wxPropertyValue::Arg(wxPropertyValueType type, int arg) -{ - wxPropertyValue *expr = value.first; - for (int i = 1; i < arg; i++) - if (expr) - expr = expr->next; - - if (expr && (expr->type == type)) - return expr; - else - return NULL; -} - -// Return nth argument of a list expression (starting from zero) -wxPropertyValue *wxPropertyValue::Nth(int arg) -{ - if (type != wxPropertyValueList) - return NULL; - - wxPropertyValue *expr = value.first; - for (int i = 0; i < arg; i++) - if (expr) - expr = expr->next; - else return NULL; - - if (expr) - return expr; - else - return NULL; -} - - // Returns the number of elements in a list expression -int wxPropertyValue::Number(void) -{ - if (type != wxPropertyValueList) - return 0; - - int i = 0; - wxPropertyValue *expr = value.first; - while (expr) - { - expr = expr->next; - i ++; - } - return i; -} - -void wxPropertyValue::WritePropertyClause(ostream& stream) // Write this expression as a top-level clause -{ - if (type != wxPropertyValueList) - return; - - wxPropertyValue *node = value.first; - if (node) - { - node->WritePropertyType(stream); - stream << "("; - node = node->next; - bool first = TRUE; - while (node) - { - if (!first) - stream << " "; - node->WritePropertyType(stream); - node = node->next; - if (node) stream << ",\n"; - first = FALSE; - } - stream << ").\n\n"; - } -} - -void wxPropertyValue::WritePropertyType(ostream& stream) // Write as any other subexpression -{ - switch (type) - { - case wxPropertyValueInteger: - { - stream << value.integer; - break; - } - case wxPropertyValueIntegerPtr: - { - stream << *value.integerPtr; - break; - } - case wxPropertyValuebool: - { - if (value.integer) - stream << "True"; - else - stream << "False"; - break; - } - case wxPropertyValueboolPtr: - { - if (*value.integerPtr) - stream << "True"; - else - stream << "False"; - break; - } - case wxPropertyValueReal: - { - float f = value.real; - sprintf(wxBuffer, "%.6g", (double)f); - stream << wxBuffer; - break; - } - case wxPropertyValueRealPtr: - { - float f = *value.realPtr; -/* Now the parser can cope with this. - // Prevent printing in 'e' notation. Any better way? - if (fabs(f) < 0.00001) - f = 0.0; -*/ - sprintf(wxBuffer, "%.6g", f); - stream << wxBuffer; - break; - } - case wxPropertyValueString: - { -// stream << "\""; - int i; - int len = strlen(value.string); - for (i = 0; i < len; i++) - { - char ch = value.string[i]; -// if (ch == '"' || ch == '\\') -// stream << "\\"; - stream << ch; - } - -// stream << "\""; - break; - } - case wxPropertyValueStringPtr: - { - int i; - int len = strlen(*(value.stringPtr)); - for (i = 0; i < len; i++) - { - char ch = *(value.stringPtr)[i]; - - } - break; - } - case wxPropertyValueList: - { - if (!value.first) - stream << "[]"; - else - { - wxPropertyValue *expr = value.first; - - stream << "["; - while (expr) - { - expr->WritePropertyType(stream); - expr = expr->next; - if (expr) stream << ", "; - } - stream << "]"; - } - break; - } - case wxPropertyValueNull: break; - } -} - -wxString wxPropertyValue::GetStringRepresentation(void) -{ - char buf[500]; - buf[0] = 0; - - ostrstream str((char *)buf, (int)500, ios::out); - WritePropertyType(str); - str << '\0'; - str.flush(); - - wxString theString(buf); - return theString; -} - -void wxPropertyValue::operator=(const wxPropertyValue& val) -{ - modifiedFlag = TRUE; - Copy((wxPropertyValue&)val); -} - -// void wxPropertyValue::operator=(const char *val) -void wxPropertyValue::operator=(const wxString& val1) -{ - const char *val = (const char *)val1; - - modifiedFlag = TRUE; - if (type == wxPropertyValueNull) - type = wxPropertyValueString; - - if (type == wxPropertyValueString) - { - if (val) - value.string = copystring(val); - else - value.string = NULL; - } - else if (type == wxPropertyValueStringPtr) - { - if (*value.stringPtr) - delete[] *value.stringPtr; - if (val) - *value.stringPtr = copystring(val); - else - *value.stringPtr = NULL; - } - - client_data = NULL; - next = NULL; - last = NULL; - -} - -void wxPropertyValue::operator=(const long val) -{ - modifiedFlag = TRUE; - if (type == wxPropertyValueNull) - type = wxPropertyValueInteger; - - if (type == wxPropertyValueInteger) - value.integer = val; - else if (type == wxPropertyValueIntegerPtr) - *value.integerPtr = val; - else if (type == wxPropertyValueReal) - value.real = (float)val; - else if (type == wxPropertyValueRealPtr) - *value.realPtr = (float)val; - - client_data = NULL; - next = NULL; -} - -void wxPropertyValue::operator=(const bool val) -{ - modifiedFlag = TRUE; - if (type == wxPropertyValueNull) - type = wxPropertyValuebool; - - if (type == wxPropertyValuebool) - value.integer = (long)val; - else if (type == wxPropertyValueboolPtr) - *value.boolPtr = val; - - client_data = NULL; - next = NULL; -} - -void wxPropertyValue::operator=(const float val) -{ - modifiedFlag = TRUE; - if (type == wxPropertyValueNull) - type = wxPropertyValueReal; - - if (type == wxPropertyValueInteger) - value.integer = (long)val; - else if (type == wxPropertyValueIntegerPtr) - *value.integerPtr = (long)val; - else if (type == wxPropertyValueReal) - value.real = val; - else if (type == wxPropertyValueRealPtr) - *value.realPtr = val; - - client_data = NULL; - next = NULL; -} - -void wxPropertyValue::operator=(const char **val) -{ - modifiedFlag = TRUE; - type = wxPropertyValueStringPtr; - - if (val) - value.stringPtr = (char **)val; - else - value.stringPtr = NULL; - client_data = NULL; - next = NULL; - last = NULL; - -} - -void wxPropertyValue::operator=(const long *val) -{ - modifiedFlag = TRUE; - type = wxPropertyValueIntegerPtr; - value.integerPtr = (long *)val; - client_data = NULL; - next = NULL; -} - -void wxPropertyValue::operator=(const bool *val) -{ - modifiedFlag = TRUE; - type = wxPropertyValueboolPtr; - value.boolPtr = (bool *)val; - client_data = NULL; - next = NULL; -} - -void wxPropertyValue::operator=(const float *val) -{ - modifiedFlag = TRUE; - type = wxPropertyValueRealPtr; - value.realPtr = (float *)val; - client_data = NULL; - next = NULL; -} - -long wxPropertyValue::IntegerValue(void) - { - if (type == wxPropertyValueInteger) - return value.integer; - else if (type == wxPropertyValueReal) - return (long)value.real; - else if (type == wxPropertyValueIntegerPtr) - return *value.integerPtr; - else if (type == wxPropertyValueRealPtr) - return (long)(*value.realPtr); - else return 0; - } - -long *wxPropertyValue::IntegerValuePtr(void) -{ - return value.integerPtr; -} - -float wxPropertyValue::RealValue(void) { - if (type == wxPropertyValueReal) - return value.real; - else if (type == wxPropertyValueRealPtr) - return *value.realPtr; - else if (type == wxPropertyValueInteger) - return (float)value.integer; - else if (type == wxPropertyValueIntegerPtr) - return (float)*(value.integerPtr); - else return 0.0; - } - -float *wxPropertyValue::RealValuePtr(void) -{ - return value.realPtr; -} - -bool wxPropertyValue::BoolValue(void) { - if (type == wxPropertyValueReal) - return (value.real != 0.0); - if (type == wxPropertyValueRealPtr) - return (*(value.realPtr) != 0.0); - else if (type == wxPropertyValueInteger) - return (value.integer != 0); - else if (type == wxPropertyValueIntegerPtr) - return (*(value.integerPtr) != 0); - else if (type == wxPropertyValuebool) - return (value.integer != 0); - else if (type == wxPropertyValueboolPtr) - return (*(value.boolPtr) != 0); - else return FALSE; - } - -bool *wxPropertyValue::BoolValuePtr(void) -{ - return value.boolPtr; -} - -char *wxPropertyValue::StringValue(void) { - if (type == wxPropertyValueString) - return value.string; - else if (type == wxPropertyValueStringPtr) - return *(value.stringPtr); - else return NULL; - } - -char **wxPropertyValue::StringValuePtr(void) -{ - return value.stringPtr; -} - -/* - * A property (name plus value) - */ - -IMPLEMENT_DYNAMIC_CLASS(wxProperty, wxObject) - -wxProperty::wxProperty(void) -{ - propertyRole = (char *)NULL; - propertyValidator = NULL; - propertyWindow = NULL; - enabled = TRUE; -} - -wxProperty::wxProperty(wxProperty& copyFrom) -{ - value = copyFrom.GetValue(); - name = copyFrom.GetName(); - propertyRole = copyFrom.GetRole(); - propertyValidator = copyFrom.GetValidator(); - enabled = copyFrom.IsEnabled(); - propertyWindow = NULL; -} - -wxProperty::wxProperty(wxString nm, wxString role, wxPropertyValidator *ed):name(nm), propertyRole(role) -{ - propertyValidator = ed; - propertyWindow = NULL; - enabled = TRUE; -} - -wxProperty::wxProperty(wxString nm, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed): - name(nm), value(val), propertyRole(role) -{ - propertyValidator = ed; - propertyWindow = NULL; - enabled = TRUE; -} - -wxProperty::~wxProperty(void) -{ - if (propertyValidator) - delete propertyValidator; -} - -wxPropertyValue& wxProperty::GetValue(void) -{ - return value; -} - -wxPropertyValidator *wxProperty::GetValidator(void) -{ - return propertyValidator; -} - -wxString& wxProperty::GetName(void) -{ - return name; -} - -wxString& wxProperty::GetRole(void) -{ - return propertyRole; -} - -void wxProperty::SetValue(const wxPropertyValue& val) -{ - value = val; -} - -void wxProperty::SetValidator(wxPropertyValidator *ed) -{ - propertyValidator = ed; -} - -void wxProperty::SetRole(wxString& role) -{ - propertyRole = role; -} - -void wxProperty::SetName(wxString& nm) -{ - name = nm; -} - -void wxProperty::operator=(const wxPropertyValue& val) -{ - value = val; -} - -/* - * Base property view class - */ - -IMPLEMENT_DYNAMIC_CLASS(wxPropertyView, wxEvtHandler) - -wxPropertyView::wxPropertyView(long flags) -{ - buttonFlags = flags; - propertySheet = NULL; - currentValidator = NULL; - currentProperty = NULL; -} - -wxPropertyView::~wxPropertyView(void) -{ -} - -void wxPropertyView::AddRegistry(wxPropertyValidatorRegistry *registry) -{ - validatorRegistryList.Append(registry); -} - -wxPropertyValidator *wxPropertyView::FindPropertyValidator(wxProperty *property) -{ - if (property->GetValidator()) - return property->GetValidator(); - - wxNode *node = validatorRegistryList.First(); - while (node) - { - wxPropertyValidatorRegistry *registry = (wxPropertyValidatorRegistry *)node->Data(); - wxPropertyValidator *validator = registry->GetValidator(property->GetRole()); - if (validator) - return validator; - node = node->Next(); - } - return NULL; -/* - if (!wxDefaultPropertyValidator) - wxDefaultPropertyValidator = new wxPropertyListValidator; - return wxDefaultPropertyValidator; -*/ -} - -/* - * Property sheet - */ - -IMPLEMENT_DYNAMIC_CLASS(wxPropertySheet, wxObject) - -wxPropertySheet::wxPropertySheet(void):properties(wxKEY_STRING) -{ -} - -wxPropertySheet::~wxPropertySheet(void) -{ - Clear(); -} - -bool wxPropertySheet::Save(ostream& str) -{ - return FALSE; -} - -bool wxPropertySheet::Load(ostream& str) -{ - return FALSE; -} - -void wxPropertySheet::UpdateAllViews(wxPropertyView *thisView) -{ -} - -// Add a property -void wxPropertySheet::AddProperty(wxProperty *property) -{ - properties.Append(property->GetName().GetData(), property); -} - -// Get property by name -wxProperty *wxPropertySheet::GetProperty(wxString name) -{ - wxNode *node = properties.Find(name.GetData()); - if (!node) - return NULL; - else - return (wxProperty *)node->Data(); -} - -// Clear all properties -void wxPropertySheet::Clear(void) -{ - wxNode *node = properties.First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - wxNode *next = node->Next(); - delete prop; - delete node; - node = next; - } -} - -// Sets/clears the modified flag for each property value -void wxPropertySheet::SetAllModified(bool flag) -{ - wxNode *node = properties.First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - prop->GetValue().SetModified(flag); - node = node->Next(); - } -} - -/* - * Property validator registry - * - */ - -IMPLEMENT_DYNAMIC_CLASS(wxPropertyValidatorRegistry, wxHashTable) - -wxPropertyValidatorRegistry::wxPropertyValidatorRegistry(void):wxHashTable(wxKEY_STRING) -{ -} - -wxPropertyValidatorRegistry::~wxPropertyValidatorRegistry(void) -{ - ClearRegistry(); -} - -void wxPropertyValidatorRegistry::RegisterValidator(wxString& typeName, wxPropertyValidator *validator) -{ - Put(typeName.GetData(), validator); -} - -wxPropertyValidator *wxPropertyValidatorRegistry::GetValidator(wxString& typeName) -{ - return (wxPropertyValidator *)Get(typeName.GetData()); -} - -void wxPropertyValidatorRegistry::ClearRegistry(void) -{ - BeginFind(); - wxNode *node; - while (node = Next()) - { - delete (wxPropertyValidator *)node->Data(); - } -} - - /* - * Property validator - */ - - -IMPLEMENT_ABSTRACT_CLASS(wxPropertyValidator, wxEvtHandler) - -wxPropertyValidator::wxPropertyValidator(long flags) -{ - validatorFlags = flags; - validatorProperty = NULL; -} - -wxPropertyValidator::~wxPropertyValidator(void) -{} - -bool wxPropertyValidator::StringToFloat (char *s, float *number) { - double num; - bool ok = StringToDouble (s, &num); - *number = (float) num; - return ok; -} - -bool wxPropertyValidator::StringToDouble (char *s, double *number) { - bool ok = TRUE; - char *value_ptr; - *number = strtod (s, &value_ptr); - if (value_ptr) { - int len = strlen (value_ptr); - for (int i = 0; i < len; i++) { - ok = (isspace (value_ptr[i]) != 0); - if (!ok) return FALSE; - } - } - return ok; -} - -bool wxPropertyValidator::StringToInt (char *s, int *number) { - long num; - bool ok = StringToLong (s, &num); - *number = (int) num; - return ok; -} - -bool wxPropertyValidator::StringToLong (char *s, long *number) { - bool ok = TRUE; - char *value_ptr; - *number = strtol (s, &value_ptr, 10); - if (value_ptr) { - int len = strlen (value_ptr); - for (int i = 0; i < len; i++) { - ok = (isspace (value_ptr[i]) != 0); - if (!ok) return FALSE; - } - } - return ok; -} - -char *wxPropertyValidator::FloatToString (float number) { - static char buf[20]; - sprintf (buf, "%.6g", number); - return buf; -} - -char *wxPropertyValidator::DoubleToString (double number) { - static char buf[20]; - sprintf (buf, "%.6g", number); - return buf; -} - -char *wxPropertyValidator::IntToString (int number) { - return ::IntToString (number); -} - -char *wxPropertyValidator::LongToString (long number) { - return ::LongToString (number); - } - - diff --git a/utils/wxprop/src/prop.h b/utils/wxprop/src/prop.h deleted file mode 100644 index e62e022ebb..0000000000 --- a/utils/wxprop/src/prop.h +++ /dev/null @@ -1,317 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: prop.h -// Purpose: Property sheet classes -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifndef _PROP_H_ -#define _PROP_H_ - -#ifdef __GNUG__ -#pragma interface "prop.h" -#endif - -#include "wx/defs.h" -#include "wx/string.h" -#include "wx/hash.h" -#include "wx/dialog.h" -#include "wx/frame.h" -#include "wx/button.h" -#include "wx/listbox.h" -#include "wx/textctrl.h" -#include "wx/gdicmn.h" -#include "wx/layout.h" - -class wxWindow; -class wxProperty; -class wxPropertyValue; -class wxPropertySheet; -class wxPropertyView; -class wxPropertyValidator; -class wxPropertyValidatorRegistry; - -#define wxPROPERTY_VERSION 2.0 - -// A storable sheet of values -class wxPropertySheet: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxPropertySheet) - protected: - wxObject *viewedObject; - wxList properties; - wxPropertyView *propertyView; - - public: - wxPropertySheet(void); - ~wxPropertySheet(void); - - // Add a property - virtual void AddProperty(wxProperty *property); - - // Get property by name - virtual wxProperty *GetProperty(wxString name); - - // Clear all properties - virtual void Clear(void); - - virtual bool Save(ostream& str); - virtual bool Load(ostream& str); - - virtual void UpdateAllViews(wxPropertyView *thisView = NULL); - inline virtual wxList& GetProperties(void) { return properties; } - - // Sets/clears the modified flag for each property value - virtual void SetAllModified(bool flag = TRUE); -}; - - -// Base class for property sheet views. There are currently two directly derived -// classes: wxPropertyListView, and wxPropertyFormView. -class wxPropertyView: public wxEvtHandler -{ - DECLARE_DYNAMIC_CLASS(wxPropertyView) - protected: - long buttonFlags; - wxPropertySheet *propertySheet; - wxProperty *currentProperty; - wxList validatorRegistryList; - wxPropertyValidator *currentValidator; - public: - wxPropertyView(long flags = 0); - ~wxPropertyView(void); - - // Associates and shows the view - virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *panel) {}; - - // Update this view of the viewed object, called e.g. by - // the object itself. - virtual bool OnUpdateView(void) {return FALSE;}; - - // Override this to do something as soon as the property changed, - // if the view and validators support it. - virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {} - - virtual void AddRegistry(wxPropertyValidatorRegistry *registry); - inline virtual wxList& GetRegistryList(void) - { return validatorRegistryList; } - - virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property); - inline virtual void SetPropertySheet(wxPropertySheet *sheet) { propertySheet = sheet; } - inline virtual wxPropertySheet *GetPropertySheet(void) { return propertySheet; } - - virtual void OnOk(void) {}; - virtual void OnCancel(void) {}; - virtual void OnHelp(void) {}; - - inline virtual bool OnClose(void) { return FALSE; } - inline long GetFlags(void) { return buttonFlags; } -}; - - -class wxPropertyValidator: public wxEvtHandler -{ - DECLARE_DYNAMIC_CLASS(wxPropertyValidator) - protected: - long validatorFlags; - wxProperty *validatorProperty; - public: - wxPropertyValidator(long flags = 0); - ~wxPropertyValidator(void); - - inline long GetFlags(void) { return validatorFlags; } - inline void SetValidatorProperty(wxProperty *prop) { validatorProperty = prop; } - inline wxProperty *GetValidatorProperty(void) { return validatorProperty; } - - virtual bool StringToFloat (char *s, float *number); - virtual bool StringToDouble (char *s, double *number); - virtual bool StringToInt (char *s, int *number); - virtual bool StringToLong (char *s, long *number); - virtual char *FloatToString (float number); - virtual char *DoubleToString (double number); - virtual char *IntToString (int number); - virtual char *LongToString (long number); -}; - - -// extern wxPropertyValidator *wxDefaultPropertyValidator; - -class wxPropertyValidatorRegistry: public wxHashTable -{ - DECLARE_DYNAMIC_CLASS(wxPropertyValidatorRegistry) - public: - wxPropertyValidatorRegistry(void); - ~wxPropertyValidatorRegistry(void); - - virtual void RegisterValidator(wxString& roleName, wxPropertyValidator *validator); - virtual wxPropertyValidator *GetValidator(wxString& roleName); - void ClearRegistry(void); -}; - -/* - * Property value class - */ - -typedef enum { - wxPropertyValueNull, - wxPropertyValueInteger, - wxPropertyValueReal, - wxPropertyValuebool, - wxPropertyValueString, - wxPropertyValueList, - wxPropertyValueIntegerPtr, - wxPropertyValueRealPtr, - wxPropertyValueboolPtr, - wxPropertyValueStringPtr -} wxPropertyValueType; - -class wxPropertyValue: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxPropertyValue) - public: - wxObject *client_data; - wxPropertyValueType type; - bool modifiedFlag; - - union { - long integer; // Also doubles as bool - char *string; - float real; - long *integerPtr; - bool *boolPtr; - char **stringPtr; - float *realPtr; - wxPropertyValue *first; // If is a list expr, points to the first node - } value; - - wxPropertyValue *next; // If this is a node in a list, points to the next node - wxPropertyValue *last; // If is a list expr, points to the last node - - wxPropertyValue(void); // Unknown type - wxPropertyValue(const wxPropertyValue& copyFrom); // Copy constructor - wxPropertyValue(const char *val); - wxPropertyValue(const wxString& val); - wxPropertyValue(long val); - wxPropertyValue(bool val); - wxPropertyValue(float val); - wxPropertyValue(double the_real); - wxPropertyValue(wxList *val); - wxPropertyValue(wxStringList *val); - // Pointer versions - wxPropertyValue(char **val); - wxPropertyValue(long *val); - wxPropertyValue(bool *val); - wxPropertyValue(float *val); - - ~wxPropertyValue(void); - - virtual inline wxPropertyValueType Type(void) { return type; } - virtual inline void SetType(wxPropertyValueType typ) { type = typ; } - virtual long IntegerValue(void); - virtual float RealValue(void); - virtual bool BoolValue(void); - virtual char *StringValue(void); - virtual long *IntegerValuePtr(void); - virtual float *RealValuePtr(void); - virtual bool *BoolValuePtr(void); - virtual char **StringValuePtr(void); - - // Get nth arg of clause (starting from 1) - virtual wxPropertyValue *Arg(wxPropertyValueType type, int arg); - - // Return nth argument of a list expression (starting from zero) - virtual wxPropertyValue *Nth(int arg); - // Returns the number of elements in a list expression - virtual int Number(void); - - virtual wxPropertyValue *NewCopy(void); - virtual void Copy(wxPropertyValue& copyFrom); - - virtual void WritePropertyClause(ostream& stream); // Write this expression as a top-level clause - virtual void WritePropertyType(ostream& stream); // Write as any other subexpression - - // Append an expression to a list - virtual void Append(wxPropertyValue *expr); - // Insert at beginning of list - virtual void Insert(wxPropertyValue *expr); - - // Get first expr in list - virtual inline wxPropertyValue *GetFirst(void) { return ((type == wxPropertyValueList) ? value.first : NULL); } - - // Get next expr if this is a node in a list - virtual inline wxPropertyValue *GetNext(void) { return next; } - - // Get last expr in list - virtual inline wxPropertyValue *GetLast(void) { return ((type == wxPropertyValueList) ? last : NULL); } - - // Delete this node from the list - virtual void Delete(wxPropertyValue *node); - - // Clear list - virtual void ClearList(void); - - virtual inline void SetClientData(wxObject *data) { client_data = data; } - virtual inline wxObject *GetClientData(void) { return client_data; } - - virtual wxString GetStringRepresentation(void); - - inline void SetModified(bool flag = TRUE) { modifiedFlag = flag; } - inline bool GetModified(void) { return modifiedFlag; } - - // Operators - void operator=(const wxPropertyValue& val); -// void operator=(const char *val); - void operator=(const wxString& val); - void operator=(const long val); - void operator=(const bool val); - void operator=(const float val); - void operator=(const char **val); - void operator=(const long *val); - void operator=(const bool *val); - void operator=(const float *val); -}; - -/* - * Property class: contains a name and a value. - */ - -class wxProperty: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxProperty) - protected: - bool enabled; - public: - wxPropertyValue value; - wxString name; - wxString propertyRole; - wxPropertyValidator *propertyValidator; - wxWindow *propertyWindow; // Usually a panel item, if anything - - wxProperty(void); - wxProperty(wxProperty& copyFrom); - wxProperty(wxString name, wxString role, wxPropertyValidator *ed = NULL); - wxProperty(wxString name, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed = NULL); - ~wxProperty(void); - - virtual wxPropertyValue& GetValue(void); - virtual wxPropertyValidator *GetValidator(void); - virtual wxString& GetName(void); - virtual wxString& GetRole(void); - virtual void SetValue(const wxPropertyValue& val); - virtual void SetValidator(wxPropertyValidator *v); - virtual void SetName(wxString& nm); - virtual void SetRole(wxString& role); - void operator=(const wxPropertyValue& val); - virtual inline void SetWindow(wxWindow *win) { propertyWindow = win; } - virtual inline wxWindow *GetWindow(void) { return propertyWindow; } - - inline void Enable(bool en) { enabled = en; } - inline bool IsEnabled(void) { return enabled; } -}; - -#endif - diff --git a/utils/wxprop/src/propform.cpp b/utils/wxprop/src/propform.cpp deleted file mode 100644 index ac5aed868f..0000000000 --- a/utils/wxprop/src/propform.cpp +++ /dev/null @@ -1,726 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: propform.cpp -// Purpose: Property form classes -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "propform.h" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include -#include -#include -#include - -#if defined(__WXMSW__) && !defined(__GNUWIN32__) -#include -#else -#include -#endif - -#include "wx/window.h" -#include "wx/utils.h" -#include "wx/list.h" -#include "propform.h" - -/* - * Property view - */ - -IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormView, wxPropertyView) - -BEGIN_EVENT_TABLE(wxPropertyFormView, wxPropertyView) - EVT_BUTTON(wxID_OK, wxPropertyFormView::OnOk) - EVT_BUTTON(wxID_CANCEL, wxPropertyFormView::OnCancel) - EVT_BUTTON(wxID_HELP, wxPropertyFormView::OnHelp) - EVT_BUTTON(wxID_PROP_REVERT, wxPropertyFormView::OnRevert) - EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate) -END_EVENT_TABLE() - -bool wxPropertyFormView::dialogCancelled = FALSE; - -wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxPropertyView(flags) -{ - propertyWindow = propPanel; - managedWindow = NULL; - - windowCloseButton = NULL; - windowCancelButton = NULL; - windowHelpButton = NULL; - - detailedEditing = FALSE; -} - -wxPropertyFormView::~wxPropertyFormView(void) -{ -} - -void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel) -{ - propertySheet = ps; - - AssociatePanel(panel); -// CreateControls(); -// UpdatePropertyList(); -} - -// Update this view of the viewed object, called e.g. by -// the object itself. -bool wxPropertyFormView::OnUpdateView(void) -{ - return TRUE; -} - -bool wxPropertyFormView::Check(void) -{ - if (!propertySheet) - return FALSE; - - wxNode *node = propertySheet->GetProperties().First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - wxPropertyValidator *validator = FindPropertyValidator(prop); - if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) - { - wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; - if (!formValidator->OnCheckValue(prop, this, propertyWindow)) - return FALSE; - } - node = node->Next(); - } - return TRUE; -} - -bool wxPropertyFormView::TransferToPropertySheet(void) -{ - if (!propertySheet) - return FALSE; - - wxNode *node = propertySheet->GetProperties().First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - wxPropertyValidator *validator = FindPropertyValidator(prop); - if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) - { - wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; - formValidator->OnRetrieveValue(prop, this, propertyWindow); - } - node = node->Next(); - } - return TRUE; -} - -bool wxPropertyFormView::TransferToDialog(void) -{ - if (!propertySheet) - return FALSE; - - wxNode *node = propertySheet->GetProperties().First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - wxPropertyValidator *validator = FindPropertyValidator(prop); - if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) - { - wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; - formValidator->OnDisplayValue(prop, this, propertyWindow); - } - node = node->Next(); - } - return TRUE; -} - -bool wxPropertyFormView::AssociateNames(void) -{ - if (!propertySheet || !propertyWindow) - return FALSE; - - wxNode *node = propertyWindow->GetChildren()->First(); - while (node) - { - wxWindow *win = (wxWindow *)node->Data(); - if (win->GetName() != "") - { - wxProperty *prop = propertySheet->GetProperty(win->GetName()); - if (prop) - prop->SetWindow(win); - } - node = node->Next(); - } - return TRUE; -} - - -bool wxPropertyFormView::OnClose(void) -{ - delete this; - return TRUE; -} - -void wxPropertyFormView::OnOk(wxCommandEvent& event) -{ - // Retrieve the value if any - if (!Check()) - return; - - dialogCancelled = FALSE; - - managedWindow->Close(TRUE); -} - -void wxPropertyFormView::OnCancel(wxCommandEvent& event) -{ - dialogCancelled = TRUE; - - managedWindow->Close(TRUE); -} - -void wxPropertyFormView::OnHelp(wxCommandEvent& event) -{ -} - -void wxPropertyFormView::OnUpdate(wxCommandEvent& event) -{ - TransferToPropertySheet(); -} - -void wxPropertyFormView::OnRevert(wxCommandEvent& event) -{ - TransferToDialog(); -} - -void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event) -{ - if (!propertySheet) - return; - - if (win.GetName() == "") - return; - - if (strcmp(win.GetName(), "ok") == 0) - OnOk(event); - else if (strcmp(win.GetName(), "cancel") == 0) - OnCancel(event); - else if (strcmp(win.GetName(), "help") == 0) - OnHelp(event); - else if (strcmp(win.GetName(), "update") == 0) - OnUpdate(event); - else if (strcmp(win.GetName(), "revert") == 0) - OnRevert(event); - else - { - // Find a validator to route the command to. - wxNode *node = propertySheet->GetProperties().First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - if (prop->GetWindow() && (prop->GetWindow() == &win)) - { - wxPropertyValidator *validator = FindPropertyValidator(prop); - if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) - { - wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; - formValidator->OnCommand(prop, this, propertyWindow, event); - return; - } - } - node = node->Next(); - } - } -} - -void wxPropertyFormView::OnDoubleClick(wxControl *item) -{ - if (!propertySheet) - return; - - // Find a validator to route the command to. - wxNode *node = propertySheet->GetProperties().First(); - while (node) - { - wxProperty *prop = (wxProperty *)node->Data(); - if (prop->GetWindow() && ((wxControl *)prop->GetWindow() == item)) - { - wxPropertyValidator *validator = FindPropertyValidator(prop); - if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator))) - { - wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator; - formValidator->OnDoubleClick(prop, this, propertyWindow); - return; - } - } - node = node->Next(); - } -} - -/* - * Property form dialog box - */ - -IMPLEMENT_CLASS(wxPropertyFormDialog, wxDialog) - -wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, - const wxPoint& pos, const wxSize& size, long style, const wxString& name): - wxDialog(parent, -1, title, pos, size, style, name) -{ - view = v; - view->AssociatePanel(this); - view->SetManagedWindow(this); -// SetAutoLayout(TRUE); -} - -bool wxPropertyFormDialog::OnClose(void) -{ - if (view) - { - view->OnClose(); - view = NULL; - return TRUE; - } - else - return FALSE; -} - -void wxPropertyFormDialog::OnDefaultAction(wxControl *item) -{ - view->OnDoubleClick(item); -} - -void wxPropertyFormDialog::OnCommand(wxWindow& win, wxCommandEvent& event) -{ - if ( view ) - view->OnCommand(win, event); -} - -// Extend event processing to search the view's event table -bool wxPropertyFormDialog::ProcessEvent(wxEvent& event) -{ - if ( !view || ! view->ProcessEvent(event) ) - return wxEvtHandler::ProcessEvent(event); - else - return TRUE; -} - - -/* - * Property form panel - */ - -IMPLEMENT_CLASS(wxPropertyFormPanel, wxPanel) - -void wxPropertyFormPanel::OnDefaultAction(wxControl *item) -{ - view->OnDoubleClick(item); -} - -void wxPropertyFormPanel::OnCommand(wxWindow& win, wxCommandEvent& event) -{ - view->OnCommand(win, event); -} - -// Extend event processing to search the view's event table -bool wxPropertyFormPanel::ProcessEvent(wxEvent& event) -{ - if ( !view || ! view->ProcessEvent(event) ) - return wxEvtHandler::ProcessEvent(event); - else - return TRUE; -} - -/* - * Property frame - */ - -IMPLEMENT_CLASS(wxPropertyFormFrame, wxFrame) - -bool wxPropertyFormFrame::OnClose(void) -{ - if (view) - return view->OnClose(); - else - return FALSE; -} - -wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView *v) -{ - return new wxPropertyFormPanel(v, parent); -} - -bool wxPropertyFormFrame::Initialize(void) -{ - propertyPanel = OnCreatePanel(this, view); - if (propertyPanel) - { - view->AssociatePanel(propertyPanel); - view->SetManagedWindow(this); -// propertyPanel->SetAutoLayout(TRUE); - return TRUE; - } - else - return FALSE; -} - - /* - * Property form specific validator - */ - -IMPLEMENT_ABSTRACT_CLASS(wxPropertyFormValidator, wxPropertyValidator) - - -/* - * Default validators - */ - -IMPLEMENT_DYNAMIC_CLASS(wxRealFormValidator, wxPropertyFormValidator) - -/// -/// Real number form validator -/// -bool wxRealFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - if (realMin == 0.0 && realMax == 0.0) - return TRUE; - - // The item used for viewing the real number: should be a text item. - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - return FALSE; - - wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); - - float val = 0.0; - if (!StringToFloat(WXSTRINGCAST value, &val)) - { - char buf[200]; - sprintf(buf, "Value %s is not a valid real number!", (const char *)value); - wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - - if (val < realMin || val > realMax) - { - char buf[200]; - sprintf(buf, "Value must be a real number between %.2f and %.2f!", realMin, realMax); - wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - return TRUE; -} - -bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - // The item used for viewing the real number: should be a text item. - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - return FALSE; - - wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); - - if (value.Length() == 0) - return FALSE; - - float f = (float)atof((const char *)value); - property->GetValue() = f; - return TRUE; -} - -bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - // The item used for viewing the real number: should be a text item. - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - return FALSE; - - wxTextCtrl *textItem = (wxTextCtrl *)propertyWindow; - textItem->SetValue(FloatToString(property->GetValue().RealValue())); - return TRUE; -} - -/// -/// Integer validator -/// -IMPLEMENT_DYNAMIC_CLASS(wxIntegerFormValidator, wxPropertyFormValidator) - -bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - if (integerMin == 0.0 && integerMax == 0.0) - return TRUE; - - // The item used for viewing the real number: should be a text item or a slider - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow) - return FALSE; - - long val = 0; - - if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); - - if (!StringToLong(WXSTRINGCAST value, &val)) - { - char buf[200]; - sprintf(buf, "Value %s is not a valid integer!", (const char *)value); - wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - } - else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider))) - { - val = (long)((wxSlider *)propertyWindow)->GetValue(); - } - else - return FALSE; - - if (val < integerMin || val > integerMax) - { - char buf[200]; - sprintf(buf, "Value must be an integer between %ld and %ld!", integerMin, integerMax); - wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - return TRUE; -} - -bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - // The item used for viewing the real number: should be a text item or a slider - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow) - return FALSE; - - if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxString value(((wxTextCtrl *)propertyWindow)->GetValue()); - - if (value.Length() == 0) - return FALSE; - - long i = atol((const char *)value); - property->GetValue() = i; - } - else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider))) - { - property->GetValue() = (long)((wxSlider *)propertyWindow)->GetValue(); - } - else - return FALSE; - - return TRUE; -} - -bool wxIntegerFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - // The item used for viewing the real number: should be a text item or a slider - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow) - return FALSE; - - if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxTextCtrl *textItem = (wxTextCtrl *)propertyWindow; - textItem->SetValue(LongToString(property->GetValue().IntegerValue())); - } - else if (propertyWindow->IsKindOf(CLASSINFO(wxSlider))) - { - ((wxSlider *)propertyWindow)->SetValue((int)property->GetValue().IntegerValue()); - } - else - return FALSE; - return TRUE; -} - -/// -/// Boolean validator -/// -IMPLEMENT_DYNAMIC_CLASS(wxBoolFormValidator, wxPropertyFormValidator) - -bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - // The item used for viewing the boolean: should be a checkbox - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) - return FALSE; - - return TRUE; -} - -bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - // The item used for viewing the boolean: should be a checkbox. - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) - return FALSE; - - wxCheckBox *checkBox = (wxCheckBox *)propertyWindow; - - property->GetValue() = (bool)checkBox->GetValue(); - return TRUE; -} - -bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - // The item used for viewing the boolean: should be a checkbox. - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow || !propertyWindow->IsKindOf(CLASSINFO(wxCheckBox))) - return FALSE; - - wxCheckBox *checkBox = (wxCheckBox *)propertyWindow; - checkBox->SetValue((bool)property->GetValue().BoolValue()); - return TRUE; -} - -/// -/// String validator -/// -IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator) - -wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags): - wxPropertyFormValidator(flags) -{ - strings = list; -} - -bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - if (!strings) - return TRUE; - - // The item used for viewing the string: should be a text item, choice item or listbox. - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow) - return FALSE; - if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxTextCtrl *text = (wxTextCtrl *)propertyWindow; - if (!strings->Member(text->GetValue())) - { - wxString s("Value "); - s += text->GetValue(); - s += " is not valid."; - wxMessageBox(s, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - } - else - { - // Any other item constrains the string value, - // so we don't have to check it. - } - return TRUE; -} - -bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - // The item used for viewing the string: should be a text item, choice item or listbox. - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow) - return FALSE; - if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxTextCtrl *text = (wxTextCtrl *)propertyWindow; - property->GetValue() = text->GetValue(); - } - else if (propertyWindow->IsKindOf(CLASSINFO(wxListBox))) - { - wxListBox *lbox = (wxListBox *)propertyWindow; - if (lbox->GetSelection() > -1) - property->GetValue() = lbox->GetStringSelection(); - } -/* - else if (propertyWindow->IsKindOf(CLASSINFO(wxRadioBox))) - { - wxRadioBox *rbox = (wxRadioBox *)propertyWindow; - int n = 0; - if ((n = rbox->GetSelection()) > -1) - property->GetValue() = rbox->GetString(n); - } -*/ - else if (propertyWindow->IsKindOf(CLASSINFO(wxChoice))) - { - wxChoice *choice = (wxChoice *)propertyWindow; - if (choice->GetSelection() > -1) - property->GetValue() = choice->GetStringSelection(); - } - else - return FALSE; - return TRUE; -} - -bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) -{ - // The item used for viewing the string: should be a text item, choice item or listbox. - wxWindow *propertyWindow = property->GetWindow(); - if (!propertyWindow) - return FALSE; - if (propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl))) - { - wxTextCtrl *text = (wxTextCtrl *)propertyWindow; - text->SetValue(property->GetValue().StringValue()); - } - else if (propertyWindow->IsKindOf(CLASSINFO(wxListBox))) - { - wxListBox *lbox = (wxListBox *)propertyWindow; - if (lbox->Number() == 0 && strings) - { - // Try to initialize the listbox from 'strings' - wxNode *node = strings->First(); - while (node) - { - char *s = (char *)node->Data(); - lbox->Append(s); - node = node->Next(); - } - } - lbox->SetStringSelection(property->GetValue().StringValue()); - } -/* - else if (propertyWindow->IsKindOf(CLASSINFO(wxRadioBox))) - { - wxRadioBox *rbox = (wxRadioBox *)propertyWindow; - rbox->SetStringSelection(property->GetValue().StringValue()); - } -*/ - else if (propertyWindow->IsKindOf(CLASSINFO(wxChoice))) - { - wxChoice *choice = (wxChoice *)propertyWindow; -#ifndef __XVIEW__ - if (choice->Number() == 0 && strings) - { - // Try to initialize the choice item from 'strings' - // XView doesn't allow this kind of thing. - wxNode *node = strings->First(); - while (node) - { - char *s = (char *)node->Data(); - choice->Append(s); - node = node->Next(); - } - } -#endif - choice->SetStringSelection(property->GetValue().StringValue()); - } - else - return FALSE; - return TRUE; -} - diff --git a/utils/wxprop/src/propform.h b/utils/wxprop/src/propform.h deleted file mode 100644 index 242204d7fa..0000000000 --- a/utils/wxprop/src/propform.h +++ /dev/null @@ -1,286 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: propform.h -// Purpose: Property form classes -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifndef _PROPFORM_H_ -#define _PROPFORM_H_ - -#ifdef __GNUG__ -#pragma interface "propform.h" -#endif - -#include "prop.h" - -//// -//// Property form classes: for using an existing dialog or panel -//// - -#define wxID_PROP_REVERT 3100 -#define wxID_PROP_UPDATE 3101 - -// Mediates between a physical panel and the property sheet -class wxPropertyFormView: public wxPropertyView -{ - DECLARE_DYNAMIC_CLASS(wxPropertyFormView) - protected: - bool detailedEditing; // E.g. using listbox for choices - - wxWindow *propertyWindow; // Panel that the controls will appear on - wxWindow *managedWindow; // Frame or dialog - - wxButton *windowCloseButton; // Or OK - wxButton *windowCancelButton; - wxButton *windowHelpButton; - public: - static bool dialogCancelled; - - wxPropertyFormView(wxWindow *propPanel = NULL, long flags = 0); - ~wxPropertyFormView(void); - - // Associates and shows the view - virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *panel); - - // Update this view of the viewed object, called e.g. by - // the object itself. - virtual bool OnUpdateView(void); - - // Transfer values from property sheet to dialog - virtual bool TransferToDialog(void); - - // Transfer values from dialog to property sheet - virtual bool TransferToPropertySheet(void); - - // Check that all the values are valid - virtual bool Check(void); - - // Give each property in the sheet a panel item, by matching - // the name of the property to the name of the panel item. - // The user doesn't always want to call this; sometimes, it - // will have been done explicitly (e.g., no matching names). - virtual bool AssociateNames(void); - - void OnOk(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - void OnHelp(wxCommandEvent& event); - void OnUpdate(wxCommandEvent& event); - void OnRevert(wxCommandEvent& event); - - virtual bool OnClose(void); - virtual void OnDoubleClick(wxControl *item); - - // TODO: does OnCommand still get called...??? - virtual void OnCommand(wxWindow& win, wxCommandEvent& event); - - inline virtual void AssociatePanel(wxWindow *win) { propertyWindow = win; } - inline virtual wxWindow *GetPanel(void) { return propertyWindow; } - - inline virtual void SetManagedWindow(wxWindow *win) { managedWindow = win; } - inline virtual wxWindow *GetManagedWindow(void) { return managedWindow; } - - inline virtual wxButton *GetWindowCloseButton() { return windowCloseButton; } - inline virtual wxButton *GetWindowCancelButton() { return windowCancelButton; } - inline virtual wxButton *GetHelpButton() { return windowHelpButton; } - -DECLARE_EVENT_TABLE() - -}; - -/* - * The type of validator used for forms (wxForm style but using an existing panel - * or dialog box). - * Classes derived from this know how to map from whatever widget they - * find themselves paired with, to the wxProperty and vice versa. - * Should the widget pointer be stored with the validator, or - * the wxProperty? If with the property, we don't have to supply - * a validator for every property. Otherwise, there ALWAYS needs - * to be a validator. On the other hand, not storing a wxWindow pointer - * in the wxProperty is more elegant. Perhaps. - * I think on balance, should put wxWindow pointer into wxProperty. - * After all, wxProperty will often be used to represent the data - * assocated with a window. It's that kinda thing. - */ - -class wxPropertyFormValidator: public wxPropertyValidator -{ - DECLARE_DYNAMIC_CLASS(wxPropertyFormValidator) - protected: - public: - wxPropertyFormValidator(long flags = 0): wxPropertyValidator(flags) { } - ~wxPropertyFormValidator(void) {} - - // Called to check value is OK (e.g. when OK is pressed) - // Return FALSE if value didn't check out; signal to restore old value. - virtual bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) - { return TRUE; } - - // Does the transferance from the property editing area to the property itself. - // Called by the view, e.g. when closing the window. - virtual bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0; - - // Called by the view to transfer the property to the window. - virtual bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0; - - virtual void OnDoubleClick(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) {}; - virtual void OnSetFocus(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) {}; - virtual void OnKillFocus(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) {}; - virtual void OnCommand(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow, wxCommandEvent& event) {}; - -}; - -/* - * Some default validators - */ - -class wxRealFormValidator: public wxPropertyFormValidator -{ - DECLARE_DYNAMIC_CLASS(wxRealFormValidator) - protected: - float realMin; - float realMax; - public: - // 0.0, 0.0 means no range - wxRealFormValidator(float min = 0.0, float max = 0.0, long flags = 0):wxPropertyFormValidator(flags) - { - realMin = min; realMax = max; - } - ~wxRealFormValidator(void) {} - - bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); - bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); - // Called by the view to transfer the property to the window. - bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); -}; - -class wxIntegerFormValidator: public wxPropertyFormValidator -{ - DECLARE_DYNAMIC_CLASS(wxIntegerFormValidator) - protected: - long integerMin; - long integerMax; - public: - // 0, 0 means no range - wxIntegerFormValidator(long min = 0, long max = 0, long flags = 0):wxPropertyFormValidator(flags) - { - integerMin = min; integerMax = max; - } - ~wxIntegerFormValidator(void) {} - - bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); - bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); - bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); -}; - -class wxBoolFormValidator: public wxPropertyFormValidator -{ - DECLARE_DYNAMIC_CLASS(wxBoolFormValidator) - protected: - public: - wxBoolFormValidator(long flags = 0):wxPropertyFormValidator(flags) - { - } - ~wxBoolFormValidator(void) {} - - bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); - bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); - bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); -}; - -class wxStringFormValidator: public wxPropertyFormValidator -{ - DECLARE_DYNAMIC_CLASS(wxStringFormValidator) - protected: - wxStringList *strings; - public: - wxStringFormValidator(wxStringList *list = NULL, long flags = 0); - - ~wxStringFormValidator(void) - { - if (strings) - delete strings; - } - - bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); - bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); - bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow); -}; - -/* - * A default dialog box class to use. - */ - -class wxPropertyFormDialog: public wxDialog -{ - DECLARE_CLASS(wxPropertyFormDialog) - private: - wxPropertyFormView *view; - public: - wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"); - bool OnClose(void); - void OnDefaultAction(wxControl *item); - void OnCommand(wxWindow& win, wxCommandEvent& event); - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); -}; - -/* - * A default panel class to use. - */ - -class wxPropertyFormPanel: public wxPanel -{ - DECLARE_CLASS(wxPropertyFormPanel) - private: - wxPropertyFormView *view; - public: - wxPropertyFormPanel(wxPropertyFormView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "panel"): - wxPanel(parent, -1, pos, size, style, name) - { - view = v; - } - void OnDefaultAction(wxControl *item); - void OnCommand(wxWindow& win, wxCommandEvent& event); - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); -}; - -/* - * A default frame class to use. - */ - -class wxPropertyFormFrame: public wxFrame -{ - DECLARE_CLASS(wxPropertyFormFrame) - private: - wxPropertyFormView *view; - wxPanel *propertyPanel; - public: - wxPropertyFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME, const wxString& name = "frame"): - wxFrame(parent, -1, title, pos, size, style, name) - { - view = v; - propertyPanel = NULL; - } - bool OnClose(void); - - // Must call this to create panel and associate view - virtual bool Initialize(void); - virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyFormView *v); - inline virtual wxPanel *GetPropertyPanel(void) { return propertyPanel; } -}; - -#endif - diff --git a/utils/wxprop/src/proplist.cpp b/utils/wxprop/src/proplist.cpp deleted file mode 100644 index 2b8ba2555b..0000000000 --- a/utils/wxprop/src/proplist.cpp +++ /dev/null @@ -1,1849 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: proplist.cpp -// Purpose: Property list classes -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "proplist.h" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include -#include -#include -#include - -#if defined(__WXMSW__) && !defined(__GNUWIN32__) -#include -#else -#include -#endif - -#include "wx/window.h" -#include "wx/utils.h" -#include "wx/list.h" -#include "wx/colordlg.h" -#include "proplist.h" - -/* - * Property text edit control - */ - -IMPLEMENT_CLASS(wxPropertyTextEdit, wxTextCtrl) - -wxPropertyTextEdit::wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, - const wxWindowID id, const wxString& value, - const wxPoint& pos, const wxSize& size, - long style, const wxString& name): - wxTextCtrl(parent, id, value, pos, size, style, wxDefaultValidator, name) -{ - view = v; -} - -void wxPropertyTextEdit::OnSetFocus(void) -{ -} - -void wxPropertyTextEdit::OnKillFocus(void) -{ -} - -/* - * Property list view - */ - -IMPLEMENT_DYNAMIC_CLASS(wxPropertyListView, wxPropertyView) - -BEGIN_EVENT_TABLE(wxPropertyListView, wxPropertyView) - EVT_BUTTON(wxID_OK, wxPropertyListView::OnOk) - EVT_BUTTON(wxID_CANCEL, wxPropertyListView::OnCancel) - EVT_BUTTON(wxID_HELP, wxPropertyListView::OnHelp) - EVT_BUTTON(wxID_PROP_CROSS, wxPropertyListView::OnCross) - EVT_BUTTON(wxID_PROP_CHECK, wxPropertyListView::OnCheck) - EVT_BUTTON(wxID_PROP_EDIT, wxPropertyListView::OnEdit) - EVT_TEXT_ENTER(wxID_PROP_TEXT, wxPropertyListView::OnText) - EVT_LISTBOX(wxID_PROP_SELECT, wxPropertyListView::OnPropertySelect) - EVT_COMMAND(wxID_PROP_SELECT, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxPropertyListView::OnPropertyDoubleClick) - EVT_TEXT(wxID_PROP_VALUE_SELECT, wxPropertyListView::OnValueListSelect) -END_EVENT_TABLE() - -bool wxPropertyListView::dialogCancelled = FALSE; -wxBitmap *wxPropertyListView::tickBitmap = NULL; -wxBitmap *wxPropertyListView::crossBitmap = NULL; - -wxPropertyListView::wxPropertyListView(wxPanel *propPanel, long flags):wxPropertyView(flags) -{ - propertyScrollingList = NULL; - valueList = NULL; - valueText = NULL; - editButton = NULL; - confirmButton = NULL; - cancelButton = NULL; - propertyWindow = propPanel; - managedWindow = NULL; - - windowCloseButton = NULL; - windowCancelButton = NULL; - windowHelpButton = NULL; - - detailedEditing = FALSE; -} - -wxPropertyListView::~wxPropertyListView(void) -{ -/* - if (tickBitmap) - delete tickBitmap; - if (crossBitmap) - delete crossBitmap; -*/ -} - -void wxPropertyListView::ShowView(wxPropertySheet *ps, wxPanel *panel) -{ - propertySheet = ps; - - AssociatePanel(panel); - CreateControls(); - - UpdatePropertyList(); - panel->Layout(); -} - -// Update this view of the viewed object, called e.g. by -// the object itself. -bool wxPropertyListView::OnUpdateView(void) -{ - return TRUE; -} - -bool wxPropertyListView::UpdatePropertyList(bool clearEditArea) -{ - if (!propertyScrollingList || !propertySheet) - return FALSE; - - propertyScrollingList->Clear(); - if (clearEditArea) - { - valueList->Clear(); - valueText->SetValue(""); - } - wxNode *node = propertySheet->GetProperties().First(); - - // Should sort them... later... - while (node) - { - wxProperty *property = (wxProperty *)node->Data(); - wxString stringValueRepr(property->GetValue().GetStringRepresentation()); - wxString paddedString(MakeNameValueString(property->GetName(), stringValueRepr)); - - propertyScrollingList->Append(paddedString.GetData(), (char *)property); - node = node->Next(); - } - return TRUE; -} - -bool wxPropertyListView::UpdatePropertyDisplayInList(wxProperty *property) -{ - if (!propertyScrollingList || !propertySheet) - return FALSE; - - int currentlySelected = propertyScrollingList->GetSelection(); -// #ifdef __WXMSW__ - wxString stringValueRepr(property->GetValue().GetStringRepresentation()); - wxString paddedString(MakeNameValueString(property->GetName(), stringValueRepr)); - int sel = FindListIndexForProperty(property); - - if (sel > -1) - { - // Don't update the listbox unnecessarily because it can cause - // ugly flashing. - - if (paddedString != propertyScrollingList->GetString(sel)) - propertyScrollingList->SetString(sel, paddedString.GetData()); - } -//#else -// UpdatePropertyList(FALSE); -//#endif - - if (currentlySelected > -1) - propertyScrollingList->SetSelection(currentlySelected); - - return TRUE; -} - -// Find the wxListBox index corresponding to this property -int wxPropertyListView::FindListIndexForProperty(wxProperty *property) -{ - int n = propertyScrollingList->Number(); - for (int i = 0; i < n; i++) - { - if (property == (wxProperty *)propertyScrollingList->wxListBox::GetClientData(i)) - return i; - } - return -1; -} - -wxString wxPropertyListView::MakeNameValueString(wxString name, wxString value) -{ - wxString theString(name); - - int nameWidth = 25; - int padWith = nameWidth - theString.Length(); - if (padWith < 0) - padWith = 0; - - if (GetFlags() & wxPROP_SHOWVALUES) - { - // Want to pad with spaces - theString.Append(' ', padWith); - theString += value; - } - - return theString; -} - -// Select and show string representation in validator the given -// property. NULL resets to show no property. -bool wxPropertyListView::ShowProperty(wxProperty *property, bool select) -{ - if (currentProperty) - { - EndShowingProperty(currentProperty); - currentProperty = NULL; - } - - valueList->Clear(); - valueText->SetValue(""); - - if (property) - { - currentProperty = property; - BeginShowingProperty(property); - } - if (select) - { - int sel = FindListIndexForProperty(property); - if (sel > -1) - propertyScrollingList->SetSelection(sel); - } - return TRUE; -} - -// Find appropriate validator and load property into value controls -bool wxPropertyListView::BeginShowingProperty(wxProperty *property) -{ - currentValidator = FindPropertyValidator(property); - if (!currentValidator) - return FALSE; - - if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return FALSE; - - wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; - - listValidator->OnPrepareControls(property, this, propertyWindow); - DisplayProperty(property); - return TRUE; -} - -// Find appropriate validator and unload property from value controls -bool wxPropertyListView::EndShowingProperty(wxProperty *property) -{ - if (!currentValidator) - return FALSE; - - RetrieveProperty(property); - - if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return FALSE; - - wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; - - listValidator->OnClearControls(property, this, propertyWindow); - if (detailedEditing) - { - listValidator->OnClearDetailControls(property, this, propertyWindow); - detailedEditing = FALSE; - } - return TRUE; -} - -void wxPropertyListView::BeginDetailedEditing(void) -{ - if (!currentValidator) - return; - if (!currentProperty) - return; - if (detailedEditing) - return; - if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return; - if (!currentProperty->IsEnabled()) - return; - - wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; - - if (listValidator->OnPrepareDetailControls(currentProperty, this, propertyWindow)) - detailedEditing = TRUE; -} - -void wxPropertyListView::EndDetailedEditing(void) -{ - if (!currentValidator) - return; - if (!currentProperty) - return; - - RetrieveProperty(currentProperty); - - if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return; - - wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; - - if (detailedEditing) - { - listValidator->OnClearDetailControls(currentProperty, this, propertyWindow); - detailedEditing = FALSE; - } -} - -bool wxPropertyListView::DisplayProperty(wxProperty *property) -{ - if (!currentValidator) - return FALSE; - - if (((currentValidator->GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == 0) || !property->IsEnabled()) - valueText->SetEditable(FALSE); - else - valueText->SetEditable(TRUE); - - if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return FALSE; - - wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; - - listValidator->OnDisplayValue(property, this, propertyWindow); - return TRUE; -} - -bool wxPropertyListView::RetrieveProperty(wxProperty *property) -{ - if (!currentValidator) - return FALSE; - if (!property->IsEnabled()) - return FALSE; - - if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return FALSE; - - wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; - - if (listValidator->OnCheckValue(property, this, propertyWindow)) - { - if (listValidator->OnRetrieveValue(property, this, propertyWindow)) - { - UpdatePropertyDisplayInList(property); - OnPropertyChanged(property); - } - } - else - { - // Revert to old value - listValidator->OnDisplayValue(property, this, propertyWindow); - } - return TRUE; -} - - -bool wxPropertyListView::EditProperty(wxProperty *property) -{ - return TRUE; -} - -// Called by the listbox callback -void wxPropertyListView::OnPropertySelect(wxCommandEvent& event) -{ - int sel = propertyScrollingList->GetSelection(); - if (sel > -1) - { - wxProperty *newSel = (wxProperty *)propertyScrollingList->wxListBox::GetClientData(sel); - if (newSel && newSel != currentProperty) - { - ShowProperty(newSel, FALSE); - } - } -} - -bool wxPropertyListView::CreateControls(void) -{ - wxPanel *panel = (wxPanel *)propertyWindow; - - int largeButtonWidth = 50; - int largeButtonHeight = 25; - - int smallButtonWidth = 25; - int smallButtonHeight = 20; - - // XView must be allowed to choose its own sized buttons -#ifdef __XVIEW__ - largeButtonWidth = -1; - largeButtonHeight = -1; - - smallButtonWidth = -1; - smallButtonHeight = -1; -#endif - - if (valueText) - return TRUE; - - if (!panel) - return FALSE; - - wxWindow *leftMostWindow = panel; - wxWindow *topMostWindow = panel; - wxWindow *rightMostWindow = panel; - - wxSystemSettings settings; - wxFont guiFont = settings.GetSystemFont(wxSYS_DEFAULT_GUI_FONT); - - wxFont *boringFont = wxTheFontList->FindOrCreateFont(guiFont.GetPointSize(), wxMODERN, wxNORMAL, wxNORMAL); - - // May need to be changed in future to eliminate clashes with app. - panel->SetClientData((char *)this); - - if (buttonFlags & wxPROP_BUTTON_OK) - { - windowCloseButton = new wxButton(panel, wxID_OK, "OK", - wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); - windowCloseButton->SetDefault(); - windowCloseButton->SetFocus(); - } - if (buttonFlags & wxPROP_BUTTON_CLOSE) - { - windowCloseButton = new wxButton(panel, wxID_OK, "Close", - wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); - } - if (buttonFlags & wxPROP_BUTTON_CANCEL) - { - windowCancelButton = new wxButton(panel, wxID_CANCEL, "Cancel", - wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); - } - if (buttonFlags & wxPROP_BUTTON_HELP) - { - windowHelpButton = new wxButton(panel, wxID_HELP, "Help", - wxPoint(-1, -1), wxSize(largeButtonWidth, largeButtonHeight)); - } - - if (windowCloseButton) - { - wxLayoutConstraints *c1 = new wxLayoutConstraints; - c1->left.SameAs (panel, wxLeft, 2); - c1->top.SameAs (panel, wxTop, 2); - c1->width.AsIs(); - c1->height.AsIs(); - windowCloseButton->SetConstraints(c1); - leftMostWindow = windowCloseButton; - } - if (windowCancelButton) - { - wxLayoutConstraints *c2 = new wxLayoutConstraints; - if (leftMostWindow == panel) - c2->left.SameAs (panel, wxLeft, 2); - else - c2->left.RightOf (leftMostWindow, 2); - - c2->top.SameAs (panel, wxTop, 2); - c2->width.AsIs(); - c2->height.AsIs(); - windowCancelButton->SetConstraints(c2); - leftMostWindow = windowCancelButton; - } - if (windowHelpButton) - { - wxLayoutConstraints *c2 = new wxLayoutConstraints; - if (leftMostWindow == panel) - c2->left.SameAs (panel, wxLeft, 2); - else - c2->left.RightOf (leftMostWindow, 2); - - c2->top.SameAs (panel, wxTop, 2); - c2->width.AsIs(); - c2->height.AsIs(); - windowHelpButton->SetConstraints(c2); - leftMostWindow = windowHelpButton; - } - - if (buttonFlags & wxPROP_BUTTON_CHECK_CROSS) - { -/* - if (!tickBitmap) - { -#ifdef __WXMSW__ - tickBitmap = new wxBitmap("tick_bmp", wxBITMAP_TYPE_RESOURCE); - crossBitmap = new wxBitmap("cross_bmp", wxBITMAP_TYPE_RESOURCE); - if (!tickBitmap || !crossBitmap || !tickBitmap->Ok() || !crossBitmap->Ok()) - { - if (tickBitmap) - delete tickBitmap; - if (crossBitmap) - delete crossBitmap; - tickBitmap = NULL; - crossBitmap = NULL; - } -#endif - } -*/ -/* - if (tickBitmap && crossBitmap) - { - confirmButton = new wxBitmapButton(panel, wxID_PROP_CHECK, tickBitmap, - wxPoint(-1, -1), wxSize(smallButtonWidth-5, smallButtonHeight-5)); - cancelButton = new wxBitmapButton(panel, wxID_PROP_CROSS, crossBitmap, - wxPoint(-1, -1), wxSize(smallButtonWidth-5, smallButtonHeight-5)); - } - else -*/ - { - confirmButton = new wxButton(panel, wxID_PROP_CHECK, ":-)", - wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight)); - cancelButton = new wxButton(panel, wxID_PROP_CROSS, "X", - wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight)); - } - - wxLayoutConstraints *c = new wxLayoutConstraints; - c->left.SameAs (panel, wxLeft, 2); - if (windowCloseButton) - c->top.Below (windowCloseButton, 2); - else - c->top.SameAs (panel, wxTop, 2); - - c->width.AsIs(); - c->height.AsIs(); - - cancelButton->SetConstraints(c); - - c = new wxLayoutConstraints; - c->left.RightOf (cancelButton, 2); - c->top.SameAs (cancelButton, wxTop, 0); - c->width.AsIs(); - c->height.AsIs(); - - confirmButton->SetConstraints(c); - - cancelButton->Enable(FALSE); - confirmButton->Enable(FALSE); - } - - if (buttonFlags & wxPROP_PULLDOWN) - { - editButton = new wxButton(panel, wxID_PROP_EDIT, "...", - wxPoint(-1, -1), wxSize(smallButtonWidth, smallButtonHeight)); - editButton->Enable(FALSE); - wxLayoutConstraints *c = new wxLayoutConstraints; - - if (windowCloseButton) - c->top.Below (windowCloseButton, 2); - else - c->top.SameAs (panel, wxTop, 2); - - c->right.SameAs (panel, wxRight, 2); - c->width.AsIs(); - c->height.AsIs(); - editButton->SetConstraints(c); - } - - valueText = new wxPropertyTextEdit(this, panel, wxID_PROP_TEXT, "", wxPoint(-1, -1), wxSize(-1, -1), wxPROCESS_ENTER); - valueText->Enable(FALSE); - - wxLayoutConstraints *c = new wxLayoutConstraints; - - if (cancelButton) - c->left.RightOf (confirmButton, 2); - else - c->left.SameAs (panel, wxLeft, 2); - - if (windowCloseButton) - c->top.Below (windowCloseButton, 2); - else - c->top.SameAs (panel, wxTop, 2); - - if (editButton) - c->right.LeftOf (editButton, 2); - else - c->right.SameAs (panel, wxRight, 2); - c->height.AsIs(); - - valueText->SetConstraints(c); - - valueList = new wxListBox(panel, wxID_PROP_VALUE_SELECT, wxPoint(-1, -1), wxSize(-1, 60)); - valueList->Show(FALSE); - - c = new wxLayoutConstraints; - - c->left.SameAs (panel, wxLeft, 2); - c->top.Below (valueText, 2); - c->right.SameAs (panel, wxRight, 2); - c->height.Absolute(60); - - valueList->SetConstraints(c); - - propertyScrollingList = new wxListBox(panel, wxID_PROP_SELECT, - wxPoint(-1, -1), wxSize(300, 300)); - propertyScrollingList->SetFont(boringFont); - - c = new wxLayoutConstraints; - - c->left.SameAs (panel, wxLeft, 2); - - if (buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD) - c->top.Below (valueText, 2); - else - c->top.Below (valueList, 2); - - c->right.SameAs (panel, wxRight, 2); - c->bottom.SameAs (panel, wxBottom, 2); - - propertyScrollingList->SetConstraints(c); - - // Note: if this is called now, it causes a GPF. - // Why? -// panel->Layout(); - - return TRUE; -} - -void wxPropertyListView::ShowTextControl(bool show) -{ - if (valueText) - valueText->Show(show); -} - -void wxPropertyListView::ShowListBoxControl(bool show) -{ - if (valueList) - { - valueList->Show(show); - if (buttonFlags & wxPROP_DYNAMIC_VALUE_FIELD) - { - wxLayoutConstraints *constraints = propertyScrollingList->GetConstraints(); - if (constraints) - { - if (show) - constraints->top.Below(valueList, 2); - else - constraints->top.Below(valueText, 2); - propertyWindow->Layout(); - } - } - } -} - -void wxPropertyListView::EnableCheck(bool show) -{ - if (confirmButton) - confirmButton->Enable(show); -} - -void wxPropertyListView::EnableCross(bool show) -{ - if (cancelButton) - cancelButton->Enable(show); -} - -bool wxPropertyListView::OnClose(void) -{ - // Retrieve the value if any - wxCommandEvent event; - OnCheck(event); - - delete this; - return TRUE; -} - -void wxPropertyListView::OnValueListSelect(wxCommandEvent& event) -{ - if (currentProperty && currentValidator) - { - if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return; - - wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; - - listValidator->OnValueListSelect(currentProperty, this, propertyWindow); - } -} - -void wxPropertyListView::OnOk(wxCommandEvent& event) -{ - // Retrieve the value if any - OnCheck(event); - - managedWindow->Close(TRUE); -} - -void wxPropertyListView::OnCancel(wxCommandEvent& event) -{ -// SetReturnCode(wxID_CANCEL); - managedWindow->Close(TRUE); - dialogCancelled = TRUE; -} - -void wxPropertyListView::OnHelp(wxCommandEvent& event) -{ -} - -void wxPropertyListView::OnCheck(wxCommandEvent& event) -{ - if (currentProperty) - { - RetrieveProperty(currentProperty); - } -} - -void wxPropertyListView::OnCross(wxCommandEvent& event) -{ - if (currentProperty && currentValidator) - { - if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return; - - wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; - - // Revert to old value - listValidator->OnDisplayValue(currentProperty, this, propertyWindow); - } -} - -void wxPropertyListView::OnPropertyDoubleClick(wxCommandEvent& event) -{ - if (currentProperty && currentValidator) - { - if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return; - - wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; - - // Revert to old value - listValidator->OnDoubleClick(currentProperty, this, propertyWindow); - } -} - -void wxPropertyListView::OnEdit(wxCommandEvent& event) -{ - if (currentProperty && currentValidator) - { - if (!currentValidator->IsKindOf(CLASSINFO(wxPropertyListValidator))) - return; - - wxPropertyListValidator *listValidator = (wxPropertyListValidator *)currentValidator; - - listValidator->OnEdit(currentProperty, this, propertyWindow); - } -} - -void wxPropertyListView::OnText(wxCommandEvent& event) -{ - if (event.GetEventType() == wxEVT_COMMAND_TEXT_ENTER) - { - OnCheck(event); - } -} - -/* - * Property dialog box - */ - -IMPLEMENT_CLASS(wxPropertyListDialog, wxDialog) - -BEGIN_EVENT_TABLE(wxPropertyListDialog, wxDialog) - EVT_BUTTON(wxID_CANCEL, wxPropertyListDialog::OnCancel) -END_EVENT_TABLE() - -wxPropertyListDialog::wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, - const wxString& title, const wxPoint& pos, - const wxSize& size, long style, const wxString& name): - wxDialog(parent, -1, title, pos, size, style, name) -{ - view = v; - view->AssociatePanel(this); - view->SetManagedWindow(this); - SetAutoLayout(TRUE); -} - -bool wxPropertyListDialog::OnClose(void) -{ - if (view) - { - SetReturnCode(wxID_CANCEL); - view->OnClose(); - view = NULL; - return TRUE; - } - else - return FALSE; -} - -void wxPropertyListDialog::OnCancel(wxCommandEvent& event) -{ - SetReturnCode(wxID_CANCEL); - this->Close(); -} - -void wxPropertyListDialog::OnDefaultAction(wxControl *item) -{ -/* - if (item == view->GetPropertyScrollingList()) - view->OnDoubleClick(); -*/ -} - -// Extend event processing to search the view's event table -bool wxPropertyListDialog::ProcessEvent(wxEvent& event) -{ - if ( !view || ! view->ProcessEvent(event) ) - return wxEvtHandler::ProcessEvent(event); - else - return TRUE; -} - -/* - * Property panel - */ - -IMPLEMENT_CLASS(wxPropertyListPanel, wxPanel) - -void wxPropertyListPanel::OnDefaultAction(wxControl *item) -{ -/* - if (item == view->GetPropertyScrollingList()) - view->OnDoubleClick(); -*/ -} - -// Extend event processing to search the view's event table -bool wxPropertyListPanel::ProcessEvent(wxEvent& event) -{ - if ( !view || ! view->ProcessEvent(event) ) - return wxEvtHandler::ProcessEvent(event); - else - return TRUE; -} - -/* - * Property frame - */ - -IMPLEMENT_CLASS(wxPropertyListFrame, wxFrame) - -bool wxPropertyListFrame::OnClose(void) -{ - if (view) - return view->OnClose(); - else - return FALSE; -} - -wxPanel *wxPropertyListFrame::OnCreatePanel(wxFrame *parent, wxPropertyListView *v) -{ - return new wxPropertyListPanel(v, parent); -} - -bool wxPropertyListFrame::Initialize(void) -{ - propertyPanel = OnCreatePanel(this, view); - if (propertyPanel) - { - view->AssociatePanel(propertyPanel); - view->SetManagedWindow(this); - propertyPanel->SetAutoLayout(TRUE); - return TRUE; - } - else - return FALSE; -} - - /* - * Property list specific validator - */ - -IMPLEMENT_ABSTRACT_CLASS(wxPropertyListValidator, wxPropertyValidator) - -bool wxPropertyListValidator::OnSelect(bool select, wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ -// view->GetValueText()->Show(TRUE); - if (select) - OnDisplayValue(property, view, parentWindow); - - return TRUE; -} - -bool wxPropertyListValidator::OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - wxString s(view->GetValueList()->GetStringSelection()); - if (s != "") - { - view->GetValueText()->SetValue(s); - view->RetrieveProperty(property); - } - return TRUE; -} - -bool wxPropertyListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ -// view->GetValueText()->Show(TRUE); - wxString str(property->GetValue().GetStringRepresentation()); - - view->GetValueText()->SetValue(str.GetData()); - return TRUE; -} - -// Called when TICK is pressed or focus is lost or view wants to update -// the property list. -// Does the transferance from the property editing area to the property itself -bool wxPropertyListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - return FALSE; -} - -void wxPropertyListValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (view->GetDetailedEditing()) - view->EndDetailedEditing(); - else - view->BeginDetailedEditing(); -} - -bool wxPropertyListValidator::OnClearControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(FALSE); - if (view->GetCancelButton()) - view->GetCancelButton()->Enable(FALSE); - if (view->GetEditButton()) - view->GetEditButton()->Enable(FALSE); - return TRUE; -} - -/* - * Default validators - */ - -IMPLEMENT_DYNAMIC_CLASS(wxRealListValidator, wxPropertyListValidator) - -/// -/// Real number validator -/// -bool wxRealListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (realMin == 0.0 && realMax == 0.0) - return TRUE; - - if (!view->GetValueText()) - return FALSE; - wxString value(view->GetValueText()->GetValue()); - - float val = 0.0; - if (!StringToFloat(WXSTRINGCAST value, &val)) - { - char buf[200]; - sprintf(buf, "Value %s is not a valid real number!", value.GetData()); - wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - - if (val < realMin || val > realMax) - { - char buf[200]; - sprintf(buf, "Value must be a real number between %.2f and %.2f!", realMin, realMax); - wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - return TRUE; -} - -// Called when TICK is pressed or focus is lost or view wants to update -// the property list. -// Does the transferance from the property editing area to the property itself -bool wxRealListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - - if (strlen(view->GetValueText()->GetValue()) == 0) - return FALSE; - - wxString value(view->GetValueText()->GetValue()); - float f = (float)atof(value.GetData()); - property->GetValue() = f; - return TRUE; -} - -bool wxRealListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(TRUE); - if (view->GetCancelButton()) - view->GetCancelButton()->Enable(TRUE); - if (view->GetEditButton()) - view->GetEditButton()->Enable(FALSE); - if (view->GetValueText()) - view->GetValueText()->Enable(TRUE); - return TRUE; -} - -/// -/// Integer validator -/// -IMPLEMENT_DYNAMIC_CLASS(wxIntegerListValidator, wxPropertyListValidator) - -bool wxIntegerListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (integerMin == 0 && integerMax == 0) - return TRUE; - - if (!view->GetValueText()) - return FALSE; - wxString value(view->GetValueText()->GetValue()); - - long val = 0; - if (!StringToLong(WXSTRINGCAST value, &val)) - { - char buf[200]; - sprintf(buf, "Value %s is not a valid integer!", value.GetData()); - wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - if (val < integerMin || val > integerMax) - { - char buf[200]; - sprintf(buf, "Value must be an integer between %ld and %ld!", integerMin, integerMax); - wxMessageBox(buf, "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - return TRUE; -} - -// Called when TICK is pressed or focus is lost or view wants to update -// the property list. -// Does the transferance from the property editing area to the property itself -bool wxIntegerListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - - if (strlen(view->GetValueText()->GetValue()) == 0) - return FALSE; - - wxString value(view->GetValueText()->GetValue()); - long val = (long)atoi(value.GetData()); - property->GetValue() = (long)val; - return TRUE; -} - -bool wxIntegerListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(TRUE); - if (view->GetCancelButton()) - view->GetCancelButton()->Enable(TRUE); - if (view->GetEditButton()) - view->GetEditButton()->Enable(FALSE); - if (view->GetValueText()) - view->GetValueText()->Enable(TRUE); - return TRUE; -} - -/// -/// boolean validator -/// -IMPLEMENT_DYNAMIC_CLASS(wxBoolListValidator, wxPropertyListValidator) - -bool wxBoolListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - wxString value(view->GetValueText()->GetValue()); - if (value != "True" && value != "False") - { - wxMessageBox("Value must be True or False!", "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - return TRUE; -} - -// Called when TICK is pressed or focus is lost or view wants to update -// the property list. -// Does the transferance from the property editing area to the property itself -bool wxBoolListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - - if (strlen(view->GetValueText()->GetValue()) == 0) - return FALSE; - - wxString value(view->GetValueText()->GetValue()); - bool boolValue = FALSE; - if (value == "True") - boolValue = TRUE; - else - boolValue = FALSE; - property->GetValue() = (bool)boolValue; - return TRUE; -} - -bool wxBoolListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - wxString str(property->GetValue().GetStringRepresentation()); - - view->GetValueText()->SetValue(str.GetData()); - view->GetValueList()->SetStringSelection(str.GetData()); - return TRUE; -} - -bool wxBoolListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(FALSE); - if (view->GetCancelButton()) - view->GetCancelButton()->Enable(FALSE); - if (view->GetEditButton()) - view->GetEditButton()->Enable(TRUE); - if (view->GetValueText()) - view->GetValueText()->Enable(FALSE); - return TRUE; -} - -bool wxBoolListValidator::OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (view->GetValueList()) - { - view->ShowListBoxControl(TRUE); - view->GetValueList()->Enable(TRUE); - - view->GetValueList()->Append("True"); - view->GetValueList()->Append("False"); - char *currentString = copystring(view->GetValueText()->GetValue()); - view->GetValueList()->SetStringSelection(currentString); - delete[] currentString; - } - return TRUE; -} - -bool wxBoolListValidator::OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (view->GetValueList()) - { - view->GetValueList()->Clear(); - view->ShowListBoxControl(FALSE); - view->GetValueList()->Enable(FALSE); - } - return TRUE; -} - -// Called when the property is double clicked. Extra functionality can be provided, -// cycling through possible values. -bool wxBoolListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - if (property->GetValue().BoolValue()) - property->GetValue() = (bool)FALSE; - else - property->GetValue() = (bool)TRUE; - view->DisplayProperty(property); - view->UpdatePropertyDisplayInList(property); - view->OnPropertyChanged(property); - return TRUE; -} - -/// -/// String validator -/// -IMPLEMENT_DYNAMIC_CLASS(wxStringListValidator, wxPropertyListValidator) - -wxStringListValidator::wxStringListValidator(wxStringList *list, long flags): - wxPropertyListValidator(flags) -{ - strings = list; - // If no constraint, we just allow the string to be edited. - if (!strings && ((validatorFlags & wxPROP_ALLOW_TEXT_EDITING) == 0)) - validatorFlags |= wxPROP_ALLOW_TEXT_EDITING; -} - -bool wxStringListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!strings) - return TRUE; - - if (!view->GetValueText()) - return FALSE; - wxString value(view->GetValueText()->GetValue()); - - if (!strings->Member(value.GetData())) - { - wxString s("Value "); - s += value.GetData(); - s += " is not valid."; - wxMessageBox(s.GetData(), "Property value error", wxOK | wxICON_EXCLAMATION, parentWindow); - return FALSE; - } - return TRUE; -} - -// Called when TICK is pressed or focus is lost or view wants to update -// the property list. -// Does the transferance from the property editing area to the property itself -bool wxStringListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - wxString value(view->GetValueText()->GetValue()); - property->GetValue() = value ; - return TRUE; -} - -// Called when TICK is pressed or focus is lost or view wants to update -// the property list. -// Does the transferance from the property editing area to the property itself -bool wxStringListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - wxString str(property->GetValue().GetStringRepresentation()); - view->GetValueText()->SetValue(str.GetData()); - if (strings) - { - view->GetValueList()->SetStringSelection(str.GetData()); - } - return TRUE; -} - -bool wxStringListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - // Unconstrained - if (!strings) - { - if (view->GetEditButton()) - view->GetEditButton()->Enable(FALSE); - if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(TRUE); - if (view->GetCancelButton()) - view->GetCancelButton()->Enable(TRUE); - if (view->GetValueText()) - view->GetValueText()->Enable(TRUE); - return TRUE; - } - - // Constrained - if (view->GetValueText()) - view->GetValueText()->Enable(FALSE); - - if (view->GetEditButton()) - view->GetEditButton()->Enable(TRUE); - - if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(FALSE); - if (view->GetCancelButton()) - view->GetCancelButton()->Enable(FALSE); - return TRUE; -} - -bool wxStringListValidator::OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (view->GetValueList()) - { - view->ShowListBoxControl(TRUE); - view->GetValueList()->Enable(TRUE); - wxNode *node = strings->First(); - while (node) - { - char *s = (char *)node->Data(); - view->GetValueList()->Append(s); - node = node->Next(); - } - char *currentString = property->GetValue().StringValue(); - view->GetValueList()->SetStringSelection(currentString); - } - return TRUE; -} - -bool wxStringListValidator::OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!strings) - { - return TRUE; - } - - if (view->GetValueList()) - { - view->GetValueList()->Clear(); - view->ShowListBoxControl(FALSE); - view->GetValueList()->Enable(FALSE); - } - return TRUE; -} - -// Called when the property is double clicked. Extra functionality can be provided, -// cycling through possible values. -bool wxStringListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - if (!strings) - return FALSE; - - wxNode *node = strings->First(); - char *currentString = property->GetValue().StringValue(); - while (node) - { - char *s = (char *)node->Data(); - if (strcmp(s, currentString) == 0) - { - char *nextString = NULL; - if (node->Next()) - nextString = (char *)node->Next()->Data(); - else - nextString = (char *)strings->First()->Data(); - property->GetValue() = wxString(nextString); - view->DisplayProperty(property); - view->UpdatePropertyDisplayInList(property); - view->OnPropertyChanged(property); - return TRUE; - } - else node = node->Next(); - } - return TRUE; -} - -/// -/// Filename validator -/// -IMPLEMENT_DYNAMIC_CLASS(wxFilenameListValidator, wxPropertyListValidator) - -wxFilenameListValidator::wxFilenameListValidator(wxString message , wxString wildcard, long flags): - wxPropertyListValidator(flags), filenameWildCard(wildcard), filenameMessage(message) -{ -} - -wxFilenameListValidator::~wxFilenameListValidator(void) -{ -} - -bool wxFilenameListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - return TRUE; -} - -// Called when TICK is pressed or focus is lost or view wants to update -// the property list. -// Does the transferance from the property editing area to the property itself -bool wxFilenameListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - wxString value(view->GetValueText()->GetValue()); - property->GetValue() = value ; - return TRUE; -} - -// Called when TICK is pressed or focus is lost or view wants to update -// the property list. -// Does the transferance from the property editing area to the property itself -bool wxFilenameListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - wxString str(property->GetValue().GetStringRepresentation()); - view->GetValueText()->SetValue(str); - return TRUE; -} - -// Called when the property is double clicked. Extra functionality can be provided, -// cycling through possible values. -bool wxFilenameListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - OnEdit(property, view, parentWindow); - return TRUE; -} - -bool wxFilenameListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(TRUE); - if (view->GetCancelButton()) - view->GetCancelButton()->Enable(TRUE); - if (view->GetEditButton()) - view->GetEditButton()->Enable(TRUE); - if (view->GetValueText()) - view->GetValueText()->Enable((GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == wxPROP_ALLOW_TEXT_EDITING); - return TRUE; -} - -void wxFilenameListValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return; - - char *s = wxFileSelector( - filenameMessage.GetData(), - wxPathOnly(property->GetValue().StringValue()), - wxFileNameFromPath(property->GetValue().StringValue()), - NULL, - filenameWildCard.GetData(), - 0, - parentWindow); - if (s) - { - property->GetValue() = wxString(s); - view->DisplayProperty(property); - view->UpdatePropertyDisplayInList(property); - view->OnPropertyChanged(property); - } -} - -/// -/// Colour validator -/// -IMPLEMENT_DYNAMIC_CLASS(wxColourListValidator, wxPropertyListValidator) - -wxColourListValidator::wxColourListValidator(long flags): - wxPropertyListValidator(flags) -{ -} - -wxColourListValidator::~wxColourListValidator(void) -{ -} - -bool wxColourListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - return TRUE; -} - -// Called when TICK is pressed or focus is lost or view wants to update -// the property list. -// Does the transferance from the property editing area to the property itself -bool wxColourListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - wxString value(view->GetValueText()->GetValue()); - - property->GetValue() = value ; - return TRUE; -} - -// Called when TICK is pressed or focus is lost or view wants to update -// the property list. -// Does the transferance from the property editing area to the property itself -bool wxColourListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - wxString str(property->GetValue().GetStringRepresentation()); - view->GetValueText()->SetValue(str); - return TRUE; -} - -// Called when the property is double clicked. Extra functionality can be provided, -// cycling through possible values. -bool wxColourListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - OnEdit(property, view, parentWindow); - return TRUE; -} - -bool wxColourListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(TRUE); - if (view->GetCancelButton()) - view->GetCancelButton()->Enable(TRUE); - if (view->GetEditButton()) - view->GetEditButton()->Enable(TRUE); - if (view->GetValueText()) - view->GetValueText()->Enable((GetFlags() & wxPROP_ALLOW_TEXT_EDITING) == wxPROP_ALLOW_TEXT_EDITING); - return TRUE; -} - -void wxColourListValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return; - - char *s = property->GetValue().StringValue(); - int r = 0; - int g = 0; - int b = 0; - if (s) - { - r = wxHexToDec(s); - g = wxHexToDec(s+2); - b = wxHexToDec(s+4); - } - - wxColour col(r,g,b); - - wxColourData data; - data.SetChooseFull(TRUE); - data.SetColour(col); - - for (int i = 0; i < 16; i++) - { - wxColour colour(i*16, i*16, i*16); - data.SetCustomColour(i, colour); - } - - wxColourDialog dialog(parentWindow, &data); - if (dialog.ShowModal() != wxID_CANCEL) - { - wxColourData retData = dialog.GetColourData(); - col = retData.GetColour(); - - char buf[7]; - wxDecToHex(col.Red(), buf); - wxDecToHex(col.Green(), buf+2); - wxDecToHex(col.Blue(), buf+4); - - property->GetValue() = wxString(buf); - view->DisplayProperty(property); - view->UpdatePropertyDisplayInList(property); - view->OnPropertyChanged(property); - } -} - -/// -/// List of strings validator. For this we need more user interface than -/// we get with a property list; so create a new dialog for editing the list. -/// -IMPLEMENT_DYNAMIC_CLASS(wxListOfStringsListValidator, wxPropertyListValidator) - -wxListOfStringsListValidator::wxListOfStringsListValidator(long flags): - wxPropertyListValidator(flags) -{ -} - -bool wxListOfStringsListValidator::OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - // No constraints for an arbitrary, user-editable list of strings. - return TRUE; -} - -// Called when TICK is pressed or focus is lost or view wants to update -// the property list. -// Does the transferance from the property editing area to the property itself. -// In this case, the user cannot directly edit the string list. -bool wxListOfStringsListValidator::OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - return TRUE; -} - -bool wxListOfStringsListValidator::OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (!view->GetValueText()) - return FALSE; - wxString str(property->GetValue().GetStringRepresentation()); - view->GetValueText()->SetValue(str.GetData()); - return TRUE; -} - -bool wxListOfStringsListValidator::OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - if (view->GetEditButton()) - view->GetEditButton()->Enable(TRUE); - if (view->GetValueText()) - view->GetValueText()->Enable(FALSE); - - if (view->GetConfirmButton()) - view->GetConfirmButton()->Enable(FALSE); - if (view->GetCancelButton()) - view->GetCancelButton()->Enable(FALSE); - return TRUE; -} - -// Called when the property is double clicked. Extra functionality can be provided, -// cycling through possible values. -bool wxListOfStringsListValidator::OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - OnEdit(property, view, parentWindow); - return TRUE; -} - -void wxListOfStringsListValidator::OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) -{ - // Convert property value to a list of strings for editing - wxStringList *stringList = new wxStringList; - - wxPropertyValue *expr = property->GetValue().GetFirst(); - while (expr) - { - char *s = expr->StringValue(); - if (s) - stringList->Add(s); - expr = expr->GetNext(); - } - - wxString title("Editing "); - title += property->GetName(); - - if (EditStringList(parentWindow, stringList, title.GetData())) - { - wxPropertyValue& oldValue = property->GetValue(); - oldValue.ClearList(); - wxNode *node = stringList->First(); - while (node) - { - char *s = (char *)node->Data(); - oldValue.Append(new wxPropertyValue(s)); - - node = node->Next(); - } - - view->DisplayProperty(property); - view->UpdatePropertyDisplayInList(property); - view->OnPropertyChanged(property); - } - delete stringList; -} - -class wxPropertyStringListEditorDialog: public wxDialog -{ - public: - wxStringList *stringList; - wxListBox *listBox; - wxTextCtrl *stringText; - static bool dialogCancelled; - int currentSelection; - wxPropertyStringListEditorDialog(wxWindow *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long windowStyle = wxDEFAULT_DIALOG_STYLE, const wxString& name = "stringEditorDialogBox"): - wxDialog(parent, -1, title, pos, size, windowStyle, name) - { - stringList = NULL; - stringText = NULL; - listBox = NULL; - dialogCancelled = FALSE; - currentSelection = -1; - } - ~wxPropertyStringListEditorDialog(void) {} - bool OnClose(void); - void SaveCurrentSelection(void); - void ShowCurrentSelection(void); - - void OnOK(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - void OnAdd(wxCommandEvent& event); - void OnDelete(wxCommandEvent& event); - void OnStrings(wxCommandEvent& event); - void OnText(wxCommandEvent& event); - -DECLARE_EVENT_TABLE() -}; - -#define wxID_PROP_SL_ADD 3000 -#define wxID_PROP_SL_DELETE 3001 -#define wxID_PROP_SL_STRINGS 3002 -#define wxID_PROP_SL_TEXT 3003 - -BEGIN_EVENT_TABLE(wxPropertyStringListEditorDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxPropertyStringListEditorDialog::OnOK) - EVT_BUTTON(wxID_CANCEL, wxPropertyStringListEditorDialog::OnCancel) - EVT_BUTTON(wxID_PROP_SL_ADD, wxPropertyStringListEditorDialog::OnAdd) - EVT_BUTTON(wxID_PROP_SL_DELETE, wxPropertyStringListEditorDialog::OnDelete) - EVT_LISTBOX(wxID_PROP_SL_STRINGS, wxPropertyStringListEditorDialog::OnStrings) - EVT_TEXT(wxID_PROP_SL_TEXT, wxPropertyStringListEditorDialog::OnText) -END_EVENT_TABLE() - -class wxPropertyStringListEditorText: public wxTextCtrl -{ - public: - wxPropertyStringListEditorText(wxWindow *parent, wxWindowID id, const wxString& val, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long windowStyle = 0, const wxString& name = "text"): - wxTextCtrl(parent, id, val, pos, size, windowStyle, wxDefaultValidator, name) - { - } - void OnKillFocus(void) - { - wxPropertyStringListEditorDialog *dialog = (wxPropertyStringListEditorDialog *)GetParent(); - dialog->SaveCurrentSelection(); - } -}; - -bool wxPropertyStringListEditorDialog::dialogCancelled = FALSE; - -// Edit the string list. -bool wxListOfStringsListValidator::EditStringList(wxWindow *parent, wxStringList *stringList, const char *title) -{ - wxBeginBusyCursor(); - wxPropertyStringListEditorDialog *dialog = new wxPropertyStringListEditorDialog(parent, - title, wxPoint(10, 10), wxSize(400, 400), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); - - dialog->stringList = stringList; - - wxButton *okButton = new wxButton(dialog, wxID_OK, "OK", wxPoint(5, 5)); - wxButton *cancelButton = new wxButton(dialog, wxID_CANCEL, "Cancel", wxPoint(40, 5)); - -// wxButton *helpButton = new wxButton(dialog, (wxFunction)StringListEditorHelpProc, "Help"); -// helpButton->SetClientData((char *)this); - - dialog->listBox = new wxListBox(dialog, wxID_PROP_SL_STRINGS, - wxPoint(5, 30), wxSize(300, 200), 0, NULL, wxLB_SINGLE); - - dialog->stringText = new wxPropertyStringListEditorText(dialog, - wxID_PROP_SL_TEXT, "", wxPoint(5, 240), - wxSize(300, -1), wxPROCESS_ENTER); - dialog->stringText->Enable(FALSE); - - wxButton *addButton = new wxButton(dialog, wxID_PROP_SL_ADD, "Add", wxPoint(5, 280)); - wxButton *deleteButton = new wxButton(dialog, wxID_PROP_SL_DELETE, "Delete", wxPoint(40, 280)); - - wxNode *node = stringList->First(); - while (node) - { - char *str = (char *)node->Data(); - // Save node as client data for each listbox item - dialog->listBox->Append(str, (char *)node); - node = node->Next(); - } - - dialog->SetClientSize(310, 305); - - dialog->Centre(wxBOTH); - wxEndBusyCursor(); - if (dialog->ShowModal() == wxID_CANCEL) - return FALSE; - else - return TRUE; -} - -/* - * String list editor callbacks - * - */ - -void wxPropertyStringListEditorDialog::OnStrings(wxCommandEvent& event) -{ - int sel = listBox->GetSelection(); - if (sel > -1) - { - currentSelection = sel; - - ShowCurrentSelection(); - } -} - -void wxPropertyStringListEditorDialog::OnDelete(wxCommandEvent& event) -{ - int sel = listBox->GetSelection(); - if (sel == -1) - return; - - wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(sel); - if (!node) - return; - - listBox->Delete(sel); - delete[] (char *)node->Data(); - delete node; - currentSelection = -1; - stringText->SetValue(""); -} - -void wxPropertyStringListEditorDialog::OnAdd(wxCommandEvent& event) -{ - SaveCurrentSelection(); - - char *initialText = ""; - wxNode *node = stringList->Add(initialText); - listBox->Append(initialText, (char *)node); - currentSelection = stringList->Number() - 1; - listBox->SetSelection(currentSelection); - ShowCurrentSelection(); - stringText->SetFocus(); -} - -void wxPropertyStringListEditorDialog::OnOK(wxCommandEvent& event) -{ - SaveCurrentSelection(); - EndModal(wxID_OK); - Close(TRUE); -} - -void wxPropertyStringListEditorDialog::OnCancel(wxCommandEvent& event) -{ - dialogCancelled = TRUE; - EndModal(wxID_CANCEL); - Close(TRUE); -} - -void wxPropertyStringListEditorDialog::OnText(wxCommandEvent& event) -{ - if (event.GetEventType() == wxEVENT_TYPE_TEXT_ENTER_COMMAND) - { - SaveCurrentSelection(); - } -} - -bool wxPropertyStringListEditorDialog::OnClose(void) -{ - SaveCurrentSelection(); - return TRUE; -} - -void wxPropertyStringListEditorDialog::SaveCurrentSelection(void) -{ - if (currentSelection == -1) - return; - - wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(currentSelection); - if (!node) - return; - - wxString txt(stringText->GetValue()); - if (node->Data()) - delete[] (char *)node->Data(); - node->SetData((wxObject *)copystring(txt)); - - listBox->SetString(currentSelection, (char *)node->Data()); -} - -void wxPropertyStringListEditorDialog::ShowCurrentSelection(void) -{ - if (currentSelection == -1) - { - stringText->SetValue(""); - return; - } - wxNode *node = (wxNode *)listBox->wxListBox::GetClientData(currentSelection); - char *txt = (char *)node->Data(); - stringText->SetValue(txt); - stringText->Enable(TRUE); -} diff --git a/utils/wxprop/src/proplist.h b/utils/wxprop/src/proplist.h deleted file mode 100644 index 15f1243458..0000000000 --- a/utils/wxprop/src/proplist.h +++ /dev/null @@ -1,539 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: proplist.h -// Purpose: Property list classes -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - - /* - - TO DO: - - (1) Optional popup-help for each item, and an optional Help button - for dialog. - - (2) Align Ok, Cancel, Help buttons properly. - - (3) Consider retrieving the rectangle on the panel that can be - drawn into (where the value listbox is) and giving an example - of editing graphically. May be too fancy. - - (4) Deriveable types for wxPropertyValue => may need to reorganise - wxPropertyValue to use inheritance rather than present all-types-in-one - scheme. - - (5) Optional popup panel for value list, perhaps. - - (6) Floating point checking routine still crashes with Floating - point error for zany input. - - (7) Property sheet with choice (or listbox) to select alternative - sheets... multiple views per panel, only one active. For this - we really need a wxChoice that can be dynamically set: XView - may be a problem; Motif? - - (8) More example validators, e.g. colour selector. - */ - -#ifndef _PROPLIST_H_ -#define _PROPLIST_H_ - -#ifdef __GNUG__ -#pragma interface "proplist.h" -#endif - -#include "prop.h" - -#define wxPROP_BUTTON_CLOSE 1 -#define wxPROP_BUTTON_OK 2 -#define wxPROP_BUTTON_CANCEL 4 -#define wxPROP_BUTTON_CHECK_CROSS 8 -#define wxPROP_BUTTON_HELP 16 -#define wxPROP_DYNAMIC_VALUE_FIELD 32 -#define wxPROP_PULLDOWN 64 -#define wxPROP_SHOWVALUES 128 - -#ifdef __XVIEW__ -#define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN -#else -#define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN | wxPROP_SHOWVALUES -#endif - -#define wxID_PROP_CROSS 3000 -#define wxID_PROP_CHECK 3001 -#define wxID_PROP_EDIT 3002 -#define wxID_PROP_TEXT 3003 -#define wxID_PROP_SELECT 3004 -#define wxID_PROP_VALUE_SELECT 3005 - -// Mediates between a physical panel and the property sheet -class wxPropertyListView: public wxPropertyView -{ - DECLARE_DYNAMIC_CLASS(wxPropertyListView) - protected: - wxListBox *propertyScrollingList; - wxListBox *valueList; // Should really be a combobox, but we don't have one. - wxTextCtrl *valueText; - wxButton *confirmButton; // A tick, as in VB - wxButton *cancelButton; // A cross, as in VB - wxButton *editButton; // Invokes the custom validator, if any - - bool detailedEditing; // E.g. using listbox for choices - - static wxBitmap *tickBitmap; - static wxBitmap *crossBitmap; - - wxPanel *propertyWindow; // Panel that the controls will appear on - wxWindow *managedWindow; // Frame or dialog - - wxButton *windowCloseButton; // Or OK - wxButton *windowCancelButton; - wxButton *windowHelpButton; - public: - static bool dialogCancelled; - - wxPropertyListView(wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT); - ~wxPropertyListView(void); - - // Associates and shows the view - virtual void ShowView(wxPropertySheet *propertySheet, wxPanel *panel); - - // Update this view of the viewed object, called e.g. by - // the object itself. - virtual bool OnUpdateView(void); - - wxString MakeNameValueString(wxString name, wxString value); - - // Update a single line in the list of properties - virtual bool UpdatePropertyDisplayInList(wxProperty *property); - - // Update the whole list - virtual bool UpdatePropertyList(bool clearEditArea = TRUE); - - // Find the wxListBox index corresponding to this property - virtual int FindListIndexForProperty(wxProperty *property); - - // Select and show string representation in editor the given - // property. NULL resets to show no property. - virtual bool ShowProperty(wxProperty *property, bool select = TRUE); - virtual bool EditProperty(wxProperty *property); - - // Update the display from the property - virtual bool DisplayProperty(wxProperty *property); - // Update the property from the display - virtual bool RetrieveProperty(wxProperty *property); - - // Find appropriate validator and load property into value controls - virtual bool BeginShowingProperty(wxProperty *property); - // Find appropriate validator and unload property from value controls - virtual bool EndShowingProperty(wxProperty *property); - - // Begin detailed editing (e.g. using value listbox) - virtual void BeginDetailedEditing(void); - - // End detailed editing (e.g. using value listbox) - virtual void EndDetailedEditing(void); - - // Called by the property listbox - void OnPropertySelect(wxCommandEvent& event); - - // Called by the value listbox - void OnValueListSelect(wxCommandEvent& event); - - virtual bool CreateControls(void); - virtual void ShowTextControl(bool show); - virtual void ShowListBoxControl(bool show); - virtual void EnableCheck(bool show); - virtual void EnableCross(bool show); - - void OnOk(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - void OnHelp(wxCommandEvent& event); - void OnPropertyDoubleClick(wxCommandEvent& event); -// virtual void OnDoubleClick(void); - - void OnCheck(wxCommandEvent& event); - void OnCross(wxCommandEvent& event); - void OnEdit(wxCommandEvent& event); - void OnText(wxCommandEvent& event); - - inline virtual wxListBox *GetPropertyScrollingList() { return propertyScrollingList; } - inline virtual wxListBox *GetValueList() { return valueList; } - inline virtual wxTextCtrl *GetValueText() { return valueText; } - inline virtual wxButton *GetConfirmButton() { return confirmButton; } - inline virtual wxButton *GetCancelButton() { return cancelButton; } - inline virtual wxButton *GetEditButton() { return editButton; } - inline virtual bool GetDetailedEditing(void) { return detailedEditing; } - - inline virtual void AssociatePanel(wxPanel *win) { propertyWindow = win; } - inline virtual wxPanel *GetPanel(void) { return propertyWindow; } - - inline virtual void SetManagedWindow(wxWindow *win) { managedWindow = win; } - inline virtual wxWindow *GetManagedWindow(void) { return managedWindow; } - - inline virtual wxButton *GetWindowCloseButton() { return windowCloseButton; } - inline virtual wxButton *GetWindowCancelButton() { return windowCancelButton; } - inline virtual wxButton *GetHelpButton() { return windowHelpButton; } - - bool OnClose(void); - -DECLARE_EVENT_TABLE() -}; - -class wxPropertyTextEdit: public wxTextCtrl -{ - DECLARE_CLASS(wxPropertyTextEdit) - public: - wxPropertyListView *view; - wxPropertyTextEdit(wxPropertyListView *v, wxWindow *parent, const wxWindowID id, - const wxString& value, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "text"); - void OnSetFocus(void); - void OnKillFocus(void); -}; - -#define wxPROP_ALLOW_TEXT_EDITING 1 - -/* - * The type of validator used for property lists (Visual Basic style) - */ - -class wxPropertyListValidator: public wxPropertyValidator -{ - DECLARE_DYNAMIC_CLASS(wxPropertyListValidator) - protected: - public: - wxPropertyListValidator(long flags = wxPROP_ALLOW_TEXT_EDITING): wxPropertyValidator(flags) { } - ~wxPropertyListValidator(void) {} - - // Called when the property is selected or deselected: typically displays the value - // in the edit control (having chosen a suitable control to display: (non)editable text or listbox) - virtual bool OnSelect(bool select, wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when the property is double clicked. Extra functionality can be provided, such as - // cycling through possible values. - inline virtual bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) - { return TRUE; } - - // Called when the value listbox is selected. Default behaviour is to copy - // string to text control, and retrieve the value into the property. - virtual bool OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when the property value is edited using standard text control - virtual bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) - { - return TRUE; - } - - virtual bool OnClearControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when the property is edited in detail - virtual bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) - { - return TRUE; - } - - // Called if focus lost, IF we're in a modeless property editing situation. - virtual bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) - { - return TRUE; - } - - // Called when the edit (...) button is pressed. The default implementation - // calls view->BeginDetailedEditing; the filename validator (for example) overrides - // this function to show the file selector. - virtual void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost. - // Return FALSE if value didn't check out; signal to restore old value. - virtual bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow) - { return TRUE; } - - // Called when TICK is pressed or focus is lost or view wants to update - // the property list. - // Does the transferance from the property editing area to the property itself - virtual bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - virtual bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); -}; - -/* - * A default dialog box class to use. - */ - -class wxPropertyListDialog: public wxDialog -{ - DECLARE_CLASS(wxPropertyListDialog) - private: - wxPropertyListView *view; - public: - wxPropertyListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"); - bool OnClose(void); - void OnDefaultAction(wxControl *item); - void OnCancel(wxCommandEvent& event); - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); - -DECLARE_EVENT_TABLE() -}; - -/* - * A default panel class to use. - */ - -class wxPropertyListPanel: public wxPanel -{ - DECLARE_CLASS(wxPropertyListPanel) - private: - wxPropertyListView *view; - public: - wxPropertyListPanel(wxPropertyListView *v, wxWindow *parent, const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, const wxString& name = "panel"): - wxPanel(parent, -1, pos, size, style, name) - { - view = v; - } - void OnDefaultAction(wxControl *item); - - // Extend event processing to search the view's event table - virtual bool ProcessEvent(wxEvent& event); -}; - -/* - * A default frame class to use. - */ - -class wxPropertyListFrame: public wxFrame -{ - DECLARE_CLASS(wxPropertyListFrame) - private: - wxPropertyListView *view; - wxPanel *propertyPanel; - public: - wxPropertyListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME, const wxString& name = "frame"): - wxFrame(parent, -1, title, pos, size, style, name) - { - view = v; - propertyPanel = NULL; - } - bool OnClose(void); - - // Must call this to create panel and associate view - virtual bool Initialize(void); - virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v); - inline virtual wxPanel *GetPropertyPanel(void) { return propertyPanel; } -}; - -/* - * Some default validators - */ - -class wxRealListValidator: public wxPropertyListValidator -{ - DECLARE_DYNAMIC_CLASS(wxRealListValidator) - protected: - float realMin; - float realMax; - public: - // 0.0, 0.0 means no range - wxRealListValidator(float min = 0.0, float max = 0.0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags) - { - realMin = min; realMax = max; - } - ~wxRealListValidator(void) {} - - bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost. - // Return FALSE if value didn't check out; signal to restore old value. - bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost or view wants to update - // the property list. - // Does the transfer from the property editing area to the property itself - bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); -}; - -class wxIntegerListValidator: public wxPropertyListValidator -{ - DECLARE_DYNAMIC_CLASS(wxIntegerListValidator) - protected: - long integerMin; - long integerMax; - public: - // 0, 0 means no range - wxIntegerListValidator(long min = 0, long max = 0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags) - { - integerMin = min; integerMax = max; - } - ~wxIntegerListValidator(void) {} - - bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost. - // Return FALSE if value didn't check out; signal to restore old value. - bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost or view wants to update - // the property list. - // Does the transfer from the property editing area to the property itself - bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); -}; - -class wxBoolListValidator: public wxPropertyListValidator -{ - DECLARE_DYNAMIC_CLASS(wxBoolListValidator) - protected: - public: - wxBoolListValidator(long flags = 0):wxPropertyListValidator(flags) - { - } - ~wxBoolListValidator(void) {} - - bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost. - // Return FALSE if value didn't check out; signal to restore old value. - bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost or view wants to update - // the property list. - // Does the transfer from the property editing area to the property itself - bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when the property is double clicked. Extra functionality can be provided, - // cycling through possible values. - virtual bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); -}; - -class wxStringListValidator: public wxPropertyListValidator -{ - DECLARE_DYNAMIC_CLASS(wxStringListValidator) - protected: - wxStringList *strings; - public: - wxStringListValidator(wxStringList *list = NULL, long flags = 0); - - ~wxStringListValidator(void) - { - if (strings) - delete strings; - } - - bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost. - // Return FALSE if value didn't check out; signal to restore old value. - bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost or view wants to update - // the property list. - // Does the transfer from the property editing area to the property itself - bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when the property is double clicked. Extra functionality can be provided, - // cycling through possible values. - bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); -}; - -class wxFilenameListValidator: public wxPropertyListValidator -{ - DECLARE_DYNAMIC_CLASS(wxFilenameListValidator) - protected: - wxString filenameWildCard; - wxString filenameMessage; - - public: - wxFilenameListValidator(wxString message = "Select a file", wxString wildcard = "*.*", long flags = 0); - - ~wxFilenameListValidator(void); - - // Called when TICK is pressed or focus is lost. - // Return FALSE if value didn't check out; signal to restore old value. - bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost or view wants to update - // the property list. - // Does the transferance from the property editing area to the property itself - bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when the edit (...) button is pressed. - void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); -}; - -class wxColourListValidator: public wxPropertyListValidator -{ - DECLARE_DYNAMIC_CLASS(wxColourListValidator) - protected: - public: - wxColourListValidator(long flags = 0); - - ~wxColourListValidator(void); - - bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when the edit (...) button is pressed. - void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); -}; - -class wxListOfStringsListValidator: public wxPropertyListValidator -{ - DECLARE_DYNAMIC_CLASS(wxListOfStringsListValidator) - protected: - public: - wxListOfStringsListValidator(long flags = 0); - - ~wxListOfStringsListValidator(void) - { - } - - bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost. - // Return FALSE if value didn't check out; signal to restore old value. - bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when TICK is pressed or focus is lost or view wants to update - // the property list. - // Does the transfer from the property editing area to the property itself - bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - // Called when the property is double clicked. - bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); - - bool EditStringList(wxWindow *parent, wxStringList *stringList, const char *title = "String List Editor"); - - // Called when the edit (...) button is pressed. - void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow); -}; - -#endif - diff --git a/utils/wxprop/src/test.cpp b/utils/wxprop/src/test.cpp deleted file mode 100644 index 267dfdab74..0000000000 --- a/utils/wxprop/src/test.cpp +++ /dev/null @@ -1,321 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: test.cpp -// Purpose: Property sheet test implementation -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "test.h" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -#include "test.h" - -// A macro needed for some compilers (AIX) that need 'main' to be defined -// in the application itself. -IMPLEMENT_WXWIN_MAIN - -IMPLEMENT_APP(MyApp) - -wxPropertyValidatorRegistry myListValidatorRegistry; -wxPropertyValidatorRegistry myFormValidatorRegistry; - -MyApp::MyApp(void) -{ - m_childWindow = NULL; - m_mainFrame = NULL; -} - -bool MyApp::OnInit(void) -{ - RegisterValidators(); - - // Create the main frame window - m_mainFrame = new MyFrame(NULL, "wxPropertySheet Demo", wxPoint(0, 0), wxSize(300, 400), wxDEFAULT_FRAME); - - // Make a menubar - wxMenu *file_menu = new wxMenu; - file_menu->Append(PROPERTY_TEST_DIALOG_LIST, "Test property list &dialog..."); - file_menu->Append(PROPERTY_TEST_FRAME_LIST, "Test property list &frame..."); - file_menu->AppendSeparator(); - file_menu->Append(PROPERTY_TEST_DIALOG_FORM, "Test property form d&ialog..."); - file_menu->Append(PROPERTY_TEST_FRAME_FORM, "Test property form f&rame..."); - file_menu->AppendSeparator(); - file_menu->Append(PROPERTY_QUIT, "E&xit"); - - wxMenu *help_menu = new wxMenu; - help_menu->Append(PROPERTY_ABOUT, "&About"); - - wxMenuBar *menu_bar = new wxMenuBar; - - menu_bar->Append(file_menu, "&File"); - menu_bar->Append(help_menu, "&Help"); - - // Associate the menu bar with the frame - m_mainFrame->SetMenuBar(menu_bar); - - m_mainFrame->Centre(wxBOTH); - m_mainFrame->Show(TRUE); - - SetTopWindow(m_mainFrame); - - return TRUE; -} - -BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_CLOSE(MyFrame::OnCloseWindow) - EVT_MENU(PROPERTY_QUIT, MyFrame::OnQuit) - EVT_MENU(PROPERTY_ABOUT, MyFrame::OnAbout) - EVT_MENU(PROPERTY_TEST_DIALOG_LIST, MyFrame::OnDialogList) - EVT_MENU(PROPERTY_TEST_FRAME_LIST, MyFrame::OnFrameList) - EVT_MENU(PROPERTY_TEST_DIALOG_FORM, MyFrame::OnDialogForm) - EVT_MENU(PROPERTY_TEST_FRAME_FORM, MyFrame::OnFrameForm) -END_EVENT_TABLE() - -// Define my frame constructor -MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long type): - wxFrame(frame, -1, title, pos, size, type) -{ -} - -// Define the behaviour for the frame closing -// - must delete all frames except for the main one. -void MyFrame::OnCloseWindow(wxCloseEvent& event) -{ - if (wxGetApp().m_childWindow) - { - wxGetApp().m_childWindow->Close(TRUE); - } - - Destroy(); -} - -void MyFrame::OnQuit(wxCommandEvent& event) -{ - Close(TRUE); -} - -void MyFrame::OnDialogList(wxCommandEvent& event) -{ - wxGetApp().PropertyListTest(TRUE); -} - -void MyFrame::OnFrameList(wxCommandEvent& event) -{ - wxGetApp().PropertyListTest(FALSE); -} - -void MyFrame::OnDialogForm(wxCommandEvent& event) -{ - wxGetApp().PropertyFormTest(TRUE); -} - -void MyFrame::OnFrameForm(wxCommandEvent& event) -{ - wxGetApp().PropertyFormTest(FALSE); -} - -void MyFrame::OnAbout(wxCommandEvent& event) -{ - (void)wxMessageBox("Property Classes Demo\nAuthor: Julian Smart", "About Property Classes Test"); -} - -void MyApp::RegisterValidators(void) -{ - myListValidatorRegistry.RegisterValidator((wxString)"real", new wxRealListValidator); - myListValidatorRegistry.RegisterValidator((wxString)"string", new wxStringListValidator); - myListValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerListValidator); - myListValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolListValidator); - myListValidatorRegistry.RegisterValidator((wxString)"stringlist", new wxListOfStringsListValidator); - - myFormValidatorRegistry.RegisterValidator((wxString)"real", new wxRealFormValidator); - myFormValidatorRegistry.RegisterValidator((wxString)"string", new wxStringFormValidator); - myFormValidatorRegistry.RegisterValidator((wxString)"integer", new wxIntegerFormValidator); - myFormValidatorRegistry.RegisterValidator((wxString)"bool", new wxBoolFormValidator); -} - -void MyApp::PropertyListTest(bool useDialog) -{ - if (m_childWindow) - return; - - wxPropertySheet *sheet = new wxPropertySheet; - - sheet->AddProperty(new wxProperty("fred", 1.0, "real")); - sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool")); - sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerListValidator(-50, 50))); - sheet->AddProperty(new wxProperty("bill", 25.0, "real", new wxRealListValidator(0.0, 100.0))); - sheet->AddProperty(new wxProperty("julian", "one", "string")); - sheet->AddProperty(new wxProperty("bitmap", "none", "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"))); - wxStringList *strings = new wxStringList("one", "two", "three", NULL); - sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringListValidator(strings))); - - wxStringList *strings2 = new wxStringList("earth", "fire", "wind", "water", NULL); - sheet->AddProperty(new wxProperty("string list", strings2, "stringlist")); - - wxPropertyListView *view = - new wxPropertyListView(NULL, - wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES); - - wxDialog *propDialog = NULL; - wxPropertyListFrame *propFrame = NULL; - if (useDialog) - { - propDialog = new PropListDialog(view, NULL, "Property Sheet Test", - wxPoint(-1, -1), wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS); - m_childWindow = propDialog; - } - else - { - propFrame = new PropListFrame(view, NULL, "Property Sheet Test", wxPoint(-1, -1), wxSize(400, 500)); - m_childWindow = propFrame; - } - - view->AddRegistry(&myListValidatorRegistry); - - if (useDialog) - { - view->ShowView(sheet, propDialog); - propDialog->Centre(wxBOTH); - propDialog->Show(TRUE); - } - else - { - propFrame->Initialize(); - view->ShowView(sheet, propFrame->GetPropertyPanel()); - - propFrame->Centre(wxBOTH); - propFrame->Show(TRUE); - } -} - -void MyApp::PropertyFormTest(bool useDialog) -{ - if (m_childWindow) - return; - -#if 0 - wxPropertySheet *sheet = new wxPropertySheet; - - sheet->AddProperty(new wxProperty("fred", 25.0, "real", new wxRealFormValidator(0.0, 100.0))); - sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool")); - sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerFormValidator(-50, 50))); - sheet->AddProperty(new wxProperty("julian", "one", "string")); - wxStringList *strings = new wxStringList("one", "two", "three", NULL); - sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringFormValidator(strings))); - - wxPropertyFormView *view = new wxPropertyFormView(NULL); - - wxDialogBox *propDialog = NULL; - wxPropertyFormFrame *propFrame = NULL; - if (useDialog) - { - propDialog = new PropFormDialog(view, NULL, "Property Form Test", wxPoint(-1, -1), wxSize(380, 250), - wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); - m_childWindow = propDialog; - } - else - { - propFrame = new PropFormFrame(view, NULL, "Property Form Test", wxPoint(-1, -1), wxSize(280, 250)); - propFrame->Initialize(); - m_childWindow = propFrame; - } - - wxPanel *panel = propDialog ? propDialog : propFrame->GetPropertyPanel(); - panel->SetLabelPosition(wxVERTICAL); - - // Add items to the panel - - (void) new wxButton(panel, -1, "OK", -1, -1, -1, -1, 0, "ok"); - (void) new wxButton(panel, -1, "Cancel", -1, -1, 80, -1, 0, "cancel"); - (void) new wxButton(panel, -1, "Update", -1, -1, 80, -1, 0, "update"); - (void) new wxButton(panel, -1, "Revert", -1, -1, -1, -1, 0, "revert"); - panel->NewLine(); - - // The name of this text item matches the "fred" property - (void) new wxText(panel, -1, "Fred", "", -1, -1, 90, -1, 0, "fred"); - (void) new wxCheckBox(panel, -1, "Yes or no", -1, -1, -1, -1, 0, "tough choice"); - (void) new wxSlider(panel, -1, "Scale", 0, -50, 50, 150, -1, -1, wxHORIZONTAL, "ian"); - panel->NewLine(); - (void) new wxListBox(panel, -1, "Constrained", wxSINGLE, -1, -1, 100, 90, 0, NULL, 0, "constrained"); - - view->AddRegistry(&myFormValidatorRegistry); - - if (useDialog) - { - view->ShowView(sheet, propDialog); - view->AssociateNames(); - view->TransferToDialog(); - propDialog->Centre(wxBOTH); - propDialog->Show(TRUE); - } - else - { - view->ShowView(sheet, propFrame->GetPropertyPanel()); - view->AssociateNames(); - view->TransferToDialog(); - propFrame->Centre(wxBOTH); - propFrame->Show(TRUE); - } -#endif -} - -BEGIN_EVENT_TABLE(PropListFrame, wxPropertyListFrame) - EVT_CLOSE(PropListFrame::OnCloseWindow) -END_EVENT_TABLE() - -void PropListFrame::OnCloseWindow(wxCloseEvent& event) -{ - wxGetApp().m_childWindow = NULL; - - wxPropertyListFrame::OnCloseWindow(event); -} - -BEGIN_EVENT_TABLE(PropListDialog, wxPropertyListDialog) - EVT_CLOSE(PropListDialog::OnCloseWindow) -END_EVENT_TABLE() - -void PropListDialog::OnCloseWindow(wxCloseEvent& event) -{ - wxGetApp().m_childWindow = NULL; - - wxPropertyListDialog::OnCloseWindow(event); -} - -BEGIN_EVENT_TABLE(PropFormFrame, wxPropertyFormFrame) - EVT_CLOSE(PropFormFrame::OnCloseWindow) -END_EVENT_TABLE() - -void PropFormFrame::OnCloseWindow(wxCloseEvent& event) -{ - wxGetApp().m_childWindow = NULL; - - wxPropertyFormFrame::OnCloseWindow(event); -} - -BEGIN_EVENT_TABLE(PropFormDialog, wxPropertyFormDialog) - EVT_CLOSE(PropFormDialog::OnCloseWindow) -END_EVENT_TABLE() - -void PropFormDialog::OnCloseWindow(wxCloseEvent& event) -{ - wxGetApp().m_childWindow = NULL; - - wxPropertyFormDialog::OnCloseWindow(event); -} - diff --git a/utils/wxprop/src/test.def b/utils/wxprop/src/test.def deleted file mode 100644 index d94e329083..0000000000 --- a/utils/wxprop/src/test.def +++ /dev/null @@ -1,8 +0,0 @@ -NAME TEST -DESCRIPTION 'wxProperty test' -EXETYPE WINDOWS -STUB 'WINSTUB.EXE' -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD MOVEABLE MULTIPLE -HEAPSIZE 1024 -STACKSIZE 8192 diff --git a/utils/wxprop/src/test.h b/utils/wxprop/src/test.h deleted file mode 100644 index 3e8bd88df0..0000000000 --- a/utils/wxprop/src/test.h +++ /dev/null @@ -1,127 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: test.h -// Purpose: Property sheet sample -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows license -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma interface "test.h" -#endif - -#ifndef _PROPTEST_H_ -#define _PROPTEST_H_ - -#include "proplist.h" -#include "propform.h" - -class MyChild; - -// Define a new application -class MyFrame; -class MyApp: public wxApp -{ -public: - MyApp(void); - bool OnInit(void); - - void RegisterValidators(void); - void PropertyListTest(bool useDialog); - void PropertyFormTest(bool useDialog); - - MyFrame* m_mainFrame; - wxWindow* m_childWindow; -}; - -DECLARE_APP(MyApp) - -// Define a new frame -class MyFrame: public wxFrame -{ - public: - MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long type); - - void OnCloseWindow(wxCloseEvent& event); - void OnQuit(wxCommandEvent& event); - void OnDialogList(wxCommandEvent& event); - void OnFrameList(wxCommandEvent& event); - void OnDialogForm(wxCommandEvent& event); - void OnFrameForm(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); - -DECLARE_EVENT_TABLE() -}; - -class PropListFrame: public wxPropertyListFrame -{ -public: - PropListFrame(wxPropertyListView *v, wxFrame *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME, const wxString& name = "frame"): - wxPropertyListFrame(v, parent, title, pos, size, style, name) - { - } - - void OnCloseWindow(wxCloseEvent& event); - - DECLARE_EVENT_TABLE() -}; - -class PropListDialog: public wxPropertyListDialog -{ -public: - PropListDialog(wxPropertyListView *v, wxWindow *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"): - wxPropertyListDialog(v, parent, title, pos, size, style, name) - { - } - - void OnCloseWindow(wxCloseEvent& event); - - DECLARE_EVENT_TABLE() -}; - -class PropFormFrame: public wxPropertyFormFrame -{ -public: - PropFormFrame(wxPropertyFormView *v, wxFrame *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_FRAME, const wxString& name = "frame"): - wxPropertyFormFrame(v, parent, title, pos, size, style, name) - { - } - - void OnCloseWindow(wxCloseEvent& event); - - DECLARE_EVENT_TABLE() -}; - -class PropFormDialog: public wxPropertyFormDialog -{ -public: - PropFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title, - const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = "dialogBox"): - wxPropertyFormDialog(v, parent, title, pos, size, style, name) - { - } - - void OnCloseWindow(wxCloseEvent& event); - - DECLARE_EVENT_TABLE() -}; - -#define PROPERTY_QUIT 1 -#define PROPERTY_ABOUT 2 -#define PROPERTY_TEST_DIALOG_LIST 3 -#define PROPERTY_TEST_FRAME_LIST 4 -#define PROPERTY_TEST_DIALOG_FORM 5 -#define PROPERTY_TEST_FRAME_FORM 6 - -#endif - diff --git a/utils/wxprop/src/test.rc b/utils/wxprop/src/test.rc deleted file mode 100644 index 80e490e9f1..0000000000 --- a/utils/wxprop/src/test.rc +++ /dev/null @@ -1,8 +0,0 @@ -wxSTD_MDIPARENTFRAME ICON "aiai.ico" -aiai_icn ICON "aiai.ico" - -tick_bmp BITMAP "tick.bmp" -cross_bmp BITMAP "cross.bmp" - -#include "wx/msw/wx.rc" - diff --git a/utils/wxprop/src/tick.bmp b/utils/wxprop/src/tick.bmp deleted file mode 100644 index 3673eda5de..0000000000 Binary files a/utils/wxprop/src/tick.bmp and /dev/null differ 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 764b5fd123..0000000000 --- a/utils/wxtree/src/makefile.b32 +++ /dev/null @@ -1,71 +0,0 @@ -# -# File: makefile.b32 -# Author: Patrick Halke -# Created: 1995 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds 32bit wxtree library for 32-bit BC++ - -WXDIR = $(WXWIN) -!include $(WXDIR)\src\makeb32.env - -WXINC = $(WXDIR)\include -TARGET=test -TESTOBJECTS=test.obj -LIBTARGET= $(WXLIBDIR)\wxprop.lib -LIBS=$(WXLIB)\wx32.lib $(LIBTARGET) cw32 import32 - -!ifndef DEBUG -DEBUG=0 -!endif - -!if "$(FINAL)" == "0" -LINKFLAGS=/v /Tpe /L$(WXLIBDIR);$(BCCDIR)\lib -OPT = -Od -DEBUG_FLAGS= -v -DDEBUG=$(DEBUG) -!else -LINKFLAGS=/Tpe /L$(WXLIBDIR);$(BCCDIR)\lib -OPT = -O2 -DEBUG_FLAGS = -DDEBUG=$(DEBUG) -!endif - -CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) - -.$(SRCSUFF).obj: - bcc32 $(CPPFLAGS) -c {$< } - -.c.obj: - bcc32 $(CPPFLAGS) -P- -c {$< } - -OBJECTS = wxtree.obj - -all: $(LIBTARGET) - -$(LIBTARGET): $(OBJECTS) - erase $(LIBTARGET) - tlib $(LIBTARGET) /P32 @&&! -+$(OBJECTS:.obj =.obj +) -! - -wxtree.obj: wxtree.$(SRCSUFF) wxtree.h - -$(TARGET).exe: $(TESTOBJECTS) $(LIBTARGET) $(TARGET).def $(TARGET).res - tlink32 $(LINKFLAGS) @&&! -c0w32.obj $(TESTOBJECTS) -$(TARGET) -nul -$(LIBS) $(LIBTARGET) -$(TARGET).def -! - brc32 -K $(TARGET).res - -test.obj: test.$(SRCSUFF) test.h - -$(TARGET).res : $(TARGET).rc $(WXDIR)\include\wx\msw\wx.rc - brc32 -r /i$(BCCDIR)\include /i$(WXDIR)\include $(TARGET) - -clean: - -erase *.obj $(LIBTARGET) *.exe *.res *.map *.rws diff --git a/utils/wxtree/src/makefile.bcc b/utils/wxtree/src/makefile.bcc deleted file mode 100644 index df91939532..0000000000 --- a/utils/wxtree/src/makefile.bcc +++ /dev/null @@ -1,96 +0,0 @@ -# -# File: makefile.bcc -# Author: Julian Smart -# Created: 1993 -# Updated: -# Copyright: (c) 1993, AIAI, University of Edinburgh -# -# "%W% %G%" -# -# Makefile : Builds tree library and example (DOS). - -!if "$(BCCDIR)" == "" -!error You must define the BCCDIR variable in autoexec.bat, e.g. BCCDIR=d:\bc4 -!endif - -!if "$(WXWIN)" == "" -!error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx -!endif - -# Change WXDIR to wherever wxWindows is found -WXDIR = $(WXWIN) -!include $(WXDIR)\src\makebcc.env - -WXLIB = $(WXDIR)\lib\wx.lib -WXINC = $(WXDIR)\include -CFG=$(WXWIN)\src\wxwin.cfg - -TREEDIR = $(WXDIR)\utils\wxtree -TREELIB = $(TREEDIR)\lib\wxtree.lib - -WXHELPDIR = $(WXDIR)\utils\wxhelp -TEX2RTFDIR = $(WXDIR)\utils\tex2rtf -DOCDIR = $(WXHELPDIR)\docs - -# Default is to output RTF for WinHelp -!ifndef WINHELP -WINHELP=-winhelp -!endif - -INC=/I$(WXDIR)\include\base /I$(WXDIR)\include\msw - -LIBS=$(WXLIB) $(TREELIB) mathwl cwl import mathwl - -!ifndef FINAL -FINAL=0 -!endif - -!if "$(FINAL)" == "0" -LINKFLAGS=/v/Vt /Twe /L$(WXDIR)\lib;$(BCCDIR)\lib -OPT = -Od -DEBUG_FLAGS= -v -!else -LINKFLAGS=/Twe /L$(WXDIR)\lib;$(BCCDIR)\lib -OPT = -O2 -DEBUG_FLAGS= -!endif -CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) -CFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG) - -HEADERS = wxtree.h -SOURCES = wxtree.$(SRCSUFF) -OBJECTS = wxtree.obj - -all: $(TREELIB) - -.$(SRCSUFF).obj: - bcc $(CPPFLAGS) $(INC) -c {$< } - -$(TREELIB): $(OBJECTS) - erase $(TREELIB) - tlib /P128 @&&! -$(TREELIB) & -+$(OBJECTS:.obj =.obj +) -! - -test.obj: test.$(SRCSUFF) - -test.res : test.rc $(WXDIR)\include\msw\wx.rc - rc /i$(BCCDIR)\include /i$(WXDIR)\include\msw /i$(WXDIR)\contrib\fafa -r test - -test.exe: test.obj test.def test.res $(TREELIB) - tlink $(LINKFLAGS) @&&! -c0wl.obj test.obj -test -nul -$(LIBS) -test.def -! - rc -K test.res - -clean: - -erase *.obj - -erase *.exe - -erase *.res - -erase ..\lib\*.lib - 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 a7b7f866c1..0000000000 --- a/utils/wxtree/src/makefile.g95 +++ /dev/null @@ -1,48 +0,0 @@ -# -# File: makefile.g95 -# Author: Julian Smart -# Created: 1996 -# -# "%W% %G%" -# -# Makefile : Builds wxTree library and example under GNU-WIN32 -# -WXDIR = ../../.. -include $(WXDIR)/src/makeg95.env - -PROPDIR = $(WXDIR)/utils/wxtree -TREELIB = $(PROPDIR)/lib/$(LIBPREFIX)wxtree.$(LIBSUFF) -THISDIR = $(PROPDIR)/src - -OBJECTS = $(OBJDIR)/wxtree.$(OBJSUFF) -TESTOBJECTS = $(OBJDIR)/test.$(OBJSUFF) $(OBJDIR)/test_resources.$(OBJSUFF) - -LDFLAGS = -Wl,--subsystem,windows -mwindows -L$(WXDIR)/lib -L../lib -LDLIBS=-lwxtree $(LIBS) - -all: $(OBJDIR) $(TREELIB) - -test: $(OBJDIR) test.exe - -$(OBJDIR): - mkdir $(OBJDIR) - -$(TREELIB): $(OBJECTS) - rm -f $@ - ar $(AROPTIONS) $@ $(OBJECTS) - $(RANLIB) $@ - -$(OBJDIR)/test.$(OBJSUFF): test.h test.$(SRCSUFF) $(TREELIB) - $(CC) -c $(CPPFLAGS) -o $@ test.$(SRCSUFF) - -test.exe: $(TESTOBJECTS) - $(CC) $(LDFLAGS) -o test$(GUISUFFIX)$(EXESUFF) $(TESTOBJECTS) $(LDLIBS) - -$(OBJDIR)/wxtree.$(OBJSUFF): wxtree.h wxtree.$(SRCSUFF) - $(CC) -c $(CPPFLAGS) -o $@ wxtree.$(SRCSUFF) - -$(OBJDIR)/test_resources.o: test.rc - $(RESCOMP) -i test.rc -o $(OBJDIR)/test_resources.o $(RESFLAGS) - -clean: - rm -f *.$(OBJSUFF) $(TREELIB) objects/test.o *.exe *.res *.map *.rsc diff --git a/utils/wxtree/src/makefile.nt b/utils/wxtree/src/makefile.nt deleted file mode 100644 index 5e815db012..0000000000 --- a/utils/wxtree/src/makefile.nt +++ /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=$(TREEDIR)\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=$(TREEDIR)\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.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.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 7fa625668f..0000000000 --- a/utils/wxtree/src/test.cpp +++ /dev/null @@ -1,200 +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) -{ -} - -// 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 70d3be26c0..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 id) 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_ -