From 7c9955d147ed92cdd79d795ed94d6e03fca06a52 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Mon, 31 Mar 2003 10:24:36 +0000 Subject: [PATCH] More deprecated class mods git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19900 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/deprecated/resource.h | 4 +- contrib/include/wx/ogl/ogldiag.h | 6 + contrib/samples/animate/makefile.vc | 6 +- contrib/samples/deprecated/proplist/Makefile.in | 3 + contrib/samples/deprecated/proplist/makefile.b32 | 1 + contrib/samples/deprecated/proplist/makefile.g95 | 2 + contrib/samples/deprecated/proplist/makefile.vc | 6 + contrib/samples/deprecated/proplist/proplist.cpp | 3 +- contrib/samples/deprecated/resource/Makefile.in | 5 +- contrib/samples/deprecated/resource/makefile.b32 | 1 + contrib/samples/deprecated/resource/makefile.g95 | 2 + contrib/samples/deprecated/resource/makefile.vc | 7 +- contrib/samples/deprecated/resource/resource.cpp | 6 +- contrib/samples/deprecated/treelay/Makefile.in | 5 +- contrib/samples/deprecated/treelay/makefile.b32 | 1 + contrib/samples/deprecated/treelay/makefile.g95 | 2 + contrib/samples/deprecated/treelay/makefile.vc | 6 + contrib/samples/deprecated/treelay/treelay.cpp | 8 +- contrib/samples/ogl/ogledit/doc.cpp | 1 - contrib/samples/ogl/ogledit/doc.h | 3 +- contrib/samples/ogl/ogledit/makefile.vc | 4 +- contrib/samples/ogl/studio/csprint.cpp | 4 +- contrib/samples/ogl/studio/dialogs.cpp | 15 +- contrib/samples/ogl/studio/doc.cpp | 2 - contrib/samples/ogl/studio/doc.h | 4 +- contrib/samples/ogl/studio/makefile.vc | 4 +- contrib/samples/ogl/studio/shapes.cpp | 3 +- contrib/samples/ogl/studio/shapes.h | 3 +- contrib/samples/ogl/studio/studio.cpp | 3 +- contrib/samples/ogl/studio/symbols.cpp | 3 +- contrib/src/deprecated/Makefile.in | 4 +- contrib/src/deprecated/makefile.b32 | 2 +- contrib/src/deprecated/makefile.g95 | 2 +- contrib/src/deprecated/makefile.vc | 2 +- contrib/src/ogl/basic.cpp | 44 +- contrib/src/ogl/basic2.cpp | 2 +- contrib/src/ogl/bmpshape.cpp | 2 +- contrib/src/ogl/canvas.cpp | 2 +- contrib/src/ogl/composit.cpp | 20 +- contrib/src/ogl/constrnt.cpp | 2 +- contrib/src/ogl/divided.cpp | 2 +- contrib/src/ogl/drawn.cpp | 96 +- contrib/src/ogl/lines.cpp | 18 +- contrib/src/ogl/misc.cpp | 2 +- contrib/src/ogl/ogldiag.cpp | 6 +- contrib/src/ogl/oglmisc.cpp | 2 +- contrib/utils/convertrc/Makefile.in | 3 + contrib/utils/convertrc/convert.cpp | 21 +- contrib/utils/convertrc/makefile.b32 | 2 +- contrib/utils/convertrc/makefile.g95 | 3 +- contrib/utils/convertrc/makefile.vc | 4 +- contrib/utils/convertrc/makefile.wat | 2 +- contrib/utils/convertrc/rc2wxr.cpp | 41 +- contrib/utils/convertrc/rc2xml.cpp | 87 +- contrib/utils/convertrc/wxr2xml.h | 9 +- demos/dbbrowse/std.h | 1 - distrib/msw/cw.rsp | 8 +- distrib/msw/cw_mac.rsp | 16 +- distrib/msw/generic.rsp | 34 - distrib/msw/makefile.rsp | 8 +- distrib/msw/tardist | 12 +- distrib/msw/tarwxall | 2 +- distrib/msw/tarwxmac | 2 +- distrib/msw/tarwxx11 | 2 +- distrib/msw/vc.rsp | 21 +- distrib/msw/zipdistinno.bat | 3 + docs/html/index.htm | 12 +- include/wx/expr.h | 68 - include/wx/resource.h | 208 -- include/wx/treelay.h | 7 - include/wx/wxexpr.h | 283 -- samples/configure | 3 - samples/configure.in | 3 - samples/dnd/dnd.cpp | 50 +- samples/makefile.b32 | 12 - samples/makefile.dos | 8 - samples/makefile.g95 | 3 - samples/makefile.vc | 8 - samples/nativdlg/nativdlg.cpp | 2 - samples/samples.dsw | 36 - src/common/cwlex_yy.c | 1214 -------- src/common/cwy_tab.c | 547 ---- src/common/doslex.c | 1276 --------- src/common/dosyacc.c | 540 ---- src/common/lexer.l | 192 -- src/common/parser.y | 184 -- src/common/resourc2.cpp | 1573 ----------- src/common/resource.cpp | 3263 ---------------------- src/common/wxexpr.cpp | 1278 --------- src/generic/treelay.cpp | 471 ---- src/gtk/app.cpp | 13 - src/gtk1/app.cpp | 13 - src/mac/app.cpp | 100 +- src/mac/carbon/app.cpp | 100 +- src/mgl/app.cpp | 33 +- src/motif/app.cpp | 12 - src/msw/app.cpp | 16 +- src/os2/app.cpp | 12 - src/os2/cursor.cpp | 1 - src/x11/app.cpp | 30 +- utils/dialoged/src/DialogEdVC.dsp | 8 +- utils/dialoged/src/makefile.vc | 7 + utils/projgen/makeproj.cpp | 3 +- 103 files changed, 466 insertions(+), 11735 deletions(-) delete mode 100644 include/wx/expr.h delete mode 100644 include/wx/resource.h delete mode 100644 include/wx/treelay.h delete mode 100644 include/wx/wxexpr.h delete mode 100644 src/common/cwlex_yy.c delete mode 100644 src/common/cwy_tab.c delete mode 100644 src/common/doslex.c delete mode 100644 src/common/dosyacc.c delete mode 100644 src/common/lexer.l delete mode 100644 src/common/parser.y delete mode 100644 src/common/resourc2.cpp delete mode 100644 src/common/resource.cpp delete mode 100644 src/common/wxexpr.cpp delete mode 100644 src/generic/treelay.cpp diff --git a/contrib/include/wx/deprecated/resource.h b/contrib/include/wx/deprecated/resource.h index 8b77491..ea71779 100644 --- a/contrib/include/wx/deprecated/resource.h +++ b/contrib/include/wx/deprecated/resource.h @@ -202,10 +202,10 @@ WXDLLEXPORT extern bool wxResourceAddIdentifier(const wxString& name, int value, WXDLLEXPORT extern int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table = (wxResourceTable *) NULL); // Used to be wxWindowBase::LoadFromResource -bool wxLoadFromResource(wxWindow* thisWindow, wxWindow *parent, const wxString& resourceName, const wxResourceTable *table); +bool wxLoadFromResource(wxWindow* thisWindow, wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = (const wxResourceTable *) NULL); // Used to be wxWindowBase::CreateItem -wxControl *wxCreateItem(wxWindow* thisWindow, const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table); +wxControl *wxCreateItem(wxWindow* thisWindow, const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table = (const wxResourceTable *) NULL); #if defined(__WXPM__) #include "wx/os2/wxrsc.h" diff --git a/contrib/include/wx/ogl/ogldiag.h b/contrib/include/wx/ogl/ogldiag.h index 540c224..83d292f 100644 --- a/contrib/include/wx/ogl/ogldiag.h +++ b/contrib/include/wx/ogl/ogldiag.h @@ -16,6 +16,12 @@ #pragma interface "ogldiag.h" #endif +#include + +#if wxUSE_PROLOGIO +#include +#endif + #include class wxDiagram: public wxObject diff --git a/contrib/samples/animate/makefile.vc b/contrib/samples/animate/makefile.vc index 483d823..aadb452 100644 --- a/contrib/samples/animate/makefile.vc +++ b/contrib/samples/animate/makefile.vc @@ -2,7 +2,11 @@ WXDIR = $(WXWIN) PROGRAM = anitest OBJECTS = $(PROGRAM).obj -EXTRALIBS = $(WXDIR)\lib\anim$(LIBEXT).lib +!if "$(FINAL)" == "0" +EXTRALIBS=$(WXDIR)\lib\animd.lib +!else +EXTRALIBS=$(WXDIR)\lib\anim.lib +!endif EXTRAINC = -I$(WXDIR)\contrib\include !include $(WXDIR)\src\makeprog.vc diff --git a/contrib/samples/deprecated/proplist/Makefile.in b/contrib/samples/deprecated/proplist/Makefile.in index 17a47fa..38ed5aa 100644 --- a/contrib/samples/deprecated/proplist/Makefile.in +++ b/contrib/samples/deprecated/proplist/Makefile.in @@ -10,6 +10,9 @@ PROGRAM=proplist OBJECTS =$(PROGRAM).o DEPFILES=$(PROGRAM).d +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_wxdeprecated-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRADEFS=-I$(top_srcdir)/contrib/include + include ../../../../src/makeprog.env @IF_GNU_MAKE@-include $(DEPFILES) diff --git a/contrib/samples/deprecated/proplist/makefile.b32 b/contrib/samples/deprecated/proplist/makefile.b32 index 9e35c97..e3d9fb1 100644 --- a/contrib/samples/deprecated/proplist/makefile.b32 +++ b/contrib/samples/deprecated/proplist/makefile.b32 @@ -4,6 +4,7 @@ WXDIR = $(WXWIN) TARGET=proplist +EXTRALIBS=$(WXDIR)\lib\wxdeprecated.lib OBJECTS = $(TARGET).obj !include $(WXDIR)\src\makeprog.b32 diff --git a/contrib/samples/deprecated/proplist/makefile.g95 b/contrib/samples/deprecated/proplist/makefile.g95 index ba4b3e9..ca71a81 100644 --- a/contrib/samples/deprecated/proplist/makefile.g95 +++ b/contrib/samples/deprecated/proplist/makefile.g95 @@ -5,6 +5,8 @@ WXDIR = ../../../.. TARGET=proplist OBJECTS = $(TARGET).o +EXTRAINC = -I$(WXDIR)/contrib/include +EXTRALIBS = -lwxdeprecated include $(WXDIR)/src/makeprog.g95 diff --git a/contrib/samples/deprecated/proplist/makefile.vc b/contrib/samples/deprecated/proplist/makefile.vc index 4cb4243..9c15bc5 100644 --- a/contrib/samples/deprecated/proplist/makefile.vc +++ b/contrib/samples/deprecated/proplist/makefile.vc @@ -5,6 +5,12 @@ WXDIR = $(WXWIN) PROGRAM=proplist +FINAL=0 +!if "$(FINAL)" == "0" +EXTRALIBS=$(WXDIR)\lib\wxdeprecatedd.lib +!else +EXTRALIBS=$(WXDIR)\lib\wxdeprecated.lib +!endif OBJECTS = $(PROGRAM).obj !include $(WXDIR)\src\makeprog.vc diff --git a/contrib/samples/deprecated/proplist/proplist.cpp b/contrib/samples/deprecated/proplist/proplist.cpp index 8c04d7d..bb962d5 100644 --- a/contrib/samples/deprecated/proplist/proplist.cpp +++ b/contrib/samples/deprecated/proplist/proplist.cpp @@ -24,9 +24,10 @@ #include "wx/wx.h" #endif +#include "wx/deprecated/setup.h" #if !wxUSE_PROPSHEET -#error Please set wxUSE_PROPSHEET to 1 in include/wx/msw/setup.h and recompile. +#error Please set wxUSE_PROPSHEET to 1 in contrib/include/wx/deprecated/setup.h and recompile. #endif #include "proplist.h" diff --git a/contrib/samples/deprecated/resource/Makefile.in b/contrib/samples/deprecated/resource/Makefile.in index 5b55ea3..9f8dd6f 100644 --- a/contrib/samples/deprecated/resource/Makefile.in +++ b/contrib/samples/deprecated/resource/Makefile.in @@ -11,13 +11,16 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../../.. -program_dir = samples/resource +program_dir = contrib/samples/deprecated/resource PROGRAM=resource OBJECTS =$(PROGRAM).o DEPFILES=$(PROGRAM).d +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_wxdeprecated-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRADEFS=-I$(top_srcdir)/contrib/include + include ../../../../src/makeprog.env @IF_GNU_MAKE@-include $(DEPFILES) diff --git a/contrib/samples/deprecated/resource/makefile.b32 b/contrib/samples/deprecated/resource/makefile.b32 index dc944a8..4ae1e90 100644 --- a/contrib/samples/deprecated/resource/makefile.b32 +++ b/contrib/samples/deprecated/resource/makefile.b32 @@ -10,6 +10,7 @@ WXDIR = $(WXWIN) TARGET=resource +EXTRALIBS=$(WXDIR)\lib\wxdeprecated.lib OBJECTS = $(TARGET).obj !include $(WXDIR)\src\makeprog.b32 diff --git a/contrib/samples/deprecated/resource/makefile.g95 b/contrib/samples/deprecated/resource/makefile.g95 index f4c2809..8a54497 100644 --- a/contrib/samples/deprecated/resource/makefile.g95 +++ b/contrib/samples/deprecated/resource/makefile.g95 @@ -11,6 +11,8 @@ WXDIR = ../../../.. TARGET=resource OBJECTS = $(TARGET).o +EXTRAINC = -I$(WXDIR)/contrib/include +EXTRALIBS = -lwxdeprecated include $(WXDIR)/src/makeprog.g95 diff --git a/contrib/samples/deprecated/resource/makefile.vc b/contrib/samples/deprecated/resource/makefile.vc index 103fa7f..de44d1c 100644 --- a/contrib/samples/deprecated/resource/makefile.vc +++ b/contrib/samples/deprecated/resource/makefile.vc @@ -10,8 +10,13 @@ # Set WXDIR for your system WXDIR = $(WXWIN) - +FINAL=0 PROGRAM=resource +!if "$(FINAL)" == "0" +EXTRALIBS=$(WXDIR)\lib\wxdeprecatedd.lib +!else +EXTRALIBS=$(WXDIR)\lib\wxdeprecated.lib +!endif OBJECTS = $(PROGRAM).obj !include $(WXDIR)\src\makeprog.vc diff --git a/contrib/samples/deprecated/resource/resource.cpp b/contrib/samples/deprecated/resource/resource.cpp index 4045cf9..8553ccb 100644 --- a/contrib/samples/deprecated/resource/resource.cpp +++ b/contrib/samples/deprecated/resource/resource.cpp @@ -24,6 +24,8 @@ #include "wx/wx.h" #endif +#include "wx/deprecated/setup.h" + #if !wxUSE_RESOURCES #error "You should set wxUSE_RESOURCES to 1 to compile this sample" #endif @@ -32,7 +34,7 @@ // #error "This sample can't be compiled in Unicode mode." #endif // wxUSE_UNICODE -#include "wx/resource.h" +#include "wx/deprecated/resource.h" #include #include "resource.h" @@ -184,7 +186,7 @@ void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) ) { MyDialog *dialog = new MyDialog; - if (dialog->LoadFromResource(this, wxT("dialog1"))) + if (wxLoadFromResource(dialog, this, wxT("dialog1"))) { wxTextCtrl *text = (wxTextCtrl *)wxFindWindowByName(wxT("multitext3"), dialog); if (text) diff --git a/contrib/samples/deprecated/treelay/Makefile.in b/contrib/samples/deprecated/treelay/Makefile.in index 25d8ff2..903f70a 100644 --- a/contrib/samples/deprecated/treelay/Makefile.in +++ b/contrib/samples/deprecated/treelay/Makefile.in @@ -3,7 +3,7 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../../.. -program_dir = samples/treelay +program_dir = contrib/samples/deprecated/treelay PROGRAM=treelay @@ -12,4 +12,7 @@ DEPFILES=$(PROGRAM).d include ../../../../src/makeprog.env +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_wxdeprecated-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRADEFS=-I$(top_srcdir)/contrib/include + @IF_GNU_MAKE@-include $(DEPFILES) diff --git a/contrib/samples/deprecated/treelay/makefile.b32 b/contrib/samples/deprecated/treelay/makefile.b32 index 81050de..17de6a4 100644 --- a/contrib/samples/deprecated/treelay/makefile.b32 +++ b/contrib/samples/deprecated/treelay/makefile.b32 @@ -4,6 +4,7 @@ WXDIR = $(WXWIN) TARGET=treelay +EXTRALIBS=$(WXDIR)\lib\wxdeprecated.lib OBJECTS = $(TARGET).obj !include $(WXDIR)\src\makeprog.b32 diff --git a/contrib/samples/deprecated/treelay/makefile.g95 b/contrib/samples/deprecated/treelay/makefile.g95 index 6c44e2f..9dc09fe 100644 --- a/contrib/samples/deprecated/treelay/makefile.g95 +++ b/contrib/samples/deprecated/treelay/makefile.g95 @@ -5,6 +5,8 @@ WXDIR = ../../../.. TARGET=treelay OBJECTS = $(TARGET).o +EXTRAINC = -I$(WXDIR)/contrib/include +EXTRALIBS = -lwxdeprecated include $(WXDIR)/src/makeprog.g95 diff --git a/contrib/samples/deprecated/treelay/makefile.vc b/contrib/samples/deprecated/treelay/makefile.vc index 4f55234..d95cf20 100644 --- a/contrib/samples/deprecated/treelay/makefile.vc +++ b/contrib/samples/deprecated/treelay/makefile.vc @@ -5,6 +5,12 @@ WXDIR = $(WXWIN) PROGRAM=treelay +FINAL=0 +!if "$(FINAL)" == "0" +EXTRALIBS=$(WXDIR)\lib\wxdeprecatedd.lib +!else +EXTRALIBS=$(WXDIR)\lib\wxdeprecated.lib +!endif OBJECTS = $(PROGRAM).obj !include $(WXDIR)\src\makeprog.vc diff --git a/contrib/samples/deprecated/treelay/treelay.cpp b/contrib/samples/deprecated/treelay/treelay.cpp index 9b1df20..43d9c98 100644 --- a/contrib/samples/deprecated/treelay/treelay.cpp +++ b/contrib/samples/deprecated/treelay/treelay.cpp @@ -20,7 +20,13 @@ #include "wx/wx.h" #endif -#include "wx/treelay.h" +#include "wx/deprecated/setup.h" + +#if !wxUSE_TREELAYOUT +#error Please set wxUSE_TREELAYOUT to 1 in contrib/include/wx/deprecated/setup.h and recompile. +#endif + +#include "wx/deprecated/treelay.h" #include "treelay.h" diff --git a/contrib/samples/ogl/ogledit/doc.cpp b/contrib/samples/ogl/ogledit/doc.cpp index 017f34f..6f467fc 100644 --- a/contrib/samples/ogl/ogledit/doc.cpp +++ b/contrib/samples/ogl/ogledit/doc.cpp @@ -28,7 +28,6 @@ #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h! #endif -#include #include "ogledit.h" #include "doc.h" #include "view.h" diff --git a/contrib/samples/ogl/ogledit/doc.h b/contrib/samples/ogl/ogledit/doc.h index 6817c6d..17432e9 100644 --- a/contrib/samples/ogl/ogledit/doc.h +++ b/contrib/samples/ogl/ogledit/doc.h @@ -19,8 +19,9 @@ #include #include #include -#include +#include +#include #include #if wxUSE_STD_IOSTREAM diff --git a/contrib/samples/ogl/ogledit/makefile.vc b/contrib/samples/ogl/ogledit/makefile.vc index 194a12d..88a2f7b 100644 --- a/contrib/samples/ogl/ogledit/makefile.vc +++ b/contrib/samples/ogl/ogledit/makefile.vc @@ -18,9 +18,9 @@ PROGRAM=ogledit FINAL=0 !if "$(FINAL)" == "0" -EXTRALIBS=$(WXDIR)\lib\ogld.lib +EXTRALIBS=$(WXDIR)\lib\ogld.lib $(WXDIR)\lib\wxdeprecatedd.lib !else -EXTRALIBS=$(WXDIR)\lib\ogl.lib +EXTRALIBS=$(WXDIR)\lib\ogl.lib $(WXDIR)\lib\wxdeprecated.lib !endif OBJECTS = $(PROGRAM).obj doc.obj view.obj palette.obj diff --git a/contrib/samples/ogl/studio/csprint.cpp b/contrib/samples/ogl/studio/csprint.cpp index 3b2b149..f3f65e8 100644 --- a/contrib/samples/ogl/studio/csprint.cpp +++ b/contrib/samples/ogl/studio/csprint.cpp @@ -24,7 +24,9 @@ #include #endif -#include +#include +#include + #include #ifdef __WXMSW__ diff --git a/contrib/samples/ogl/studio/dialogs.cpp b/contrib/samples/ogl/studio/dialogs.cpp index 62b0ca2..be54a49 100644 --- a/contrib/samples/ogl/studio/dialogs.cpp +++ b/contrib/samples/ogl/studio/dialogs.cpp @@ -24,7 +24,8 @@ #include #endif -#include +#include +#include #include "dialogs.h" #include "doc.h" #include "view.h" @@ -39,7 +40,7 @@ END_EVENT_TABLE() csLabelEditingDialog::csLabelEditingDialog(wxWindow* parent) { - LoadFromResource(parent, "shape_label_dialog"); + wxLoadFromResource(this, parent, "shape_label_dialog"); // Accelerators wxAcceleratorEntry entries[1]; @@ -99,13 +100,13 @@ csSettingsDialog::csSettingsDialog(wxWindow* parent): m_generalSettings = new wxPanel; - bool success = m_generalSettings->LoadFromResource(m_notebook, "general_settings_dialog"); + bool success = wxLoadFromResource(m_generalSettings, m_notebook, "general_settings_dialog"); wxASSERT_MSG( (success), "Could not load general settings panel."); m_notebook->AddPage(m_generalSettings, "General", TRUE); m_diagramSettings = new wxPanel; - success = m_diagramSettings->LoadFromResource(m_notebook, "diagram_settings_dialog"); + success = wxLoadFromResource(m_diagramSettings, m_notebook, "diagram_settings_dialog"); wxASSERT_MSG( (success), "Could not load diagram settings panel."); m_notebook->AddPage(m_diagramSettings, "Diagram"); @@ -258,11 +259,11 @@ csShapePropertiesDialog::csShapePropertiesDialog(wxWindow* parent, const wxStrin wxPoint(2, 2), wxSize(SHAPE_PROPERTY_DIALOG_WIDTH - 4, SHAPE_PROPERTY_DIALOG_HEIGHT - 4)); m_generalPropertiesDialog = new csGeneralShapePropertiesDialog; - bool success = m_generalPropertiesDialog->LoadFromResource(m_notebook, "general_shape_properties_dialog"); + bool success = wxLoadFromResource(m_generalPropertiesDialog, m_notebook, "general_shape_properties_dialog"); wxASSERT_MSG( (success), "Could not load general properties panel."); m_notebook->AddPage(m_generalPropertiesDialog, "General"); - success = m_attributeDialog->LoadFromResource(m_notebook, attributeDialogName); + success = wxLoadFromResource(m_attributeDialog, m_notebook, attributeDialogName); if (!success) { wxMessageBox("Could not load the attribute dialog for this shape.", "Studio", wxICON_EXCLAMATION); @@ -278,7 +279,7 @@ csShapePropertiesDialog::csShapePropertiesDialog(wxWindow* parent, const wxStrin wxString str(attributeDialogName); str += "1"; m_alternativeAttributeDialog = new wxPanel; - success = m_alternativeAttributeDialog->LoadFromResource(m_notebook, str); + success = wxLoadFromResource(m_alternativeAttributeDialog, m_notebook, str); if (success) { m_notebook->AddPage(m_alternativeAttributeDialog, "Attributes (alternative)"); diff --git a/contrib/samples/ogl/studio/doc.cpp b/contrib/samples/ogl/studio/doc.cpp index bfedc40..acd6c5b 100644 --- a/contrib/samples/ogl/studio/doc.cpp +++ b/contrib/samples/ogl/studio/doc.cpp @@ -24,8 +24,6 @@ #include #endif -#include - #include "studio.h" #include "doc.h" #include "view.h" diff --git a/contrib/samples/ogl/studio/doc.h b/contrib/samples/ogl/studio/doc.h index 502f227..e9aca18 100644 --- a/contrib/samples/ogl/studio/doc.h +++ b/contrib/samples/ogl/studio/doc.h @@ -19,7 +19,9 @@ #include #include #include -#include + +#include +#include #include #include "shapes.h" diff --git a/contrib/samples/ogl/studio/makefile.vc b/contrib/samples/ogl/studio/makefile.vc index 1c01f3a..d772710 100644 --- a/contrib/samples/ogl/studio/makefile.vc +++ b/contrib/samples/ogl/studio/makefile.vc @@ -18,9 +18,9 @@ PROGRAM=studio FINAL=0 !if "$(FINAL)" == "0" -EXTRALIBS=$(WXDIR)\lib\ogld.lib +EXTRALIBS=$(WXDIR)\lib\ogld.lib $(WXDIR)\lib\wxdeprecatedd.lib !else -EXTRALIBS=$(WXDIR)\lib\ogl.lib +EXTRALIBS=$(WXDIR)\lib\ogl.lib $(WXDIR)\lib\wxdeprecated.lib !endif OBJECTS = $(PROGRAM).obj doc.obj shapes.obj symbols.obj view.obj cspalette.obj\ diff --git a/contrib/samples/ogl/studio/shapes.cpp b/contrib/samples/ogl/studio/shapes.cpp index ded2eb7..55c28df 100644 --- a/contrib/samples/ogl/studio/shapes.cpp +++ b/contrib/samples/ogl/studio/shapes.cpp @@ -28,7 +28,8 @@ #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h! #endif -#include +#include +#include #include "studio.h" #include "doc.h" diff --git a/contrib/samples/ogl/studio/shapes.h b/contrib/samples/ogl/studio/shapes.h index 6a440cf..6238dce 100644 --- a/contrib/samples/ogl/studio/shapes.h +++ b/contrib/samples/ogl/studio/shapes.h @@ -18,7 +18,8 @@ #include #include -#include +#include +#include #include #include diff --git a/contrib/samples/ogl/studio/studio.cpp b/contrib/samples/ogl/studio/studio.cpp index 674b3af..ed6069c 100644 --- a/contrib/samples/ogl/studio/studio.cpp +++ b/contrib/samples/ogl/studio/studio.cpp @@ -21,7 +21,8 @@ #include "wx/mdi.h" #endif -#include "wx/resource.h" +#include +#include #include "wx/config.h" #include "wx/laywin.h" diff --git a/contrib/samples/ogl/studio/symbols.cpp b/contrib/samples/ogl/studio/symbols.cpp index d8a617e..2744355 100644 --- a/contrib/samples/ogl/studio/symbols.cpp +++ b/contrib/samples/ogl/studio/symbols.cpp @@ -24,7 +24,8 @@ #include #endif -#include +#include +#include #include "studio.h" #include "doc.h" diff --git a/contrib/src/deprecated/Makefile.in b/contrib/src/deprecated/Makefile.in index 7d53e9b..497a1b6 100644 --- a/contrib/src/deprecated/Makefile.in +++ b/contrib/src/deprecated/Makefile.in @@ -4,7 +4,7 @@ top_srcdir = @top_srcdir@/.. top_builddir = ../../.. libsrc_dir = contrib/src/deprecated -TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_deprecated-@WX_RELEASE@ +TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_wxdeprecated-@WX_RELEASE@ LIBVERSION_CURRENT=@WX_CURRENT@ LIBVERSION_REVISION=@WX_REVISION@ @@ -15,7 +15,7 @@ HEADER_SUBDIR=deprecated HEADERS=prop.h propform.h proplist.h resource.h treelay.h wxexpr.h treelay.h -OBJECTS=prop.o propform.o proplist.o wxexpr.o parser.o treelay.cpp +OBJECTS=prop.o propform.o proplist.o wxexpr.o parser.o resource.o treelay.o DEPFILES=$(OBJECTS:.o=.d) APPEXTRADEFS=-I$(top_srcdir)/contrib/include diff --git a/contrib/src/deprecated/makefile.b32 b/contrib/src/deprecated/makefile.b32 index 0e27265..1083ac8 100644 --- a/contrib/src/deprecated/makefile.b32 +++ b/contrib/src/deprecated/makefile.b32 @@ -11,7 +11,7 @@ WXDIR = $(WXWIN) LIBTARGET=$(WXDIR)\lib\wxdeprecated.lib -OBJECTS = prop.obj propform.obj proplist.obj y_tab.obj resource.obj treelay.obj +OBJECTS = prop.obj propform.obj proplist.obj y_tab.obj wxexpr.obj resource.obj treelay.obj !include $(WXDIR)\src\makelib.b32 diff --git a/contrib/src/deprecated/makefile.g95 b/contrib/src/deprecated/makefile.g95 index 2e69fe4..4147d59 100644 --- a/contrib/src/deprecated/makefile.g95 +++ b/contrib/src/deprecated/makefile.g95 @@ -10,7 +10,7 @@ WXDIR = ../../.. LIBTARGET=$(WXDIR)/lib/libwxdeprecated.a -OBJECTS = prop.o propform.o proplist.o y_tab.o resource.o treelay.o +OBJECTS = prop.o propform.o proplist.o y_tab.o wxexpr.o resource.o treelay.o include $(WXDIR)/src/makelib.g95 diff --git a/contrib/src/deprecated/makefile.vc b/contrib/src/deprecated/makefile.vc index e6ba785..9613f13 100644 --- a/contrib/src/deprecated/makefile.vc +++ b/contrib/src/deprecated/makefile.vc @@ -32,7 +32,7 @@ LIBEXT=d LIBTARGET=$(WXDIR)\lib\wxdeprecated$(LIBEXT).lib EXTRATARGETS=$(D) -OBJECTS=$(D)\prop.obj $(D)\propform.obj $(D)\proplist.obj $(D)\y_tab.obj $(D)\resource.obj $(D)\treelay.obj +OBJECTS=$(D)\prop.obj $(D)\propform.obj $(D)\proplist.obj $(D)\y_tab.obj $(D)\wxexpr.obj $(D)\resource.obj $(D)\treelay.obj !include $(WXDIR)\src\makelib.vc diff --git a/contrib/src/ogl/basic.cpp b/contrib/src/ogl/basic.cpp index 2b673af..563711d 100644 --- a/contrib/src/ogl/basic.cpp +++ b/contrib/src/ogl/basic.cpp @@ -24,7 +24,7 @@ #include #endif -#include +#include #ifdef new #undef new @@ -2040,9 +2040,9 @@ void wxShape::ReadAttributes(wxExpr *clause) wxExpr *pointExpr = attachmentList->GetFirst(); while (pointExpr) { - wxExpr *idExpr = pointExpr->Item(0); - wxExpr *xExpr = pointExpr->Item(1); - wxExpr *yExpr = pointExpr->Item(2); + wxExpr *idExpr = pointExpr->Nth(0); + wxExpr *xExpr = pointExpr->Nth(1); + wxExpr *yExpr = pointExpr->Nth(2); if (idExpr && xExpr && yExpr) { wxAttachmentPoint *point = new wxAttachmentPoint; @@ -2104,24 +2104,24 @@ void wxShape::ReadRegions(wxExpr *clause) if (regionExpr->Type() == wxExprList) { - wxExpr *nameExpr = regionExpr->Item(0); - wxExpr *textExpr = regionExpr->Item(1); - wxExpr *xExpr = regionExpr->Item(2); - wxExpr *yExpr = regionExpr->Item(3); - wxExpr *widthExpr = regionExpr->Item(4); - wxExpr *heightExpr = regionExpr->Item(5); - wxExpr *minWidthExpr = regionExpr->Item(6); - wxExpr *minHeightExpr = regionExpr->Item(7); - wxExpr *propXExpr = regionExpr->Item(8); - wxExpr *propYExpr = regionExpr->Item(9); - wxExpr *formatExpr = regionExpr->Item(10); - wxExpr *sizeExpr = regionExpr->Item(11); - wxExpr *familyExpr = regionExpr->Item(12); - wxExpr *styleExpr = regionExpr->Item(13); - wxExpr *weightExpr = regionExpr->Item(14); - wxExpr *colourExpr = regionExpr->Item(15); - wxExpr *penColourExpr = regionExpr->Item(16); - wxExpr *penStyleExpr = regionExpr->Item(17); + 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(); diff --git a/contrib/src/ogl/basic2.cpp b/contrib/src/ogl/basic2.cpp index 78f571e..c24bf7c 100644 --- a/contrib/src/ogl/basic2.cpp +++ b/contrib/src/ogl/basic2.cpp @@ -24,7 +24,7 @@ #include #endif -#include +#include #ifdef new #undef new diff --git a/contrib/src/ogl/bmpshape.cpp b/contrib/src/ogl/bmpshape.cpp index 7b2dfac..3080ac7 100644 --- a/contrib/src/ogl/bmpshape.cpp +++ b/contrib/src/ogl/bmpshape.cpp @@ -24,7 +24,7 @@ #include #endif -#include +#include #include #include diff --git a/contrib/src/ogl/canvas.cpp b/contrib/src/ogl/canvas.cpp index 0620c41..30640a6 100644 --- a/contrib/src/ogl/canvas.cpp +++ b/contrib/src/ogl/canvas.cpp @@ -24,7 +24,7 @@ #include #endif -#include +#include #ifdef new #undef new diff --git a/contrib/src/ogl/composit.cpp b/contrib/src/ogl/composit.cpp index 479452f..eb5be65 100644 --- a/contrib/src/ogl/composit.cpp +++ b/contrib/src/ogl/composit.cpp @@ -24,7 +24,7 @@ #include #endif -#include +#include #include #include @@ -706,13 +706,13 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database) // Each constraint is stored in the form // (type name id xspacing yspacing m_constrainingObjectId constrainedObjectIdList) - wxExpr *typeExpr = constraintExpr->Item(0); - wxExpr *nameExpr = constraintExpr->Item(1); - wxExpr *idExpr = constraintExpr->Item(2); - wxExpr *xExpr = constraintExpr->Item(3); - wxExpr *yExpr = constraintExpr->Item(4); - wxExpr *constrainingExpr = constraintExpr->Item(5); - wxExpr *constrainedExpr = constraintExpr->Item(6); + 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(); @@ -727,7 +727,7 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database) wxLogFatalError(wxT("Object graphics error: Couldn't find constraining image of composite.")); int i = 0; - wxExpr *currentIdExpr = constrainedExpr->Item(i); + wxExpr *currentIdExpr = constrainedExpr->Nth(i); while (currentIdExpr) { long currentId = currentIdExpr->IntegerValue(); @@ -742,7 +742,7 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database) } i ++; - currentIdExpr = constrainedExpr->Item(i); + currentIdExpr = constrainedExpr->Nth(i); } wxOGLConstraint *newConstraint = AddConstraint(cType, m_constrainingObject, m_constrainedObjects); newConstraint->SetSpacing(cXSpacing, cYSpacing); diff --git a/contrib/src/ogl/constrnt.cpp b/contrib/src/ogl/constrnt.cpp index 354cac4..98e9e6f 100644 --- a/contrib/src/ogl/constrnt.cpp +++ b/contrib/src/ogl/constrnt.cpp @@ -24,7 +24,7 @@ #include #endif -#include +#include #include #include diff --git a/contrib/src/ogl/divided.cpp b/contrib/src/ogl/divided.cpp index cb1de4f..8c40db0 100644 --- a/contrib/src/ogl/divided.cpp +++ b/contrib/src/ogl/divided.cpp @@ -24,7 +24,7 @@ #include #endif -#include +#include #include #include diff --git a/contrib/src/ogl/drawn.cpp b/contrib/src/ogl/drawn.cpp index bb5c79e..3104fba 100644 --- a/contrib/src/ogl/drawn.cpp +++ b/contrib/src/ogl/drawn.cpp @@ -25,7 +25,7 @@ #include #endif -#include +#include #include #include @@ -563,20 +563,20 @@ void wxOpSetGDI::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) case DRAWOP_SET_BRUSH: case DRAWOP_SET_FONT: { - m_gdiIndex = (int)expr->Item(1)->IntegerValue(); + m_gdiIndex = (int)expr->Nth(1)->IntegerValue(); break; } case DRAWOP_SET_TEXT_COLOUR: case DRAWOP_SET_BK_COLOUR: { - m_r = (unsigned char)expr->Item(1)->IntegerValue(); - m_g = (unsigned char)expr->Item(2)->IntegerValue(); - m_b = (unsigned char)expr->Item(3)->IntegerValue(); + m_r = (unsigned char)expr->Nth(1)->IntegerValue(); + m_g = (unsigned char)expr->Nth(2)->IntegerValue(); + m_b = (unsigned char)expr->Nth(3)->IntegerValue(); break; } case DRAWOP_SET_BK_MODE: { - m_mode = (int)expr->Item(1)->IntegerValue(); + m_mode = (int)expr->Nth(1)->IntegerValue(); break; } default: @@ -665,10 +665,10 @@ void wxOpSetClipping::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) { case DRAWOP_SET_CLIPPING_RECT: { - m_x1 = expr->Item(1)->RealValue(); - m_y1 = expr->Item(2)->RealValue(); - m_x2 = expr->Item(3)->RealValue(); - m_y2 = expr->Item(4)->RealValue(); + m_x1 = expr->Nth(1)->RealValue(); + m_y1 = expr->Nth(2)->RealValue(); + m_x2 = expr->Nth(3)->RealValue(); + m_y2 = expr->Nth(4)->RealValue(); break; } default: @@ -950,44 +950,44 @@ void wxOpDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) case DRAWOP_DRAW_RECT: case DRAWOP_DRAW_ELLIPSE: { - m_x1 = expr->Item(1)->RealValue(); - m_y1 = expr->Item(2)->RealValue(); - m_x2 = expr->Item(3)->RealValue(); - m_y2 = expr->Item(4)->RealValue(); + m_x1 = expr->Nth(1)->RealValue(); + m_y1 = expr->Nth(2)->RealValue(); + m_x2 = expr->Nth(3)->RealValue(); + m_y2 = expr->Nth(4)->RealValue(); break; } case DRAWOP_DRAW_ROUNDED_RECT: { - m_x1 = expr->Item(1)->RealValue(); - m_y1 = expr->Item(2)->RealValue(); - m_x2 = expr->Item(3)->RealValue(); - m_y2 = expr->Item(4)->RealValue(); - m_radius = expr->Item(5)->RealValue(); + m_x1 = expr->Nth(1)->RealValue(); + m_y1 = expr->Nth(2)->RealValue(); + m_x2 = expr->Nth(3)->RealValue(); + m_y2 = expr->Nth(4)->RealValue(); + m_radius = expr->Nth(5)->RealValue(); break; } case DRAWOP_DRAW_POINT: { - m_x1 = expr->Item(1)->RealValue(); - m_y1 = expr->Item(2)->RealValue(); + m_x1 = expr->Nth(1)->RealValue(); + m_y1 = expr->Nth(2)->RealValue(); break; } case DRAWOP_DRAW_TEXT: { - m_x1 = expr->Item(1)->RealValue(); - m_y1 = expr->Item(2)->RealValue(); - wxString str(expr->Item(3)->StringValue()); + m_x1 = expr->Nth(1)->RealValue(); + m_y1 = expr->Nth(2)->RealValue(); + wxString str(expr->Nth(3)->StringValue()); m_textString = copystring(str); break; } case DRAWOP_DRAW_ARC: case DRAWOP_DRAW_ELLIPTIC_ARC: { - m_x1 = expr->Item(1)->RealValue(); - m_y1 = expr->Item(2)->RealValue(); - m_x2 = expr->Item(3)->RealValue(); - m_y2 = expr->Item(4)->RealValue(); - m_x3 = expr->Item(5)->RealValue(); - m_y3 = expr->Item(6)->RealValue(); + m_x1 = expr->Nth(1)->RealValue(); + m_y1 = expr->Nth(2)->RealValue(); + m_x2 = expr->Nth(3)->RealValue(); + m_y2 = expr->Nth(4)->RealValue(); + m_x3 = expr->Nth(5)->RealValue(); + m_y3 = expr->Nth(6)->RealValue(); break; } default: @@ -1156,7 +1156,7 @@ wxExpr *wxOpPolyDraw::WriteExpr(wxPseudoMetaFile *image) void wxOpPolyDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) { - m_noPoints = (int)expr->Item(1)->IntegerValue(); + m_noPoints = (int)expr->Nth(1)->IntegerValue(); char buf1[5]; char buf2[5]; @@ -1164,7 +1164,7 @@ void wxOpPolyDraw::ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) m_points = new wxRealPoint[m_noPoints]; int i = 0; int bufPtr = 0; - wxString hexString = expr->Item(2)->StringValue(); + wxString hexString = expr->Nth(2)->StringValue(); while (i < m_noPoints) { buf1[0] = hexString[(size_t)bufPtr]; @@ -1621,16 +1621,16 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) } else { - wxExpr *idExpr = expr->Item(0); + wxExpr *idExpr = expr->Nth(0); switch (idExpr->IntegerValue()) { case gyTYPE_PEN: { - int penWidth = (int)expr->Item(1)->IntegerValue(); - int penStyle = (int)expr->Item(2)->IntegerValue(); - int penRed = (int)expr->Item(3)->IntegerValue(); - int penGreen = (int)expr->Item(4)->IntegerValue(); - int penBlue = (int)expr->Item(5)->IntegerValue(); + 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) @@ -1640,10 +1640,10 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) } case gyTYPE_BRUSH: { - int brushStyle = (int)expr->Item(1)->IntegerValue(); - int brushRed = (int)expr->Item(2)->IntegerValue(); - int brushGreen = (int)expr->Item(3)->IntegerValue(); - int brushBlue = (int)expr->Item(4)->IntegerValue(); + 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) @@ -1653,11 +1653,11 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) } case gyTYPE_FONT: { - int fontPointSize = (int)expr->Item(1)->IntegerValue(); - int fontFamily = (int)expr->Item(2)->IntegerValue(); - int fontStyle = (int)expr->Item(3)->IntegerValue(); - int fontWeight = (int)expr->Item(4)->IntegerValue(); - int fontUnderlined = (int)expr->Item(5)->IntegerValue(); + 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; @@ -1687,7 +1687,7 @@ void wxPseudoMetaFile::ReadAttributes(wxExpr *clause, int whichAngle) } else { - wxExpr *idExpr = expr->Item(0); + wxExpr *idExpr = expr->Nth(0); int opId = (int)idExpr->IntegerValue(); switch (opId) { diff --git a/contrib/src/ogl/lines.cpp b/contrib/src/ogl/lines.cpp index 045202c..40996d0 100644 --- a/contrib/src/ogl/lines.cpp +++ b/contrib/src/ogl/lines.cpp @@ -25,7 +25,7 @@ #include #endif -#include +#include #ifdef new #undef new @@ -1541,16 +1541,16 @@ void wxLineShape::ReadAttributes(wxExpr *clause) wxString arrowName; long arrowId = -1; - wxExpr *type_expr = node->Item(0); - wxExpr *end_expr = node->Item(1); - wxExpr *dist_expr = node->Item(2); - wxExpr *size_expr = node->Item(3); - wxExpr *name_expr = node->Item(4); - wxExpr *id_expr = node->Item(5); + 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->Item(6); - wxExpr *spacingExpr = node->Item(7); + wxExpr *yOffsetExpr = node->Nth(6); + wxExpr *spacingExpr = node->Nth(7); if (type_expr) arrowType = (int)type_expr->IntegerValue(); diff --git a/contrib/src/ogl/misc.cpp b/contrib/src/ogl/misc.cpp index 50cc5b9..f76fa8f 100644 --- a/contrib/src/ogl/misc.cpp +++ b/contrib/src/ogl/misc.cpp @@ -24,7 +24,7 @@ #include #endif -#include +#include #include diff --git a/contrib/src/ogl/ogldiag.cpp b/contrib/src/ogl/ogldiag.cpp index 932bbcd..fa1139b 100644 --- a/contrib/src/ogl/ogldiag.cpp +++ b/contrib/src/ogl/ogldiag.cpp @@ -24,7 +24,7 @@ #include #endif -#include +#include #ifdef new #undef new @@ -453,7 +453,7 @@ void wxDiagram::ReadContainerGeometry(wxExprDatabase& database) if (divisionExpr) { int i = 0; - wxExpr *idExpr = divisionExpr->Item(i); + wxExpr *idExpr = divisionExpr->Nth(i); while (idExpr) { long divisionId = idExpr->IntegerValue(); @@ -510,7 +510,7 @@ void wxDiagram::ReadContainerGeometry(wxExprDatabase& database) } } i ++; - idExpr = divisionExpr->Item(i); + idExpr = divisionExpr->Nth(i); } } } diff --git a/contrib/src/ogl/oglmisc.cpp b/contrib/src/ogl/oglmisc.cpp index e5cb939..07ea533 100644 --- a/contrib/src/ogl/oglmisc.cpp +++ b/contrib/src/ogl/oglmisc.cpp @@ -24,7 +24,7 @@ #include #endif -#include +#include #include diff --git a/contrib/utils/convertrc/Makefile.in b/contrib/utils/convertrc/Makefile.in index 8dffc8f..a09d38e 100644 --- a/contrib/utils/convertrc/Makefile.in +++ b/contrib/utils/convertrc/Makefile.in @@ -6,6 +6,9 @@ program_dir = contrib/utils/convertrc PROGRAM=convert +APPEXTRALIBS=$(top_builddir)/lib/lib@WX_LIBRARY_BASENAME@_wxdeprecated-@WX_RELEASE@.@WX_TARGET_LIBRARY_TYPE@ +APPEXTRADEFS=-I$(top_srcdir)/contrib/include + OBJECTS=convert.o rc2xml.o rc2wxr.o wxr2xml.o include $(top_builddir)/src/makeprog.env diff --git a/contrib/utils/convertrc/convert.cpp b/contrib/utils/convertrc/convert.cpp index 3368af3..17927d3 100644 --- a/contrib/utils/convertrc/convert.cpp +++ b/contrib/utils/convertrc/convert.cpp @@ -24,7 +24,9 @@ #endif #include -#include "wx/resource.h" + +#include "wx/deprecated/setup.h" +#include "wx/deprecated/resource.h" #include "convert.h" #include "rc2wxr.h" @@ -62,7 +64,7 @@ bool wxConvertApp::OnInit() // Create the main frame window m_pFrame = new wxMainFrame(NULL, -1, "wxConvertApp", wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL); - + InitMenu(); m_pFrame->Show(TRUE); SetTopWindow(m_pFrame); @@ -104,12 +106,12 @@ END_EVENT_TABLE() // Construction/Destruction ////////////////////////////////////////////////////////////////////// -wxMainFrame::wxMainFrame(wxWindow* parent,wxWindowID id, +wxMainFrame::wxMainFrame(wxWindow* parent,wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) :wxFrame(parent,id,title,pos,size,style,name) { - + } wxMainFrame::~wxMainFrame() @@ -163,7 +165,7 @@ void wxMainFrame::OnWXR2XML() wxr2xml XMLCon; XMLCon.Convert(f.GetPath(),xmlfile.GetPath()); - + } void wxMainFrame::OnRC2XML() @@ -189,18 +191,19 @@ void wxMainFrame::OnRC2XML() bool wxConvertApp::HandleCommandLine() { - if (argc != 2) + if (argc != 2) return FALSE; //Figure out kind of conversion wxString source,target; + wxr2xml trans_wxr2xml; rc2xml trans_rc2xml; rc2wxr trans_rc2wxr; source=argv[1]; target=argv[2]; - + if ((source.Find(".wxr")>0)&&(target.Find(".xml")>0)) { @@ -217,6 +220,6 @@ bool wxConvertApp::HandleCommandLine() trans_rc2xml.Convert(source,target); return TRUE; } - - return FALSE; + + return FALSE; } diff --git a/contrib/utils/convertrc/makefile.b32 b/contrib/utils/convertrc/makefile.b32 index dfe3a6b..5b133f6 100644 --- a/contrib/utils/convertrc/makefile.b32 +++ b/contrib/utils/convertrc/makefile.b32 @@ -8,7 +8,7 @@ # Makefile : Builds convert for 32-bit BC++ WXDIR = $(WXWIN) -EXTRALIBS=$(WXDIR)\lib\wxxrc.lib +EXTRALIBS=$(WXDIR)\lib\wxxrc.lib $(WXDIR)\lib\wxdeprecated.lib TARGET=wxconvert diff --git a/contrib/utils/convertrc/makefile.g95 b/contrib/utils/convertrc/makefile.g95 index c1706f3..88a00d8 100644 --- a/contrib/utils/convertrc/makefile.g95 +++ b/contrib/utils/convertrc/makefile.g95 @@ -10,7 +10,8 @@ WXDIR = ../../.. TARGET=wxconvert -EXTRALIBS=-lwxxrc +EXTRALIBS=-lwxxrc -lwxdeprecated +EXTRAINC = -I$(WXDIR)/contrib/include OBJECTS=convert.o rc2xml.o rc2wxr.o wxr2xml.o include $(WXDIR)/src/makeprog.g95 diff --git a/contrib/utils/convertrc/makefile.vc b/contrib/utils/convertrc/makefile.vc index 86328c7..b928ee1 100644 --- a/contrib/utils/convertrc/makefile.vc +++ b/contrib/utils/convertrc/makefile.vc @@ -18,9 +18,9 @@ PROGRAM=wxconvert FINAL=0 !if "$(FINAL)" == "0" -EXTRALIBS=$(WXDIR)\lib\wxxrcd.lib +EXTRALIBS=$(WXDIR)\lib\wxxrcd.lib $(WXDIR)\lib\wxdeprecatedd.lib !else -EXTRALIBS=$(WXDIR)\lib\wxxrc.lib +EXTRALIBS=$(WXDIR)\lib\wxxrc.lib $(WXDIR)\lib\wxdeprecated.lib !endif OBJECTS=convert.obj rc2xml.obj rc2wxr.obj wxr2xml.obj diff --git a/contrib/utils/convertrc/makefile.wat b/contrib/utils/convertrc/makefile.wat index d270853..28de5d0 100644 --- a/contrib/utils/convertrc/makefile.wat +++ b/contrib/utils/convertrc/makefile.wat @@ -6,7 +6,7 @@ WXDIR = $(%WXWIN) PROGRAM = wxconvert -EXTRALIBS = $(WXDIR)\lib\wxxrc.lib +EXTRALIBS = $(WXDIR)\lib\wxxrc.lib $(WXDIR)\lib\wxdeprecated.lib OBJECTS=convert.obj rc2xml.obj rc2wxr.obj wxr2xml.obj !include $(WXDIR)\src\makeprog.wat diff --git a/contrib/utils/convertrc/rc2wxr.cpp b/contrib/utils/convertrc/rc2wxr.cpp index 30a0262..87abed7 100644 --- a/contrib/utils/convertrc/rc2wxr.cpp +++ b/contrib/utils/convertrc/rc2wxr.cpp @@ -62,7 +62,8 @@ This code was used as a starting point for my rc2xml converter #include "wx/image.h" -#include "wx/resource.h" +#include "wx/deprecated/setup.h" +#include "wx/deprecated/resource.h" ////////////////////////////////////////////////////////////////////// @@ -138,7 +139,7 @@ ParseDialog(prevtok); } - + @@ -148,7 +149,7 @@ if (tok=="MENU") ParseMenu(prevtok); -} +} @@ -160,7 +161,7 @@ prevtok=tok; fclose(m_wxr); -//fclose(m_rc); +//fclose(m_rc); m_rc.Close(); @@ -174,7 +175,7 @@ m_rc.Close(); /* -Example .rc +Example .rc Microsoft style as of v5.0 @@ -222,7 +223,7 @@ static int dlgid=999; dlgid++; -/* Make sure that this really is a dialog +/* Make sure that this really is a dialog microsoft reuses the keyword DIALOG for other things @@ -328,7 +329,7 @@ BEGIN - EDITTEXT IDC_BANDS,36,83,22,14,ES_AUTOHSCROLL | ES_NUMBER | NOT + EDITTEXT IDC_BANDS,36,83,22,14,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_TABSTOP @@ -642,7 +643,7 @@ m_done=TRUE; } - + @@ -692,7 +693,7 @@ while (ch!=34) ReadChar(ch); - + ReadChar(ch); @@ -752,7 +753,7 @@ void rc2wxr::ParseComboBox() { -/* COMBOBOX IDC_SCALECOMBO,10,110,48,52,CBS_DROPDOWNLIST | CBS_SORT | +/* COMBOBOX IDC_SCALECOMBO,10,110,48,52,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP */ @@ -794,7 +795,7 @@ static int menuid=0; menuid++; -fprintf(m_wxr,"static char *MenuBar%i = \"menu(name = '%s',\\\n",menuid,name); +fprintf(m_wxr,"static char *MenuBar%i = \"menu(name = '%s',\\\n",menuid,name); fprintf(m_wxr,"menu = \\\n"); @@ -904,7 +905,7 @@ fprintf(m_wxr," ['%s',%i,''],\\\n",tok,menuitem); - + } @@ -964,7 +965,7 @@ if (kindctrl=="BUTTON") } -/* CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | +/* CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,52,73,100,15 @@ -980,7 +981,7 @@ wxString tok; while (ReadOrs(tok)); -fprintf(m_wxr," control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',",m_controlid,varname); +fprintf(m_wxr," control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',",m_controlid,varname); int x,y,width,height; @@ -994,7 +995,7 @@ fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n" } -/* +/* CONTROL "Progress1",CG_IDC_PROGDLG_PROGRESS,"msctls_progress32", @@ -1010,7 +1011,7 @@ wxString tok; while (ReadOrs(tok)); -fprintf(m_wxr," control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',",m_controlid,varname); +fprintf(m_wxr," control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',",m_controlid,varname); int x,y,width,height; @@ -1068,9 +1069,9 @@ if (tok=="BS_AUTOCHECKBOX") { - fprintf(m_wxr," control = [%i,wxCheckBox,'%s','0','%s',",m_controlid,label,varname); + fprintf(m_wxr," control = [%i,wxCheckBox,'%s','0','%s',",m_controlid,label,varname); - while (ReadOrs(tok)); + while (ReadOrs(tok)); ReadRect(x,y,width,height); @@ -1086,9 +1087,9 @@ if (tok=="BS_AUTORADIOBUTTON") { - fprintf(m_wxr," control = [%i,wxRadioButton,'%s','0','%s',",m_controlid,label,varname); + fprintf(m_wxr," control = [%i,wxRadioButton,'%s','0','%s',",m_controlid,label,varname); - while(ReadOrs(tok)); + while(ReadOrs(tok)); ReadRect(x,y,width,height); diff --git a/contrib/utils/convertrc/rc2xml.cpp b/contrib/utils/convertrc/rc2xml.cpp index 3c8e797..fc65fe5 100644 --- a/contrib/utils/convertrc/rc2xml.cpp +++ b/contrib/utils/convertrc/rc2xml.cpp @@ -36,7 +36,8 @@ cross platform (wxGTK,etc) #include "rc2xml.h" #include "wx/image.h" -#include "wx/resource.h" +#include "wx/deprecated/setup.h" +#include "wx/deprecated/resource.h" #include #include @@ -67,7 +68,7 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile) { m_rc.Open(rcfile.c_str()); m_filesize=m_rc.Length(); - + m_workingpath=wxPathOnly(rcfile); @@ -80,15 +81,15 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile) bool result; result=m_xmlfile.Open(xmlfile.c_str(),"w+t"); - wxASSERT_MSG(result,"Couldn't create XML file"); + wxASSERT_MSG(result,"Couldn't create XML file"); if (!result) return FALSE; - + /* Write Basic header for XML file */ m_xmlfile.Write("\n"); m_xmlfile.Write("\n"); - + //Read resource.h ParseResourceHeader(); //Gather all the resource we need for toolbars,menus, and etc @@ -101,7 +102,7 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile) m_xmlfile.Write("\n"); m_xmlfile.Close(); m_rc.Close(); - wxMessageBox(_("Conversion complete."), _("Done"), + wxMessageBox(_("Conversion complete."), _("Done"), wxOK | wxICON_INFORMATION); return TRUE; @@ -113,7 +114,7 @@ void rc2xml::ParseDialog(wxString dlgname) wxString token; static int dlgid=999; dlgid++; -/* Make sure that this really is a dialog +/* Make sure that this really is a dialog microsoft reuses the keyword DIALOG for other things */ token=PeekToken(); @@ -135,13 +136,13 @@ microsoft reuses the keyword DIALOG for other things token=GetToken(); wxString title; wxString ptsize,face; - + m_xmlfile.Write("\t\n"); } -/* +/* CONTROL "Progress1",CG_IDC_PROGDLG_PROGRESS,"msctls_progress32", WS_BORDER,15,52,154,13 */ @@ -652,7 +653,7 @@ void rc2xml::ParseProgressBar(wxString label, wxString varname) { wxString token,style; ReadOrs(token); - + int x,y,width,height; ReadRect(x,y,width,height); @@ -674,7 +675,7 @@ bool rc2xml::ReadOrs(wxString & orstring) while(PeekToken()==_T("|")) { - //Grab | + //Grab | orstring+=GetToken(); //Grab next token orstring+=GetToken(); @@ -697,7 +698,7 @@ void rc2xml::ParseCtrlButton(wxString label, wxString varname) (token.Find("BS_RADIOBUTTON")!=-1)) ParseRadioButton(label, varname); else if (token.Find("BS_GROUPBOX")!=-1) - ParseGroupBox(label, varname); + ParseGroupBox(label, varname); else // if ((token.Find("BS_PUSHBUTTON")!=-1)|| // (token.Find("BS_DEFPUSHBUTTON")!=-1)) ParsePushButton(label, varname); // make default case @@ -726,7 +727,7 @@ void rc2xml::WriteTitle(wxString title) void rc2xml::WriteName(wxString name) { - + //Try to convert any number ids into names name=LookUpId(name); //Replace common MS ids with wxWindows ids @@ -796,7 +797,7 @@ void rc2xml::WriteStyle(wxString style) m_xmlfile.Write("\t\t\t\n"); } /* - LISTBOX IDC_LIST1,16,89,48,40,LBS_SORT | LBS_MULTIPLESEL | + LISTBOX IDC_LIST1,16,89,48,40,LBS_SORT | LBS_MULTIPLESEL | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP */ void rc2xml::ParseListBox(wxString varname) @@ -817,7 +818,7 @@ void rc2xml::ParseListBox(wxString varname) } /* - CONTROL "",IDC_RICHEDIT1,"RICHEDIT",ES_AUTOHSCROLL | WS_BORDER | + CONTROL "",IDC_RICHEDIT1,"RICHEDIT",ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP,103,110,40,14 */ void rc2xml::ParseRichEdit(wxString label, wxString varname) @@ -843,7 +844,7 @@ CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_ARROWKEYS,209,72, void rc2xml::ParseSpinCtrl(wxString label, wxString varname) { wxString token,style; - + ReadOrs(token); if (token.Find("UDS_HORZ")!=-1) style="wxSP_HORIZONTAL"; @@ -872,7 +873,7 @@ void rc2xml::FirstPass() ParseStringTable(prevtok); else if (token=="ICON") ParseIcon(prevtok); - + prevtok=token; } } @@ -880,7 +881,7 @@ void rc2xml::FirstPass() void rc2xml::ParseBitmap(wxString varname) { wxString token,*bitmapfile; - + token=PeekToken(); //Microsoft notation? if (token=="DISCARDABLE") @@ -907,7 +908,7 @@ void rc2xml::SecondPass() ParseMenu(prevtok); else if (token=="TOOLBAR") ParseToolBar(prevtok); - + prevtok=token; } @@ -915,7 +916,7 @@ void rc2xml::SecondPass() void rc2xml::ParseToolBar(wxString varname) { - wxString token; + wxString token; token=GetToken(); wxASSERT_MSG(token=="DISCARDABLE","Error in toolbar parsing"); //Look up bitmap for toolbar and load @@ -942,7 +943,7 @@ void rc2xml::ParseToolBar(wxString varname) width=atoi(GetToken()); height=atoi(GetToken()); - int c=0; + int c=0; wxString buttonname,msg,tip,longhelp; token=GetToken(); while ((token!="BEGIN")&(token!="{")) @@ -1060,7 +1061,7 @@ void rc2xml::ParseMenuItem() WriteLabel(token); //Look up help if any listed in stringtable //can't assume numbers correlate, restrict to string identifiers - if ((!name.IsNumber())&&(LookUpString(name,msg))) + if ((!name.IsNumber())&&(LookUpString(name,msg))) { SplitHelp(msg,tip,longhelp); m_xmlfile.Write("\t\t\t" @@ -1081,11 +1082,11 @@ void rc2xml::ParseMenuItem() else if (token=="GRAYED"); else wxLogError("Unknown Menu Item token:"+token); - + ptoken=PeekToken(); ptoken.MakeUpper(); } - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } @@ -1121,7 +1122,7 @@ void rc2xml::ParseIcon(wxString varname) *iconfile=GetQuoteField(); m_iconlist->Append(varname,iconfile); - + } @@ -1234,7 +1235,7 @@ void rc2xml::ParseScrollBar() wxString style; ReadOrs(token); - + if (token.Find("SBS_VERT")!=-1) style=_T("wxSB_VERTICAL"); //Default MFC style is horizontal @@ -1302,7 +1303,7 @@ void rc2xml::WriteBitmap(wxString bitmapname) wxLogError("Unable to find bitmap:"+bitmapname); return; } - + wxString *bitmappath; bitmappath=(wxString *)node->Data(); @@ -1344,7 +1345,7 @@ wxNode *node=m_iconlist->Find(iconname); m_xmlfile.Write("\t\t\t"+iconname+"\n"); bitmap.SaveFile(m_targetpath+iconname,wxBITMAP_TYPE_BMP); - + } /*Unfortunately sometimes the great MSVC Resource editor decides to use numbers instead of the word id. I have no idea why they @@ -1362,13 +1363,13 @@ wxTextFile r; wxLogError("Warining Unable to load resource.h file"); return; } - + wxString str; wxString id,v; wxStringTokenizer tok; wxString *varname; - - + + long n; //Read through entire file @@ -1391,8 +1392,8 @@ wxTextFile r; } } - - + + } diff --git a/contrib/utils/convertrc/wxr2xml.h b/contrib/utils/convertrc/wxr2xml.h index 8692f9c..1656050 100644 --- a/contrib/utils/convertrc/wxr2xml.h +++ b/contrib/utils/convertrc/wxr2xml.h @@ -1,4 +1,4 @@ -// wxr2xml.h: +// wxr2xml.h: // 8/30/00 Brian Gavin ////////////////////////////////////////////////////////////////////// @@ -6,13 +6,14 @@ #define WXR2XML_H #include -#include "wx/resource.h" +#include "wx/deprecated/setup.h" +#include "wx/deprecated/resource.h" #if !wxUSE_WX_RESOURCES #error "convertc requires wxUSE_WX_RESOURCES" #endif // wxUSE_WX_RESOURCES -class wxr2xml : public wxObject +class wxr2xml : public wxObject { public: bool Convert(wxString wxrfile,wxString xmlfile); @@ -74,4 +75,4 @@ protected: wxFFile m_xmlfile; }; -#endif +#endif diff --git a/demos/dbbrowse/std.h b/demos/dbbrowse/std.h index 0450f04..b1bf58b 100644 --- a/demos/dbbrowse/std.h +++ b/demos/dbbrowse/std.h @@ -14,7 +14,6 @@ #include #include #include -#include // wxResourceParsedata/File/String #include #include #include diff --git a/distrib/msw/cw.rsp b/distrib/msw/cw.rsp index 7c167d5..f631c16 100644 --- a/distrib/msw/cw.rsp +++ b/distrib/msw/cw.rsp @@ -63,9 +63,7 @@ samples/opengl/*W7.xml samples/ownerdrw/*W7.xml samples/png/*W7.xml samples/printing/*W7.xml -samples/proplist/*W7.xml samples/regtest/*W7.xml -samples/resource/*W7.xml samples/rotate/*W7.xml samples/sashtest/*W7.xml samples/scroll/*W7.xml @@ -80,7 +78,6 @@ samples/text/*W7.xml samples/thread/*W7.xml samples/toolbar/*W7.xml samples/treectrl/*W7.xml -samples/treelay/*W7.xml samples/typetest/*W7.xml samples/validate/*W7.xml samples/widgets/*W7.xml @@ -133,3 +130,8 @@ contrib/samples/fl/fl_sample2/*W7.xml contrib/samples/fl/fl_sample3/*W7.xml contrib/src/net/*W7.xml +contrib/src/deprecated/*W7.xml +contrib/samples/deprecated/resource/*W7.xml +contrib/samples/deprecated/proplist/*W7.xml +contrib/samples/deprecated/treelay/*W7.xml + diff --git a/distrib/msw/cw_mac.rsp b/distrib/msw/cw_mac.rsp index b345bc3..8223478 100644 --- a/distrib/msw/cw_mac.rsp +++ b/distrib/msw/cw_mac.rsp @@ -113,12 +113,8 @@ samples/png/*M?.xml samples/png/*.mcp samples/printing/*M?.xml samples/printing/*.mcp -samples/proplist/*M?.xml -samples/proplist/*.mcp samples/regtest/*M?.xml samples/regtest/*.mcp -samples/resource/*M?.xml -samples/resource/*.mcp samples/rotate/*M?.xml samples/rotate/*.mcp samples/sashtest/*M?.xml @@ -147,8 +143,6 @@ samples/toolbar/*M?.xml samples/toolbar/*.mcp samples/treectrl/*M?.xml samples/treectrl/*.mcp -samples/treelay/*M?.xml -samples/treelay/*.mcp samples/typetest/*M?.xml samples/typetest/*.mcp samples/validate/*M?.xml @@ -271,3 +265,13 @@ contrib/samples/fl/fl_sample3/*.mcp contrib/src/net/*M?.xml contrib/src/net/*.mcp +contrib/src/deprecated/*M?.xml +contrib/src/deprecated/*.mcp + +contrib/samples/deprecated/proplist/*M?.xml +contrib/samples/deprecated/proplist/*.mcp +contrib/samples/deprecated/resource/*M?.xml +contrib/samples/deprecated/resource/*.mcp +contrib/samples/deprecated/treelay/*M?.xml +contrib/samples/deprecated/treelay/*.mcp + diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index 206172a..4fc4d49 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -899,17 +899,6 @@ samples/printing/*.rc samples/printing/*.afm samples/printing/*.pro -samples/proplist/*.cpp -samples/proplist/*.h -samples/proplist/*.def -samples/proplist/makefile* -samples/proplist/*.xbm -samples/proplist/*.xpm -samples/proplist/*.ico -samples/proplist/*.bmp -samples/proplist/*.rc -samples/proplist/*.pro - samples/propsize/*.cpp samples/propsize/*.h samples/propsize/*.def @@ -921,18 +910,6 @@ samples/propsize/*.bmp samples/propsize/*.rc samples/propsize/*.pro -samples/resource/*.cpp -samples/resource/*.h -samples/resource/*.def -samples/resource/*.rc -samples/resource/*.txt -samples/resource/*.wxr -samples/resource/makefile* -samples/resource/*.xbm -samples/resource/*.xpm -samples/resource/*.ico -samples/resource/*.pro - samples/rotate/*.cpp samples/rotate/*.h samples/rotate/makefile* @@ -1065,17 +1042,6 @@ samples/thread/*.ico samples/thread/*.txt samples/thread/*.pro -samples/treelay/*.cpp -samples/treelay/*.h -samples/treelay/makefile* -samples/treelay/*.rc -samples/treelay/*.def -samples/treelay/*.ico -samples/treelay/*.xpm -samples/treelay/*.txt -samples/treelay/*.bmp -samples/treelay/*.pro - samples/typetest/*.cpp samples/typetest/*.h samples/typetest/*.def diff --git a/distrib/msw/makefile.rsp b/distrib/msw/makefile.rsp index db9ac53..7c3945f 100644 --- a/distrib/msw/makefile.rsp +++ b/distrib/msw/makefile.rsp @@ -27,7 +27,6 @@ samples/help/Makefile.in samples/internat/Makefile.in samples/ipc/Makefile.in samples/png/Makefile.in -samples/resource/Makefile.in samples/sockets/Makefile.in samples/html/Makefile.in samples/html/about/Makefile.in @@ -52,7 +51,6 @@ samples/mobile/styles/Makefile.in samples/multimon/Makefile.in samples/notebook/Makefile.in samples/printing/Makefile.in -samples/proplist/Makefile.in samples/propsize/Makefile.in samples/rotate/Makefile.in samples/sashtest/Makefile.in @@ -73,7 +71,6 @@ samples/display/Makefile.in samples/font/Makefile.in samples/menu/Makefile.in samples/memcheck/Makefile.in -samples/treelay/Makefile.in samples/opengl/Makefile.in samples/opengl/cube/Makefile.in samples/opengl/penguin/Makefile.in @@ -141,6 +138,11 @@ contrib/samples/fl/fl_sample3/Makefile.in contrib/samples/svg/Makefile.in contrib/src/svg/Makefile.in +contrib/src/deprecated/Makefile.in +contrib/samples/deprecated/proplist/Makefile.in +contrib/samples/deprecated/treelay/Makefile.in +contrib/samples/deprecated/resource/Makefile.in + contrib/utils/Makefile.in descrip.mms diff --git a/distrib/msw/tardist b/distrib/msw/tardist index 64c3072..76a0375 100644 --- a/distrib/msw/tardist +++ b/distrib/msw/tardist @@ -70,7 +70,7 @@ dospinwxgtk() echo Tarring wxGTK... cd $WXSRC -cat $WXSRC/distrib/msw/generic.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/stc.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/utils.rsp $WXSRC/distrib/msw/ogl.rsp $WXSRC/distrib/msw/tex2rtf.rsp $WXSRC/distrib/msw/dialoged.rsp $WXSRC/distrib/msw/gtk.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp > /tmp/wxgtk_in.txt +cat $WXSRC/distrib/msw/generic.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/deprecated.rsp $WXSRC/distrib/msw/stc.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/utils.rsp $WXSRC/distrib/msw/ogl.rsp $WXSRC/distrib/msw/tex2rtf.rsp $WXSRC/distrib/msw/dialoged.rsp $WXSRC/distrib/msw/gtk.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp > /tmp/wxgtk_in.txt expandlines /tmp/wxgtk_in.txt /tmp/wxgtk.txt $TAR cf $WXDEST/wxGTK-${WXVER}.tar -T /tmp/wxgtk.txt @@ -91,7 +91,7 @@ dospinwxmotif() echo Tarring wxMotif... cd $WXSRC -cat $WXSRC/distrib/msw/generic.rsp $WXSRC/distrib/msw/motif.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/stc.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/ogl.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp > /tmp/wxmotif_in.txt +cat $WXSRC/distrib/msw/generic.rsp $WXSRC/distrib/msw/motif.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/deprecated.rsp $WXSRC/distrib/msw/stc.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/ogl.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp > /tmp/wxmotif_in.txt expandlines /tmp/wxmotif_in.txt /tmp/wxmotif.txt $TAR cf $WXDEST/wxMotif-${WXVER}.tar -T /tmp/wxmotif.txt @@ -113,7 +113,7 @@ echo Tarring wxX11... ### wxX11: combined wxMotif and wxX11 distributions cd $WXSRC -cat $WXSRC/distrib/msw/generic.rsp $WXSRC/distrib/msw/motif.rsp $WXSRC/distrib/msw/x11.rsp $WXSRC/distrib/msw/univ.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/stc.rsp $WXSRC/distrib/msw/utils.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/dialoged.rsp $WXSRC/distrib/msw/ogl.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp > /tmp/wxx11_in.txt +cat $WXSRC/distrib/msw/generic.rsp $WXSRC/distrib/msw/motif.rsp $WXSRC/distrib/msw/x11.rsp $WXSRC/distrib/msw/univ.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/deprecated.rsp $WXSRC/distrib/msw/stc.rsp $WXSRC/distrib/msw/utils.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/dialoged.rsp $WXSRC/distrib/msw/ogl.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp > /tmp/wxx11_in.txt expandlines /tmp/wxx11_in.txt /tmp/wxx11.txt $TAR cf $WXDEST/wxX11-${WXVER}.tar -T /tmp/wxx11.txt @@ -131,7 +131,7 @@ gzip $WXDEST/wxX11-${WXVER}.tar ### wxMSW # cd $WXSRC -# cat $WXSRC/distrib/msw/msw.rsp $WXSRC/distrib/msw/vc.rsp $WXSRC/distrib/msw/bc.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp > /tmp/wxmsw_in.txt +# cat $WXSRC/distrib/msw/msw.rsp $WXSRC/distrib/msw/vc.rsp $WXSRC/distrib/msw/bc.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/deprecated.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp > /tmp/wxmsw_in.txt # expandlines /tmp/wxmsw_in.txt /tmp/wxmsw.txt # $TAR cf $WXDEST/wxMSW-${WXVER}.tar -T /tmp/wxmsw.txt # gzip $WXDEST/wxMSW-${WXVER}.tar @@ -142,7 +142,7 @@ echo Tarring wxMac... ### wxMac cp $WXSRC/include/wx/mac/setup0.h $WXSRC/include/wx/setup.h cd $WXSRC -cat $WXSRC/distrib/msw/mac.rsp $WXSRC/distrib/msw/generic.rsp $WXSRC/distrib/msw/cw_mac.rsp $WXSRC/distrib/msw/tex2rtf.rsp $WXSRC/distrib/msw/utils.rsp $WXSRC/distrib/msw/dialoged.rsp $WXSRC/distrib/msw/ogl.rsp $WXSRC/distrib/msw/stc.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp > /tmp/wxmac_in.txt +cat $WXSRC/distrib/msw/mac.rsp $WXSRC/distrib/msw/generic.rsp $WXSRC/distrib/msw/cw_mac.rsp $WXSRC/distrib/msw/tex2rtf.rsp $WXSRC/distrib/msw/utils.rsp $WXSRC/distrib/msw/dialoged.rsp $WXSRC/distrib/msw/ogl.rsp $WXSRC/distrib/msw/stc.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/deprecated.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp > /tmp/wxmac_in.txt expandlines /tmp/wxmac_in.txt /tmp/wxmac.txt $TAR cf $WXDEST/wxMac-${WXVER}.tar -T /tmp/wxmac.txt @@ -193,7 +193,7 @@ echo Tarring wxAll... ### wxAll: all distributions in one giant archive cd $WXSRC -cat $WXSRC/distrib/msw/generic.rsp $WXSRC/distrib/msw/msw.rsp $WXSRC/distrib/msw/vc.rsp $WXSRC/distrib/msw/cw.rsp $WXSRC/distrib/msw/cw_mac.rsp $WXSRC/distrib/msw/gtk.rsp $WXSRC/distrib/msw/x11.rsp $WXSRC/distrib/msw/motif.rsp $WXSRC/distrib/msw/mac.rsp $WXSRC/distrib/msw/os2.rsp $WXSRC/distrib/msw/x11.rsp $WXSRC/distrib/msw/univ.rsp $WXSRC/distrib/msw/mgl.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/utilmake.rsp $WXSRC/distrib/msw/utils.rsp $WXSRC/distrib/msw/mmedia.rsp $WXSRC/distrib/msw/tex2rtf.rsp $WXSRC/distrib/msw/stc.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/dialoged.rsp $WXSRC/distrib/msw/ogl.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp $WXSRC/distrib/msw/docsrc.rsp | uniq > /tmp/wxall_in.txt +cat $WXSRC/distrib/msw/generic.rsp $WXSRC/distrib/msw/msw.rsp $WXSRC/distrib/msw/vc.rsp $WXSRC/distrib/msw/cw.rsp $WXSRC/distrib/msw/cw_mac.rsp $WXSRC/distrib/msw/gtk.rsp $WXSRC/distrib/msw/x11.rsp $WXSRC/distrib/msw/motif.rsp $WXSRC/distrib/msw/mac.rsp $WXSRC/distrib/msw/os2.rsp $WXSRC/distrib/msw/x11.rsp $WXSRC/distrib/msw/univ.rsp $WXSRC/distrib/msw/mgl.rsp $WXSRC/distrib/msw/contrib.rsp $WXSRC/distrib/msw/deprecated.rsp $WXSRC/distrib/msw/utilmake.rsp $WXSRC/distrib/msw/utils.rsp $WXSRC/distrib/msw/mmedia.rsp $WXSRC/distrib/msw/tex2rtf.rsp $WXSRC/distrib/msw/stc.rsp $WXSRC/distrib/msw/xml.rsp $WXSRC/distrib/msw/dialoged.rsp $WXSRC/distrib/msw/ogl.rsp $WXSRC/distrib/msw/makefile.rsp $WXSRC/distrib/msw/tiff.rsp $WXSRC/distrib/msw/jpeg.rsp $WXSRC/distrib/msw/docsrc.rsp | uniq > /tmp/wxall_in.txt expandlines /tmp/wxall_in.txt /tmp/wxall.txt $TAR cf $WXDEST/wxAll-${WXVER}.tar -T /tmp/wxall.txt diff --git a/distrib/msw/tarwxall b/distrib/msw/tarwxall index b38bddd..eb4c107 100755 --- a/distrib/msw/tarwxall +++ b/distrib/msw/tarwxall @@ -66,7 +66,7 @@ rm -f $2/wxAll-${WXVER}*.tar.gz ### wxAll: all distributions in one giant archive cd $1 -cat $1/distrib/msw/generic.rsp $1/distrib/msw/msw.rsp $1/distrib/msw/vc.rsp $1/distrib/msw/cw.rsp $1/distrib/msw/cw_mac.rsp $1/distrib/msw/gtk.rsp $1/distrib/msw/x11.rsp $1/distrib/msw/motif.rsp $1/distrib/msw/mac.rsp $1/distrib/msw/os2.rsp $1/distrib/msw/x11.rsp $1/distrib/msw/univ.rsp $1/distrib/msw/mgl.rsp $1/distrib/msw/contrib.rsp $1/distrib/msw/utilmake.rsp $1/distrib/msw/utils.rsp $1/distrib/msw/mmedia.rsp $1/distrib/msw/tex2rtf.rsp $1/distrib/msw/stc.rsp $1/distrib/msw/xml.rsp $1/distrib/msw/dialoged.rsp $1/distrib/msw/ogl.rsp $1/distrib/msw/makefile.rsp $1/distrib/msw/tiff.rsp $1/distrib/msw/jpeg.rsp $1/distrib/msw/docsrc.rsp | uniq > /tmp/wxall_in.txt +cat $1/distrib/msw/generic.rsp $1/distrib/msw/msw.rsp $1/distrib/msw/vc.rsp $1/distrib/msw/cw.rsp $1/distrib/msw/cw_mac.rsp $1/distrib/msw/gtk.rsp $1/distrib/msw/x11.rsp $1/distrib/msw/motif.rsp $1/distrib/msw/mac.rsp $1/distrib/msw/os2.rsp $1/distrib/msw/x11.rsp $1/distrib/msw/univ.rsp $1/distrib/msw/mgl.rsp $1/distrib/msw/contrib.rsp $1/distrib/msw/deprecated.rsp $1/distrib/msw/utilmake.rsp $1/distrib/msw/utils.rsp $1/distrib/msw/mmedia.rsp $1/distrib/msw/tex2rtf.rsp $1/distrib/msw/stc.rsp $1/distrib/msw/xml.rsp $1/distrib/msw/dialoged.rsp $1/distrib/msw/ogl.rsp $1/distrib/msw/makefile.rsp $1/distrib/msw/tiff.rsp $1/distrib/msw/jpeg.rsp $1/distrib/msw/docsrc.rsp | uniq > /tmp/wxall_in.txt expandlines /tmp/wxall_in.txt /tmp/wxall.txt $TAR cf $2/wxAll-${WXVER}.tar -T /tmp/wxall.txt diff --git a/distrib/msw/tarwxmac b/distrib/msw/tarwxmac index 1e2b159..6b31256 100755 --- a/distrib/msw/tarwxmac +++ b/distrib/msw/tarwxmac @@ -70,7 +70,7 @@ cp $1/include/wx/mac/setup0.h $1/include/wx/setup.h echo Tarring... ### wxMac -cat $1/distrib/msw/mac.rsp $1/distrib/msw/generic.rsp $1/distrib/msw/cw_mac.rsp $1/distrib/msw/tex2rtf.rsp $1/distrib/msw/utils.rsp $1/distrib/msw/dialoged.rsp $1/distrib/msw/ogl.rsp $1/distrib/msw/stc.rsp $1/distrib/msw/xml.rsp $1/distrib/msw/contrib.rsp $1/distrib/msw/makefile.rsp $1/distrib/msw/tiff.rsp $1/distrib/msw/jpeg.rsp > /tmp/wxmac_in.txt +cat $1/distrib/msw/mac.rsp $1/distrib/msw/generic.rsp $1/distrib/msw/cw_mac.rsp $1/distrib/msw/tex2rtf.rsp $1/distrib/msw/utils.rsp $1/distrib/msw/dialoged.rsp $1/distrib/msw/ogl.rsp $1/distrib/msw/stc.rsp $1/distrib/msw/xml.rsp $1/distrib/msw/contrib.rsp $1/distrib/msw/deprecated.rsp $1/distrib/msw/makefile.rsp $1/distrib/msw/tiff.rsp $1/distrib/msw/jpeg.rsp > /tmp/wxmac_in.txt expandlines /tmp/wxmac_in.txt /tmp/wxmac.txt $TAR cf $2/wxMac-${WXVER}.tar -T /tmp/wxmac.txt diff --git a/distrib/msw/tarwxx11 b/distrib/msw/tarwxx11 index 065f67c..7869440 100755 --- a/distrib/msw/tarwxx11 +++ b/distrib/msw/tarwxx11 @@ -67,7 +67,7 @@ rm -f $2/wxX11-${WXVER} ### wxX11: combined wxMotif and wxX11 distributions cd $1 -cat $1/distrib/msw/generic.rsp $1/distrib/msw/motif.rsp $1/distrib/msw/x11.rsp $1/distrib/msw/univ.rsp $1/distrib/msw/contrib.rsp $1/distrib/msw/utils.rsp $1/distrib/msw/xml.rsp $1/distrib/msw/dialoged.rsp $1/distrib/msw/ogl.rsp $1/distrib/msw/makefile.rsp $1/distrib/msw/tiff.rsp $1/distrib/msw/jpeg.rsp > /tmp/wxx11_in.txt +cat $1/distrib/msw/generic.rsp $1/distrib/msw/motif.rsp $1/distrib/msw/x11.rsp $1/distrib/msw/univ.rsp $1/distrib/msw/contrib.rsp $1/distrib/msw/deprecated.rsp $1/distrib/msw/utils.rsp $1/distrib/msw/xml.rsp $1/distrib/msw/dialoged.rsp $1/distrib/msw/ogl.rsp $1/distrib/msw/makefile.rsp $1/distrib/msw/tiff.rsp $1/distrib/msw/jpeg.rsp > /tmp/wxx11_in.txt expandlines /tmp/wxx11_in.txt /tmp/wxx11.txt $TAR cf $2/wxX11-${WXVER}.tar -T /tmp/wxx11.txt diff --git a/distrib/msw/vc.rsp b/distrib/msw/vc.rsp index 6e3095d..0985a6c 100644 --- a/distrib/msw/vc.rsp +++ b/distrib/msw/vc.rsp @@ -185,18 +185,12 @@ samples/png/png.dsw samples/printing/printing.dsp samples/printing/printing.dsw -samples/proplist/proplist.dsp -samples/proplist/proplist.dsw - samples/propsize/propsize.dsp samples/propsize/propsize.dsw samples/regtest/regtest.dsp samples/regtest/regtest.dsw -samples/resource/resource.dsp -samples/resource/resource.dsw - samples/rotate/rotate.dsp samples/rotate/rotate.dsw @@ -238,9 +232,6 @@ samples/toolbar/toolbar.dsw samples/treectrl/treetest.dsp samples/treectrl/treetest.dsw -samples/treelay/treelay.dsp -samples/treelay/treelay.dsw - samples/typetest/typetest.dsp samples/typetest/typetest.dsw @@ -377,3 +368,15 @@ contrib/samples/fl/fl_sample3/fl_demo.dsw contrib/src/net/NetVC.dsp contrib/src/net/NetVC.dsw +contrib/src/deprecated/deprecated.dsp + +contrib/samples/deprecated/proplist/proplist.dsp +contrib/samples/deprecated/proplist/proplist.dsw + +contrib/samples/deprecated/resource/resource.dsp +contrib/samples/deprecated/resource/resource.dsw + +contrib/samples/deprecated/treelay/treelay.dsp +contrib/samples/deprecated/treelay/treelay.dsw + + diff --git a/distrib/msw/zipdistinno.bat b/distrib/msw/zipdistinno.bat index 63f0644..f321de1 100755 --- a/distrib/msw/zipdistinno.bat +++ b/distrib/msw/zipdistinno.bat @@ -74,6 +74,7 @@ zip32 -u -@ %dest%\wxOS2-%version%.zip < %src%\distrib\msw\dialoged.rsp zip32 -u -@ %dest%\wxOS2-%version%.zip < %src%\distrib\msw\ogl.rsp zip32 -u -@ %dest%\wxOS2-%version%.zip < %src%\distrib\msw\xml.rsp zip32 -u -@ %dest%\wxOS2-%version%.zip < %src%\distrib\msw\contrib.rsp +zip32 -u -@ %dest%\wxOS2-%version%.zip < %src%\distrib\msw\deprecated.rsp zip32 -u -@ %dest%\wxOS2-%version%.zip < %src%\distrib\msw\makefile.rsp Rem Rearchive under wxWindows-%version% @@ -117,6 +118,7 @@ zip32 -u -@ %dest%\wxMac-%version%.zip < %src%\distrib\msw\ogl.rsp zip32 -u -@ %dest%\wxMac-%version%.zip < %src%\distrib\msw\xml.rsp zip32 -u -@ %dest%\wxMac-%version%.zip < %src%\distrib\msw\stc.rsp zip32 -u -@ %dest%\wxMac-%version%.zip < %src%\distrib\msw\contrib.rsp +zip32 -u -@ %dest%\wxMac-%version%.zip < %src%\distrib\msw\deprecated.rsp zip32 -u -@ %dest%\wxMac-%version%.zip < %src%\distrib\msw\makefile.rsp zip32 -@ %dest%\wxWindows-%version%-CW-Mac.zip < %src%\distrib\msw\cw_mac.rsp @@ -151,6 +153,7 @@ zip32 -@ -u %dest\wxWindows-%version%-win.zip < %src\distrib\msw\jpeg.rsp zip32 -@ -u %dest\wxWindows-%version%-win.zip < %src\distrib\msw\tiff.rsp zip32 -@ -u %dest\wxWindows-%version%-win.zip < %src\distrib\msw\xml.rsp zip32 -@ -u %dest\wxWindows-%version%-win.zip < %src\distrib\msw\contrib.rsp +zip32 -@ -u %dest\wxWindows-%version%-win.zip < %src\distrib\msw\deprecated.rsp zip32 -@ -u %dest\wxWindows-%version%-win.zip < %src\distrib\msw\dialoged.rsp zip32 -@ -u %dest\wxWindows-%version%-win.zip < %src\distrib\msw\utils.rsp zip32 -@ -u %dest\wxWindows-%version%-win.zip < %src\distrib\msw\utilmake.rsp diff --git a/docs/html/index.htm b/docs/html/index.htm index 2e1d6eb..2af586b 100644 --- a/docs/html/index.htm +++ b/docs/html/index.htm @@ -343,7 +343,6 @@ dynamically.
  • exec: demonstrates wxExecute.
  • font: tests fonts, font enumerator, font encodings.
  • grid: demonstrates the wxGrid class. -Please see newgrid below for a full demo of the new implementation's capabilities.
  • help: shows how to use wxHelpController.
  • html: a number of demos for the wxHTML class library, used inside applications and also as a help facility. @@ -384,10 +383,8 @@ Excel to be present).
  • ownerdrw: demonstrates owner-draw menus and controls (Windows only).
  • png: demonstrates PNG loading.
  • printing: shows printing and previewing. -
  • proplist: demonstrates the property list classes (a VB-style property editor).
  • propsize: demonstrates proportional sizer classes.
  • regtest: tests the low-level Windows registry functions (Windows only). -
  • resource: shows how to use wxWindows resources (.wxr files). @@ -416,6 +413,15 @@ wxTime, wxDate and wxVariant.
  • wizard: demonstrates the wxWizard class. +The following are deprecated samples. + +
      +
    • resource: shows how to use old-style wxWindows resources (.wxr files). +
    • proplist: demonstrates the property list classes (a VB-style property editor). +
    • treelay: an algorithm for displaying tree hierarchies. +
    + +

    diff --git a/include/wx/expr.h b/include/wx/expr.h deleted file mode 100644 index 90c2337..0000000 --- a/include/wx/expr.h +++ /dev/null @@ -1,68 +0,0 @@ -/* ////////////////////////////////////////////////////////////////////////// -// Name: expr.h -// Purpose: C helper defines and functions for wxExpr class -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) -// Licence: wxWindows licence -////////////////////////////////////////////////////////////////////////// */ - -#ifndef _WX_EXPRH__ -#define _WX_EXPRH__ - -#include -#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 -# undef __BSEXCPT__ -#endif -#include - -#ifdef ____HPUX__ -#define alloca malloc -#endif - - -#ifdef __cplusplus -extern "C" { -char *proio_cons(char *, char *); -char * wxmake_integer(char *); -char * wxmake_word(char *); -char * wxmake_string(char *); -char * wxmake_real(char *, char *); -char * wxmake_exp(char *, char *); -char * wxmake_exp2(char *, char *, char*); -void add_expr(char *); -void process_command(char *); -void syntax_error(char *); -} -#else -#if defined(__BORLANDC__) || defined(__VISAGECPP__) -char *proio_cons(char *, char *); -char * wxmake_integer(char *); -char * wxmake_word(char *); -char * wxmake_string(char *); -char * wxmake_real(char *, char *); -char * wxmake_exp(char *, char *); -char * wxmake_exp2(char *, char *, char*); -void add_expr(char *); -void process_command(char *); -void syntax_error(char *); -int lex_input(void); -#else -char *proio_cons(); -char * wxmake_integer(); -char * wxmake_word(); -char * wxmake_string(); -char * wxmake_real(); -char * wxmake_exp(); -char * wxmake_exp2(); - -void add_expr(); -void process_command(); -void syntax_error(); -#endif -#endif - -#endif - /* _WX_EXPRH__ */ diff --git a/include/wx/resource.h b/include/wx/resource.h deleted file mode 100644 index fce8cf1..0000000 --- a/include/wx/resource.h +++ /dev/null @@ -1,208 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: resource.h -// Purpose: Resource processing -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_RESOURCEH__ -#define _WX_RESOURCEH__ - -#if defined(__GNUG__) && !defined(__APPLE__) -#pragma interface "resource.h" -#endif - -#include "wx/setup.h" - -#if wxUSE_WX_RESOURCES - -#include "wx/bitmap.h" -#include - -// A few further types not in wx_types.h -#define wxRESOURCE_TYPE_SEPARATOR 1000 -#define wxRESOURCE_TYPE_XBM_DATA 1001 -#define wxRESOURCE_TYPE_XPM_DATA 1002 - -#define RESOURCE_PLATFORM_WINDOWS 1 -#define RESOURCE_PLATFORM_X 2 -#define RESOURCE_PLATFORM_MAC 3 -#define RESOURCE_PLATFORM_ANY 4 - -// Extended styles: for resource usage only - -// Use dialog units instead of pixels -#define wxRESOURCE_DIALOG_UNITS 0x0001 -// Use default system colour and font -#define wxRESOURCE_USE_DEFAULTS 0x0002 -// Old-style vertical label -#define wxRESOURCE_VERTICAL_LABEL 0x0004 -// Old-style horizontal label -#define wxRESOURCE_HORIZONTAL_LABEL 0x0008 - -// Macros to help use dialog units -#define wxDLG_POINT(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxPoint(x, y)) : wxPoint(x, y)) -#define wxDLG_SIZE(x, y, parent, useDlgUnits) (useDlgUnits ? parent->ConvertDialogToPixel(wxSize(x, y)) : wxSize(x, y)) - -#ifdef FindResource -#undef FindResource -#endif - -class WXDLLEXPORT wxInputStream; - -/* - * Internal format for control/panel item - */ - -class WXDLLEXPORT wxItemResource: public wxObject -{ - DECLARE_DYNAMIC_CLASS(wxItemResource) - - public: - - wxItemResource(); - ~wxItemResource(); - - inline void SetType(const wxString& type) { m_itemType = type; } - inline void SetStyle(long styl) { m_windowStyle = styl; } - inline void SetId(int id) { m_windowId = id; } - inline void SetBitmap(const wxBitmap& bm) { m_bitmap = bm; } - inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; } - inline void SetFont(const wxFont& font) { m_windowFont = font; } - inline wxFont& GetFont() const { return (wxFont&) m_windowFont; } - inline void SetSize(int xx, int yy, int ww, int hh) - { m_x = xx; m_y = yy; m_width = ww; m_height = hh; } - inline void SetTitle(const wxString& title) { m_title = title; } - inline void SetName(const wxString& name) { m_name = name; } - inline void SetValue1(long v) { m_value1 = v; } - inline void SetValue2(long v) { m_value2 = v; } - inline void SetValue3(long v) { m_value3 = v; } - inline void SetValue5(long v) { m_value5 = v; } - inline void SetValue4(const wxString& v) { m_value4 = v; } - inline void SetStringValues(const wxStringList& svalues) { m_stringValues = svalues; } - - inline const wxString& GetType() const { return m_itemType; } - inline int GetX() const { return m_x; } - inline int GetY() const { return m_y; } - inline int GetWidth() const { return m_width; } - inline int GetHeight() const { return m_height; } - - inline const wxString& GetTitle() const { return m_title; } - inline const wxString& GetName() const { return m_name; } - inline long GetStyle() const { return m_windowStyle; } - inline int GetId() const { return m_windowId; } - - inline wxInt32 GetValue1() const { return m_value1; } - inline wxInt32 GetValue2() const { return m_value2; } - inline wxInt32 GetValue3() const { return m_value3; } - inline wxInt32 GetValue5() const { return m_value5; } - inline wxString GetValue4() const { return m_value4; } - inline wxList& GetChildren() const { return (wxList&) m_children; } - inline wxStringList& GetStringValues() const { return (wxStringList&) m_stringValues; } - - inline void SetBackgroundColour(const wxColour& col) { m_backgroundColour = col; } - inline void SetLabelColour(const wxColour& col) { m_labelColour = col; } - inline void SetButtonColour(const wxColour& col) { m_buttonColour = col; } - - inline wxColour& GetBackgroundColour() const { return (wxColour&) m_backgroundColour; } - inline wxColour& GetLabelColour() const { return (wxColour&) m_labelColour; } - inline wxColour& GetButtonColour() const { return (wxColour&) m_buttonColour; } - - inline void SetResourceStyle(long style) { m_exStyle = style; } - inline wxInt32 GetResourceStyle() const { return m_exStyle; } - - protected: - wxList m_children; - wxString m_itemType; - int m_x, m_y, m_width, m_height; - wxString m_title; - wxString m_name; - long m_windowStyle; - long m_value1, m_value2, m_value3, m_value5; - wxString m_value4; - int m_windowId; - wxStringList m_stringValues; // Optional string values - wxBitmap m_bitmap; - wxColour m_backgroundColour; - wxColour m_labelColour; - wxColour m_buttonColour; - wxFont m_windowFont; - long m_exStyle; // Extended, resource-specific styles -}; - -/* - * Resource table (normally only one of these) - */ - -class WXDLLEXPORT wxResourceTable: public wxHashTable -{ - DECLARE_DYNAMIC_CLASS(wxResourceTable) - - protected: - - public: - wxHashTable identifiers; - - wxResourceTable(); - ~wxResourceTable(); - - virtual wxItemResource *FindResource(const wxString& name) const; - virtual void AddResource(wxItemResource *item); - virtual bool DeleteResource(const wxString& name); - - virtual bool ParseResourceFile(const wxString& filename); - virtual bool ParseResourceFile(wxInputStream *is); - virtual bool ParseResourceData(const wxString& data); - virtual bool SaveResource(const wxString& filename); - - // Register XBM/XPM data - virtual bool RegisterResourceBitmapData(const wxString& name, char bits[], int width, int height); - virtual bool RegisterResourceBitmapData(const wxString& name, char **data); - - virtual wxControl *CreateItem(wxWindow *panel, const wxItemResource* childResource, const wxItemResource* parentResource) const; - - virtual void ClearTable(); -}; - -WXDLLEXPORT extern void wxInitializeResourceSystem(); -WXDLLEXPORT extern void wxCleanUpResourceSystem(); - -WXDLLEXPORT_DATA(extern wxResourceTable*) wxDefaultResourceTable; -WXDLLEXPORT extern long wxParseWindowStyle(const wxString& style); - -class WXDLLEXPORT wxMenuBar; -class WXDLLEXPORT wxMenu; -class WXDLLEXPORT wxBitmap; -class WXDLLEXPORT wxIcon; -WXDLLEXPORT extern wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL); -WXDLLEXPORT extern wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL); -WXDLLEXPORT extern wxMenuBar* wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL, wxMenuBar *menuBar = (wxMenuBar *) NULL); -WXDLLEXPORT extern wxMenu* wxResourceCreateMenu(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL); -WXDLLEXPORT extern bool wxResourceParseData(const wxString& resource, wxResourceTable *table = (wxResourceTable *) NULL); -WXDLLEXPORT extern bool wxResourceParseData(const char* resource, wxResourceTable *table = (wxResourceTable *) NULL); -WXDLLEXPORT extern bool wxResourceParseFile(const wxString& filename, wxResourceTable *table = (wxResourceTable *) NULL); -WXDLLEXPORT extern bool wxResourceParseString(char* s, wxResourceTable *table = (wxResourceTable *) NULL); -WXDLLEXPORT extern bool wxResourceParseString(const wxString& s, wxResourceTable *table = (wxResourceTable *) NULL); -WXDLLEXPORT extern void wxResourceClear(wxResourceTable *table = (wxResourceTable *) NULL); -// Register XBM/XPM data -WXDLLEXPORT extern bool wxResourceRegisterBitmapData(const wxString& name, char bits[], int width, int height, wxResourceTable *table = (wxResourceTable *) NULL); -WXDLLEXPORT extern bool wxResourceRegisterBitmapData(const wxString& name, char **data, wxResourceTable *table = (wxResourceTable *) NULL); -#define wxResourceRegisterIconData wxResourceRegisterBitmapData - -/* - * Resource identifer code: #define storage - */ - -WXDLLEXPORT extern bool wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *table = (wxResourceTable *) NULL); -WXDLLEXPORT extern int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table = (wxResourceTable *) NULL); - -#if defined(__WXPM__) -#include "wx/os2/wxrsc.h" -#endif -#endif -#endif - // _WX_RESOURCEH__ diff --git a/include/wx/treelay.h b/include/wx/treelay.h deleted file mode 100644 index 1bd61c5..0000000 --- a/include/wx/treelay.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _WX_TREELAY_H_BASE_ -#define _WX_TREELAY_H_BASE_ - -#include "wx/generic/treelay.h" - -#endif - // _WX_TREELAY_H_BASE_ diff --git a/include/wx/wxexpr.h b/include/wx/wxexpr.h deleted file mode 100644 index 304aeb0..0000000 --- a/include/wx/wxexpr.h +++ /dev/null @@ -1,283 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wxexpr.h -// Purpose: Prolog-like file I/O, used by resource system. -// Author: Julian Smart -// Modified by: -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifndef _WX_WXEXPRH__ -#define _WX_WXEXPRH__ - -#if defined(__GNUG__) && !defined(__APPLE__) -#pragma interface "wxexpr.h" -#endif - -#if wxUSE_PROLOGIO - -#include "wx/defs.h" -#include "wx/string.h" - -#include "wx/list.h" -#include "wx/hash.h" - -#include "wx/expr.h" - -#include - -// Compatibility -#define PrologExpr wxExpr -#define PrologDatabase wxExprDatabase -#define proioErrorHandler wxExprErrorHandler -#define PROIO_ERROR_GENERAL 1 -#define PROIO_ERROR_SYNTAX 2 -#define PrologNull wxExprNull -#define PrologInteger wxExprInteger -#define PrologReal wxExprReal -#define PrologWord wxExprWord -#define PrologString wxExprString -#define PrologList wxExprList -#define PrologType wxExprType - -// Error types -#define WXEXPR_ERROR_GENERAL 1 -#define WXEXPR_ERROR_SYNTAX 2 - -// Error handler function definition. If app returns TRUE, -// carry on processing. -typedef bool (*wxExprErrorHandler) (int errorType, char *msg); - -WXDLLEXPORT_DATA(extern wxExprErrorHandler) currentwxExprErrorHandler; - - -typedef enum { - wxExprNull, - wxExprInteger, - wxExprReal, - wxExprWord, - wxExprString, - wxExprList -} wxExprType; - -class WXDLLEXPORT wxExprDatabase; - -class WXDLLEXPORT wxExpr -{ - public: - wxObject *client_data; - wxExprType type; - union { - long integer; - wxChar *word; - wxChar *string; - double real; - wxExpr *first; // If is a list expr, points to the first node - } value; - - wxExpr *next; // If this is a node in a list, points to the next node - wxExpr *last; // If is a list expr, points to the last node - - wxExpr(wxExprType the_type, wxChar *word_or_string, bool allocate); - wxExpr(const wxString& functor); // Assume this is a new clause - pass functor - wxExpr(wxExprType the_type, const wxString& word_or_string = wxT("")); - wxExpr(long the_integer); - wxExpr(double the_real); - wxExpr(wxList *the_list); - ~wxExpr(void); - - inline wxExprType Type(void) const { return type; } - inline long IntegerValue(void) const - { - if (type == wxExprInteger) - return value.integer; - else if (type == wxExprReal) - return (long)value.real; - else return 0; - } - - inline double RealValue(void) const { - if (type == wxExprReal) - return value.real; - else if (type == wxExprInteger) - return (double)value.integer; - else return (double)0.0; - } - - inline wxString WordValue(void) const { - if (type == wxExprWord) - return value.word; - else if (type == wxExprString) - return wxString(value.string); - else return wxString(wxT("")); - } - - inline wxString StringValue(void) const { - if (type == wxExprString) - return wxString(value.string); - else if (type == wxExprWord) - return wxString(value.word); - else return wxString(wxT("")); - } - - // Get nth arg of clause (starting from 1) - wxExpr *Arg(wxExprType type, int arg) const; - - // Return nth argument of a list expression (starting from zero) - wxExpr *Nth(int arg) const; - - // Returns the number of elements in a list expression - int Number(void) const; - - // Make a clone - wxExpr *Copy(void) const; - - wxExpr *GetAttributeValueNode(const wxString& word) const; // Use only for a clause or list - wxExpr *AttributeValue(const wxString& word) const; // Use only for a clause - wxString Functor(void) const; // Only for a clause - bool IsFunctor(const wxString& s) const; // Only for a clause - void WriteClause(FILE* stream); // Write this expression as a top-level clause - void WriteExpr(FILE* stream); // Write as any other subexpression - - // Append an expression to a list - void Append(wxExpr *expr); - // Insert at beginning of list - void Insert(wxExpr *expr); - - // Get first expr in list - inline wxExpr *GetFirst(void) const { return ((type == wxExprList) ? value.first : (wxExpr*)NULL); } - - // Get next expr if this is a node in a list - inline wxExpr *GetNext(void) const { return next; } - - // Get last expr in list - inline wxExpr *GetLast(void) const { return ((type == wxExprList) ? last : (wxExpr*)NULL); } - - // This should really be called SetAttributeValue since any existing - // attribute-value is deleted first. - void AddAttributeValue(const wxString& attribute, long value); - void AddAttributeValue(const wxString& attribute, double value); - void AddAttributeValueWord(const wxString& attribute, const wxString& value); - void AddAttributeValueString(const wxString& attribute, const wxString& value); - void AddAttributeValue(const wxString& attribute, wxList *value); - void AddAttributeValue(const wxString& attribute, wxExpr *value); - void AddAttributeValueStringList(const wxString& attribute, wxList *string_list); - - void DeleteAttributeValue(const wxString& attribute); - - bool GetAttributeValue(const wxString& att, int& var) const; - bool GetAttributeValue(const wxString& att, long& var) const; - bool GetAttributeValue(const wxString& att, float& var) const; - bool GetAttributeValue(const wxString& att, double& var) const; - bool GetAttributeValue(const wxString& att, wxString& var) const; // Word OR string -> string - bool GetAttributeValue(const wxString& att, wxExpr **var) const; - - // Compatibility with old PrologIO - inline void AssignAttributeValue(wxChar *att, int *var) const { GetAttributeValue(att, *var); } - inline void AssignAttributeValue(wxChar *att, long *var) const { GetAttributeValue(att, *var); } - inline void AssignAttributeValue(wxChar *att, float *var) const { GetAttributeValue(att, *var); } - inline void AssignAttributeValue(wxChar *att, double *var) const { GetAttributeValue(att, *var); } - inline void AssignAttributeValue(wxChar *att, wxExpr **var) const { GetAttributeValue(att, var); } - void AssignAttributeValue(wxChar *att, wxChar **var) const ; // Word OR string -> string - - // Add string items to list if the list attribute exists - bool GetAttributeValueStringList(const wxString& att, wxList *var) const; - - // Associate other data with this expression, e.g. when reading in a - // number of linked items - store C++ object pointer with the expression - // so we can index into the wxExpr database and fish out the pointer. - inline void SetClientData(wxObject *data) { client_data = data; } - inline wxObject *GetClientData(void) const { return client_data; } - - DECLARE_NO_COPY_CLASS(wxExpr) -}; - -class WXDLLEXPORT wxExprDatabase: public wxList -{ -private: - wxNode *position; // Where we are in a search - wxHashTable *hash_table; - wxString attribute_to_hash; - -public: - int noErrors; - - wxExprDatabase(wxExprErrorHandler handler = 0); - - // Use hashing on both the functor, and the attribute of - // specified type (wxExprString or wxExprInteger) and name. - // So to find node 45 - // (i.e. match the clause node(id=45, ...)) - // it usually requires 1 look-up: the keys for functor and attribute - // are added together. - // Obviously if the attribute was missing in a clause, it would - // fail to be found by this method, but could be retrieved by a - // linear search using BeginFind and FindClauseByFunctor, - // or just searching through the list as per usual. - - wxExprDatabase(wxExprType type, const wxString& attribute, int size = 500, - wxExprErrorHandler handler = 0); - - ~wxExprDatabase(void); - - void BeginFind(void) ; // Initialise a search - wxExpr *FindClause(long id) ; // Find a term based on an integer id attribute - // e.g. node(id=23, type=rectangle, ....). - - // Find on basis of attribute/value pairs, e.g. type=rectangle - // This doesn't use hashing; it's a linear search. - wxExpr *FindClause(const wxString& word, const wxString& value); - wxExpr *FindClause(const wxString& word, long value); - wxExpr *FindClause(const wxString& word, double value); - wxExpr *FindClauseByFunctor(const wxString& functor); - - wxExpr *HashFind(const wxString& functor, const wxString& value) const; - wxExpr *HashFind(const wxString& functor, long value) const; - - void Append(wxExpr *expr); // Does cleverer things if hashing is on - void ClearDatabase(void); - inline int GetErrorCount() const { return noErrors; } - bool Read(const wxString& filename); - bool ReadFromString(const wxString& buffer); - bool Write(const wxString& fileName); - bool Write(FILE* stream); - - // Compatibility - inline bool ReadProlog(wxChar *filename) { return Read(wxString(filename)); } - inline bool ReadPrologFromString(char *buffer) - { - return ReadFromString(wxString(buffer, wxConvLibc)); - } - inline void WriteProlog(FILE* stream) { Write(stream); } - -private: - DECLARE_DYNAMIC_CLASS(wxExprDatabase) - DECLARE_NO_COPY_CLASS(wxExprDatabase) -}; - -// Function call-style interface - some more convenience wrappers/unwrappers - -// Make a call -WXDLLEXPORT wxExpr* wxExprMakeCall(const wxString& functor ...); - -#define wxExprMakeInteger(x) (new wxExpr((long)x)) -#define wxExprMakeReal(x) (new wxExpr((double)x)) -#define wxExprMakeString(x) (new wxExpr(wxExprString, x)) -#define wxExprMakeWord(x) (new wxExpr(wxExprWord, x)) -#define wxExprMake(x) (new wxExpr(x)) - -// Checks functor -WXDLLEXPORT bool wxExprIsFunctor(wxExpr *expr, const wxString& functor); - -// Temporary variable for communicating between wxexpr.cpp and YACC/LEX -WXDLLEXPORT_DATA(extern wxExprDatabase*) thewxExprDatabase; - -// YACC/LEX can leave memory lying around... -extern "C" WXDLLEXPORT int wxExprCleanUp(); - -#endif // wxUSE_PROLOGIO - -#endif // _WX_WXEXPRH__ - diff --git a/samples/configure b/samples/configure index b4469a6..7256cce 100755 --- a/samples/configure +++ b/samples/configure @@ -700,10 +700,8 @@ trap 'rm -fr `echo " ownerdrw/Makefile png/Makefile printing/Makefile - proplist/Makefile propsize/Makefile regtest/Makefile - resource/Makefile rotate/Makefile sashtest/Makefile shaped/Makefile @@ -717,7 +715,6 @@ trap 'rm -fr `echo " thread/Makefile toolbar/Makefile treectrl/Makefile - treelay/Makefile typetest/Makefile validate/Makefile widgets/Makefile diff --git a/samples/configure.in b/samples/configure.in index bef7930..04e6fd9 100644 --- a/samples/configure.in +++ b/samples/configure.in @@ -70,10 +70,8 @@ AC_OUTPUT([ ownerdrw/Makefile png/Makefile printing/Makefile - proplist/Makefile propsize/Makefile regtest/Makefile - resource/Makefile rotate/Makefile sashtest/Makefile shaped/Makefile @@ -87,7 +85,6 @@ AC_OUTPUT([ thread/Makefile toolbar/Makefile treectrl/Makefile - treelay/Makefile typetest/Makefile validate/Makefile widgets/Makefile diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index e7a4b69..0801b54 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -29,12 +29,6 @@ #define USE_METAFILES #endif // Windows -#define USE_RESOURCES 0 -#if !wxUSE_RESOURCES -#undef USE_RESOURCES -#define USE_RESOURCES 0 -#endif - #include "wx/intl.h" #include "wx/log.h" @@ -44,11 +38,7 @@ #include "wx/image.h" #include "wx/clipbrd.h" #include "wx/colordlg.h" -#if USE_RESOURCES - #include "wx/resource.h" -#else - #include "wx/sizer.h" -#endif +#include "wx/sizer.h" #ifdef USE_METAFILES #include "wx/metafile.h" @@ -347,7 +337,7 @@ protected: //get a point 1 up and 1 left, otherwise the mid-point of a triangle is on the line wxPoint GetCentre() const { return wxPoint(m_pos.x + m_size.x / 2 - 1, m_pos.y + m_size.y / 2 - 1); } - + struct ShapeDump { int x, y, // position @@ -393,7 +383,7 @@ public: dc.DrawLine(p3, p1); //works in multicolor modes; on GTK (at least) will fail in 16-bit color - dc.SetBrush(wxBrush(m_col, wxSOLID)); + dc.SetBrush(wxBrush(m_col, wxSOLID)); dc.FloodFill(GetCentre(), m_col, wxFLOOD_BORDER); } }; @@ -874,27 +864,6 @@ END_EVENT_TABLE() // `Main program' equivalent, creating windows and returning main app frame bool DnDApp::OnInit() { -#if USE_RESOURCES - // load our ressources - wxPathList pathList; - pathList.Add(_T(".")); -#ifdef __WXMSW__ - pathList.Add(_T("./Debug")); - pathList.Add(_T("./Release")); -#endif // wxMSW - - wxString path = pathList.FindValidPath(_T("dnd.wxr")); - if ( !path ) - { - wxLogError(wxT("Can't find the resource file dnd.wxr in the current ") - wxT("directory, aborting.")); - - return FALSE; - } - - wxDefaultResourceTable->ParseResourceFile(path); -#endif - // switch on trace messages #if defined(__WXGTK__) wxLog::AddTraceMask(_T("clipboard")); @@ -1496,23 +1465,11 @@ bool DnDFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames) // ---------------------------------------------------------------------------- DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape) -#if !USE_RESOURCES :wxDialog( parent, 6001, wxT("Choose Shape"), wxPoint( 10, 10 ), wxSize( 40, 40 ), wxRAISED_BORDER|wxCAPTION|wxTHICK_FRAME|wxSYSTEM_MENU ) -#endif { m_shape = shape; -#if USE_RESOURCES - LoadFromResource(parent, _T("dialogShape")); - - m_textX = (wxTextCtrl *)wxFindWindowByName(_T("textX"), this); - m_textY = (wxTextCtrl *)wxFindWindowByName(_T("textY"), this); - m_textW = (wxTextCtrl *)wxFindWindowByName(_T("textW"), this); - m_textH = (wxTextCtrl *)wxFindWindowByName(_T("textH"), this); - - m_radio = (wxRadioBox *)wxFindWindowByName(_T("radio"), this); -#else wxBoxSizer* topSizer = new wxBoxSizer( wxVERTICAL ); // radio box @@ -1574,7 +1531,6 @@ DnDShapeDialog::DnDShapeDialog(wxFrame *parent, DnDShape *shape) SetAutoLayout( TRUE ); SetSizer( topSizer ); topSizer->Fit( this ); -#endif } DnDShape *DnDShapeDialog::GetShape() const diff --git a/samples/makefile.b32 b/samples/makefile.b32 index a0b2484..d699a75 100644 --- a/samples/makefile.b32 +++ b/samples/makefile.b32 @@ -121,12 +121,8 @@ all: make -f makefile.b32 FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\printing make -f makefile.b32 FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) - cd $(WXDIR)\samples\proplist - make -f makefile.b32 FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\regtest make -f makefile.b32 FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) - cd $(WXDIR)\samples\resource - make -f makefile.b32 FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\rotate make -f makefile.b32 FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\sashtest @@ -169,8 +165,6 @@ all: make -f makefile.b32 FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\tab make -f makefile.b32 FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) - cd $(WXDIR)\samples\treelay - make -f makefile.b32 FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\erase make -f makefile.b32 FINAL=$(FINAL) WXUSINGDLL=$(WXUSINGDLL) cd $(WXDIR)\samples\event @@ -253,12 +247,8 @@ clean: make -f makefile.b32 clean cd $(WXDIR)\samples\printing make -f makefile.b32 clean - cd $(WXDIR)\samples\proplist - make -f makefile.b32 clean cd $(WXDIR)\samples\regtest make -f makefile.b32 clean - cd $(WXDIR)\samples\resource - make -f makefile.b32 clean cd $(WXDIR)\samples\rotate make -f makefile.b32 clean cd $(WXDIR)\samples\sashtest @@ -301,8 +291,6 @@ clean: make -f makefile.b32 clean cd $(WXDIR)\samples\sockets make -f makefile.b32 clean - cd $(WXDIR)\samples\treelay - make -f makefile.b32 clean cd $(WXDIR)\samples\treectrl make -f makefile.b32 clean cd $(WXDIR)\samples\tab diff --git a/samples/makefile.dos b/samples/makefile.dos index 463c0f0..4aa5e3f 100644 --- a/samples/makefile.dos +++ b/samples/makefile.dos @@ -116,14 +116,10 @@ all: !endif cd $(WXDIR)\samples\printing nmake -f makefile.dos FINAL=$(FINAL) - cd $(WXDIR)\samples\proplist - nmake -f makefile.dos FINAL=$(FINAL) !if "$(NOMAKE)"=="" cd $(WXDIR)\samples\regtest nmake -f makefile.dos FINAL=$(FINAL) !endif - cd $(WXDIR)\samples\resource - nmake -f makefile.dos FINAL=$(FINAL) !if "$(NOMAKE)"=="" cd $(WXDIR)\samples\sashtest nmake -f makefile.dos FINAL=$(FINAL) @@ -239,14 +235,10 @@ clean: !endif cd $(WXDIR)\samples\printing nmake -f makefile.dos clean - cd $(WXDIR)\samples\proplist - nmake -f makefile.dos clean !if "$(NOMAKE)"=="" cd $(WXDIR)\samples\regtest nmake -f makefile.dos clean !endif - cd $(WXDIR)\samples\resource - nmake -f makefile.dos clean !if "$(NOMAKE)"=="" cd $(WXDIR)\samples\sashtest nmake -f makefile.dos clean diff --git a/samples/makefile.g95 b/samples/makefile.g95 index 8258547..04db09b 100644 --- a/samples/makefile.g95 +++ b/samples/makefile.g95 @@ -63,10 +63,8 @@ all clean: -$(MAKE) -C ownerdrw $(CMDLINE) $@ -$(MAKE) -C png $(CMDLINE) $@ -$(MAKE) -C printing $(CMDLINE) $@ - -$(MAKE) -C proplist $(CMDLINE) $@ -$(MAKE) -C propsize $(CMDLINE) $@ -$(MAKE) -C regtest $(CMDLINE) $@ - -$(MAKE) -C resource $(CMDLINE) $@ -$(MAKE) -C rotate $(CMDLINE) $@ -$(MAKE) -C sashtest $(CMDLINE) $@ -$(MAKE) -C scroll $(CMDLINE) $@ @@ -80,7 +78,6 @@ all clean: -$(MAKE) -C thread $(CMDLINE) $@ -$(MAKE) -C toolbar $(CMDLINE) $@ -$(MAKE) -C treectrl $(CMDLINE) $@ - -$(MAKE) -C treelay $(CMDLINE) $@ -$(MAKE) -C typetest $(CMDLINE) $@ -$(MAKE) -C validate $(CMDLINE) $@ -$(MAKE) -C widgets $(CMDLINE) $@ diff --git a/samples/makefile.vc b/samples/makefile.vc index 2f18c36..99e8b8c 100644 --- a/samples/makefile.vc +++ b/samples/makefile.vc @@ -118,12 +118,8 @@ all: nmake -f makefile.vc $(MAKEFLAGS) cd $(WXDIR)\samples\printing nmake -f makefile.vc $(MAKEFLAGS) - cd $(WXDIR)\samples\proplist - nmake -f makefile.vc $(MAKEFLAGS) cd $(WXDIR)\samples\regtest nmake -f makefile.vc $(MAKEFLAGS) - cd $(WXDIR)\samples\resource - nmake -f makefile.vc $(MAKEFLAGS) cd $(WXDIR)\samples\rotate nmake -f makefile.vc $(MAKEFLAGS) cd $(WXDIR)\samples\sashtest @@ -228,12 +224,8 @@ clean: nmake -f makefile.vc clean cd $(WXDIR)\samples\printing nmake -f makefile.vc clean - cd $(WXDIR)\samples\proplist - nmake -f makefile.vc clean cd $(WXDIR)\samples\regtest nmake -f makefile.vc clean - cd $(WXDIR)\samples\resource - nmake -f makefile.vc clean cd $(WXDIR)\samples\rotate nmake -f makefile.vc clean cd $(WXDIR)\samples\sashtest diff --git a/samples/nativdlg/nativdlg.cpp b/samples/nativdlg/nativdlg.cpp index cccb7e2..69a9c42 100644 --- a/samples/nativdlg/nativdlg.cpp +++ b/samples/nativdlg/nativdlg.cpp @@ -28,8 +28,6 @@ #error Sorry, this sample is only appropriate under Windows. #endif -#include "wx/resource.h" - #include #include "nativdlg.h" #include "resource.h" diff --git a/samples/samples.dsw b/samples/samples.dsw index 6a411b9..9426dbb 100644 --- a/samples/samples.dsw +++ b/samples/samples.dsw @@ -627,18 +627,6 @@ Package=<4> ############################################################################### -Project: "proplist"=.\proplist\proplist.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - Project: "propsize"=.\propsize\propsize.dsp - Package Owner=<4> Package=<5> @@ -663,18 +651,6 @@ Package=<4> ############################################################################### -Project: "resource"=.\resource\resource.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - Project: "rotate"=.\rotate\rotate.dsp - Package Owner=<4> Package=<5> @@ -831,18 +807,6 @@ Package=<4> ############################################################################### -Project: "treelay"=.\treelay\treelay.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - Project: "typetest"=.\typetest\typetest.dsp - Package Owner=<4> Package=<5> diff --git a/src/common/cwlex_yy.c b/src/common/cwlex_yy.c deleted file mode 100644 index 3f67562..0000000 --- a/src/common/cwlex_yy.c +++ /dev/null @@ -1,1214 +0,0 @@ -/* A lexical scanner generated by flex */ - -/* scanner skeleton version: - * $Header$ - Last change: JS 13 Jul 97 6:17 pm - */ - -#define FLEX_SCANNER - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -#include - -/* use prototypes in function declarations */ -#define YY_USE_PROTOS - -/* the "const" storage-class-modifier is valid */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#ifdef __STDC__ - -#ifdef __GNUC__ -#include -#else -#include -#endif /* __GNUC__ */ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - - -#ifdef __TURBOC__ -#define YY_USE_CONST -#endif - - -#ifndef YY_USE_CONST -#define const -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -/* we can't get here if it's an ANSI C compiler, or a C++ compiler, - * so it's got to be a K&R compiler, and therefore there's no standard - * place from which to include these definitions - */ -/* -char *malloc(); -int free(); -*/ - -//int read(); -#endif - - -/* amount of stuff to slurp up with each read */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* returned upon end-of-file */ -#define YY_END_TOK 0 - -/* copy whatever the last rule matched to the standard output */ - -/* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */ -/* this used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite() - */ -#define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout ) - -/* gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#define YY_INPUT(buf,result,max_size) \ - if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "read() in flex scanner failed" ); -#define YY_NULL 0 - -/* no semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#define yyterminate() return ( YY_NULL ) - -/* report a fatal error */ - -/* The funky do-while is used to turn this macro definition into - * a single C statement (which needs a semi-colon terminator). - * This avoids problems with code like: - * - * if ( something_happens ) - * YY_FATAL_ERROR( "oops, the something happened" ); - * else - * everything_okay(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the YY_FATAL_ERROR() call. - */ - -#define YY_FATAL_ERROR(msg) \ - do \ - { \ - (void) fputs( msg, stderr ); \ - (void) putc( '\n', stderr ); \ - exit( 1 ); \ - } \ - while ( 0 ) - -/* default yywrap function - always treat EOF as an EOF */ -int yywrap(void) { return 1; } - - -/* enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN - */ -#define BEGIN yy_start = 1 + 2 * - -/* action number for EOF rule of a given start state */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* special action meaning "start processing a new file" */ -#define YY_NEW_FILE \ - do \ - { \ - yy_init_buffer( yy_current_buffer, yyin ); \ - yy_load_buffer_state(); \ - } \ - while ( 0 ) - -/* default declaration of generated scanner - a define so the user can - * easily add parameters - */ -#define YY_DECL int yylex YY_PROTO(( void )) - -/* code executed at the end of each rule */ -#define YY_BREAK break; - -#define YY_END_OF_BUFFER_CHAR 0 - -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */ -#endif - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -#define YY_CHAR unsigned char -# line 1 "lexer.l" -#define INITIAL 0 -# line 9 "lexer.l" -/* - * File: lexer.l - * Description: Lexical analyser for PROLOGIO; can be used with - * either lex and flex. - */ -#include - -/* +++steve162e: added, otherwise, PROIO_input will be undefined (at least under LINUX) - please check, if this is also TRUE under other UNIXes. - */ - -#if defined(FLEX_SCANNER) && defined(_LINUX) -#define PROIO_input my_input -#endif -/* ---steve162e */ - -#include "wx/expr.h" -#ifdef wx_x -extern char *malloc(); -#endif -#define Return(x) return x; - -#if defined(VMS) && ( __VMS_VER < 70000000 ) -#define strdup(s) (strcpy((char *)malloc(strlen(s)+1), s)); -#endif - -static size_t lex_buffer_length = 0; -static const char *lex_buffer = NULL; -static size_t lex_string_ptr = 0; -static int lex_read_from_string = 0; - -static int my_input(void); -static int my_unput(char); - -#ifdef FLEX_SCANNER -#undef YY_INPUT -# define YY_INPUT(buf,result,max_size) \ - if (lex_read_from_string) \ - { int c = my_input(); result = (c == 0) ? YY_NULL : ((buf)[0]=(c), 1); } \ - else \ - if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "read() in flex scanner failed" ); -#else -# undef unput -# define unput(_c) my_unput(_c) -#endif - -# line 58 "lexer.l" - -/* done after the current pattern has been matched and before the - * corresponding action - sets up yytext - */ -#define YY_DO_BEFORE_ACTION \ - yytext = yy_bp; \ - yyleng = yy_cp - yy_bp; \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* return all but the first 'n' matched characters back to the input stream */ -#define yyless(n) \ - do \ - { \ - /* undo effects of setting up yytext */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#undef unput -#define unput(c) yyunput( c, yytext ) - - -struct yy_buffer_state - { - FILE *yy_input_file; - - YY_CHAR *yy_ch_buf; /* input buffer */ - YY_CHAR *yy_buf_pos; /* current position in input buffer */ - - /* size of input buffer in bytes, not including room for EOB characters*/ - int yy_buf_size; - - /* number of characters read into yy_ch_buf, not including EOB characters */ - int yy_n_chars; - - int yy_eof_status; /* whether we've seen an EOF on this buffer */ -#define EOF_NOT_SEEN 0 - /* "pending" happens when the EOF has been seen but there's still - * some text process - */ -#define EOF_PENDING 1 -#define EOF_DONE 2 - }; - -static YY_BUFFER_STATE yy_current_buffer; - -/* we provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state" - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed */ -static YY_CHAR yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - - -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -#ifndef YY_USER_INIT -#define YY_USER_INIT -#endif - -extern YY_CHAR *yytext; -extern int yyleng; -extern FILE *yyin, *yyout; - -YY_CHAR *yytext; -int yyleng; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -#define YY_END_OF_BUFFER 18 -typedef int yy_state_type; -static const short int yy_accept[34] = - { 0, - 0, 0, 18, 16, 13, 14, 16, 16, 6, 7, - 16, 8, 12, 16, 1, 11, 3, 9, 10, 2, - 0, 5, 0, 0, 0, 4, 1, 15, 3, 5, - 0, 0, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 4, 1, 1, 1, 1, 5, 6, - 7, 8, 9, 10, 9, 11, 12, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, - 14, 1, 1, 1, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 16, 17, 18, 1, 15, 1, 15, 15, 15, 15, - - 19, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 1, 20, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static const YY_CHAR yy_meta[21] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 1, 2, 1, 3, 1, 2, 1 - } ; - -static const short int yy_base[37] = - { 0, - 0, 0, 48, 55, 55, 55, 17, 42, 55, 55, - 19, 55, 55, 23, 17, 55, 0, 55, 55, 0, - 18, 55, 19, 23, 21, 55, 12, 55, 0, 24, - 25, 29, 55, 49, 52, 22 - } ; - -static const short int yy_def[37] = - { 0, - 33, 1, 33, 33, 33, 33, 34, 35, 33, 33, - 33, 33, 33, 33, 33, 33, 36, 33, 33, 36, - 34, 33, 34, 34, 35, 33, 33, 33, 36, 34, - 34, 34, 0, 33, 33, 33 - } ; - -static const short int yy_nxt[76] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 4, 11, 12, - 13, 14, 15, 16, 17, 18, 4, 19, 20, 4, - 22, 22, 30, 29, 27, 26, 22, 22, 30, 27, - 28, 27, 30, 23, 23, 23, 24, 24, 24, 31, - 23, 32, 24, 24, 24, 23, 26, 33, 24, 21, - 21, 21, 25, 25, 3, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33 - } ; - -static const short int yy_chk[76] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 7, 21, 23, 36, 27, 25, 24, 30, 31, 15, - 14, 11, 32, 7, 21, 23, 7, 21, 23, 24, - 30, 31, 24, 30, 31, 32, 8, 3, 32, 34, - 34, 34, 35, 35, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33 - } ; - -static yy_state_type yy_last_accepting_state; -static YY_CHAR *yy_last_accepting_cpos; - -/* the intent behind this definition is that it'll catch - * any uses of REJECT which flex missed - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 - -/* these variables are all declared out here so that section 3 code can - * manipulate them - */ -/* points to current character in buffer */ -static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr )); -void yyrestart YY_PROTO(( FILE *input_file )); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); - -#define yy_new_buffer yy_create_buffer - -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif - -YY_DECL - { - register yy_state_type yy_current_state; - register YY_CHAR *yy_cp, *yy_bp; - register int yy_act; - - - - - if ( yy_init ) - { - YY_USER_INIT; - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( yy_current_buffer ) - yy_init_buffer( yy_current_buffer, yyin ); - else - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - - yy_init = 0; - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; - - /* support of yytext */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of the - * current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[*yy_cp]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = yy_def[yy_current_state]; - if ( yy_current_state >= 34 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_current_state != 33 ); - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - - YY_DO_BEFORE_ACTION; - YY_USER_ACTION; - -do_action: /* this label is used only to access EOF actions */ - - - switch ( yy_act ) - { - case 0: /* must backtrack */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -# line 60 "lexer.l" -{yylval.s = strdup(yytext); Return(INTEGER);} - YY_BREAK -case 2: -# line 62 "lexer.l" -Return(EXP); - YY_BREAK -case 3: -# line 64 "lexer.l" -{yylval.s = strdup(yytext); Return(WORD);} - YY_BREAK -case 4: -# line 66 "lexer.l" -{int len = strlen(yytext); - yytext[len-1] = 0; - yylval.s = strdup(yytext+1); - Return(WORD);} - YY_BREAK -case 5: -# line 71 "lexer.l" -{yylval.s = strdup(yytext); Return(STRING);} - YY_BREAK -case 6: -# line 73 "lexer.l" -Return(OPEN); - YY_BREAK -case 7: -# line 75 "lexer.l" -Return(CLOSE); - YY_BREAK -case 8: -# line 77 "lexer.l" -Return(COMMA); - YY_BREAK -case 9: -# line 79 "lexer.l" -Return(OPEN_SQUARE); - YY_BREAK -case 10: -# line 81 "lexer.l" -Return(CLOSE_SQUARE); - YY_BREAK -case 11: -# line 83 "lexer.l" -Return(EQUALS); - YY_BREAK -case 12: -# line 85 "lexer.l" -Return(PERIOD); - YY_BREAK -case 13: -# line 87 "lexer.l" -; - YY_BREAK -case 14: -# line 89 "lexer.l" -; - YY_BREAK -case 15: -# line 91 "lexer.l" -{ loop: -#ifdef __cplusplus - while (yyinput() != '*'); - switch (yyinput()) -#else - while (input() != '*'); - switch (input()) -#endif - { - case '/': break; - case '*': unput('*'); - default: goto loop; - } - } - YY_BREAK -case 16: -# line 106 "lexer.l" -Return(ERROR); - YY_BREAK -case 17: -# line 108 "lexer.l" -ECHO; - YY_BREAK -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* amount of text matched not including the EOB char */ - int yy_amount_of_matched_text = yy_cp - yytext - 1; - - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - - /* note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the end- - * of-buffer state). Contrast this with the test in yyinput(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* this was really a NUL */ - { - yy_state_type yy_next_state; - - yy_c_buf_p = yytext + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* okay, we're now positioned to make the - * NUL transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we - * don't want to build jamming into it because - * then it will run more slowly) - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* consume the NUL */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* note: because we've taken care in - * yy_get_next_buffer() to have set up yytext, - * we can now set up yy_c_buf_p so that if some - * total hoser (like flex itself) wants - * to call the scanner after we return the - * YY_NULL, it'll still work - another YY_NULL - * will get returned. - */ - yy_c_buf_p = yytext + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF((yy_start - 1) / 2); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - } - break; - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: -#ifdef FLEX_DEBUG - printf( "action # %d\n", yy_act ); -#endif - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } - } - } - - -/* yy_get_next_buffer - try to read in a new buffer - * - * synopsis - * int yy_get_next_buffer(); - * - * returns a code representing an action - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - - { - register YY_CHAR *dest = yy_current_buffer->yy_ch_buf; - register YY_CHAR *source = yytext - 1; /* copy prev. char, too */ - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - /* try to read more data */ - - /* first move last chars to start of buffer */ - number_to_move = yy_c_buf_p - yytext; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; - - else - { - int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - else if ( num_to_read <= 0 ) - YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - - /* read in more data */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == 1 ) - { - ret_val = EOB_ACT_END_OF_FILE; - yy_current_buffer->yy_eof_status = EOF_DONE; - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_eof_status = EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - /* yytext begins at the second character in yy_ch_buf; the first - * character is the one which preceded it before reading in the latest - * buffer; it needs to be kept around in case it's a newline, so - * yy_get_previous_state() will have with '^' rules active - */ - - yytext = &yy_current_buffer->yy_ch_buf[1]; - - return ( ret_val ); - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached - * - * synopsis - * yy_state_type yy_get_previous_state(); - */ - -static yy_state_type yy_get_previous_state() - - { - register yy_state_type yy_current_state; - register YY_CHAR *yy_cp; - - yy_current_state = yy_start; - - for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = yy_def[yy_current_state]; - if ( yy_current_state >= 34 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - } - - return ( yy_current_state ); - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -register yy_state_type yy_current_state; -#endif - - { - register int yy_is_jam; - register YY_CHAR *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = yy_def[yy_current_state]; - if ( yy_current_state >= 34 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 33); - - return ( yy_is_jam ? 0 : yy_current_state ); - } - - -#ifdef YY_USE_PROTOS -static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp ) -#else -static void yyunput( c, yy_bp ) -YY_CHAR c; -register YY_CHAR *yy_bp; -#endif - - { - register YY_CHAR *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ - register YY_CHAR *dest = - &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; - register YY_CHAR *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += dest - source; - yy_bp += dest - source; - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) - yy_cp[-2] = '\n'; - - *--yy_cp = c; - - /* note: the formal parameter *must* be called "yy_bp" for this - * macro to now work correctly - */ - YY_DO_BEFORE_ACTION; /* set up yytext again */ - } - - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - - { - int c; - YY_CHAR *yy_cp = yy_c_buf_p; - - *yy_cp = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* this was really a NUL */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - yytext = yy_c_buf_p; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = yytext + YY_MORE_ADJ; - return ( EOF ); - } - - YY_NEW_FILE; - -#ifdef __cplusplus - return ( yyinput() ); -#else - return ( input() ); -#endif - } - break; - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext + YY_MORE_ADJ; - break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - YY_FATAL_ERROR( "unexpected last match in yyinput()" ); -#else - YY_FATAL_ERROR( "unexpected last match in input()" ); -#endif - } - } - } - - c = *yy_c_buf_p; - yy_hold_char = *++yy_c_buf_p; - - return ( c ); - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - - { - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* flush out information for old buffer */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* we don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) ); - - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) ); - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - yy_init_buffer( b, file ); - - return ( b ); - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - free( (char *) b->yy_ch_buf ); - free( (char *) b ); - } - - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - { - b->yy_input_file = file; - - /* we put in the '\n' and start reading from [1] so that an - * initial match-at-newline will be true. - */ - - b->yy_ch_buf[0] = '\n'; - b->yy_n_chars = 1; - - /* we always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[1]; - - b->yy_eof_status = EOF_NOT_SEEN; - } -# line 108 "lexer.l" - - - -#ifdef FLEX_SCANNER -static int lex_input() { - return input(); -} -#else /* BSD/AT&T lex */ -#ifndef input -# error "Sorry, but need either flex or AT&T lex" -#endif -static int lex_input() { - return input(); -} -/* # undef unput -# define unput(_c) my_unput(_c) -*/ - -# undef input -# define input() my_input() -static int my_unput(char c) -{ - if (lex_read_from_string) { - /* Make sure we have something */ - if (lex_string_ptr) { - if (c == '\n') yylineno--; - lex_string_ptr--; - } - } else { - yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar; -/* unput(c); Causes infinite recursion! */ - } - return c; -} - -#endif - -/* Public */ -void LexFromFile(FILE *fd) -{ - lex_read_from_string = 0; - yyin = fd; - /* Don't know why this is necessary, but otherwise - * lex only works _once_! - */ -#ifdef FLEX_SCANNER - yy_init = 1; -#endif -} - -void LexFromString(char *buffer) -{ - lex_read_from_string = 1; - lex_buffer = buffer; - lex_buffer_length = strlen(buffer); - lex_string_ptr = 0; - /* Don't know why this is necessary, but otherwise - * lex only works _once_! - */ -#ifdef FLEX_SCANNER - yy_init = 1; -#endif -} - -static int my_input( void ) -{ - if (lex_read_from_string) { - if (lex_string_ptr == lex_buffer_length) - return 0; - else { - char c = lex_buffer[lex_string_ptr++]; -#ifndef FLEX_SCANNER - if (c == '\n') yylineno++; -#endif - return c; - } - } else { - return lex_input(); - } -} - -void wxExprCleanUp() -{ - if (yy_current_buffer) - yy_delete_buffer(yy_current_buffer); -} diff --git a/src/common/cwy_tab.c b/src/common/cwy_tab.c deleted file mode 100644 index 8cbbcb1..0000000 --- a/src/common/cwy_tab.c +++ /dev/null @@ -1,547 +0,0 @@ -#ifndef lint -static char yysccsid[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90"; -#endif -#define YYBYACC 1 -#line 2 "parser.y" -#include "string.h" -#ifdef _MSC_VER -#include -#endif -#include "wx/expr.h" - -#ifndef __EXTERN_C__ -#define __EXTERN_C__ 1 -#endif - -#if defined(__cplusplus) || defined(__STDC__) -#if defined(__cplusplus) && defined(__EXTERN_C__) -extern "C" { -#endif -#endif -int yyparse(void); -int PROIO_yyparse(void) { - return yyparse() ; -} -int yylex(void); -int yylook(void); -int yywrap(void); -int yyback(int *, int); -#if __MSL__ < 0x6000 -int read( int , char * , int ) ; -#else -#ifndef __MACH__ -int _read( int , void * , size_t ) ; -#define read _read -#endif -#endif -#ifdef __WXMSW__ -//int fileno( FILE* ) ; This is defined in watcom -#else -#if __MSL__ < 0x6000L -int fileno( void* ) ; -#endif -#endif - -/* You may need to put /DLEX_SCANNER in your makefile - * if you're using LEX! - Last change: JS 13 Jul 97 6:12 pm - */ -#ifdef LEX_SCANNER -/* int yyoutput(int); */ -void yyoutput(int); -#else -void yyoutput(int); -#endif - -#if defined(__cplusplus) || defined(__STDC__) -#if defined(__cplusplus) && defined(__EXTERN_C__) -} -#endif -#endif -#line 36 "parser.y" -typedef union { - char *s; -/* struct pexpr *expr; */ -} YYSTYPE; -#line 44 "y_tab.c" -#define INTEGER 1 -#define WORD 2 -#define STRING 3 -#define PERIOD 13 -#define OPEN 4 -#define CLOSE 5 -#define COMMA 6 -#define NEWLINE 7 -#define ERROR 8 -#define OPEN_SQUARE 9 -#define CLOSE_SQUARE 10 -#define EQUALS 11 -#define EXP 14 -#define YYERRCODE 256 -short yylhs[] = { -1, - 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, - 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, -}; -short yylen[] = { 2, - 0, 2, 2, 2, 2, 4, 2, 3, 0, 1, - 3, 3, 1, 1, 1, 1, 3, 3, 5, 1, -}; -short yydefred[] = { 1, - 0, 0, 0, 0, 2, 0, 5, 3, 0, 0, - 0, 15, 7, 20, 0, 0, 13, 4, 0, 0, - 0, 0, 8, 0, 6, 0, 18, 0, 12, 11, - 0, 19, -}; -short yydgoto[] = { 1, - 5, 14, 15, 16, 17, -}; -short yysindex[] = { 0, - -2, 9, 2, 1, 0, 10, 0, 0, 11, -5, - 17, 0, 0, 0, 14, -1, 0, 0, 33, 38, - 41, 16, 0, 11, 0, 29, 0, 40, 0, 0, - 44, 0, -}; -short yyrindex[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 42, 21, - 24, 0, 0, 0, 0, 30, 0, 0, 0, 0, - 0, 0, 0, 31, 0, 27, 0, 24, 0, 0, - 0, 0, -}; -short yygindex[] = { 0, - 0, 45, -8, 0, 26, -}; -#define YYTABLESIZE 254 -short yytable[] = { 3, - 19, 10, 11, 12, 24, 9, 4, 20, 21, 4, - 13, 10, 11, 12, 8, 30, 10, 28, 12, 4, - 9, 7, 18, 23, 4, 16, 16, 22, 14, 14, - 16, 17, 17, 14, 10, 9, 17, 25, 26, 10, - 9, 27, 31, 9, 32, 6, 9, 29, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2, -}; -short yycheck[] = { 2, - 9, 1, 2, 3, 6, 4, 9, 13, 14, 9, - 10, 1, 2, 3, 13, 24, 1, 2, 3, 9, - 4, 13, 13, 10, 9, 5, 6, 11, 5, 6, - 10, 5, 6, 10, 5, 5, 10, 5, 1, 10, - 10, 1, 14, 4, 1, 1, 5, 22, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 256, -}; -#define YYFINAL 1 -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -#define YYMAXTOKEN 14 -#if YYDEBUG -char *yyname[] = { -"end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE", -"ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP", -}; -char *yyrule[] = { -"$accept : commands", -"commands :", -"commands : commands command", -"command : WORD PERIOD", -"command : expr PERIOD", -"command : error PERIOD", -"expr : WORD OPEN arglist CLOSE", -"expr : OPEN_SQUARE CLOSE_SQUARE", -"expr : OPEN_SQUARE arglist CLOSE_SQUARE", -"arglist :", -"arglist : arg", -"arglist : arg COMMA arglist", -"arg : WORD EQUALS arg1", -"arg : arg1", -"arg1 : WORD", -"arg1 : STRING", -"arg1 : INTEGER", -"arg1 : INTEGER PERIOD INTEGER", -"arg1 : INTEGER EXP INTEGER", -"arg1 : INTEGER PERIOD INTEGER EXP INTEGER", -"arg1 : expr", -}; -#endif -#define yyclearin (yychar=(-1)) -#define yyerrok (yyerrflag=0) -#ifdef YYSTACKSIZE -#ifndef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#endif -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 600 -#define YYMAXDEPTH 600 -#endif -#endif -int yydebug; -int yynerrs; -int yyerrflag; -int yychar; -short *yyssp; -YYSTYPE *yyvsp; -YYSTYPE yyval; -YYSTYPE yylval; -short yyss[YYSTACKSIZE]; -YYSTYPE yyvs[YYSTACKSIZE]; -#define yystacksize YYSTACKSIZE -#line 118 "parser.y" - -#ifdef IDE_INVOKED -#include "../common/doslex.c" -#else -#if (defined(__MWERKS__)) -#include "../common/cwlex_yy.c" -#else -#include "../common/lex_yy.c" -#endif -#endif - -/* -void yyerror(s) -char *s; -{ - syntax_error(s); -} -*/ - -/* Ansi prototype. If this doesn't work for you... uncomment - the above instead. - */ - -void yyerror(char *s) -{ - syntax_error(s); -} - -/* - * Unfortunately, my DOS version of FLEX - * requires yywrap to be #def'ed, whereas - * the UNIX flex expects a proper function. - */ - -/* Not sure if __SC__ is the appropriate thing - * to test - */ - -#ifndef __SC__ -#ifdef USE_DEFINE -#ifndef yywrap -#define yywrap() 1 -#endif -#else -int yywrap() { return 1; } -#endif -#endif -#line 247 "y_tab.c" -#define YYABORT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab -int -yyparse() -{ - register int yym, yyn, yystate; -#if YYDEBUG - register char *yys; - extern char *getenv(); - - if (yys = getenv("YYDEBUG")) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = (-1); - - yyssp = yyss; - yyvsp = yyvs; - *yyssp = yystate = 0; - -yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, reading %d (%s)\n", yystate, - yychar, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, shifting to state %d\n", - yystate, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - yychar = (-1); - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; -#ifdef lint - goto yynewerror; -#endif -yynewerror: - yyerror("syntax error"); -#ifdef lint - goto yyerrlab; -#endif -yyerrlab: - ++yynerrs; -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, error recovery shifting\ - to state %d\n", *yyssp, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("yydebug: error recovery discarding state %d\n", - *yyssp); -#endif - if (yyssp <= yyss) goto yyabort; - --yyssp; - --yyvsp; - } - } - } - else - { - if (yychar == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, error recovery discards token %d (%s)\n", - yystate, yychar, yys); - } -#endif - yychar = (-1); - goto yyloop; - } -yyreduce: -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, reducing by rule %d (%s)\n", - yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - yyval = yyvsp[1-yym]; - switch (yyn) - { -case 3: -#line 68 "parser.y" -{process_command(proio_cons(wxmake_word(yyvsp[-1].s), NULL)); free(yyvsp[-1].s);} -break; -case 4: -#line 70 "parser.y" -{process_command(yyvsp[-1].s);} -break; -case 5: -#line 72 "parser.y" -{syntax_error("Unrecognized command.");} -break; -case 6: -#line 76 "parser.y" -{yyval.s = proio_cons(wxmake_word(yyvsp[-3].s), yyvsp[-1].s); free(yyvsp[-3].s);} -break; -case 7: -#line 78 "parser.y" -{yyval.s = proio_cons(NULL, NULL);} -break; -case 8: -#line 80 "parser.y" -{yyval.s = yyvsp[-1].s; } -break; -case 9: -#line 84 "parser.y" -{yyval.s = NULL;} -break; -case 10: -#line 86 "parser.y" -{yyval.s = proio_cons(yyvsp[0].s, NULL);} -break; -case 11: -#line 89 "parser.y" -{yyval.s = proio_cons(yyvsp[-2].s, yyvsp[0].s);} -break; -case 12: -#line 93 "parser.y" -{yyval.s = proio_cons(wxmake_word("="), proio_cons(wxmake_word(yyvsp[-2].s), proio_cons(yyvsp[0].s, NULL))); - free(yyvsp[-2].s); } -break; -case 13: -#line 96 "parser.y" -{yyval.s = yyvsp[0].s; } -break; -case 14: -#line 99 "parser.y" -{yyval.s = wxmake_word(yyvsp[0].s); free(yyvsp[0].s);} -break; -case 15: -#line 101 "parser.y" -{yyval.s = wxmake_string(yyvsp[0].s); free(yyvsp[0].s);} -break; -case 16: -#line 103 "parser.y" -{yyval.s = wxmake_integer(yyvsp[0].s); free(yyvsp[0].s);} -break; -case 17: -#line 105 "parser.y" -{yyval.s = wxmake_real(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); } -break; -case 18: -#line 107 "parser.y" -{yyval.s = wxmake_exp(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); } -break; -case 19: -#line 110 "parser.y" -{yyval.s = wxmake_exp2(yyvsp[-4].s, yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-4].s); free(yyvsp[-2].s); - free(yyvsp[0].s); } -break; -case 20: -#line 114 "parser.y" -{yyval.s = yyvsp[0].s;} -break; -#line 461 "y_tab.c" - } - yyssp -= yym; - yystate = *yyssp; - yyvsp -= yym; - yym = yylhs[yyn]; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: after reduction, shifting from state 0 to\ - state %d\n", YYFINAL); -#endif - yystate = YYFINAL; - *++yyssp = YYFINAL; - *++yyvsp = yyval; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, reading %d (%s)\n", - YYFINAL, yychar, yys); - } -#endif - } - if (yychar == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("yydebug: after reduction, shifting from state %d \ -to state %d\n", *yyssp, yystate); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate; - *++yyvsp = yyval; - goto yyloop; -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - return (1); -yyaccept: - return (0); -} diff --git a/src/common/doslex.c b/src/common/doslex.c deleted file mode 100644 index 233e20a..0000000 --- a/src/common/doslex.c +++ /dev/null @@ -1,1276 +0,0 @@ -/* A lexical scanner generated by flex */ - -/* scanner skeleton version: - * $Header$ - Last change: JS 13 Jul 97 6:17 pm - */ - -#define FLEX_SCANNER - -#include - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include - -#ifdef __SALFORDC__ -#include -#include -#else -#include -#endif - -#ifdef __VISAGECPP__ -#include -#endif - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - -/* use prototypes in function declarations */ -#define YY_USE_PROTOS - -/* the "const" storage-class-modifier is valid */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#ifdef __STDC__ - -#ifdef __GNUC__ -#include -#else -#include -#endif /* __GNUC__ */ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - - -#ifdef __TURBOC__ -#define YY_USE_CONST -#endif - - -#ifndef YY_USE_CONST -#define const -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -/* we can't get here if it's an ANSI C compiler, or a C++ compiler, - * so it's got to be a K&R compiler, and therefore there's no standard - * place from which to include these definitions - */ -/* -char *malloc(); -int free(); -*/ - -#endif - - -/* amount of stuff to slurp up with each read */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* returned upon end-of-file */ -#define YY_END_TOK 0 - -/* copy whatever the last rule matched to the standard output */ - -/* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */ -/* this used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite() - */ -#define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout ) - -/* gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#define YY_INPUT(buf,result,max_size) \ - if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "read() in flex scanner failed" ); -#define YY_NULL 0 - -/* no semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#define yyterminate() return ( YY_NULL ) - -/* report a fatal error */ - -/* The funky do-while is used to turn this macro definition into - * a single C statement (which needs a semi-colon terminator). - * This avoids problems with code like: - * - * if ( something_happens ) - * YY_FATAL_ERROR( "oops, the something happened" ); - * else - * everything_okay(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the YY_FATAL_ERROR() call. - */ - -#if !defined(__VISAGECPP__) -#define YY_FATAL_ERROR(msg) \ - do \ - { \ - (void) fputs( msg, stderr ); \ - (void) putc( '\n', stderr ); \ - exit( 1 ); \ - } \ - while ( 0 ) -#else -/* suppress expression always false warning */ -int os2var = 0; -#define YY_FATAL_ERROR(msg) \ - do \ - { \ - (void) fputs( msg, stderr ); \ - (void) putc( '\n', stderr ); \ - exit( 1 ); \ - } \ - while ( os2var == 0 ) -#endif - -/* default yywrap function - always treat EOF as an EOF */ -int yywrap(void) { return 1; } - - -/* enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN - */ -#define BEGIN yy_start = 1 + 2 * - -/* action number for EOF rule of a given start state */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* special action meaning "start processing a new file" */ -#if !defined(__VISAGECPP__) -#define YY_NEW_FILE \ - do \ - { \ - yy_init_buffer( yy_current_buffer, yyin ); \ - yy_load_buffer_state(); \ - } \ - while ( 0 ) -#else -#define YY_NEW_FILE \ - do \ - { \ - yy_init_buffer( yy_current_buffer, yyin ); \ - yy_load_buffer_state(); \ - } \ - while ( os2var == 0 ) -#endif - -/* default declaration of generated scanner - a define so the user can - * easily add parameters - */ -#define YY_DECL int yylex YY_PROTO(( void )) - -/* code executed at the end of each rule */ -#define YY_BREAK break; - -#define YY_END_OF_BUFFER_CHAR 0 - -#ifndef YY_BUF_SIZE -#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */ -#endif - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -#define YY_CHAR unsigned char -# line 1 "lexer.l" -#define INITIAL 0 -# line 9 "lexer.l" -/* - * File: lexer.l - * Description: Lexical analyser for PROLOGIO; can be used with - * either lex and flex. - */ -#include - -/* +++steve162e: added, otherwise, PROIO_input will be undefined (at least under LINUX) - please check, if this is also TRUE under other UNIXes. - */ - -#if defined(FLEX_SCANNER) && defined(_LINUX) -#define PROIO_input my_input -#endif -/* ---steve162e */ - -#include "wx/expr.h" -#ifdef wx_x -extern char *malloc(); -#endif -#define Return(x) return x; - -#if defined(VMS) && ( __VMS_VER < 70000000 ) -#define strdup(s) (strcpy((char *)malloc(strlen(s)+1), s)); -#endif - -static size_t lex_buffer_length = 0; -static const char *lex_buffer = NULL; -static size_t lex_string_ptr = 0; -static int lex_read_from_string = 0; - -static int my_input(void); -static int my_unput(char); - -#ifdef FLEX_SCANNER -#undef YY_INPUT -# define YY_INPUT(buf,result,max_size) \ - if (lex_read_from_string) \ - { int c = my_input(); result = (c == 0) ? YY_NULL : ((buf)[0]=(c), 1); } \ - else \ - if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "read() in flex scanner failed" ); -#else -# ifndef unput -# undef unput -# endif -# define unput(_c) my_unput(_c) -#endif - -# line 58 "lexer.l" - -/* done after the current pattern has been matched and before the - * corresponding action - sets up yytext - */ -#define YY_DO_BEFORE_ACTION \ - yytext = yy_bp; \ - yyleng = yy_cp - yy_bp; \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* return all but the first 'n' matched characters back to the input stream */ -#if !defined(__VISAGECPP__) -#define yyless(n) \ - do \ - { \ - /* undo effects of setting up yytext */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) -#else -#define yyless(n) \ - do \ - { \ - /* undo effects of setting up yytext */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( os2var == 0 ) -#endif - -#undef unput -#define unput(c) yyunput( c, yytext ) - - -struct yy_buffer_state - { - FILE *yy_input_file; - - YY_CHAR *yy_ch_buf; /* input buffer */ - YY_CHAR *yy_buf_pos; /* current position in input buffer */ - - /* size of input buffer in bytes, not including room for EOB characters*/ - int yy_buf_size; - - /* number of characters read into yy_ch_buf, not including EOB characters */ - int yy_n_chars; - - int yy_eof_status; /* whether we've seen an EOF on this buffer */ -#define EOF_NOT_SEEN 0 - /* "pending" happens when the EOF has been seen but there's still - * some text process - */ -#define EOF_PENDING 1 -#define EOF_DONE 2 - }; - -static YY_BUFFER_STATE yy_current_buffer; - -/* we provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state" - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -/* yy_hold_char holds the character lost when yytext is formed */ -static YY_CHAR yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - - -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -#ifndef YY_USER_INIT -#define YY_USER_INIT -#endif - -extern YY_CHAR *yytext; -extern int yyleng; -extern FILE *yyin, *yyout; - -YY_CHAR *yytext; -int yyleng; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -#define YY_END_OF_BUFFER 18 -typedef int yy_state_type; -static const short int yy_accept[34] = - { 0, - 0, 0, 18, 16, 13, 14, 16, 16, 6, 7, - 16, 8, 12, 16, 1, 11, 3, 9, 10, 2, - 0, 5, 0, 0, 0, 4, 1, 15, 3, 5, - 0, 0, 0 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 4, 1, 1, 1, 1, 5, 6, - 7, 8, 9, 10, 9, 11, 12, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, - 14, 1, 1, 1, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 16, 17, 18, 1, 15, 1, 15, 15, 15, 15, - - 19, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 1, 20, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static const YY_CHAR yy_meta[21] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 1, 2, 1, 3, 1, 2, 1 - } ; - -static const short int yy_base[37] = - { 0, - 0, 0, 48, 55, 55, 55, 17, 42, 55, 55, - 19, 55, 55, 23, 17, 55, 0, 55, 55, 0, - 18, 55, 19, 23, 21, 55, 12, 55, 0, 24, - 25, 29, 55, 49, 52, 22 - } ; - -static const short int yy_def[37] = - { 0, - 33, 1, 33, 33, 33, 33, 34, 35, 33, 33, - 33, 33, 33, 33, 33, 33, 36, 33, 33, 36, - 34, 33, 34, 34, 35, 33, 33, 33, 36, 34, - 34, 34, 0, 33, 33, 33 - } ; - -static const short int yy_nxt[76] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 4, 11, 12, - 13, 14, 15, 16, 17, 18, 4, 19, 20, 4, - 22, 22, 30, 29, 27, 26, 22, 22, 30, 27, - 28, 27, 30, 23, 23, 23, 24, 24, 24, 31, - 23, 32, 24, 24, 24, 23, 26, 33, 24, 21, - 21, 21, 25, 25, 3, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33 - } ; - -static const short int yy_chk[76] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 7, 21, 23, 36, 27, 25, 24, 30, 31, 15, - 14, 11, 32, 7, 21, 23, 7, 21, 23, 24, - 30, 31, 24, 30, 31, 32, 8, 3, 32, 34, - 34, 34, 35, 35, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33 - } ; - -static yy_state_type yy_last_accepting_state; -static YY_CHAR *yy_last_accepting_cpos; - -/* the intent behind this definition is that it'll catch - * any uses of REJECT which flex missed - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 - -/* these variables are all declared out here so that section 3 code can - * manipulate them - */ -/* points to current character in buffer */ -static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr )); -void yyrestart YY_PROTO(( FILE *input_file )); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); - -#define yy_new_buffer yy_create_buffer - -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif - -YY_DECL - { - register yy_state_type yy_current_state; - register YY_CHAR *yy_cp, *yy_bp; - register int yy_act; - - - - - if ( yy_init ) - { - YY_USER_INIT; - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( yy_current_buffer ) - yy_init_buffer( yy_current_buffer, yyin ); - else - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - - yy_init = 0; - } - -#if !defined(__VISAGECPP__) - while ( 1 ) /* loops until end-of-file is reached */ -#else - os2var = 1; - if (os2var == 0) return 0; - while ( os2var == 1 ) /* loops until end-of-file is reached */ -#endif - { - yy_cp = yy_c_buf_p; - - /* support of yytext */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of the - * current run. - */ - yy_bp = yy_cp; - - yy_current_state = yy_start; -yy_match: - do - { - register YY_CHAR yy_c = yy_ec[*yy_cp]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = yy_def[yy_current_state]; - if ( yy_current_state >= 34 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - ++yy_cp; - } - while ( yy_current_state != 33 ); - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - - YY_DO_BEFORE_ACTION; - YY_USER_ACTION; - -do_action: /* this label is used only to access EOF actions */ - - - switch ( yy_act ) - { - case 0: /* must backtrack */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - -case 1: -# line 60 "lexer.l" -{yylval.s = strdup((const char*) yytext); Return(INTEGER);} - YY_BREAK -case 2: -# line 62 "lexer.l" -Return(EXP); - YY_BREAK -case 3: -# line 64 "lexer.l" -{yylval.s = strdup((const char*) yytext); Return(WORD);} - YY_BREAK -case 4: -# line 66 "lexer.l" -{int len = strlen((const char*) yytext); - yytext[len-1] = 0; - yylval.s = strdup((const char*) (yytext+1)); - Return(WORD);} - YY_BREAK -case 5: -# line 71 "lexer.l" -{yylval.s = strdup((const char*) yytext); Return(STRING);} - YY_BREAK -case 6: -# line 73 "lexer.l" -Return(OPEN); - YY_BREAK -case 7: -# line 75 "lexer.l" -Return(CLOSE); - YY_BREAK -case 8: -# line 77 "lexer.l" -Return(COMMA); - YY_BREAK -case 9: -# line 79 "lexer.l" -Return(OPEN_SQUARE); - YY_BREAK -case 10: -# line 81 "lexer.l" -Return(CLOSE_SQUARE); - YY_BREAK -case 11: -# line 83 "lexer.l" -Return(EQUALS); - YY_BREAK -case 12: -# line 85 "lexer.l" -Return(PERIOD); - YY_BREAK -case 13: -# line 87 "lexer.l" -; - YY_BREAK -case 14: -# line 89 "lexer.l" -; - YY_BREAK -case 15: -# line 91 "lexer.l" -{ loop: -#ifdef __cplusplus - while (yyinput() != '*'); - switch (yyinput()) -#else - while (input() != '*'); - switch (input()) -#endif - { - case '/': break; - case '*': unput('*'); - default: goto loop; - } - } - YY_BREAK -case 16: -# line 106 "lexer.l" -Return(ERROR); - YY_BREAK -case 17: -# line 108 "lexer.l" -ECHO; - YY_BREAK -case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: - { - /* amount of text matched not including the EOB char */ - int yy_amount_of_matched_text = yy_cp - yytext - 1; - - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - - /* note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the end- - * of-buffer state). Contrast this with the test in yyinput(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* this was really a NUL */ - { - yy_state_type yy_next_state; - - yy_c_buf_p = yytext + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* okay, we're now positioned to make the - * NUL transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we - * don't want to build jamming into it because - * then it will run more slowly) - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* consume the NUL */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* note: because we've taken care in - * yy_get_next_buffer() to have set up yytext, - * we can now set up yy_c_buf_p so that if some - * total hoser (like flex itself) wants - * to call the scanner after we return the - * YY_NULL, it'll still work - another YY_NULL - * will get returned. - */ - yy_c_buf_p = yytext + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF((yy_start - 1) / 2); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - } - break; - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: -#ifdef FLEX_DEBUG - printf( "action # %d\n", yy_act ); -#endif - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } - } -#if defined(__VISAGECPP__) -/* VA complains about proc maybe not returning a value so return one */ -return 0; -#endif - } - - -/* yy_get_next_buffer - try to read in a new buffer - * - * synopsis - * int yy_get_next_buffer(); - * - * returns a code representing an action - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int yy_get_next_buffer() - - { - register YY_CHAR *dest = yy_current_buffer->yy_ch_buf; - register YY_CHAR *source = yytext - 1; /* copy prev. char, too */ - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - /* try to read more data */ - - /* first move last chars to start of buffer */ - number_to_move = yy_c_buf_p - yytext; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; - - else - { - int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - else if ( num_to_read <= 0 ) - YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - - /* read in more data */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == 1 ) - { - ret_val = EOB_ACT_END_OF_FILE; - yy_current_buffer->yy_eof_status = EOF_DONE; - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_eof_status = EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - /* yytext begins at the second character in yy_ch_buf; the first - * character is the one which preceded it before reading in the latest - * buffer; it needs to be kept around in case it's a newline, so - * yy_get_previous_state() will have with '^' rules active - */ - - yytext = &yy_current_buffer->yy_ch_buf[1]; - - return ( ret_val ); - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached - * - * synopsis - * yy_state_type yy_get_previous_state(); - */ - -static yy_state_type yy_get_previous_state() - - { - register yy_state_type yy_current_state; - register YY_CHAR *yy_cp; - - yy_current_state = yy_start; - - for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = yy_def[yy_current_state]; - if ( yy_current_state >= 34 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - } - - return ( yy_current_state ); - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -register yy_state_type yy_current_state; -#endif - - { - register int yy_is_jam; - register YY_CHAR *yy_cp = yy_c_buf_p; - - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = yy_def[yy_current_state]; - if ( yy_current_state >= 34 ) - yy_c = yy_meta[yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 33); - - return ( yy_is_jam ? 0 : yy_current_state ); - } - - -#ifdef YY_USE_PROTOS -static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp ) -#else -static void yyunput( c, yy_bp ) -YY_CHAR c; -register YY_CHAR *yy_bp; -#endif - - { - register YY_CHAR *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ - register YY_CHAR *dest = - &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; - register YY_CHAR *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += dest - source; - yy_bp += dest - source; - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) - yy_cp[-2] = '\n'; - - *--yy_cp = c; - - /* note: the formal parameter *must* be called "yy_bp" for this - * macro to now work correctly - */ - YY_DO_BEFORE_ACTION; /* set up yytext again */ - } - - -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif - - { - int c; - YY_CHAR *yy_cp = yy_c_buf_p; - - *yy_cp = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* this was really a NUL */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - yytext = yy_c_buf_p; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = yytext + YY_MORE_ADJ; - return ( EOF ); - } - - YY_NEW_FILE; - -#ifdef __cplusplus - return ( yyinput() ); -#else - return ( input() ); -#endif - } - break; - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext + YY_MORE_ADJ; - break; - - case EOB_ACT_LAST_MATCH: -#ifdef __cplusplus - YY_FATAL_ERROR( "unexpected last match in yyinput()" ); -#else - YY_FATAL_ERROR( "unexpected last match in input()" ); -#endif - } - } - } - - c = *yy_c_buf_p; - yy_hold_char = *++yy_c_buf_p; - - return ( c ); - } - - -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - - { - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* flush out information for old buffer */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* we don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) ); - - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) ); - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - yy_init_buffer( b, file ); - - return ( b ); - } - - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - free( (char *) b->yy_ch_buf ); - free( (char *) b ); - } - - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - { - b->yy_input_file = file; - - /* we put in the '\n' and start reading from [1] so that an - * initial match-at-newline will be true. - */ - - b->yy_ch_buf[0] = '\n'; - b->yy_n_chars = 1; - - /* we always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[1]; - - b->yy_eof_status = EOF_NOT_SEEN; - } -# line 108 "lexer.l" - - - -#ifdef FLEX_SCANNER -static int lex_input() { - return input(); -} -#else /* BSD/AT&T lex */ -#ifndef input -# error "Sorry, but need either flex or AT&T lex" -#endif -static int lex_input() { - return input(); -} -/* # undef unput -# define unput(_c) my_unput(_c) -*/ - -# undef input -# define input() my_input() -static int my_unput(char c) -{ - if (lex_read_from_string) { - /* Make sure we have something */ - if (lex_string_ptr) { - if (c == '\n') yylineno--; - lex_string_ptr--; - } - } else { - yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar; -/* unput(c); Causes infinite recursion! */ - } - return c; -} - -#endif - -/* Public */ -void LexFromFile(FILE *fd) -{ - lex_read_from_string = 0; - yyin = fd; - /* Don't know why this is necessary, but otherwise - * lex only works _once_! - */ -#ifdef FLEX_SCANNER - yy_init = 1; -#endif -} - -void LexFromString(char *buffer) -{ - lex_read_from_string = 1; - lex_buffer = buffer; - lex_buffer_length = strlen((const char*) buffer); - lex_string_ptr = 0; - /* Don't know why this is necessary, but otherwise - * lex only works _once_! - */ -#ifdef FLEX_SCANNER - yy_init = 1; -#endif -} - -static int my_input( void ) -{ - if (lex_read_from_string) { - if (lex_string_ptr == lex_buffer_length) - return 0; - else { - char c = lex_buffer[lex_string_ptr++]; -#ifndef FLEX_SCANNER - if (c == '\n') yylineno++; -#endif - return c; - } - } else { - return lex_input(); - } -} - -void wxExprCleanUp() -{ - if (yy_current_buffer) - yy_delete_buffer(yy_current_buffer); -} diff --git a/src/common/dosyacc.c b/src/common/dosyacc.c deleted file mode 100644 index 802a804..0000000 --- a/src/common/dosyacc.c +++ /dev/null @@ -1,540 +0,0 @@ -/* include platform.h first to get __WIN32__ definition */ -#include "wx/platform.h" -#if defined(__WIN32__) || defined(__GNUWIN32__) -/* all Win32 compilers can handle C++ comments, and C++ comments - is the only C++ in setup.h */ -#include "wx/setup.h" -#endif - -#if !defined(wxUSE_PROLOGIO) || wxUSE_PROLOGIO - -#ifndef lint -static char yysccsid[] = "@(#)yaccpar 1.7 (Berkeley) 09/09/90"; -#endif -#define YYBYACC 1 -#line 2 "parser.y" -#include "string.h" -#if defined(_MSC_VER) || defined(__VISAGECPP__) -#include -#endif -#include "wx/expr.h" - -#ifndef __EXTERN_C__ -#define __EXTERN_C__ 1 -#endif - -#if defined(__cplusplus) || defined(__STDC__) -#if defined(__cplusplus) && defined(__EXTERN_C__) -extern "C" { -#endif -#endif -int yylex(void); -int yylook(void); -int yywrap(void); -int yyback(int *, int); - -/* You may need to put /DLEX_SCANNER in your makefile - * if you're using LEX! - */ -#ifdef LEX_SCANNER -/* int yyoutput(int); */ -void yyoutput(int); -#else -void yyoutput(int); -#endif - -#if defined(__cplusplus) || defined(__STDC__) -#if defined(__cplusplus) && defined(__EXTERN_C__) -} -#endif -#endif -#line 36 "parser.y" -typedef union { - char *s; -/* struct pexpr *expr; */ -} YYSTYPE; -#line 44 "y_tab.c" -#define INTEGER 1 -#define WORD 2 -#define STRING 3 -#define PERIOD 13 -#define OPEN 4 -#define CLOSE 5 -#define COMMA 6 -#define NEWLINE 7 -#define ERROR 8 -#define OPEN_SQUARE 9 -#define CLOSE_SQUARE 10 -#define EQUALS 11 -#define EXP 14 -#define YYERRCODE 256 -short yylhs[] = { -1, - 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, - 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, -}; -short yylen[] = { 2, - 0, 2, 2, 2, 2, 4, 2, 3, 0, 1, - 3, 3, 1, 1, 1, 1, 3, 3, 5, 1, -}; -short yydefred[] = { 1, - 0, 0, 0, 0, 2, 0, 5, 3, 0, 0, - 0, 15, 7, 20, 0, 0, 13, 4, 0, 0, - 0, 0, 8, 0, 6, 0, 18, 0, 12, 11, - 0, 19, -}; -short yydgoto[] = { 1, - 5, 14, 15, 16, 17, -}; -short yysindex[] = { 0, - -2, 9, 2, 1, 0, 10, 0, 0, 11, -5, - 17, 0, 0, 0, 14, -1, 0, 0, 33, 38, - 41, 16, 0, 11, 0, 29, 0, 40, 0, 0, - 44, 0, -}; -short yyrindex[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 42, 21, - 24, 0, 0, 0, 0, 30, 0, 0, 0, 0, - 0, 0, 0, 31, 0, 27, 0, 24, 0, 0, - 0, 0, -}; -short yygindex[] = { 0, - 0, 45, -8, 0, 26, -}; -#define YYTABLESIZE 254 -short yytable[] = { 3, - 19, 10, 11, 12, 24, 9, 4, 20, 21, 4, - 13, 10, 11, 12, 8, 30, 10, 28, 12, 4, - 9, 7, 18, 23, 4, 16, 16, 22, 14, 14, - 16, 17, 17, 14, 10, 9, 17, 25, 26, 10, - 9, 27, 31, 9, 32, 6, 9, 29, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2, -}; -short yycheck[] = { 2, - 9, 1, 2, 3, 6, 4, 9, 13, 14, 9, - 10, 1, 2, 3, 13, 24, 1, 2, 3, 9, - 4, 13, 13, 10, 9, 5, 6, 11, 5, 6, - 10, 5, 6, 10, 5, 5, 10, 5, 1, 10, - 10, 1, 14, 4, 1, 1, 5, 22, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 256, -}; -#define YYFINAL 1 -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -#define YYMAXTOKEN 14 -#if YYDEBUG -char *yyname[] = { -"end-of-file","INTEGER","WORD","STRING","OPEN","CLOSE","COMMA","NEWLINE", -"ERROR","OPEN_SQUARE","CLOSE_SQUARE","EQUALS",0,"PERIOD","EXP", -}; -char *yyrule[] = { -"$accept : commands", -"commands :", -"commands : commands command", -"command : WORD PERIOD", -"command : expr PERIOD", -"command : error PERIOD", -"expr : WORD OPEN arglist CLOSE", -"expr : OPEN_SQUARE CLOSE_SQUARE", -"expr : OPEN_SQUARE arglist CLOSE_SQUARE", -"arglist :", -"arglist : arg", -"arglist : arg COMMA arglist", -"arg : WORD EQUALS arg1", -"arg : arg1", -"arg1 : WORD", -"arg1 : STRING", -"arg1 : INTEGER", -"arg1 : INTEGER PERIOD INTEGER", -"arg1 : INTEGER EXP INTEGER", -"arg1 : INTEGER PERIOD INTEGER EXP INTEGER", -"arg1 : expr", -}; -#endif -#define yyclearin (yychar=(-1)) -#define yyerrok (yyerrflag=0) -#ifdef YYSTACKSIZE -#ifndef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#endif -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 600 -#define YYMAXDEPTH 600 -#endif -#endif -int yydebug; -int yynerrs; -int yyerrflag; -int yychar; -short *yyssp; -YYSTYPE *yyvsp; -YYSTYPE yyval; -YYSTYPE yylval; -short yyss[YYSTACKSIZE]; -YYSTYPE yyvs[YYSTACKSIZE]; -#define yystacksize YYSTACKSIZE -#line 118 "parser.y" - -#ifdef IDE_INVOKED -#include "../common/doslex.c" -#else -#include "../common/lex_yy.c" -#endif - -/* -void yyerror(s) -char *s; -{ - syntax_error(s); -} -*/ - -/* Ansi prototype. If this doesn't work for you... uncomment - the above instead. - */ - -void yyerror(char *s) -{ - syntax_error(s); -} - -/* - * Unfortunately, my DOS version of FLEX - * requires yywrap to be #def'ed, whereas - * the UNIX flex expects a proper function. - */ - -/* Not sure if __SC__ is the appropriate thing - * to test - */ - -#ifndef __SC__ -#ifdef USE_DEFINE -#ifndef yywrap -#define yywrap() 1 -#endif -#else -# if !(defined(__VISAGECPP__) && __IBMC__ >= 400) -/* VA 4.0 thinks this is multiply defined (in lex_yy.c) */ - int yywrap() { return 1; } -# endif -#endif -#endif -#line 247 "y_tab.c" -#define YYABORT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab -int -PROIO_yyparse() -{ - register int yym, yyn, yystate; -#if YYDEBUG - register char *yys; - extern char *getenv(); - - yys = getenv("YYDEBUG"); - if (yys) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = (-1); - - yyssp = yyss; - yyvsp = yyvs; - *yyssp = yystate = 0; - -yyloop: - yyn = yydefred[yystate]; - if (yyn != 0) goto yyreduce; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, reading %d (%s)\n", yystate, - yychar, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, shifting to state %d\n", - yystate, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - yychar = (-1); - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; -#ifdef lint - goto yynewerror; -#endif -yynewerror: - yyerror("syntax error"); -#ifdef lint - goto yyerrlab; -#endif -yyerrlab: - ++yynerrs; -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, error recovery shifting\ - to state %d\n", *yyssp, yytable[yyn]); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("yydebug: error recovery discarding state %d\n", - *yyssp); -#endif - if (yyssp <= yyss) goto yyabort; - --yyssp; - --yyvsp; - } - } - } - else - { - if (yychar == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, error recovery discards token %d (%s)\n", - yystate, yychar, yys); - } -#endif - yychar = (-1); - goto yyloop; - } -yyreduce: -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, reducing by rule %d (%s)\n", - yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - yyval = yyvsp[1-yym]; - switch (yyn) - { -case 3: -#line 68 "parser.y" -{process_command(proio_cons(wxmake_word(yyvsp[-1].s), NULL)); free(yyvsp[-1].s);} -break; -case 4: -#line 70 "parser.y" -{process_command(yyvsp[-1].s);} -break; -case 5: -#line 72 "parser.y" -{syntax_error("Unrecognized command.");} -break; -case 6: -#line 76 "parser.y" -{yyval.s = proio_cons(wxmake_word(yyvsp[-3].s), yyvsp[-1].s); free(yyvsp[-3].s);} -break; -case 7: -#line 78 "parser.y" -{yyval.s = proio_cons(NULL, NULL);} -break; -case 8: -#line 80 "parser.y" -{yyval.s = yyvsp[-1].s; } -break; -case 9: -#line 84 "parser.y" -{yyval.s = NULL;} -break; -case 10: -#line 86 "parser.y" -{yyval.s = proio_cons(yyvsp[0].s, NULL);} -break; -case 11: -#line 89 "parser.y" -{yyval.s = proio_cons(yyvsp[-2].s, yyvsp[0].s);} -break; -case 12: -#line 93 "parser.y" -{yyval.s = proio_cons(wxmake_word("="), proio_cons(wxmake_word(yyvsp[-2].s), proio_cons(yyvsp[0].s, NULL))); - free(yyvsp[-2].s); } -break; -case 13: -#line 96 "parser.y" -{yyval.s = yyvsp[0].s; } -break; -case 14: -#line 99 "parser.y" -{yyval.s = wxmake_word(yyvsp[0].s); free(yyvsp[0].s);} -break; -case 15: -#line 101 "parser.y" -{yyval.s = wxmake_string(yyvsp[0].s); free(yyvsp[0].s);} -break; -case 16: -#line 103 "parser.y" -{yyval.s = wxmake_integer(yyvsp[0].s); free(yyvsp[0].s);} -break; -case 17: -#line 105 "parser.y" -{yyval.s = wxmake_real(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); } -break; -case 18: -#line 107 "parser.y" -{yyval.s = wxmake_exp(yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-2].s); free(yyvsp[0].s); } -break; -case 19: -#line 110 "parser.y" -{yyval.s = wxmake_exp2(yyvsp[-4].s, yyvsp[-2].s, yyvsp[0].s); free(yyvsp[-4].s); free(yyvsp[-2].s); - free(yyvsp[0].s); } -break; -case 20: -#line 114 "parser.y" -{yyval.s = yyvsp[0].s;} -break; -#line 461 "y_tab.c" - } - yyssp -= yym; - yystate = *yyssp; - yyvsp -= yym; - yym = yylhs[yyn]; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: after reduction, shifting from state 0 to\ - state %d\n", YYFINAL); -#endif - yystate = YYFINAL; - *++yyssp = YYFINAL; - *++yyvsp = yyval; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, reading %d (%s)\n", - YYFINAL, yychar, yys); - } -#endif - } - if (yychar == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("yydebug: after reduction, shifting from state %d \ -to state %d\n", *yyssp, yystate); -#endif - if (yyssp >= yyss + yystacksize - 1) - { - goto yyoverflow; - } - *++yyssp = yystate; - *++yyvsp = yyval; - goto yyloop; -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - return (1); -yyaccept: - return (0); -} - -#endif /* wxUSE_PROLOGIO */ diff --git a/src/common/lexer.l b/src/common/lexer.l deleted file mode 100644 index 8f8a1cd..0000000 --- a/src/common/lexer.l +++ /dev/null @@ -1,192 +0,0 @@ -SIGN [+-] -DIGIT [0-9] -ALPHA [a-zA-Z_] -ALPHADIGIT [a-zA-Z_0-9] -STRINGCHAR [^"\\] -WORDCHAR [^'\\] - -%{ -/* - * File: lexer.l - * Description: Lexical analyser for PROLOGIO; can be used with - * either lex and flex. - */ -#include -#include - -/* +++steve162e: added, otherwise, PROIO_input will be undefined (at least under LINUX) - please check, if this is also TRUE under other UNIXes. - */ - -#if defined(FLEX_SCANNER) && defined(_LINUX) -#define PROIO_input my_input -#endif -/* ---steve162e */ - -#include "wx/expr.h" - -#define Return(x) return x; - -#if defined(VMS) && !defined(strdup) -#define strdup(s) (strcpy((char *)malloc(strlen(s)+1), s)); -#endif - -static size_t lex_buffer_length = 0; -static const char *lex_buffer = NULL; -static size_t lex_string_ptr = 0; -static int lex_read_from_string = 0; - -static int my_input(void); - -#ifdef FLEX_SCANNER -# undef YY_INPUT -# define YY_INPUT(buf,result,max_size) \ - if (lex_read_from_string) \ - { int c = my_input(); result = (c == 0) ? YY_NULL : ((buf)[0]=(c), 1); } \ - else \ - if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "read() in flex scanner failed" ); -#else -# undef unput -# define unput(_c) my_unput(_c) - static int my_unput(char); -#endif - -%} - -%% - -{SIGN}?{DIGIT}+ {yylval.s = strdup(yytext); Return(INTEGER);} - -"e" Return(EXP); - -{ALPHA}{ALPHADIGIT}* {yylval.s = strdup(yytext); Return(WORD);} - -"'"{WORDCHAR}*"'" {int len = strlen(yytext); - yytext[len-1] = 0; - yylval.s = strdup(yytext+1); - Return(WORD);} - -\"({STRINGCHAR}|\\\"|\|\\\\|\\)*\" {yylval.s = strdup(yytext); Return(STRING);} - -"(" Return(OPEN); - -")" Return(CLOSE); - -"," Return(COMMA); - -"[" Return(OPEN_SQUARE); - -"]" Return(CLOSE_SQUARE); - -"=" Return(EQUALS); - -"." Return(PERIOD); - -[ \t] ; - -\n ; - -"/*" { loop: -#ifdef __cplusplus - while (yyinput() != '*'); - switch (yyinput()) -#else - while (input() != '*'); - switch (input()) -#endif - { - case '/': break; - case '*': unput('*'); - default: goto loop; - } - } - -. Return(ERROR); - -%% - - -#ifdef FLEX_SCANNER -static int lex_input() { - return input(); -} -#else /* BSD/AT&T lex */ -#ifndef input -# error "Sorry, but need either flex or AT&T lex" -#endif -static int lex_input() { - return input(); -} - -# undef input -# define input() my_input() -static int my_unput(char c) -{ - if (lex_read_from_string != 0) { - /* Make sure we have something */ - if (lex_string_ptr) { - if (c == '\n') yylineno--; - lex_string_ptr--; - } - } else { - yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar; -/* unput(c); Causes infinite recursion! */ - } - return c; -} - -#endif - -/* Public */ -void LexFromFile(FILE *fd) -{ - lex_read_from_string = 0; - yyin = fd; - /* Don't know why this is necessary, but otherwise - * lex only works _once_! - */ -#ifdef FLEX_SCANNER - yyrestart(fd); - yy_init = 1; -#endif -} - -void LexFromString(char *buffer) -{ - lex_read_from_string = 1; - lex_buffer = buffer; - lex_buffer_length = strlen(buffer); - lex_string_ptr = 0; - /* Don't know why this is necessary, but otherwise - * lex only works _once_! - */ -#ifdef FLEX_SCANNER - yy_init = 1; -#endif -} - -static int my_input( void ) -{ - if (lex_read_from_string) { - if (lex_string_ptr == lex_buffer_length) - return 0; - else { - char c = lex_buffer[lex_string_ptr++]; -#ifndef FLEX_SCANNER - if (c == '\n') yylineno++; -#endif - return c; - } - } else { - return lex_input(); - } -} - -void wxExprCleanUp() -{ -#ifdef FLEX_SCANNER - if (yy_current_buffer) - yy_delete_buffer(yy_current_buffer); -#endif -} diff --git a/src/common/parser.y b/src/common/parser.y deleted file mode 100644 index c922f8c..0000000 --- a/src/common/parser.y +++ /dev/null @@ -1,184 +0,0 @@ -/* Version: $Id$ */ - %{ -#include "wx/setup.h" -#include -#ifdef _MSC_VER -#include -#endif -#if defined(__GNUWIN32__) && !defined(__TWIN32__) -#include -#endif - -#include "wx/expr.h" - -#ifndef __EXTERN_C__ -#define __EXTERN_C__ 1 -#endif - -#if defined(__cplusplus) || defined(__STDC__) -#if defined(__cplusplus) && defined(__EXTERN_C__) -extern "C" { -#endif -#endif -int yylex(void); -int yylook(void); -int yywrap(void); -int yyback(int *, int); -void yyerror(char *); - -/* You may need to put /DLEX_SCANNER in your makefile - * if you're using LEX! - */ -void yyoutput(int); - -#if defined(__cplusplus) || defined(__STDC__) -#if defined(__cplusplus) && defined(__EXTERN_C__) -} -#endif -#endif -%} - -%union { - char *s; -/* struct pexpr *expr; */ -} - - -%start commands - -%token INTEGER 1 -%token WORD 2 -%token STRING 3 -%token PERIOD 13 -%token OPEN 4 -%token CLOSE 5 -%token COMMA 6 -%token NEWLINE 7 -%token ERROR 8 -%token OPEN_SQUARE 9 -%token CLOSE_SQUARE 10 -%token EQUALS 11 -%token EXP 14 - -/* %type command expr arglist arg arg1 */ -%type command expr arglist arg arg1 - -%% - -commands : /* empty */ - | commands command - ; - -command : WORD PERIOD - {process_command(proio_cons(wxmake_word($1), NULL)); free($1);} - | expr PERIOD - {process_command($1);} - | error PERIOD - {syntax_error("Unrecognized command.");} - ; - -expr : WORD OPEN arglist CLOSE - {$$ = proio_cons(wxmake_word($1), $3); free($1);} - | OPEN_SQUARE arglist CLOSE_SQUARE - {$$ = $2; } - ; - -arglist : - {$$ = proio_cons(NULL, NULL);} - | arg - {$$ = proio_cons($1, NULL);} - | - arg COMMA arglist - {$$ = proio_cons($1, $3);} - ; - -arg : WORD EQUALS arg1 - {$$ = proio_cons(wxmake_word("="), proio_cons(wxmake_word($1), proio_cons($3, NULL))); - free($1); } - | arg1 - {$$ = $1; } - ; - -arg1 : WORD - {$$ = wxmake_word($1); free($1);} - | STRING - {$$ = wxmake_string($1); free($1);} - | INTEGER - {$$ = wxmake_integer($1); free($1);} - | INTEGER PERIOD INTEGER - {$$ = wxmake_real($1, $3); free($1); free($3); } - | INTEGER EXP INTEGER - {$$ = wxmake_exp($1, $3); free($1); free($3); } - | - INTEGER PERIOD INTEGER EXP INTEGER - {$$ = wxmake_exp2($1, $3, $5); free($1); free($3); - free($5); } - - | expr - {$$ = $1;} - ; - -%% - -/* We include lexer.c if we are building for gtk, wine or motif - * and also whenever we are using configure (marked by __WX_SETUP_H__) for, - * for example, cross compilation. */ -#if (defined(__WXGTK__) || defined(__WXWINE__) || defined(__WXMOTIF__)) || defined(__WX_SETUP_H__) && !defined(NO_CONFIGURE) -#include "lexer.c" -#elif defined(__WXMAC__) && defined(__APPLE__) -#include "lexer.c" -#elif defined(__MWERKS__) -#include "../common/cwlex_yy.c" -#else -#include "../common/lex_yy.c" -#endif - -/* -void yyerror(s) -char *s; -{ - syntax_error(s); -} -*/ - -/* Ansi prototype. If this doesn't work for you... uncomment - the above instead. - */ - -void yyerror(char *s) -{ - syntax_error(s); -} - -/* - * Unfortunately, my DOS version of FLEX - * requires yywrap to be #def'ed, whereas - * the UNIX flex expects a proper function. - */ - -/* At least on alphaev6-dec-osf4.0e yywrap() must be #define'd. - * RL: ... but on Debian/Alpha(linux) it must not, so hopefully - * testing for __OSF__ here is what we really want. - */ -#ifdef __OSF__ -#ifndef yywrap -#define yywrap() 1 -#endif -#else -/* HH: Added test for __WX_SETUP_H__ for gnuwin builds - * using configure */ -#if !defined(__SC__) && !defined(__GNUWIN32__) -#ifdef USE_DEFINE -#ifndef yywrap -#define yywrap() 1 -#endif -#elif !defined(__ultrix) -int yywrap() { return 1; } -#elif defined(__VMS__) -int yywrap() { return 1; } -#endif -#elif defined(__WX_SETUP_H__) -int yywrap() { return 1; } -#endif -#endif - diff --git a/src/common/resourc2.cpp b/src/common/resourc2.cpp deleted file mode 100644 index 758f1c7..0000000 --- a/src/common/resourc2.cpp +++ /dev/null @@ -1,1573 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: resourc2.cpp -// Purpose: Resource system (2nd file). Only required for 16-bit BC++. -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "resource.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if wxUSE_WX_RESOURCES - -#ifdef __VISUALC__ - #pragma warning(disable:4706) // assignment within conditional expression -#endif // VC++ - -#ifndef WX_PRECOMP -#include "wx/defs.h" -#include "wx/setup.h" -#include "wx/list.h" -#include "wx/hash.h" -#include "wx/gdicmn.h" -#include "wx/utils.h" -#include "wx/types.h" -#include "wx/menu.h" -#include "wx/stattext.h" -#include "wx/button.h" -#include "wx/bmpbuttn.h" -#include "wx/radiobox.h" -#include "wx/listbox.h" -#include "wx/choice.h" -#include "wx/checkbox.h" -#include "wx/settings.h" -#include "wx/slider.h" -#include "wx/statbox.h" -#if wxUSE_GAUGE -#include "wx/gauge.h" -#endif -#include "wx/textctrl.h" -#include "wx/msgdlg.h" -#include "wx/intl.h" -#endif - -#if wxUSE_SCROLLBAR -#include "wx/scrolbar.h" -#endif - -#if wxUSE_COMBOBOX -#include "wx/combobox.h" -#endif - -#include "wx/validate.h" - -#include "wx/log.h" - -#include -#include -#include -#include - -#include "wx/resource.h" -#include "wx/string.h" -#include "wx/wxexpr.h" - -#include "wx/settings.h" - -#if ((defined(__BORLANDC__) || defined(__SC__)) && defined(__WIN16__)) - -// Forward (private) declarations -bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db); -wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel = FALSE); -wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr); -wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr); -wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, wxExpr *expr); -wxItemResource *wxResourceInterpretString(wxResourceTable& table, wxExpr *expr); -wxItemResource *wxResourceInterpretBitmap(wxResourceTable& table, wxExpr *expr); -wxItemResource *wxResourceInterpretIcon(wxResourceTable& table, wxExpr *expr); -// Interpret list expression -wxFont wxResourceInterpretFontSpec(wxExpr *expr); - -bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table = (wxResourceTable *) NULL); -bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table = (wxResourceTable *) NULL); - -extern wxResourceTable *wxDefaultResourceTable; - -extern char *wxResourceBuffer; -extern long wxResourceBufferSize; -extern long wxResourceBufferCount; -extern int wxResourceStringPtr; - -/* - * (Re)allocate buffer for reading in from resource file - */ - -bool wxReallocateResourceBuffer() -{ - if (!wxResourceBuffer) - { - wxResourceBufferSize = 1000; - wxResourceBuffer = new char[wxResourceBufferSize]; - return TRUE; - } - if (wxResourceBuffer) - { - long newSize = wxResourceBufferSize + 1000; - char *tmp = new char[(int)newSize]; - strncpy(tmp, wxResourceBuffer, (int)wxResourceBufferCount); - delete[] wxResourceBuffer; - wxResourceBuffer = tmp; - wxResourceBufferSize = newSize; - } - return TRUE; -} - -static bool wxEatWhiteSpace(FILE *fd) -{ - int ch = getc(fd); - if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9)) - { - ungetc(ch, fd); - return TRUE; - } - - // Eat whitespace - while (ch == ' ' || ch == 10 || ch == 13 || ch == 9) - ch = getc(fd); - // Check for comment - if (ch == '/') - { - ch = getc(fd); - if (ch == '*') - { - bool finished = FALSE; - while (!finished) - { - ch = getc(fd); - if (ch == EOF) - return FALSE; - if (ch == '*') - { - int newCh = getc(fd); - if (newCh == '/') - finished = TRUE; - else - { - ungetc(newCh, fd); - } - } - } - } - else // False alarm - return FALSE; - } - else - ungetc(ch, fd); - return wxEatWhiteSpace(fd); -} - -bool wxGetResourceToken(FILE *fd) -{ - if (!wxResourceBuffer) - wxReallocateResourceBuffer(); - wxResourceBuffer[0] = 0; - wxEatWhiteSpace(fd); - - int ch = getc(fd); - if (ch == '"') - { - // Get string - wxResourceBufferCount = 0; - ch = getc(fd); - while (ch != '"') - { - int actualCh = ch; - if (ch == EOF) - { - wxResourceBuffer[wxResourceBufferCount] = 0; - return FALSE; - } - // Escaped characters - else if (ch == '\\') - { - int newCh = getc(fd); - if (newCh == '"') - actualCh = '"'; - else if (newCh == 10) - actualCh = 10; - else - { - ungetc(newCh, fd); - } - } - - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; - wxResourceBufferCount ++; - ch = getc(fd); - } - wxResourceBuffer[wxResourceBufferCount] = 0; - } - else - { - wxResourceBufferCount = 0; - // Any other token - while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) - { - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)ch; - wxResourceBufferCount ++; - - ch = getc(fd); - } - wxResourceBuffer[wxResourceBufferCount] = 0; - if (ch == EOF) - return FALSE; - } - return TRUE; -} - -/* - * Files are in form: - static char *name = "...."; - with possible comments. - */ - -bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - // static or #define - if (!wxGetResourceToken(fd)) - { - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "#define") == 0) - { - wxGetResourceToken(fd); - char *name = copystring(wxResourceBuffer); - wxGetResourceToken(fd); - char *value = copystring(wxResourceBuffer); - if (isalpha(value[0])) - { - int val = (int)atol(value); - wxResourceAddIdentifier(name, val, table); - } - else - { - wxLogWarning(_("#define %s must be an integer."), name); - delete[] name; - delete[] value; - return FALSE; - } - delete[] name; - delete[] value; - - return TRUE; - } - else if (strcmp(wxResourceBuffer, "#include") == 0) - { - wxGetResourceToken(fd); - char *name = copystring(wxResourceBuffer); - char *actualName = name; - if (name[0] == '"') - actualName = name + 1; - int len = strlen(name); - if ((len > 0) && (name[len-1] == '"')) - name[len-1] = 0; - if (!wxResourceParseIncludeFile(actualName, table)) - { - wxLogWarning(_("Could not find resource include file %s."), actualName); - } - delete[] name; - return TRUE; - } - else if (strcmp(wxResourceBuffer, "static") != 0) - { - char buf[300]; - strcpy(buf, _("Found ")); - strncat(buf, wxResourceBuffer, 30); - strcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); - wxLogWarning(buf); - return FALSE; - } - - // char - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "char") != 0) - { - wxLogWarning(_("Expected 'char' whilst parsing resource.")); - return FALSE; - } - - // *name - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (wxResourceBuffer[0] != '*') - { - wxLogWarning(_("Expected '*' whilst parsing resource.")); - return FALSE; - } - char nameBuf[100]; - strncpy(nameBuf, wxResourceBuffer+1, 99); - - // = - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "=") != 0) - { - wxLogWarning(_("Expected '=' whilst parsing resource.")); - return FALSE; - } - - // String - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - else - { - if (!db.ReadPrologFromString(wxResourceBuffer)) - { - wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); - return FALSE; - } - } - // Semicolon - if (!wxGetResourceToken(fd)) - { - *eof = TRUE; - } - return TRUE; -} - -/* - * Parses string window style into integer window style - */ - -/* - * Style flag parsing, e.g. - * "wxSYSTEM_MENU | wxBORDER" -> integer - */ - -char* wxResourceParseWord(char*s, int *i) -{ - if (!s) - return (char*) NULL; - - static char buf[150]; - int len = strlen(s); - int j = 0; - int ii = *i; - while ((ii < len) && (isalpha(s[ii]) || (s[ii] == '_'))) - { - buf[j] = s[ii]; - j ++; - ii ++; - } - buf[j] = 0; - - // Eat whitespace and conjunction characters - while ((ii < len) && - ((s[ii] == ' ') || (s[ii] == '|') || (s[ii] == ','))) - { - ii ++; - } - *i = ii; - if (j == 0) - return (char*) NULL; - else - return buf; -} - -struct wxResourceBitListStruct -{ - char *word; - long bits; -}; - -static wxResourceBitListStruct wxResourceBitListTable[] = -{ - /* wxListBox */ - { "wxSINGLE", wxLB_SINGLE }, - { "wxMULTIPLE", wxLB_MULTIPLE }, - { "wxEXTENDED", wxLB_EXTENDED }, - { "wxLB_SINGLE", wxLB_SINGLE }, - { "wxLB_MULTIPLE", wxLB_MULTIPLE }, - { "wxLB_EXTENDED", wxLB_EXTENDED }, - { "wxLB_NEEDED_SB", wxLB_NEEDED_SB }, - { "wxLB_ALWAYS_SB", wxLB_ALWAYS_SB }, - { "wxLB_SORT", wxLB_SORT }, - { "wxLB_OWNERDRAW", wxLB_OWNERDRAW }, - { "wxLB_HSCROLL", wxLB_HSCROLL }, - - /* wxComboxBox */ - { "wxCB_SIMPLE", wxCB_SIMPLE }, - { "wxCB_DROPDOWN", wxCB_DROPDOWN }, - { "wxCB_READONLY", wxCB_READONLY }, - { "wxCB_SORT", wxCB_SORT }, - - /* wxGauge */ - { "wxGA_PROGRESSBAR", wxGA_PROGRESSBAR }, - { "wxGA_HORIZONTAL", wxGA_HORIZONTAL }, - { "wxGA_VERTICAL", wxGA_VERTICAL }, - - /* wxTextCtrl */ - { "wxPASSWORD", wxPASSWORD}, - { "wxPROCESS_ENTER", wxPROCESS_ENTER}, - { "wxTE_PASSWORD", wxTE_PASSWORD}, - { "wxTE_READONLY", wxTE_READONLY}, - { "wxTE_PROCESS_ENTER", wxTE_PROCESS_ENTER}, - { "wxTE_MULTILINE", wxTE_MULTILINE}, - - /* wxRadioBox/wxRadioButton */ - { "wxRB_GROUP", wxRB_GROUP }, - { "wxRA_SPECIFY_COLS", wxRA_SPECIFY_COLS }, - { "wxRA_SPECIFY_ROWS", wxRA_SPECIFY_ROWS }, - { "wxRA_HORIZONTAL", wxRA_HORIZONTAL }, - { "wxRA_VERTICAL", wxRA_VERTICAL }, - - /* wxSlider */ - { "wxSL_HORIZONTAL", wxSL_HORIZONTAL }, - { "wxSL_VERTICAL", wxSL_VERTICAL }, - { "wxSL_AUTOTICKS", wxSL_AUTOTICKS }, - { "wxSL_LABELS", wxSL_LABELS }, - { "wxSL_LEFT", wxSL_LEFT }, - { "wxSL_TOP", wxSL_TOP }, - { "wxSL_RIGHT", wxSL_RIGHT }, - { "wxSL_BOTTOM", wxSL_BOTTOM }, - { "wxSL_BOTH", wxSL_BOTH }, - { "wxSL_SELRANGE", wxSL_SELRANGE }, - - /* wxScrollBar */ - { "wxSB_HORIZONTAL", wxSB_HORIZONTAL }, - { "wxSB_VERTICAL", wxSB_VERTICAL }, - - /* wxButton */ - { "wxBU_AUTODRAW", wxBU_AUTODRAW }, - { "wxBU_NOAUTODRAW", wxBU_NOAUTODRAW }, - - /* wxTreeCtrl */ - { "wxTR_HAS_BUTTONS", wxTR_HAS_BUTTONS }, - { "wxTR_EDIT_LABELS", wxTR_EDIT_LABELS }, - { "wxTR_LINES_AT_ROOT", wxTR_LINES_AT_ROOT }, - - /* wxListCtrl */ - { "wxLC_ICON", wxLC_ICON }, - { "wxLC_SMALL_ICON", wxLC_SMALL_ICON }, - { "wxLC_LIST", wxLC_LIST }, - { "wxLC_REPORT", wxLC_REPORT }, - { "wxLC_ALIGN_TOP", wxLC_ALIGN_TOP }, - { "wxLC_ALIGN_LEFT", wxLC_ALIGN_LEFT }, - { "wxLC_AUTOARRANGE", wxLC_AUTOARRANGE }, - { "wxLC_USER_TEXT", wxLC_USER_TEXT }, - { "wxLC_EDIT_LABELS", wxLC_EDIT_LABELS }, - { "wxLC_NO_HEADER", wxLC_NO_HEADER }, - { "wxLC_NO_SORT_HEADER", wxLC_NO_SORT_HEADER }, - { "wxLC_SINGLE_SEL", wxLC_SINGLE_SEL }, - { "wxLC_SORT_ASCENDING", wxLC_SORT_ASCENDING }, - { "wxLC_SORT_DESCENDING", wxLC_SORT_DESCENDING }, - - /* wxSpinButton */ - { "wxSP_VERTICAL", wxSP_VERTICAL}, - { "wxSP_HORIZONTAL", wxSP_HORIZONTAL}, - { "wxSP_ARROW_KEYS", wxSP_ARROW_KEYS}, - { "wxSP_WRAP", wxSP_WRAP}, - - /* wxSplitterWnd */ - { "wxSP_NOBORDER", wxSP_NOBORDER}, - { "wxSP_3D", wxSP_3D}, - { "wxSP_BORDER", wxSP_BORDER}, - - /* wxTabCtrl */ - { "wxTC_MULTILINE", wxTC_MULTILINE}, - { "wxTC_RIGHTJUSTIFY", wxTC_RIGHTJUSTIFY}, - { "wxTC_FIXEDWIDTH", wxTC_FIXEDWIDTH}, - { "wxTC_OWNERDRAW", wxTC_OWNERDRAW}, - - /* wxStatusBar95 */ - { "wxST_SIZEGRIP", wxST_SIZEGRIP}, - - /* wxControl */ - { "wxFIXED_LENGTH", wxFIXED_LENGTH}, - { "wxALIGN_LEFT", wxALIGN_LEFT}, - { "wxALIGN_CENTER", wxALIGN_CENTER}, - { "wxALIGN_CENTRE", wxALIGN_CENTRE}, - { "wxALIGN_RIGHT", wxALIGN_RIGHT}, - { "wxCOLOURED", wxCOLOURED}, - - /* wxToolBar */ - { "wxTB_3DBUTTONS", wxTB_3DBUTTONS}, - { "wxTB_HORIZONTAL", wxTB_HORIZONTAL}, - { "wxTB_VERTICAL", wxTB_VERTICAL}, - { "wxTB_FLAT", wxTB_FLAT}, - - /* Generic */ - { "wxVSCROLL", wxVSCROLL }, - { "wxHSCROLL", wxHSCROLL }, - { "wxCAPTION", wxCAPTION }, - { "wxSTAY_ON_TOP", wxSTAY_ON_TOP}, - { "wxICONIZE", wxICONIZE}, - { "wxMINIMIZE", wxICONIZE}, - { "wxMAXIMIZE", wxMAXIMIZE}, - { "wxSDI", 0}, - { "wxMDI_PARENT", 0}, - { "wxMDI_CHILD", 0}, - { "wxTHICK_FRAME", wxTHICK_FRAME}, - { "wxRESIZE_BORDER", wxRESIZE_BORDER}, - { "wxSYSTEM_MENU", wxSYSTEM_MENU}, - { "wxMINIMIZE_BOX", wxMINIMIZE_BOX}, - { "wxMAXIMIZE_BOX", wxMAXIMIZE_BOX}, - { "wxRESIZE_BOX", wxRESIZE_BOX}, - { "wxDEFAULT_FRAME_STYLE", wxDEFAULT_FRAME_STYLE}, - { "wxDEFAULT_FRAME", wxDEFAULT_FRAME_STYLE}, - { "wxDEFAULT_DIALOG_STYLE", wxDEFAULT_DIALOG_STYLE}, - { "wxBORDER", wxBORDER}, - { "wxRETAINED", wxRETAINED}, - { "wxNATIVE_IMPL", 0}, - { "wxEXTENDED_IMPL", 0}, - { "wxBACKINGSTORE", wxBACKINGSTORE}, -// { "wxFLAT", wxFLAT}, -// { "wxMOTIF_RESIZE", wxMOTIF_RESIZE}, - { "wxFIXED_LENGTH", 0}, - { "wxDOUBLE_BORDER", wxDOUBLE_BORDER}, - { "wxSUNKEN_BORDER", wxSUNKEN_BORDER}, - { "wxRAISED_BORDER", wxRAISED_BORDER}, - { "wxSIMPLE_BORDER", wxSIMPLE_BORDER}, - { "wxSTATIC_BORDER", wxSTATIC_BORDER}, - { "wxTRANSPARENT_WINDOW", wxTRANSPARENT_WINDOW}, - { "wxNO_BORDER", wxNO_BORDER}, - { "wxCLIP_CHILDREN", wxCLIP_CHILDREN}, - - { "wxTINY_CAPTION_HORIZ", wxTINY_CAPTION_HORIZ}, - { "wxTINY_CAPTION_VERT", wxTINY_CAPTION_VERT}, - - // Text font families - { "wxDEFAULT", wxDEFAULT}, - { "wxDECORATIVE", wxDECORATIVE}, - { "wxROMAN", wxROMAN}, - { "wxSCRIPT", wxSCRIPT}, - { "wxSWISS", wxSWISS}, - { "wxMODERN", wxMODERN}, - { "wxTELETYPE", wxTELETYPE}, - { "wxVARIABLE", wxVARIABLE}, - { "wxFIXED", wxFIXED}, - { "wxNORMAL", wxNORMAL}, - { "wxLIGHT", wxLIGHT}, - { "wxBOLD", wxBOLD}, - { "wxITALIC", wxITALIC}, - { "wxSLANT", wxSLANT}, - { "wxSOLID", wxSOLID}, - { "wxDOT", wxDOT}, - { "wxLONG_DASH", wxLONG_DASH}, - { "wxSHORT_DASH", wxSHORT_DASH}, - { "wxDOT_DASH", wxDOT_DASH}, - { "wxUSER_DASH", wxUSER_DASH}, - { "wxTRANSPARENT", wxTRANSPARENT}, - { "wxSTIPPLE", wxSTIPPLE}, - { "wxBDIAGONAL_HATCH", wxBDIAGONAL_HATCH}, - { "wxCROSSDIAG_HATCH", wxCROSSDIAG_HATCH}, - { "wxFDIAGONAL_HATCH", wxFDIAGONAL_HATCH}, - { "wxCROSS_HATCH", wxCROSS_HATCH}, - { "wxHORIZONTAL_HATCH", wxHORIZONTAL_HATCH}, - { "wxVERTICAL_HATCH", wxVERTICAL_HATCH}, - { "wxJOIN_BEVEL", wxJOIN_BEVEL}, - { "wxJOIN_MITER", wxJOIN_MITER}, - { "wxJOIN_ROUND", wxJOIN_ROUND}, - { "wxCAP_ROUND", wxCAP_ROUND}, - { "wxCAP_PROJECTING", wxCAP_PROJECTING}, - { "wxCAP_BUTT", wxCAP_BUTT}, - - // Logical ops - { "wxCLEAR", wxCLEAR}, - { "wxXOR", wxXOR}, - { "wxINVERT", wxINVERT}, - { "wxOR_REVERSE", wxOR_REVERSE}, - { "wxAND_REVERSE", wxAND_REVERSE}, - { "wxCOPY", wxCOPY}, - { "wxAND", wxAND}, - { "wxAND_INVERT", wxAND_INVERT}, - { "wxNO_OP", wxNO_OP}, - { "wxNOR", wxNOR}, - { "wxEQUIV", wxEQUIV}, - { "wxSRC_INVERT", wxSRC_INVERT}, - { "wxOR_INVERT", wxOR_INVERT}, - { "wxNAND", wxNAND}, - { "wxOR", wxOR}, - { "wxSET", wxSET}, - - { "wxFLOOD_SURFACE", wxFLOOD_SURFACE}, - { "wxFLOOD_BORDER", wxFLOOD_BORDER}, - { "wxODDEVEN_RULE", wxODDEVEN_RULE}, - { "wxWINDING_RULE", wxWINDING_RULE}, - { "wxHORIZONTAL", wxHORIZONTAL}, - { "wxVERTICAL", wxVERTICAL}, - { "wxBOTH", wxBOTH}, - { "wxCENTER_FRAME", wxCENTER_FRAME}, - { "wxOK", wxOK}, - { "wxYES_NO", wxYES_NO}, - { "wxCANCEL", wxCANCEL}, - { "wxYES", wxYES}, - { "wxNO", wxNO}, - { "wxICON_EXCLAMATION", wxICON_EXCLAMATION}, - { "wxICON_HAND", wxICON_HAND}, - { "wxICON_QUESTION", wxICON_QUESTION}, - { "wxICON_INFORMATION", wxICON_INFORMATION}, - { "wxICON_STOP", wxICON_STOP}, - { "wxICON_ASTERISK", wxICON_ASTERISK}, - { "wxICON_MASK", wxICON_MASK}, - { "wxCENTRE", wxCENTRE}, - { "wxCENTER", wxCENTRE}, - { "wxUSER_COLOURS", wxUSER_COLOURS}, - { "wxVERTICAL_LABEL", 0}, - { "wxHORIZONTAL_LABEL", 0}, - - // Bitmap types (not strictly styles) - { "wxBITMAP_TYPE_XPM", wxBITMAP_TYPE_XPM}, - { "wxBITMAP_TYPE_XBM", wxBITMAP_TYPE_XBM}, - { "wxBITMAP_TYPE_BMP", wxBITMAP_TYPE_BMP}, - { "wxBITMAP_TYPE_RESOURCE", wxBITMAP_TYPE_BMP_RESOURCE}, - { "wxBITMAP_TYPE_BMP_RESOURCE", wxBITMAP_TYPE_BMP_RESOURCE}, - { "wxBITMAP_TYPE_GIF", wxBITMAP_TYPE_GIF}, - { "wxBITMAP_TYPE_TIF", wxBITMAP_TYPE_TIF}, - { "wxBITMAP_TYPE_ICO", wxBITMAP_TYPE_ICO}, - { "wxBITMAP_TYPE_ICO_RESOURCE", wxBITMAP_TYPE_ICO_RESOURCE}, - { "wxBITMAP_TYPE_CUR", wxBITMAP_TYPE_CUR}, - { "wxBITMAP_TYPE_CUR_RESOURCE", wxBITMAP_TYPE_CUR_RESOURCE}, - { "wxBITMAP_TYPE_XBM_DATA", wxBITMAP_TYPE_XBM_DATA}, - { "wxBITMAP_TYPE_XPM_DATA", wxBITMAP_TYPE_XPM_DATA}, - { "wxBITMAP_TYPE_ANY", wxBITMAP_TYPE_ANY} -}; - -static int wxResourceBitListCount = (sizeof(wxResourceBitListTable)/sizeof(wxResourceBitListStruct)); - -long wxParseWindowStyle(const wxString& bitListString) -{ - int i = 0; - char *word; - long bitList = 0; - while ((word = wxResourceParseWord((char*) (const char*) bitListString, &i))) - { - bool found = FALSE; - int j; - for (j = 0; j < wxResourceBitListCount; j++) - if (strcmp(wxResourceBitListTable[j].word, word) == 0) - { - bitList |= wxResourceBitListTable[j].bits; - found = TRUE; - break; - } - if (!found) - { - wxLogWarning(_("Unrecognized style %s whilst parsing resource."), word); - return 0; - } - } - return bitList; -} - -/* - * Load a bitmap from a wxWindows resource, choosing an optimum - * depth and appropriate type. - */ - -wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *item = table->FindResource(resource); - if (item) - { - if ((item->GetType() == "") || (item->GetType() != "wxBitmap")) - { - wxLogWarning(_("%s not a bitmap resource specification."), (const char*) resource); - return wxNullBitmap; - } - int thisDepth = wxDisplayDepth(); - long thisNoColours = (long)pow(2.0, (double)thisDepth); - - wxItemResource *optResource = (wxItemResource *) NULL; - - // Try to find optimum bitmap for this platform/colour depth - wxNode *node = item->GetChildren().First(); - while (node) - { - wxItemResource *child = (wxItemResource *)node->Data(); - int platform = (int)child->GetValue2(); - int noColours = (int)child->GetValue3(); -/* - char *name = child->GetName(); - int bitmapType = (int)child->GetValue1(); - int xRes = child->GetWidth(); - int yRes = child->GetHeight(); -*/ - - switch (platform) - { - case RESOURCE_PLATFORM_ANY: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours. - // If noColours is zero (unspecified), then assume this - // is the right one. - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#ifdef __WXMSW__ - case RESOURCE_PLATFORM_WINDOWS: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours > 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif -#ifdef __WXGTK__ - case RESOURCE_PLATFORM_X: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif -#ifdef wx_max - case RESOURCE_PLATFORM_MAC: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif - default: - break; - } - node = node->Next(); - } - // If no matching resource, fail. - if (!optResource) - return wxNullBitmap; - - wxString name = optResource->GetName(); - int bitmapType = (int)optResource->GetValue1(); - switch (bitmapType) - { - case wxBITMAP_TYPE_XBM_DATA: - { -#ifdef __WXGTK__ - wxItemResource *item = table->FindResource(name); - if (!item) - { - wxLogWarning(_("Failed to find XBM resource %s.\n" - "Forgot to use wxResourceLoadBitmapData?"), (const char*) name); - return wxNullBitmap; - } - return wxBitmap(item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()) ; -#else - wxLogWarning(_("No XBM facility available!")); -#endif - break; - } - case wxBITMAP_TYPE_XPM_DATA: - { - wxItemResource *item = table->FindResource(name); - if (!item) - { - wxLogWarning(_("Failed to find XPM resource %s.\n" - "Forgot to use wxResourceLoadBitmapData?"), (const char*) name); - return wxNullBitmap; - } - return wxBitmap(item->GetValue1()); - break; - } - default: - { - return wxBitmap(name, bitmapType); - break; - } - } - return wxNullBitmap; - } - else - { - wxLogWarning(_("Bitmap resource specification %s not found."), (const char*) resource); - return wxNullBitmap; - } -} - -/* - * Load an icon from a wxWindows resource, choosing an optimum - * depth and appropriate type. - */ - -wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *item = table->FindResource(resource); - if (item) - { - if ((item->GetType() == "") || (item->GetType() != "wxIcon")) - { - wxLogWarning(_("%s not an icon resource specification."), (const char*) resource); - return wxNullIcon; - } - int thisDepth = wxDisplayDepth(); - long thisNoColours = (long)pow(2.0, (double)thisDepth); - - wxItemResource *optResource = (wxItemResource *) NULL; - - // Try to find optimum icon for this platform/colour depth - wxNode *node = item->GetChildren().First(); - while (node) - { - wxItemResource *child = (wxItemResource *)node->Data(); - int platform = (int)child->GetValue2(); - int noColours = (int)child->GetValue3(); -/* - char *name = child->GetName(); - int bitmapType = (int)child->GetValue1(); - int xRes = child->GetWidth(); - int yRes = child->GetHeight(); -*/ - - switch (platform) - { - case RESOURCE_PLATFORM_ANY: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours. - // If noColours is zero (unspecified), then assume this - // is the right one. - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#ifdef __WXMSW__ - case RESOURCE_PLATFORM_WINDOWS: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours > 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif -#ifdef __WXGTK__ - case RESOURCE_PLATFORM_X: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif -#ifdef wx_max - case RESOURCE_PLATFORM_MAC: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif - default: - break; - } - node = node->Next(); - } - // If no matching resource, fail. - if (!optResource) - return wxNullIcon; - - wxString name = optResource->GetName(); - int bitmapType = (int)optResource->GetValue1(); - switch (bitmapType) - { - case wxBITMAP_TYPE_XBM_DATA: - { -#ifdef __WXGTK__ - wxItemResource *item = table->FindResource(name); - if (!item) - { - wxLogWarning(_("Failed to find XBM resource %s.\n" - "Forgot to use wxResourceLoadIconData?"), (const char*) name); - return wxNullIcon; - } - return wxIcon((const char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()); -#else - wxLogWarning(_("No XBM facility available!")); -#endif - break; - } - case wxBITMAP_TYPE_XPM_DATA: - { - // *** XPM ICON NOT YET IMPLEMENTED IN WXWINDOWS *** -/* - wxItemResource *item = table->FindResource(name); - if (!item) - { - char buf[400]; - sprintf(buf, _("Failed to find XPM resource %s.\nForgot to use wxResourceLoadIconData?"), name); - wxLogWarning(buf); - return NULL; - } - return wxIcon((char **)item->GetValue1()); -*/ - wxLogWarning(_("No XPM icon facility available!")); - break; - } - default: - { -#ifdef __WXGTK__ - wxLogWarning(_("Icon resource specification %s not found."), (const char*) resource); -#else - return wxIcon(name, bitmapType); -#endif - break; - } - } - return wxNullIcon; - } - else - { - wxLogWarning(_("Icon resource specification %s not found."), (const char*) resource); - return wxNullIcon; - } -} - -wxMenu *wxResourceCreateMenu(wxItemResource *item) -{ - wxMenu *menu = new wxMenu; - wxNode *node = item->GetChildren().First(); - while (node) - { - wxItemResource *child = (wxItemResource *)node->Data(); - if ((child->GetType() != "") && (child->GetType() == "wxMenuSeparator")) - menu->AppendSeparator(); - else if (child->GetChildren().Number() > 0) - { - wxMenu *subMenu = wxResourceCreateMenu(child); - if (subMenu) - menu->Append((int)child->GetValue1(), child->GetTitle(), subMenu, child->GetValue4()); - } - else - { - menu->Append((int)child->GetValue1(), child->GetTitle(), child->GetValue4(), (child->GetValue2() != 0)); - } - node = node->Next(); - } - return menu; -} - -wxMenuBar *wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *table, wxMenuBar *menuBar) -{ - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *menuResource = table->FindResource(resource); - if (menuResource && (menuResource->GetType() != "") && (menuResource->GetType() == "wxMenu")) - { - if (!menuBar) - menuBar = new wxMenuBar; - wxNode *node = menuResource->GetChildren().First(); - while (node) - { - wxItemResource *child = (wxItemResource *)node->Data(); - wxMenu *menu = wxResourceCreateMenu(child); - if (menu) - menuBar->Append(menu, child->GetTitle()); - node = node->Next(); - } - return menuBar; - } - return (wxMenuBar *) NULL; -} - -wxMenu *wxResourceCreateMenu(const wxString& resource, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *menuResource = table->FindResource(resource); - if (menuResource && (menuResource->GetType() != "") && (menuResource->GetType() == "wxMenu")) -// if (menuResource && (menuResource->GetType() == wxTYPE_MENU)) - return wxResourceCreateMenu(menuResource); - return (wxMenu *) NULL; -} - -// Global equivalents (so don't have to refer to default table explicitly) -bool wxResourceParseData(const wxString& resource, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - return table->ParseResourceData(resource); -} - -bool wxResourceParseFile(const wxString& filename, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - return table->ParseResourceFile(filename); -} - -// Register XBM/XPM data -bool wxResourceRegisterBitmapData(const wxString& name, char bits[], int width, int height, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - return table->RegisterResourceBitmapData(name, bits, width, height); -} - -bool wxResourceRegisterBitmapData(const wxString& name, char **data, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - return table->RegisterResourceBitmapData(name, data); -} - -void wxResourceClear(wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - table->ClearTable(); -} - -/* - * Identifiers - */ - -bool wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - table->identifiers.Put(name, (wxObject *)value); - return TRUE; -} - -int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - return (int)table->identifiers.Get(name); -} - -/* - * Parse #include file for #defines (only) - */ - -bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - FILE *fd = fopen(f, "r"); - if (!fd) - { - return FALSE; - } - while (wxGetResourceToken(fd)) - { - if (strcmp(wxResourceBuffer, "#define") == 0) - { - wxGetResourceToken(fd); - char *name = copystring(wxResourceBuffer); - wxGetResourceToken(fd); - char *value = copystring(wxResourceBuffer); - if (isdigit(value[0])) - { - int val = (int)atol(value); - wxResourceAddIdentifier(name, val, table); - } - delete[] name; - delete[] value; - } - } - fclose(fd); - return TRUE; -} - -/* - * Reading strings as if they were .wxr files - */ - -static int getc_string(char *s) -{ - int ch = s[wxResourceStringPtr]; - if (ch == 0) - return EOF; - else - { - wxResourceStringPtr ++; - return ch; - } -} - -static int ungetc_string() -{ - wxResourceStringPtr --; - return 0; -} - -bool wxEatWhiteSpaceString(char *s) -{ - int ch = getc_string(s); - if (ch == EOF) - return TRUE; - - if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9)) - { - ungetc_string(); - return TRUE; - } - - // Eat whitespace - while (ch == ' ' || ch == 10 || ch == 13 || ch == 9) - ch = getc_string(s); - // Check for comment - if (ch == '/') - { - ch = getc_string(s); - if (ch == '*') - { - bool finished = FALSE; - while (!finished) - { - ch = getc_string(s); - if (ch == EOF) - return FALSE; - if (ch == '*') - { - int newCh = getc_string(s); - if (newCh == '/') - finished = TRUE; - else - { - ungetc_string(); - } - } - } - } - else // False alarm - return FALSE; - } - else if (ch != EOF) - ungetc_string(); - return wxEatWhiteSpaceString(s); -} - -bool wxGetResourceTokenString(char *s) -{ - if (!wxResourceBuffer) - wxReallocateResourceBuffer(); - wxResourceBuffer[0] = 0; - wxEatWhiteSpaceString(s); - - int ch = getc_string(s); - if (ch == '"') - { - // Get string - wxResourceBufferCount = 0; - ch = getc_string(s); - while (ch != '"') - { - int actualCh = ch; - if (ch == EOF) - { - wxResourceBuffer[wxResourceBufferCount] = 0; - return FALSE; - } - // Escaped characters - else if (ch == '\\') - { - int newCh = getc_string(s); - if (newCh == '"') - actualCh = '"'; - else if (newCh == 10) - actualCh = 10; - else - { - ungetc_string(); - } - } - - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; - wxResourceBufferCount ++; - ch = getc_string(s); - } - wxResourceBuffer[wxResourceBufferCount] = 0; - } - else - { - wxResourceBufferCount = 0; - // Any other token - while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) - { - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)ch; - wxResourceBufferCount ++; - - ch = getc_string(s); - } - wxResourceBuffer[wxResourceBufferCount] = 0; - if (ch == EOF) - return FALSE; - } - return TRUE; -} - -/* - * Files are in form: - static char *name = "...."; - with possible comments. - */ - -bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - // static or #define - if (!wxGetResourceTokenString(s)) - { - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "#define") == 0) - { - wxGetResourceTokenString(s); - char *name = copystring(wxResourceBuffer); - wxGetResourceTokenString(s); - char *value = copystring(wxResourceBuffer); - if (isalpha(value[0])) - { - int val = (int)atol(value); - wxResourceAddIdentifier(name, val, table); - } - else - { - wxLogWarning(_("#define %s must be an integer."), name); - delete[] name; - delete[] value; - return FALSE; - } - delete[] name; - delete[] value; - - return TRUE; - } -/* - else if (strcmp(wxResourceBuffer, "#include") == 0) - { - wxGetResourceTokenString(s); - char *name = copystring(wxResourceBuffer); - char *actualName = name; - if (name[0] == '"') - actualName = name + 1; - int len = strlen(name); - if ((len > 0) && (name[len-1] == '"')) - name[len-1] = 0; - if (!wxResourceParseIncludeFile(actualName, table)) - { - char buf[400]; - sprintf(buf, _("Could not find resource include file %s."), actualName); - wxLogWarning(buf); - } - delete[] name; - return TRUE; - } -*/ - else if (strcmp(wxResourceBuffer, "static") != 0) - { - char buf[300]; - strcpy(buf, _("Found ")); - strncat(buf, wxResourceBuffer, 30); - strcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); - wxLogWarning(buf); - return FALSE; - } - - // char - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "char") != 0) - { - wxLogWarning(_("Expected 'char' whilst parsing resource.")); - return FALSE; - } - - // *name - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (wxResourceBuffer[0] != '*') - { - wxLogWarning(_("Expected '*' whilst parsing resource.")); - return FALSE; - } - char nameBuf[100]; - strncpy(nameBuf, wxResourceBuffer+1, 99); - - // = - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "=") != 0) - { - wxLogWarning(_("Expected '=' whilst parsing resource.")); - return FALSE; - } - - // String - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - else - { - if (!db.ReadPrologFromString(wxResourceBuffer)) - { - wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); - return FALSE; - } - } - // Semicolon - if (!wxGetResourceTokenString(s)) - { - *eof = TRUE; - } - return TRUE; -} - -bool wxResourceParseString(char *s, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - if (!s) - return FALSE; - - // Turn backslashes into spaces - if (s) - { - int len = strlen(s); - int i; - for (i = 0; i < len; i++) - if (s[i] == 92 && s[i+1] == 13) - { - s[i] = ' '; - s[i+1] = ' '; - } - } - - wxExprDatabase db; - wxResourceStringPtr = 0; - - bool eof = FALSE; - while (wxResourceReadOneResourceString(s, db, &eof, table) && !eof) - { - // Loop - } - return wxResourceInterpretResources(*table, db); -} - -/* - * resource loading facility - */ - -bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *resource = table->FindResource((const char *)resourceName); -// if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX)) - if (!resource || (resource->GetType() == "") || - ! ((strcmp(resource->GetType(), "wxDialog") == 0) || (strcmp(resource->GetType(), "wxPanel") == 0))) - return FALSE; - - wxString title(resource->GetTitle()); - long theWindowStyle = resource->GetStyle(); - bool isModal = (resource->GetValue1() != 0); - int x = resource->GetX(); - int y = resource->GetY(); - int width = resource->GetWidth(); - int height = resource->GetHeight(); - wxString name = resource->GetName(); - - if (IsKindOf(CLASSINFO(wxDialog))) - { - wxDialog *dialogBox = (wxDialog *)this; - long modalStyle = isModal ? wxDIALOG_MODAL : 0; - if (!dialogBox->Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), theWindowStyle|modalStyle, name)) - return FALSE; - - // Only reset the client size if we know we're not going to do it again below. - if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == 0) - dialogBox->SetClientSize(width, height); - } - else if (IsKindOf(CLASSINFO(wxPanel))) - { - wxPanel* panel = (wxPanel *)this; - if (!panel->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name)) - return FALSE; - } - else - { - if (!this->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name)) - return FALSE; - } - - if ((resource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) - { - // No need to do this since it's done in wxPanel or wxDialog constructor. - // SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - } - else - { - if (resource->GetFont().Ok()) - SetFont(resource->GetFont()); - if (resource->GetBackgroundColour().Ok()) - SetBackgroundColour(resource->GetBackgroundColour()); - } - - // Should have some kind of font at this point - if (!GetFont().Ok()) - SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - if (!GetBackgroundColour().Ok()) - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); - - // Only when we've created the window and set the font can we set the correct size, - // if based on dialog units. - if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) - { - wxSize sz = ConvertDialogToPixels(wxSize(width, height)); - SetClientSize(sz.x, sz.y); - - wxPoint pt = ConvertDialogToPixels(wxPoint(x, y)); - #ifdef __WXMAC__ - int mbarheight = 2 * LMGetMBarHeight() ; - pt.y += mbarheight ; - #endif - Move(pt.x, pt.y); - } - - // Now create children - wxNode *node = resource->GetChildren().First(); - while (node) - { - wxItemResource *childResource = (wxItemResource *)node->Data(); - - (void) CreateItem(childResource, resource, table); - - node = node->Next(); - } - return TRUE; -} - -wxControl *wxWindow::CreateItem(const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - return table->CreateItem((wxWindow *)this, resource, parentResource); -} - -#ifdef __VISUALC__ - #pragma warning(default:4706) // assignment within conditional expression -#endif // VC++ - -#endif - // BC++/Win16 only -#endif // wxUSE_WX_RESOURCES diff --git a/src/common/resource.cpp b/src/common/resource.cpp deleted file mode 100644 index 92785ac3..0000000 --- a/src/common/resource.cpp +++ /dev/null @@ -1,3263 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: resource.cpp -// Purpose: Resource system -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "resource.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if wxUSE_WX_RESOURCES - -#ifdef __VISUALC__ -#pragma warning(disable:4706) // assignment within conditional expression -#endif // VC++ - -#ifndef WX_PRECOMP -#include "wx/defs.h" -#include "wx/setup.h" -#include "wx/list.h" -#include "wx/hash.h" -#include "wx/gdicmn.h" -#include "wx/utils.h" -#include "wx/types.h" -#include "wx/menu.h" -#include "wx/stattext.h" -#include "wx/button.h" -#include "wx/bmpbuttn.h" -#include "wx/radiobox.h" -#include "wx/listbox.h" -#include "wx/choice.h" -#include "wx/checkbox.h" -#include "wx/settings.h" -#include "wx/slider.h" -#include "wx/icon.h" -#include "wx/statbox.h" -#include "wx/statbmp.h" -#include "wx/gauge.h" -#include "wx/textctrl.h" -#include "wx/msgdlg.h" -#include "wx/intl.h" -#endif - -#include "wx/treebase.h" -#include "wx/listctrl.h" - -#if wxUSE_RADIOBTN -#include "wx/radiobut.h" -#endif - -#if wxUSE_SCROLLBAR -#include "wx/scrolbar.h" -#endif - -#if wxUSE_COMBOBOX -#include "wx/combobox.h" -#endif - -#include "wx/validate.h" - -#include "wx/log.h" - -#include -#include -#include -#include - -#include "wx/resource.h" -#include "wx/string.h" -#include "wx/wxexpr.h" - -#include "wx/settings.h" -#include "wx/stream.h" - -// Forward (private) declarations -bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db); -wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel = FALSE); -wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr); -wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr); -wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, wxExpr *expr); -wxItemResource *wxResourceInterpretString(wxResourceTable& table, wxExpr *expr); -wxItemResource *wxResourceInterpretBitmap(wxResourceTable& table, wxExpr *expr); -wxItemResource *wxResourceInterpretIcon(wxResourceTable& table, wxExpr *expr); -// Interpret list expression -wxFont wxResourceInterpretFontSpec(wxExpr *expr); - -bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table = (wxResourceTable *) NULL); -bool wxResourceReadOneResource(wxInputStream *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table) ; -bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table = (wxResourceTable *) NULL); - -wxResourceTable *wxDefaultResourceTable = (wxResourceTable *) NULL; - -char *wxResourceBuffer = (char *) NULL; -long wxResourceBufferSize = 0; -long wxResourceBufferCount = 0; -int wxResourceStringPtr = 0; - -void wxInitializeResourceSystem() -{ - wxDefaultResourceTable = new wxResourceTable; -} - -void wxCleanUpResourceSystem() -{ - delete wxDefaultResourceTable; - if (wxResourceBuffer) - delete[] wxResourceBuffer; -} - -#if 0 -void wxLogWarning(char *msg) -{ - wxMessageBox(msg, _("Warning"), wxOK); -} -#endif - -IMPLEMENT_DYNAMIC_CLASS(wxItemResource, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable) - -wxItemResource::wxItemResource() -{ - m_itemType = wxT(""); - m_title = wxT(""); - m_name = wxT(""); - m_windowStyle = 0; - m_x = m_y = m_width = m_height = 0; - m_value1 = m_value2 = m_value3 = m_value5 = 0; - m_value4 = wxT(""); - m_windowId = 0; - m_exStyle = 0; -} - -wxItemResource::~wxItemResource() -{ - wxNode *node = m_children.First(); - while (node) - { - wxItemResource *item = (wxItemResource *)node->Data(); - delete item; - delete node; - node = m_children.First(); - } -} - -/* -* Resource table -*/ - -wxResourceTable::wxResourceTable():wxHashTable(wxKEY_STRING), identifiers(wxKEY_STRING) -{ -} - -wxResourceTable::~wxResourceTable() -{ - ClearTable(); -} - -wxItemResource *wxResourceTable::FindResource(const wxString& name) const -{ - wxItemResource *item = (wxItemResource *)Get(WXSTRINGCAST name); - return item; -} - -void wxResourceTable::AddResource(wxItemResource *item) -{ - wxString name = item->GetName(); - if (name == wxT("")) - name = item->GetTitle(); - if (name == wxT("")) - name = wxT("no name"); - - // Delete existing resource, if any. - Delete(name); - - Put(name, item); -} - -bool wxResourceTable::DeleteResource(const wxString& name) -{ - wxItemResource *item = (wxItemResource *)Delete(WXSTRINGCAST name); - if (item) - { - // See if any resource has this as its child; if so, delete from - // parent's child list. - BeginFind(); - wxNode *node = (wxNode *) NULL; - node = Next(); - while (node != NULL) - { - wxItemResource *parent = (wxItemResource *)node->Data(); - if (parent->GetChildren().Member(item)) - { - parent->GetChildren().DeleteObject(item); - break; - } - node = Next(); - } - - delete item; - return TRUE; - } - else - return FALSE; -} - -bool wxResourceTable::ParseResourceFile( wxInputStream *is ) -{ - wxExprDatabase db; - int len = is->GetSize() ; - - bool eof = FALSE; - while ( is->TellI() + 10 < len) // it's a hack because the streams dont support EOF - { - wxResourceReadOneResource(is, db, &eof, this) ; - } - return wxResourceInterpretResources(*this, db); -} - -bool wxResourceTable::ParseResourceFile(const wxString& filename) -{ - wxExprDatabase db; - - FILE *fd = wxFopen(filename, wxT("r")); - if (!fd) - return FALSE; - bool eof = FALSE; - while (wxResourceReadOneResource(fd, db, &eof, this) && !eof) - { - // Loop - } - fclose(fd); - return wxResourceInterpretResources(*this, db); -} - -bool wxResourceTable::ParseResourceData(const wxString& data) -{ - wxExprDatabase db; - if (!db.ReadFromString(data)) - { - wxLogWarning(_("Ill-formed resource file syntax.")); - return FALSE; - } - - return wxResourceInterpretResources(*this, db); -} - -bool wxResourceTable::RegisterResourceBitmapData(const wxString& name, char bits[], int width, int height) -{ - // Register pre-loaded bitmap data - wxItemResource *item = new wxItemResource; - // item->SetType(wxRESOURCE_TYPE_XBM_DATA); - item->SetType(wxT("wxXBMData")); - item->SetName(name); - item->SetValue1((long)bits); - item->SetValue2((long)width); - item->SetValue3((long)height); - AddResource(item); - return TRUE; -} - -bool wxResourceTable::RegisterResourceBitmapData(const wxString& name, char **data) -{ - // Register pre-loaded bitmap data - wxItemResource *item = new wxItemResource; - // item->SetType(wxRESOURCE_TYPE_XPM_DATA); - item->SetType(wxT("wxXPMData")); - item->SetName(name); - item->SetValue1((long)data); - AddResource(item); - return TRUE; -} - -bool wxResourceTable::SaveResource(const wxString& WXUNUSED(filename)) -{ - return FALSE; -} - -void wxResourceTable::ClearTable() -{ - BeginFind(); - wxNode *node = Next(); - while (node) - { - wxNode *next = Next(); - wxItemResource *item = (wxItemResource *)node->Data(); - delete item; - delete node; - node = next; - } -} - -wxControl *wxResourceTable::CreateItem(wxWindow *parent, const wxItemResource* childResource, const wxItemResource* parentResource) const -{ - int id = childResource->GetId(); - if ( id == 0 ) - id = -1; - - bool dlgUnits = ((parentResource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0); - - wxControl *control = (wxControl *) NULL; - wxString itemType(childResource->GetType()); - - wxPoint pos; - wxSize size; - if (dlgUnits) - { - pos = parent->ConvertDialogToPixels(wxPoint(childResource->GetX(), childResource->GetY())); - size = parent->ConvertDialogToPixels(wxSize(childResource->GetWidth(), childResource->GetHeight())); - } - else - { - pos = wxPoint(childResource->GetX(), childResource->GetY()); - size = wxSize(childResource->GetWidth(), childResource->GetHeight()); - } - - if (itemType == wxString(wxT("wxButton")) || itemType == wxString(wxT("wxBitmapButton"))) - { - if (childResource->GetValue4() != wxT("")) - { - // Bitmap button - wxBitmap bitmap = childResource->GetBitmap(); - if (!bitmap.Ok()) - { - bitmap = wxResourceCreateBitmap(childResource->GetValue4(), (wxResourceTable *)this); - ((wxItemResource*) childResource)->SetBitmap(bitmap); - } - if (!bitmap.Ok()) -#if defined(__WXPM__) - // - // OS/2 uses integer id's to access resources, not file name strings - // - bitmap.LoadFile(wxCROSS_BITMAP, wxBITMAP_TYPE_BMP_RESOURCE); -#else - bitmap.LoadFile(wxT("cross_bmp"), wxBITMAP_TYPE_BMP_RESOURCE); -#endif - control = new wxBitmapButton(parent, id, bitmap, pos, size, - childResource->GetStyle() | wxBU_AUTODRAW, wxDefaultValidator, childResource->GetName()); - } - else - // Normal, text button - control = new wxButton(parent, id, childResource->GetTitle(), pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - } - else if (itemType == wxString(wxT("wxMessage")) || itemType == wxString(wxT("wxStaticText")) || - itemType == wxString(wxT("wxStaticBitmap"))) - { - if (childResource->GetValue4() != wxT("") || itemType == wxString(wxT("wxStaticBitmap")) ) - { - // Bitmap message - wxBitmap bitmap = childResource->GetBitmap(); - if (!bitmap.Ok()) - { - bitmap = wxResourceCreateBitmap(childResource->GetValue4(), (wxResourceTable *)this); - ((wxItemResource*) childResource)->SetBitmap(bitmap); - } -#if wxUSE_BITMAP_MESSAGE -#ifdef __WXMSW__ - // Use a default bitmap - if (!bitmap.Ok()) - bitmap.LoadFile(wxT("cross_bmp"), wxBITMAP_TYPE_BMP_RESOURCE); -#endif - - if (bitmap.Ok()) - control = new wxStaticBitmap(parent, id, bitmap, pos, size, - childResource->GetStyle(), childResource->GetName()); -#endif - } - else - { - control = new wxStaticText(parent, id, childResource->GetTitle(), pos, size, - childResource->GetStyle(), childResource->GetName()); - } - } - else if (itemType == wxString(wxT("wxText")) || itemType == wxString(wxT("wxTextCtrl")) || itemType == wxString(wxT("wxMultiText"))) - { - control = new wxTextCtrl(parent, id, childResource->GetValue4(), pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - } - else if (itemType == wxString(wxT("wxCheckBox"))) - { - control = new wxCheckBox(parent, id, childResource->GetTitle(), pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - - ((wxCheckBox *)control)->SetValue((childResource->GetValue1() != 0)); - } -#if wxUSE_GAUGE - else if (itemType == wxString(wxT("wxGauge"))) - { - control = new wxGauge(parent, id, (int)childResource->GetValue2(), pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - - ((wxGauge *)control)->SetValue((int)childResource->GetValue1()); - } -#endif -#if wxUSE_RADIOBTN - else if (itemType == wxString(wxT("wxRadioButton"))) - { - control = new wxRadioButton(parent, id, childResource->GetTitle(), // (int)childResource->GetValue1(), - pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - } -#endif -#if wxUSE_SCROLLBAR - else if (itemType == wxString(wxT("wxScrollBar"))) - { - control = new wxScrollBar(parent, id, pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - /* - ((wxScrollBar *)control)->SetValue((int)childResource->GetValue1()); - ((wxScrollBar *)control)->SetPageSize((int)childResource->GetValue2()); - ((wxScrollBar *)control)->SetObjectLength((int)childResource->GetValue3()); - ((wxScrollBar *)control)->SetViewLength((int)(long)childResource->GetValue5()); - */ - ((wxScrollBar *)control)->SetScrollbar((int)childResource->GetValue1(),(int)childResource->GetValue2(), - (int)childResource->GetValue3(),(int)(long)childResource->GetValue5(),FALSE); - - } -#endif - else if (itemType == wxString(wxT("wxSlider"))) - { - control = new wxSlider(parent, id, (int)childResource->GetValue1(), - (int)childResource->GetValue2(), (int)childResource->GetValue3(), pos, size, - childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - } - else if (itemType == wxString(wxT("wxGroupBox")) || itemType == wxString(wxT("wxStaticBox"))) - { - control = new wxStaticBox(parent, id, childResource->GetTitle(), pos, size, - childResource->GetStyle(), childResource->GetName()); - } - else if (itemType == wxString(wxT("wxListBox"))) - { - wxStringList& stringList = childResource->GetStringValues(); - wxString *strings = (wxString *) NULL; - int noStrings = 0; - if (stringList.Number() > 0) - { - noStrings = stringList.Number(); - strings = new wxString[noStrings]; - wxNode *node = stringList.First(); - int i = 0; - while (node) - { - strings[i] = (wxChar *)node->Data(); - i ++; - node = node->Next(); - } - } - control = new wxListBox(parent, id, pos, size, - noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - - if (strings) - delete[] strings; - } - else if (itemType == wxString(wxT("wxChoice"))) - { - wxStringList& stringList = childResource->GetStringValues(); - wxString *strings = (wxString *) NULL; - int noStrings = 0; - if (stringList.Number() > 0) - { - noStrings = stringList.Number(); - strings = new wxString[noStrings]; - wxNode *node = stringList.First(); - int i = 0; - while (node) - { - strings[i] = (wxChar *)node->Data(); - i ++; - node = node->Next(); - } - } - control = new wxChoice(parent, id, pos, size, - noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - - if (strings) - delete[] strings; - } -#if wxUSE_COMBOBOX - else if (itemType == wxString(wxT("wxComboBox"))) - { - wxStringList& stringList = childResource->GetStringValues(); - wxString *strings = (wxString *) NULL; - int noStrings = 0; - if (stringList.Number() > 0) - { - noStrings = stringList.Number(); - strings = new wxString[noStrings]; - wxNode *node = stringList.First(); - int i = 0; - while (node) - { - strings[i] = (wxChar *)node->Data(); - i ++; - node = node->Next(); - } - } - control = new wxComboBox(parent, id, childResource->GetValue4(), pos, size, - noStrings, strings, childResource->GetStyle(), wxDefaultValidator, childResource->GetName()); - - if (strings) - delete[] strings; - } -#endif - else if (itemType == wxString(wxT("wxRadioBox"))) - { - wxStringList& stringList = childResource->GetStringValues(); - wxString *strings = (wxString *) NULL; - int noStrings = 0; - if (stringList.Number() > 0) - { - noStrings = stringList.Number(); - strings = new wxString[noStrings]; - wxNode *node = stringList.First(); - int i = 0; - while (node) - { - strings[i] = (wxChar *)node->Data(); - i ++; - node = node->Next(); - } - } - control = new wxRadioBox(parent, (wxWindowID) id, wxString(childResource->GetTitle()), pos, size, - noStrings, strings, (int)childResource->GetValue1(), childResource->GetStyle(), wxDefaultValidator, - childResource->GetName()); - - if (strings) - delete[] strings; - } - - if ((parentResource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) - { - // Don't set font; will be inherited from parent. - } - else - { - if (control && childResource->GetFont().Ok()) - { - control->SetFont(childResource->GetFont()); - -#ifdef __WXMSW__ - // Force the layout algorithm since the size changes the layout - if (control->IsKindOf(CLASSINFO(wxRadioBox))) - { - control->SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT); - } -#endif - } - } - return control; -} - -/* -* Interpret database as a series of resources -*/ - -bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db) -{ - wxNode *node = db.First(); - while (node) - { - wxExpr *clause = (wxExpr *)node->Data(); - wxString functor(clause->Functor()); - - wxItemResource *item = (wxItemResource *) NULL; - if (functor == wxT("dialog")) - item = wxResourceInterpretDialog(table, clause); - else if (functor == wxT("panel")) - item = wxResourceInterpretDialog(table, clause, TRUE); - else if (functor == wxT("menubar")) - item = wxResourceInterpretMenuBar(table, clause); - else if (functor == wxT("menu")) - item = wxResourceInterpretMenu(table, clause); - else if (functor == wxT("string")) - item = wxResourceInterpretString(table, clause); - else if (functor == wxT("bitmap")) - item = wxResourceInterpretBitmap(table, clause); - else if (functor == wxT("icon")) - item = wxResourceInterpretIcon(table, clause); - - if (item) - { - // Remove any existing resource of same name - if (item->GetName() != wxT("")) - table.DeleteResource(item->GetName()); - table.AddResource(item); - } - node = node->Next(); - } - return TRUE; -} - -static const wxChar *g_ValidControlClasses[] = -{ - wxT("wxButton"), - wxT("wxBitmapButton"), - wxT("wxMessage"), - wxT("wxStaticText"), - wxT("wxStaticBitmap"), - wxT("wxText"), - wxT("wxTextCtrl"), - wxT("wxMultiText"), - wxT("wxListBox"), - wxT("wxRadioBox"), - wxT("wxRadioButton"), - wxT("wxCheckBox"), - wxT("wxBitmapCheckBox"), - wxT("wxGroupBox"), - wxT("wxStaticBox"), - wxT("wxSlider"), - wxT("wxGauge"), - wxT("wxScrollBar"), - wxT("wxChoice"), - wxT("wxComboBox") -}; - -static bool wxIsValidControlClass(const wxString& c) -{ - for ( size_t i = 0; i < WXSIZEOF(g_ValidControlClasses); i++ ) - { - if ( c == g_ValidControlClasses[i] ) - return TRUE; - } - return FALSE; -} - -wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel) -{ - wxItemResource *dialogItem = new wxItemResource; - if (isPanel) - dialogItem->SetType(wxT("wxPanel")); - else - dialogItem->SetType(wxT("wxDialog")); - wxString style = wxT(""); - wxString title = wxT(""); - wxString name = wxT(""); - wxString backColourHex = wxT(""); - wxString labelColourHex = wxT(""); - wxString buttonColourHex = wxT(""); - - long windowStyle = wxDEFAULT_DIALOG_STYLE; - if (isPanel) - windowStyle = 0; - - int x = 0; int y = 0; int width = -1; int height = -1; - int isModal = 0; - wxExpr *labelFontExpr = (wxExpr *) NULL; - wxExpr *buttonFontExpr = (wxExpr *) NULL; - wxExpr *fontExpr = (wxExpr *) NULL; - expr->GetAttributeValue(wxT("style"), style); - expr->GetAttributeValue(wxT("name"), name); - expr->GetAttributeValue(wxT("title"), title); - expr->GetAttributeValue(wxT("x"), x); - expr->GetAttributeValue(wxT("y"), y); - expr->GetAttributeValue(wxT("width"), width); - expr->GetAttributeValue(wxT("height"), height); - expr->GetAttributeValue(wxT("modal"), isModal); - expr->GetAttributeValue(wxT("label_font"), &labelFontExpr); - expr->GetAttributeValue(wxT("button_font"), &buttonFontExpr); - expr->GetAttributeValue(wxT("font"), &fontExpr); - expr->GetAttributeValue(wxT("background_colour"), backColourHex); - expr->GetAttributeValue(wxT("label_colour"), labelColourHex); - expr->GetAttributeValue(wxT("button_colour"), buttonColourHex); - - int useDialogUnits = 0; - expr->GetAttributeValue(wxT("use_dialog_units"), useDialogUnits); - if (useDialogUnits != 0) - dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_DIALOG_UNITS); - - int useDefaults = 0; - expr->GetAttributeValue(wxT("use_system_defaults"), useDefaults); - if (useDefaults != 0) - dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_USE_DEFAULTS); - - int id = 0; - expr->GetAttributeValue(wxT("id"), id); - dialogItem->SetId(id); - - if (style != wxT("")) - { - windowStyle = wxParseWindowStyle(style); - } - dialogItem->SetStyle(windowStyle); - dialogItem->SetValue1(isModal); - if (windowStyle & wxDIALOG_MODAL) // Uses style in wxWin 2 - dialogItem->SetValue1(TRUE); - - dialogItem->SetName(name); - dialogItem->SetTitle(title); - dialogItem->SetSize(x, y, width, height); - - // Check for wxWin 1.68-style specifications - if (style.Find(wxT("VERTICAL_LABEL")) != -1) - dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_VERTICAL_LABEL); - else if (style.Find(wxT("HORIZONTAL_LABEL")) != -1) - dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_HORIZONTAL_LABEL); - - if (backColourHex != wxT("")) - { - int r = 0; - int g = 0; - int b = 0; - r = wxHexToDec(backColourHex.Mid(0, 2)); - g = wxHexToDec(backColourHex.Mid(2, 2)); - b = wxHexToDec(backColourHex.Mid(4, 2)); - dialogItem->SetBackgroundColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); - } - if (labelColourHex != wxT("")) - { - int r = 0; - int g = 0; - int b = 0; - r = wxHexToDec(labelColourHex.Mid(0, 2)); - g = wxHexToDec(labelColourHex.Mid(2, 2)); - b = wxHexToDec(labelColourHex.Mid(4, 2)); - dialogItem->SetLabelColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); - } - if (buttonColourHex != wxT("")) - { - int r = 0; - int g = 0; - int b = 0; - r = wxHexToDec(buttonColourHex.Mid(0, 2)); - g = wxHexToDec(buttonColourHex.Mid(2, 2)); - b = wxHexToDec(buttonColourHex.Mid(4, 2)); - dialogItem->SetButtonColour(wxColour((unsigned char)r,(unsigned char)g,(unsigned char)b)); - } - - if (fontExpr) - dialogItem->SetFont(wxResourceInterpretFontSpec(fontExpr)); - else if (buttonFontExpr) - dialogItem->SetFont(wxResourceInterpretFontSpec(buttonFontExpr)); - else if (labelFontExpr) - dialogItem->SetFont(wxResourceInterpretFontSpec(labelFontExpr)); - - // Now parse all controls - wxExpr *controlExpr = expr->GetFirst(); - while (controlExpr) - { - if (controlExpr->Number() == 3) - { - wxString controlKeyword(controlExpr->Nth(1)->StringValue()); - if (controlKeyword != wxT("") && controlKeyword == wxT("control")) - { - // The value part: always a list. - wxExpr *listExpr = controlExpr->Nth(2); - if (listExpr->Type() == PrologList) - { - wxItemResource *controlItem = wxResourceInterpretControl(table, listExpr); - if (controlItem) - { - dialogItem->GetChildren().Append(controlItem); - } - } - } - } - controlExpr = controlExpr->GetNext(); - } - return dialogItem; -} - -wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr) -{ - wxItemResource *controlItem = new wxItemResource; - - // First, find the standard features of a control definition: - // [optional integer/string id], control name, title, style, name, x, y, width, height - - wxString controlType; - wxString style; - wxString title; - wxString name; - int id = 0; - long windowStyle = 0; - int x = 0; int y = 0; int width = -1; int height = -1; - int count = 0; - - wxExpr *expr1 = expr->Nth(0); - - if ( expr1->Type() == PrologString || expr1->Type() == PrologWord ) - { - if ( wxIsValidControlClass(expr1->StringValue()) ) - { - count = 1; - controlType = expr1->StringValue(); - } - else - { - wxString str(expr1->StringValue()); - id = wxResourceGetIdentifier(str, &table); - if (id == 0) - { - wxLogWarning(_("Could not resolve control class or id '%s'. Use (non-zero) integer instead\n or provide #define (see manual for caveats)"), - (const wxChar*) expr1->StringValue()); - delete controlItem; - return (wxItemResource *) NULL; - } - else - { - // Success - we have an id, so the 2nd element must be the control class. - controlType = expr->Nth(1)->StringValue(); - count = 2; - } - } - } - else if (expr1->Type() == PrologInteger) - { - id = (int)expr1->IntegerValue(); - // Success - we have an id, so the 2nd element must be the control class. - controlType = expr->Nth(1)->StringValue(); - count = 2; - } - - expr1 = expr->Nth(count); - count ++; - if ( expr1 ) - title = expr1->StringValue(); - - expr1 = expr->Nth(count); - count ++; - if (expr1) - { - style = expr1->StringValue(); - windowStyle = wxParseWindowStyle(style); - } - - expr1 = expr->Nth(count); - count ++; - if (expr1) - name = expr1->StringValue(); - - expr1 = expr->Nth(count); - count ++; - if (expr1) - x = (int)expr1->IntegerValue(); - - expr1 = expr->Nth(count); - count ++; - if (expr1) - y = (int)expr1->IntegerValue(); - - expr1 = expr->Nth(count); - count ++; - if (expr1) - width = (int)expr1->IntegerValue(); - - expr1 = expr->Nth(count); - count ++; - if (expr1) - height = (int)expr1->IntegerValue(); - - controlItem->SetStyle(windowStyle); - controlItem->SetName(name); - controlItem->SetTitle(title); - controlItem->SetSize(x, y, width, height); - controlItem->SetType(controlType); - controlItem->SetId(id); - - // Check for wxWin 1.68-style specifications - if (style.Find(wxT("VERTICAL_LABEL")) != -1) - controlItem->SetResourceStyle(controlItem->GetResourceStyle() | wxRESOURCE_VERTICAL_LABEL); - else if (style.Find(wxT("HORIZONTAL_LABEL")) != -1) - controlItem->SetResourceStyle(controlItem->GetResourceStyle() | wxRESOURCE_HORIZONTAL_LABEL); - - if (controlType == wxT("wxButton")) - { - // Check for bitmap resource name (in case loading old-style resource file) - if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) - { - wxString str(expr->Nth(count)->StringValue()); - count ++; - - if (str != wxT("")) - { - controlItem->SetValue4(str); - controlItem->SetType(wxT("wxBitmapButton")); - } - } - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - else if (controlType == wxT("wxBitmapButton")) - { - // Check for bitmap resource name - if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) - { - wxString str(expr->Nth(count)->StringValue()); - controlItem->SetValue4(str); - count ++; - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - else if (controlType == wxT("wxCheckBox")) - { - // Check for default value - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } -#if wxUSE_RADIOBTN - else if (controlType == wxT("wxRadioButton")) - { - // Check for default value - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } -#endif - else if (controlType == wxT("wxText") || controlType == wxT("wxTextCtrl") || controlType == wxT("wxMultiText")) - { - // Check for default value - if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) - { - wxString str(expr->Nth(count)->StringValue()); - controlItem->SetValue4(str); - count ++; - - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } - else if (controlType == wxT("wxMessage") || controlType == wxT("wxStaticText")) - { - // Check for bitmap resource name (in case it's an old-style .wxr file) - if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) - { - wxString str(expr->Nth(count)->StringValue()); - controlItem->SetValue4(str); - count ++; - controlItem->SetType(wxT("wxStaticText")); - } - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - else if (controlType == wxT("wxStaticBitmap")) - { - // Check for bitmap resource name - if (expr->Nth(count) && ((expr->Nth(count)->Type() == PrologString) || (expr->Nth(count)->Type() == PrologWord))) - { - wxString str(expr->Nth(count)->StringValue()); - controlItem->SetValue4(str); - count ++; - } - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - else if (controlType == wxT("wxGroupBox") || controlType == wxT("wxStaticBox")) - { - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - else if (controlType == wxT("wxGauge")) - { - // Check for default value - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - - // Check for range - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue2(expr->Nth(count)->IntegerValue()); - count ++; - - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } - } - else if (controlType == wxT("wxSlider")) - { - // Check for default value - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - - // Check for min - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue2(expr->Nth(count)->IntegerValue()); - count ++; - - // Check for max - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue3(expr->Nth(count)->IntegerValue()); - count ++; - - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // controlItem->SetLabelFont(wxResourceInterpretFontSpec(expr->Nth(count))); - // do nothing - count ++; - - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } - } - } - else if (controlType == wxT("wxScrollBar")) - { - // DEFAULT VALUE - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - - // PAGE LENGTH - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue2(expr->Nth(count)->IntegerValue()); - count ++; - - // OBJECT LENGTH - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue3(expr->Nth(count)->IntegerValue()); - count ++; - - // VIEW LENGTH - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - controlItem->SetValue5(expr->Nth(count)->IntegerValue()); - } - } - } - } - else if (controlType == wxT("wxListBox")) - { - wxExpr *valueList = (wxExpr *) NULL; - - if (((valueList = expr->Nth(count)) != 0) && (valueList->Type() == PrologList)) - { - wxStringList stringList; - wxExpr *stringExpr = valueList->GetFirst(); - while (stringExpr) - { - stringList.Add(stringExpr->StringValue()); - stringExpr = stringExpr->GetNext(); - } - controlItem->SetStringValues(stringList); - count ++; - // This is now obsolete: it's in the window style. - // Check for wxSINGLE/wxMULTIPLE - wxExpr *mult = (wxExpr *) NULL; - /* - controlItem->SetValue1(wxLB_SINGLE); - */ - if (((mult = expr->Nth(count)) != 0) && ((mult->Type() == PrologString)||(mult->Type() == PrologWord))) - { - /* - wxString m(mult->StringValue()); - if (m == "wxLB_MULTIPLE") - controlItem->SetValue1(wxLB_MULTIPLE); - else if (m == "wxLB_EXTENDED") - controlItem->SetValue1(wxLB_EXTENDED); - */ - // Ignore the value - count ++; - } - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } - else if (controlType == wxT("wxChoice")) - { - wxExpr *valueList = (wxExpr *) NULL; - // Check for default value list - if (((valueList = expr->Nth(count)) != 0) && (valueList->Type() == PrologList)) - { - wxStringList stringList; - wxExpr *stringExpr = valueList->GetFirst(); - while (stringExpr) - { - stringList.Add(stringExpr->StringValue()); - stringExpr = stringExpr->GetNext(); - } - controlItem->SetStringValues(stringList); - - count ++; - - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } -#if wxUSE_COMBOBOX - else if (controlType == wxT("wxComboBox")) - { - wxExpr *textValue = expr->Nth(count); - if (textValue && (textValue->Type() == PrologString || textValue->Type() == PrologWord)) - { - wxString str(textValue->StringValue()); - controlItem->SetValue4(str); - - count ++; - - wxExpr *valueList = (wxExpr *) NULL; - // Check for default value list - if (((valueList = expr->Nth(count)) != 0) && (valueList->Type() == PrologList)) - { - wxStringList stringList; - wxExpr *stringExpr = valueList->GetFirst(); - while (stringExpr) - { - stringList.Add(stringExpr->StringValue()); - stringExpr = stringExpr->GetNext(); - } - controlItem->SetStringValues(stringList); - - count ++; - - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } - } -#endif -#if 1 - else if (controlType == wxT("wxRadioBox")) - { - wxExpr *valueList = (wxExpr *) NULL; - // Check for default value list - if (((valueList = expr->Nth(count)) != 0) && (valueList->Type() == PrologList)) - { - wxStringList stringList; - wxExpr *stringExpr = valueList->GetFirst(); - while (stringExpr) - { - stringList.Add(stringExpr->StringValue()); - stringExpr = stringExpr->GetNext(); - } - controlItem->SetStringValues(stringList); - count ++; - - // majorDim (number of rows or cols) - if (expr->Nth(count) && (expr->Nth(count)->Type() == PrologInteger)) - { - controlItem->SetValue1(expr->Nth(count)->IntegerValue()); - count ++; - } - else - controlItem->SetValue1(0); - - if (expr->Nth(count) && expr->Nth(count)->Type() == PrologList) - { - // Skip past the obsolete label font spec if there are two consecutive specs - if (expr->Nth(count+1) && expr->Nth(count+1)->Type() == PrologList) - count ++; - controlItem->SetFont(wxResourceInterpretFontSpec(expr->Nth(count))); - } - } - } -#endif - else - { - delete controlItem; - return (wxItemResource *) NULL; - } - return controlItem; -} - -// Forward declaration -wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, wxExpr *expr); - -/* -* Interpet a menu item -*/ - -wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, wxExpr *expr) -{ - wxItemResource *item = new wxItemResource; - - wxExpr *labelExpr = expr->Nth(0); - wxExpr *idExpr = expr->Nth(1); - wxExpr *helpExpr = expr->Nth(2); - wxExpr *checkableExpr = expr->Nth(3); - - // Further keywords/attributes to follow sometime... - if (expr->Number() == 0) - { - // item->SetType(wxRESOURCE_TYPE_SEPARATOR); - item->SetType(wxT("wxMenuSeparator")); - return item; - } - else - { - // item->SetType(wxTYPE_MENU); // Well, menu item, but doesn't matter. - item->SetType(wxT("wxMenu")); // Well, menu item, but doesn't matter. - if (labelExpr) - { - wxString str(labelExpr->StringValue()); - item->SetTitle(str); - } - if (idExpr) - { - int id = 0; - // If a string or word, must look up in identifier table. - if ((idExpr->Type() == PrologString) || (idExpr->Type() == PrologWord)) - { - wxString str(idExpr->StringValue()); - id = wxResourceGetIdentifier(str, &table); - if (id == 0) - { - wxLogWarning(_("Could not resolve menu id '%s'. Use (non-zero) integer instead\nor provide #define (see manual for caveats)"), - (const wxChar*) idExpr->StringValue()); - } - } - else if (idExpr->Type() == PrologInteger) - id = (int)idExpr->IntegerValue(); - item->SetValue1(id); - } - if (helpExpr) - { - wxString str(helpExpr->StringValue()); - item->SetValue4(str); - } - if (checkableExpr) - item->SetValue2(checkableExpr->IntegerValue()); - - // Find the first expression that's a list, for submenu - wxExpr *subMenuExpr = expr->GetFirst(); - while (subMenuExpr && (subMenuExpr->Type() != PrologList)) - subMenuExpr = subMenuExpr->GetNext(); - - while (subMenuExpr) - { - wxItemResource *child = wxResourceInterpretMenuItem(table, subMenuExpr); - item->GetChildren().Append(child); - subMenuExpr = subMenuExpr->GetNext(); - } - } - return item; -} - -/* -* Interpret a nested list as a menu -*/ -/* -wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, wxExpr *expr) -{ -wxItemResource *menu = new wxItemResource; -// menu->SetType(wxTYPE_MENU); -menu->SetType("wxMenu"); -wxExpr *element = expr->GetFirst(); -while (element) -{ -wxItemResource *item = wxResourceInterpretMenuItem(table, element); -if (item) -menu->GetChildren().Append(item); -element = element->GetNext(); -} -return menu; -} -*/ - -wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr) -{ - wxExpr *listExpr = (wxExpr *) NULL; - expr->GetAttributeValue(wxT("menu"), &listExpr); - if (!listExpr) - return (wxItemResource *) NULL; - - wxItemResource *menuResource = wxResourceInterpretMenuItem(table, listExpr); - - if (!menuResource) - return (wxItemResource *) NULL; - - wxString name; - if (expr->GetAttributeValue(wxT("name"), name)) - { - menuResource->SetName(name); - } - - return menuResource; -} - -wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, wxExpr *expr) -{ - wxExpr *listExpr = (wxExpr *) NULL; - expr->GetAttributeValue(wxT("menu"), &listExpr); - if (!listExpr) - return (wxItemResource *) NULL; - - wxItemResource *resource = new wxItemResource; - resource->SetType(wxT("wxMenu")); - // resource->SetType(wxTYPE_MENU); - - wxExpr *element = listExpr->GetFirst(); - while (element) - { - wxItemResource *menuResource = wxResourceInterpretMenuItem(table, listExpr); - resource->GetChildren().Append(menuResource); - element = element->GetNext(); - } - - wxString name; - if (expr->GetAttributeValue(wxT("name"), name)) - { - resource->SetName(name); - } - - return resource; -} - -wxItemResource *wxResourceInterpretString(wxResourceTable& WXUNUSED(table), wxExpr *WXUNUSED(expr)) -{ - return (wxItemResource *) NULL; -} - -wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), wxExpr *expr) -{ - wxItemResource *bitmapItem = new wxItemResource; - // bitmapItem->SetType(wxTYPE_BITMAP); - bitmapItem->SetType(wxT("wxBitmap")); - wxString name; - if (expr->GetAttributeValue(wxT("name"), name)) - { - bitmapItem->SetName(name); - } - // Now parse all bitmap specifications - wxExpr *bitmapExpr = expr->GetFirst(); - while (bitmapExpr) - { - if (bitmapExpr->Number() == 3) - { - wxString bitmapKeyword(bitmapExpr->Nth(1)->StringValue()); - if (bitmapKeyword == wxT("bitmap") || bitmapKeyword == wxT("icon")) - { - // The value part: always a list. - wxExpr *listExpr = bitmapExpr->Nth(2); - if (listExpr->Type() == PrologList) - { - wxItemResource *bitmapSpec = new wxItemResource; - // bitmapSpec->SetType(wxTYPE_BITMAP); - bitmapSpec->SetType(wxT("wxBitmap")); - - // List is of form: [filename, bitmaptype, platform, colours, xresolution, yresolution] - // where everything after 'filename' is optional. - wxExpr *nameExpr = listExpr->Nth(0); - wxExpr *typeExpr = listExpr->Nth(1); - wxExpr *platformExpr = listExpr->Nth(2); - wxExpr *coloursExpr = listExpr->Nth(3); - wxExpr *xresExpr = listExpr->Nth(4); - wxExpr *yresExpr = listExpr->Nth(5); - if (nameExpr && nameExpr->StringValue() != wxT("")) - { - bitmapSpec->SetName(nameExpr->StringValue()); - } - if (typeExpr && typeExpr->StringValue() != wxT("")) - { - bitmapSpec->SetValue1(wxParseWindowStyle(typeExpr->StringValue())); - } - else - bitmapSpec->SetValue1(0); - - if (platformExpr && platformExpr->StringValue() != wxT("")) - { - wxString plat(platformExpr->StringValue()); - if (plat == wxT("windows") || plat == wxT("WINDOWS")) - bitmapSpec->SetValue2(RESOURCE_PLATFORM_WINDOWS); - else if (plat == wxT("x") || plat == wxT("X")) - bitmapSpec->SetValue2(RESOURCE_PLATFORM_X); - else if (plat == wxT("mac") || plat == wxT("MAC")) - bitmapSpec->SetValue2(RESOURCE_PLATFORM_MAC); - else - bitmapSpec->SetValue2(RESOURCE_PLATFORM_ANY); - } - else - bitmapSpec->SetValue2(RESOURCE_PLATFORM_ANY); - - if (coloursExpr) - bitmapSpec->SetValue3(coloursExpr->IntegerValue()); - int xres = 0; - int yres = 0; - if (xresExpr) - xres = (int)xresExpr->IntegerValue(); - if (yresExpr) - yres = (int)yresExpr->IntegerValue(); - bitmapSpec->SetSize(0, 0, xres, yres); - - bitmapItem->GetChildren().Append(bitmapSpec); - } - } - } - bitmapExpr = bitmapExpr->GetNext(); - } - - return bitmapItem; -} - -wxItemResource *wxResourceInterpretIcon(wxResourceTable& table, wxExpr *expr) -{ - wxItemResource *item = wxResourceInterpretBitmap(table, expr); - if (item) - { - // item->SetType(wxTYPE_ICON); - item->SetType(wxT("wxIcon")); - return item; - } - else - return (wxItemResource *) NULL; -} - -// Interpret list expression as a font -wxFont wxResourceInterpretFontSpec(wxExpr *expr) -{ - if (expr->Type() != PrologList) - return wxNullFont; - - int point = 10; - int family = wxSWISS; - int style = wxNORMAL; - int weight = wxNORMAL; - int underline = 0; - wxString faceName(wxT("")); - - wxExpr *pointExpr = expr->Nth(0); - wxExpr *familyExpr = expr->Nth(1); - wxExpr *styleExpr = expr->Nth(2); - wxExpr *weightExpr = expr->Nth(3); - wxExpr *underlineExpr = expr->Nth(4); - wxExpr *faceNameExpr = expr->Nth(5); - if (pointExpr) - point = (int)pointExpr->IntegerValue(); - - wxString str; - if (familyExpr) - { - str = familyExpr->StringValue(); - family = (int)wxParseWindowStyle(str); - } - if (styleExpr) - { - str = styleExpr->StringValue(); - style = (int)wxParseWindowStyle(str); - } - if (weightExpr) - { - str = weightExpr->StringValue(); - weight = (int)wxParseWindowStyle(str); - } - if (underlineExpr) - underline = (int)underlineExpr->IntegerValue(); - if (faceNameExpr) - faceName = faceNameExpr->StringValue(); - - return *wxTheFontList->FindOrCreateFont(point, family, style, weight, - (underline != 0), faceName); -} - -// Separate file for the remainder of this, for BC++/Win16 - -#if !((defined(__BORLANDC__) || defined(__SC__)) && defined(__WIN16__)) -/* -* (Re)allocate buffer for reading in from resource file -*/ - -bool wxReallocateResourceBuffer() -{ - if (!wxResourceBuffer) - { - wxResourceBufferSize = 1000; - wxResourceBuffer = new char[wxResourceBufferSize]; - return TRUE; - } - if (wxResourceBuffer) - { - long newSize = wxResourceBufferSize + 1000; - char *tmp = new char[(int)newSize]; - strncpy(tmp, wxResourceBuffer, (int)wxResourceBufferCount); - delete[] wxResourceBuffer; - wxResourceBuffer = tmp; - wxResourceBufferSize = newSize; - } - return TRUE; -} - -static bool wxEatWhiteSpace(FILE *fd) -{ - int ch = 0; - - while ((ch = getc(fd)) != EOF) - { - switch (ch) - { - case ' ': - case 0x0a: - case 0x0d: - case 0x09: - break; - case '/': - { - int prev_ch = ch; - ch = getc(fd); - if (ch == EOF) - { - ungetc(prev_ch, fd); - return TRUE; - } - - if (ch == '*') - { - // Eat C comment - prev_ch = 0; - while ((ch = getc(fd)) != EOF) - { - if (ch == '/' && prev_ch == '*') - break; - prev_ch = ch; - } - } - else if (ch == '/') - { - // Eat C++ comment - static char buffer[255]; - fgets(buffer, 255, fd); - } - else - { - ungetc(prev_ch, fd); - ungetc(ch, fd); - return TRUE; - } - } - break; - default: - ungetc(ch, fd); - return TRUE; - - } - } - return FALSE; -} -static bool wxEatWhiteSpace(wxInputStream *is) -{ - int ch = is->GetC() ; - if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9)) - { - is->Ungetch(ch); - return TRUE; - } - - // Eat whitespace - while (ch == ' ' || ch == 10 || ch == 13 || ch == 9) - ch = is->GetC(); - // Check for comment - if (ch == '/') - { - ch = is->GetC(); - if (ch == '*') - { - bool finished = FALSE; - while (!finished) - { - ch = is->GetC(); - if (ch == EOF) - return FALSE; - if (ch == '*') - { - int newCh = is->GetC(); - if (newCh == '/') - finished = TRUE; - else - { - is->Ungetch(ch); - } - } - } - } - else // False alarm - return FALSE; - } - else - is->Ungetch(ch); - return wxEatWhiteSpace(is); -} - -bool wxGetResourceToken(FILE *fd) -{ - if (!wxResourceBuffer) - wxReallocateResourceBuffer(); - wxResourceBuffer[0] = 0; - wxEatWhiteSpace(fd); - - int ch = getc(fd); - if (ch == '"') - { - // Get string - wxResourceBufferCount = 0; - ch = getc(fd); - while (ch != '"') - { - int actualCh = ch; - if (ch == EOF) - { - wxResourceBuffer[wxResourceBufferCount] = 0; - return FALSE; - } - // Escaped characters - else if (ch == '\\') - { - int newCh = getc(fd); - if (newCh == '"') - actualCh = '"'; - else if (newCh == 10) - actualCh = 10; - else - { - ungetc(newCh, fd); - } - } - - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; - wxResourceBufferCount ++; - ch = getc(fd); - } - wxResourceBuffer[wxResourceBufferCount] = 0; - } - else - { - wxResourceBufferCount = 0; - // Any other token - while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) - { - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)ch; - wxResourceBufferCount ++; - - ch = getc(fd); - } - wxResourceBuffer[wxResourceBufferCount] = 0; - if (ch == EOF) - return FALSE; - } - return TRUE; -} - -bool wxGetResourceToken(wxInputStream *is) -{ - if (!wxResourceBuffer) - wxReallocateResourceBuffer(); - wxResourceBuffer[0] = 0; - wxEatWhiteSpace(is); - - int ch = is->GetC() ; - if (ch == '"') - { - // Get string - wxResourceBufferCount = 0; - ch = is->GetC(); - while (ch != '"') - { - int actualCh = ch; - if (ch == EOF) - { - wxResourceBuffer[wxResourceBufferCount] = 0; - return FALSE; - } - // Escaped characters - else if (ch == '\\') - { - int newCh = is->GetC(); - if (newCh == '"') - actualCh = '"'; - else if (newCh == 10) - actualCh = 10; - else if (newCh == 13) // mac - actualCh = 10; - else - { - is->Ungetch(newCh); - } - } - - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; - wxResourceBufferCount ++; - ch = is->GetC(); - } - wxResourceBuffer[wxResourceBufferCount] = 0; - } - else - { - wxResourceBufferCount = 0; - // Any other token - while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) - { - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)ch; - wxResourceBufferCount ++; - - ch = is->GetC(); - } - wxResourceBuffer[wxResourceBufferCount] = 0; - if (ch == EOF) - return FALSE; - } - return TRUE; -} - -/* -* Files are in form: -static char *name = "...."; -with possible comments. -*/ - -bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - // static or #define - if (!wxGetResourceToken(fd)) - { - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "#define") == 0) - { - wxGetResourceToken(fd); - wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - wxGetResourceToken(fd); - wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - if (wxIsdigit(value[0])) - { - int val = (int)wxAtol(value); - wxResourceAddIdentifier(name, val, table); - } - else - { - wxLogWarning(_("#define %s must be an integer."), name); - delete[] name; - delete[] value; - return FALSE; - } - delete[] name; - delete[] value; - - return TRUE; - } - else if (strcmp(wxResourceBuffer, "#include") == 0) - { - wxGetResourceToken(fd); - wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - wxChar *actualName = name; - if (name[0] == wxT('"')) - actualName = name + 1; - int len = wxStrlen(name); - if ((len > 0) && (name[len-1] == wxT('"'))) - name[len-1] = 0; - if (!wxResourceParseIncludeFile(actualName, table)) - { - wxLogWarning(_("Could not find resource include file %s."), actualName); - } - delete[] name; - return TRUE; - } - else if (strcmp(wxResourceBuffer, "static") != 0) - { - wxChar buf[300]; - wxStrcpy(buf, _("Found ")); - wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30); - wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); - wxLogWarning(buf); - return FALSE; - } - - // char - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "char") != 0) - { - wxLogWarning(_("Expected 'char' whilst parsing resource.")); - return FALSE; - } - - // *name - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (wxResourceBuffer[0] != '*') - { - wxLogWarning(_("Expected '*' whilst parsing resource.")); - return FALSE; - } - wxChar nameBuf[100]; - wxMB2WX(nameBuf, wxResourceBuffer+1, 99); - nameBuf[99] = 0; - - // = - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "=") != 0) - { - wxLogWarning(_("Expected '=' whilst parsing resource.")); - return FALSE; - } - - // String - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - else - { - if (!db.ReadPrologFromString(wxResourceBuffer)) - { - wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); - return FALSE; - } - } - // Semicolon - if (!wxGetResourceToken(fd)) - { - *eof = TRUE; - } - return TRUE; -} - -bool wxResourceReadOneResource(wxInputStream *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - // static or #define - if (!wxGetResourceToken(fd)) - { - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "#define") == 0) - { - wxGetResourceToken(fd); - wxChar *name = copystring(wxConvLibc.cMB2WX(wxResourceBuffer)); - wxGetResourceToken(fd); - wxChar *value = copystring(wxConvLibc.cMB2WX(wxResourceBuffer)); - if (wxIsalpha(value[0])) - { - int val = (int)wxAtol(value); - wxResourceAddIdentifier(name, val, table); - } - else - { - wxLogWarning(_("#define %s must be an integer."), name); - delete[] name; - delete[] value; - return FALSE; - } - delete[] name; - delete[] value; - - return TRUE; - } - else if (strcmp(wxResourceBuffer, "#include") == 0) - { - wxGetResourceToken(fd); - wxChar *name = copystring(wxConvLibc.cMB2WX(wxResourceBuffer)); - wxChar *actualName = name; - if (name[0] == wxT('"')) - actualName = name + 1; - int len = wxStrlen(name); - if ((len > 0) && (name[len-1] == wxT('"'))) - name[len-1] = 0; - if (!wxResourceParseIncludeFile(actualName, table)) - { - wxLogWarning(_("Could not find resource include file %s."), actualName); - } - delete[] name; - return TRUE; - } - else if (strcmp(wxResourceBuffer, "static") != 0) - { - wxChar buf[300]; - wxStrcpy(buf, _("Found ")); - wxStrncat(buf, wxConvLibc.cMB2WX(wxResourceBuffer), 30); - wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); - wxLogWarning(buf); - return FALSE; - } - - // char - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "char") != 0) - { - wxLogWarning(_("Expected 'char' whilst parsing resource.")); - return FALSE; - } - - // *name - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (wxResourceBuffer[0] != '*') - { - wxLogWarning(_("Expected '*' whilst parsing resource.")); - return FALSE; - } - char nameBuf[100]; - strncpy(nameBuf, wxResourceBuffer+1, 99); - - // = - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "=") != 0) - { - wxLogWarning(_("Expected '=' whilst parsing resource.")); - return FALSE; - } - - // String - if (!wxGetResourceToken(fd)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - else - { - if (!db.ReadPrologFromString(wxResourceBuffer)) - { - wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); - return FALSE; - } - } - // Semicolon - if (!wxGetResourceToken(fd)) - { - *eof = TRUE; - } - return TRUE; -} - -/* -* Parses string window style into integer window style -*/ - -/* -* Style flag parsing, e.g. -* "wxSYSTEM_MENU | wxBORDER" -> integer -*/ - -wxChar* wxResourceParseWord(wxChar*s, int *i) -{ - if (!s) - return (wxChar*) NULL; - - static wxChar buf[150]; - int len = wxStrlen(s); - int j = 0; - int ii = *i; - while ((ii < len) && (wxIsalpha(s[ii]) || (s[ii] == wxT('_')))) - { - buf[j] = s[ii]; - j ++; - ii ++; - } - buf[j] = 0; - - // Eat whitespace and conjunction characters - while ((ii < len) && - ((s[ii] == wxT(' ')) || (s[ii] == wxT('|')) || (s[ii] == wxT(',')))) - { - ii ++; - } - *i = ii; - if (j == 0) - return (wxChar*) NULL; - else - return buf; -} - -struct wxResourceBitListStruct -{ - const wxChar *word; - long bits; -}; - -static wxResourceBitListStruct wxResourceBitListTable[] = -{ - /* wxListBox */ - { wxT("wxSINGLE"), wxLB_SINGLE }, - { wxT("wxMULTIPLE"), wxLB_MULTIPLE }, - { wxT("wxEXTENDED"), wxLB_EXTENDED }, - { wxT("wxLB_SINGLE"), wxLB_SINGLE }, - { wxT("wxLB_MULTIPLE"), wxLB_MULTIPLE }, - { wxT("wxLB_EXTENDED"), wxLB_EXTENDED }, - { wxT("wxLB_NEEDED_SB"), wxLB_NEEDED_SB }, - { wxT("wxLB_ALWAYS_SB"), wxLB_ALWAYS_SB }, - { wxT("wxLB_SORT"), wxLB_SORT }, - { wxT("wxLB_OWNERDRAW"), wxLB_OWNERDRAW }, - { wxT("wxLB_HSCROLL"), wxLB_HSCROLL }, - - /* wxComboxBox */ - { wxT("wxCB_SIMPLE"), wxCB_SIMPLE }, - { wxT("wxCB_DROPDOWN"), wxCB_DROPDOWN }, - { wxT("wxCB_READONLY"), wxCB_READONLY }, - { wxT("wxCB_SORT"), wxCB_SORT }, - - /* wxGauge */ - { wxT("wxGA_PROGRESSBAR"), wxGA_PROGRESSBAR }, - { wxT("wxGA_HORIZONTAL"), wxGA_HORIZONTAL }, - { wxT("wxGA_VERTICAL"), wxGA_VERTICAL }, - - /* wxTextCtrl */ - { wxT("wxPASSWORD"), wxPASSWORD}, - { wxT("wxPROCESS_ENTER"), wxPROCESS_ENTER}, - { wxT("wxTE_PASSWORD"), wxTE_PASSWORD}, - { wxT("wxTE_READONLY"), wxTE_READONLY}, - { wxT("wxTE_PROCESS_ENTER"), wxTE_PROCESS_ENTER}, - { wxT("wxTE_MULTILINE"), wxTE_MULTILINE}, - { wxT("wxTE_NO_VSCROLL"), wxTE_NO_VSCROLL}, - - /* wxRadioBox/wxRadioButton */ - { wxT("wxRB_GROUP"), wxRB_GROUP }, - { wxT("wxRA_SPECIFY_COLS"), wxRA_SPECIFY_COLS }, - { wxT("wxRA_SPECIFY_ROWS"), wxRA_SPECIFY_ROWS }, - { wxT("wxRA_HORIZONTAL"), wxRA_HORIZONTAL }, - { wxT("wxRA_VERTICAL"), wxRA_VERTICAL }, - - /* wxSlider */ - { wxT("wxSL_HORIZONTAL"), wxSL_HORIZONTAL }, - { wxT("wxSL_VERTICAL"), wxSL_VERTICAL }, - { wxT("wxSL_AUTOTICKS"), wxSL_AUTOTICKS }, - { wxT("wxSL_LABELS"), wxSL_LABELS }, - { wxT("wxSL_LEFT"), wxSL_LEFT }, - { wxT("wxSL_TOP"), wxSL_TOP }, - { wxT("wxSL_RIGHT"), wxSL_RIGHT }, - { wxT("wxSL_BOTTOM"), wxSL_BOTTOM }, - { wxT("wxSL_BOTH"), wxSL_BOTH }, - { wxT("wxSL_SELRANGE"), wxSL_SELRANGE }, - - /* wxScrollBar */ - { wxT("wxSB_HORIZONTAL"), wxSB_HORIZONTAL }, - { wxT("wxSB_VERTICAL"), wxSB_VERTICAL }, - - /* wxButton */ - { wxT("wxBU_AUTODRAW"), wxBU_AUTODRAW }, - { wxT("wxBU_NOAUTODRAW"), wxBU_NOAUTODRAW }, - - /* wxTreeCtrl */ - { wxT("wxTR_HAS_BUTTONS"), wxTR_HAS_BUTTONS }, - { wxT("wxTR_EDIT_LABELS"), wxTR_EDIT_LABELS }, - { wxT("wxTR_LINES_AT_ROOT"), wxTR_LINES_AT_ROOT }, - - /* wxListCtrl */ - { wxT("wxLC_ICON"), wxLC_ICON }, - { wxT("wxLC_SMALL_ICON"), wxLC_SMALL_ICON }, - { wxT("wxLC_LIST"), wxLC_LIST }, - { wxT("wxLC_REPORT"), wxLC_REPORT }, - { wxT("wxLC_ALIGN_TOP"), wxLC_ALIGN_TOP }, - { wxT("wxLC_ALIGN_LEFT"), wxLC_ALIGN_LEFT }, - { wxT("wxLC_AUTOARRANGE"), wxLC_AUTOARRANGE }, - { wxT("wxLC_USER_TEXT"), wxLC_USER_TEXT }, - { wxT("wxLC_EDIT_LABELS"), wxLC_EDIT_LABELS }, - { wxT("wxLC_NO_HEADER"), wxLC_NO_HEADER }, - { wxT("wxLC_NO_SORT_HEADER"), wxLC_NO_SORT_HEADER }, - { wxT("wxLC_SINGLE_SEL"), wxLC_SINGLE_SEL }, - { wxT("wxLC_SORT_ASCENDING"), wxLC_SORT_ASCENDING }, - { wxT("wxLC_SORT_DESCENDING"), wxLC_SORT_DESCENDING }, - - /* wxSpinButton */ - { wxT("wxSP_VERTICAL"), wxSP_VERTICAL}, - { wxT("wxSP_HORIZONTAL"), wxSP_HORIZONTAL}, - { wxT("wxSP_ARROW_KEYS"), wxSP_ARROW_KEYS}, - { wxT("wxSP_WRAP"), wxSP_WRAP}, - - /* wxSplitterWnd */ - { wxT("wxSP_NOBORDER"), wxSP_NOBORDER}, - { wxT("wxSP_3D"), wxSP_3D}, - { wxT("wxSP_BORDER"), wxSP_BORDER}, - - /* wxTabCtrl */ - { wxT("wxTC_MULTILINE"), wxTC_MULTILINE}, - { wxT("wxTC_RIGHTJUSTIFY"), wxTC_RIGHTJUSTIFY}, - { wxT("wxTC_FIXEDWIDTH"), wxTC_FIXEDWIDTH}, - { wxT("wxTC_OWNERDRAW"), wxTC_OWNERDRAW}, - - /* wxStatusBar95 */ - { wxT("wxST_SIZEGRIP"), wxST_SIZEGRIP}, - - /* wxControl */ - { wxT("wxFIXED_LENGTH"), wxFIXED_LENGTH}, - { wxT("wxALIGN_LEFT"), wxALIGN_LEFT}, - { wxT("wxALIGN_CENTER"), wxALIGN_CENTER}, - { wxT("wxALIGN_CENTRE"), wxALIGN_CENTRE}, - { wxT("wxALIGN_RIGHT"), wxALIGN_RIGHT}, - { wxT("wxCOLOURED"), wxCOLOURED}, - - /* wxToolBar */ - { wxT("wxTB_3DBUTTONS"), wxTB_3DBUTTONS}, - { wxT("wxTB_HORIZONTAL"), wxTB_HORIZONTAL}, - { wxT("wxTB_VERTICAL"), wxTB_VERTICAL}, - { wxT("wxTB_FLAT"), wxTB_FLAT}, - - /* wxDialog */ - { wxT("wxDIALOG_MODAL"), wxDIALOG_MODAL }, - - /* Generic */ - { wxT("wxVSCROLL"), wxVSCROLL }, - { wxT("wxHSCROLL"), wxHSCROLL }, - { wxT("wxCAPTION"), wxCAPTION }, - { wxT("wxSTAY_ON_TOP"), wxSTAY_ON_TOP}, - { wxT("wxICONIZE"), wxICONIZE}, - { wxT("wxMINIMIZE"), wxICONIZE}, - { wxT("wxMAXIMIZE"), wxMAXIMIZE}, - { wxT("wxSDI"), 0}, - { wxT("wxMDI_PARENT"), 0}, - { wxT("wxMDI_CHILD"), 0}, - { wxT("wxTHICK_FRAME"), wxTHICK_FRAME}, - { wxT("wxRESIZE_BORDER"), wxRESIZE_BORDER}, - { wxT("wxSYSTEM_MENU"), wxSYSTEM_MENU}, - { wxT("wxMINIMIZE_BOX"), wxMINIMIZE_BOX}, - { wxT("wxMAXIMIZE_BOX"), wxMAXIMIZE_BOX}, - { wxT("wxRESIZE_BOX"), wxRESIZE_BOX}, - { wxT("wxDEFAULT_FRAME_STYLE"), wxDEFAULT_FRAME_STYLE}, - { wxT("wxDEFAULT_FRAME"), wxDEFAULT_FRAME_STYLE}, - { wxT("wxDEFAULT_DIALOG_STYLE"), wxDEFAULT_DIALOG_STYLE}, - { wxT("wxBORDER"), wxBORDER}, - { wxT("wxRETAINED"), wxRETAINED}, - { wxT("wxNATIVE_IMPL"), 0}, - { wxT("wxEXTENDED_IMPL"), 0}, - { wxT("wxBACKINGSTORE"), wxBACKINGSTORE}, - // { wxT("wxFLAT"), wxFLAT}, - // { wxT("wxMOTIF_RESIZE"), wxMOTIF_RESIZE}, - { wxT("wxFIXED_LENGTH"), 0}, - { wxT("wxDOUBLE_BORDER"), wxDOUBLE_BORDER}, - { wxT("wxSUNKEN_BORDER"), wxSUNKEN_BORDER}, - { wxT("wxRAISED_BORDER"), wxRAISED_BORDER}, - { wxT("wxSIMPLE_BORDER"), wxSIMPLE_BORDER}, - { wxT("wxSTATIC_BORDER"), wxSTATIC_BORDER}, - { wxT("wxTRANSPARENT_WINDOW"), wxTRANSPARENT_WINDOW}, - { wxT("wxNO_BORDER"), wxNO_BORDER}, - { wxT("wxCLIP_CHILDREN"), wxCLIP_CHILDREN}, - { wxT("wxCLIP_SIBLINGS"), wxCLIP_SIBLINGS}, - { wxT("wxTAB_TRAVERSAL"), 0}, // Compatibility only - - { wxT("wxTINY_CAPTION_HORIZ"), wxTINY_CAPTION_HORIZ}, - { wxT("wxTINY_CAPTION_VERT"), wxTINY_CAPTION_VERT}, - - // Text font families - { wxT("wxDEFAULT"), wxDEFAULT}, - { wxT("wxDECORATIVE"), wxDECORATIVE}, - { wxT("wxROMAN"), wxROMAN}, - { wxT("wxSCRIPT"), wxSCRIPT}, - { wxT("wxSWISS"), wxSWISS}, - { wxT("wxMODERN"), wxMODERN}, - { wxT("wxTELETYPE"), wxTELETYPE}, - { wxT("wxVARIABLE"), wxVARIABLE}, - { wxT("wxFIXED"), wxFIXED}, - { wxT("wxNORMAL"), wxNORMAL}, - { wxT("wxLIGHT"), wxLIGHT}, - { wxT("wxBOLD"), wxBOLD}, - { wxT("wxITALIC"), wxITALIC}, - { wxT("wxSLANT"), wxSLANT}, - { wxT("wxSOLID"), wxSOLID}, - { wxT("wxDOT"), wxDOT}, - { wxT("wxLONG_DASH"), wxLONG_DASH}, - { wxT("wxSHORT_DASH"), wxSHORT_DASH}, - { wxT("wxDOT_DASH"), wxDOT_DASH}, - { wxT("wxUSER_DASH"), wxUSER_DASH}, - { wxT("wxTRANSPARENT"), wxTRANSPARENT}, - { wxT("wxSTIPPLE"), wxSTIPPLE}, - { wxT("wxBDIAGONAL_HATCH"), wxBDIAGONAL_HATCH}, - { wxT("wxCROSSDIAG_HATCH"), wxCROSSDIAG_HATCH}, - { wxT("wxFDIAGONAL_HATCH"), wxFDIAGONAL_HATCH}, - { wxT("wxCROSS_HATCH"), wxCROSS_HATCH}, - { wxT("wxHORIZONTAL_HATCH"), wxHORIZONTAL_HATCH}, - { wxT("wxVERTICAL_HATCH"), wxVERTICAL_HATCH}, - { wxT("wxJOIN_BEVEL"), wxJOIN_BEVEL}, - { wxT("wxJOIN_MITER"), wxJOIN_MITER}, - { wxT("wxJOIN_ROUND"), wxJOIN_ROUND}, - { wxT("wxCAP_ROUND"), wxCAP_ROUND}, - { wxT("wxCAP_PROJECTING"), wxCAP_PROJECTING}, - { wxT("wxCAP_BUTT"), wxCAP_BUTT}, - - // Logical ops - { wxT("wxCLEAR"), wxCLEAR}, - { wxT("wxXOR"), wxXOR}, - { wxT("wxINVERT"), wxINVERT}, - { wxT("wxOR_REVERSE"), wxOR_REVERSE}, - { wxT("wxAND_REVERSE"), wxAND_REVERSE}, - { wxT("wxCOPY"), wxCOPY}, - { wxT("wxAND"), wxAND}, - { wxT("wxAND_INVERT"), wxAND_INVERT}, - { wxT("wxNO_OP"), wxNO_OP}, - { wxT("wxNOR"), wxNOR}, - { wxT("wxEQUIV"), wxEQUIV}, - { wxT("wxSRC_INVERT"), wxSRC_INVERT}, - { wxT("wxOR_INVERT"), wxOR_INVERT}, - { wxT("wxNAND"), wxNAND}, - { wxT("wxOR"), wxOR}, - { wxT("wxSET"), wxSET}, - - { wxT("wxFLOOD_SURFACE"), wxFLOOD_SURFACE}, - { wxT("wxFLOOD_BORDER"), wxFLOOD_BORDER}, - { wxT("wxODDEVEN_RULE"), wxODDEVEN_RULE}, - { wxT("wxWINDING_RULE"), wxWINDING_RULE}, - { wxT("wxHORIZONTAL"), wxHORIZONTAL}, - { wxT("wxVERTICAL"), wxVERTICAL}, - { wxT("wxBOTH"), wxBOTH}, - { wxT("wxCENTER_FRAME"), wxCENTER_FRAME}, - { wxT("wxOK"), wxOK}, - { wxT("wxYES_NO"), wxYES_NO}, - { wxT("wxCANCEL"), wxCANCEL}, - { wxT("wxYES"), wxYES}, - { wxT("wxNO"), wxNO}, - { wxT("wxICON_EXCLAMATION"), wxICON_EXCLAMATION}, - { wxT("wxICON_HAND"), wxICON_HAND}, - { wxT("wxICON_QUESTION"), wxICON_QUESTION}, - { wxT("wxICON_INFORMATION"), wxICON_INFORMATION}, - { wxT("wxICON_STOP"), wxICON_STOP}, - { wxT("wxICON_ASTERISK"), wxICON_ASTERISK}, - { wxT("wxICON_MASK"), wxICON_MASK}, - { wxT("wxCENTRE"), wxCENTRE}, - { wxT("wxCENTER"), wxCENTRE}, - { wxT("wxUSER_COLOURS"), wxUSER_COLOURS}, - { wxT("wxVERTICAL_LABEL"), 0}, - { wxT("wxHORIZONTAL_LABEL"), 0}, - - // Bitmap types (not strictly styles) - { wxT("wxBITMAP_TYPE_XPM"), wxBITMAP_TYPE_XPM}, - { wxT("wxBITMAP_TYPE_XBM"), wxBITMAP_TYPE_XBM}, - { wxT("wxBITMAP_TYPE_BMP"), wxBITMAP_TYPE_BMP}, - { wxT("wxBITMAP_TYPE_RESOURCE"), wxBITMAP_TYPE_BMP_RESOURCE}, - { wxT("wxBITMAP_TYPE_BMP_RESOURCE"), wxBITMAP_TYPE_BMP_RESOURCE}, - { wxT("wxBITMAP_TYPE_GIF"), wxBITMAP_TYPE_GIF}, - { wxT("wxBITMAP_TYPE_TIF"), wxBITMAP_TYPE_TIF}, - { wxT("wxBITMAP_TYPE_ICO"), wxBITMAP_TYPE_ICO}, - { wxT("wxBITMAP_TYPE_ICO_RESOURCE"), wxBITMAP_TYPE_ICO_RESOURCE}, - { wxT("wxBITMAP_TYPE_CUR"), wxBITMAP_TYPE_CUR}, - { wxT("wxBITMAP_TYPE_CUR_RESOURCE"), wxBITMAP_TYPE_CUR_RESOURCE}, - { wxT("wxBITMAP_TYPE_XBM_DATA"), wxBITMAP_TYPE_XBM_DATA}, - { wxT("wxBITMAP_TYPE_XPM_DATA"), wxBITMAP_TYPE_XPM_DATA}, - { wxT("wxBITMAP_TYPE_ANY"), wxBITMAP_TYPE_ANY} -}; - -static int wxResourceBitListCount = (sizeof(wxResourceBitListTable)/sizeof(wxResourceBitListStruct)); - -long wxParseWindowStyle(const wxString& bitListString) -{ - int i = 0; - wxChar *word; - long bitList = 0; - word = wxResourceParseWord(WXSTRINGCAST bitListString, &i); - while (word != NULL) - { - bool found = FALSE; - int j; - for (j = 0; j < wxResourceBitListCount; j++) - if (wxStrcmp(wxResourceBitListTable[j].word, word) == 0) - { - bitList |= wxResourceBitListTable[j].bits; - found = TRUE; - break; - } - if (!found) - { - wxLogWarning(_("Unrecognized style %s whilst parsing resource."), word); - return 0; - } - word = wxResourceParseWord(WXSTRINGCAST bitListString, &i); - } - return bitList; -} - -/* -* Load a bitmap from a wxWindows resource, choosing an optimum -* depth and appropriate type. -*/ - -wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *item = table->FindResource(resource); - if (item) - { - if ((item->GetType() == wxT("")) || (item->GetType() != wxT("wxBitmap"))) - { - wxLogWarning(_("%s not a bitmap resource specification."), (const wxChar*) resource); - return wxNullBitmap; - } - int thisDepth = wxDisplayDepth(); - long thisNoColours = (long)pow(2.0, (double)thisDepth); - - wxItemResource *optResource = (wxItemResource *) NULL; - - // Try to find optimum bitmap for this platform/colour depth - wxNode *node = item->GetChildren().First(); - while (node) - { - wxItemResource *child = (wxItemResource *)node->Data(); - int platform = (int)child->GetValue2(); - int noColours = (int)child->GetValue3(); - /* - char *name = child->GetName(); - int bitmapType = (int)child->GetValue1(); - int xRes = child->GetWidth(); - int yRes = child->GetHeight(); - */ - - switch (platform) - { - case RESOURCE_PLATFORM_ANY: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours. - // If noColours is zero (unspecified), then assume this - // is the right one. - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#ifdef __WXMSW__ - case RESOURCE_PLATFORM_WINDOWS: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours > 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif -#ifdef __WXGTK__ - case RESOURCE_PLATFORM_X: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif -#ifdef wx_max - case RESOURCE_PLATFORM_MAC: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif - default: - break; - } - node = node->Next(); - } - // If no matching resource, fail. - if (!optResource) - return wxNullBitmap; - - wxString name = optResource->GetName(); - int bitmapType = (int)optResource->GetValue1(); - switch (bitmapType) - { - case wxBITMAP_TYPE_XBM_DATA: - { -#ifdef __WXGTK__ - wxItemResource *item = table->FindResource(name); - if (!item) - { - wxLogWarning(_("Failed to find XBM resource %s.\n" - "Forgot to use wxResourceLoadBitmapData?"), (const wxChar*) name); - return wxNullBitmap; - } - return wxBitmap(item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()) ; -#else - wxLogWarning(_("No XBM facility available!")); - break; -#endif - } - case wxBITMAP_TYPE_XPM_DATA: - { - wxItemResource *item = table->FindResource(name); - if (!item) - { - wxLogWarning(_("Failed to find XPM resource %s.\nForgot to use wxResourceLoadBitmapData?"), (const wxChar*) name); - return wxNullBitmap; - } - return wxBitmap((char **)item->GetValue1()); - } - default: - { -#if defined(__WXPM__) - return wxNullBitmap; -#else - return wxBitmap(name, (wxBitmapType)bitmapType); -#endif - } - } -#ifndef __WXGTK__ - return wxNullBitmap; -#endif - } - else - { - wxLogWarning(_("Bitmap resource specification %s not found."), (const wxChar*) resource); - return wxNullBitmap; - } -} - -/* -* Load an icon from a wxWindows resource, choosing an optimum -* depth and appropriate type. -*/ - -wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *item = table->FindResource(resource); - if (item) - { - if ((item->GetType() == wxT("")) || wxStrcmp(item->GetType(), wxT("wxIcon")) != 0) - { - wxLogWarning(_("%s not an icon resource specification."), (const wxChar*) resource); - return wxNullIcon; - } - int thisDepth = wxDisplayDepth(); - long thisNoColours = (long)pow(2.0, (double)thisDepth); - - wxItemResource *optResource = (wxItemResource *) NULL; - - // Try to find optimum icon for this platform/colour depth - wxNode *node = item->GetChildren().First(); - while (node) - { - wxItemResource *child = (wxItemResource *)node->Data(); - int platform = (int)child->GetValue2(); - int noColours = (int)child->GetValue3(); - /* - char *name = child->GetName(); - int bitmapType = (int)child->GetValue1(); - int xRes = child->GetWidth(); - int yRes = child->GetHeight(); - */ - - switch (platform) - { - case RESOURCE_PLATFORM_ANY: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours. - // If noColours is zero (unspecified), then assume this - // is the right one. - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#ifdef __WXMSW__ - case RESOURCE_PLATFORM_WINDOWS: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours > 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif -#ifdef __WXGTK__ - case RESOURCE_PLATFORM_X: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif -#ifdef wx_max - case RESOURCE_PLATFORM_MAC: - { - if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) - optResource = child; - else - { - // Maximise the number of colours - if ((noColours == 0) || ((noColours <= thisNoColours) && (noColours > optResource->GetValue3()))) - optResource = child; - } - break; - } -#endif - default: - break; - } - node = node->Next(); - } - // If no matching resource, fail. - if (!optResource) - return wxNullIcon; - - wxString name = optResource->GetName(); - int bitmapType = (int)optResource->GetValue1(); - switch (bitmapType) - { - case wxBITMAP_TYPE_XBM_DATA: - { -#ifdef __WXGTK__ - wxItemResource *item = table->FindResource(name); - if (!item) - { - wxLogWarning(_("Failed to find XBM resource %s.\n" - "Forgot to use wxResourceLoadIconData?"), (const wxChar*) name); - return wxNullIcon; - } - return wxIcon((const char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()); -#else - wxLogWarning(_("No XBM facility available!")); - break; -#endif - } - case wxBITMAP_TYPE_XPM_DATA: - { - // *** XPM ICON NOT YET IMPLEMENTED IN WXWINDOWS *** - /* - wxItemResource *item = table->FindResource(name); - if (!item) - { - char buf[400]; - sprintf(buf, _("Failed to find XPM resource %s.\nForgot to use wxResourceLoadIconData?"), name); - wxLogWarning(buf); - return NULL; - } - return wxIcon((char **)item->GetValue1()); - */ - wxLogWarning(_("No XPM icon facility available!")); - break; - } - default: - { -#if defined( __WXGTK__ ) || defined( __WXMOTIF__ ) - wxLogWarning(_("Icon resource specification %s not found."), (const wxChar*) resource); - break; -#else - return wxIcon(name, bitmapType); -#endif - } - } - return wxNullIcon; - } - else - { - wxLogWarning(_("Icon resource specification %s not found."), (const wxChar*) resource); - return wxNullIcon; - } -} - -#if wxUSE_MENUS - -wxMenu *wxResourceCreateMenu(wxItemResource *item) -{ - wxMenu *menu = new wxMenu; - wxNode *node = item->GetChildren().First(); - while (node) - { - wxItemResource *child = (wxItemResource *)node->Data(); - if ((child->GetType() != wxT("")) && (child->GetType() == wxT("wxMenuSeparator"))) - menu->AppendSeparator(); - else if (child->GetChildren().Number() > 0) - { - wxMenu *subMenu = wxResourceCreateMenu(child); - if (subMenu) - menu->Append((int)child->GetValue1(), child->GetTitle(), subMenu, child->GetValue4()); - } - else - { - menu->Append((int)child->GetValue1(), child->GetTitle(), child->GetValue4(), (child->GetValue2() != 0)); - } - node = node->Next(); - } - return menu; -} - -wxMenuBar *wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *table, wxMenuBar *menuBar) -{ - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *menuResource = table->FindResource(resource); - if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu"))) - { - if (!menuBar) - menuBar = new wxMenuBar; - wxNode *node = menuResource->GetChildren().First(); - while (node) - { - wxItemResource *child = (wxItemResource *)node->Data(); - wxMenu *menu = wxResourceCreateMenu(child); - if (menu) - menuBar->Append(menu, child->GetTitle()); - node = node->Next(); - } - return menuBar; - } - return (wxMenuBar *) NULL; -} - -wxMenu *wxResourceCreateMenu(const wxString& resource, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *menuResource = table->FindResource(resource); - if (menuResource && (menuResource->GetType() != wxT("")) && (menuResource->GetType() == wxT("wxMenu"))) - // if (menuResource && (menuResource->GetType() == wxTYPE_MENU)) - return wxResourceCreateMenu(menuResource); - return (wxMenu *) NULL; -} - -#endif // wxUSE_MENUS - -// Global equivalents (so don't have to refer to default table explicitly) -bool wxResourceParseData(const wxString& resource, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - return table->ParseResourceData(resource); -} - -bool wxResourceParseData(const char* resource, wxResourceTable *table) -{ - wxString str(resource, wxConvLibc); - if (!table) - table = wxDefaultResourceTable; - - return table->ParseResourceData(str); -} - -bool wxResourceParseFile(const wxString& filename, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - return table->ParseResourceFile(filename); -} - -// Register XBM/XPM data -bool wxResourceRegisterBitmapData(const wxString& name, char bits[], int width, int height, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - return table->RegisterResourceBitmapData(name, bits, width, height); -} - -bool wxResourceRegisterBitmapData(const wxString& name, char **data, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - return table->RegisterResourceBitmapData(name, data); -} - -void wxResourceClear(wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - table->ClearTable(); -} - -/* -* Identifiers -*/ - -bool wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - table->identifiers.Put(name, (wxObject *)(long)value); - return TRUE; -} - -int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - return (int)(long)table->identifiers.Get(name); -} - -/* -* Parse #include file for #defines (only) -*/ - -bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - FILE *fd = wxFopen(f, wxT("r")); - if (!fd) - { - return FALSE; - } - while (wxGetResourceToken(fd)) - { - if (strcmp(wxResourceBuffer, "#define") == 0) - { - wxGetResourceToken(fd); - wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - wxGetResourceToken(fd); - wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - if (wxIsdigit(value[0])) - { - int val = (int)wxAtol(value); - wxResourceAddIdentifier(name, val, table); - } - delete[] name; - delete[] value; - } - } - fclose(fd); - return TRUE; -} - -/* -* Reading strings as if they were .wxr files -*/ - -static int getc_string(char *s) -{ - int ch = s[wxResourceStringPtr]; - if (ch == 0) - return EOF; - else - { - wxResourceStringPtr ++; - return ch; - } -} - -static int ungetc_string() -{ - wxResourceStringPtr --; - return 0; -} - -bool wxEatWhiteSpaceString(char *s) -{ - int ch = 0; - - while ((ch = getc_string(s)) != EOF) - { - switch (ch) - { - case ' ': - case 0x0a: - case 0x0d: - case 0x09: - break; - case '/': - { - int prev_ch = ch; - ch = getc_string(s); - if (ch == EOF) - { - ungetc_string(); - return TRUE; - } - - if (ch == '*') - { - // Eat C comment - prev_ch = 0; - while ((ch = getc_string(s)) != EOF) - { - if (ch == '/' && prev_ch == '*') - break; - prev_ch = ch; - } - } - else - { - ungetc_string(); - ungetc_string(); - return TRUE; - } - } - break; - default: - ungetc_string(); - return TRUE; - - } - } - return FALSE; -} - -bool wxGetResourceTokenString(char *s) -{ - if (!wxResourceBuffer) - wxReallocateResourceBuffer(); - wxResourceBuffer[0] = 0; - wxEatWhiteSpaceString(s); - - int ch = getc_string(s); - if (ch == '"') - { - // Get string - wxResourceBufferCount = 0; - ch = getc_string(s); - while (ch != '"') - { - int actualCh = ch; - if (ch == EOF) - { - wxResourceBuffer[wxResourceBufferCount] = 0; - return FALSE; - } - // Escaped characters - else if (ch == '\\') - { - int newCh = getc_string(s); - if (newCh == '"') - actualCh = '"'; - else if (newCh == 10) - actualCh = 10; - else - { - ungetc_string(); - } - } - - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)actualCh; - wxResourceBufferCount ++; - ch = getc_string(s); - } - wxResourceBuffer[wxResourceBufferCount] = 0; - } - else - { - wxResourceBufferCount = 0; - // Any other token - while (ch != ' ' && ch != EOF && ch != ' ' && ch != 13 && ch != 9 && ch != 10) - { - if (wxResourceBufferCount >= wxResourceBufferSize-1) - wxReallocateResourceBuffer(); - wxResourceBuffer[wxResourceBufferCount] = (char)ch; - wxResourceBufferCount ++; - - ch = getc_string(s); - } - wxResourceBuffer[wxResourceBufferCount] = 0; - if (ch == EOF) - return FALSE; - } - return TRUE; -} - -/* -* Files are in form: -static char *name = "...."; -with possible comments. -*/ - -bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - // static or #define - if (!wxGetResourceTokenString(s)) - { - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "#define") == 0) - { - wxGetResourceTokenString(s); - wxChar *name = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - wxGetResourceTokenString(s); - wxChar *value = copystring(wxConvCurrent->cMB2WX(wxResourceBuffer)); - if (wxIsdigit(value[0])) - { - int val = (int)wxAtol(value); - wxResourceAddIdentifier(name, val, table); - } - else - { - wxLogWarning(_("#define %s must be an integer."), name); - delete[] name; - delete[] value; - return FALSE; - } - delete[] name; - delete[] value; - - return TRUE; - } - /* - else if (strcmp(wxResourceBuffer, "#include") == 0) - { - wxGetResourceTokenString(s); - char *name = copystring(wxResourceBuffer); - char *actualName = name; - if (name[0] == '"') - actualName = name + 1; - int len = strlen(name); - if ((len > 0) && (name[len-1] == '"')) - name[len-1] = 0; - if (!wxResourceParseIncludeFile(actualName, table)) - { - char buf[400]; - sprintf(buf, _("Could not find resource include file %s."), actualName); - wxLogWarning(buf); - } - delete[] name; - return TRUE; - } - */ - else if (strcmp(wxResourceBuffer, "static") != 0) - { - wxChar buf[300]; - wxStrcpy(buf, _("Found ")); - wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30); - wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource.")); - wxLogWarning(buf); - return FALSE; - } - - // char - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "char") != 0) - { - wxLogWarning(_("Expected 'char' whilst parsing resource.")); - return FALSE; - } - - // *name - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (wxResourceBuffer[0] != '*') - { - wxLogWarning(_("Expected '*' whilst parsing resource.")); - return FALSE; - } - wxChar nameBuf[100]; - wxMB2WX(nameBuf, wxResourceBuffer+1, 99); - nameBuf[99] = 0; - - // = - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - - if (strcmp(wxResourceBuffer, "=") != 0) - { - wxLogWarning(_("Expected '=' whilst parsing resource.")); - return FALSE; - } - - // String - if (!wxGetResourceTokenString(s)) - { - wxLogWarning(_("Unexpected end of file whilst parsing resource.")); - *eof = TRUE; - return FALSE; - } - else - { - if (!db.ReadPrologFromString(wxResourceBuffer)) - { - wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf); - return FALSE; - } - } - // Semicolon - if (!wxGetResourceTokenString(s)) - { - *eof = TRUE; - } - return TRUE; -} - -bool wxResourceParseString(const wxString& s, wxResourceTable *table) -{ -#if wxUSE_UNICODE - return wxResourceParseString( (char*)s.mb_str().data() ); -#else - return wxResourceParseString( (char*)s.c_str() ); -#endif -} - -bool wxResourceParseString(char *s, wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - if (!s) - return FALSE; - - // Turn backslashes into spaces - if (s) - { - int len = strlen(s); - int i; - for (i = 0; i < len; i++) - if (s[i] == 92 && s[i+1] == 13) - { - s[i] = ' '; - s[i+1] = ' '; - } - } - - wxExprDatabase db; - wxResourceStringPtr = 0; - - bool eof = FALSE; - while (wxResourceReadOneResourceString(s, db, &eof, table) && !eof) - { - // Loop - } - return wxResourceInterpretResources(*table, db); -} - -/* -* resource loading facility -*/ - -bool wxWindowBase::LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - - wxItemResource *resource = table->FindResource((const wxChar *)resourceName); - // if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX)) - if (!resource || (resource->GetType() == wxT("")) || - ! ((resource->GetType() == wxT("wxDialog")) || (resource->GetType() == wxT("wxPanel")))) - return FALSE; - - wxString title(resource->GetTitle()); - long theWindowStyle = resource->GetStyle(); - bool isModal = (resource->GetValue1() != 0) ; - int x = resource->GetX(); - int y = resource->GetY(); - int width = resource->GetWidth(); - int height = resource->GetHeight(); - wxString name = resource->GetName(); - - // this is used for loading wxWizard pages from WXR - if ( parent != this ) - { - if (IsKindOf(CLASSINFO(wxDialog))) - { - wxDialog *dialogBox = (wxDialog *)this; - long modalStyle = isModal ? wxDIALOG_MODAL : 0; - if (!dialogBox->Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), theWindowStyle|modalStyle, name)) - return FALSE; - - // Only reset the client size if we know we're not going to do it again below. - if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == 0) - dialogBox->SetClientSize(width, height); - } - else if (IsKindOf(CLASSINFO(wxPanel))) - { - wxPanel* panel = (wxPanel *)this; - if (!panel->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle | wxTAB_TRAVERSAL, name)) - return FALSE; - } - else - { - if (!((wxWindow *)this)->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name)) - return FALSE; - } - } - - if ((resource->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) - { - // No need to do this since it's done in wxPanel or wxDialog constructor. - // SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - } - else - { - if (resource->GetFont().Ok()) - SetFont(resource->GetFont()); - if (resource->GetBackgroundColour().Ok()) - SetBackgroundColour(resource->GetBackgroundColour()); - } - - // Should have some kind of font at this point - if (!GetFont().Ok()) - SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - if (!GetBackgroundColour().Ok()) - SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); - - // Only when we've created the window and set the font can we set the correct size, - // if based on dialog units. - if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) - { - wxSize sz = ConvertDialogToPixels(wxSize(width, height)); - SetClientSize(sz.x, sz.y); - - wxPoint pt = ConvertDialogToPixels(wxPoint(x, y)); - Move(pt.x, pt.y); - } - - // Now create children - wxNode *node = resource->GetChildren().First(); - while (node) - { - wxItemResource *childResource = (wxItemResource *)node->Data(); - - (void) CreateItem(childResource, resource, table); - - node = node->Next(); - } - return TRUE; -} - -wxControl *wxWindowBase::CreateItem(const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table) -{ - if (!table) - table = wxDefaultResourceTable; - return table->CreateItem((wxWindow *)this, resource, parentResource); -} - -#ifdef __VISUALC__ -#pragma warning(default:4706) // assignment within conditional expression -#endif // VC++ - -#endif -// BC++/Win16 - -#endif // wxUSE_WX_RESOURCES diff --git a/src/common/wxexpr.cpp b/src/common/wxexpr.cpp deleted file mode 100644 index 70fb548..0000000 --- a/src/common/wxexpr.cpp +++ /dev/null @@ -1,1278 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: wxexpr.cpp -// Purpose: wxExpr -// Author: Julian Smart -// Modified by: -// Created: 04/01/98 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "wxexpr.h" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#if wxUSE_PROLOGIO - -#include -#include -#include - -#include "wx/utils.h" -#include "wx/expr.h" -#include "wx/wxexpr.h" - -extern "C" void add_expr(char *); -extern "C" void LexFromFile(FILE *fd); -extern "C" void LexFromString(char *buf); - - - -/* Rename all YACC/LEX stuff or we'll conflict with other - * applications - */ - -#define yyback PROIO_yyback -#define yylook PROIO_yylook -#define yywrap PROIO_yywrap -#define yyoutput PROIO_yyoutput -#define yylex PROIO_yylex -#define yyerror PROIO_yyerror -#define yyleng PROIO_yyleng -#define yytext PROIO_yytext -#define yymorfg PROIO_yymorfg -#define yylineno PROIO_yylineno -#define yytchar PROIO_yytchar -#define yyin PROIO_yyin -#define yyout PROIO_yyout -#define yysvf PROIO_yysvf -#define yyestate PROIO_yyestate -#define yysvec PROIO_yysvec -#define yybgin PROIO_yybgin -#define yyprevious PROIO_yyprevious -#define yylhs PROIO_yylhs -#define yylen PROIO_yylen -#define yydefred PROIO_yydefred -#define yydgoto PROIO_yydgoto -#define yysindex PROIO_yysindex -#define yyrindex PROIO_yyrindex -#define yygindex PROIO_yygindex -#define yytable PROIO_yytable -#define yycheck PROIO_yycheck -#define yyname PROIO_yyname -#define yyrule PROIO_yyrule -#define yydebug PROIO_yydebug -#define yynerrs PROIO_yynerrs -#define yyerrflag PROIO_yyerrflag -#define yychar PROIO_yychar -#define yyvsp PROIO_yyvsp -#define yyssp PROIO_yyssp -#define yyval PROIO_yyval -#define yylval PROIO_yylval -#define yyss PROIO_yyss -#define yyvs PROIO_yyvs -#define yyparse PROIO_yyparse - -/* +++steve162e: more defines necessary */ -#define yy_init_buffer PROIO_yy_init_buffer -#define yy_create_buffer PROIO_yy_create_buffer -#define yy_load_buffer_state PROIO_yy_load_buffer_state -#define yyrestart PROIO_yyrestart -#define yy_switch_to_buffer PROIO_yy_switch_to_buffer -#define yy_delete_buffer PROIO_yy_delete_buffer -/* ---steve162e */ - -/* WG 1/96: still more for flex 2.5 */ -#define yy_scan_buffer PROIO_scan_buffer -#define yy_scan_string PROIO_scan_string -#define yy_scan_bytes PROIO_scan_bytes -#define yy_flex_debug PROIO_flex_debug -#define yy_flush_buffer PROIO_flush_buffer -#if !defined(__VISAGECPP__) -/* multiply defined??? */ -#define yyleng PROIO_yyleng -#define yytext PROIO_yytext -#endif - -extern "C" WXDLLEXPORT_DATA(FILE*) yyin; -extern "C" WXDLLEXPORT int yyparse(void); - - -wxExprDatabase *thewxExprDatabase = NULL; -wxExprErrorHandler currentwxExprErrorHandler; - -wxExpr::wxExpr(const wxString& functor) -{ - type = wxExprList; - next = NULL; - last = NULL; - value.first = NULL; - - wxExpr *pfunctor = new wxExpr(wxExprWord, functor); - Append(pfunctor); - client_data = NULL; -} - -wxExpr::wxExpr(wxExprType the_type, const wxString& word_or_string) -{ - type = the_type; - - switch (the_type) - { - case wxExprWord: - value.word = copystring((const wxChar *)word_or_string); - break; - case wxExprString: - value.string = copystring((const wxChar *)word_or_string); - break; - case wxExprList: - last = NULL; - value.first = NULL; - break; - case wxExprReal: - case wxExprInteger: - case wxExprNull: - break; - } - client_data = NULL; - next = NULL; -} - -wxExpr::wxExpr(wxExprType the_type, wxChar *word_or_string, bool allocate) -{ - type = the_type; - - switch (the_type) - { - case wxExprWord: - value.word = allocate ? copystring(word_or_string) : word_or_string; - break; - case wxExprString: - value.string = allocate ? copystring(word_or_string) : word_or_string; - break; - case wxExprList: - last = NULL; - value.first = NULL; - break; - case wxExprReal: - case wxExprInteger: - case wxExprNull: - break; - } - client_data = NULL; - next = NULL; -} - -wxExpr::wxExpr(long the_integer) -{ - type = wxExprInteger; - value.integer = the_integer; - client_data = NULL; - next = NULL; -} - -wxExpr::wxExpr(double the_real) -{ - type = wxExprReal; - value.real = the_real; - client_data = NULL; - next = NULL; -} - -wxExpr::wxExpr(wxList *the_list) -{ - type = wxExprList; - client_data = NULL; - last = NULL; - value.first = NULL; - - wxExpr *listExpr = new wxExpr(wxExprList); - - wxNode *node = the_list->GetFirst(); - while (node) - { - wxExpr *expr = (wxExpr *)node->GetData(); - listExpr->Append(expr); - node = node->GetNext(); - } - Append(listExpr); - - delete the_list; -} - -wxExpr::~wxExpr(void) -{ - switch (type) - { - case wxExprInteger: - case wxExprReal: - { - break; - } - case wxExprString: - { - delete[] value.string; - break; - } - case wxExprWord: - { - delete[] value.word; - break; - } - case wxExprList: - { - wxExpr *expr = value.first; - while (expr) - { - wxExpr *expr1 = expr->next; - - delete expr; - expr = expr1; - } - break; - } - case wxExprNull: break; - } -} - -void wxExpr::Append(wxExpr *expr) -{ - if (!value.first) - value.first = expr; - - if (last) - last->next = expr; - last = expr; -} - -void wxExpr::Insert(wxExpr *expr) -{ - expr->next = value.first; - value.first = expr; - - if (!last) - last = expr; -} - -wxExpr *wxExpr::Copy(void) const -{ - // This seems to get round an optimizer bug when - // using Watcom C++ 10a in WIN32 compilation mode. - // If these lines not present, the type seems to be - // interpreted wrongly as an integer. - // I don't want to turn optimization off since it's needed - // for reading in files quickly. -#if defined(__WATCOMC__) - char buf[2]; - sprintf(buf, ""); -#endif - - switch (type) - { - case wxExprInteger: - return new wxExpr(value.integer); - case wxExprReal: - return new wxExpr(value.real); - case wxExprString: - return new wxExpr(wxExprString, wxString(value.string)); - case wxExprWord: - return new wxExpr(wxExprWord, wxString(value.word)); - case wxExprList: - { - wxExpr *expr = value.first; - wxExpr *new_list = new wxExpr(wxExprList); - while (expr) - { - wxExpr *expr2 = expr->Copy(); - new_list->Append(expr2); - expr = expr->next; - } - return new_list; - } - case wxExprNull: - break; - } - return NULL; -} - - -// Get the wxExpr (containing (= wxExpr Value) form) for the given word -// or string, assuming that we have Attribute=Value, ... -wxExpr *wxExpr::GetAttributeValueNode(const wxString& word) const // Use only for a clause or list -{ - if (type != wxExprList) - return NULL; - - wxExpr *expr = value.first; - while (expr) - { - if (expr->type == wxExprList) - { - wxExpr *firstNode = expr->value.first; - if ((firstNode->type == wxExprWord) && (firstNode->value.word[0] == '=')) - { - wxExpr *secondNode = firstNode->next; - if ((secondNode->type == wxExprWord) && - (wxStrcmp((const wxChar *)word, secondNode->value.word) == 0)) - { - return expr; - } - } - } - expr = expr->next; - } - return NULL; -} - -// Get the value (in wxExpr form) for the given word or string, assuming -// that we have Attribute=Value, ... -wxExpr *wxExpr::AttributeValue(const wxString& word) const // Use only for a clause or list -{ - if (type != wxExprList) - return NULL; - - wxExpr *attExpr = GetAttributeValueNode(word); - if (attExpr && attExpr->value.first && attExpr->value.first->next) - return attExpr->value.first->next->next; - else return NULL; -} - -wxString wxExpr::Functor(void) const // Use only for a clause -{ - if ((type != wxExprList) || !value.first) - return wxString(wxT("")); - - if (value.first->type == wxExprWord) - return wxString(value.first->value.word); - else - return wxString(wxT("")); -} - -bool wxExpr::IsFunctor(const wxString& f) const // Use only for a clause -{ - if ((type != wxExprList) || !value.first) - return FALSE; - - return (value.first->type == wxExprWord && - (wxStrcmp((const wxChar *)f, value.first->value.word) == 0)); -} - -// Return nth argument of a clause (starting from 1) -wxExpr *wxExpr::Arg(wxExprType theType, int arg) const -{ - wxExpr *expr = value.first; - int i; - for (i = 1; i < arg; i++) - if (expr) - expr = expr->next; - - if (expr && (expr->type == theType)) - return expr; - else - return NULL; -} - -// Return nth argument of a list expression (starting from zero) -wxExpr *wxExpr::Nth(int arg) const -{ - if (type != wxExprList) - return NULL; - - wxExpr *expr = value.first; - int i; - for (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 wxExpr::Number(void) const -{ - if (type != wxExprList) - return 0; - - int i = 0; - wxExpr *expr = value.first; - while (expr) - { - expr = expr->next; - i ++; - } - return i; -} - -void wxExpr::DeleteAttributeValue(const wxString& attribute) -{ - if (type != wxExprList) - return; - - wxExpr *expr = value.first; - wxExpr *lastExpr = this; - while (expr) - { - if (expr->type == wxExprList) - { - wxExpr *firstNode = expr->value.first; - if ((firstNode->type == wxExprWord) && (firstNode->value.word[0] == '=')) - { - wxExpr *secondNode = firstNode->next; - if ((secondNode->type == wxExprWord) && - (wxStrcmp((const wxChar *)attribute, secondNode->value.word) == 0)) - { - wxExpr *nextExpr = expr->next; - delete expr; - - lastExpr->next = nextExpr; - - if (last == expr) - last = lastExpr; - - return; - } - } - } - lastExpr = expr; - expr = expr->next; - } - return; -} - -void wxExpr::AddAttributeValue(const wxString& attribute, wxExpr *val) -{ - if (type != wxExprList) - { -// cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n"; - return; - } - // Warning - existing code may assume that any existing value - // is deleted first. For efficiency, we leave this to the application. -// DeleteAttributeValue(attribute); - - wxExpr *patt = new wxExpr(wxExprWord, attribute); - wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); - - wxExpr *listExpr = new wxExpr(wxExprList); - - listExpr->Append(pequals); - listExpr->Append(patt); - listExpr->Append(val); - - Append(listExpr); -} - -void wxExpr::AddAttributeValue(const wxString& attribute, long val) -{ - if (type != wxExprList) - { -// cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n"; - return; - } - // Warning - existing code may assume that any existing value - // is deleted first. For efficiency, we leave this to the application. -// DeleteAttributeValue(attribute); - - wxExpr *patt = new wxExpr(wxExprWord, attribute); - wxExpr *pval = new wxExpr(val); - wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); - - wxExpr *listExpr = new wxExpr(wxExprList); - - listExpr->Append(pequals); - listExpr->Append(patt); - listExpr->Append(pval); - - Append(listExpr); -} - -void wxExpr::AddAttributeValue(const wxString& attribute, double val) -{ - if (type != wxExprList) - { -// cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n"; - return; - } - -// DeleteAttributeValue(attribute); - wxExpr *patt = new wxExpr(wxExprWord, attribute); - wxExpr *pval = new wxExpr(val); - wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); - - wxExpr *listExpr = new wxExpr(wxExprList); - - listExpr->Append(pequals); - listExpr->Append(patt); - listExpr->Append(pval); - - Append(listExpr); -} - -void wxExpr::AddAttributeValueString(const wxString& attribute, const wxString& val) -{ - if (type != wxExprList) - { -// cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n"; - return; - } - -// DeleteAttributeValue(attribute); - - wxExpr *patt = new wxExpr(wxExprWord, attribute); - wxExpr *pval = new wxExpr(wxExprString, val); - wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); - - wxExpr *listExpr = new wxExpr(wxExprList); - - listExpr->Append(pequals); - listExpr->Append(patt); - listExpr->Append(pval); - - Append(listExpr); -} - -void wxExpr::AddAttributeValueWord(const wxString& attribute, const wxString& val) -{ - if (type != wxExprList) - { -// cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n"; - return; - } - -// DeleteAttributeValue(attribute); - - wxExpr *patt = new wxExpr(wxExprWord, attribute); - wxExpr *pval = new wxExpr(wxExprWord, val); - wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); - - wxExpr *listExpr = new wxExpr(wxExprList); - - listExpr->Append(pequals); - listExpr->Append(patt); - listExpr->Append(pval); - - Append(listExpr); -} - -void wxExpr::AddAttributeValue(const wxString& attribute, wxList *val) -{ - if (type != wxExprList) - { -// cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n"; - return; - } - if (!val) - return; - -// DeleteAttributeValue(attribute); - - wxExpr *patt = new wxExpr(wxExprWord, attribute); - wxExpr *pval = new wxExpr(val); - wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); - - wxExpr *listExpr = new wxExpr(wxExprList); - - listExpr->Append(pequals); - listExpr->Append(patt); - listExpr->Append(pval); - - Append(listExpr); -} - -void wxExpr::AddAttributeValueStringList(const wxString& attribute, wxList *string_list) -{ - if (type != wxExprList) - { -// cout << "Error! tried to add an attribute-value pair to a nonlist wxExpr expression\n"; - return; - } - if (!string_list) - return; - -// DeleteAttributeValue(attribute); - - // First make a list of wxExpr strings - wxExpr *listExpr = new wxExpr(wxExprList); - wxNode *node = string_list->GetFirst(); - while (node) - { - wxChar *string = (wxChar*)node->GetData(); - wxExpr *expr = new wxExpr(wxExprString, wxString(string)); - listExpr->Append(expr); - node = node->GetNext(); - } - - // Now make an (=, Att, Value) triple - wxExpr *patt = new wxExpr(wxExprWord, attribute); - wxExpr *pequals = new wxExpr(wxExprWord, wxT("=")); - - wxExpr *listExpr2 = new wxExpr(wxExprList); - - listExpr2->Append(pequals); - listExpr2->Append(patt); - listExpr2->Append(listExpr); - - Append(listExpr2); -} - -bool wxExpr::GetAttributeValue(const wxString& att, int& var) const -{ - wxExpr *expr = AttributeValue(att); - - if (expr && (expr->Type() == wxExprInteger || expr->Type() == wxExprReal)) - { - var = (int)(expr->IntegerValue()); - return TRUE; - } - else - return FALSE; -} - -bool wxExpr::GetAttributeValue(const wxString& att, long& var) const -{ - wxExpr *expr = AttributeValue(att); - - if (expr && (expr->Type() == wxExprInteger || expr->Type() == wxExprReal)) - { - var = expr->IntegerValue(); - return TRUE; - } - else - return FALSE; -} - -bool wxExpr::GetAttributeValue(const wxString& att, float& var) const -{ - wxExpr *expr = AttributeValue(att); - if (expr && (expr->Type() == wxExprInteger || expr->Type() == wxExprReal)) - { - var = (float) expr->RealValue(); - return TRUE; - } - else - return FALSE; -} - -bool wxExpr::GetAttributeValue(const wxString& att, double& var) const -{ - wxExpr *expr = AttributeValue(att); - if (expr && (expr->Type() == wxExprInteger || expr->Type() == wxExprReal)) - { - var = expr->RealValue(); - return TRUE; - } - else - return FALSE; -} - -bool wxExpr::GetAttributeValue(const wxString& att, wxString& var) const // Word OR string -> string -{ - wxExpr *expr = AttributeValue(att); - if (expr && expr->Type() == wxExprWord) - { - var = expr->WordValue(); - return TRUE; - } - else if (expr && expr->Type() == wxExprString) - { - var = expr->StringValue(); - return TRUE; - } - else - return FALSE; -} - -bool wxExpr::GetAttributeValue(const wxString& att, wxExpr **var) const -{ - wxExpr *expr = AttributeValue(att); - if (expr) - { - *var = expr; - return TRUE; - } - else - return FALSE; -} - -bool wxExpr::GetAttributeValueStringList(const wxString& att, wxList *var) const -{ - wxExpr *expr = AttributeValue(att); - if (expr && expr->Type() == wxExprList) - { - wxExpr *string_expr = expr->value.first; - while (string_expr) - { - if (string_expr->Type() == wxExprString) - var->Append((wxObject *)copystring(string_expr->StringValue())); - - string_expr = string_expr->next; - } - return TRUE; - } - else - return FALSE; -} - -// Compatibility -void wxExpr::AssignAttributeValue(wxChar *att, wxChar **var) const -{ - wxString str; - if (GetAttributeValue(att, str)) - { - if (*var) - delete[] *var; - *var = copystring((const wxChar *) str); - } -} - -void wxExpr::WriteClause(FILE* stream) // Write this expression as a top-level clause -{ - if (type != wxExprList) - return; - - wxExpr *node = value.first; - if (node) - { - node->WriteExpr(stream); - fprintf( stream, "(" ); - node = node->next; - bool first = TRUE; - while (node) - { - if (!first) - fprintf( stream, " " ); - node->WriteExpr(stream); - node = node->next; - if (node) - fprintf( stream, ",\n" ); - first = FALSE; - } - fprintf( stream, ").\n\n" ); - } -} - -void wxExpr::WriteExpr(FILE* stream) // Write as any other subexpression -{ - // This seems to get round an optimizer bug when - // using Watcom C++ 10a in WIN32 compilation mode. - // If these lines not present, the type seems to be - // interpreted wrongly as an integer. - // I don't want to turn optimization off since it's needed - // for reading in files quickly. -#if defined(__WATCOMC__) - char buf[2]; - sprintf(buf, ""); -#endif - - switch (type) - { - case wxExprInteger: - { - fprintf( stream, "%ld", value.integer ); - break; - } - case wxExprReal: - { - double f = value.real; - fprintf( stream, "%.6g", f); - break; - } - case wxExprString: - { - fprintf( stream, "\"" ); - size_t i; - const wxWX2MBbuf val = wxConvLibc.cWX2MB(value.string); - size_t len = strlen(val); - for (i = 0; i < len; i++) - { - char ch = val[i]; - if (ch == '"' || ch == '\\') - fprintf( stream, "\\" ); - char tmp[2]; - tmp[0] = ch; - tmp[1] = 0; - fprintf( stream, tmp ); - } - fprintf( stream, "\"" ); - break; - } - case wxExprWord: - { - bool quote_it = FALSE; - const wxWX2MBbuf val = wxConvLibc.cWX2MB(value.word); - size_t len = strlen(val); - if ((len == 0) || (len > 0 && (val[(size_t) 0] > 64 && val[(size_t) 0] < 91))) - quote_it = TRUE; - else - { - size_t i; - for (i = 0; i < len; i++) - if ((!isalpha(val[i])) && (!isdigit(val[i])) && - (val[i] != '_')) - { quote_it = TRUE; i = len; } - } - - if (quote_it) - fprintf( stream ,"'" ); - - fprintf( stream, val ); - - if (quote_it) - fprintf( stream, "'" ); - - break; - } - case wxExprList: - { - if (!value.first) - fprintf( stream, "[]" ); - else - { - wxExpr *expr = value.first; - - if ((expr->Type() == wxExprWord) && (wxStrcmp(expr->WordValue(), wxT("=")) == 0)) - { - wxExpr *arg1 = expr->next; - wxExpr *arg2 = arg1->next; - arg1->WriteExpr(stream); - fprintf( stream, " = " ); - arg2->WriteExpr(stream); - } - else - { - fprintf( stream, "[" ); - while (expr) - { - expr->WriteExpr(stream); - expr = expr->next; - if (expr) - fprintf( stream, ", " ); - } - fprintf( stream, "]" ); - } - } - break; - } - case wxExprNull: break; - } -} - -/* - * wxExpr 'database' (list of expressions) - */ - -IMPLEMENT_DYNAMIC_CLASS(wxExprDatabase, wxList) - -wxExprDatabase::wxExprDatabase(wxExprErrorHandler handler) -{ - position = NULL; - hash_table = NULL; - currentwxExprErrorHandler = handler; - noErrors = 0; -} - -wxExprDatabase::wxExprDatabase(wxExprType type, const wxString& attribute, int size, - wxExprErrorHandler handler) -{ - position = NULL; - attribute_to_hash = attribute; - if (type == wxExprString) - hash_table = new wxHashTable(wxKEY_STRING, size); - else if (type == wxExprInteger) - hash_table = new wxHashTable(wxKEY_INTEGER, size); - else hash_table = NULL; - - currentwxExprErrorHandler = handler; - noErrors = 0; -} - -wxExprDatabase::~wxExprDatabase(void) -{ - ClearDatabase(); - if (hash_table) - delete hash_table; -} - -void wxExprDatabase::BeginFind(void) // Initialise a search -{ - position = GetFirst(); -} - -wxExpr *wxExprDatabase::FindClause(long id) // Find a term based on an integer id attribute - // e.g. node(id=23, type=rectangle, ....). -{ - wxExpr *found = NULL; - while (position && !found) - { - wxExpr *term = (wxExpr *)position->GetData(); - - if (term->Type() == wxExprList) - { - wxExpr *value = term->AttributeValue(wxT("id")); - if (value->Type() == wxExprInteger && value->IntegerValue() == id) - found = term; - } - position = position->GetNext(); - } - return found; -} - -// Find on basis of attribute/value pairs, e.g. type=rectangle -wxExpr *wxExprDatabase::FindClause(const wxString& word, const wxString& val) -{ - wxExpr *found = NULL; - while (position && !found) - { - wxExpr *term = (wxExpr *)position->GetData(); - - if (term->Type() == wxExprList) - { - wxExpr *value = term->AttributeValue(word); - if ((value->Type() == wxExprWord && value->WordValue() == val) || - (value->Type() == wxExprString && value->StringValue() == val)) - found = term; - } - position = position->GetNext(); - } - return found; -} - -wxExpr *wxExprDatabase::FindClause(const wxString& word, long val) -{ - wxExpr *found = NULL; - while (position && !found) - { - wxExpr *term = (wxExpr *)position->GetData(); - - if (term->Type() == wxExprList) - { - wxExpr *value = term->AttributeValue(word); - if ((value->Type() == wxExprInteger) && (value->IntegerValue() == val)) - found = term; - } - position = position->GetNext(); - } - return found; -} - -wxExpr *wxExprDatabase::FindClause(const wxString& word, double val) -{ - wxExpr *found = NULL; - while (position && !found) - { - wxExpr *term = (wxExpr *)position->GetData(); - - if (term->Type() == wxExprList) - { - wxExpr *value = term->AttributeValue(word); - if ((value->Type() == wxExprReal) && (value->RealValue() == val)) - found = term; - } - position = position->GetNext(); - } - return found; -} - -wxExpr *wxExprDatabase::FindClauseByFunctor(const wxString& functor) -{ - wxExpr *found = NULL; - while (position && !found) - { - wxExpr *term = (wxExpr *)position->GetData(); - - if (term->Type() == wxExprList) - { - if (term->Functor() == functor) - found = term; - } - position = position->GetNext(); - } - return found; -} - -// If hashing is on, must store in hash table too -void wxExprDatabase::Append(wxExpr *clause) -{ - wxList::Append((wxObject *)clause); - if (hash_table) - { - wxString functor(clause->Functor()); - wxExpr *expr = clause->AttributeValue(attribute_to_hash); - if (expr) - { - long functor_key = hash_table->MakeKey(WXSTRINGCAST functor); - long value_key = 0; - if (expr && expr->Type() == wxExprString) - { - value_key = hash_table->MakeKey(WXSTRINGCAST expr->StringValue()); - hash_table->Put(functor_key + value_key, WXSTRINGCAST expr->StringValue(), (wxObject *)clause); - } - else if (expr && expr->Type() == wxExprInteger) - { - value_key = expr->IntegerValue(); - hash_table->Put(functor_key + value_key, expr->IntegerValue(), (wxObject *)clause); - } - - } - } -} - -wxExpr *wxExprDatabase::HashFind(const wxString& functor, long value) const -{ - long key = hash_table->MakeKey(WXSTRINGCAST functor) + value; - - // The key alone isn't guaranteed to be unique: - // must supply value too. Let's assume the value of the - // id is going to be reasonably unique. - return (wxExpr *)hash_table->Get(key, value); -} - -wxExpr *wxExprDatabase::HashFind(const wxString& functor, const wxString& value) const -{ - long key = hash_table->MakeKey(WXSTRINGCAST functor) + hash_table->MakeKey(WXSTRINGCAST value); - return (wxExpr *)hash_table->Get(key, WXSTRINGCAST value); -} - -void wxExprDatabase::ClearDatabase(void) -{ - noErrors = 0; - wxNode *node = GetFirst(); - while (node) - { - wxExpr *expr = (wxExpr *)node->GetData(); - delete expr; - delete node; - node = GetFirst(); - } - - if (hash_table) - hash_table->Clear(); -} - -bool wxExprDatabase::Read(const wxString& filename) -{ - noErrors = 0; - - FILE *f = wxFopen(filename, _T("r")); - if (f) - { - thewxExprDatabase = this; - - LexFromFile(f); - yyparse(); - fclose(f); - - wxExprCleanUp(); - return (noErrors == 0); - } - else - { - return FALSE; - } -} - -bool wxExprDatabase::ReadFromString(const wxString& buffer) -{ - noErrors = 0; - thewxExprDatabase = this; - - const wxWX2MBbuf buf = buffer.mb_str(); - LexFromString(wxMBSTRINGCAST buf); - yyparse(); - wxExprCleanUp(); - return (noErrors == 0); -} - -bool wxExprDatabase::Write(const wxString& fileName) -{ - FILE *stream = wxFopen( fileName, _T("w+")); - - if (!stream) - return FALSE; - - bool success = Write(stream); - fclose(stream); - return success; -} - -bool wxExprDatabase::Write(FILE *stream) -{ - noErrors = 0; - wxNode *node = GetFirst(); - while (node) - { - wxExpr *expr = (wxExpr *)node->GetData(); - expr->WriteClause(stream); - node = node->GetNext(); - } - return (noErrors == 0); -} - -void add_expr(wxExpr * expr) -{ - thewxExprDatabase->Append(expr); -} - -// Checks functor -bool wxExprIsFunctor(wxExpr *expr, const wxString& functor) -{ - if (expr && (expr->Type() == wxExprList)) - { - wxExpr *first_expr = expr->value.first; - - if (first_expr && (first_expr->Type() == wxExprWord) && - (first_expr->WordValue() == functor)) - return TRUE; - else - return FALSE; - } - else - return FALSE; -} - -/* - * Called from parser - * - */ - -char *wxmake_integer(char *str) -{ - wxExpr *x = new wxExpr(atol(str)); - - return (char *)x; -} - -char *wxmake_real(char *str1, char *str2) -{ - char buf[50]; - - sprintf(buf, "%s.%s", str1, str2); - double f = (double)atof(buf); - wxExpr *x = new wxExpr(f); - - return (char *)x; -} - -// extern "C" double exp10(double); - -char *wxmake_exp(char *str1, char *str2) -{ - double mantissa = (double)atoi(str1); - double exponent = (double)atoi(str2); - - double d = mantissa * pow(10.0, exponent); - - wxExpr *x = new wxExpr(d); - - return (char *)x; -} - -char *wxmake_exp2(char *str1, char *str2, char *str3) -{ - char buf[50]; - - sprintf(buf, "%s.%s", str1, str2); - double mantissa = (double)atof(buf); - double exponent = (double)atoi(str3); - - double d = mantissa * pow(10.0, exponent); - - wxExpr *x = new wxExpr(d); - - return (char *)x; -} - -char *wxmake_word(char *str) -{ - wxExpr *x = new wxExpr(wxExprWord, wxString(str, wxConvLibc).c_str()); - return (char *)x; -} - -char *wxmake_string(char *str) -{ - wxChar *s, *t; - size_t len, i; - const wxMB2WXbuf sbuf = wxConvLibc.cMB2WX(str); - -// str++; /* skip leading quote */ - len = wxStrlen(sbuf) - 1; /* ignore trailing quote */ - - s = new wxChar[len + 1]; - - t = s; - for(i=1; iInsert(car); - return (char *)cdr; -} - -void process_command(char * cexpr) -{ - wxExpr *expr = (wxExpr *)cexpr; - add_expr(expr); -} - -void syntax_error(char *WXUNUSED(s)) -{ - if (currentwxExprErrorHandler) - (void)(*(currentwxExprErrorHandler))(WXEXPR_ERROR_SYNTAX, (char *)"syntax error"); - if (thewxExprDatabase) thewxExprDatabase->noErrors += 1; -} - -#if 0 -#ifdef _WINDLL -// char *__cdecl strdup(const char *s) -WXDLLEXPORT char *strdup(const char *s) -{ - int len = strlen(s); - char *new_s = (char *)malloc(sizeof(char)*(len+1)); - strcpy(new_s, s); - return new_s; -} -#endif -#endif - -#endif - // wxUSE_PROLOGIO diff --git a/src/generic/treelay.cpp b/src/generic/treelay.cpp deleted file mode 100644 index 16f82eb..0000000 --- a/src/generic/treelay.cpp +++ /dev/null @@ -1,471 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// Name: treelay.h -// Purpose: wxTreeLayout class -// Author: Julian Smart -// Modified by: -// Created: 7/4/98 -// RCS-ID: $Id$ -// Copyright: (c) 1998 Julian Smart -// Licence: wxWindows licence -/////////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "wxtree.h" -#endif - -// For compilers that support precompilation, includes "wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/dc.h" -#include "wx/event.h" -#endif - -#if wxUSE_TREELAYOUT - -#include "wx/treelay.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) -{ - wxChar buf[80]; - wxString name(GetNodeName(id)); - if (name != wxT("")) - wxSprintf(buf, wxT("%s"), (const wxChar*) name); - else - wxSprintf(buf, wxT("")); - - 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 != wxT("")) - 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.GetCount(); - - 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.GetFirst(); - while (node) - { - CalcLayout((long)node->GetData(), level+1, dc); - node = node->GetNext(); - } - - // Y Calculations - long averageY; - ActivateNode(nodeId, TRUE); - - if (n > 0) - { - averageY = 0; - node = children.GetFirst(); - while (node) - { - averageY += GetNodeY((long)node->GetData()); - node = node->GetNext(); - } - 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.GetFirst(); - while (node) - { - CalcLayout((long)node->GetData(), level+1, dc); - node = node->GetNext(); - } - - // X Calculations - long averageX; - ActivateNode(nodeId, TRUE); - - if (n > 0) - { - averageX = 0; - node = children.GetFirst(); - while (node) - { - averageX += GetNodeX((long)node->GetData()); - node = node->GetNext(); - } - 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(wxTreeLayoutStored, wxTreeLayout) - -wxTreeLayoutStored::wxTreeLayoutStored(int n):wxTreeLayout() -{ - m_nodes = NULL; - m_maxNodes = 0; - Initialize(n); -} - -wxTreeLayoutStored::~wxTreeLayoutStored(void) -{ - if (m_nodes) - delete[] m_nodes; -} - -void wxTreeLayoutStored::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 = wxT(""); - 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 wxTreeLayoutStored::AddChild(const wxString& name, const wxString& parent) -{ - if (m_num < (m_maxNodes -1 )) - { - long i = -1; - if (parent != wxT("")) - 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 wxTreeLayoutStored::AddChild(const wxString& name, long parent) -{ - if (m_num < (m_maxNodes -1 ) && parent < m_num) - { - long i = -1; - if (parent != -1) - { - i = 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 wxTreeLayoutStored::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 wxTreeLayoutStored::GetChildren(long id, wxList& list) -{ - long currentId = GetTopNode(); - while (currentId != -1) - { - if (id == GetNodeParent(currentId)) - list.Append((wxObject *)currentId); - currentId = GetNextNode(currentId); - } -} - -wxStoredNode* wxTreeLayoutStored::GetNode(long idx) const -{ - wxASSERT(idx < m_num); - - return &m_nodes[idx]; -}; - -long wxTreeLayoutStored::GetNodeX(long id) -{ - wxASSERT(id < m_num); - - return (long)m_nodes[id].m_x; -} - -long wxTreeLayoutStored::GetNodeY(long id) -{ - wxASSERT(id < m_num); - - return (long)m_nodes[id].m_y; -} - -void wxTreeLayoutStored::SetNodeX(long id, long x) -{ - wxASSERT(id < m_num); - - m_nodes[id].m_x = (int)x; -} - -void wxTreeLayoutStored::SetNodeY(long id, long y) -{ - wxASSERT(id < m_num); - - m_nodes[id].m_y = (int)y; -} - -void wxTreeLayoutStored::SetNodeName(long id, const wxString& name) -{ - wxASSERT(id < m_num); - - m_nodes[id].m_name = name; -} - -wxString wxTreeLayoutStored::GetNodeName(long id) -{ - wxASSERT(id < m_num); - - return m_nodes[id].m_name; -} - -long wxTreeLayoutStored::GetNodeParent(long id) -{ - if (id != -1) - { - wxASSERT(id < m_num); - - return m_nodes[id].m_parentId; - } - else - return -1; -} - -long wxTreeLayoutStored::GetNextNode(long id) -{ - wxASSERT(id < m_num); - - if ((id != -1) && (id < (m_num - 1))) - return id + 1; - else - return -1; -} - -void wxTreeLayoutStored::SetClientData(long id, long clientData) -{ - wxASSERT(id < m_num); - - m_nodes[id].m_clientData = clientData; -} - -long wxTreeLayoutStored::GetClientData(long id) const -{ - wxASSERT(id < m_num); - - return m_nodes[id].m_clientData; -} - -void wxTreeLayoutStored::ActivateNode(long id, bool active) -{ - wxASSERT(id < m_num); - - m_nodes[id].m_active = active; -} - -bool wxTreeLayoutStored::NodeActive(long id) -{ - wxASSERT(id < m_num); - - return m_nodes[id].m_active; -} - -wxString wxTreeLayoutStored::HitTest(wxMouseEvent& event, wxDC& dc) -{ - wxPoint pt = event.GetPosition(); - wxCoord x = pt.x; - wxCoord y = pt.y; - - int i; - for (i = 0; i < m_maxNodes; i++) - { - 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( wxT("") ); -} - -#endif - // wxUSE_TREELAYOUT diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 704c36a..ff2211e 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -28,11 +28,6 @@ #include "wx/msgdlg.h" #include "wx/file.h" #include "wx/filename.h" - -#if wxUSE_WX_RESOURCES - #include "wx/resource.h" -#endif - #include "wx/module.h" #include "wx/image.h" @@ -709,10 +704,6 @@ bool wxApp::Initialize() wxInitializeStockLists(); wxInitializeStockObjects(); -#if wxUSE_WX_RESOURCES - wxInitializeResourceSystem(); -#endif - wxModule::RegisterModules(); if (!wxModule::InitializeModules()) return FALSE; @@ -728,10 +719,6 @@ void wxApp::CleanUp() { wxModule::CleanUpModules(); -#if wxUSE_WX_RESOURCES - wxCleanUpResourceSystem(); -#endif - delete wxTheColourDatabase; wxTheColourDatabase = (wxColourDatabase*) NULL; diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 704c36a..ff2211e 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -28,11 +28,6 @@ #include "wx/msgdlg.h" #include "wx/file.h" #include "wx/filename.h" - -#if wxUSE_WX_RESOURCES - #include "wx/resource.h" -#endif - #include "wx/module.h" #include "wx/image.h" @@ -709,10 +704,6 @@ bool wxApp::Initialize() wxInitializeStockLists(); wxInitializeStockObjects(); -#if wxUSE_WX_RESOURCES - wxInitializeResourceSystem(); -#endif - wxModule::RegisterModules(); if (!wxModule::InitializeModules()) return FALSE; @@ -728,10 +719,6 @@ void wxApp::CleanUp() { wxModule::CleanUpModules(); -#if wxUSE_WX_RESOURCES - wxCleanUpResourceSystem(); -#endif - delete wxTheColourDatabase; wxTheColourDatabase = (wxColourDatabase*) NULL; diff --git a/src/mac/app.cpp b/src/mac/app.cpp index 943e674..bf3a261 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -38,10 +38,6 @@ #include "wx/menu.h" #include "wx/docview.h" -#if wxUSE_WX_RESOURCES -# include "wx/resource.h" -#endif - #include // mac @@ -162,16 +158,16 @@ short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply)) err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList); if (err != noErr) return err; - + err = AECountItems(&docList, &itemsInList); if (err != noErr) return err; - + ProcessSerialNumber PSN ; PSN.highLongOfPSN = 0 ; PSN.lowLongOfPSN = kCurrentProcess ; SetFrontProcess( &PSN ) ; - + for (i = 1; i <= itemsInList; i++) { AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType, (Ptr) & theSpec, sizeof(theSpec), &actualSize); @@ -196,16 +192,16 @@ short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply) err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList); if (err != noErr) return err; - + err = AECountItems(&docList, &itemsInList); if (err != noErr) return err; - + ProcessSerialNumber PSN ; PSN.highLongOfPSN = 0 ; PSN.lowLongOfPSN = kCurrentProcess ; SetFrontProcess( &PSN ) ; - + for (i = 1; i <= itemsInList; i++) { AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType, (Ptr) & theSpec, sizeof(theSpec), &actualSize); @@ -223,7 +219,7 @@ short wxApp::MacHandleAEOApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU return noErr ; } -// AEQuit attempts to quite the application +// AEQuit attempts to quite the application short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply)) { @@ -289,18 +285,18 @@ void wxApp::MacNewFile() #if TARGET_CARBON - static const EventTypeSpec eventList[] = + static const EventTypeSpec eventList[] = { { kEventClassCommand, kEventProcessCommand } , { kEventClassCommand, kEventCommandUpdateStatus } , - + { kEventClassApplication , kEventAppActivated } , { kEventClassApplication , kEventAppDeactivated } , // handling the quit event is not recommended by apple // rather using the quit apple event - which we do - + { kEventClassAppleEvent , kEventAppleEvent } , - + { kEventClassMouse , kEventMouseDown } , { 'WXMC' , 'WXMC' } } ; @@ -309,25 +305,25 @@ static pascal OSStatus MenuEventHandler( EventHandlerCallRef handler , EventRef { OSStatus result = eventNotHandledErr ; UInt32 kind = GetEventKind( event ) ; - + return result ; } -// due to the rather low-level event API of wxWindows, we cannot use RunApplicationEventLoop +// due to the rather low-level event API of wxWindows, we cannot use RunApplicationEventLoop // but have to use ReceiveNextEvent dealing with events manually, therefore we also have // deal with clicks in the menu bar explicitely static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) { OSStatus result = eventNotHandledErr ; - + switch( GetEventKind(event) ) { case kEventMouseDown : { Point point ; WindowRef window ; - + GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof( Point ), NULL, &point ); short windowPart = ::FindWindow(point, &window); @@ -339,7 +335,7 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef } } break ; - } + } return result ; } @@ -349,14 +345,14 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR OSStatus result = eventNotHandledErr ; HICommand command ; - + GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof( HICommand ), NULL, &command ); MenuCommand id = command.commandID ; if ( id == kHICommandPreferences ) id = wxApp::s_macPreferencesMenuItemId ; - + wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ; wxMenu* menu = NULL ; wxMenuItem* item = NULL ; @@ -366,7 +362,7 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR if ( item == NULL || menu == NULL || mbar == NULL ) return result ; - + switch( GetEventKind( event ) ) { case kEventProcessCommand : @@ -375,7 +371,7 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR { item->Check( !item->IsChecked() ) ; } - + menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ; result = noErr ; } @@ -386,8 +382,8 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR break ; default : break ; - } - + } + return result ; } @@ -541,7 +537,7 @@ bool wxApp::Initialize() #endif wxMacSetupConverters() ; - + s_macCursorRgn = ::NewRgn() ; wxClassInfo::InitializeClasses(); @@ -576,10 +572,6 @@ bool wxApp::Initialize() wxInitializeStockLists(); wxInitializeStockObjects(); -#if wxUSE_WX_RESOURCES - wxInitializeResourceSystem(); -#endif - wxBitmap::InitStandardHandlers(); wxModule::RegisterModules(); @@ -598,15 +590,15 @@ bool wxApp::OnInitGui() { if( !wxAppBase::OnInitGui() ) return false ; - -#if TARGET_CARBON + +#if TARGET_CARBON InstallStandardEventHandler( GetApplicationEventTarget() ) ; - + InstallApplicationEventHandler( - GetwxAppEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler)); + GetwxAppEventHandlerUPP(), + GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler)); #endif - + #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments , NewAEEventHandlerUPP(AEHandleODoc) , @@ -657,10 +649,6 @@ void wxApp::CleanUp() wxModule::CleanUpModules(); -#if wxUSE_WX_RESOURCES - wxCleanUpResourceSystem(); -#endif - wxDeleteStockObjects() ; // Destroy all GDI lists, etc. @@ -723,7 +711,7 @@ void wxApp::CleanUp() wxStAppResource::CloseSharedLibraryResource(); #endif wxMacCleanupConverters() ; - + UMACleanupToolbox() ; if (s_macCursorRgn) { ::DisposeRgn((RgnHandle)s_macCursorRgn); @@ -1360,7 +1348,7 @@ bool wxApp::Yield(bool onlyIfNeeded) s_inReceiveEvent = true ; status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ; s_inReceiveEvent = false ; - + if ( status == eventLoopTimedOutErr ) { // make sure next time the event loop will trigger idle events @@ -1383,7 +1371,7 @@ bool wxApp::Yield(bool onlyIfNeeded) // having a larger value here leads to large performance slowdowns // so we cannot give background apps more processor time here // we do so however having a large sleep value in the main event loop - sleepTime = 0 ; + sleepTime = 0 ; while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn)) { @@ -1722,8 +1710,8 @@ void wxApp::MacHandleMouseDownEvent( WXEVENTREF evr ) &constraintRect , &newContentRect ) ; if ( growResult ) { - win->SetSize( newContentRect.left , newContentRect.top , - newContentRect.right - newContentRect.left , + win->SetSize( newContentRect.left , newContentRect.top , + newContentRect.right - newContentRect.left , newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING); } s_lastMouseDown = 0; @@ -1825,7 +1813,7 @@ void wxApp::MacHandleMouseUpEvent( WXEVENTREF evr ) } } -#endif +#endif long wxMacTranslateKey(unsigned char key, unsigned char code) ; long wxMacTranslateKey(unsigned char key, unsigned char code) @@ -1951,7 +1939,7 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr ) else { wxWindow* focus = wxWindow::FindFocus() ; - + if ( MacSendKeyDownEvent( focus , ev->message , ev->modifiers , ev->when , ev->where.h , ev->where.v ) == false ) { // has not been handled -> perform default @@ -1989,12 +1977,12 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi { if ( !focus ) return false ; - + short keycode ; short keychar ; keychar = short(keymessage & charCodeMask); keycode = short(keymessage & keyCodeMask) >> 8 ; - + if ( modifiers & ( controlKey|shiftKey|optionKey ) ) { // control interferes with some built-in keys like pgdown, return etc. therefore we remove the controlKey modifier @@ -2012,7 +2000,7 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi realkeyval = short(keymessage & charCodeMask) ; keyval = wxToupper( keyval ) ; } - + wxKeyEvent event(wxEVT_KEY_DOWN); bool handled = false ; event.m_shiftDown = modifiers & shiftKey; @@ -2137,7 +2125,7 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier if ( keyval == keychar ) { - keyval = wxToupper( keyval ) ; + keyval = wxToupper( keyval ) ; } bool handled = false ; @@ -2321,9 +2309,9 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr ) } else { - windowPart = ::FindWindow(ev->where, &window); + windowPart = ::FindWindow(ev->where, &window); } - + switch (windowPart) { case inContent : @@ -2368,12 +2356,12 @@ void wxApp::MacHandleMenuCommand( wxUint32 id ) item = mbar->FindItem( id , &menu ) ; } wxCHECK_RET( item != NULL && menu != NULL && mbar != NULL, wxT("error in menu item callback") ); - + if (item->IsCheckable()) { item->Check( !item->IsChecked() ) ; } - + menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ; } diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index 943e674..bf3a261 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -38,10 +38,6 @@ #include "wx/menu.h" #include "wx/docview.h" -#if wxUSE_WX_RESOURCES -# include "wx/resource.h" -#endif - #include // mac @@ -162,16 +158,16 @@ short wxApp::MacHandleAEODoc(const WXEVENTREF event, WXEVENTREF WXUNUSED(reply)) err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList); if (err != noErr) return err; - + err = AECountItems(&docList, &itemsInList); if (err != noErr) return err; - + ProcessSerialNumber PSN ; PSN.highLongOfPSN = 0 ; PSN.lowLongOfPSN = kCurrentProcess ; SetFrontProcess( &PSN ) ; - + for (i = 1; i <= itemsInList; i++) { AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType, (Ptr) & theSpec, sizeof(theSpec), &actualSize); @@ -196,16 +192,16 @@ short wxApp::MacHandleAEPDoc(const WXEVENTREF event , WXEVENTREF WXUNUSED(reply) err = AEGetParamDesc((AppleEvent *)event, keyDirectObject, typeAEList,&docList); if (err != noErr) return err; - + err = AECountItems(&docList, &itemsInList); if (err != noErr) return err; - + ProcessSerialNumber PSN ; PSN.highLongOfPSN = 0 ; PSN.lowLongOfPSN = kCurrentProcess ; SetFrontProcess( &PSN ) ; - + for (i = 1; i <= itemsInList; i++) { AEGetNthPtr(&docList, i, typeFSS, &keywd, &returnedType, (Ptr) & theSpec, sizeof(theSpec), &actualSize); @@ -223,7 +219,7 @@ short wxApp::MacHandleAEOApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU return noErr ; } -// AEQuit attempts to quite the application +// AEQuit attempts to quite the application short wxApp::MacHandleAEQuit(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNUSED(reply)) { @@ -289,18 +285,18 @@ void wxApp::MacNewFile() #if TARGET_CARBON - static const EventTypeSpec eventList[] = + static const EventTypeSpec eventList[] = { { kEventClassCommand, kEventProcessCommand } , { kEventClassCommand, kEventCommandUpdateStatus } , - + { kEventClassApplication , kEventAppActivated } , { kEventClassApplication , kEventAppDeactivated } , // handling the quit event is not recommended by apple // rather using the quit apple event - which we do - + { kEventClassAppleEvent , kEventAppleEvent } , - + { kEventClassMouse , kEventMouseDown } , { 'WXMC' , 'WXMC' } } ; @@ -309,25 +305,25 @@ static pascal OSStatus MenuEventHandler( EventHandlerCallRef handler , EventRef { OSStatus result = eventNotHandledErr ; UInt32 kind = GetEventKind( event ) ; - + return result ; } -// due to the rather low-level event API of wxWindows, we cannot use RunApplicationEventLoop +// due to the rather low-level event API of wxWindows, we cannot use RunApplicationEventLoop // but have to use ReceiveNextEvent dealing with events manually, therefore we also have // deal with clicks in the menu bar explicitely static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) { OSStatus result = eventNotHandledErr ; - + switch( GetEventKind(event) ) { case kEventMouseDown : { Point point ; WindowRef window ; - + GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof( Point ), NULL, &point ); short windowPart = ::FindWindow(point, &window); @@ -339,7 +335,7 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef } } break ; - } + } return result ; } @@ -349,14 +345,14 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR OSStatus result = eventNotHandledErr ; HICommand command ; - + GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof( HICommand ), NULL, &command ); MenuCommand id = command.commandID ; if ( id == kHICommandPreferences ) id = wxApp::s_macPreferencesMenuItemId ; - + wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ; wxMenu* menu = NULL ; wxMenuItem* item = NULL ; @@ -366,7 +362,7 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR if ( item == NULL || menu == NULL || mbar == NULL ) return result ; - + switch( GetEventKind( event ) ) { case kEventProcessCommand : @@ -375,7 +371,7 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR { item->Check( !item->IsChecked() ) ; } - + menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ; result = noErr ; } @@ -386,8 +382,8 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR break ; default : break ; - } - + } + return result ; } @@ -541,7 +537,7 @@ bool wxApp::Initialize() #endif wxMacSetupConverters() ; - + s_macCursorRgn = ::NewRgn() ; wxClassInfo::InitializeClasses(); @@ -576,10 +572,6 @@ bool wxApp::Initialize() wxInitializeStockLists(); wxInitializeStockObjects(); -#if wxUSE_WX_RESOURCES - wxInitializeResourceSystem(); -#endif - wxBitmap::InitStandardHandlers(); wxModule::RegisterModules(); @@ -598,15 +590,15 @@ bool wxApp::OnInitGui() { if( !wxAppBase::OnInitGui() ) return false ; - -#if TARGET_CARBON + +#if TARGET_CARBON InstallStandardEventHandler( GetApplicationEventTarget() ) ; - + InstallApplicationEventHandler( - GetwxAppEventHandlerUPP(), - GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler)); + GetwxAppEventHandlerUPP(), + GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler)); #endif - + #if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340) AEInstallEventHandler( kCoreEventClass , kAEOpenDocuments , NewAEEventHandlerUPP(AEHandleODoc) , @@ -657,10 +649,6 @@ void wxApp::CleanUp() wxModule::CleanUpModules(); -#if wxUSE_WX_RESOURCES - wxCleanUpResourceSystem(); -#endif - wxDeleteStockObjects() ; // Destroy all GDI lists, etc. @@ -723,7 +711,7 @@ void wxApp::CleanUp() wxStAppResource::CloseSharedLibraryResource(); #endif wxMacCleanupConverters() ; - + UMACleanupToolbox() ; if (s_macCursorRgn) { ::DisposeRgn((RgnHandle)s_macCursorRgn); @@ -1360,7 +1348,7 @@ bool wxApp::Yield(bool onlyIfNeeded) s_inReceiveEvent = true ; status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ; s_inReceiveEvent = false ; - + if ( status == eventLoopTimedOutErr ) { // make sure next time the event loop will trigger idle events @@ -1383,7 +1371,7 @@ bool wxApp::Yield(bool onlyIfNeeded) // having a larger value here leads to large performance slowdowns // so we cannot give background apps more processor time here // we do so however having a large sleep value in the main event loop - sleepTime = 0 ; + sleepTime = 0 ; while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn)) { @@ -1722,8 +1710,8 @@ void wxApp::MacHandleMouseDownEvent( WXEVENTREF evr ) &constraintRect , &newContentRect ) ; if ( growResult ) { - win->SetSize( newContentRect.left , newContentRect.top , - newContentRect.right - newContentRect.left , + win->SetSize( newContentRect.left , newContentRect.top , + newContentRect.right - newContentRect.left , newContentRect.bottom - newContentRect.top, wxSIZE_USE_EXISTING); } s_lastMouseDown = 0; @@ -1825,7 +1813,7 @@ void wxApp::MacHandleMouseUpEvent( WXEVENTREF evr ) } } -#endif +#endif long wxMacTranslateKey(unsigned char key, unsigned char code) ; long wxMacTranslateKey(unsigned char key, unsigned char code) @@ -1951,7 +1939,7 @@ void wxApp::MacHandleKeyDownEvent( WXEVENTREF evr ) else { wxWindow* focus = wxWindow::FindFocus() ; - + if ( MacSendKeyDownEvent( focus , ev->message , ev->modifiers , ev->when , ev->where.h , ev->where.v ) == false ) { // has not been handled -> perform default @@ -1989,12 +1977,12 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi { if ( !focus ) return false ; - + short keycode ; short keychar ; keychar = short(keymessage & charCodeMask); keycode = short(keymessage & keyCodeMask) >> 8 ; - + if ( modifiers & ( controlKey|shiftKey|optionKey ) ) { // control interferes with some built-in keys like pgdown, return etc. therefore we remove the controlKey modifier @@ -2012,7 +2000,7 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi realkeyval = short(keymessage & charCodeMask) ; keyval = wxToupper( keyval ) ; } - + wxKeyEvent event(wxEVT_KEY_DOWN); bool handled = false ; event.m_shiftDown = modifiers & shiftKey; @@ -2137,7 +2125,7 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier if ( keyval == keychar ) { - keyval = wxToupper( keyval ) ; + keyval = wxToupper( keyval ) ; } bool handled = false ; @@ -2321,9 +2309,9 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr ) } else { - windowPart = ::FindWindow(ev->where, &window); + windowPart = ::FindWindow(ev->where, &window); } - + switch (windowPart) { case inContent : @@ -2368,12 +2356,12 @@ void wxApp::MacHandleMenuCommand( wxUint32 id ) item = mbar->FindItem( id , &menu ) ; } wxCHECK_RET( item != NULL && menu != NULL && mbar != NULL, wxT("error in menu item callback") ); - + if (item->IsCheckable()) { item->Check( !item->IsChecked() ) ; } - + menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ; } diff --git a/src/mgl/app.cpp b/src/mgl/app.cpp index 82261a7..e81251b 100644 --- a/src/mgl/app.cpp +++ b/src/mgl/app.cpp @@ -27,7 +27,6 @@ #include "wx/dialog.h" #include "wx/log.h" #include "wx/intl.h" - #include "wx/resource.h" #endif #include "wx/app.h" @@ -91,7 +90,7 @@ bool wxApp::Yield(bool onlyIfNeeded) while (wxEventLoop::GetActive()->Pending()) wxEventLoop::GetActive()->Dispatch(); } - + /* it's necessary to call ProcessIdle() to update the frames sizes which might have been changed (it also will update other things set from OnUpdateUI() which is a nice (and desired) side effect) */ @@ -116,7 +115,7 @@ void wxWakeUpIdle() wxMutexGuiEnter(); #endif - while (wxTheApp->ProcessIdle()) {} + while (wxTheApp->ProcessIdle()) {} #if wxUSE_THREADS if (!wxThread::IsMain()) @@ -139,11 +138,11 @@ class wxRootWindow : public wxWindow ~wxRootWindow() { // we don't want to delete MGL_WM's rootWnd - m_wnd = NULL; + m_wnd = NULL; } virtual bool AcceptsFocus() const { return FALSE; } - + DECLARE_DYNAMIC_CLASS(wxRootWindow) }; @@ -159,18 +158,18 @@ static bool wxCreateMGL_WM(const wxDisplayModeInfo& displayMode) { int mode; int refresh = MGL_DEFAULT_REFRESH; - + #if wxUSE_SYSTEM_OPTIONS if ( wxSystemOptions::HasOption(wxT("mgl.screen-refresh")) ) refresh = wxSystemOptions::GetOptionInt(wxT("mgl.screen-refresh")); #endif - - mode = MGL_findMode(displayMode.GetWidth(), - displayMode.GetHeight(), + + mode = MGL_findMode(displayMode.GetWidth(), + displayMode.GetHeight(), displayMode.GetDepth()); if ( mode == -1 ) { - wxLogError(_("Mode %ix%i-%i not available."), + wxLogError(_("Mode %ix%i-%i not available."), displayMode.GetWidth(), displayMode.GetHeight(), displayMode.GetDepth()); @@ -183,7 +182,7 @@ static bool wxCreateMGL_WM(const wxDisplayModeInfo& displayMode) g_displayDC = NULL; return FALSE; } - + g_winMng = MGL_wmCreate(g_displayDC->getDC()); if (!g_winMng) return FALSE; @@ -229,7 +228,7 @@ wxDisplayModeInfo wxGetDefaultDisplayMode() wxString mode; unsigned w, h, bpp; - if ( !wxGetEnv(wxT("WXMODE"), &mode) || + if ( !wxGetEnv(wxT("WXMODE"), &mode) || (wxSscanf(mode.c_str(), _T("%ux%u-%u"), &w, &h, &bpp) != 3) ) { w = 640, h = 480, bpp = 16; @@ -430,17 +429,13 @@ bool wxApp::Initialize() wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING); wxTheColourDatabase->Initialize(); - + // Can't do this in wxModule, because fonts are needed by stock lists wxTheFontsManager = new wxFontsManager; wxInitializeStockLists(); wxInitializeStockObjects(); -#if wxUSE_WX_RESOURCES - wxInitializeResourceSystem(); -#endif - wxModule::RegisterModules(); if (!wxModule::InitializeModules()) return FALSE; @@ -462,10 +457,6 @@ void wxApp::CleanUp() wxModule::CleanUpModules(); -#if wxUSE_WX_RESOURCES - wxCleanUpResourceSystem(); -#endif - if (wxTheColourDatabase) delete wxTheColourDatabase; diff --git a/src/motif/app.cpp b/src/motif/app.cpp index b41e0eb..0968451 100644 --- a/src/motif/app.cpp +++ b/src/motif/app.cpp @@ -42,10 +42,6 @@ #include "wx/thread.h" #endif -#if wxUSE_WX_RESOURCES - #include "wx/resource.h" -#endif - #ifdef __VMS__ #pragma message disable nosimpint #endif @@ -105,10 +101,6 @@ bool wxApp::Initialize() wxInitializeStockLists(); wxInitializeStockObjects(); -#if wxUSE_WX_RESOURCES - wxInitializeResourceSystem(); -#endif - // For PostScript printing #if wxUSE_POSTSCRIPT /* Done using wxModule now @@ -135,10 +127,6 @@ void wxApp::CleanUp() wxModule::CleanUpModules(); -#if wxUSE_WX_RESOURCES - wxCleanUpResourceSystem(); -#endif - wxDeleteStockObjects() ; // Destroy all GDI lists, etc. diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 072874a..94b3dfb 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -65,10 +65,6 @@ WX_DEFINE_OBJARRAY(wxMsgArray); #endif // wxUSE_THREADS -#if wxUSE_WX_RESOURCES - #include "wx/resource.h" -#endif - #if wxUSE_TOOLTIPS #include "wx/tooltip.h" #endif // wxUSE_TOOLTIPS @@ -191,7 +187,7 @@ END_EVENT_TABLE() bool wxApp::Initialize() { // the first thing to do is to check if we're trying to run an Unicode - // program under Win9x w/o MSLU emulation layer - if so, abort right now + // program under Win9x w/o MSLU emulation layer - if so, abort right now // as it has no chance to work #if wxUSE_UNICODE && !wxUSE_UNICODE_MSLU if ( wxGetOsVersion() != wxWINDOWS_NT ) @@ -225,10 +221,6 @@ bool wxApp::Initialize() wxInitializeStockLists(); wxInitializeStockObjects(); -#if wxUSE_WX_RESOURCES - wxInitializeResourceSystem(); -#endif - wxBitmap::InitStandardHandlers(); #if defined(__WIN95__) && !defined(__WXMICROWIN__) @@ -511,12 +503,6 @@ void wxApp::CleanUp() wxModule::CleanUpModules(); -#if wxUSE_WX_RESOURCES - wxCleanUpResourceSystem(); - - // wxDefaultResourceTable->ClearTable(); -#endif - wxDeleteStockObjects(); // Destroy all GDI lists, etc. diff --git a/src/os2/app.cpp b/src/os2/app.cpp index 4d47ed1..79c53de 100644 --- a/src/os2/app.cpp +++ b/src/os2/app.cpp @@ -76,10 +76,6 @@ extern "C" int _System bsdselect(int, WX_DEFINE_OBJARRAY(wxMsgArray); #endif // wxUSE_THREADS -#if wxUSE_WX_RESOURCES - #include "wx/resource.h" -#endif - #if wxUSE_TOOLTIPS #include "wx/tooltip.h" #endif // wxUSE_TOOLTIPS @@ -271,10 +267,6 @@ bool wxApp::Initialize( wxInitializeStockLists(); wxInitializeStockObjects(); -#if wxUSE_WX_RESOURCES - wxInitializeResourceSystem(); -#endif - wxBitmap::InitStandardHandlers(); // @@ -473,10 +465,6 @@ void wxApp::CleanUp() wxModule::CleanUpModules(); -#if wxUSE_WX_RESOURCES - wxCleanUpResourceSystem(); -#endif - wxDeleteStockObjects(); // diff --git a/src/os2/cursor.cpp b/src/os2/cursor.cpp index 73a7935..be4238b 100644 --- a/src/os2/cursor.cpp +++ b/src/os2/cursor.cpp @@ -20,7 +20,6 @@ #include "wx/app.h" #include "wx/cursor.h" #include "wx/icon.h" -#include "wx/resource.h" #endif #include "wx/os2/private.h" diff --git a/src/x11/app.cpp b/src/x11/app.cpp index baf2b44..7435774 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -38,10 +38,6 @@ #include "wx/thread.h" #endif -#if wxUSE_WX_RESOURCES - #include "wx/resource.h" -#endif - #include "wx/x11/private.h" #include @@ -121,10 +117,6 @@ bool wxApp::Initialize() wxInitializeStockLists(); wxInitializeStockObjects(); -#if wxUSE_WX_RESOURCES - wxInitializeResourceSystem(); -#endif - wxWidgetHashTable = new wxHashTable(wxKEY_INTEGER); wxClientWidgetHashTable = new wxHashTable(wxKEY_INTEGER); @@ -143,10 +135,6 @@ void wxApp::CleanUp() wxModule::CleanUpModules(); -#if wxUSE_WX_RESOURCES - wxCleanUpResourceSystem(); -#endif - delete wxTheColourDatabase; wxTheColourDatabase = NULL; @@ -239,7 +227,7 @@ int wxEntryStart( int& argc, char *argv[] ) } - // X11 display stuff + // X11 display stuff Display* xdisplay = XOpenDisplay( displayName ); if (!xdisplay) { @@ -251,7 +239,7 @@ int wxEntryStart( int& argc, char *argv[] ) XSynchronize(xdisplay, True); wxApp::ms_display = (WXDisplay*) xdisplay; - + XSelectInput( xdisplay, XDefaultRootWindow(xdisplay), PropertyChangeMask); // Misc. @@ -260,7 +248,7 @@ int wxEntryStart( int& argc, char *argv[] ) #if wxUSE_UNICODE // Glib's type system required by Pango g_type_init(); -#endif +#endif if (!wxApp::Initialize()) return -1; @@ -1119,9 +1107,9 @@ PangoContext* wxApp::GetPangoContext() static PangoContext *ret = NULL; if (ret) return ret; - + Display *xdisplay = (Display*) wxApp::GetDisplay(); - + #if 1 int xscreen = DefaultScreen(xdisplay); static int use_xft = -1; @@ -1130,16 +1118,16 @@ PangoContext* wxApp::GetPangoContext() wxString val = wxGetenv( L"GDK_USE_XFT" ); use_xft = (val == L"1"); } - + if (use_xft) ret = pango_xft_get_context( xdisplay, xscreen ); else #endif ret = pango_x_get_context( xdisplay ); - + if (!PANGO_IS_CONTEXT(ret)) wxLogError( wxT("No pango context.") ); - + return ret; } #endif @@ -1240,7 +1228,7 @@ bool wxApp::Yield(bool onlyIfNeeded) // Call dispatch at least once so that sockets // can be tested wxTheApp->Dispatch(); - + while (wxTheApp && wxTheApp->Pending()) wxTheApp->Dispatch(); diff --git a/utils/dialoged/src/DialogEdVC.dsp b/utils/dialoged/src/DialogEdVC.dsp index fa417f1..dbfa8a8 100644 --- a/utils/dialoged/src/DialogEdVC.dsp +++ b/utils/dialoged/src/DialogEdVC.dsp @@ -56,7 +56,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/dialoged.exe" /libpath:"../../../lib" /libpath:"../../../contrib/lib" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmsw.lib png.lib zlib.lib jpeg.lib tiff.lib wxdeprecated.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"Release/dialoged.exe" /libpath:"../../../lib" /libpath:"../../../contrib/lib" !ELSEIF "$(CFG)" == "DialogEdVC - Win32 Debug" @@ -82,7 +82,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmswd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"Debug/dialoged.exe" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../contrib/lib" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmswd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib wxdeprecatedd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"Debug/dialoged.exe" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../contrib/lib" !ELSEIF "$(CFG)" == "DialogEdVC - Win32 Debug DLL" @@ -108,7 +108,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmsw250d.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/dialoged.exe" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../contrib/lib" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmsw250d.lib wxdeprecatedd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /out:"DebugDLL/dialoged.exe" /pdbtype:sept /libpath:"../../../lib" /libpath:"../../../contrib/lib" !ELSEIF "$(CFG)" == "DialogEdVC - Win32 Release DLL" @@ -135,7 +135,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmsw250.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/dialoged.exe" /libpath:"../../../lib" /libpath:"../../../contrib/lib" +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmsw250.lib wxdeprecated.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /out:"ReleaseDLL/dialoged.exe" /libpath:"../../../lib" /libpath:"../../../contrib/lib" !ENDIF diff --git a/utils/dialoged/src/makefile.vc b/utils/dialoged/src/makefile.vc index b42c3a4..c5f320f 100644 --- a/utils/dialoged/src/makefile.vc +++ b/utils/dialoged/src/makefile.vc @@ -22,6 +22,13 @@ THISDIR = $(WXDIR)\utils\dialoged\src DOCDIR=$(WXDIR)\docs LOCALDOCDIR=$(WXDIR)\utils\dialoged\docs +FINAL=0 +!if "$(FINAL)" == "0" +EXTRALIBS=$(WXDIR)\lib\wxdeprecatedd.lib +!else +EXTRALIBS=$(WXDIR)\lib\wxdeprecated.lib +!endif + OVERRIDEFLAGS=/Od PROGRAM=dialoged diff --git a/utils/projgen/makeproj.cpp b/utils/projgen/makeproj.cpp index 0f0fdf7..0a3b22e 100644 --- a/utils/projgen/makeproj.cpp +++ b/utils/projgen/makeproj.cpp @@ -21,7 +21,8 @@ #endif #include "wx/wx.h" -#include "wx/resource.h" +#include "wx/deprecated/setup.h" +#include "wx/deprecated/resource.h" #if wxUSE_IOSTREAMH #include -- 2.7.4