// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
-// Licence: wxWindows licence
+// Licence: wxWindows licence
////////////////////////////////////////////////////////////////////////// */
#ifndef _WX_EXPRH__
#endif
#endif
- /* _WX_EXPRH__ */
+ /* _WX_EXPRH__ */
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PROP_H_
// 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;
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);
+ virtual void SetAllModified(bool flag = true);
protected:
wxObject* m_viewedObject;
wxList m_properties;
wxPropertyView* m_propertyView;
- wxString m_name;
-
+ wxString m_name;
+
private:
DECLARE_DYNAMIC_CLASS(wxPropertySheet)
};
// Update this view of the viewed object, called e.g. by
// the object itself.
- virtual bool OnUpdateView() {return FALSE;};
+ virtual bool OnUpdateView() {return false;};
// Override this to do something as soon as the property changed,
// if the view and validators support it.
inline virtual void SetPropertySheet(wxPropertySheet *sheet) { m_propertySheet = sheet; }
inline virtual wxPropertySheet *GetPropertySheet() const { return m_propertySheet; }
- inline virtual bool OnClose() { return FALSE; }
+ inline virtual bool OnClose() { return false; }
inline long GetFlags(void) { return m_buttonFlags; }
protected:
wxProperty* m_currentProperty;
wxList m_validatorRegistryList;
wxPropertyValidator* m_currentValidator;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxPropertyView)
};
protected:
long m_validatorFlags;
wxProperty* m_validatorProperty;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxPropertyValidator)
};
virtual void RegisterValidator(const wxString& roleName, wxPropertyValidator *validator);
virtual wxPropertyValidator *GetValidator(const wxString& roleName);
void ClearRegistry();
-
+
private:
DECLARE_DYNAMIC_CLASS(wxPropertyValidatorRegistry)
};
// 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);
virtual inline wxObject *GetClientData(void) { return m_clientData; }
virtual wxString GetStringRepresentation(void);
-
- inline void SetModified(bool flag = TRUE) { m_modifiedFlag = flag; }
+
+ inline void SetModified(bool flag = true) { m_modifiedFlag = flag; }
inline bool GetModified(void) { return m_modifiedFlag; }
// Operators
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; }
};
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PROPFORM_H_
~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.
+ // 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; }
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/*
private:
DECLARE_DYNAMIC_CLASS(wxPropertyListView)
DECLARE_EVENT_TABLE()
-
+
virtual void ShowView(wxPropertySheet *propertySheet, wxWindow *window)
{ wxPropertyView::ShowView(propertySheet, window); };
};
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.
+ // 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; }
virtual bool OnRetrieveValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
virtual bool OnDisplayValue(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
-
+
private:
DECLARE_DYNAMIC_CLASS(wxPropertyListValidator)
};
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.
+ // 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
protected:
float m_realMin;
float m_realMax;
-
+
private:
DECLARE_DYNAMIC_CLASS(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.
+ // 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
protected:
long m_integerMin;
long m_integerMax;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxIntegerListValidator)
};
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.
+ // 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
// 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)
};
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.
+ // 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
protected:
wxStringList* m_strings;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxStringListValidator)
};
~wxFilenameListValidator();
// Called when TICK is pressed or focus is lost.
- // Return FALSE if value didn't check out; signal to restore old value.
+ // 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
// Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
-
+
private:
DECLARE_DYNAMIC_CLASS(wxColourListValidator)
};
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.
+ // 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
// Called when the edit (...) button is pressed.
void OnEdit(wxProperty *property, wxPropertyListView *view, wxWindow *parentWindow);
-
+
private:
DECLARE_DYNAMIC_CLASS(wxListOfStringsListValidator)
};
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; }
/*
* Resource table (normally only one of these)
*/
-
+
class WXDLLIMPEXP_DEPRECATED wxResourceTable: public wxHashTable
{
DECLARE_DYNAMIC_CLASS(wxResourceTable)
protected:
-
+
public:
wxHashTable identifiers;
-
+
wxResourceTable();
~wxResourceTable();
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString,
wxObject *clientData = NULL,
- wxCoord xPos = -1,
- wxCoord yPos = -1
+ wxCoord xPos = wxDefaultCoord,
+ wxCoord yPos = wxDefaultCoord
);
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
long m_topMargin;
long m_leftMargin;
bool m_orientation; // true for top-to-bottom, false for left-to-right
-
+
private:
DECLARE_ABSTRACT_CLASS(wxTreeLayout)
};
wxStoredNode* m_nodes;
int m_num;
int m_maxNodes;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxTreeLayoutStored)
DECLARE_NO_COPY_CLASS(wxTreeLayoutStored)
#define WXEXPR_ERROR_GENERAL 1
#define WXEXPR_ERROR_SYNTAX 2
-// Error handler function definition. If app returns TRUE,
+// Error handler function definition. If app returns true,
// carry on processing.
typedef bool (*wxExprErrorHandler) (int errorType, char *msg);
MyPanel(wxWindow *parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, int style, const wxString &name);
void OnClick(wxMouseEvent &event);
-
+
private:
DECLARE_EVENT_TABLE()
};
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnTestDialog(wxCommandEvent& event);
-
+
wxWindow *panel;
private:
public:
void OnOk(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
-
+
private:
DECLARE_EVENT_TABLE()
};
// Name: treelay.cpp
// Purpose: wxTreeLayout sample
// Author: Julian Smart
-// Modified by:
+// Modified by:
// Created: 7/4/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
void MyApp::TreeTest(wxTreeLayoutStored& tree, wxDC& dc)
{
tree.Initialize(200);
-
+
tree.AddChild(_T("animal"));
tree.AddChild(_T("mammal"), _T("animal"));
tree.AddChild(_T("insect"), _T("animal"));
// Name: treelay.h
// Purpose: wxTreeLayout sample
// Author: Julian Smart
-// Modified by:
+// Modified by:
// Created: 7/4/98
// RCS-ID: $Id$
// Copyright: (c) 1998 Julian Smart
m_last = NULL;
m_value.first = NULL;
m_clientData = NULL;
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
}
wxPropertyValue::wxPropertyValue(const wxPropertyValue& copyFrom)
: wxObject()
{
m_value.string = (wxChar*) NULL;
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
Copy((wxPropertyValue& )copyFrom);
}
wxPropertyValue::wxPropertyValue(const wxChar *val)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueString;
m_value.string = copystring(val);
wxPropertyValue::wxPropertyValue(const wxString& val)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueString;
m_value.string = copystring(val.c_str());
wxPropertyValue::wxPropertyValue(long the_integer)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueInteger;
m_value.integer = the_integer;
m_clientData = NULL;
wxPropertyValue::wxPropertyValue(bool val)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValuebool;
m_value.integer = val;
m_clientData = NULL;
wxPropertyValue::wxPropertyValue(float the_real)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueReal;
m_value.real = the_real;
m_clientData = NULL;
wxPropertyValue::wxPropertyValue(double the_real)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueReal;
m_value.real = (float)the_real;
m_clientData = NULL;
// Pointer versions: we have a pointer to the real C++ value.
wxPropertyValue::wxPropertyValue(wxChar **val)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueStringPtr;
m_value.stringPtr = val;
wxPropertyValue::wxPropertyValue(long *val)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueIntegerPtr;
m_value.integerPtr = val;
m_clientData = NULL;
wxPropertyValue::wxPropertyValue(bool *val)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueboolPtr;
m_value.boolPtr = val;
m_clientData = NULL;
wxPropertyValue::wxPropertyValue(float *val)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueRealPtr;
m_value.realPtr = val;
m_clientData = NULL;
wxPropertyValue::wxPropertyValue(wxList *the_list)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueList;
m_clientData = NULL;
m_last = NULL;
wxPropertyValue::wxPropertyValue(wxStringList *the_list)
{
- m_modifiedFlag = FALSE;
+ m_modifiedFlag = false;
m_type = wxPropertyValueList;
m_clientData = NULL;
m_last = NULL;
void wxPropertyValue::Append(wxPropertyValue *expr)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
if (!m_value.first)
m_value.first = expr;
void wxPropertyValue::Insert(wxPropertyValue *expr)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
expr->m_next = m_value.first;
m_value.first = expr;
else
m_last = NULL;
}
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
delete expr;
}
{
wxPropertyValue *val = GetFirst();
if (val)
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
while (val)
{
case wxPropertyValueStringPtr:
{
wxChar** s = copyFrom.StringValuePtr();
-
-#if 0
+
+#if 0
// what is this? are you trying to assign a bool or a string? VA can't figure it out..
#if defined(__VISAGECPP__) || defined( __VISUALC__ )
(*this) = s;
#endif // if 0
(*this) = (bool)(s != 0);
-
+
return ;
}
node->WritePropertyType(stream);
stream.Append( wxT("(") );
node = node->m_next;
- bool first = TRUE;
+ bool first = true;
while (node)
{
if (!first)
node = node->m_next;
if (node)
stream.Append( wxT(",\n" ) );
- first = FALSE;
+ first = false;
}
stream.Append( wxT(").\n\n") );
}
void wxPropertyValue::operator=(const wxPropertyValue& val)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
Copy((wxPropertyValue&)val);
}
{
const wxChar *val = (const wxChar *)val1;
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
wxPropertyValueType oldType = m_type;
if (oldType == wxPropertyValueString)
m_value.string = NULL;
}
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueInteger;
m_value.string = NULL;
}
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValuebool;
m_value.string = NULL;
}
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
if (m_type == wxPropertyValueNull)
m_type = wxPropertyValueReal;
m_value.string = NULL;
}
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
m_type = wxPropertyValueStringPtr;
if (val)
void wxPropertyValue::operator=(const long *val)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
m_type = wxPropertyValueIntegerPtr;
m_value.integerPtr = (long *)val;
m_clientData = NULL;
void wxPropertyValue::operator=(const bool *val)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
m_type = wxPropertyValueboolPtr;
m_value.boolPtr = (bool *)val;
m_clientData = NULL;
void wxPropertyValue::operator=(const float *val)
{
- m_modifiedFlag = TRUE;
+ m_modifiedFlag = true;
m_type = wxPropertyValueRealPtr;
m_value.realPtr = (float *)val;
m_clientData = NULL;
return (m_value.integer != 0);
else if (m_type == wxPropertyValueboolPtr)
return (*(m_value.boolPtr) != 0);
- else return FALSE;
+ else return false;
}
bool *wxPropertyValue::BoolValuePtr(void) const
m_propertyRole = wxEmptyString;
m_propertyValidator = NULL;
m_propertyWindow = NULL;
- m_enabled = TRUE;
+ m_enabled = true;
}
wxProperty::wxProperty(wxProperty& copyFrom)
{
m_propertyValidator = ed;
m_propertyWindow = NULL;
- m_enabled = TRUE;
+ m_enabled = true;
}
wxProperty::wxProperty(wxString nm, const wxPropertyValue& val, wxString role, wxPropertyValidator *ed):
{
m_propertyValidator = ed;
m_propertyWindow = NULL;
- m_enabled = TRUE;
+ m_enabled = true;
}
wxProperty::~wxProperty(void)
wxProperty* prop = GetProperty(name);
if(prop){
prop->SetValue(value);
- return TRUE;
+ return true;
}else{
- return FALSE;
+ return false;
}
}
delete prop;
m_properties.Erase(node);
}
-}
+}
bool wxPropertySheet::HasProperty(const wxString& name) const
{
- return (GetProperty(name)?TRUE:FALSE);
+ return (GetProperty(name)?true:false);
}
// Clear all properties
}
bool wxPropertyValidator::StringToDouble (wxChar *s, double *number) {
- bool ok = TRUE;
+ bool ok = true;
wxChar *value_ptr;
*number = wxStrtod (s, &value_ptr);
if (value_ptr) {
int len = wxStrlen (value_ptr);
for (int i = 0; i < len; i++) {
ok = (wxIsspace (value_ptr[i]) != 0);
- if (!ok) return FALSE;
+ if (!ok) return false;
}
}
return ok;
}
bool wxPropertyValidator::StringToLong (wxChar *s, long *number) {
- bool ok = TRUE;
+ bool ok = true;
wxChar *value_ptr;
*number = wxStrtol (s, &value_ptr, 10);
if (value_ptr) {
int len = wxStrlen (value_ptr);
for (int i = 0; i < len; i++) {
ok = (wxIsspace (value_ptr[i]) != 0);
- if (!ok) return FALSE;
+ if (!ok) return false;
}
}
return ok;
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxListBox)))
{
wxListBox *lbox = (wxListBox *)m_propertyWindow;
- if (lbox->GetSelection() > -1)
+ if (lbox->GetSelection() != wxNOT_FOUND)
property->GetValue() = lbox->GetStringSelection();
}
/*
{
wxRadioBox *rbox = (wxRadioBox *)m_propertyWindow;
int n = 0;
- if ((n = rbox->GetSelection()) > -1)
+ if ((n = rbox->GetSelection()) != wxNOT_FOUND)
property->GetValue() = rbox->GetString(n);
}
*/
else if (m_propertyWindow->IsKindOf(CLASSINFO(wxChoice)))
{
wxChoice *choice = (wxChoice *)m_propertyWindow;
- if (choice->GetSelection() > -1)
+ if (choice->GetSelection() != wxNOT_FOUND)
property->GetValue() = choice->GetStringSelection();
}
else
if (property == (wxProperty *)m_propertyScrollingList->wxListBox::GetClientData(i))
return i;
}
- return -1;
+ return wxNOT_FOUND;
}
wxString wxPropertyListView::MakeNameValueString(wxString name, wxString value)
if (select)
{
int sel = FindListIndexForProperty(property);
- if (sel > -1)
+ if (sel != wxNOT_FOUND)
m_propertyScrollingList->SetSelection(sel);
}
return true;
void wxPropertyListView::OnPropertySelect(wxCommandEvent& WXUNUSED(event))
{
int sel = m_propertyScrollingList->GetSelection();
- if (sel > -1)
+ if (sel != wxNOT_FOUND)
{
wxProperty *newSel = (wxProperty *)m_propertyScrollingList->wxListBox::GetClientData(sel);
if (newSel && newSel != m_currentProperty)
void wxPropertyStringListEditorDialog::OnStrings(wxCommandEvent& WXUNUSED(event))
{
int sel = m_listBox->GetSelection();
- if (sel > -1)
+ if (sel != wxNOT_FOUND)
{
m_currentSelection = sel;
void wxPropertyStringListEditorDialog::OnDelete(wxCommandEvent& WXUNUSED(event))
{
int sel = m_listBox->GetSelection();
- if (sel == -1)
+ if (sel == wxNOT_FOUND)
return;
wxNode *node = (wxNode *)m_listBox->wxListBox::GetClientData(sel);
// Forward (private) declarations
bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db);
-wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel = FALSE);
+wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel = false);
wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr);
wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr);
wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, wxExpr *expr);
{
public:
wxResourceModule() : wxModule() {}
- virtual bool OnInit() { wxInitializeResourceSystem(); return TRUE; }
+ virtual bool OnInit() { wxInitializeResourceSystem(); return true; }
virtual void OnExit() { wxCleanUpResourceSystem(); }
DECLARE_DYNAMIC_CLASS(wxResourceModule)
}
delete item;
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
bool wxResourceTable::ParseResourceFile( wxInputStream *is )
wxExprDatabase db;
int len = is->GetSize() ;
- bool eof = FALSE;
+ bool eof = false;
while ( is->TellI() + 10 < len) // it's a hack because the streams dont support EOF
{
wxResourceReadOneResource(is, db, &eof, this) ;
FILE *fd = wxFopen(filename, wxT("r"));
if (!fd)
- return FALSE;
- bool eof = FALSE;
+ return false;
+ bool eof = false;
while (wxResourceReadOneResource(fd, db, &eof, this) && !eof)
{
// Loop
if (!db.ReadFromString(data))
{
wxLogWarning(_("Ill-formed resource file syntax."));
- return FALSE;
+ return false;
}
return wxResourceInterpretResources(*this, db);
item->SetValue2((long)width);
item->SetValue3((long)height);
AddResource(item);
- return TRUE;
+ return true;
}
bool wxResourceTable::RegisterResourceBitmapData(const wxString& name, char **data)
item->SetName(name);
item->SetValue1((long)data);
AddResource(item);
- return TRUE;
+ return true;
}
bool wxResourceTable::SaveResource(const wxString& WXUNUSED(filename))
{
- return FALSE;
+ return false;
}
void wxResourceTable::ClearTable()
((wxScrollBar *)control)->SetViewLength((int)(long)childResource->GetValue5());
*/
((wxScrollBar *)control)->SetScrollbar((int)childResource->GetValue1(),(int)childResource->GetValue2(),
- (int)childResource->GetValue3(),(int)(long)childResource->GetValue5(),FALSE);
+ (int)childResource->GetValue3(),(int)(long)childResource->GetValue5(),false);
}
#endif
// Force the layout algorithm since the size changes the layout
if (control->IsKindOf(CLASSINFO(wxRadioBox)))
{
- control->SetSize(-1, -1, -1, -1, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT);
+ control->SetSize(wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxDefaultCoord, wxSIZE_AUTO_WIDTH|wxSIZE_AUTO_HEIGHT);
}
#endif
}
if (functor == wxT("dialog"))
item = wxResourceInterpretDialog(table, clause);
else if (functor == wxT("panel"))
- item = wxResourceInterpretDialog(table, clause, TRUE);
+ item = wxResourceInterpretDialog(table, clause, true);
else if (functor == wxT("menubar"))
item = wxResourceInterpretMenuBar(table, clause);
else if (functor == wxT("menu"))
}
node = node->GetNext();
}
- return TRUE;
+ return true;
}
static const wxChar *g_ValidControlClasses[] =
for ( size_t i = 0; i < WXSIZEOF(g_ValidControlClasses); i++ )
{
if ( c == g_ValidControlClasses[i] )
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel)
if (isPanel)
windowStyle = 0;
- int x = 0; int y = 0; int width = -1; int height = -1;
+ int x = 0; int y = 0; int width = wxDefaultCoord; int height = wxDefaultCoord;
int isModal = 0;
wxExpr *labelFontExpr = (wxExpr *) NULL;
wxExpr *buttonFontExpr = (wxExpr *) NULL;
#pragma message disable CODCAUUNR
#endif
if (windowStyle & wxDIALOG_MODAL) // Uses style in wxWin 2
- dialogItem->SetValue1(TRUE);
+ dialogItem->SetValue1(true);
#ifdef __VMS
#pragma message enable CODCAUUNR
#endif
dialogItem->SetSize(x, y, width, height);
// Check for wxWin 1.68-style specifications
- if (style.Find(wxT("VERTICAL_LABEL")) != -1)
+ if (style.Find(wxT("VERTICAL_LABEL")) != wxNOT_FOUND)
dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_VERTICAL_LABEL);
- else if (style.Find(wxT("HORIZONTAL_LABEL")) != -1)
+ else if (style.Find(wxT("HORIZONTAL_LABEL")) != wxNOT_FOUND)
dialogItem->SetResourceStyle(dialogItem->GetResourceStyle() | wxRESOURCE_HORIZONTAL_LABEL);
if (backColourHex != wxT(""))
wxString name;
int id = 0;
long windowStyle = 0;
- int x = 0; int y = 0; int width = -1; int height = -1;
+ int x = 0; int y = 0; int width = wxDefaultCoord; int height = wxDefaultCoord;
int count = 0;
wxExpr *expr1 = expr->Nth(0);
controlItem->SetId(id);
// Check for wxWin 1.68-style specifications
- if (style.Find(wxT("VERTICAL_LABEL")) != -1)
+ if (style.Find(wxT("VERTICAL_LABEL")) != wxNOT_FOUND)
controlItem->SetResourceStyle(controlItem->GetResourceStyle() | wxRESOURCE_VERTICAL_LABEL);
- else if (style.Find(wxT("HORIZONTAL_LABEL")) != -1)
+ else if (style.Find(wxT("HORIZONTAL_LABEL")) != wxNOT_FOUND)
controlItem->SetResourceStyle(controlItem->GetResourceStyle() | wxRESOURCE_HORIZONTAL_LABEL);
if (controlType == wxT("wxButton"))
{
wxResourceBufferSize = 1000;
wxResourceBuffer = new char[wxResourceBufferSize];
- return TRUE;
+ return true;
}
if (wxResourceBuffer)
{
wxResourceBuffer = tmp;
wxResourceBufferSize = newSize;
}
- return TRUE;
+ return true;
}
static bool wxEatWhiteSpace(FILE *fd)
if (ch == EOF)
{
ungetc(prev_ch, fd);
- return TRUE;
+ return true;
}
if (ch == '*')
{
ungetc(prev_ch, fd);
ungetc(ch, fd);
- return TRUE;
+ return true;
}
}
break;
default:
ungetc(ch, fd);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
static bool wxEatWhiteSpace(wxInputStream *is)
{
if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9))
{
is->Ungetch(ch);
- return TRUE;
+ return true;
}
// Eat whitespace
ch = is->GetC();
if (ch == '*')
{
- bool finished = FALSE;
+ bool finished = false;
while (!finished)
{
ch = is->GetC();
if (ch == EOF)
- return FALSE;
+ return false;
if (ch == '*')
{
int newCh = is->GetC();
if (newCh == '/')
- finished = TRUE;
+ finished = true;
else
{
is->Ungetch(ch);
}
}
else // False alarm
- return FALSE;
+ return false;
}
else
is->Ungetch(ch);
if (ch == EOF)
{
wxResourceBuffer[wxResourceBufferCount] = 0;
- return FALSE;
+ return false;
}
// Escaped characters
else if (ch == '\\')
}
wxResourceBuffer[wxResourceBufferCount] = 0;
if (ch == EOF)
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
bool wxGetResourceToken(wxInputStream *is)
if (ch == EOF)
{
wxResourceBuffer[wxResourceBufferCount] = 0;
- return FALSE;
+ return false;
}
// Escaped characters
else if (ch == '\\')
}
wxResourceBuffer[wxResourceBufferCount] = 0;
if (ch == EOF)
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
/*
// static or #define
if (!wxGetResourceToken(fd))
{
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (strcmp(wxResourceBuffer, "#define") == 0)
wxLogWarning(_("#define %s must be an integer."), name);
delete[] name;
delete[] value;
- return FALSE;
+ return false;
}
delete[] name;
delete[] value;
- return TRUE;
+ return true;
}
else if (strcmp(wxResourceBuffer, "#include") == 0)
{
wxLogWarning(_("Could not find resource include file %s."), actualName);
}
delete[] name;
- return TRUE;
+ return true;
}
else if (strcmp(wxResourceBuffer, "static") != 0)
{
wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30);
wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
wxLogWarning(buf);
- return FALSE;
+ return false;
}
// char
if (!wxGetResourceToken(fd))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (strcmp(wxResourceBuffer, "char") != 0)
{
wxLogWarning(_("Expected 'char' whilst parsing resource."));
- return FALSE;
+ return false;
}
// *name
if (!wxGetResourceToken(fd))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (wxResourceBuffer[0] != '*')
{
wxLogWarning(_("Expected '*' whilst parsing resource."));
- return FALSE;
+ return false;
}
wxChar nameBuf[100];
wxMB2WX(nameBuf, wxResourceBuffer+1, 99);
if (!wxGetResourceToken(fd))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (strcmp(wxResourceBuffer, "=") != 0)
{
wxLogWarning(_("Expected '=' whilst parsing resource."));
- return FALSE;
+ return false;
}
// String
if (!wxGetResourceToken(fd))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
else
{
if (!db.ReadPrologFromString(wxResourceBuffer))
{
wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf);
- return FALSE;
+ return false;
}
}
// Semicolon
if (!wxGetResourceToken(fd))
{
- *eof = TRUE;
+ *eof = true;
}
- return TRUE;
+ return true;
}
bool wxResourceReadOneResource(wxInputStream *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table)
// static or #define
if (!wxGetResourceToken(fd))
{
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (strcmp(wxResourceBuffer, "#define") == 0)
wxLogWarning(_("#define %s must be an integer."), name);
delete[] name;
delete[] value;
- return FALSE;
+ return false;
}
delete[] name;
delete[] value;
- return TRUE;
+ return true;
}
else if (strcmp(wxResourceBuffer, "#include") == 0)
{
wxLogWarning(_("Could not find resource include file %s."), actualName);
}
delete[] name;
- return TRUE;
+ return true;
}
else if (strcmp(wxResourceBuffer, "static") != 0)
{
wxStrncat(buf, wxConvLibc.cMB2WX(wxResourceBuffer), 30);
wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
wxLogWarning(buf);
- return FALSE;
+ return false;
}
// char
if (!wxGetResourceToken(fd))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (strcmp(wxResourceBuffer, "char") != 0)
{
wxLogWarning(_("Expected 'char' whilst parsing resource."));
- return FALSE;
+ return false;
}
// *name
if (!wxGetResourceToken(fd))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (wxResourceBuffer[0] != '*')
{
wxLogWarning(_("Expected '*' whilst parsing resource."));
- return FALSE;
+ return false;
}
char nameBuf[100];
strncpy(nameBuf, wxResourceBuffer+1, 99);
if (!wxGetResourceToken(fd))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (strcmp(wxResourceBuffer, "=") != 0)
{
wxLogWarning(_("Expected '=' whilst parsing resource."));
- return FALSE;
+ return false;
}
// String
if (!wxGetResourceToken(fd))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
else
{
if (!db.ReadPrologFromString(wxResourceBuffer))
{
wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf);
- return FALSE;
+ return false;
}
}
// Semicolon
if (!wxGetResourceToken(fd))
{
- *eof = TRUE;
+ *eof = true;
}
- return TRUE;
+ return true;
}
/*
word = wxResourceParseWord(WXSTRINGCAST bitListString, &i);
while (word != NULL)
{
- bool found = FALSE;
+ bool found = false;
int j;
for (j = 0; j < wxResourceBitListCount; j++)
if (wxStrcmp(wxResourceBitListTable[j].word, word) == 0)
{
bitList |= wxResourceBitListTable[j].bits;
- found = TRUE;
+ found = true;
break;
}
if (!found)
table = wxDefaultResourceTable;
table->identifiers.Put(name, (wxObject *)(long)value);
- return TRUE;
+ return true;
}
int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table)
FILE *fd = wxFopen(f, wxT("r"));
if (!fd)
{
- return FALSE;
+ return false;
}
while (wxGetResourceToken(fd))
{
}
}
fclose(fd);
- return TRUE;
+ return true;
}
/*
if (ch == EOF)
{
ungetc_string();
- return TRUE;
+ return true;
}
if (ch == '*')
{
ungetc_string();
ungetc_string();
- return TRUE;
+ return true;
}
}
break;
default:
ungetc_string();
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
bool wxGetResourceTokenString(char *s)
if (ch == EOF)
{
wxResourceBuffer[wxResourceBufferCount] = 0;
- return FALSE;
+ return false;
}
// Escaped characters
else if (ch == '\\')
}
wxResourceBuffer[wxResourceBufferCount] = 0;
if (ch == EOF)
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
/*
// static or #define
if (!wxGetResourceTokenString(s))
{
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (strcmp(wxResourceBuffer, "#define") == 0)
wxLogWarning(_("#define %s must be an integer."), name);
delete[] name;
delete[] value;
- return FALSE;
+ return false;
}
delete[] name;
delete[] value;
- return TRUE;
+ return true;
}
/*
else if (strcmp(wxResourceBuffer, "#include") == 0)
wxLogWarning(buf);
}
delete[] name;
- return TRUE;
+ return true;
}
*/
else if (strcmp(wxResourceBuffer, "static") != 0)
wxStrncat(buf, wxConvCurrent->cMB2WX(wxResourceBuffer), 30);
wxStrcat(buf, _(", expected static, #include or #define\nwhilst parsing resource."));
wxLogWarning(buf);
- return FALSE;
+ return false;
}
// char
if (!wxGetResourceTokenString(s))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (strcmp(wxResourceBuffer, "char") != 0)
{
wxLogWarning(_("Expected 'char' whilst parsing resource."));
- return FALSE;
+ return false;
}
// *name
if (!wxGetResourceTokenString(s))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (wxResourceBuffer[0] != '*')
{
wxLogWarning(_("Expected '*' whilst parsing resource."));
- return FALSE;
+ return false;
}
wxChar nameBuf[100];
wxMB2WX(nameBuf, wxResourceBuffer+1, 99);
if (!wxGetResourceTokenString(s))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
if (strcmp(wxResourceBuffer, "=") != 0)
{
wxLogWarning(_("Expected '=' whilst parsing resource."));
- return FALSE;
+ return false;
}
// String
if (!wxGetResourceTokenString(s))
{
wxLogWarning(_("Unexpected end of file whilst parsing resource."));
- *eof = TRUE;
- return FALSE;
+ *eof = true;
+ return false;
}
else
{
if (!db.ReadPrologFromString(wxResourceBuffer))
{
wxLogWarning(_("%s: ill-formed resource file syntax."), nameBuf);
- return FALSE;
+ return false;
}
}
// Semicolon
if (!wxGetResourceTokenString(s))
{
- *eof = TRUE;
+ *eof = true;
}
- return TRUE;
+ return true;
}
bool wxResourceParseString(const wxString& s, wxResourceTable *WXUNUSED(table))
table = wxDefaultResourceTable;
if (!s)
- return FALSE;
+ return false;
// Turn backslashes into spaces
if (s)
wxExprDatabase db;
wxResourceStringPtr = 0;
- bool eof = FALSE;
+ bool eof = false;
while (wxResourceReadOneResourceString(s, db, &eof, table) && !eof)
{
// Loop
// if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX))
if (!resource || (resource->GetType() == wxT("")) ||
! ((resource->GetType() == wxT("wxDialog")) || (resource->GetType() == wxT("wxPanel"))))
- return FALSE;
+ return false;
wxString title(resource->GetTitle());
long theWindowStyle = resource->GetStyle();
{
wxDialog *dialogBox = (wxDialog *)thisWindow;
long modalStyle = isModal ? wxDIALOG_MODAL : 0;
- if (!dialogBox->Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), theWindowStyle|modalStyle, name))
- return FALSE;
+ if (!dialogBox->Create(parent, wxID_ANY, title, wxPoint(x, y), wxSize(width, height), theWindowStyle|modalStyle, name))
+ return false;
// Only reset the client size if we know we're not going to do it again below.
if ((resource->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) == 0)
else if (thisWindow->IsKindOf(CLASSINFO(wxPanel)))
{
wxPanel* panel = (wxPanel *)thisWindow;
- if (!panel->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle | wxTAB_TRAVERSAL, name))
- return FALSE;
+ if (!panel->Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), theWindowStyle | wxTAB_TRAVERSAL, name))
+ return false;
}
else
{
- if (!((wxWindow *)thisWindow)->Create(parent, -1, wxPoint(x, y), wxSize(width, height), theWindowStyle, name))
- return FALSE;
+ if (!((wxWindow *)thisWindow)->Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), theWindowStyle, name))
+ return false;
}
}
node = node->GetNext();
}
- return TRUE;
+ return true;
}
wxControl *wxCreateItem(wxWindow* thisWindow, const wxItemResource *resource, const wxItemResource* parentResource, const wxResourceTable *table)
m_currentTool = -1;
m_xPos =
- m_yPos = -1;
+ m_yPos = wxDefaultCoord;
m_toolPacking = 1;
m_toolSeparation = 5;
_T("generic wxToolBarSimple doesn't support controls") );
tool->m_x = m_xPos;
- if ( tool->m_x == -1 )
+ if ( tool->m_x == wxDefaultCoord )
tool->m_x = m_xMargin;
tool->m_y = m_yPos;
- if ( tool->m_y == -1 )
+ if ( tool->m_y == wxDefaultCoord )
tool->m_y = m_yMargin;
tool->SetSize(GetToolSize());
else
nScrollInc = pos - m_yScrollPosition;
}
-
+
if (orient == wxHORIZONTAL)
{
int w, h;
{
int old_x, old_y;
ViewStart (&old_x, &old_y);
- if (((x_pos == -1) || (x_pos == old_x)) && ((y_pos == -1) || (y_pos == old_y)))
+ if (((x_pos == wxDefaultCoord) || (x_pos == old_x)) && ((y_pos == wxDefaultCoord) || (y_pos == old_y)))
return;
- if (x_pos > -1)
+ if (x_pos != wxDefaultCoord)
{
m_xScrollPosition = x_pos;
SetScrollPos (wxHORIZONTAL, x_pos, true);
}
- if (y_pos > -1)
+ if (y_pos != wxDefaultCoord)
{
m_yScrollPosition = y_pos;
SetScrollPos (wxVERTICAL, y_pos, true);
void wxTreeLayout::DoLayout(wxDC& dc, long topId)
{
- if (topId != -1)
+ if (topId != wxID_ANY)
SetTopNode(topId);
long actualTopId = GetTopNode();
long id = actualTopId;
- while (id != -1)
+ while (id != wxID_ANY)
{
SetNodeX(id, 0);
SetNodeY(id, 0);
void wxTreeLayout::DrawNodes(wxDC& dc)
{
long id = GetTopNode();
- while (id != -1)
+ while (id != wxID_ANY)
{
if (NodeActive(id))
DrawNode(id, dc);
void wxTreeLayout::DrawBranches(wxDC& dc)
{
long id = GetTopNode();
- while (id != -1)
+ while (id != wxID_ANY)
{
- if (GetNodeParent(id) > -1)
+ if (GetNodeParent(id) != wxID_ANY)
{
long parent = GetNodeParent(id);
if (NodeActive(parent))
long x = 0;
long y = 0;
long parentId = GetNodeParent(nodeId);
- if (parentId != -1)
+ if (parentId != wxID_ANY)
GetNodeSize(parentId, &x, &y, dc);
SetNodeX(nodeId, (long)(GetNodeX(parentId) + m_xSpacing + x));
}
long x = 0;
long y = 0;
long parentId = GetNodeParent(nodeId);
- if (parentId != -1)
+ if (parentId != wxID_ANY)
GetNodeSize(parentId, &x, &y, dc);
SetNodeY(nodeId, (long)(GetNodeY(parentId) + m_ySpacing + y));
}
{
m_nodes[i].m_name = wxT("");
m_nodes[i].m_active = false;
- m_nodes[i].m_parentId = -1;
+ m_nodes[i].m_parentId = wxID_ANY;
m_nodes[i].m_x = 0;
m_nodes[i].m_y = 0;
}
{
i = parent;
}
- else
+ 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
void wxTreeLayoutStored::GetChildren(long id, wxList& list)
{
long currentId = GetTopNode();
- while (currentId != -1)
+ while (currentId != wxID_ANY)
{
if (id == GetNodeParent(currentId))
list.Append((wxObject *)currentId);
long wxTreeLayoutStored::GetNodeParent(long id)
{
- if (id != -1)
+ if (id != wxID_ANY)
{
wxASSERT(id < m_num);
return m_nodes[id].m_parentId;
}
else
- return -1;
+ return wxNOT_FOUND;
}
long wxTreeLayoutStored::GetNextNode(long id)
{
wxASSERT(id < m_num);
- if ((id != -1) && (id < (m_num - 1)))
+ if ((id != wxID_ANY) && (id < (m_num - 1)))
return id + 1;
else
- return -1;
+ return wxNOT_FOUND;
}
void wxTreeLayoutStored::SetClientData(long id, long clientData)
break;
case wxExprReal:
case wxExprInteger:
- case wxExprNull:
+ case wxExprNull:
break;
}
client_data = NULL;
break;
case wxExprReal:
case wxExprInteger:
- case wxExprNull:
+ case wxExprNull:
break;
}
client_data = NULL;
}
return new_list;
}
- case wxExprNull:
+ case wxExprNull:
break;
}
return NULL;
if ((firstNode->type == wxExprWord) && (firstNode->value.word[0] == '='))
{
wxExpr *secondNode = firstNode->next;
- if ((secondNode->type == wxExprWord) &&
+ if ((secondNode->type == wxExprWord) &&
(wxStrcmp((const wxChar *)word, secondNode->value.word) == 0))
{
return expr;
bool wxExpr::IsFunctor(const wxString& f) const // Use only for a clause
{
if ((type != wxExprList) || !value.first)
- return FALSE;
+ return false;
- return (value.first->type == wxExprWord &&
+ return (value.first->type == wxExprWord &&
(wxStrcmp((const wxChar *)f, value.first->value.word) == 0));
}
if ((firstNode->type == wxExprWord) && (firstNode->value.word[0] == '='))
{
wxExpr *secondNode = firstNode->next;
- if ((secondNode->type == wxExprWord) &&
+ if ((secondNode->type == wxExprWord) &&
(wxStrcmp((const wxChar *)attribute, secondNode->value.word) == 0))
{
wxExpr *nextExpr = expr->next;
if (expr && (expr->Type() == wxExprInteger || expr->Type() == wxExprReal))
{
var = (int)(expr->IntegerValue());
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
bool wxExpr::GetAttributeValue(const wxString& att, long& var) const
if (expr && (expr->Type() == wxExprInteger || expr->Type() == wxExprReal))
{
var = expr->IntegerValue();
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
bool wxExpr::GetAttributeValue(const wxString& att, float& var) const
if (expr && (expr->Type() == wxExprInteger || expr->Type() == wxExprReal))
{
var = (float) expr->RealValue();
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
bool wxExpr::GetAttributeValue(const wxString& att, double& var) const
if (expr && (expr->Type() == wxExprInteger || expr->Type() == wxExprReal))
{
var = expr->RealValue();
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
bool wxExpr::GetAttributeValue(const wxString& att, wxString& var) const // Word OR string -> string
if (expr && expr->Type() == wxExprWord)
{
var = expr->WordValue();
- return TRUE;
+ return true;
}
else if (expr && expr->Type() == wxExprString)
{
var = expr->StringValue();
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
bool wxExpr::GetAttributeValue(const wxString& att, wxExpr **var) const
if (expr)
{
*var = expr;
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
bool wxExpr::GetAttributeValueStringList(const wxString& att, wxList *var) const
string_expr = string_expr->next;
}
- return TRUE;
+ return true;
}
else
- return FALSE;
+ return false;
}
// Compatibility
node->WriteExpr(stream);
fprintf( stream, "(" );
node = node->next;
- bool first = TRUE;
+ bool first = true;
while (node)
{
if (!first)
fprintf( stream, " " );
node->WriteExpr(stream);
node = node->next;
- if (node)
+ if (node)
fprintf( stream, ",\n" );
- first = FALSE;
+ first = false;
}
fprintf( stream, ").\n\n" );
}
}
case wxExprWord:
{
- bool quote_it = FALSE;
+ bool quote_it = false;
const wxWX2MBbuf val = wxConvLibc.cWX2MB(value.word);
size_t len = strlen(val);
if ((len == 0) || (len > 0 && (val[(size_t) 0] > 64 && val[(size_t) 0] < 91)))
- quote_it = TRUE;
+ quote_it = true;
else
{
size_t i;
for (i = 0; i < len; i++)
if ((!isalpha(val[i])) && (!isdigit(val[i])) &&
(val[i] != '_'))
- { quote_it = TRUE; i = len; }
+ { quote_it = true; i = len; }
}
if (quote_it)
{
expr->WriteExpr(stream);
expr = expr->next;
- if (expr)
- fprintf( stream, ", " );
+ if (expr)
+ fprintf( stream, ", " );
}
fprintf( stream, "]" );
}
/*
* wxExpr 'database' (list of expressions)
*/
-
+
IMPLEMENT_DYNAMIC_CLASS(wxExprDatabase, wxList)
wxExprDatabase::wxExprDatabase(wxExprErrorHandler handler)
while (position && !found)
{
wxExpr *term = (wxExpr *)position->GetData();
-
+
if (term->Type() == wxExprList)
{
wxExpr *value = term->AttributeValue(wxT("id"));
while (position && !found)
{
wxExpr *term = (wxExpr *)position->GetData();
-
+
if (term->Type() == wxExprList)
{
wxExpr *value = term->AttributeValue(word);
while (position && !found)
{
wxExpr *term = (wxExpr *)position->GetData();
-
+
if (term->Type() == wxExprList)
{
wxExpr *value = term->AttributeValue(word);
while (position && !found)
{
wxExpr *term = (wxExpr *)position->GetData();
-
+
if (term->Type() == wxExprList)
{
wxExpr *value = term->AttributeValue(word);
while (position && !found)
{
wxExpr *term = (wxExpr *)position->GetData();
-
+
if (term->Type() == wxExprList)
{
if (term->Functor() == functor)
}
else
{
- return FALSE;
+ return false;
}
}
bool wxExprDatabase::Write(const wxString& fileName)
{
FILE *stream = wxFopen( fileName, _T("w+"));
-
+
if (!stream)
- return FALSE;
-
+ return false;
+
bool success = Write(stream);
fclose(stream);
return success;
if (first_expr && (first_expr->Type() == wxExprWord) &&
(first_expr->WordValue() == functor))
- return TRUE;
- else
- return FALSE;
- }
- else
- return FALSE;
+ return true;
+ else
+ return false;
+ }
+ else
+ return false;
}
/*
size_t len, i;
const wxMB2WXbuf sbuf = wxConvLibc.cMB2WX(str);
-// str++; /* skip leading quote */
- len = wxStrlen(sbuf) - 1; /* ignore trailing quote */
-
+// str++; /* skip leading quote */
+ len = wxStrlen(sbuf) - 1; /* ignore trailing quote */
+
s = new wxChar[len + 1];
-
+
t = s;
for(i=1; i<len; i++) // 1 since we want to skip leading quote
{
*t = wxT('\0');
- wxExpr *x = new wxExpr(wxExprString, s, FALSE);
+ wxExpr *x = new wxExpr(wxExprString, s, false);
return (char *)x;
}