New location for some deprecated files

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19890 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-03-30 19:47:55 +00:00
parent 820893d0d4
commit 4a3bdee6a9
24 changed files with 14923 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
/* //////////////////////////////////////////////////////////////////////////
// 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 <math.h>
#if defined(__VISAGECPP__) && __IBMCPP__ >= 400
# undef __BSEXCPT__
#endif
#include <stdlib.h>
#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__ */

View File

@@ -0,0 +1,348 @@
/////////////////////////////////////////////////////////////////////////////
// Name: prop.h
// Purpose: Property sheet classes
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PROP_H_
#define _WX_PROP_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "prop.h"
#endif
#include "wx/deprecated/setup.h"
#if wxUSE_PROPSHEET
#include "wx/defs.h"
#include "wx/string.h"
#include "wx/hash.h"
#include "wx/dialog.h"
#include "wx/frame.h"
#include "wx/button.h"
#include "wx/listbox.h"
#include "wx/textctrl.h"
#include "wx/gdicmn.h"
#include "wx/layout.h"
#include "wx/sizer.h"
class wxWindow;
class wxProperty;
class wxPropertyValue;
class wxPropertySheet;
class wxPropertyView;
class wxPropertyValidator;
class wxPropertyValidatorRegistry;
#define wxPROPERTY_VERSION 2.0
// A storable sheet of values
class WXDLLEXPORT wxPropertySheet: public wxObject
{
public:
wxPropertySheet(const wxString& name = wxT(""));
~wxPropertySheet();
// Set the name of the sheet
inline virtual void SetName(const wxString& name) { m_name=name; }
inline virtual wxString GetName() const { return m_name; }
// Does this sheet contain a property with this name
virtual bool HasProperty(const wxString& name) const;
// Set property name to value
virtual bool SetProperty(const wxString& name, const wxPropertyValue& value);
// Remove property from sheet by name, deleting it
virtual void RemoveProperty(const wxString& name);
// Get the name of the sheet
// Add a property
virtual void AddProperty(wxProperty *property);
// Get property by name
virtual wxProperty *GetProperty(const wxString& name) const;
// Clear all properties
virtual void Clear();
virtual void UpdateAllViews(wxPropertyView *thisView = NULL);
inline virtual wxList& GetProperties() const { return (wxList&) m_properties; }
// Sets/clears the modified flag for each property value
virtual void SetAllModified(bool flag = TRUE);
protected:
wxObject* m_viewedObject;
wxList m_properties;
wxPropertyView* m_propertyView;
wxString m_name;
private:
DECLARE_DYNAMIC_CLASS(wxPropertySheet)
};
// Base class for property sheet views. There are currently two directly derived
// classes: wxPropertyListView, and wxPropertyFormView.
class WXDLLEXPORT wxPropertyView: public wxEvtHandler
{
public:
wxPropertyView(long flags = 0);
~wxPropertyView();
// Associates and shows the view
virtual void ShowView(wxPropertySheet *WXUNUSED(propertySheet), wxWindow *WXUNUSED(panel)) {}
// Update this view of the viewed object, called e.g. by
// the object itself.
virtual bool OnUpdateView() {return FALSE;};
// Override this to do something as soon as the property changed,
// if the view and validators support it.
virtual void OnPropertyChanged(wxProperty *WXUNUSED(property)) {}
virtual void AddRegistry(wxPropertyValidatorRegistry *registry);
inline virtual wxList& GetRegistryList() const
{ return (wxList&) m_validatorRegistryList; }
virtual wxPropertyValidator *FindPropertyValidator(wxProperty *property);
inline virtual void SetPropertySheet(wxPropertySheet *sheet) { m_propertySheet = sheet; }
inline virtual wxPropertySheet *GetPropertySheet() const { return m_propertySheet; }
inline virtual bool OnClose() { return FALSE; }
inline long GetFlags(void) { return m_buttonFlags; }
protected:
long m_buttonFlags;
wxPropertySheet* m_propertySheet;
wxProperty* m_currentProperty;
wxList m_validatorRegistryList;
wxPropertyValidator* m_currentValidator;
private:
DECLARE_DYNAMIC_CLASS(wxPropertyView)
};
class WXDLLEXPORT wxPropertyValidator: public wxEvtHandler
{
public:
wxPropertyValidator(long flags = 0);
~wxPropertyValidator();
inline long GetFlags() const { return m_validatorFlags; }
inline void SetValidatorProperty(wxProperty *prop) { m_validatorProperty = prop; }
inline wxProperty *GetValidatorProperty(void) const { return m_validatorProperty; }
virtual bool StringToFloat (wxChar *s, float *number);
virtual bool StringToDouble (wxChar *s, double *number);
virtual bool StringToInt (wxChar *s, int *number);
virtual bool StringToLong (wxChar *s, long *number);
virtual wxChar *FloatToString (float number);
virtual wxChar *DoubleToString (double number);
virtual wxChar *IntToString (int number);
virtual wxChar *LongToString (long number);
protected:
long m_validatorFlags;
wxProperty* m_validatorProperty;
private:
DECLARE_DYNAMIC_CLASS(wxPropertyValidator)
};
// extern wxPropertyValidator *wxDefaultPropertyValidator;
class WXDLLEXPORT wxPropertyValidatorRegistry: public wxHashTable
{
public:
wxPropertyValidatorRegistry();
~wxPropertyValidatorRegistry();
virtual void RegisterValidator(const wxString& roleName, wxPropertyValidator *validator);
virtual wxPropertyValidator *GetValidator(const wxString& roleName);
void ClearRegistry();
private:
DECLARE_DYNAMIC_CLASS(wxPropertyValidatorRegistry)
};
/*
* Property value class
*/
typedef enum {
wxPropertyValueNull,
wxPropertyValueInteger,
wxPropertyValueReal,
wxPropertyValuebool,
wxPropertyValueString,
wxPropertyValueList,
wxPropertyValueIntegerPtr,
wxPropertyValueRealPtr,
wxPropertyValueboolPtr,
wxPropertyValueStringPtr
} wxPropertyValueType;
class WXDLLEXPORT wxPropertyValue: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxPropertyValue)
wxPropertyValue(void); // Unknown type
wxPropertyValue(const wxPropertyValue& copyFrom); // Copy constructor
wxPropertyValue(const wxChar *val);
wxPropertyValue(const wxString& val);
wxPropertyValue(long val);
wxPropertyValue(bool val);
wxPropertyValue(float val);
wxPropertyValue(double the_real);
wxPropertyValue(wxList *val);
wxPropertyValue(wxStringList *val);
// Pointer versions
wxPropertyValue(wxChar **val);
wxPropertyValue(long *val);
wxPropertyValue(bool *val);
wxPropertyValue(float *val);
~wxPropertyValue(void);
virtual inline wxPropertyValueType Type(void) const { return m_type; }
virtual inline void SetType(wxPropertyValueType typ) { m_type = typ; }
virtual long IntegerValue(void) const;
virtual float RealValue(void) const;
virtual bool BoolValue(void) const;
virtual wxChar *StringValue(void) const;
virtual long *IntegerValuePtr(void) const;
virtual float *RealValuePtr(void) const;
virtual bool *BoolValuePtr(void) const;
virtual wxChar **StringValuePtr(void) const;
// Get nth arg of clause (starting from 1)
virtual wxPropertyValue *Arg(wxPropertyValueType type, int arg) const;
// Return nth argument of a list expression (starting from zero)
virtual wxPropertyValue *Nth(int arg) const;
// Returns the number of elements in a list expression
virtual int Number(void) const;
virtual wxPropertyValue *NewCopy(void) const;
virtual void Copy(wxPropertyValue& copyFrom);
virtual void WritePropertyClause(wxString &stream); // Write this expression as a top-level clause
virtual void WritePropertyType(wxString &stream); // Write as any other subexpression
// Append an expression to a list
virtual void Append(wxPropertyValue *expr);
// Insert at beginning of list
virtual void Insert(wxPropertyValue *expr);
// Get first expr in list
virtual inline wxPropertyValue *GetFirst(void) const
{ return ((m_type == wxPropertyValueList) ? m_value.first : (wxPropertyValue*)NULL); }
// Get next expr if this is a node in a list
virtual inline wxPropertyValue *GetNext(void) const
{ return m_next; }
// Get last expr in list
virtual inline wxPropertyValue *GetLast(void) const
{ return ((m_type == wxPropertyValueList) ? m_last : (wxPropertyValue*)NULL); }
// Delete this node from the list
virtual void Delete(wxPropertyValue *node);
// Clear list
virtual void ClearList(void);
virtual inline void SetClientData(wxObject *data) { m_clientData = data; }
virtual inline wxObject *GetClientData(void) { return m_clientData; }
virtual wxString GetStringRepresentation(void);
inline void SetModified(bool flag = TRUE) { m_modifiedFlag = flag; }
inline bool GetModified(void) { return m_modifiedFlag; }
// Operators
void operator=(const wxPropertyValue& val);
// void operator=(const char *val);
void operator=(const wxString& val);
void operator=(const long val);
void operator=(const bool val);
void operator=(const float val);
void operator=(const wxChar **val);
void operator=(const long *val);
void operator=(const bool *val);
void operator=(const float *val);
public:
wxObject* m_clientData;
wxPropertyValueType m_type;
bool m_modifiedFlag;
union {
long integer; // Also doubles as bool
wxChar *string;
float real;
long *integerPtr;
bool *boolPtr;
wxChar **stringPtr;
float *realPtr;
wxPropertyValue *first; // If is a list expr, points to the first node
} m_value;
wxPropertyValue* m_next; // If this is a node in a list, points to the next node
wxPropertyValue* m_last; // If is a list expr, points to the last node
};
/*
* Property class: contains a name and a value.
*/
class WXDLLEXPORT wxProperty: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxProperty)
protected:
bool m_enabled;
public:
wxPropertyValue m_value;
wxString m_name;
wxString m_propertyRole;
wxPropertyValidator* m_propertyValidator;
wxWindow* m_propertyWindow; // Usually a panel item, if anything
wxProperty(void);
wxProperty(wxProperty& copyFrom);
wxProperty(wxString name, wxString role, wxPropertyValidator *ed = NULL);
wxProperty(wxString name, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed = NULL);
~wxProperty(void);
virtual wxPropertyValue& GetValue(void) const;
virtual wxPropertyValidator *GetValidator(void) const;
virtual wxString& GetName(void) const;
virtual wxString& GetRole(void) const;
virtual void SetValue(const wxPropertyValue& val);
virtual void SetValidator(wxPropertyValidator *v);
virtual void SetName(wxString& nm);
virtual void SetRole(wxString& role);
void operator=(const wxPropertyValue& val);
virtual inline void SetWindow(wxWindow *win) { m_propertyWindow = win; }
virtual inline wxWindow *GetWindow(void) const { return m_propertyWindow; }
inline void Enable(bool en) { m_enabled = en; }
inline bool IsEnabled(void) const { return m_enabled; }
};
#endif
// wxUSE_PROPSHEET
#endif
// _WX_PROP_H_

View File

@@ -0,0 +1,338 @@
/////////////////////////////////////////////////////////////////////////////
// Name: propform.h
// Purpose: Property form classes
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PROPFORM_H_
#define _WX_PROPFORM_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "propform.h"
#endif
#include "wx/deprecated/setup.h"
#if wxUSE_PROPSHEET
#include "wx/deprecated/prop.h"
#include "wx/panel.h"
class WXDLLEXPORT wxPropertyFormView;
////
//// Property form classes: for using an existing dialog or panel
////
#define wxID_PROP_REVERT 3100
#define wxID_PROP_UPDATE 3101
// Mediates between a physical panel and the property sheet
class WXDLLEXPORT wxPropertyFormView: public wxPropertyView
{
DECLARE_DYNAMIC_CLASS(wxPropertyFormView)
public:
wxPropertyFormView(wxWindow *propPanel = NULL, long flags = 0);
~wxPropertyFormView(void);
// Associates and shows the view
virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *panel);
// Update this view of the viewed object, called e.g. by
// the object itself.
virtual bool OnUpdateView(void);
// Transfer values from property sheet to dialog
virtual bool TransferToDialog(void);
// Transfer values from dialog to property sheet
virtual bool TransferToPropertySheet(void);
// Check that all the values are valid
virtual bool Check(void);
// Give each property in the sheet a panel item, by matching
// the name of the property to the name of the panel item.
// The user doesn't always want to call this; sometimes, it
// will have been done explicitly (e.g., no matching names).
virtual bool AssociateNames(void);
void OnOk(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
void OnHelp(wxCommandEvent& event);
void OnUpdate(wxCommandEvent& event);
void OnRevert(wxCommandEvent& event);
virtual bool OnClose();
virtual void OnDoubleClick(wxControl *item);
// TODO: does OnCommand still get called...??? No,
// make ProcessEvent do it.
virtual void OnCommand(wxWindow& win, wxCommandEvent& event);
// Extend event processing to process OnCommand
virtual bool ProcessEvent(wxEvent& event);
inline virtual void AssociatePanel(wxWindow *win) { m_propertyWindow = win; }
inline virtual wxWindow *GetPanel(void) const { return m_propertyWindow; }
inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; }
inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; }
inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; }
public:
static bool sm_dialogCancelled;
protected:
bool m_detailedEditing; // E.g. using listbox for choices
wxWindow* m_propertyWindow; // Panel that the controls will appear on
wxWindow* m_managedWindow; // Frame or dialog
wxButton* m_windowCloseButton; // Or OK
wxButton* m_windowCancelButton;
wxButton* m_windowHelpButton;
DECLARE_EVENT_TABLE()
};
/*
* The type of validator used for forms (wxForm style but using an existing panel
* or dialog box).
* Classes derived from this know how to map from whatever widget they
* find themselves paired with, to the wxProperty and vice versa.
* Should the widget pointer be stored with the validator, or
* the wxProperty? If with the property, we don't have to supply
* a validator for every property. Otherwise, there ALWAYS needs
* to be a validator. On the other hand, not storing a wxWindow pointer
* in the wxProperty is more elegant. Perhaps.
* I think on balance, should put wxWindow pointer into wxProperty.
* After all, wxProperty will often be used to represent the data
* assocated with a window. It's that kinda thing.
*/
class WXDLLEXPORT wxPropertyFormValidator: public wxPropertyValidator
{
DECLARE_DYNAMIC_CLASS(wxPropertyFormValidator)
protected:
public:
wxPropertyFormValidator(long flags = 0): wxPropertyValidator(flags) { }
~wxPropertyFormValidator(void) {}
// Called to check value is OK (e.g. when OK is pressed)
// Return FALSE if value didn't check out; signal to restore old value.
virtual bool OnCheckValue( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { return TRUE; }
// Does the transferance from the property editing area to the property itself.
// Called by the view, e.g. when closing the window.
virtual bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0;
// Called by the view to transfer the property to the window.
virtual bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow) = 0;
virtual void OnDoubleClick( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { }
virtual void OnSetFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { }
virtual void OnKillFocus( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) ) { }
virtual void OnCommand( wxProperty *WXUNUSED(property), wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow), wxCommandEvent& WXUNUSED(event) ) {}
private:
// Virtual function hiding suppression
#if WXWIN_COMPATIBILITY_2
virtual void OnCommand(wxWindow& win,
wxCommandEvent& event)
{ wxEvtHandler::OnCommand(win, event); }
#endif
};
/*
* Some default validators
*/
class WXDLLEXPORT wxRealFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxRealFormValidator)
public:
// 0.0, 0.0 means no range
wxRealFormValidator(float min = 0.0, float max = 0.0, long flags = 0):wxPropertyFormValidator(flags)
{
m_realMin = min; m_realMax = max;
}
~wxRealFormValidator(void) {}
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
// Called by the view to transfer the property to the window.
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
protected:
float m_realMin;
float m_realMax;
};
class WXDLLEXPORT wxIntegerFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxIntegerFormValidator)
public:
// 0, 0 means no range
wxIntegerFormValidator(long min = 0, long max = 0, long flags = 0):wxPropertyFormValidator(flags)
{
m_integerMin = min; m_integerMax = max;
}
~wxIntegerFormValidator(void) {}
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
protected:
long m_integerMin;
long m_integerMax;
};
class WXDLLEXPORT wxBoolFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxBoolFormValidator)
protected:
public:
wxBoolFormValidator(long flags = 0):wxPropertyFormValidator(flags)
{
}
~wxBoolFormValidator(void) {}
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
};
class WXDLLEXPORT wxStringFormValidator: public wxPropertyFormValidator
{
DECLARE_DYNAMIC_CLASS(wxStringFormValidator)
public:
wxStringFormValidator(wxStringList *list = NULL, long flags = 0);
~wxStringFormValidator(void)
{
if (m_strings)
delete m_strings;
}
bool OnCheckValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyFormView *view, wxWindow *parentWindow);
protected:
wxStringList* m_strings;
};
/*
* A default dialog box class to use.
*/
class WXDLLEXPORT wxPropertyFormDialog: public wxDialog
{
public:
wxPropertyFormDialog(wxPropertyFormView *v = NULL,
wxWindow *parent = NULL,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = _T("dialogBox"));
void OnCloseWindow(wxCloseEvent& event);
void OnDefaultAction(wxControl *item);
void OnCommand(wxWindow& win, wxCommandEvent& event);
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
private:
wxPropertyFormView* m_view;
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxPropertyFormDialog)
};
/*
* A default panel class to use.
*/
class WXDLLEXPORT wxPropertyFormPanel: public wxPanel
{
public:
wxPropertyFormPanel(wxPropertyFormView *v = NULL,
wxWindow *parent = NULL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = _T("panel"))
: wxPanel(parent, -1, pos, size, style, name)
{
m_view = v;
}
void OnDefaultAction(wxControl *item);
void OnCommand(wxWindow& win, wxCommandEvent& event);
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
void SetView(wxPropertyFormView* view) { m_view = view; }
wxPropertyFormView* GetView() const { return m_view; }
private:
wxPropertyFormView* m_view;
DECLARE_CLASS(wxPropertyFormPanel)
};
/*
* A default frame class to use.
*/
class WXDLLEXPORT wxPropertyFormFrame: public wxFrame
{
public:
wxPropertyFormFrame(wxPropertyFormView *v = NULL,
wxFrame *parent = NULL,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = _T("frame"))
: wxFrame(parent, -1, title, pos, size, style, name)
{
m_view = v;
m_propertyPanel = NULL;
}
void OnCloseWindow(wxCloseEvent& event);
// Must call this to create panel and associate view
virtual bool Initialize(void);
virtual wxPanel *OnCreatePanel(wxFrame *parent, wxPropertyFormView *v);
inline virtual wxPanel *GetPropertyPanel(void) const { return m_propertyPanel; }
private:
wxPropertyFormView* m_view;
wxPanel* m_propertyPanel;
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxPropertyFormFrame)
};
#endif
// wxUSE_PROPSHEET
#endif
// _WX_PROPFORM_H_

View File

@@ -0,0 +1,597 @@
/////////////////////////////////////////////////////////////////////////////
// Name: proplist.h
// Purpose: Property list classes
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/*
TO DO:
(1) Optional popup-help for each item, and an optional Help button
for dialog.
(2) Align Ok, Cancel, Help buttons properly.
(3) Consider retrieving the rectangle on the panel that can be
drawn into (where the value listbox is) and giving an example
of editing graphically. May be too fancy.
(4) Deriveable types for wxPropertyValue => may need to reorganise
wxPropertyValue to use inheritance rather than present all-types-in-one
scheme.
(5) Optional popup panel for value list, perhaps.
(6) Floating point checking routine still crashes with Floating
point error for zany input.
(7) Property sheet with choice (or listbox) to select alternative
sheets... multiple views per panel, only one active. For this
we really need a wxChoice that can be dynamically set: XView
may be a problem; Motif?
(8) More example validators, e.g. colour selector.
*/
#ifndef _WX_PROPLIST_H_
#define _WX_PROPLIST_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "proplist.h"
#endif
#include "wx/deprecated/setup.h"
#if wxUSE_PROPSHEET
#include "wx/deprecated/prop.h"
#include "wx/panel.h"
#define wxPROP_BUTTON_CLOSE 1
#define wxPROP_BUTTON_OK 2
#define wxPROP_BUTTON_CANCEL 4
#define wxPROP_BUTTON_CHECK_CROSS 8
#define wxPROP_BUTTON_HELP 16
#define wxPROP_DYNAMIC_VALUE_FIELD 32
#define wxPROP_PULLDOWN 64
#define wxPROP_SHOWVALUES 128
// Show OK/Cancel buttons on X-based systems where window management is
// more awkward
#if defined(__WXMOTIF__) || defined(__WXGTK__)
#define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN
#else
#define wxPROP_BUTTON_DEFAULT wxPROP_BUTTON_CHECK_CROSS | wxPROP_PULLDOWN | wxPROP_SHOWVALUES
#endif
#define wxID_PROP_CROSS 3000
#define wxID_PROP_CHECK 3001
#define wxID_PROP_EDIT 3002
#define wxID_PROP_TEXT 3003
#define wxID_PROP_SELECT 3004
#define wxID_PROP_VALUE_SELECT 3005
// Mediates between a physical panel and the property sheet
class WXDLLEXPORT wxPropertyListView: public wxPropertyView
{
public:
wxPropertyListView(wxPanel *propPanel = NULL, long flags = wxPROP_BUTTON_DEFAULT);
~wxPropertyListView(void);
// Associates and shows the view
virtual void ShowView(wxPropertySheet *propertySheet, wxPanel *panel);
// Update this view of the viewed object, called e.g. by
// the object itself.
virtual bool OnUpdateView(void);
wxString MakeNameValueString(wxString name, wxString value);
// Update a single line in the list of properties
virtual bool UpdatePropertyDisplayInList(wxProperty *property);
// Update the whole list
virtual bool UpdatePropertyList(bool clearEditArea = TRUE);
// Find the wxListBox index corresponding to this property
virtual int FindListIndexForProperty(wxProperty *property);
// Select and show string representation in editor the given
// property. NULL resets to show no property.
virtual bool ShowProperty(wxProperty *property, bool select = TRUE);
virtual bool EditProperty(wxProperty *property);
// Update the display from the property
virtual bool DisplayProperty(wxProperty *property);
// Update the property from the display
virtual bool RetrieveProperty(wxProperty *property);
// Find appropriate validator and load property into value controls
virtual bool BeginShowingProperty(wxProperty *property);
// Find appropriate validator and unload property from value controls
virtual bool EndShowingProperty(wxProperty *property);
// Begin detailed editing (e.g. using value listbox)
virtual void BeginDetailedEditing(void);
// End detailed editing (e.g. using value listbox)
virtual void EndDetailedEditing(void);
// Called by the property listbox
void OnPropertySelect(wxCommandEvent& event);
// Called by the value listbox
void OnValueListSelect(wxCommandEvent& event);
virtual bool CreateControls(void);
virtual void ShowTextControl(bool show);
virtual void ShowListBoxControl(bool show);
virtual void EnableCheck(bool show);
virtual void EnableCross(bool show);
void OnOk(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
void OnHelp(wxCommandEvent& event);
void OnPropertyDoubleClick(wxCommandEvent& event);
// virtual void OnDoubleClick(void);
void OnCheck(wxCommandEvent& event);
void OnCross(wxCommandEvent& event);
void OnEdit(wxCommandEvent& event);
void OnText(wxCommandEvent& event);
inline virtual wxListBox *GetPropertyScrollingList() const { return m_propertyScrollingList; }
inline virtual wxListBox *GetValueList() const { return m_valueList; }
inline virtual wxTextCtrl *GetValueText() const { return m_valueText; }
inline virtual wxButton *GetConfirmButton() const { return m_confirmButton; }
inline virtual wxButton *GetCancelButton() const { return m_cancelButton; }
inline virtual wxButton *GetEditButton() const { return m_editButton; }
inline virtual bool GetDetailedEditing(void) const { return m_detailedEditing; }
inline virtual void AssociatePanel(wxPanel *win) { m_propertyWindow = win; }
inline virtual wxPanel *GetPanel(void) const { return m_propertyWindow; }
inline virtual void SetManagedWindow(wxWindow *win) { m_managedWindow = win; }
inline virtual wxWindow *GetManagedWindow(void) const { return m_managedWindow; }
inline virtual wxButton *GetWindowCloseButton() const { return m_windowCloseButton; }
inline virtual wxButton *GetWindowCancelButton() const { return m_windowCancelButton; }
inline virtual wxButton *GetHelpButton() const { return m_windowHelpButton; }
bool OnClose(void);
public:
static bool sm_dialogCancelled;
protected:
wxListBox* m_propertyScrollingList;
wxListBox* m_valueList; // Should really be a combobox, but we don't have one.
wxTextCtrl* m_valueText;
wxButton* m_confirmButton; // A tick, as in VB
wxButton* m_cancelButton; // A cross, as in VB
wxButton* m_editButton; // Invokes the custom validator, if any
wxSizer* m_middleSizer;
bool m_detailedEditing; // E.g. using listbox for choices
wxPanel* m_propertyWindow; // Panel that the controls will appear on
wxWindow* m_managedWindow; // Frame or dialog
wxButton* m_windowCloseButton; // Or OK
wxButton* m_windowCancelButton;
wxButton* m_windowHelpButton;
private:
DECLARE_DYNAMIC_CLASS(wxPropertyListView)
DECLARE_EVENT_TABLE()
virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *window)
{ wxPropertyView::ShowView(propertySheet, window); };
};
class WXDLLEXPORT wxPropertyTextEdit: public wxTextCtrl
{
public:
wxPropertyTextEdit(wxPropertyListView *v = NULL,
wxWindow *parent = NULL,
const wxWindowID id = -1,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxT("text"));
void OnSetFocus();
void OnKillFocus();
wxPropertyListView* m_view;
private:
DECLARE_CLASS(wxPropertyTextEdit)
};
#define wxPROP_ALLOW_TEXT_EDITING 1
/*
* The type of validator used for property lists (Visual Basic style)
*/
class WXDLLEXPORT wxPropertyListValidator: public wxPropertyValidator
{
public:
wxPropertyListValidator(long flags = wxPROP_ALLOW_TEXT_EDITING): wxPropertyValidator(flags) { }
~wxPropertyListValidator() {}
// Called when the property is selected or deselected: typically displays the value
// in the edit control (having chosen a suitable control to display: (non)editable text or listbox)
virtual bool OnSelect(bool select, wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is double clicked. Extra functionality can be provided, such as
// cycling through possible values.
inline virtual bool OnDoubleClick(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
// Called when the value listbox is selected. Default behaviour is to copy
// string to text control, and retrieve the value into the property.
virtual bool OnValueListSelect(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property value is edited using standard text control
inline virtual bool OnPrepareControls(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
virtual bool OnClearControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is edited in detail
inline virtual bool OnPrepareDetailControls(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
// Called if focus lost, IF we're in a modeless property editing situation.
inline virtual bool OnClearDetailControls(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
// Called when the edit (...) button is pressed. The default implementation
// calls view->BeginDetailedEditing; the filename validator (for example) overrides
// this function to show the file selector.
virtual void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
inline virtual bool OnCheckValue(
wxProperty *WXUNUSED(property), wxPropertyListView *WXUNUSED(view), wxWindow *WXUNUSED(parentWindow) )
{ return TRUE; }
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transferance from the property editing area to the property itself
virtual bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
virtual bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
private:
DECLARE_DYNAMIC_CLASS(wxPropertyListValidator)
};
/*
* A default dialog box class to use.
*/
class WXDLLEXPORT wxPropertyListDialog: public wxDialog
{
public:
wxPropertyListDialog(wxPropertyListView *v = NULL,
wxWindow *parent = NULL,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = wxT("dialogBox"));
void OnCloseWindow(wxCloseEvent& event);
void OnDefaultAction(wxControl *item);
void OnCancel(wxCommandEvent& event);
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
private:
wxPropertyListView* m_view;
private:
DECLARE_CLASS(wxPropertyListDialog)
DECLARE_EVENT_TABLE()
};
/*
* A default panel class to use.
*/
class WXDLLEXPORT wxPropertyListPanel: public wxPanel
{
public:
wxPropertyListPanel(wxPropertyListView *v = NULL,
wxWindow *parent = NULL,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxT("panel"))
: wxPanel(parent, -1, pos, size, style, name)
{
m_view = v;
}
~wxPropertyListPanel();
void OnDefaultAction(wxControl *item);
inline void SetView(wxPropertyListView* v) { m_view = v; }
inline wxPropertyListView* GetView() const { return m_view; }
// Extend event processing to search the view's event table
virtual bool ProcessEvent(wxEvent& event);
// Call Layout()
void OnSize(wxSizeEvent& event);
private:
wxPropertyListView* m_view;
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxPropertyListPanel)
};
/*
* A default frame class to use.
*/
class WXDLLEXPORT wxPropertyListFrame: public wxFrame
{
public:
wxPropertyListFrame(wxPropertyListView *v = NULL,
wxFrame *parent = NULL,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = _T("frame"))
: wxFrame(parent, -1, title, pos, size, style, name)
{
m_view = v;
m_propertyPanel = NULL;
}
void OnCloseWindow(wxCloseEvent& event);
// Must call this to create panel and associate view
virtual bool Initialize(void);
virtual wxPropertyListPanel *OnCreatePanel(wxFrame *parent, wxPropertyListView *v);
inline virtual wxPropertyListPanel *GetPropertyPanel(void) const { return m_propertyPanel; }
inline wxPropertyListView* GetView() const { return m_view; }
private:
wxPropertyListView* m_view;
wxPropertyListPanel* m_propertyPanel;
private:
DECLARE_EVENT_TABLE()
DECLARE_CLASS(wxPropertyListFrame)
};
/*
* Some default validators
*/
class WXDLLEXPORT wxRealListValidator: public wxPropertyListValidator
{
public:
// 0.0, 0.0 means no range
wxRealListValidator(float min = 0.0, float max = 0.0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags)
{ m_realMin = min; m_realMax = max; }
~wxRealListValidator() {}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
float m_realMin;
float m_realMax;
private:
DECLARE_DYNAMIC_CLASS(wxRealListValidator)
};
class WXDLLEXPORT wxIntegerListValidator: public wxPropertyListValidator
{
public:
// 0, 0 means no range
wxIntegerListValidator(long min = 0, long max = 0, long flags = wxPROP_ALLOW_TEXT_EDITING):wxPropertyListValidator(flags)
{
m_integerMin = min; m_integerMax = max;
}
~wxIntegerListValidator() {}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
long m_integerMin;
long m_integerMax;
private:
DECLARE_DYNAMIC_CLASS(wxIntegerListValidator)
};
class WXDLLEXPORT wxBoolListValidator: public wxPropertyListValidator
{
public:
wxBoolListValidator(long flags = 0):wxPropertyListValidator(flags) {}
~wxBoolListValidator() {}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is double clicked. Extra functionality can be provided,
// cycling through possible values.
virtual bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
private:
DECLARE_DYNAMIC_CLASS(wxBoolListValidator)
};
class WXDLLEXPORT wxStringListValidator: public wxPropertyListValidator
{
public:
wxStringListValidator(wxStringList *list = NULL, long flags = 0);
~wxStringListValidator()
{
if (m_strings)
delete m_strings;
}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnPrepareDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnClearDetailControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is double clicked. Extra functionality can be provided,
// cycling through possible values.
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
wxStringList* m_strings;
private:
DECLARE_DYNAMIC_CLASS(wxStringListValidator)
};
class WXDLLEXPORT wxFilenameListValidator: public wxPropertyListValidator
{
public:
wxFilenameListValidator(wxString message = wxT("Select a file"), wxString wildcard = wxALL_FILES_PATTERN, long flags = 0);
~wxFilenameListValidator();
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transferance from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
protected:
wxString m_filenameWildCard;
wxString m_filenameMessage;
private:
DECLARE_DYNAMIC_CLASS(wxFilenameListValidator)
};
class WXDLLEXPORT wxColourListValidator: public wxPropertyListValidator
{
public:
wxColourListValidator(long flags = 0);
~wxColourListValidator();
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
private:
DECLARE_DYNAMIC_CLASS(wxColourListValidator)
};
class WXDLLEXPORT wxListOfStringsListValidator: public wxPropertyListValidator
{
public:
wxListOfStringsListValidator(long flags = 0);
~wxListOfStringsListValidator() {}
bool OnPrepareControls(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost.
// Return FALSE if value didn't check out; signal to restore old value.
bool OnCheckValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when TICK is pressed or focus is lost or view wants to update
// the property list.
// Does the transfer from the property editing area to the property itself
bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
// Called when the property is double clicked.
bool OnDoubleClick(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
bool EditStringList(wxWindow *parent, wxStringList *stringList, const wxChar *title = wxT("String List Editor"));
// Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
private:
DECLARE_DYNAMIC_CLASS(wxListOfStringsListValidator)
};
#endif
// wxUSE_PROPSHEET
#endif
// _WX_PROPLIST_H_

View File

@@ -0,0 +1,209 @@
/////////////////////////////////////////////////////////////////////////////
// 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"
#include "wx/deprecated/setup.h"
#if wxUSE_WX_RESOURCES
#include "wx/bitmap.h"
#include <stdio.h>
// 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__

View File

@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/deprecated/setup.h
// Purpose: Configuration for deprecated features of the library
// Author: Julian Smart
// Modified by:
// Created: 2003-03-30
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DEPRECATED_SETUP_H_
#define _WX_DEPRECATED_SETUP_H_
// wxUSE_TIMEDATE enables compilation of the old wxDate and wxTime classes (not
// the same as wxDateTime!). These classes are obsolete and shouldn't be used
// in new code
//
// Default is 0
//
// Recommended setting: 0 unless you have legacy code which uses these classes
#define wxUSE_TIMEDATE 0
// wxProperty[Value/Form/List] classes, used by Dialog Editor
#define wxUSE_PROPSHEET 1
// wxTreeLayout class
#define wxUSE_TREELAYOUT 1
// use wxExpr (a.k.a. PrologIO)
#define wxUSE_PROLOGIO 1
// Use .wxr resource mechanism (requires PrologIO library)
#define wxUSE_WX_RESOURCES 1
#endif
// _WX_DEPRECATED_SETUP_H_

View File

@@ -0,0 +1,155 @@
///////////////////////////////////////////////////////////////////////////////
// Name: treelay.h
// Purpose: wxTreeLayout class
// Author: Julian Smart
// Modified by:
// Created: 7/4/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_TREELAY_H_
#define _WX_TREELAY_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "wxtree.h"
#endif
#ifndef WX_PRECOMP
#include "wx/object.h"
class wxList;
class wxDC;
class wxMouseEvent;
#endif
#include "wx/deprecated/setup.h"
#include "wx/string.h"
#if wxUSE_TREELAYOUT
class WXDLLEXPORT wxTreeLayout: public wxObject
{
public:
wxTreeLayout();
virtual ~wxTreeLayout() { }
// Redefine these
virtual void GetChildren(long id, wxList& list) = 0;
virtual long GetNextNode(long id) = 0;
virtual long GetNodeParent(long id) = 0;
virtual long GetNodeX(long id) = 0;
virtual long GetNodeY(long id) = 0;
virtual void SetNodeX(long id, long x) = 0;
virtual void SetNodeY(long id, long y) = 0;
virtual void ActivateNode(long id, bool active) = 0;
virtual bool NodeActive(long id) = 0;
// Optional redefinition
void Initialize(void);
inline virtual void SetNodeName(long WXUNUSED(id), const wxString& WXUNUSED(name)) {}
inline virtual wxString GetNodeName(long WXUNUSED(id)) { return wxString(wxT("")); }
virtual void GetNodeSize(long id, long *x, long *y, wxDC& dc);
virtual void Draw(wxDC& dc);
virtual void DrawNodes(wxDC& dc);
virtual void DrawBranches(wxDC& dc);
virtual void DrawNode(long id, wxDC& dc);
virtual void DrawBranch(long from, long to, wxDC& dc);
// Don't redefine
virtual void DoLayout(wxDC& dc, long topNode = -1);
// Accessors -- don't redefine
inline void SetTopNode(long id) { m_parentNode = id; }
inline long GetTopNode(void) const { return m_parentNode; }
inline void SetSpacing(long x, long y) { m_xSpacing = x; m_ySpacing = y; }
inline long GetXSpacing(void) const { return m_xSpacing; }
inline long GetYSpacing(void) const { return m_ySpacing; }
inline void SetMargins(long x, long y) { m_leftMargin = x; m_topMargin = y; }
inline long GetTopMargin(void) const { return m_topMargin; }
inline long GetLeftMargin(void) const { return m_leftMargin; }
inline bool GetOrientation(void) const { return m_orientation; }
inline void SetOrientation(bool orient) { m_orientation = orient; }
private:
void CalcLayout(long node_id, int level, wxDC& dc);
protected:
long m_parentNode;
long m_lastY;
long m_lastX;
long m_xSpacing;
long m_ySpacing;
long m_topMargin;
long m_leftMargin;
bool m_orientation; // TRUE for top-to-bottom, FALSE for left-to-right
private:
DECLARE_ABSTRACT_CLASS(wxTreeLayout)
};
class WXDLLEXPORT wxStoredNode
{
public:
wxString m_name;
long m_x, m_y;
long m_parentId;
bool m_active;
long m_clientData;
};
/*
* A version of wxTreeLayout with storage for nodes
*/
class WXDLLEXPORT wxTreeLayoutStored: public wxTreeLayout
{
public:
wxTreeLayoutStored(int noNodes = 200);
virtual ~wxTreeLayoutStored(void);
void Initialize(int n);
wxString HitTest(wxMouseEvent& event, wxDC& dc);
wxStoredNode* GetNode(long id) const;
inline int GetNumNodes() const { return m_maxNodes; };
inline int GetNodeCount() const { return m_num; };
virtual void GetChildren(long id, wxList& list);
virtual long GetNextNode(long id);
virtual long GetNodeParent(long id);
virtual long GetNodeX(long id);
virtual long GetNodeY(long id);
virtual void SetNodeX(long id, long x);
virtual void SetNodeY(long id, long y);
virtual void SetNodeName(long id, const wxString& name);
virtual wxString GetNodeName(long id);
virtual void ActivateNode(long id, bool active);
virtual bool NodeActive(long id);
virtual void SetClientData(long id, long clientData);
virtual long GetClientData(long id) const;
virtual long AddChild(const wxString& name, const wxString& parent = wxT(""));
virtual long AddChild(const wxString& name, long parent);
virtual long NameToId(const wxString& name);
// Data members
private:
wxStoredNode* m_nodes;
int m_num;
int m_maxNodes;
private:
DECLARE_DYNAMIC_CLASS(wxTreeLayoutStored)
DECLARE_NO_COPY_CLASS(wxTreeLayoutStored)
};
// For backward compatibility
#define wxStoredTree wxTreeLayoutStored
#endif
// wxUSE_TREELAYOUT
#endif
// _WX_TREELAY_H_

View File

@@ -0,0 +1,285 @@
/////////////////////////////////////////////////////////////////////////////
// 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
#include "wx/deprecated/setup.h"
#if wxUSE_PROLOGIO
#include "wx/defs.h"
#include "wx/string.h"
#include "wx/list.h"
#include "wx/hash.h"
#include "wx/deprecated/expr.h"
#include <stdio.h>
// 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__

View File

@@ -0,0 +1,26 @@
# $Id$
top_srcdir = @top_srcdir@/..
top_builddir = ../../..
libsrc_dir = contrib/src/deprecated
TARGET_LIBNAME=lib@WX_LIBRARY_BASENAME@_deprecated-@WX_RELEASE@
LIBVERSION_CURRENT=@WX_CURRENT@
LIBVERSION_REVISION=@WX_REVISION@
LIBVERSION_AGE=@WX_AGE@
HEADER_PATH=$(top_srcdir)/contrib/include/wx
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 y_tab.o treelay.cpp
DEPFILES=$(OBJECTS:.o=.d)
APPEXTRADEFS=-I$(top_srcdir)/contrib/include
include $(top_builddir)/src/makelib.env
-include $(DEPFILES)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,540 @@
/* 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 <io.h>
#endif
#include "wx/deprecated/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 */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,192 @@
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 <string.h>
#include <unistd.h>
/* +++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/deprecated/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
}

View File

@@ -0,0 +1,17 @@
#
# File: makefile.b32
# Author: Julian Smart
# Created: 1999
# Updated:
# Copyright:
#
# Makefile : Builds Deprecated library for 32-bit BC++
WXDIR = $(WXWIN)
LIBTARGET=$(WXDIR)\lib\wxdeprecated.lib
OBJECTS = prop.obj propform.obj proplist.obj y_tab.obj resource.obj treelay.obj
!include $(WXDIR)\src\makelib.b32

View File

@@ -0,0 +1,16 @@
#
# File: makefile.g95
# Author: Julian Smart
# Created: 1999
# Updated:
# Copyright: (c) Julian Smart, 1999
#
# Makefile for wxWindows Deprecated Features library (Cygwin/Mingw32).
WXDIR = ../../..
LIBTARGET=$(WXDIR)/lib/libwxdeprecated.a
OBJECTS = prop.o propform.o proplist.o y_tab.o resource.o treelay.o
include $(WXDIR)/src/makelib.g95

View File

@@ -0,0 +1,38 @@
# File: makefile.vc
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright:
#
# "%W% %G%"
#
# Makefile : Builds Deprecated Features classes library (MS VC++).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
# Set WXDIR for your system
WXDIR = $(WXWIN)
THISDIR = $(WXDIR)\contrib\src\deprecated
!if "$(RM)" == ""
RM= erase
!endif
NOPCH=1
# Unfortunately we need this _before_ we include makelib.vc
!if "$(FINAL)" == "1"
D=Release
!else
D=Debug
LIBEXT=d
!endif
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
!include $(WXDIR)\src\makelib.vc

View File

@@ -0,0 +1,184 @@
/* Version: $Id$ */
%{
#include "wx/setup.h"
#include <string.h>
#ifdef _MSC_VER
#include <io.h>
#endif
#if defined(__GNUWIN32__) && !defined(__TWIN32__)
#include <sys/unistd.h>
#endif
#include "wx/deprecated/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 <s> INTEGER 1
%token <s> WORD 2
%token <s> STRING 3
%token <s> 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 <expr> command expr arglist arg arg1 */
%type <s> 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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,763 @@
/////////////////////////////////////////////////////////////////////////////
// Name: propform.cpp
// Purpose: Property form classes
// Author: Julian Smart
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "propform.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/deprecated/setup.h"
#if wxUSE_PROPSHEET
#ifndef WX_PRECOMP
#include "wx/choice.h"
#include "wx/checkbox.h"
#include "wx/slider.h"
#include "wx/msgdlg.h"
#endif
#include "wx/deprecated/propform.h"
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
/*
* Property view
*/
IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormView, wxPropertyView)
BEGIN_EVENT_TABLE(wxPropertyFormView, wxPropertyView)
EVT_BUTTON(wxID_OK, wxPropertyFormView::OnOk)
EVT_BUTTON(wxID_CANCEL, wxPropertyFormView::OnCancel)
EVT_BUTTON(wxID_HELP, wxPropertyFormView::OnHelp)
EVT_BUTTON(wxID_PROP_REVERT, wxPropertyFormView::OnRevert)
EVT_BUTTON(wxID_PROP_UPDATE, wxPropertyFormView::OnUpdate)
END_EVENT_TABLE()
bool wxPropertyFormView::sm_dialogCancelled = FALSE;
wxPropertyFormView::wxPropertyFormView(wxWindow *propPanel, long flags):wxPropertyView(flags)
{
m_propertyWindow = propPanel;
m_managedWindow = NULL;
m_windowCloseButton = NULL;
m_windowCancelButton = NULL;
m_windowHelpButton = NULL;
m_detailedEditing = FALSE;
}
wxPropertyFormView::~wxPropertyFormView(void)
{
}
void wxPropertyFormView::ShowView(wxPropertySheet *ps, wxWindow *panel)
{
m_propertySheet = ps;
AssociatePanel(panel);
// CreateControls();
// UpdatePropertyList();
}
// Update this view of the viewed object, called e.g. by
// the object itself.
bool wxPropertyFormView::OnUpdateView(void)
{
return TRUE;
}
bool wxPropertyFormView::Check(void)
{
if (!m_propertySheet)
return FALSE;
wxNode *node = m_propertySheet->GetProperties().GetFirst();
while (node)
{
wxProperty *prop = (wxProperty *)node->GetData();
wxPropertyValidator *validator = FindPropertyValidator(prop);
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
if (!formValidator->OnCheckValue(prop, this, m_propertyWindow))
return FALSE;
}
node = node->GetNext();
}
return TRUE;
}
bool wxPropertyFormView::TransferToPropertySheet(void)
{
if (!m_propertySheet)
return FALSE;
wxNode *node = m_propertySheet->GetProperties().GetFirst();
while (node)
{
wxProperty *prop = (wxProperty *)node->GetData();
wxPropertyValidator *validator = FindPropertyValidator(prop);
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnRetrieveValue(prop, this, m_propertyWindow);
}
node = node->GetNext();
}
return TRUE;
}
bool wxPropertyFormView::TransferToDialog(void)
{
if (!m_propertySheet)
return FALSE;
wxNode *node = m_propertySheet->GetProperties().GetFirst();
while (node)
{
wxProperty *prop = (wxProperty *)node->GetData();
wxPropertyValidator *validator = FindPropertyValidator(prop);
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnDisplayValue(prop, this, m_propertyWindow);
}
node = node->GetNext();
}
return TRUE;
}
bool wxPropertyFormView::AssociateNames(void)
{
if (!m_propertySheet || !m_propertyWindow)
return FALSE;
wxWindowList::Node *node = m_propertyWindow->GetChildren().GetFirst();
while (node)
{
wxWindow *win = node->GetData();
if ( win->GetName() != wxEmptyString )
{
wxProperty *prop = m_propertySheet->GetProperty(win->GetName());
if (prop)
prop->SetWindow(win);
}
node = node->GetNext();
}
return TRUE;
}
bool wxPropertyFormView::OnClose(void)
{
if (m_propertyWindow->IsKindOf(CLASSINFO(wxPropertyFormPanel)))
{
((wxPropertyFormPanel*)m_propertyWindow)->SetView(NULL);
}
delete this;
return TRUE;
}
void wxPropertyFormView::OnOk(wxCommandEvent& WXUNUSED(event))
{
// Retrieve the value if any
if (!Check())
return;
sm_dialogCancelled = FALSE;
TransferToPropertySheet();
m_managedWindow->Close(TRUE);
}
void wxPropertyFormView::OnCancel(wxCommandEvent& WXUNUSED(event))
{
sm_dialogCancelled = TRUE;
m_managedWindow->Close(TRUE);
}
void wxPropertyFormView::OnHelp(wxCommandEvent& WXUNUSED(event))
{
}
void wxPropertyFormView::OnUpdate(wxCommandEvent& WXUNUSED(event))
{
if (Check())
TransferToPropertySheet();
}
void wxPropertyFormView::OnRevert(wxCommandEvent& WXUNUSED(event))
{
TransferToDialog();
}
void wxPropertyFormView::OnCommand(wxWindow& win, wxCommandEvent& event)
{
if (!m_propertySheet)
return;
if (win.GetName() == wxT(""))
return;
if (wxStrcmp(win.GetName(), wxT("ok")) == 0)
OnOk(event);
else if (wxStrcmp(win.GetName(), wxT("cancel")) == 0)
OnCancel(event);
else if (wxStrcmp(win.GetName(), wxT("help")) == 0)
OnHelp(event);
else if (wxStrcmp(win.GetName(), wxT("update")) == 0)
OnUpdate(event);
else if (wxStrcmp(win.GetName(), wxT("revert")) == 0)
OnRevert(event);
else
{
// Find a validator to route the command to.
wxNode *node = m_propertySheet->GetProperties().GetFirst();
while (node)
{
wxProperty *prop = (wxProperty *)node->GetData();
if (prop->GetWindow() && (prop->GetWindow() == &win))
{
wxPropertyValidator *validator = FindPropertyValidator(prop);
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnCommand(prop, this, m_propertyWindow, event);
return;
}
}
node = node->GetNext();
}
}
}
// Extend event processing to call OnCommand
bool wxPropertyFormView::ProcessEvent(wxEvent& event)
{
if (wxEvtHandler::ProcessEvent(event))
return TRUE;
else if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxUpdateUIEvent)) && event.GetEventObject())
{
OnCommand(* ((wxWindow*) event.GetEventObject()), (wxCommandEvent&) event);
return TRUE;
}
else
return FALSE;
}
void wxPropertyFormView::OnDoubleClick(wxControl *item)
{
if (!m_propertySheet)
return;
// Find a validator to route the command to.
wxNode *node = m_propertySheet->GetProperties().GetFirst();
while (node)
{
wxProperty *prop = (wxProperty *)node->GetData();
if (prop->GetWindow() && ((wxControl *)prop->GetWindow() == item))
{
wxPropertyValidator *validator = FindPropertyValidator(prop);
if (validator && validator->IsKindOf(CLASSINFO(wxPropertyFormValidator)))
{
wxPropertyFormValidator *formValidator = (wxPropertyFormValidator *)validator;
formValidator->OnDoubleClick(prop, this, m_propertyWindow);
return;
}
}
node = node->GetNext();
}
}
/*
* Property form dialog box
*/
IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormDialog, wxDialog)
BEGIN_EVENT_TABLE(wxPropertyFormDialog, wxDialog)
EVT_CLOSE(wxPropertyFormDialog::OnCloseWindow)
END_EVENT_TABLE()
wxPropertyFormDialog::wxPropertyFormDialog(wxPropertyFormView *v, wxWindow *parent, const wxString& title,
const wxPoint& pos, const wxSize& size, long style, const wxString& name):
wxDialog(parent, -1, title, pos, size, style, name)
{
m_view = v;
m_view->AssociatePanel(this);
m_view->SetManagedWindow(this);
// SetAutoLayout(TRUE);
}
void wxPropertyFormDialog::OnCloseWindow(wxCloseEvent& event)
{
if (m_view)
{
m_view->OnClose();
m_view = NULL;
this->Destroy();
}
else
event.Veto();
}
void wxPropertyFormDialog::OnDefaultAction(wxControl *item)
{
m_view->OnDoubleClick(item);
}
void wxPropertyFormDialog::OnCommand(wxWindow& win, wxCommandEvent& event)
{
if ( m_view )
m_view->OnCommand(win, event);
}
// Extend event processing to search the view's event table
bool wxPropertyFormDialog::ProcessEvent(wxEvent& event)
{
if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
}
/*
* Property form panel
*/
IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormPanel, wxPanel)
void wxPropertyFormPanel::OnDefaultAction(wxControl *item)
{
m_view->OnDoubleClick(item);
}
void wxPropertyFormPanel::OnCommand(wxWindow& win, wxCommandEvent& event)
{
m_view->OnCommand(win, event);
}
// Extend event processing to search the view's event table
bool wxPropertyFormPanel::ProcessEvent(wxEvent& event)
{
if ( !m_view || ! m_view->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
}
/*
* Property frame
*/
IMPLEMENT_DYNAMIC_CLASS(wxPropertyFormFrame, wxFrame)
BEGIN_EVENT_TABLE(wxPropertyFormFrame, wxFrame)
EVT_CLOSE(wxPropertyFormFrame::OnCloseWindow)
END_EVENT_TABLE()
void wxPropertyFormFrame::OnCloseWindow(wxCloseEvent& event)
{
if (m_view && m_view->OnClose())
this->Destroy();
else
event.Veto();
}
wxPanel *wxPropertyFormFrame::OnCreatePanel(wxFrame *parent, wxPropertyFormView *v)
{
return new wxPropertyFormPanel(v, parent);
}
bool wxPropertyFormFrame::Initialize(void)
{
m_propertyPanel = OnCreatePanel(this, m_view);
if (m_propertyPanel)
{
m_view->AssociatePanel(m_propertyPanel);
m_view->SetManagedWindow(this);
return TRUE;
}
else
return FALSE;
}
/*
* Property form specific validator
*/
IMPLEMENT_ABSTRACT_CLASS(wxPropertyFormValidator, wxPropertyValidator)
/*
* Default validators
*/
IMPLEMENT_DYNAMIC_CLASS(wxRealFormValidator, wxPropertyFormValidator)
///
/// Real number form validator
///
bool wxRealFormValidator::OnCheckValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow)
{
if (m_realMin == 0.0 && m_realMax == 0.0)
return TRUE;
// The item used for viewing the real number: should be a text item.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
float val = 0.0;
if (!StringToFloat(WXSTRINGCAST value, &val))
{
wxChar buf[200];
wxSprintf(buf, wxT("Value %s is not a valid real number!"), (const wxChar *)value);
wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
if (val < m_realMin || val > m_realMax)
{
wxChar buf[200];
wxSprintf(buf, wxT("Value must be a real number between %.2f and %.2f!"), m_realMin, m_realMax);
wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
return TRUE;
}
bool wxRealFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the real number: should be a text item.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (value.Length() == 0)
return FALSE;
float f = (float)wxAtof((const wxChar *)value);
property->GetValue() = f;
return TRUE;
}
bool wxRealFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the real number: should be a text item.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
return FALSE;
wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
textItem->SetValue(FloatToString(property->GetValue().RealValue()));
return TRUE;
}
///
/// Integer validator
///
IMPLEMENT_DYNAMIC_CLASS(wxIntegerFormValidator, wxPropertyFormValidator)
bool wxIntegerFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow)
{
if (m_integerMin == 0.0 && m_integerMax == 0.0)
return TRUE;
// The item used for viewing the real number: should be a text item or a slider
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
long val = 0;
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (!StringToLong(WXSTRINGCAST value, &val))
{
wxChar buf[200];
wxSprintf(buf, wxT("Value %s is not a valid integer!"), (const wxChar *)value);
wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
}
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
{
val = (long)((wxSlider *)m_propertyWindow)->GetValue();
}
else
return FALSE;
if (val < m_integerMin || val > m_integerMax)
{
wxChar buf[200];
wxSprintf(buf, wxT("Value must be an integer between %ld and %ld!"), m_integerMin, m_integerMax);
wxMessageBox(buf, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
return TRUE;
}
bool wxIntegerFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the real number: should be a text item or a slider
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxString value(((wxTextCtrl *)m_propertyWindow)->GetValue());
if (value.Length() == 0)
return FALSE;
long i = wxAtol((const wxChar *)value);
property->GetValue() = i;
}
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
{
property->GetValue() = (long)((wxSlider *)m_propertyWindow)->GetValue();
}
else
return FALSE;
return TRUE;
}
bool wxIntegerFormValidator::OnDisplayValue( wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the real number: should be a text item or a slider
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *textItem = (wxTextCtrl *)m_propertyWindow;
textItem->SetValue(LongToString(property->GetValue().IntegerValue()));
}
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxSlider)))
{
((wxSlider *)m_propertyWindow)->SetValue((int)property->GetValue().IntegerValue());
}
else
return FALSE;
return TRUE;
}
///
/// Boolean validator
///
IMPLEMENT_DYNAMIC_CLASS(wxBoolFormValidator, wxPropertyFormValidator)
bool wxBoolFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the boolean: should be a checkbox
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
return TRUE;
}
bool wxBoolFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the boolean: should be a checkbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
property->GetValue() = (bool)checkBox->GetValue();
return TRUE;
}
bool wxBoolFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow))
{
// The item used for viewing the boolean: should be a checkbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow || !m_propertyWindow->IsKindOf(CLASSINFO(wxCheckBox)))
return FALSE;
wxCheckBox *checkBox = (wxCheckBox *)m_propertyWindow;
checkBox->SetValue((bool)property->GetValue().BoolValue());
return TRUE;
}
///
/// String validator
///
IMPLEMENT_DYNAMIC_CLASS(wxStringFormValidator, wxPropertyFormValidator)
wxStringFormValidator::wxStringFormValidator(wxStringList *list, long flags):
wxPropertyFormValidator(flags)
{
m_strings = list;
}
bool wxStringFormValidator::OnCheckValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *parentWindow )
{
if (!m_strings)
return TRUE;
// The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
if (!m_strings->Member(text->GetValue()))
{
wxString str( wxT("Value ") );
str += text->GetValue();
str += wxT(" is not valid.");
wxMessageBox(str, wxT("Property value error"), wxOK | wxICON_EXCLAMATION, parentWindow);
return FALSE;
}
}
else
{
// Any other item constrains the string value,
// so we don't have to check it.
}
return TRUE;
}
bool wxStringFormValidator::OnRetrieveValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
property->GetValue() = text->GetValue();
}
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
{
wxListBox *lbox = (wxListBox *)m_propertyWindow;
if (lbox->GetSelection() > -1)
property->GetValue() = lbox->GetStringSelection();
}
/*
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
{
wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
int n = 0;
if ((n = rbox->GetSelection()) > -1)
property->GetValue() = rbox->GetString(n);
}
*/
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
{
wxChoice *choice = (wxChoice *)m_propertyWindow;
if (choice->GetSelection() > -1)
property->GetValue() = choice->GetStringSelection();
}
else
return FALSE;
return TRUE;
}
bool wxStringFormValidator::OnDisplayValue(wxProperty *property, wxPropertyFormView *WXUNUSED(view),
wxWindow *WXUNUSED(parentWindow) )
{
// The item used for viewing the string: should be a text item, choice item or listbox.
wxWindow *m_propertyWindow = property->GetWindow();
if (!m_propertyWindow)
return FALSE;
if (m_propertyWindow->IsKindOf(CLASSINFO(wxTextCtrl)))
{
wxTextCtrl *text = (wxTextCtrl *)m_propertyWindow;
text->SetValue(property->GetValue().StringValue());
}
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
{
wxListBox *lbox = (wxListBox *)m_propertyWindow;
if (lbox->GetCount() == 0 && m_strings)
{
// Try to initialize the listbox from 'strings'
wxStringList::Node *node = m_strings->GetFirst();
while (node)
{
wxChar *s = node->GetData();
lbox->Append(s);
node = node->GetNext();
}
}
lbox->SetStringSelection(property->GetValue().StringValue());
}
/*
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxRadioBox)))
{
wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
rbox->SetStringSelection(property->GetValue().StringValue());
}
*/
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
{
wxChoice *choice = (wxChoice *)m_propertyWindow;
if (choice->GetCount() == 0 && m_strings)
{
// Try to initialize the choice item from 'strings'
// XView doesn't allow this kind of thing.
wxStringList::Node *node = m_strings->GetFirst();
while (node)
{
wxChar *s = node->GetData();
choice->Append(s);
node = node->GetNext();
}
}
choice->SetStringSelection(property->GetValue().StringValue());
}
else
return FALSE;
return TRUE;
}
#endif // wxUSE_PROPSHEET

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,473 @@
///////////////////////////////////////////////////////////////////////////////
// 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
#include "wx/deprecated/setup.h"
#if wxUSE_TREELAYOUT
#include "wx/deprecated/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("<unnamed>"));
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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,538 @@
#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 <io.h>
#endif
#include "wx/deprecated/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 */