wxID_ANY, wxDefaultSize, wxDefaultPosition, wxNOT_FOUND, true, false, tabs replacements.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27745 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-06-11 13:14:23 +00:00
parent df135587ad
commit f80ea77b4a
135 changed files with 1720 additions and 1720 deletions

View File

@@ -24,7 +24,7 @@
class WXDLLIMPEXP_XRC wxGaugeXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxGaugeXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxGaugeXmlHandler) DECLARE_DYNAMIC_CLASS(wxGaugeXmlHandler)
enum enum
{ {
wxGAUGE_DEFAULT_RANGE = 100 wxGAUGE_DEFAULT_RANGE = 100

View File

@@ -31,7 +31,7 @@ private:
class WXDLLIMPEXP_XRC wxMenuBarXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxMenuBarXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxMenuBarXmlHandler) DECLARE_DYNAMIC_CLASS(wxMenuBarXmlHandler)
public: public:
wxMenuBarXmlHandler(); wxMenuBarXmlHandler();
virtual wxObject *DoCreateResource(); virtual wxObject *DoCreateResource();

View File

@@ -22,7 +22,7 @@
class WXDLLIMPEXP_XRC wxScrollBarXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxScrollBarXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxScrollBarXmlHandler) DECLARE_DYNAMIC_CLASS(wxScrollBarXmlHandler)
enum enum
{ {
wxSL_DEFAULT_VALUE = 0, wxSL_DEFAULT_VALUE = 0,

View File

@@ -22,7 +22,7 @@
class WXDLLIMPEXP_XRC wxSliderXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxSliderXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxSliderXmlHandler) DECLARE_DYNAMIC_CLASS(wxSliderXmlHandler)
enum enum
{ {
wxSL_DEFAULT_VALUE = 0, wxSL_DEFAULT_VALUE = 0,

View File

@@ -21,7 +21,7 @@
#if wxUSE_SPINBTN #if wxUSE_SPINBTN
class WXDLLIMPEXP_XRC wxSpinButtonXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxSpinButtonXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxSpinButtonXmlHandler) DECLARE_DYNAMIC_CLASS(wxSpinButtonXmlHandler)
enum enum
{ {
wxSP_DEFAULT_VALUE = 0, wxSP_DEFAULT_VALUE = 0,
@@ -39,7 +39,7 @@ public:
#if wxUSE_SPINCTRL #if wxUSE_SPINCTRL
class WXDLLIMPEXP_XRC wxSpinCtrlXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxSpinCtrlXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxSpinCtrlXmlHandler) DECLARE_DYNAMIC_CLASS(wxSpinCtrlXmlHandler)
enum enum
{ {
wxSP_DEFAULT_VALUE = 0, wxSP_DEFAULT_VALUE = 0,

View File

@@ -240,7 +240,7 @@ protected:
bool UpdateResources(); bool UpdateResources();
// Finds a resource (calls UpdateResources) and returns a node containing it. // Finds a resource (calls UpdateResources) and returns a node containing it.
wxXmlNode *FindResource(const wxString& name, const wxString& classname, bool recursive = FALSE); wxXmlNode *FindResource(const wxString& name, const wxString& classname, bool recursive = false);
// Helper function: finds a resource (calls UpdateResources) and returns a node containing it. // Helper function: finds a resource (calls UpdateResources) and returns a node containing it.
wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name, const wxString& classname, bool recursive); wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name, const wxString& classname, bool recursive);
@@ -329,8 +329,8 @@ public:
// were filled. // were filled.
virtual wxObject *DoCreateResource() = 0; virtual wxObject *DoCreateResource() = 0;
// Returns TRUE if it understands this node and can create // Returns true if it understands this node and can create
// a resource from it, FALSE otherwise. // a resource from it, false otherwise.
virtual bool CanHandle(wxXmlNode *node) = 0; virtual bool CanHandle(wxXmlNode *node) = 0;
// Sets the parent resource. // Sets the parent resource.
@@ -385,7 +385,7 @@ protected:
// - replaces \n, \r, \t by respective chars (according to C syntax) // - replaces \n, \r, \t by respective chars (according to C syntax)
// - replaces _ by & and __ by _ (needed for _File => &File because of XML) // - replaces _ by & and __ by _ (needed for _File => &File because of XML)
// - calls wxGetTranslations (unless disabled in wxXmlResource) // - calls wxGetTranslations (unless disabled in wxXmlResource)
wxString GetText(const wxString& param, bool translate = TRUE); wxString GetText(const wxString& param, bool translate = true);
// Returns the XRCID. // Returns the XRCID.
int GetID(); int GetID();
@@ -393,8 +393,8 @@ protected:
// Returns the resource name. // Returns the resource name.
wxString GetName(); wxString GetName();
// Gets a bool flag (1, t, yes, on, true are TRUE, everything else is FALSE). // Gets a bool flag (1, t, yes, on, true are true, everything else is false).
bool GetBool(const wxString& param, bool defaultv = FALSE); bool GetBool(const wxString& param, bool defaultv = false);
// Gets the integer value from the parameter. // Gets the integer value from the parameter.
long GetLong( const wxString& param, long defaultv = 0 ); long GetLong( const wxString& param, long defaultv = 0 );
@@ -428,7 +428,7 @@ protected:
void SetupWindow(wxWindow *wnd); void SetupWindow(wxWindow *wnd);
// Creates children. // Creates children.
void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE); void CreateChildren(wxObject *parent, bool this_hnd_only = false);
// Helper function. // Helper function.
void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL); void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL);

View File

@@ -119,8 +119,8 @@ void MyResizableListCtrl::ContextSensitiveMenu( wxMouseEvent& event )
// If no listctrl rows selected, then disable the menu items that // If no listctrl rows selected, then disable the menu items that
// require selection // require selection
if ( GetSelectedItemCount() == 0 ) { if ( GetSelectedItemCount() == 0 ) {
a_menu.Enable( PU_EDIT_RECORD, FALSE ); a_menu.Enable( PU_EDIT_RECORD, false );
a_menu.Enable( PU_DELETE_RECORD, FALSE ); a_menu.Enable( PU_DELETE_RECORD, false );
} }
// Show the popup menu (wxWindow::PopupMenu ), at the x,y position // Show the popup menu (wxWindow::PopupMenu ), at the x,y position

View File

@@ -60,7 +60,7 @@ public:
column. column.
*/ */
MyResizableListCtrl( wxWindow *parent = NULL, MyResizableListCtrl( wxWindow *parent = NULL,
wxWindowID id = -1, wxWindowID id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition, const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize, const wxSize &size = wxDefaultSize,
long style = wxLC_REPORT, long style = wxLC_REPORT,

View File

@@ -96,7 +96,7 @@ void PreferencesDialog::OuUpdateUIMyCheckbox( wxUpdateUIEvent &WXUNUSED(event) )
// this is the XRCCTRL way (which is more obvious as to what is going on). // this is the XRCCTRL way (which is more obvious as to what is going on).
myCheckBoxIsChecked = XRCCTRL(*this, "my_checkbox", wxCheckBox)->IsChecked(); myCheckBoxIsChecked = XRCCTRL(*this, "my_checkbox", wxCheckBox)->IsChecked();
// Now call either Enable(TRUE) or Enable(FALSE) on the textctrl, depending // Now call either Enable(true) or Enable(false) on the textctrl, depending
// on the value of that boolean. // on the value of that boolean.
XRCCTRL(*this, "my_textctrl", wxTextCtrl)->Enable(myCheckBoxIsChecked); XRCCTRL(*this, "my_textctrl", wxTextCtrl)->Enable(myCheckBoxIsChecked);
} }

View File

@@ -136,8 +136,8 @@ MyFrame::MyFrame(wxWindow* parent)
void MyFrame::OnExitToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnExitToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{ {
// TRUE is to force the frame to close. // true is to force the frame to close.
Close(TRUE); Close(true);
} }
@@ -223,7 +223,7 @@ void MyFrame::OnCustomClassToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
// Make an instance of our new custom class. // Make an instance of our new custom class.
MyResizableListCtrl* a_myResizableListCtrl = new MyResizableListCtrl(&dlg, MyResizableListCtrl* a_myResizableListCtrl = new MyResizableListCtrl(&dlg,
-1, wxID_ANY,
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
wxLC_REPORT, wxLC_REPORT,

View File

@@ -116,9 +116,9 @@ bool MyApp::OnInit()
MyFrame *frame = new MyFrame(); MyFrame *frame = new MyFrame();
// Show the frame. // Show the frame.
frame->Show(TRUE); frame->Show(true);
// Return TRUE to tell program to continue (FALSE would terminate). // Return true to tell program to continue (false would terminate).
return TRUE; return true;
} }

View File

@@ -29,7 +29,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxCheckListBoxXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxCheckListBoxXmlHandler, wxXmlResourceHandler)
wxCheckListBoxXmlHandler::wxCheckListBoxXmlHandler() wxCheckListBoxXmlHandler::wxCheckListBoxXmlHandler()
: wxXmlResourceHandler(), m_insideBox(FALSE) : wxXmlResourceHandler(), m_insideBox(false)
{ {
// no styles // no styles
AddWindowStyles(); AddWindowStyles();
@@ -48,7 +48,7 @@ wxObject *wxCheckListBoxXmlHandler::DoCreateResource()
wxLogDebug(wxT("'wxCheckList' name is deprecated, use 'wxCheckListBox' instead.")); wxLogDebug(wxT("'wxCheckList' name is deprecated, use 'wxCheckListBox' instead."));
#endif #endif
// need to build the list of strings from children // need to build the list of strings from children
m_insideBox = TRUE; m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL; wxString *strings = (wxString *) NULL;
if (strList.GetCount() > 0) if (strList.GetCount() > 0)
@@ -84,7 +84,7 @@ wxObject *wxCheckListBoxXmlHandler::DoCreateResource()
wxString v = n->GetPropVal(wxT("checked"), wxEmptyString); wxString v = n->GetPropVal(wxT("checked"), wxEmptyString);
v.MakeLower(); v.MakeLower();
if (v && v == wxT("1")) if (v && v == wxT("1"))
control->Check( i, TRUE ); control->Check( i, true );
i++; i++;
n = n->GetNext(); n = n->GetNext();

View File

@@ -26,7 +26,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxChoiceXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxChoiceXmlHandler, wxXmlResourceHandler)
wxChoiceXmlHandler::wxChoiceXmlHandler() wxChoiceXmlHandler::wxChoiceXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE) : wxXmlResourceHandler() , m_insideBox(false)
{ {
XRC_ADD_STYLE(wxCB_SORT); XRC_ADD_STYLE(wxCB_SORT);
AddWindowStyles(); AddWindowStyles();
@@ -40,7 +40,7 @@ wxObject *wxChoiceXmlHandler::DoCreateResource()
long selection = GetLong(wxT("selection"), -1); long selection = GetLong(wxT("selection"), -1);
// need to build the list of strings from children // need to build the list of strings from children
m_insideBox = TRUE; m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL; wxString *strings = (wxString *) NULL;
if (strList.GetCount() > 0) if (strList.GetCount() > 0)

View File

@@ -28,7 +28,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxComboBoxXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxComboBoxXmlHandler, wxXmlResourceHandler)
wxComboBoxXmlHandler::wxComboBoxXmlHandler() wxComboBoxXmlHandler::wxComboBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE) : wxXmlResourceHandler() , m_insideBox(false)
{ {
XRC_ADD_STYLE(wxCB_SIMPLE); XRC_ADD_STYLE(wxCB_SIMPLE);
XRC_ADD_STYLE(wxCB_SORT); XRC_ADD_STYLE(wxCB_SORT);
@@ -45,7 +45,7 @@ wxObject *wxComboBoxXmlHandler::DoCreateResource()
long selection = GetLong( wxT("selection"), -1 ); long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children // need to build the list of strings from children
m_insideBox = TRUE; m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL; wxString *strings = (wxString *) NULL;
if (strList.GetCount() > 0) if (strList.GetCount() > 0)

View File

@@ -70,7 +70,7 @@ wxObject *wxDialogXmlHandler::DoCreateResource()
CreateChildren(dlg); CreateChildren(dlg);
if (GetBool(wxT("centered"), FALSE)) if (GetBool(wxT("centered"), false))
dlg->Centre(); dlg->Centre();
return dlg; return dlg;

View File

@@ -75,7 +75,7 @@ wxObject *wxFrameXmlHandler::DoCreateResource()
CreateChildren(frame); CreateChildren(frame);
if (GetBool(wxT("centered"), FALSE)) if (GetBool(wxT("centered"), false))
frame->Centre(); frame->Centre();
return frame; return frame;

View File

@@ -26,7 +26,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxListBoxXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxListBoxXmlHandler, wxXmlResourceHandler)
wxListBoxXmlHandler::wxListBoxXmlHandler() wxListBoxXmlHandler::wxListBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE) : wxXmlResourceHandler() , m_insideBox(false)
{ {
XRC_ADD_STYLE(wxLB_SINGLE); XRC_ADD_STYLE(wxLB_SINGLE);
XRC_ADD_STYLE(wxLB_MULTIPLE); XRC_ADD_STYLE(wxLB_MULTIPLE);
@@ -46,7 +46,7 @@ wxObject *wxListBoxXmlHandler::DoCreateResource()
long selection = GetLong(wxT("selection"), -1); long selection = GetLong(wxT("selection"), -1);
// need to build the list of strings from children // need to build the list of strings from children
m_insideBox = TRUE; m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL; wxString *strings = (wxString *) NULL;
if (strList.GetCount() > 0) if (strList.GetCount() > 0)

View File

@@ -26,7 +26,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxMenuXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxMenuXmlHandler, wxXmlResourceHandler)
wxMenuXmlHandler::wxMenuXmlHandler() : wxMenuXmlHandler::wxMenuXmlHandler() :
wxXmlResourceHandler(), m_insideMenu(FALSE) wxXmlResourceHandler(), m_insideMenu(false)
{ {
XRC_ADD_STYLE(wxMENU_TEAROFF); XRC_ADD_STYLE(wxMENU_TEAROFF);
} }
@@ -40,8 +40,8 @@ wxObject *wxMenuXmlHandler::DoCreateResource()
wxString help = GetText(wxT("help")); wxString help = GetText(wxT("help"));
bool oldins = m_insideMenu; bool oldins = m_insideMenu;
m_insideMenu = TRUE; m_insideMenu = true;
CreateChildren(menu, TRUE/*only this handler*/); CreateChildren(menu, true/*only this handler*/);
m_insideMenu = oldins; m_insideMenu = oldins;
wxMenuBar *p_bar = wxDynamicCast(m_parent, wxMenuBar); wxMenuBar *p_bar = wxDynamicCast(m_parent, wxMenuBar);
@@ -69,7 +69,7 @@ wxObject *wxMenuXmlHandler::DoCreateResource()
{ {
int id = GetID(); int id = GetID();
wxString label = GetText(wxT("label")); wxString label = GetText(wxT("label"));
wxString accel = GetText(wxT("accel"), FALSE); wxString accel = GetText(wxT("accel"), false);
wxString fullLabel = label; wxString fullLabel = label;
if (!accel.IsEmpty()) if (!accel.IsEmpty())
fullLabel << wxT("\t") << accel; fullLabel << wxT("\t") << accel;
@@ -91,7 +91,7 @@ wxObject *wxMenuXmlHandler::DoCreateResource()
mitem->SetBitmap(GetBitmap(wxT("bitmap"), wxART_MENU)); mitem->SetBitmap(GetBitmap(wxT("bitmap"), wxART_MENU));
#endif #endif
p_menu->Append(mitem); p_menu->Append(mitem);
mitem->Enable(GetBool(wxT("enabled"), TRUE)); mitem->Enable(GetBool(wxT("enabled"), true));
if (kind == wxITEM_CHECK) if (kind == wxITEM_CHECK)
mitem->Check(GetBool(wxT("checked"))); mitem->Check(GetBool(wxT("checked")));
} }

View File

@@ -30,7 +30,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxNotebookXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxNotebookXmlHandler, wxXmlResourceHandler)
wxNotebookXmlHandler::wxNotebookXmlHandler() wxNotebookXmlHandler::wxNotebookXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_notebook(NULL) : wxXmlResourceHandler(), m_isInside(false), m_notebook(NULL)
{ {
XRC_ADD_STYLE(wxNB_FIXEDWIDTH); XRC_ADD_STYLE(wxNB_FIXEDWIDTH);
XRC_ADD_STYLE(wxNB_LEFT); XRC_ADD_STYLE(wxNB_LEFT);
@@ -51,7 +51,7 @@ wxObject *wxNotebookXmlHandler::DoCreateResource()
if (n) if (n)
{ {
bool old_ins = m_isInside; bool old_ins = m_isInside;
m_isInside = FALSE; m_isInside = false;
wxObject *item = CreateResFromNode(n, m_notebook, NULL); wxObject *item = CreateResFromNode(n, m_notebook, NULL);
m_isInside = old_ins; m_isInside = old_ins;
wxWindow *wnd = wxDynamicCast(item, wxWindow); wxWindow *wnd = wxDynamicCast(item, wxWindow);
@@ -83,12 +83,12 @@ wxObject *wxNotebookXmlHandler::DoCreateResource()
wxNotebook *old_par = m_notebook; wxNotebook *old_par = m_notebook;
m_notebook = nb; m_notebook = nb;
bool old_ins = m_isInside; bool old_ins = m_isInside;
m_isInside = TRUE; m_isInside = true;
CreateChildren(m_notebook, TRUE/*only this handler*/); CreateChildren(m_notebook, true/*only this handler*/);
m_isInside = old_ins; m_isInside = old_ins;
m_notebook = old_par; m_notebook = old_par;
if (GetBool(wxT("usenotebooksizer"), FALSE)) if (GetBool(wxT("usenotebooksizer"), false))
return new wxNotebookSizer(nb); return new wxNotebookSizer(nb);
else else
return nb; return nb;

View File

@@ -28,7 +28,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxRadioBoxXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxRadioBoxXmlHandler, wxXmlResourceHandler)
wxRadioBoxXmlHandler::wxRadioBoxXmlHandler() wxRadioBoxXmlHandler::wxRadioBoxXmlHandler()
: wxXmlResourceHandler(), m_insideBox(FALSE) : wxXmlResourceHandler(), m_insideBox(false)
{ {
XRC_ADD_STYLE(wxRA_SPECIFY_COLS); XRC_ADD_STYLE(wxRA_SPECIFY_COLS);
XRC_ADD_STYLE(wxRA_HORIZONTAL); XRC_ADD_STYLE(wxRA_HORIZONTAL);
@@ -45,7 +45,7 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource()
long selection = GetLong( wxT("selection"), -1 ); long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children // need to build the list of strings from children
m_insideBox = TRUE; m_insideBox = true;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content"))); CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL; wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 ) if( strList.GetCount() > 0 )

View File

@@ -36,8 +36,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxSizerXmlHandler, wxXmlResourceHandler)
wxSizerXmlHandler::wxSizerXmlHandler() wxSizerXmlHandler::wxSizerXmlHandler()
: wxXmlResourceHandler(), : wxXmlResourceHandler(),
m_isInside(FALSE), m_isInside(false),
m_isGBS(FALSE), m_isGBS(false),
m_parentSizer(NULL) m_parentSizer(NULL)
{ {
XRC_ADD_STYLE(wxHORIZONTAL); XRC_ADD_STYLE(wxHORIZONTAL);
@@ -127,7 +127,7 @@ wxObject* wxSizerXmlHandler::Handle_sizeritem()
bool old_gbs = m_isGBS; bool old_gbs = m_isGBS;
bool old_ins = m_isInside; bool old_ins = m_isInside;
wxSizer *old_par = m_parentSizer; wxSizer *old_par = m_parentSizer;
m_isInside = FALSE; m_isInside = false;
if (!IsSizerNode(n)) m_parentSizer = NULL; if (!IsSizerNode(n)) m_parentSizer = NULL;
wxObject *item = CreateResFromNode(n, m_parent, NULL); wxObject *item = CreateResFromNode(n, m_parent, NULL);
m_isInside = old_ins; m_isInside = old_ins;
@@ -212,10 +212,10 @@ wxObject* wxSizerXmlHandler::Handle_sizer()
// set new state // set new state
m_parentSizer = sizer; m_parentSizer = sizer;
m_isInside = TRUE; m_isInside = true;
m_isGBS = (m_class == wxT("wxGridBagSizer")); m_isGBS = (m_class == wxT("wxGridBagSizer"));
CreateChildren(m_parent, TRUE/*only this handler*/); CreateChildren(m_parent, true/*only this handler*/);
// restore state // restore state
m_isInside = old_ins; m_isInside = old_ins;
@@ -223,7 +223,7 @@ wxObject* wxSizerXmlHandler::Handle_sizer()
if (m_parentSizer == NULL) // setup window: if (m_parentSizer == NULL) // setup window:
{ {
m_parentAsWindow->SetAutoLayout(TRUE); m_parentAsWindow->SetAutoLayout(true);
m_parentAsWindow->SetSizer(sizer); m_parentAsWindow->SetSizer(sizer);
wxXmlNode *nd = m_node; wxXmlNode *nd = m_node;

View File

@@ -28,7 +28,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxToolBarXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxToolBarXmlHandler, wxXmlResourceHandler)
wxToolBarXmlHandler::wxToolBarXmlHandler() wxToolBarXmlHandler::wxToolBarXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_toolbar(NULL) : wxXmlResourceHandler(), m_isInside(false), m_toolbar(NULL)
{ {
XRC_ADD_STYLE(wxTB_FLAT); XRC_ADD_STYLE(wxTB_FLAT);
XRC_ADD_STYLE(wxTB_DOCKABLE); XRC_ADD_STYLE(wxTB_DOCKABLE);
@@ -124,7 +124,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
if (children_node == NULL) return toolbar; if (children_node == NULL) return toolbar;
m_isInside = TRUE; m_isInside = true;
m_toolbar = toolbar; m_toolbar = toolbar;
wxXmlNode *n = children_node; wxXmlNode *n = children_node;
@@ -144,7 +144,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
n = n->GetNext(); n = n->GetNext();
} }
m_isInside = FALSE; m_isInside = false;
m_toolbar = NULL; m_toolbar = NULL;
toolbar->Realize(); toolbar->Realize();

View File

@@ -31,7 +31,7 @@ class wxUnknownControlContainer : public wxPanel
public: public:
wxUnknownControlContainer(wxWindow *parent, wxUnknownControlContainer(wxWindow *parent,
const wxString& controlName, const wxString& controlName,
wxWindowID id = -1, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = 0) long style = 0)
@@ -95,7 +95,7 @@ wxObject *wxUnknownWidgetXmlHandler::DoCreateResource()
wxPanel *panel = wxPanel *panel =
new wxUnknownControlContainer(m_parentAsWindow, new wxUnknownControlContainer(m_parentAsWindow,
GetName(), -1, GetName(), wxID_ANY,
GetPosition(), GetSize(), GetPosition(), GetSize(),
GetStyle(wxT("style"))); GetStyle(wxT("style")));
SetupWindow(panel); SetupWindow(panel);

View File

@@ -82,7 +82,7 @@ bool wxXmlResource::Load(const wxString& filemask)
wxString fnd; wxString fnd;
wxXmlResourceDataRecord *drec; wxXmlResourceDataRecord *drec;
bool iswild = wxIsWild(filemask); bool iswild = wxIsWild(filemask);
bool rt = TRUE; bool rt = true;
#if wxUSE_FILESYSTEM #if wxUSE_FILESYSTEM
wxFileSystem fsys; wxFileSystem fsys;
@@ -260,7 +260,7 @@ bool wxXmlResource::AttachUnknownControl(const wxString& name,
if (!container) if (!container)
{ {
wxLogError(_("Cannot find container for unknown control '%s'."), name.c_str()); wxLogError(_("Cannot find container for unknown control '%s'."), name.c_str());
return FALSE; return false;
} }
return control->Reparent(container); return control->Reparent(container);
} }
@@ -274,9 +274,9 @@ static void ProcessPlatformProperty(wxXmlNode *node)
wxXmlNode *c = node->GetChildren(); wxXmlNode *c = node->GetChildren();
while (c) while (c)
{ {
isok = FALSE; isok = false;
if (!c->GetPropVal(wxT("platform"), &s)) if (!c->GetPropVal(wxT("platform"), &s))
isok = TRUE; isok = true;
else else
{ {
wxStringTokenizer tkn(s, wxT(" |")); wxStringTokenizer tkn(s, wxT(" |"));
@@ -366,8 +366,8 @@ bool wxXmlResource::UpdateResources()
# if wxUSE_FILESYSTEM # if wxUSE_FILESYSTEM
file = fsys.OpenFile(m_data[i].File); file = fsys.OpenFile(m_data[i].File);
if (file) if (file)
stream = file->GetStream(); stream = file->GetStream();
# else # else
stream = new wxFileInputStream(m_data[i].File); stream = new wxFileInputStream(m_data[i].File);
# endif # endif
@@ -391,7 +391,7 @@ bool wxXmlResource::UpdateResources()
rt = false; rt = false;
} }
else else
{ {
long version; long version;
int v1, v2, v3, v4; int v1, v2, v3, v4;
wxString verstr = m_data[i].Doc->GetRoot()->GetPropVal( wxString verstr = m_data[i].Doc->GetRoot()->GetPropVal(
@@ -411,17 +411,17 @@ bool wxXmlResource::UpdateResources()
ProcessPlatformProperty(m_data[i].Doc->GetRoot()); ProcessPlatformProperty(m_data[i].Doc->GetRoot());
#if wxUSE_FILESYSTEM #if wxUSE_FILESYSTEM
m_data[i].Time = file->GetModificationTime(); m_data[i].Time = file->GetModificationTime();
#else #else
m_data[i].Time = wxDateTime(wxFileModificationTime(m_data[i].File)); m_data[i].Time = wxDateTime(wxFileModificationTime(m_data[i].File));
#endif #endif
} }
# if wxUSE_FILESYSTEM # if wxUSE_FILESYSTEM
wxDELETE(file); wxDELETE(file);
wxUnusedVar(file); wxUnusedVar(file);
# else # else
wxDELETE(stream); wxDELETE(stream);
# endif # endif
} }
} }
@@ -456,7 +456,7 @@ wxXmlNode *wxXmlResource::DoFindResource(wxXmlNode *parent,
wxString refName = node->GetPropVal(wxT("ref"), wxEmptyString); wxString refName = node->GetPropVal(wxT("ref"), wxEmptyString);
if (refName.empty()) if (refName.empty())
continue; continue;
wxXmlNode* refNode = FindResource(refName, wxEmptyString, TRUE); wxXmlNode* refNode = FindResource(refName, wxEmptyString, true);
if (refNode && if (refNode &&
refNode->GetPropVal(wxT("class"), wxEmptyString) == classname) refNode->GetPropVal(wxT("class"), wxEmptyString) == classname)
{ {
@@ -473,7 +473,7 @@ wxXmlNode *wxXmlResource::DoFindResource(wxXmlNode *parent,
(node->GetName() == wxT("object") || (node->GetName() == wxT("object") ||
node->GetName() == wxT("object_ref")) ) node->GetName() == wxT("object_ref")) )
{ {
wxXmlNode* found = DoFindResource(node, name, classname, TRUE); wxXmlNode* found = DoFindResource(node, name, classname, true);
if ( found ) if ( found )
return found; return found;
} }
@@ -565,7 +565,7 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent,
if ( node->GetName() == wxT("object_ref") ) if ( node->GetName() == wxT("object_ref") )
{ {
wxString refName = node->GetPropVal(wxT("ref"), wxEmptyString); wxString refName = node->GetPropVal(wxT("ref"), wxEmptyString);
wxXmlNode* refNode = FindResource(refName, wxEmptyString, TRUE); wxXmlNode* refNode = FindResource(refName, wxEmptyString, true);
if ( !refNode ) if ( !refNode )
{ {
@@ -1090,7 +1090,7 @@ wxFont wxXmlResourceHandler::GetFont(const wxString& param)
else if (family == wxT("swiss")) ifamily = wxSWISS; else if (family == wxT("swiss")) ifamily = wxSWISS;
else if (family == wxT("modern")) ifamily = wxMODERN; else if (family == wxT("modern")) ifamily = wxMODERN;
bool underlined = GetBool(wxT("underlined"), FALSE); bool underlined = GetBool(wxT("underlined"), false);
wxString encoding = GetParamValue(wxT("encoding")); wxString encoding = GetParamValue(wxT("encoding"));
wxFontMapper mapper; wxFontMapper mapper;
@@ -1107,7 +1107,7 @@ wxFont wxXmlResourceHandler::GetFont(const wxString& param)
wxStringTokenizer tk(faces, wxT(",")); wxStringTokenizer tk(faces, wxT(","));
while (tk.HasMoreTokens()) while (tk.HasMoreTokens())
{ {
int index = enu.GetFacenames()->Index(tk.GetNextToken(), FALSE); int index = enu.GetFacenames()->Index(tk.GetNextToken(), false);
if (index != wxNOT_FOUND) if (index != wxNOT_FOUND)
{ {
facename = (*enu.GetFacenames())[index]; facename = (*enu.GetFacenames())[index];
@@ -1136,11 +1136,11 @@ void wxXmlResourceHandler::SetupWindow(wxWindow *wnd)
if (HasParam(wxT("fg"))) if (HasParam(wxT("fg")))
wnd->SetForegroundColour(GetColour(wxT("fg"))); wnd->SetForegroundColour(GetColour(wxT("fg")));
if (GetBool(wxT("enabled"), 1) == 0) if (GetBool(wxT("enabled"), 1) == 0)
wnd->Enable(FALSE); wnd->Enable(false);
if (GetBool(wxT("focused"), 0) == 1) if (GetBool(wxT("focused"), 0) == 1)
wnd->SetFocus(); wnd->SetFocus();
if (GetBool(wxT("hidden"), 0) == 1) if (GetBool(wxT("hidden"), 0) == 1)
wnd->Show(FALSE); wnd->Show(false);
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
if (HasParam(wxT("tooltip"))) if (HasParam(wxT("tooltip")))
wnd->SetToolTip(GetText(wxT("tooltip"))); wnd->SetToolTip(GetText(wxT("tooltip")));
@@ -1309,7 +1309,7 @@ public:
{ {
AddStdXRCID_Records(); AddStdXRCID_Records();
wxXmlResource::AddSubclassFactory(new wxXmlSubclassFactoryCXX); wxXmlResource::AddSubclassFactory(new wxXmlSubclassFactoryCXX);
return TRUE; return true;
} }
void OnExit() void OnExit()
{ {

View File

@@ -58,17 +58,17 @@ bool wxConvertApp::OnInit()
SetAppName(_T("wxConvertApp")); SetAppName(_T("wxConvertApp"));
if (HandleCommandLine()) if (HandleCommandLine())
return TRUE; return true;
// Create the main frame window // Create the main frame window
m_pFrame = new wxMainFrame(NULL, -1, _T("wxConvertApp"), wxPoint(0, 0), wxSize(500, 400), m_pFrame = new wxMainFrame(NULL, wxID_ANY, _T("wxConvertApp"), wxPoint(0, 0), wxSize(500, 400),
wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL); wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL);
InitMenu(); InitMenu();
m_pFrame->Show(TRUE); m_pFrame->Show(true);
SetTopWindow(m_pFrame); SetTopWindow(m_pFrame);
return TRUE; return true;
} }
void wxConvertApp::InitMenu() void wxConvertApp::InitMenu()
@@ -122,7 +122,7 @@ wxMainFrame::~wxMainFrame()
void wxMainFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void wxMainFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{ {
Close(TRUE); Close(true);
} }
@@ -192,7 +192,7 @@ bool wxConvertApp::HandleCommandLine()
{ {
if (argc != 2) if (argc != 2)
return FALSE; return false;
//Figure out kind of conversion //Figure out kind of conversion
wxString source,target; wxString source,target;
@@ -208,18 +208,18 @@ bool wxConvertApp::HandleCommandLine()
if ((source.Find(_T(".wxr"))>0)&&(target.Find(_T(".xml"))>0)) if ((source.Find(_T(".wxr"))>0)&&(target.Find(_T(".xml"))>0))
{ {
trans_wxr2xml.Convert(source,target); trans_wxr2xml.Convert(source,target);
return TRUE; return true;
} }
else if ((source.Find(_T(".rc"))!=-1)&(target.Find(_T(".wxr"))!=-1)) else if ((source.Find(_T(".rc"))!=wxNOT_FOUND)&(target.Find(_T(".wxr"))!=wxNOT_FOUND))
{ {
trans_rc2wxr.Convert(source,target); trans_rc2wxr.Convert(source,target);
return TRUE; return true;
} }
else if ((source.Find(_T(".rc"))!=-1)&(target.Find(_T(".xml"))!=-1)) else if ((source.Find(_T(".rc"))!=wxNOT_FOUND)&(target.Find(_T(".xml"))!=wxNOT_FOUND))
{ {
trans_rc2xml.Convert(source,target); trans_rc2xml.Convert(source,target);
return TRUE; return true;
} }
return FALSE; return false;
} }

View File

@@ -77,7 +77,7 @@ rc2wxr::rc2wxr()
{ {
m_done=FALSE; m_done=false;
m_controlid=6000; m_controlid=6000;
@@ -511,7 +511,7 @@ bool rc2wxr::Seperator(int ch)
if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='|')) if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='|'))
return TRUE; return true;
@@ -519,13 +519,13 @@ if (ch==EOF)
{ {
m_done=TRUE; m_done=true;
return TRUE; return true;
} }
return FALSE; return false;
} }
@@ -595,7 +595,7 @@ if (m_rc.Eof())
{ {
m_done=TRUE; m_done=true;
return tok; return tok;
@@ -611,7 +611,7 @@ if (ch==EOF)
{ {
m_done=TRUE; m_done=true;
return tok; return tok;
@@ -637,7 +637,7 @@ if (ch==EOF)
{ {
m_done=TRUE; m_done=true;
@@ -663,7 +663,7 @@ ReadChar(ch);
if (ch==EOF) if (ch==EOF)
m_done=TRUE; m_done=true;
@@ -719,7 +719,7 @@ void rc2wxr::ReadChar(int &ch)
{ {
int result; int result;
result=m_rc.Tell(); result=m_rc.Tell();
@@ -727,7 +727,7 @@ result=m_rc.Tell();
if((result>=m_filesize)) if((result>=m_filesize))
m_done=TRUE; m_done=true;
@@ -737,13 +737,13 @@ result=m_rc.Read(&ch,1);
if((result==-1)) if((result==-1))
m_done=TRUE; m_done=true;
if(ch==EOF) if(ch==EOF)
m_done=TRUE; m_done=true;
} }
@@ -817,13 +817,13 @@ while ((tok!=_T("END"))&(tok!=_T("}")))
if (tok==_T("POPUP")) if (tok==_T("POPUP"))
{ {
ParsePopupMenu(); ParsePopupMenu();
wxFprintf(m_wxr,_T(" ],\\\n")); wxFprintf(m_wxr,_T(" ],\\\n"));
} }
} }
@@ -1043,7 +1043,7 @@ if (tok.IsNumber())
w=GetToken(); w=GetToken();
return TRUE; return true;
} }

View File

@@ -49,7 +49,7 @@ cross platform (wxGTK,etc)
rc2xml::rc2xml() rc2xml::rc2xml()
{ {
m_done=FALSE; m_done=false;
m_bitmaplist=new wxList(wxKEY_STRING); m_bitmaplist=new wxList(wxKEY_STRING);
m_stringtable=new wxList(wxKEY_STRING); m_stringtable=new wxList(wxKEY_STRING);
m_iconlist = new wxList(wxKEY_STRING); m_iconlist = new wxList(wxKEY_STRING);
@@ -83,7 +83,7 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile)
result=m_xmlfile.Open(xmlfile.c_str(),_T("w+t")); result=m_xmlfile.Open(xmlfile.c_str(),_T("w+t"));
wxASSERT_MSG(result,_T("Couldn't create XML file")); wxASSERT_MSG(result,_T("Couldn't create XML file"));
if (!result) if (!result)
return FALSE; return false;
/* Write Basic header for XML file */ /* Write Basic header for XML file */
@@ -94,7 +94,7 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile)
ParseResourceHeader(); ParseResourceHeader();
//Gather all the resource we need for toolbars,menus, and etc //Gather all the resource we need for toolbars,menus, and etc
FirstPass(); FirstPass();
m_done=FALSE; m_done=false;
m_rc.Seek(0); m_rc.Seek(0);
//Read in dialogs, toolbars,menus //Read in dialogs, toolbars,menus
SecondPass(); SecondPass();
@@ -105,7 +105,7 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile)
wxMessageBox(_("Conversion complete."), _("Done"), wxMessageBox(_("Conversion complete."), _("Done"),
wxOK | wxICON_INFORMATION); wxOK | wxICON_INFORMATION);
return TRUE; return true;
} }
@@ -308,9 +308,9 @@ void rc2xml::ParseRadioButton(wxString phrase, wxString varname)
bool GotOrs; bool GotOrs;
GotOrs = ReadOrs(token); GotOrs = ReadOrs(token);
if (ReadRect(x,y,width,height)) if (ReadRect(x,y,width,height))
if (GotOrs==FALSE) if (GotOrs==false)
ReadOrs(token); ReadOrs(token);
if (token.Find(_T("WS_GROUP")) != -1) if (token.Find(_T("WS_GROUP")) != wxNOT_FOUND)
style += _T("wxRB_GROUP"); style += _T("wxRB_GROUP");
m_xmlfile.Write(_T("\t\t<object class=\"wxRadioButton\"")); m_xmlfile.Write(_T("\t\t<object class=\"wxRadioButton\""));
@@ -347,15 +347,15 @@ bool rc2xml::Seperator(int ch)
{ {
//if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='|')|(ch=='\t')) //if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='|')|(ch=='\t'))
if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='\t')) if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='\t'))
return TRUE; return true;
if (ch==EOF) if (ch==EOF)
{ {
m_done=TRUE; m_done=true;
return TRUE; return true;
} }
return FALSE; return false;
} }
void rc2xml::ParseGroupBox(wxString phrase, wxString varname) void rc2xml::ParseGroupBox(wxString phrase, wxString varname)
@@ -394,7 +394,7 @@ wxString rc2xml::GetToken(bool *listseperator)
if (m_rc.Eof()) if (m_rc.Eof())
{ {
m_done=TRUE; m_done=true;
return token; return token;
} }
@@ -402,7 +402,7 @@ wxString rc2xml::GetToken(bool *listseperator)
ReadChar(ch); ReadChar(ch);
if (ch==EOF) if (ch==EOF)
{ {
m_done=TRUE; m_done=true;
return token; return token;
} }
@@ -415,7 +415,7 @@ wxString rc2xml::GetToken(bool *listseperator)
if (ch==EOF) if (ch==EOF)
{ {
m_done=TRUE; m_done=true;
} }
@@ -426,7 +426,7 @@ wxString rc2xml::GetToken(bool *listseperator)
} }
if (ch == EOF) if (ch == EOF)
m_done = TRUE; m_done = true;
if (listseperator) if (listseperator)
*listseperator = (ch == ','); *listseperator = (ch == ',');
@@ -458,14 +458,14 @@ wxString rc2xml::GetStringQuote()
{ {
wxString phrase; wxString phrase;
//ASCII code 34 " //ASCII code 34 "
bool done=FALSE; bool done=false;
int p,ch=0,lastch=0; int p,ch=0,lastch=0;
ReadChar(ch); ReadChar(ch);
while (ch!=34) while (ch!=34)
ReadChar(ch); ReadChar(ch);
ReadChar(ch); ReadChar(ch);
while (done==FALSE) while (done==false)
{ {
if ((ch==34)&&(lastch!='\\')) if ((ch==34)&&(lastch!='\\'))
{ {
@@ -477,10 +477,10 @@ wxString rc2xml::GetStringQuote()
else else
{ {
m_rc.Seek(p); m_rc.Seek(p);
done = TRUE; done = true;
} }
} }
if (done==TRUE) if (done==true)
break; break;
if (ch=='\r') if (ch=='\r')
ReadChar(ch); // skip ReadChar(ch); // skip
@@ -501,15 +501,15 @@ void rc2xml::ReadChar(int &ch)
result=m_rc.Tell(); result=m_rc.Tell();
if((result>=m_filesize)) if((result>=m_filesize))
m_done=TRUE; m_done=true;
result=m_rc.Read(&ch,1); result=m_rc.Read(&ch,1);
if((result==-1)) if((result==-1))
m_done=TRUE; m_done=true;
if(ch==EOF) if(ch==EOF)
m_done=TRUE; m_done=true;
} }
void rc2xml::ParseComboBox(wxString varname) void rc2xml::ParseComboBox(wxString varname)
@@ -521,16 +521,16 @@ void rc2xml::ParseComboBox(wxString varname)
bool GotOrs; bool GotOrs;
GotOrs = ReadOrs(token); GotOrs = ReadOrs(token);
if (ReadRect(x,y,width,height)) if (ReadRect(x,y,width,height))
if (GotOrs==FALSE) if (GotOrs==false)
ReadOrs(token); ReadOrs(token);
m_xmlfile.Write(_T("\t\t<object class=\"wxComboBox\"")); m_xmlfile.Write(_T("\t\t<object class=\"wxComboBox\""));
WriteBasicInfo(x,y,width,height,varname); WriteBasicInfo(x,y,width,height,varname);
if (token.Find(_T("CBS_SIMPLE")) != -1) if (token.Find(_T("CBS_SIMPLE")) != wxNOT_FOUND)
WriteStyle(_T("wxCB_SIMPLE")); WriteStyle(_T("wxCB_SIMPLE"));
if (token.Find(_T("CBS_SORT")) != -1) if (token.Find(_T("CBS_SORT")) != wxNOT_FOUND)
WriteStyle(_T("wxCB_SORT")); WriteStyle(_T("wxCB_SORT"));
if (token.Find(_T("CBS_DISABLENOSCROLL")) != -1) if (token.Find(_T("CBS_DISABLENOSCROLL")) != wxNOT_FOUND)
WriteStyle(_T("wxLB_ALWAYS_SB")); WriteStyle(_T("wxLB_ALWAYS_SB"));
m_xmlfile.Write(_T("\n\t\t</object>\n")); m_xmlfile.Write(_T("\n\t\t</object>\n"));
@@ -631,7 +631,7 @@ void rc2xml::ParseSlider(wxString WXUNUSED(label), wxString varname)
{ {
wxString token,style; wxString token,style;
ReadOrs(token); ReadOrs(token);
if (token.Find(_T("TBS_VERT"))!=-1) if (token.Find(_T("TBS_VERT"))!=wxNOT_FOUND)
style+=_T("wxSL_VERTICAL"); style+=_T("wxSL_VERTICAL");
//MFC RC Default is horizontal //MFC RC Default is horizontal
else else
@@ -670,7 +670,7 @@ bool rc2xml::ReadOrs(wxString & orstring)
token=PeekToken(); token=PeekToken();
if (token.IsNumber()) if (token.IsNumber())
return FALSE; return false;
orstring=GetToken(); orstring=GetToken();
while(PeekToken()==_T("|")) while(PeekToken()==_T("|"))
@@ -680,7 +680,7 @@ bool rc2xml::ReadOrs(wxString & orstring)
//Grab next token //Grab next token
orstring+=GetToken(); orstring+=GetToken();
} }
return TRUE; return true;
} }
//Is it a checkbutton or a radiobutton or a pushbutton or a groupbox //Is it a checkbutton or a radiobutton or a pushbutton or a groupbox
@@ -692,15 +692,15 @@ void rc2xml::ParseCtrlButton(wxString label, wxString varname)
ReadOrs(token); ReadOrs(token);
m_rc.Seek(p); m_rc.Seek(p);
if (token.Find(_T("BS_AUTOCHECKBOX"))!=-1) if (token.Find(_T("BS_AUTOCHECKBOX"))!=wxNOT_FOUND)
ParseCheckBox(label, varname); ParseCheckBox(label, varname);
else if ((token.Find(_T("BS_AUTORADIOBUTTON"))!=-1)|| else if ((token.Find(_T("BS_AUTORADIOBUTTON"))!=wxNOT_FOUND)||
(token.Find(_T("BS_RADIOBUTTON"))!=-1)) (token.Find(_T("BS_RADIOBUTTON"))!=wxNOT_FOUND))
ParseRadioButton(label, varname); ParseRadioButton(label, varname);
else if (token.Find(_T("BS_GROUPBOX"))!=-1) else if (token.Find(_T("BS_GROUPBOX"))!=wxNOT_FOUND)
ParseGroupBox(label, varname); ParseGroupBox(label, varname);
else // if ((token.Find("BS_PUSHBUTTON")!=-1)|| else // if ((token.Find("BS_PUSHBUTTON")!=wxNOT_FOUND)||
// (token.Find("BS_DEFPUSHBUTTON")!=-1)) // (token.Find("BS_DEFPUSHBUTTON")!=wxNOT_FOUND))
ParsePushButton(label, varname); // make default case ParsePushButton(label, varname); // make default case
} }
@@ -846,7 +846,7 @@ void rc2xml::ParseSpinCtrl(wxString WXUNUSED(label), wxString varname)
wxString token,style; wxString token,style;
ReadOrs(token); ReadOrs(token);
if (token.Find(_T("UDS_HORZ"))!=-1) if (token.Find(_T("UDS_HORZ"))!=wxNOT_FOUND)
style=_T("wxSP_HORIZONTAL"); style=_T("wxSP_HORIZONTAL");
//MFC default //MFC default
else else
@@ -928,7 +928,7 @@ void rc2xml::ParseToolBar(wxString varname)
wxLogError(_T("Unable to load bitmap:")+*bitmappath); wxLogError(_T("Unable to load bitmap:")+*bitmappath);
//Write toolbar to xml file //Write toolbar to xml file
m_xmlfile.Write(_T(" <object class=\"wxToolBar\"")); m_xmlfile.Write(_T("\t<object class=\"wxToolBar\""));
//Avoid duplicate names this way //Avoid duplicate names this way
varname.Replace(_T("IDR_"),_T("TB_")); varname.Replace(_T("IDR_"),_T("TB_"));
WriteName(varname); WriteName(varname);
@@ -962,7 +962,7 @@ void rc2xml::ParseToolBar(wxString varname)
{ {
SplitHelp(msg,tip,longhelp); SplitHelp(msg,tip,longhelp);
m_xmlfile.Write(_T("\t\t\t\t<tooltip>")+tip+_T("</tooltip>\n")); m_xmlfile.Write(_T("\t\t\t\t<tooltip>")+tip+_T("</tooltip>\n"));
m_xmlfile.Write(_T(" <longhelp>")+longhelp+_T("</longhelp>\n")); m_xmlfile.Write(_T("\t\t<longhelp>")+longhelp+_T("</longhelp>\n"));
} }
//Make a bitmap file name //Make a bitmap file name
buttonname=CleanName(buttonname); buttonname=CleanName(buttonname);
@@ -1016,19 +1016,19 @@ bool rc2xml::LookUpString(wxString strid,wxString & st)
wxNode *node=m_stringtable->Find(strid); wxNode *node=m_stringtable->Find(strid);
wxString *s; wxString *s;
if (node==NULL) if (node==NULL)
return FALSE; return false;
s=(wxString *)node->GetData(); s=(wxString *)node->GetData();
st=*s; st=*s;
return TRUE; return true;
} }
bool rc2xml::SplitHelp(wxString msg, wxString &shorthelp, wxString &longhelp) bool rc2xml::SplitHelp(wxString msg, wxString &shorthelp, wxString &longhelp)
{ {
int spot; int spot;
spot=msg.Find(_T("\\n")); spot=msg.Find(_T("\\n"));
if (spot==-1) if (spot==wxNOT_FOUND)
{ {
shorthelp=msg; shorthelp=msg;
longhelp=msg; longhelp=msg;
@@ -1037,7 +1037,7 @@ bool rc2xml::SplitHelp(wxString msg, wxString &shorthelp, wxString &longhelp)
longhelp=msg.Left(spot); longhelp=msg.Left(spot);
spot=msg.Length()-spot-2; spot=msg.Length()-spot-2;
shorthelp=msg.Right(spot); shorthelp=msg.Right(spot);
return TRUE; return true;
} }
void rc2xml::ParseMenuItem() void rc2xml::ParseMenuItem()
@@ -1191,7 +1191,7 @@ kindctrl.MakeUpper();
int p=m_rc.Tell(); int p=m_rc.Tell();
ReadOrs(token); ReadOrs(token);
m_rc.Seek(p); m_rc.Seek(p);
if (token.Find(_T("SS_BITMAP"))!=-1) if (token.Find(_T("SS_BITMAP"))!=wxNOT_FOUND)
ParseStaticBitmap(label,varname); ParseStaticBitmap(label,varname);
else else
ParseStaticText(label,varname); ParseStaticText(label,varname);
@@ -1238,7 +1238,7 @@ void rc2xml::ParseScrollBar()
ReadOrs(token); ReadOrs(token);
if (token.Find(_T("SBS_VERT"))!=-1) if (token.Find(_T("SBS_VERT"))!=wxNOT_FOUND)
style=_T("wxSB_VERTICAL"); style=_T("wxSB_VERTICAL");
//Default MFC style is horizontal //Default MFC style is horizontal
else else
@@ -1377,7 +1377,7 @@ wxTextFile r;
//Read through entire file //Read through entire file
for ( str = r.GetFirstLine(); !r.Eof(); str = r.GetNextLine() ) for ( str = r.GetFirstLine(); !r.Eof(); str = r.GetNextLine() )
{ {
if (str.Find(_T("#define"))!=-1) if (str.Find(_T("#define"))!=wxNOT_FOUND)
{ {
tok.SetString(str); tok.SetString(str);
//Just ignore #define token //Just ignore #define token

View File

@@ -22,7 +22,7 @@ public:
~rc2xml(); ~rc2xml();
protected: protected:
wxString LookUpId(wxString id); wxString LookUpId(wxString id);
void ParseResourceHeader(); void ParseResourceHeader();
void WriteBitmap(wxString bitmapname); void WriteBitmap(wxString bitmapname);

View File

@@ -48,12 +48,12 @@ bool wxr2xml::Convert(wxString wxrfile, wxString xmlfile)
result = m_xmlfile.Open(xmlfile.c_str(), _T("w+t")); result = m_xmlfile.Open(xmlfile.c_str(), _T("w+t"));
wxASSERT_MSG(result, _T("Couldn't create XML file")); wxASSERT_MSG(result, _T("Couldn't create XML file"));
if (!result) if (!result)
return FALSE; return false;
result = m_table.ParseResourceFile(wxrfile); result = m_table.ParseResourceFile(wxrfile);
wxASSERT_MSG(result, _T("Couldn't Load WXR file")); wxASSERT_MSG(result, _T("Couldn't Load WXR file"));
if (!result) if (!result)
return FALSE; return false;
// Write basic xml header // Write basic xml header
m_xmlfile.Write(_T("<?xml version=\"1.0\" ?>\n")); m_xmlfile.Write(_T("<?xml version=\"1.0\" ?>\n"));
m_xmlfile.Write(_T("<resource>\n")); m_xmlfile.Write(_T("<resource>\n"));
@@ -89,7 +89,7 @@ bool wxr2xml::ParseResources()
wxLogError(_T("Found unsupported resource ") + resType); wxLogError(_T("Found unsupported resource ") + resType);
node = m_table.Next(); node = m_table.Next();
} }
return TRUE; return true;
} }
void wxr2xml::ParsePanel(wxItemResource * res) void wxr2xml::ParsePanel(wxItemResource * res)
@@ -632,10 +632,10 @@ void wxr2xml::ParseMenuItem(wxItemResource * res)
menuname << _T("name = \"menuitem_") << res->GetValue1() << _T("\""); menuname << _T("name = \"menuitem_") << res->GetValue1() << _T("\"");
m_xmlfile.Write(menuname); m_xmlfile.Write(menuname);
m_xmlfile.Write(_T(">\n")); m_xmlfile.Write(_T(">\n"));
m_xmlfile.Write(_T(" <label>") m_xmlfile.Write(_T("\t\t\t<label>")
+ FixMenuString(res->GetTitle()) + _T("</label>\n")); + FixMenuString(res->GetTitle()) + _T("</label>\n"));
if (res->GetValue4() != _T("")) if (res->GetValue4() != _T(""))
m_xmlfile.Write(_T(" <help>") + m_xmlfile.Write(_T("\t\t\t<help>") +
res->GetValue4() + _T("</help>\n")); res->GetValue4() + _T("</help>\n"));
if (res->GetValue2()) if (res->GetValue2())
m_xmlfile.Write(_T("\t\t\t\t<checkable>1</checkable>\n")); m_xmlfile.Write(_T("\t\t\t\t<checkable>1</checkable>\n"));
@@ -682,16 +682,16 @@ void wxr2xml::ParseBitmap(wxItemResource * res)
void wxr2xml::PanelStuff(wxItemResource * res) void wxr2xml::PanelStuff(wxItemResource * res)
{ {
if ((res->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0) if ((res->GetResourceStyle() & wxRESOURCE_DIALOG_UNITS) != 0)
m_dlgunits = TRUE; m_dlgunits = true;
else else
m_dlgunits = FALSE; m_dlgunits = false;
// If this is true ignore fonts, background color and use system // If this is true ignore fonts, background color and use system
// defaults instead // defaults instead
if ((res->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0) if ((res->GetResourceStyle() & wxRESOURCE_USE_DEFAULTS) != 0)
m_systemdefaults = TRUE; m_systemdefaults = true;
else else
m_systemdefaults = FALSE; m_systemdefaults = false;
} }

View File

@@ -378,11 +378,11 @@ static bool NodeContainsFilename(wxXmlNode *node)
{ {
// Any bitmaps: // Any bitmaps:
if (node->GetName() == _T("bitmap")) if (node->GetName() == _T("bitmap"))
return TRUE; return true;
// URLs in wxHtmlWindow: // URLs in wxHtmlWindow:
if (node->GetName() == _T("url")) if (node->GetName() == _T("url"))
return TRUE; return true;
// wxBitmapButton: // wxBitmapButton:
wxXmlNode *parent = node->GetParent(); wxXmlNode *parent = node->GetParent();
@@ -391,17 +391,17 @@ static bool NodeContainsFilename(wxXmlNode *node)
(node->GetName() == _T("focus") || (node->GetName() == _T("focus") ||
node->GetName() == _T("disabled") || node->GetName() == _T("disabled") ||
node->GetName() == _T("selected"))) node->GetName() == _T("selected")))
return TRUE; return true;
// wxBitmap or wxIcon toplevel resources: // wxBitmap or wxIcon toplevel resources:
if (node->GetName() == _T("object")) if (node->GetName() == _T("object"))
{ {
wxString klass = node->GetPropVal(_T("class"), wxEmptyString); wxString klass = node->GetPropVal(_T("class"), wxEmptyString);
if (klass == _T("wxBitmap") || klass == _T("wxIcon")) if (klass == _T("wxBitmap") || klass == _T("wxIcon"))
return TRUE; return true;
} }
return FALSE; return false;
} }
// find all files mentioned in structure, e.g. <bitmap>filename</bitmap> // find all files mentioned in structure, e.g. <bitmap>filename</bitmap>
@@ -473,7 +473,7 @@ void XmlResApp::MakePackageZIP(const wxArrayString& flist)
wxSetWorkingDirectory(parOutputPath); wxSetWorkingDirectory(parOutputPath);
int execres = wxExecute(_T("zip -9 -j ") + int execres = wxExecute(_T("zip -9 -j ") +
wxString(flagVerbose ? _T("") : _T("-q ")) + wxString(flagVerbose ? _T("") : _T("-q ")) +
parOutput + _T(" ") + files, TRUE); parOutput + _T(" ") + files, true);
wxSetWorkingDirectory(cwd); wxSetWorkingDirectory(cwd);
if (execres == -1) if (execres == -1)
{ {

View File

@@ -53,9 +53,9 @@ bool MyApp::OnInit()
wxInitAllImageHandlers(); wxInitAllImageHandlers();
wxFrame *frame = new EditorFrame(NULL, arg); wxFrame *frame = new EditorFrame(NULL, arg);
SetTopWindow(frame); SetTopWindow(frame);
frame->Show(TRUE); frame->Show(true);
PreviewFrame::Get()->Show(TRUE); PreviewFrame::Get()->Show(true);
PropertiesFrame::Get()->Show(TRUE); PropertiesFrame::Get()->Show(true);
return TRUE; return true;
} }

View File

@@ -141,7 +141,7 @@ enum
ID_COPY, ID_COPY,
ID_NEWDIALOG, ID_NEWDIALOG,
ID_NEWFRAME, ID_NEWFRAME,
ID_NEWPANEL, ID_NEWPANEL,
ID_NEWMENU, ID_NEWMENU,
ID_NEWMENUBAR, ID_NEWMENUBAR,
@@ -183,16 +183,16 @@ END_EVENT_TABLE()
EditorFrame *EditorFrame::ms_Instance = NULL; EditorFrame *EditorFrame::ms_Instance = NULL;
EditorFrame::EditorFrame(wxFrame *parent, const wxString& filename) EditorFrame::EditorFrame(wxFrame *parent, const wxString& filename)
: wxFrame(parent, -1, filename + _("- wxWidgets resources editor")) : wxFrame(parent, wxID_ANY, filename + _("- wxWidgets resources editor"))
{ {
ms_Instance = this; ms_Instance = this;
m_Clipboard = NULL; m_Clipboard = NULL;
m_Modified = FALSE; m_Modified = false;
wxConfigBase *cfg = wxConfigBase::Get(); wxConfigBase *cfg = wxConfigBase::Get();
SetSize(wxRect(wxPoint(cfg->Read(_T("editor_x"), -1), cfg->Read(_T("editor_y"), -1)), SetSize(wxRect(wxPoint(cfg->Read(_T("editor_x"), wxDefaultPosition.x), cfg->Read(_T("editor_y"), wxDefaultPosition.y)),
wxSize(cfg->Read(_T("editor_w"), 400), cfg->Read(_T("editor_h"), 400)))); wxSize(cfg->Read(_T("editor_w"), 400), cfg->Read(_T("editor_h"), 400))));
m_SelectedNode = NULL; m_SelectedNode = NULL;
@@ -215,8 +215,8 @@ EditorFrame::EditorFrame(wxFrame *parent, const wxString& filename)
menuEdit->AppendSeparator(); menuEdit->AppendSeparator();
menuEdit->Append(ID_DELETE_NODE, _T("Delete")); menuEdit->Append(ID_DELETE_NODE, _T("Delete"));
menuEdit->Enable(ID_PASTE_SYBLING, FALSE); menuEdit->Enable(ID_PASTE_SYBLING, false);
menuEdit->Enable(ID_PASTE_CHILD, FALSE); menuEdit->Enable(ID_PASTE_CHILD, false);
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, _T("&File")); menuBar->Append(menuFile, _T("&File"));
@@ -228,16 +228,16 @@ EditorFrame::EditorFrame(wxFrame *parent, const wxString& filename)
toolBar->SetMargins(2, 2); toolBar->SetMargins(2, 2);
toolBar->SetToolBitmapSize(wxSize(24, 24)); toolBar->SetToolBitmapSize(wxSize(24, 24));
toolBar -> AddTool(ID_EXIT, wxBITMAP(close), wxNullBitmap, toolBar -> AddTool(ID_EXIT, wxBITMAP(close), wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL,
_("Quit the editor")); _("Quit the editor"));
toolBar -> AddTool(ID_OPEN, wxBITMAP(open), wxNullBitmap, toolBar -> AddTool(ID_OPEN, wxBITMAP(open), wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL,
_("Open XML resource file")); _("Open XML resource file"));
toolBar -> AddTool(ID_SAVE, wxBITMAP(save), wxNullBitmap, toolBar -> AddTool(ID_SAVE, wxBITMAP(save), wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL,
_("Save XML file")); _("Save XML file"));
toolBar -> AddTool(ID_PREVIEW, wxBITMAP(preview), wxNullBitmap, toolBar -> AddTool(ID_PREVIEW, wxBITMAP(preview), wxNullBitmap,
FALSE, -1, -1, (wxObject *) NULL, false, wxDefaultPosition.x, wxDefaultPosition.y, (wxObject *) NULL,
_("Preview")); _("Preview"));
toolBar -> Realize(); toolBar -> Realize();
@@ -255,7 +255,7 @@ EditorFrame::EditorFrame(wxFrame *parent, const wxString& filename)
m_TreeCtrl->AssignImageList(imgList); m_TreeCtrl->AssignImageList(imgList);
sizer->Add(m_TreeCtrl, 1, wxEXPAND); sizer->Add(m_TreeCtrl, 1, wxEXPAND);
SetAutoLayout(TRUE); SetAutoLayout(true);
SetSizer(sizer); SetSizer(sizer);
// Load file: // Load file:
@@ -296,7 +296,7 @@ void EditorFrame::LoadFile(const wxString& filename)
m_FileName = wxEmptyString; m_FileName = wxEmptyString;
m_Resource = new wxXmlRcEditDocument; m_Resource = new wxXmlRcEditDocument;
m_Modified = FALSE; m_Modified = false;
if (!m_Resource->Load(filename, wxLocale::GetSystemEncodingName())) if (!m_Resource->Load(filename, wxLocale::GetSystemEncodingName()))
{ {
@@ -326,7 +326,7 @@ void EditorFrame::SaveFile(const wxString& filename)
if (!m_Resource->Save(filename)) if (!m_Resource->Save(filename))
wxLogError(_("Error saving ") + filename); wxLogError(_("Error saving ") + filename);
else else
m_Modified = FALSE; m_Modified = false;
RefreshTitle(); RefreshTitle();
} }
@@ -343,15 +343,15 @@ void EditorFrame::NewFile()
m_Resource = new wxXmlRcEditDocument; m_Resource = new wxXmlRcEditDocument;
m_Resource->SetRoot(new wxXmlNode(wxXML_ELEMENT_NODE, _("resource"))); m_Resource->SetRoot(new wxXmlNode(wxXML_ELEMENT_NODE, _("resource")));
m_Resource->SetFileEncoding(_T("utf-8")); m_Resource->SetFileEncoding(_T("utf-8"));
#if !wxUSE_UNICODE #if !wxUSE_UNICODE
m_Resource->SetEncoding(wxLocale::GetSystemEncodingName()); m_Resource->SetEncoding(wxLocale::GetSystemEncodingName());
#endif #endif
m_Resource->GetRoot()->AddProperty(_T("version"), m_Resource->GetRoot()->AddProperty(_T("version"),
WX_XMLRES_CURRENT_VERSION_STRING); WX_XMLRES_CURRENT_VERSION_STRING);
m_Modified = FALSE; m_Modified = false;
RefreshTree(); RefreshTree();
RefreshTitle(); RefreshTitle();
} }
@@ -428,14 +428,14 @@ bool EditorFrame::SelectNode(wxXmlNode *node, wxTreeItemId *root)
RecursivelyExpand(m_TreeCtrl, *root); RecursivelyExpand(m_TreeCtrl, *root);
m_TreeCtrl->SelectItem(item); m_TreeCtrl->SelectItem(item);
m_TreeCtrl->EnsureVisible(item); m_TreeCtrl->EnsureVisible(item);
return TRUE; return true;
} }
if (m_TreeCtrl->ItemHasChildren(item) && SelectNode(node, &item)) if (m_TreeCtrl->ItemHasChildren(item) && SelectNode(node, &item))
return TRUE; return true;
item = m_TreeCtrl->GetNextChild(*root, cookie); item = m_TreeCtrl->GetNextChild(*root, cookie);
} }
return FALSE; return false;
} }
@@ -474,7 +474,7 @@ void EditorFrame::NotifyChanged(int change_type)
if (!m_Modified) if (!m_Modified)
{ {
m_Modified = TRUE; m_Modified = true;
RefreshTitle(); RefreshTitle();
} }
@@ -523,7 +523,7 @@ void EditorFrame::OnToolbar(wxCommandEvent& event)
} }
case ID_EXIT : case ID_EXIT :
Close(TRUE); Close(true);
break; break;
case ID_NEW : case ID_NEW :
@@ -623,7 +623,7 @@ void EditorFrame::OnNewNode(wxCommandEvent& event)
switch (event.GetId()) switch (event.GetId())
{ {
case ID_NEWDIALOG : name = _T("wxDialog"); break; case ID_NEWDIALOG : name = _T("wxDialog"); break;
case ID_NEWFRAME : name = _T("wxFrame"); break; case ID_NEWFRAME : name = _T("wxFrame"); break;
case ID_NEWPANEL : name = _T("wxPanel"); break; case ID_NEWPANEL : name = _T("wxPanel"); break;
case ID_NEWMENU : name = _T("wxMenu"); break; case ID_NEWMENU : name = _T("wxMenu"); break;
case ID_NEWMENUBAR : name = _T("wxMenuBar"); break; case ID_NEWMENUBAR : name = _T("wxMenuBar"); break;
@@ -648,7 +648,7 @@ void EditorFrame::OnRightClickTree(wxPoint pos)
if (m_SelectedNode == NULL || m_SelectedNode == m_Resource->GetRoot()) if (m_SelectedNode == NULL || m_SelectedNode == m_Resource->GetRoot())
{ {
popup->Append(ID_NEWDIALOG, _("New wxDialog")); popup->Append(ID_NEWDIALOG, _("New wxDialog"));
popup->Append(ID_NEWFRAME, _("New wxFrame")); popup->Append(ID_NEWFRAME, _("New wxFrame"));
popup->Append(ID_NEWPANEL, _("New wxPanel")); popup->Append(ID_NEWPANEL, _("New wxPanel"));
popup->Append(ID_NEWMENU, _("New wxMenu")); popup->Append(ID_NEWMENU, _("New wxMenu"));
popup->Append(ID_NEWMENUBAR, _("New wxMenuBar")); popup->Append(ID_NEWMENUBAR, _("New wxMenuBar"));
@@ -745,8 +745,8 @@ void EditorFrame::OnClipboardAction(wxCommandEvent& event)
case ID_CUT: case ID_CUT:
delete m_Clipboard; delete m_Clipboard;
m_Clipboard = new wxXmlNode(*m_SelectedNode); m_Clipboard = new wxXmlNode(*m_SelectedNode);
GetMenuBar()->Enable(ID_PASTE_SYBLING, TRUE); GetMenuBar()->Enable(ID_PASTE_SYBLING, true);
GetMenuBar()->Enable(ID_PASTE_CHILD, TRUE); GetMenuBar()->Enable(ID_PASTE_CHILD, true);
if (event.GetId() == ID_CUT) DeleteSelectedNode(); if (event.GetId() == ID_CUT) DeleteSelectedNode();
break; break;
@@ -786,10 +786,10 @@ void EditorFrame::OnClipboardAction(wxCommandEvent& event)
bool EditorFrame::AskToSave() bool EditorFrame::AskToSave()
// asks the user to save current document (if modified) // asks the user to save current document (if modified)
// returns FALSE if user cancelled the action, TRUE of he choosed // returns false if user cancelled the action, true of he choosed
// 'yes' or 'no' // 'yes' or 'no'
{ {
if (!m_Modified) return TRUE; if (!m_Modified) return true;
int res = wxMessageBox(_("File modified. Do you want to save changes?"), _("Save changes"), int res = wxMessageBox(_("File modified. Do you want to save changes?"), _("Save changes"),
wxYES_NO | wxCANCEL | wxCENTRE | wxICON_QUESTION); wxYES_NO | wxCANCEL | wxCENTRE | wxICON_QUESTION);

View File

@@ -33,15 +33,15 @@
wxList NodeHandler::ms_Handlers; wxList NodeHandler::ms_Handlers;
bool NodeHandler::ms_HandlersLoaded = FALSE; bool NodeHandler::ms_HandlersLoaded = false;
NodeHandler *NodeHandler::Find(wxXmlNode *node) NodeHandler *NodeHandler::Find(wxXmlNode *node)
{ {
if (!ms_HandlersLoaded) if (!ms_HandlersLoaded)
{ {
ms_HandlersLoaded = TRUE; ms_HandlersLoaded = true;
ms_Handlers.DeleteContents(TRUE); ms_Handlers.DeleteContents(true);
NodeInfoArray& arr = NodesDb::Get()->GetNodesInfo(); NodeInfoArray& arr = NodesDb::Get()->GetNodesInfo();
NodeHandler *hnd; NodeHandler *hnd;

View File

@@ -123,7 +123,7 @@ class NodeHandlerUnknown : public NodeHandler
public: public:
NodeHandlerUnknown() : NodeHandler(new NodeInfo) {} NodeHandlerUnknown() : NodeHandler(new NodeInfo) {}
virtual bool CanHandle(wxXmlNode *WXUNUSED(node)) { return TRUE; } virtual bool CanHandle(wxXmlNode *WXUNUSED(node)) { return true; }
}; };

View File

@@ -34,7 +34,7 @@ void NodeInfo::Read(const wxString& filename, wxPathList& list)
{ {
wxString tp; wxString tp;
wxString nd, cht; wxString nd, cht;
bool ab = FALSE; bool ab = false;
long icn = -1; long icn = -1;
NodeClass.Empty(); NodeClass.Empty();
@@ -81,7 +81,7 @@ void NodeInfo::Read(const wxString& filename, wxPathList& list)
pi.Type = tkn.GetNextToken(); pi.Type = tkn.GetNextToken();
if (tkn.HasMoreTokens()) pi.MoreInfo = tkn.GetNextToken(); if (tkn.HasMoreTokens()) pi.MoreInfo = tkn.GetNextToken();
bool fnd = FALSE; bool fnd = false;
for (size_t j = 0; j < Props.GetCount(); j++) for (size_t j = 0; j < Props.GetCount(); j++)
{ {
if (Props[j].Name == pi.Name) if (Props[j].Name == pi.Name)
@@ -90,7 +90,7 @@ void NodeInfo::Read(const wxString& filename, wxPathList& list)
Props[j].MoreInfo << _T(',') << pi.MoreInfo; Props[j].MoreInfo << _T(',') << pi.MoreInfo;
else else
Props[j] = pi; Props[j] = pi;
fnd = TRUE; fnd = true;
} }
} }

View File

@@ -36,7 +36,7 @@
wxWindow* PropEditCtrlFont::CreateEditCtrl() wxWindow* PropEditCtrlFont::CreateEditCtrl()
{ {
PropEditCtrlTxt::CreateEditCtrl(); PropEditCtrlTxt::CreateEditCtrl();
m_TextCtrl->Enable(FALSE); m_TextCtrl->Enable(false);
return m_TextCtrl; return m_TextCtrl;
} }
@@ -61,12 +61,12 @@ wxTreeItemId PropEditCtrlFont::CreateTreeEntry(wxTreeItemId parent, const Proper
BEGIN_EVENT_TABLE(PropEditCtrlChoice, PropEditCtrl) BEGIN_EVENT_TABLE(PropEditCtrlChoice, PropEditCtrl)
EVT_CHOICE(-1, PropEditCtrlChoice::OnChoice) EVT_CHOICE(wxID_ANY, PropEditCtrlChoice::OnChoice)
END_EVENT_TABLE() END_EVENT_TABLE()
wxWindow* PropEditCtrlChoice::CreateEditCtrl() wxWindow* PropEditCtrlChoice::CreateEditCtrl()
{ {
m_Choice = new wxChoice(this, -1); m_Choice = new wxChoice(this, wxID_ANY);
return m_Choice; return m_Choice;
} }
@@ -150,12 +150,12 @@ void PropEditCtrlFlags::OnDetails()
wxConfigBase *cfg = wxConfigBase::Get(); wxConfigBase *cfg = wxConfigBase::Get();
wxDialog dlg(m_PropFrame, -1, _("Flags"), wxDialog dlg(m_PropFrame, wxID_ANY, _("Flags"),
wxPoint(cfg->Read(_T("flagsdlg_x"), -1), cfg->Read(_T("flagsdlg_y"), -1)), wxPoint(cfg->Read(_T("flagsdlg_x"), wxDefaultPosition.x), cfg->Read(_T("flagsdlg_y"), wxDefaultPosition.y)),
wxSize(cfg->Read(_T("flagsdlg_w"), 300), cfg->Read(_T("flagsdlg_h"), 300)), wxSize(cfg->Read(_T("flagsdlg_w"), 300), cfg->Read(_T("flagsdlg_h"), 300)),
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
wxSizer *sz = new wxBoxSizer(wxVERTICAL); wxSizer *sz = new wxBoxSizer(wxVERTICAL);
wxCheckListBox *lbox = new wxCheckListBox(&dlg, -1); wxCheckListBox *lbox = new wxCheckListBox(&dlg, wxID_ANY);
sz->Add(lbox, 1, wxEXPAND | wxALL, 10); sz->Add(lbox, 1, wxEXPAND | wxALL, 10);
wxSizer *sz2 = new wxBoxSizer(wxHORIZONTAL); wxSizer *sz2 = new wxBoxSizer(wxHORIZONTAL);
wxButton *btnok = new wxButton(&dlg, wxID_OK, _("OK")); wxButton *btnok = new wxButton(&dlg, wxID_OK, _("OK"));
@@ -165,7 +165,7 @@ void PropEditCtrlFlags::OnDetails()
sz->Add(sz2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10); sz->Add(sz2, 0, wxALIGN_RIGHT | wxRIGHT | wxBOTTOM, 10);
dlg.SetSizer(sz); dlg.SetSizer(sz);
dlg.SetAutoLayout(TRUE); dlg.SetAutoLayout(true);
dlg.Layout(); dlg.Layout();
for (i = 0; i < arr.GetCount(); i++) for (i = 0; i < arr.GetCount(); i++)

View File

@@ -57,7 +57,7 @@ class PropEditCtrlColor : public PropEditCtrlTxt
PropEditCtrlColor(PropertiesFrame *propFrame) PropEditCtrlColor(PropertiesFrame *propFrame)
: PropEditCtrlTxt(propFrame) {} : PropEditCtrlTxt(propFrame) {}
virtual bool HasDetails() { return TRUE; } virtual bool HasDetails() { return true; }
virtual void OnDetails(); virtual void OnDetails();
}; };
@@ -70,7 +70,7 @@ class PropEditCtrlFlags : public PropEditCtrlTxt
PropEditCtrlFlags(PropertiesFrame *propFrame) PropEditCtrlFlags(PropertiesFrame *propFrame)
: PropEditCtrlTxt(propFrame) {} : PropEditCtrlTxt(propFrame) {}
virtual bool HasDetails() { return TRUE; } virtual bool HasDetails() { return true; }
virtual void OnDetails(); virtual void OnDetails();
}; };
@@ -82,7 +82,7 @@ class PropEditCtrlFile : public PropEditCtrlTxt
PropEditCtrlFile(PropertiesFrame *propFrame) PropEditCtrlFile(PropertiesFrame *propFrame)
: PropEditCtrlTxt(propFrame) {} : PropEditCtrlTxt(propFrame) {}
virtual bool HasDetails() { return TRUE; } virtual bool HasDetails() { return true; }
virtual void OnDetails(); virtual void OnDetails();
virtual wxString GetFileTypes(); virtual wxString GetFileTypes();

View File

@@ -28,13 +28,13 @@
BEGIN_EVENT_TABLE(PropEditCtrlTxt, PropEditCtrl) BEGIN_EVENT_TABLE(PropEditCtrlTxt, PropEditCtrl)
EVT_TEXT(-1, PropEditCtrlTxt::OnText) EVT_TEXT(wxID_ANY, PropEditCtrlTxt::OnText)
END_EVENT_TABLE() END_EVENT_TABLE()
wxWindow *PropEditCtrlTxt::CreateEditCtrl() wxWindow *PropEditCtrlTxt::CreateEditCtrl()
{ {
return (m_TextCtrl = new wxTextCtrl(this, -1)); return (m_TextCtrl = new wxTextCtrl(this, wxID_ANY));
} }
@@ -61,7 +61,7 @@ void PropEditCtrlTxt::WriteValue()
{ {
wxString newv = m_TextCtrl->GetValue(); wxString newv = m_TextCtrl->GetValue();
XmlWriteValue(GetNode(), m_PropInfo->Name, newv); XmlWriteValue(GetNode(), m_PropInfo->Name, newv);
m_TreeCtrl->SetItemBold(m_TreeItem, TRUE); m_TreeCtrl->SetItemBold(m_TreeItem, true);
} }
@@ -82,12 +82,12 @@ wxWindow *PropEditCtrlInt::CreateEditCtrl()
BEGIN_EVENT_TABLE(PropEditCtrlBool, PropEditCtrl) BEGIN_EVENT_TABLE(PropEditCtrlBool, PropEditCtrl)
EVT_CHOICE(-1, PropEditCtrlBool::OnChoice) EVT_CHOICE(wxID_ANY, PropEditCtrlBool::OnChoice)
END_EVENT_TABLE() END_EVENT_TABLE()
wxWindow *PropEditCtrlBool::CreateEditCtrl() wxWindow *PropEditCtrlBool::CreateEditCtrl()
{ {
m_Choice = new wxChoice(this, -1); m_Choice = new wxChoice(this, wxID_ANY);
m_Choice->Append(_T("false")); m_Choice->Append(_T("false"));
m_Choice->Append(_T("true")); m_Choice->Append(_T("true"));
return m_Choice; return m_Choice;
@@ -110,7 +110,7 @@ void PropEditCtrlBool::WriteValue()
wxString newv = m_Choice->GetSelection() == 0 ? _T("0") : _T("1"); wxString newv = m_Choice->GetSelection() == 0 ? _T("0") : _T("1");
XmlWriteValue(GetNode(), m_PropInfo->Name, newv); XmlWriteValue(GetNode(), m_PropInfo->Name, newv);
m_TreeCtrl->SetItemBold(m_TreeItem, TRUE); m_TreeCtrl->SetItemBold(m_TreeItem, true);
} }
@@ -172,7 +172,7 @@ class PropEditCtrlCoordXY : public PropEditCtrlInt
wxString prev = XmlReadValue(GetNode(), m_PropInfo->Name); wxString prev = XmlReadValue(GetNode(), m_PropInfo->Name);
if (prev[prev.Len()-1] == _T('d')) s << _T('d'); if (prev[prev.Len()-1] == _T('d')) s << _T('d');
XmlWriteValue(GetNode(), m_PropInfo->Name, s); XmlWriteValue(GetNode(), m_PropInfo->Name, s);
m_TreeCtrl->SetItemBold(m_TreeCtrl->GetItemParent(m_TreeItem), TRUE); m_TreeCtrl->SetItemBold(m_TreeCtrl->GetItemParent(m_TreeItem), true);
} }
virtual wxString GetValueAsText(wxTreeItemId ti) virtual wxString GetValueAsText(wxTreeItemId ti)
@@ -197,8 +197,8 @@ class PropEditCtrlCoordXY : public PropEditCtrlInt
if (m_which == 0) return _T("x"); else return _T("y"); if (m_which == 0) return _T("x"); else return _T("y");
} }
virtual bool HasClearButton() { return FALSE; } virtual bool HasClearButton() { return false; }
virtual bool IsPresent(const PropertyInfo& WXUNUSED(pinfo)) { return FALSE; } virtual bool IsPresent(const PropertyInfo& WXUNUSED(pinfo)) { return false; }
protected: protected:
@@ -228,7 +228,7 @@ class PropEditCtrlCoordDlg : public PropEditCtrlBool
wxString s = XmlReadValue(GetNode(), m_PropInfo->Name).BeforeFirst(_T('d')); wxString s = XmlReadValue(GetNode(), m_PropInfo->Name).BeforeFirst(_T('d'));
if (m_Choice->GetSelection() == 1) s << _T('d'); if (m_Choice->GetSelection() == 1) s << _T('d');
XmlWriteValue(GetNode(), m_PropInfo->Name, s); XmlWriteValue(GetNode(), m_PropInfo->Name, s);
m_TreeCtrl->SetItemBold(m_TreeCtrl->GetItemParent(m_TreeItem), TRUE); m_TreeCtrl->SetItemBold(m_TreeCtrl->GetItemParent(m_TreeItem), true);
} }
virtual wxString GetValueAsText(wxTreeItemId ti) virtual wxString GetValueAsText(wxTreeItemId ti)
@@ -248,8 +248,8 @@ class PropEditCtrlCoordDlg : public PropEditCtrlBool
return _T("dlg"); return _T("dlg");
} }
virtual bool HasClearButton() { return FALSE; } virtual bool HasClearButton() { return false; }
virtual bool IsPresent(const PropertyInfo& WXUNUSED(pinfo)) { return FALSE; } virtual bool IsPresent(const PropertyInfo& WXUNUSED(pinfo)) { return false; }
}; };
@@ -309,7 +309,7 @@ class PropEditCtrlDimX : public PropEditCtrlInt
s = m_c; s = m_c;
if (dlg) s << _T('d'); if (dlg) s << _T('d');
XmlWriteValue(GetNode(), m_PropInfo->Name, s); XmlWriteValue(GetNode(), m_PropInfo->Name, s);
m_TreeCtrl->SetItemBold(m_TreeCtrl->GetItemParent(m_TreeItem), TRUE); m_TreeCtrl->SetItemBold(m_TreeCtrl->GetItemParent(m_TreeItem), true);
} }
virtual wxString GetValueAsText(wxTreeItemId ti) virtual wxString GetValueAsText(wxTreeItemId ti)
@@ -323,8 +323,8 @@ class PropEditCtrlDimX : public PropEditCtrlInt
return _T("val"); return _T("val");
} }
virtual bool HasClearButton() { return FALSE; } virtual bool HasClearButton() { return false; }
virtual bool IsPresent(const PropertyInfo& WXUNUSED(pinfo)) { return FALSE; } virtual bool IsPresent(const PropertyInfo& WXUNUSED(pinfo)) { return false; }
protected: protected:
@@ -379,7 +379,7 @@ void PropEditCtrlXRCID::WriteValue()
REAL_NODE->DeleteProperty(_T("name")); REAL_NODE->DeleteProperty(_T("name"));
REAL_NODE->AddProperty(_T("name"), s); REAL_NODE->AddProperty(_T("name"), s);
m_TreeCtrl->SetItemBold(m_TreeItem, TRUE); m_TreeCtrl->SetItemBold(m_TreeItem, true);
EditorFrame::Get()->NotifyChanged(CHANGED_TREE_SELECTED); EditorFrame::Get()->NotifyChanged(CHANGED_TREE_SELECTED);
} }
@@ -389,7 +389,7 @@ void PropEditCtrlXRCID::Clear()
{ {
EndEdit(); EndEdit();
REAL_NODE->DeleteProperty(_T("name")); REAL_NODE->DeleteProperty(_T("name"));
m_TreeCtrl->SetItemBold(m_TreeItem, FALSE); m_TreeCtrl->SetItemBold(m_TreeItem, false);
EditorFrame::Get()->NotifyChanged(CHANGED_TREE_SELECTED); EditorFrame::Get()->NotifyChanged(CHANGED_TREE_SELECTED);
} }

View File

@@ -125,7 +125,7 @@ class PropEditCtrlXRCID : public PropEditCtrlTxt
virtual void ReadValue(); virtual void ReadValue();
virtual void WriteValue(); virtual void WriteValue();
virtual void Clear(); virtual void Clear();
virtual bool HasDetails() { return TRUE; } virtual bool HasDetails() { return true; }
virtual void OnDetails(); virtual void OnDetails();
virtual wxString GetValueAsText(wxTreeItemId ti); virtual wxString GetValueAsText(wxTreeItemId ti);
virtual bool IsPresent(const PropertyInfo& pinfo); virtual bool IsPresent(const PropertyInfo& pinfo);

View File

@@ -55,13 +55,13 @@ PreviewFrame *PreviewFrame::Get()
if (ms_Instance == NULL) if (ms_Instance == NULL)
{ {
(void)new PreviewFrame; (void)new PreviewFrame;
ms_Instance->Show(TRUE); ms_Instance->Show(true);
} }
return ms_Instance; return ms_Instance;
} }
PreviewFrame::PreviewFrame() PreviewFrame::PreviewFrame()
: wxFrame(EditorFrame::Get(), -1, _("Preview"), : wxFrame(EditorFrame::Get(), wxID_ANY, _("Preview"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR
#ifdef __WXMSW__ #ifdef __WXMSW__
@@ -69,7 +69,7 @@ PreviewFrame::PreviewFrame()
#endif #endif
) )
{ {
m_Dirty = FALSE; m_Dirty = false;
ms_Instance = this; ms_Instance = this;
m_Node = NULL; m_Node = NULL;
@@ -80,13 +80,13 @@ PreviewFrame::PreviewFrame()
ResetResource(); ResetResource();
wxConfigBase *cfg = wxConfigBase::Get(); wxConfigBase *cfg = wxConfigBase::Get();
SetSize(wxRect(wxPoint(cfg->Read(_T("previewframe_x"), -1), cfg->Read(_T("previewframe_y"), -1)), SetSize(wxRect(wxPoint(cfg->Read(_T("previewframe_x"), wxDefaultPosition.x), cfg->Read(_T("previewframe_y"), wxDefaultPosition.y)),
wxSize(cfg->Read(_T("previewframe_w"), 400), cfg->Read(_T("previewframe_h"), 400)))); wxSize(cfg->Read(_T("previewframe_w"), 400), cfg->Read(_T("previewframe_h"), 400))));
m_Splitter = new wxSplitterWindow(this, -1); m_Splitter = new wxSplitterWindow(this, wxID_ANY);
m_LogCtrl = new wxTextCtrl(m_Splitter, -1, wxEmptyString, wxDefaultPosition, m_LogCtrl = new wxTextCtrl(m_Splitter, wxID_ANY, wxEmptyString, wxDefaultPosition,
wxDefaultSize, wxTE_MULTILINE); wxDefaultSize, wxTE_MULTILINE);
m_ScrollWin = new wxScrolledWindow(m_Splitter, -1); m_ScrollWin = new wxScrolledWindow(m_Splitter, wxID_ANY);
m_ScrollWin->SetBackgroundColour(_T("light steel blue")); m_ScrollWin->SetBackgroundColour(_T("light steel blue"));
m_Splitter->SplitHorizontally(m_ScrollWin, m_LogCtrl, cfg->Read(_T("previewframe_sash"), 300)); m_Splitter->SplitHorizontally(m_ScrollWin, m_LogCtrl, cfg->Read(_T("previewframe_sash"), 300));
@@ -132,7 +132,7 @@ void PreviewFrame::MakeDirty()
{ {
if (m_Node == NULL) return; if (m_Node == NULL) return;
if (m_Dirty) return; if (m_Dirty) return;
m_Dirty = TRUE; m_Dirty = true;
m_LogCtrl->Clear(); m_LogCtrl->Clear();
m_LogCtrl->SetValue(_("Resource modified.\nMove mouse cursor over the preview window to refresh it.")); m_LogCtrl->SetValue(_("Resource modified.\nMove mouse cursor over the preview window to refresh it."));
} }
@@ -189,12 +189,12 @@ void PreviewFrame::Preview(wxXmlNode *node, wxXmlDocument *orig_doc)
else if (XmlGetClass(node) == _T("wxPanel") || XmlGetClass(node) == _T("wxDialog")) else if (XmlGetClass(node) == _T("wxPanel") || XmlGetClass(node) == _T("wxDialog"))
PreviewPanel(); PreviewPanel();
else if (XmlGetClass(node) == _T("wxFrame")) else if (XmlGetClass(node) == _T("wxFrame"))
PreviewWXFrame(); PreviewWXFrame();
wxSetWorkingDirectory(oldcwd); wxSetWorkingDirectory(oldcwd);
wxLog::SetActiveTarget(oldlog); wxLog::SetActiveTarget(oldlog);
m_Dirty = FALSE; m_Dirty = false;
} }
@@ -233,29 +233,29 @@ void PreviewFrame::PreviewPanel()
else else
{ {
m_ScrollWin->SetScrollbars(1, 1, panel->GetSize().x, panel->GetSize().y, m_ScrollWin->SetScrollbars(1, 1, panel->GetSize().x, panel->GetSize().y,
0, 0, TRUE); 0, 0, true);
} }
} }
void PreviewFrame::PreviewWXFrame() void PreviewFrame::PreviewWXFrame()
{ {
//for this to work the frame MUST have a child panel! //for this to work the frame MUST have a child panel!
wxXmlNode* child = m_Node; wxXmlNode* child = m_Node;
wxString name; wxString name;
while( child != NULL) while( child != NULL)
{ {
name = child->GetPropVal(_T("name"), _T("-1")); name = child->GetPropVal(_T("name"), _T("-1"));
if(name != _T("-1")) if(name != _T("-1"))
{ {
wxXmlNode* parent = child->GetParent(); wxXmlNode* parent = child->GetParent();
if(parent->GetPropVal(_T("class"),_T("-1")) == _T("wxPanel")) if(parent->GetPropVal(_T("class"),_T("-1")) == _T("wxPanel"))
break; break;
} }
child = child->GetNext(); child = child->GetNext();
} }
wxPanel *panel = m_RC->LoadPanel(m_ScrollWin, name); wxPanel *panel = m_RC->LoadPanel(m_ScrollWin, name);
@@ -264,7 +264,7 @@ void PreviewFrame::PreviewWXFrame()
else else
{ {
m_ScrollWin->SetScrollbars(1, 1, panel->GetSize().x, panel->GetSize().y, m_ScrollWin->SetScrollbars(1, 1, panel->GetSize().x, panel->GetSize().y,
0, 0, TRUE); 0, 0, true);
} }
} }

View File

@@ -43,7 +43,7 @@ class PreviewFrame : public wxFrame
void PreviewMenu(); void PreviewMenu();
void PreviewToolbar(); void PreviewToolbar();
void PreviewPanel(); void PreviewPanel();
void PreviewWXFrame(); void PreviewWXFrame();
private: private:
static PreviewFrame *ms_Instance; static PreviewFrame *ms_Instance;

View File

@@ -54,7 +54,7 @@ void PropEditCtrl::BeginEdit(const wxRect& rect, wxTreeItemId ti)
m_PropInfo = &(((PETreeData*)m_TreeCtrl->GetItemData(ti))->PropInfo); m_PropInfo = &(((PETreeData*)m_TreeCtrl->GetItemData(ti))->PropInfo);
m_TreeItem = ti; m_TreeItem = ti;
m_CanSave = FALSE; m_CanSave = false;
if (!m_Created) if (!m_Created)
{ {
wxSizer *sz = new wxBoxSizer(wxHORIZONTAL); wxSizer *sz = new wxBoxSizer(wxHORIZONTAL);
@@ -62,28 +62,28 @@ void PropEditCtrl::BeginEdit(const wxRect& rect, wxTreeItemId ti)
sz->Add(m_TheCtrl, 1); sz->Add(m_TheCtrl, 1);
if (HasDetails()) if (HasDetails())
sz->Add(new wxButton(this, ID_DETAILS, _T("..."), wxDefaultPosition, sz->Add(new wxButton(this, ID_DETAILS, _T("..."), wxDefaultPosition,
wxSize(16,-1))); wxSize(16,wxDefaultSize.y)));
if (HasClearButton()) if (HasClearButton())
sz->Add(new wxButton(this, ID_CLEAR, _T("X"), wxDefaultPosition, sz->Add(new wxButton(this, ID_CLEAR, _T("X"), wxDefaultPosition,
wxSize(16,-1))); wxSize(16,wxDefaultSize.y)));
SetAutoLayout(TRUE); SetAutoLayout(true);
SetSizer(sz); SetSizer(sz);
m_Created = TRUE; m_Created = true;
} }
m_TheCtrl->SetFocus(); m_TheCtrl->SetFocus();
SetSize(rect.x, rect.y, rect.width, rect.height); SetSize(rect.x, rect.y, rect.width, rect.height);
Show(TRUE); Show(true);
ReadValue(); ReadValue();
m_CanSave = TRUE; m_CanSave = true;
} }
void PropEditCtrl::EndEdit() void PropEditCtrl::EndEdit()
{ {
Show(FALSE); Show(false);
} }
@@ -93,7 +93,7 @@ wxTreeItemId PropEditCtrl::CreateTreeEntry(wxTreeItemId parent, const PropertyIn
wxTreeItemId t = m_TreeCtrl->AppendItem(parent, GetPropName(pinfo)); wxTreeItemId t = m_TreeCtrl->AppendItem(parent, GetPropName(pinfo));
m_TreeCtrl->SetItemData(t, new PETreeData(this, pinfo)); m_TreeCtrl->SetItemData(t, new PETreeData(this, pinfo));
if (IsPresent(pinfo)) if (IsPresent(pinfo))
m_TreeCtrl->SetItemBold(t, TRUE); m_TreeCtrl->SetItemBold(t, true);
return t; return t;
} }
@@ -113,7 +113,7 @@ void PropEditCtrl::Clear()
{ {
n->GetParent()->RemoveChild(n); n->GetParent()->RemoveChild(n);
delete n; delete n;
m_TreeCtrl->SetItemBold(m_TreeItem, FALSE); m_TreeCtrl->SetItemBold(m_TreeItem, false);
} }
} }

View File

@@ -29,9 +29,9 @@ class PropEditCtrl : public wxPanel
{ {
public: public:
PropEditCtrl(PropertiesFrame *propFrame) PropEditCtrl(PropertiesFrame *propFrame)
: wxPanel(propFrame->m_valueWindow, -1), : wxPanel(propFrame->m_valueWindow, wxID_ANY),
m_PropFrame(propFrame), m_Created(FALSE), m_TreeCtrl(propFrame->m_tree) m_PropFrame(propFrame), m_Created(false), m_TreeCtrl(propFrame->m_tree)
{Show(FALSE);} {Show(false);}
virtual void BeginEdit(const wxRect& rect, wxTreeItemId ti); virtual void BeginEdit(const wxRect& rect, wxTreeItemId ti);
virtual void EndEdit(); virtual void EndEdit();
@@ -48,9 +48,9 @@ class PropEditCtrl : public wxPanel
virtual wxString GetPropName(const PropertyInfo& pinfo) virtual wxString GetPropName(const PropertyInfo& pinfo)
{ return pinfo.Name.AfterLast(_T('/')); } { return pinfo.Name.AfterLast(_T('/')); }
virtual bool HasDetails() { return FALSE; } virtual bool HasDetails() { return false; }
virtual void OnDetails() {} virtual void OnDetails() {}
virtual bool HasClearButton() { return TRUE; } virtual bool HasClearButton() { return true; }
void OnButtonDetails(wxCommandEvent& event); void OnButtonDetails(wxCommandEvent& event);
void OnButtonClear(wxCommandEvent& event); void OnButtonClear(wxCommandEvent& event);

View File

@@ -39,51 +39,51 @@ class PropsTree: public wxRemotelyScrolledTreeCtrl
const wxSize& sz = wxDefaultSize, long style = wxTR_HAS_BUTTONS) const wxSize& sz = wxDefaultSize, long style = wxTR_HAS_BUTTONS)
: wxRemotelyScrolledTreeCtrl(parent, id, pt, sz, style), : wxRemotelyScrolledTreeCtrl(parent, id, pt, sz, style),
m_EditCtrl(NULL) m_EditCtrl(NULL)
{ {
#if 0 #if 0
// VS: Don't do it, it is *extremely* ugly. // VS: Don't do it, it is *extremely* ugly.
// FIXME: find a better solution. // FIXME: find a better solution.
//make text larger so controls will fit properly //make text larger so controls will fit properly
wxFont font = GetFont(); wxFont font = GetFont();
font.SetPointSize(font.GetPointSize()*1.5); font.SetPointSize(font.GetPointSize()*1.5);
SetFont(font); SetFont(font);
#endif #endif
} }
void OnPaint(wxPaintEvent& event) void OnPaint(wxPaintEvent& event)
{ {
wxPaintDC dc(this); wxPaintDC dc(this);
wxTreeCtrl::OnPaint(event); wxTreeCtrl::OnPaint(event);
// Reset the device origin since it may have been set // Reset the device origin since it may have been set
dc.SetDeviceOrigin(0, 0); dc.SetDeviceOrigin(0, 0);
wxPen pen(wxColour(_T("BLACK")), 1, wxSOLID); wxPen pen(wxColour(_T("BLACK")), 1, wxSOLID);
dc.SetPen(pen); dc.SetPen(pen);
dc.SetBrush(* wxTRANSPARENT_BRUSH); dc.SetBrush(* wxTRANSPARENT_BRUSH);
wxSize clientSize = GetClientSize(); wxSize clientSize = GetClientSize();
wxRect itemRect; wxRect itemRect;
int cy=0; int cy=0;
wxTreeItemId h, lastH; wxTreeItemId h, lastH;
for(h=GetFirstVisibleItem();h;h=GetNextVisible(h)) for(h=GetFirstVisibleItem();h;h=GetNextVisible(h))
{ {
if (h.IsOk() && GetBoundingRect(h, itemRect)) if (h.IsOk() && GetBoundingRect(h, itemRect))
{ {
cy = itemRect.GetTop(); cy = itemRect.GetTop();
dc.DrawLine(0, cy, clientSize.x, cy); dc.DrawLine(0, cy, clientSize.x, cy);
lastH = h; lastH = h;
} }
} }
if (lastH.IsOk() && GetBoundingRect(lastH, itemRect)) if (lastH.IsOk() && GetBoundingRect(lastH, itemRect))
{ {
cy = itemRect.GetBottom(); cy = itemRect.GetBottom();
dc.DrawLine(0, cy, clientSize.x, cy); dc.DrawLine(0, cy, clientSize.x, cy);
} }
} }
void OnSelChange(wxTreeEvent& event) void OnSelChange(wxTreeEvent& event)
@@ -129,7 +129,7 @@ class PropsTree: public wxRemotelyScrolledTreeCtrl
wxRect bounding; wxRect bounding;
GetBoundingRect(id, bounding); GetBoundingRect(id, bounding);
m_EditCtrl->Move(-1, bounding.y); m_EditCtrl->Move(wxDefaultPosition.x, bounding.y);
} }
PropEditCtrl *m_EditCtrl; PropEditCtrl *m_EditCtrl;
@@ -138,8 +138,8 @@ class PropsTree: public wxRemotelyScrolledTreeCtrl
}; };
BEGIN_EVENT_TABLE(PropsTree, wxRemotelyScrolledTreeCtrl) BEGIN_EVENT_TABLE(PropsTree, wxRemotelyScrolledTreeCtrl)
EVT_PAINT(PropsTree::OnPaint) EVT_PAINT(PropsTree::OnPaint)
EVT_TREE_SEL_CHANGED(-1, PropsTree::OnSelChange) EVT_TREE_SEL_CHANGED(wxID_ANY, PropsTree::OnSelChange)
EVT_SCROLLWIN(PropsTree::OnScroll) EVT_SCROLLWIN(PropsTree::OnScroll)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -147,7 +147,7 @@ END_EVENT_TABLE()
class PropsValueWindow: public wxTreeCompanionWindow class PropsValueWindow: public wxTreeCompanionWindow
{ {
public: public:
PropsValueWindow(wxWindow* parent, wxWindowID id = -1, PropsValueWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize, const wxSize& sz = wxDefaultSize,
long style = 0) long style = 0)
@@ -155,24 +155,24 @@ class PropsValueWindow: public wxTreeCompanionWindow
virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect)
{ {
if (m_treeCtrl) if (m_treeCtrl)
{ {
PETreeData *data = (PETreeData*)m_treeCtrl->GetItemData(id); PETreeData *data = (PETreeData*)m_treeCtrl->GetItemData(id);
wxString text; wxString text;
if (data != NULL) text = data->EditCtrl->GetValueAsText(id); if (data != NULL) text = data->EditCtrl->GetValueAsText(id);
dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID)); dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID));
dc.DrawRectangle(rect); dc.DrawRectangle(rect);
dc.SetTextForeground(* wxBLACK); dc.SetTextForeground(* wxBLACK);
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
int textW, textH; int textW, textH;
dc.GetTextExtent(text, & textW, & textH); dc.GetTextExtent(text, & textW, & textH);
int x = 5; int x = 5;
int y = rect.GetY() + wxMax(0, (rect.GetHeight() - textH) / 2); int y = rect.GetY() + wxMax(0, (rect.GetHeight() - textH) / 2);
dc.DrawText(text, x, y); dc.DrawText(text, x, y);
} }
} }
void OnClick(wxMouseEvent& event) void OnClick(wxMouseEvent& event)
@@ -189,7 +189,7 @@ class PropsValueWindow: public wxTreeCompanionWindow
}; };
BEGIN_EVENT_TABLE(PropsValueWindow, wxTreeCompanionWindow) BEGIN_EVENT_TABLE(PropsValueWindow, wxTreeCompanionWindow)
EVT_LEFT_DOWN(PropsValueWindow::OnClick) EVT_LEFT_DOWN(PropsValueWindow::OnClick)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -205,13 +205,13 @@ PropertiesFrame *PropertiesFrame::Get()
if (ms_Instance == NULL) if (ms_Instance == NULL)
{ {
(void)new PropertiesFrame; (void)new PropertiesFrame;
ms_Instance->Show(TRUE); ms_Instance->Show(true);
} }
return ms_Instance; return ms_Instance;
} }
PropertiesFrame::PropertiesFrame() PropertiesFrame::PropertiesFrame()
: wxFrame(EditorFrame::Get(), -1, _("Properties"), : wxFrame(EditorFrame::Get(), wxID_ANY, _("Properties"),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR
#ifdef __WXMSW__ #ifdef __WXMSW__
@@ -222,34 +222,34 @@ PropertiesFrame::PropertiesFrame()
ms_Instance = this; ms_Instance = this;
m_Node = NULL; m_Node = NULL;
m_scrolledWindow = new wxSplitterScrolledWindow(this, -1, wxDefaultPosition, m_scrolledWindow = new wxSplitterScrolledWindow(this, wxID_ANY, wxDefaultPosition,
wxDefaultSize, wxNO_BORDER | wxCLIP_CHILDREN | wxVSCROLL); wxDefaultSize, wxNO_BORDER | wxCLIP_CHILDREN | wxVSCROLL);
m_splitter = new wxThinSplitterWindow(m_scrolledWindow, -1, wxDefaultPosition, m_splitter = new wxThinSplitterWindow(m_scrolledWindow, wxID_ANY, wxDefaultPosition,
wxDefaultSize, wxSP_3DBORDER | wxCLIP_CHILDREN /* | wxSP_LIVE_UPDATE */); wxDefaultSize, wxSP_3DBORDER | wxCLIP_CHILDREN /* | wxSP_LIVE_UPDATE */);
m_splitter->SetSashSize(2); m_splitter->SetSashSize(2);
m_tree = new PropsTree(m_splitter, -1, wxDefaultPosition, m_tree = new PropsTree(m_splitter, wxID_ANY, wxDefaultPosition,
wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER ); wxDefaultSize, wxTR_HAS_BUTTONS | wxTR_NO_LINES | wxNO_BORDER );
m_tree->SetIndent(2); m_tree->SetIndent(2);
m_valueWindow = new PropsValueWindow(m_splitter, -1, wxDefaultPosition, m_valueWindow = new PropsValueWindow(m_splitter, wxID_ANY, wxDefaultPosition,
wxDefaultSize, wxNO_BORDER); wxDefaultSize, wxNO_BORDER);
m_valueWindow->SetBackgroundColour(m_tree->GetBackgroundColour()); m_valueWindow->SetBackgroundColour(m_tree->GetBackgroundColour());
m_splitter->SplitVertically(m_tree, m_valueWindow, wxConfig::Get()->Read(_T("propertiesframe_sash"), 100)); m_splitter->SplitVertically(m_tree, m_valueWindow, wxConfig::Get()->Read(_T("propertiesframe_sash"), 100));
//m_splitter->AdjustScrollbars(); //m_splitter->AdjustScrollbars();
m_scrolledWindow->SetTargetWindow(m_tree); m_scrolledWindow->SetTargetWindow(m_tree);
m_scrolledWindow->EnableScrolling(FALSE, FALSE); m_scrolledWindow->EnableScrolling(false, false);
// Let the two controls know about each other // Let the two controls know about each other
m_valueWindow->SetTreeCtrl(m_tree); m_valueWindow->SetTreeCtrl(m_tree);
m_tree->SetCompanionWindow(m_valueWindow); m_tree->SetCompanionWindow(m_valueWindow);
wxConfigBase *cfg = wxConfigBase::Get(); wxConfigBase *cfg = wxConfigBase::Get();
SetSize(wxRect(wxPoint(cfg->Read(_T("propertiesframe_x"), -1), cfg->Read(_T("propertiesframe_y"), -1)), SetSize(wxRect(wxPoint(cfg->Read(_T("propertiesframe_x"), wxDefaultPosition.x), cfg->Read(_T("propertiesframe_y"), wxDefaultPosition.y)),
wxSize(cfg->Read(_T("propertiesframe_w"), 200), cfg->Read(_T("propertiesframe_h"), 200)))); wxSize(cfg->Read(_T("propertiesframe_w"), 200), cfg->Read(_T("propertiesframe_h"), 200))));
m_EditCtrls.DeleteContents(TRUE); m_EditCtrls.DeleteContents(true);
m_EditCtrls.Put(_T("bool"), new PropEditCtrlBool(this)); m_EditCtrls.Put(_T("bool"), new PropEditCtrlBool(this));
m_EditCtrls.Put(_T("coord"), new PropEditCtrlCoord(this)); m_EditCtrls.Put(_T("coord"), new PropEditCtrlCoord(this));
m_EditCtrls.Put(_T("color"), new PropEditCtrlColor(this)); m_EditCtrls.Put(_T("color"), new PropEditCtrlColor(this));

View File

@@ -43,7 +43,7 @@ class PropertiesFrame : public wxFrame
wxRemotelyScrolledTreeCtrl *m_tree; wxRemotelyScrolledTreeCtrl *m_tree;
wxThinSplitterWindow *m_splitter; wxThinSplitterWindow *m_splitter;
wxSplitterScrolledWindow *m_scrolledWindow; wxSplitterScrolledWindow *m_scrolledWindow;
wxTreeCompanionWindow *m_valueWindow; wxTreeCompanionWindow *m_valueWindow;
wxHashTable m_EditCtrls; wxHashTable m_EditCtrls;

View File

@@ -58,17 +58,17 @@ BEGIN_EVENT_TABLE(wxRemotelyScrolledTreeCtrl, wxGenericTreeCtrl)
#else #else
BEGIN_EVENT_TABLE(wxRemotelyScrolledTreeCtrl, wxTreeCtrl) BEGIN_EVENT_TABLE(wxRemotelyScrolledTreeCtrl, wxTreeCtrl)
#endif #endif
EVT_SIZE(wxRemotelyScrolledTreeCtrl::OnSize) EVT_SIZE(wxRemotelyScrolledTreeCtrl::OnSize)
EVT_TREE_ITEM_EXPANDED(-1, wxRemotelyScrolledTreeCtrl::OnExpand) EVT_TREE_ITEM_EXPANDED(wxID_ANY, wxRemotelyScrolledTreeCtrl::OnExpand)
EVT_TREE_ITEM_COLLAPSED(-1, wxRemotelyScrolledTreeCtrl::OnExpand) EVT_TREE_ITEM_COLLAPSED(wxID_ANY, wxRemotelyScrolledTreeCtrl::OnExpand)
EVT_SCROLLWIN(wxRemotelyScrolledTreeCtrl::OnScroll) EVT_SCROLLWIN(wxRemotelyScrolledTreeCtrl::OnScroll)
END_EVENT_TABLE() END_EVENT_TABLE()
wxRemotelyScrolledTreeCtrl::wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt, wxRemotelyScrolledTreeCtrl::wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt,
const wxSize& sz, long style): const wxSize& sz, long style):
wxTreeCtrl(parent, id, pt, sz, style) wxTreeCtrl(parent, id, pt, sz, style)
{ {
m_companionWindow = NULL; m_companionWindow = NULL;
} }
wxRemotelyScrolledTreeCtrl::~wxRemotelyScrolledTreeCtrl() wxRemotelyScrolledTreeCtrl::~wxRemotelyScrolledTreeCtrl()
@@ -80,7 +80,7 @@ void wxRemotelyScrolledTreeCtrl::HideVScrollbar()
#if defined(__WXMSW__) && USE_GENERIC_TREECTRL #if defined(__WXMSW__) && USE_GENERIC_TREECTRL
if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
{ {
::ShowScrollBar((HWND) GetHWND(), SB_VERT, FALSE); ::ShowScrollBar((HWND) GetHWND(), SB_VERT, false);
} }
else else
#endif #endif
@@ -103,9 +103,9 @@ void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPer
wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, 0, noUnitsX, 0, xPos, 0, noRefresh); win->wxGenericTreeCtrl::SetScrollbars(pixelsPerUnitX, 0, noUnitsX, 0, xPos, 0, noRefresh);
wxScrolledWindow* scrolledWindow = GetScrolledWindow(); wxScrolledWindow* scrolledWindow = GetScrolledWindow();
if (scrolledWindow) if (scrolledWindow)
{ {
scrolledWindow->SetScrollbars(0, pixelsPerUnitY, 0, noUnitsY, 0, yPos, noRefresh); scrolledWindow->SetScrollbars(0, pixelsPerUnitY, 0, noUnitsY, 0, yPos, noRefresh);
} }
} }
@@ -163,13 +163,13 @@ void wxRemotelyScrolledTreeCtrl::GetViewStart(int *x, int *y) const
scrolledWindow->GetViewStart(& x2, & y2); scrolledWindow->GetViewStart(& x2, & y2);
* y = y2; * y = y2;
} }
else else
#endif #endif
{ {
// x is wrong since the horizontal scrollbar is controlled by the // x is wrong since the horizontal scrollbar is controlled by the
// tree control, but we probably don't need it. // tree control, but we probably don't need it.
scrolledWindow->GetViewStart(x, y); scrolledWindow->GetViewStart(x, y);
} }
} }
// In case we're using the generic tree control. // In case we're using the generic tree control.
@@ -178,7 +178,7 @@ void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc)
{ {
if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
{ {
wxScrolledWindow* scrolledWindow = GetScrolledWindow(); wxScrolledWindow* scrolledWindow = GetScrolledWindow();
wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
@@ -207,9 +207,9 @@ void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVer
if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl))) if (!IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
#endif #endif
{ {
UINT sbCode = SB_THUMBPOSITION; UINT sbCode = SB_THUMBPOSITION;
HWND vertScrollBar = 0; HWND vertScrollBar = 0;
MSWDefWindowProc((WXUINT) WM_VSCROLL, MAKELONG(sbCode, posVert), (WXLPARAM) vertScrollBar); MSWDefWindowProc((WXUINT) WM_VSCROLL, MAKELONG(sbCode, posVert), (WXLPARAM) vertScrollBar);
} }
#if USE_GENERIC_TREECTRL #if USE_GENERIC_TREECTRL
else else
@@ -218,39 +218,39 @@ void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVer
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
{ {
wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
win->Refresh(); win->Refresh();
/* Doesn't work yet because scrolling is ignored by Scroll /* Doesn't work yet because scrolling is ignored by Scroll
int xppu, yppu; int xppu, yppu;
wxScrolledWindow* scrolledWindow = GetScrolledWindow(); wxScrolledWindow* scrolledWindow = GetScrolledWindow();
if (scrolledWindow) if (scrolledWindow)
{ {
scrolledWindow->GetScrollPixelsPerUnit(& xppu, & yppu); scrolledWindow->GetScrollPixelsPerUnit(& xppu, & yppu);
win->Scroll(-1, posVert*yppu); win->Scroll(-1, posVert*yppu);
} }
*/ */
} }
#endif #endif
} }
void wxRemotelyScrolledTreeCtrl::OnSize(wxSizeEvent& event) void wxRemotelyScrolledTreeCtrl::OnSize(wxSizeEvent& event)
{ {
HideVScrollbar(); HideVScrollbar();
AdjustRemoteScrollbars(); AdjustRemoteScrollbars();
event.Skip(); event.Skip();
} }
void wxRemotelyScrolledTreeCtrl::OnExpand(wxTreeEvent& event) void wxRemotelyScrolledTreeCtrl::OnExpand(wxTreeEvent& event)
{ {
AdjustRemoteScrollbars(); AdjustRemoteScrollbars();
event.Skip(); event.Skip();
// If we don't have this, we get some bits of lines still remaining // If we don't have this, we get some bits of lines still remaining
if (event.GetEventType() == wxEVT_COMMAND_TREE_ITEM_COLLAPSED) if (event.GetEventType() == wxEVT_COMMAND_TREE_ITEM_COLLAPSED)
Refresh(); Refresh();
// Pass on the event // Pass on the event
if (m_companionWindow) if (m_companionWindow)
m_companionWindow->GetEventHandler()->ProcessEvent(event); m_companionWindow->GetEventHandler()->ProcessEvent(event);
} }
// Adjust the containing wxScrolledWindow's scrollbars appropriately // Adjust the containing wxScrolledWindow's scrollbars appropriately
@@ -258,50 +258,50 @@ void wxRemotelyScrolledTreeCtrl::AdjustRemoteScrollbars()
{ {
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) #if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
{ {
// This is for the generic tree control. // This is for the generic tree control.
// It calls SetScrollbars which has been overridden // It calls SetScrollbars which has been overridden
// to adjust the parent scrolled window vertical // to adjust the parent scrolled window vertical
// scrollbar. // scrollbar.
((wxGenericTreeCtrl*) this)->AdjustMyScrollbars(); ((wxGenericTreeCtrl*) this)->AdjustMyScrollbars();
return; return;
} }
else else
#endif #endif
{ {
// This is for the wxMSW tree control // This is for the wxMSW tree control
wxScrolledWindow* scrolledWindow = GetScrolledWindow(); wxScrolledWindow* scrolledWindow = GetScrolledWindow();
if (scrolledWindow) if (scrolledWindow)
{ {
wxRect itemRect; wxRect itemRect;
if (GetBoundingRect(GetRootItem(), itemRect)) if (GetBoundingRect(GetRootItem(), itemRect))
{ {
// Actually, the real height seems to be 1 less than reported // Actually, the real height seems to be 1 less than reported
// (e.g. 16 instead of 16) // (e.g. 16 instead of 16)
int itemHeight = itemRect.GetHeight() - 1; int itemHeight = itemRect.GetHeight() - 1;
int w, h; int w, h;
GetClientSize(&w, &h); GetClientSize(&w, &h);
wxRect rect(0, 0, 0, 0); wxRect rect(0, 0, 0, 0);
CalcTreeSize(rect); CalcTreeSize(rect);
double f = ((double) (rect.GetHeight()) / (double) itemHeight) ; double f = ((double) (rect.GetHeight()) / (double) itemHeight) ;
int treeViewHeight = (int) ceil(f); int treeViewHeight = (int) ceil(f);
int scrollPixelsPerLine = itemHeight; int scrollPixelsPerLine = itemHeight;
int scrollPos = - (itemRect.y / itemHeight); int scrollPos = - (itemRect.y / itemHeight);
scrolledWindow->SetScrollbars(0, scrollPixelsPerLine, 0, treeViewHeight, 0, scrollPos); scrolledWindow->SetScrollbars(0, scrollPixelsPerLine, 0, treeViewHeight, 0, scrollPos);
// Ensure that when a scrollbar becomes hidden or visible, // Ensure that when a scrollbar becomes hidden or visible,
// the contained window sizes are right. // the contained window sizes are right.
// Problem: this is called too early (?) // Problem: this is called too early (?)
wxSizeEvent event(scrolledWindow->GetSize(), scrolledWindow->GetId()); wxSizeEvent event(scrolledWindow->GetSize(), scrolledWindow->GetId());
scrolledWindow->GetEventHandler()->ProcessEvent(event); scrolledWindow->GetEventHandler()->ProcessEvent(event);
} }
} }
} }
} }
@@ -330,40 +330,40 @@ static wxRect CombineRectangles(const wxRect& rect1, const wxRect& rect2)
// correctly // correctly
void wxRemotelyScrolledTreeCtrl::CalcTreeSize(wxRect& rect) void wxRemotelyScrolledTreeCtrl::CalcTreeSize(wxRect& rect)
{ {
CalcTreeSize(GetRootItem(), rect); CalcTreeSize(GetRootItem(), rect);
} }
void wxRemotelyScrolledTreeCtrl::CalcTreeSize(const wxTreeItemId& id, wxRect& rect) void wxRemotelyScrolledTreeCtrl::CalcTreeSize(const wxTreeItemId& id, wxRect& rect)
{ {
// More efficient implementation would be to find the last item (but how?) // More efficient implementation would be to find the last item (but how?)
// Q: is the bounding rect relative to the top of the virtual tree workspace // Q: is the bounding rect relative to the top of the virtual tree workspace
// or the top of the window? How would we convert? // or the top of the window? How would we convert?
wxRect itemSize; wxRect itemSize;
if (GetBoundingRect(id, itemSize)) if (GetBoundingRect(id, itemSize))
{ {
rect = CombineRectangles(rect, itemSize); rect = CombineRectangles(rect, itemSize);
} }
void* cookie; void* cookie;
wxTreeItemId childId = GetFirstChild(id, cookie); wxTreeItemId childId = GetFirstChild(id, cookie);
while (childId) while (childId)
{ {
CalcTreeSize(childId, rect); CalcTreeSize(childId, rect);
childId = GetNextChild(childId, cookie); childId = GetNextChild(childId, cookie);
} }
} }
// Find the scrolled window that contains this control // Find the scrolled window that contains this control
wxScrolledWindow* wxRemotelyScrolledTreeCtrl::GetScrolledWindow() const wxScrolledWindow* wxRemotelyScrolledTreeCtrl::GetScrolledWindow() const
{ {
wxWindow* parent = wxWindow::GetParent(); wxWindow* parent = wxWindow::GetParent();
while (parent) while (parent)
{ {
if (parent->IsKindOf(CLASSINFO(wxScrolledWindow))) if (parent->IsKindOf(CLASSINFO(wxScrolledWindow)))
return (wxScrolledWindow*) parent; return (wxScrolledWindow*) parent;
parent = parent->GetParent(); parent = parent->GetParent();
} }
return NULL; return NULL;
} }
void wxRemotelyScrolledTreeCtrl::OnScroll(wxScrollWinEvent& event) void wxRemotelyScrolledTreeCtrl::OnScroll(wxScrollWinEvent& event)
@@ -393,77 +393,77 @@ void wxRemotelyScrolledTreeCtrl::OnScroll(wxScrollWinEvent& event)
IMPLEMENT_CLASS(wxTreeCompanionWindow, wxWindow) IMPLEMENT_CLASS(wxTreeCompanionWindow, wxWindow)
BEGIN_EVENT_TABLE(wxTreeCompanionWindow, wxWindow) BEGIN_EVENT_TABLE(wxTreeCompanionWindow, wxWindow)
EVT_PAINT(wxTreeCompanionWindow::OnPaint) EVT_PAINT(wxTreeCompanionWindow::OnPaint)
EVT_SCROLLWIN(wxTreeCompanionWindow::OnScroll) EVT_SCROLLWIN(wxTreeCompanionWindow::OnScroll)
EVT_TREE_ITEM_EXPANDED(-1, wxTreeCompanionWindow::OnExpand) EVT_TREE_ITEM_EXPANDED(wxID_ANY, wxTreeCompanionWindow::OnExpand)
EVT_TREE_ITEM_COLLAPSED(-1, wxTreeCompanionWindow::OnExpand) EVT_TREE_ITEM_COLLAPSED(wxID_ANY, wxTreeCompanionWindow::OnExpand)
END_EVENT_TABLE() END_EVENT_TABLE()
wxTreeCompanionWindow::wxTreeCompanionWindow(wxWindow* parent, wxWindowID id, wxTreeCompanionWindow::wxTreeCompanionWindow(wxWindow* parent, wxWindowID id,
const wxPoint& pos, const wxPoint& pos,
const wxSize& sz, const wxSize& sz,
long style): long style):
wxWindow(parent, id, pos, sz, style) wxWindow(parent, id, pos, sz, style)
{ {
m_treeCtrl = NULL; m_treeCtrl = NULL;
} }
void wxTreeCompanionWindow::DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect) void wxTreeCompanionWindow::DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect)
{ {
// TEST CODE // TEST CODE
#if 1 #if 1
if (m_treeCtrl) if (m_treeCtrl)
{ {
wxString text = m_treeCtrl->GetItemText(id); wxString text = m_treeCtrl->GetItemText(id);
dc.SetTextForeground(* wxBLACK); dc.SetTextForeground(* wxBLACK);
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
int textW, textH; int textW, textH;
dc.GetTextExtent(text, & textW, & textH); dc.GetTextExtent(text, & textW, & textH);
int x = 5; int x = 5;
int y = rect.GetY() + wxMax(0, (rect.GetHeight() - textH) / 2); int y = rect.GetY() + wxMax(0, (rect.GetHeight() - textH) / 2);
dc.DrawText(text, x, y); dc.DrawText(text, x, y);
} }
#endif #endif
} }
void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
{ {
wxPaintDC dc(this); wxPaintDC dc(this);
if (!m_treeCtrl) if (!m_treeCtrl)
return; return;
wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID); wxPen pen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT), 1, wxSOLID);
dc.SetPen(pen); dc.SetPen(pen);
dc.SetBrush(* wxTRANSPARENT_BRUSH); dc.SetBrush(* wxTRANSPARENT_BRUSH);
wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
dc.SetFont(font); dc.SetFont(font);
wxSize clientSize = GetClientSize(); wxSize clientSize = GetClientSize();
wxRect itemRect; wxRect itemRect;
wxTreeItemId h, lastH; wxTreeItemId h, lastH;
for(h=m_treeCtrl->GetFirstVisibleItem();h;h=m_treeCtrl->GetNextVisible(h)) for(h=m_treeCtrl->GetFirstVisibleItem();h;h=m_treeCtrl->GetNextVisible(h))
{ {
if (m_treeCtrl->GetBoundingRect(h, itemRect)) if (m_treeCtrl->GetBoundingRect(h, itemRect))
{ {
int cy = itemRect.GetTop(); int cy = itemRect.GetTop();
wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight()); wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight());
lastH = h; lastH = h;
// Draw the actual item // Draw the actual item
DrawItem(dc, h, drawItemRect); DrawItem(dc, h, drawItemRect);
dc.DrawLine(0, cy, clientSize.x, cy); dc.DrawLine(0, cy, clientSize.x, cy);
} }
} }
if (lastH.IsOk() && m_treeCtrl->GetBoundingRect(lastH, itemRect)) if (lastH.IsOk() && m_treeCtrl->GetBoundingRect(lastH, itemRect))
{ {
int cy = itemRect.GetBottom(); int cy = itemRect.GetBottom();
dc.DrawLine(0, cy, clientSize.x, cy); dc.DrawLine(0, cy, clientSize.x, cy);
} }
} }
void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event) void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event)
@@ -477,15 +477,15 @@ void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event)
if (!m_treeCtrl) if (!m_treeCtrl)
return; return;
// TODO: scroll the window physically instead of just refreshing. // TODO: scroll the window physically instead of just refreshing.
Refresh(TRUE); Refresh(true);
} }
void wxTreeCompanionWindow::OnExpand(wxTreeEvent& WXUNUSED(event)) void wxTreeCompanionWindow::OnExpand(wxTreeEvent& WXUNUSED(event))
{ {
// TODO: something more optimized than simply refresh the whole // TODO: something more optimized than simply refresh the whole
// window when the tree is expanded/collapsed. Tricky. // window when the tree is expanded/collapsed. Tricky.
Refresh(); Refresh();
} }
/* /*
@@ -495,7 +495,7 @@ void wxTreeCompanionWindow::OnExpand(wxTreeEvent& WXUNUSED(event))
IMPLEMENT_CLASS(wxThinSplitterWindow, wxSplitterWindow) IMPLEMENT_CLASS(wxThinSplitterWindow, wxSplitterWindow)
BEGIN_EVENT_TABLE(wxThinSplitterWindow, wxSplitterWindow) BEGIN_EVENT_TABLE(wxThinSplitterWindow, wxSplitterWindow)
EVT_SIZE(wxThinSplitterWindow::OnSize) EVT_SIZE(wxThinSplitterWindow::OnSize)
END_EVENT_TABLE() END_EVENT_TABLE()
wxThinSplitterWindow::wxThinSplitterWindow(wxWindow* parent, wxWindowID id, wxThinSplitterWindow::wxThinSplitterWindow(wxWindow* parent, wxWindowID id,
@@ -512,9 +512,9 @@ wxThinSplitterWindow::~wxThinSplitterWindow()
void wxThinSplitterWindow::SizeWindows() void wxThinSplitterWindow::SizeWindows()
{ {
// The client size may have changed inbetween // The client size may have changed inbetween
// the sizing of the first window and the sizing of // the sizing of the first window and the sizing of
// the second. So repeat SizeWindows. // the second. So repeat SizeWindows.
wxSplitterWindow::SizeWindows(); wxSplitterWindow::SizeWindows();
wxSplitterWindow::SizeWindows(); wxSplitterWindow::SizeWindows();
} }
@@ -522,7 +522,7 @@ void wxThinSplitterWindow::SizeWindows()
// Tests for x, y over sash // Tests for x, y over sash
bool wxThinSplitterWindow::SashHitTest(int x, int y, int WXUNUSED(tolerance)) bool wxThinSplitterWindow::SashHitTest(int x, int y, int WXUNUSED(tolerance))
{ {
return wxSplitterWindow::SashHitTest(x, y, 4); return wxSplitterWindow::SashHitTest(x, y, 4);
} }
void wxThinSplitterWindow::DrawSash(wxDC& dc) void wxThinSplitterWindow::DrawSash(wxDC& dc)
@@ -535,34 +535,34 @@ void wxThinSplitterWindow::DrawSash(wxDC& dc)
int w, h; int w, h;
GetClientSize(&w, &h); GetClientSize(&w, &h);
if ( m_splitMode == wxSPLIT_VERTICAL ) if ( m_splitMode == wxSPLIT_VERTICAL )
{ {
dc.SetPen(* m_facePen); dc.SetPen(* m_facePen);
dc.SetBrush(* m_faceBrush); dc.SetBrush(* m_faceBrush);
int h1 = h-1; int h1 = h-1;
int y1 = 0; int y1 = 0;
if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER ) if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER )
h1 += 1; // Not sure why this is necessary... h1 += 1; // Not sure why this is necessary...
if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER) if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER)
{ {
y1 = 2; h1 -= 3; y1 = 2; h1 -= 3;
} }
dc.DrawRectangle(GetSashPosition(), y1, GetSashSize(), h1); dc.DrawRectangle(GetSashPosition(), y1, GetSashSize(), h1);
} }
else else
{ {
dc.SetPen(* m_facePen); dc.SetPen(* m_facePen);
dc.SetBrush(* m_faceBrush); dc.SetBrush(* m_faceBrush);
int w1 = w-1; int w1 = w-1;
int x1 = 0; int x1 = 0;
if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER ) if ( (GetWindowStyleFlag() & wxSP_BORDER) != wxSP_BORDER && (GetWindowStyleFlag() & wxSP_3DBORDER) != wxSP_3DBORDER )
w1 ++; w1 ++;
if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER) if ( (GetWindowStyleFlag() & wxSP_3DBORDER) == wxSP_3DBORDER)
{ {
x1 = 2; w1 -= 3; x1 = 2; w1 -= 3;
} }
dc.DrawRectangle(x1, GetSashPosition(), w1, GetSashSize()); dc.DrawRectangle(x1, GetSashPosition(), w1, GetSashSize());
} }
dc.SetPen(wxNullPen); dc.SetPen(wxNullPen);
dc.SetBrush(wxNullBrush); dc.SetBrush(wxNullBrush);
@@ -570,7 +570,7 @@ void wxThinSplitterWindow::DrawSash(wxDC& dc)
void wxThinSplitterWindow::OnSize(wxSizeEvent& event) void wxThinSplitterWindow::OnSize(wxSizeEvent& event)
{ {
wxSplitterWindow::OnSize(event); wxSplitterWindow::OnSize(event);
} }
/* /*
@@ -580,8 +580,8 @@ void wxThinSplitterWindow::OnSize(wxSizeEvent& event)
IMPLEMENT_CLASS(wxSplitterScrolledWindow, wxScrolledWindow) IMPLEMENT_CLASS(wxSplitterScrolledWindow, wxScrolledWindow)
BEGIN_EVENT_TABLE(wxSplitterScrolledWindow, wxScrolledWindow) BEGIN_EVENT_TABLE(wxSplitterScrolledWindow, wxScrolledWindow)
EVT_SCROLLWIN(wxSplitterScrolledWindow::OnScroll) EVT_SCROLLWIN(wxSplitterScrolledWindow::OnScroll)
EVT_SIZE(wxSplitterScrolledWindow::OnSize) EVT_SIZE(wxSplitterScrolledWindow::OnSize)
END_EVENT_TABLE() END_EVENT_TABLE()
wxSplitterScrolledWindow::wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id, wxSplitterScrolledWindow::wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id,
@@ -594,48 +594,48 @@ wxSplitterScrolledWindow::wxSplitterScrolledWindow(wxWindow* parent, wxWindowID
void wxSplitterScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event)) void wxSplitterScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event))
{ {
wxSize sz = GetClientSize(); wxSize sz = GetClientSize();
if (GetChildren().GetFirst()) if (GetChildren().GetFirst())
{ {
((wxWindow*) GetChildren().GetFirst()->GetData())->SetSize(0, 0, sz.x, sz.y); ((wxWindow*) GetChildren().GetFirst()->GetData())->SetSize(0, 0, sz.x, sz.y);
} }
} }
void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event) void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
{ {
// Ensure that events being propagated back up the window hierarchy // Ensure that events being propagated back up the window hierarchy
// don't cause an infinite loop // don't cause an infinite loop
static bool inOnScroll = FALSE; static bool inOnScroll = false;
if (inOnScroll) if (inOnScroll)
{ {
event.Skip(); event.Skip();
return; return;
} }
inOnScroll = TRUE; inOnScroll = true;
int orient = event.GetOrientation(); int orient = event.GetOrientation();
int nScrollInc = CalcScrollInc(event); int nScrollInc = CalcScrollInc(event);
if (nScrollInc == 0) if (nScrollInc == 0)
{ {
inOnScroll = FALSE; inOnScroll = false;
return; return;
} }
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
inOnScroll = FALSE; inOnScroll = false;
event.Skip(); event.Skip();
return; return;
#if 0 #if 0
int newPos = m_xScrollPosition + nScrollInc; int newPos = m_xScrollPosition + nScrollInc;
SetScrollPos(wxHORIZONTAL, newPos, TRUE ); SetScrollPos(wxHORIZONTAL, newPos, true );
#endif #endif
} }
else else
{ {
int newPos = m_yScrollPosition + nScrollInc; int newPos = m_yScrollPosition + nScrollInc;
SetScrollPos(wxVERTICAL, newPos, TRUE ); SetScrollPos(wxVERTICAL, newPos, true );
} }
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
@@ -668,6 +668,6 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
m_targetWindow->MacUpdateImmediately() ; m_targetWindow->MacUpdateImmediately() ;
#endif #endif
inOnScroll = FALSE; inOnScroll = false;
} }

View File

@@ -15,7 +15,7 @@
#define _WX_SPLITTREE_H_ #define _WX_SPLITTREE_H_
#if defined(__GNUG__) && !defined(__APPLE__) #if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "splittree.h" #pragma interface "splittree.h"
#endif #endif
// Set this to 1 to use generic tree control (doesn't yet work properly) // Set this to 1 to use generic tree control (doesn't yet work properly)
@@ -48,15 +48,15 @@ class wxSplitterScrolledWindow;
class wxRemotelyScrolledTreeCtrl: public wxTreeCtrl class wxRemotelyScrolledTreeCtrl: public wxTreeCtrl
{ {
DECLARE_CLASS(wxRemotelyScrolledTreeCtrl) DECLARE_CLASS(wxRemotelyScrolledTreeCtrl)
public: public:
wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt = wxDefaultPosition, wxRemotelyScrolledTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pt = wxDefaultPosition,
const wxSize& sz = wxDefaultSize, long style = wxTR_HAS_BUTTONS); const wxSize& sz = wxDefaultSize, long style = wxTR_HAS_BUTTONS);
~wxRemotelyScrolledTreeCtrl(); ~wxRemotelyScrolledTreeCtrl();
//// Events //// Events
void OnSize(wxSizeEvent& event); void OnSize(wxSizeEvent& event);
void OnExpand(wxTreeEvent& event); void OnExpand(wxTreeEvent& event);
void OnScroll(wxScrollWinEvent& event); void OnScroll(wxScrollWinEvent& event);
//// Overrides //// Overrides
@@ -69,7 +69,7 @@ public:
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
int noUnitsX, int noUnitsY, int noUnitsX, int noUnitsY,
int xPos = 0, int yPos = 0, int xPos = 0, int yPos = 0,
bool noRefresh = FALSE ); bool noRefresh = false );
// In case we're using the generic tree control. // In case we're using the generic tree control.
// Get the view start // Get the view start
@@ -82,18 +82,18 @@ public:
virtual int GetScrollPos(int orient) const; virtual int GetScrollPos(int orient) const;
//// Helpers //// Helpers
void HideVScrollbar(); void HideVScrollbar();
// Calculate the tree overall size so we can set the scrollbar // Calculate the tree overall size so we can set the scrollbar
// correctly // correctly
void CalcTreeSize(wxRect& rect); void CalcTreeSize(wxRect& rect);
void CalcTreeSize(const wxTreeItemId& id, wxRect& rect); void CalcTreeSize(const wxTreeItemId& id, wxRect& rect);
// Adjust the containing wxScrolledWindow's scrollbars appropriately // Adjust the containing wxScrolledWindow's scrollbars appropriately
void AdjustRemoteScrollbars(); void AdjustRemoteScrollbars();
// Find the scrolled window that contains this control // Find the scrolled window that contains this control
wxScrolledWindow* GetScrolledWindow() const; wxScrolledWindow* GetScrolledWindow() const;
// Scroll to the given line (in scroll units where each unit is // Scroll to the given line (in scroll units where each unit is
// the height of an item) // the height of an item)
@@ -101,15 +101,15 @@ public:
//// Accessors //// Accessors
// The companion window is one which will get notified when certain // The companion window is one which will get notified when certain
// events happen such as node expansion // events happen such as node expansion
void SetCompanionWindow(wxWindow* companion) { m_companionWindow = companion; } void SetCompanionWindow(wxWindow* companion) { m_companionWindow = companion; }
wxWindow* GetCompanionWindow() const { return m_companionWindow; } wxWindow* GetCompanionWindow() const { return m_companionWindow; }
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
protected: protected:
wxWindow* m_companionWindow; wxWindow* m_companionWindow;
}; };
/* /*
@@ -123,28 +123,28 @@ class wxTreeCompanionWindow: public wxWindow
public: public:
DECLARE_CLASS(wxTreeCompanionWindow) DECLARE_CLASS(wxTreeCompanionWindow)
wxTreeCompanionWindow(wxWindow* parent, wxWindowID id = -1, wxTreeCompanionWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize, const wxSize& sz = wxDefaultSize,
long style = 0); long style = 0);
//// Overrides //// Overrides
virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect); virtual void DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& rect);
//// Events //// Events
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnScroll(wxScrollWinEvent& event); void OnScroll(wxScrollWinEvent& event);
void OnExpand(wxTreeEvent& event); void OnExpand(wxTreeEvent& event);
//// Operations //// Operations
//// Accessors //// Accessors
wxRemotelyScrolledTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; }; wxRemotelyScrolledTreeCtrl* GetTreeCtrl() const { return m_treeCtrl; };
void SetTreeCtrl(wxRemotelyScrolledTreeCtrl* treeCtrl) { m_treeCtrl = treeCtrl; } void SetTreeCtrl(wxRemotelyScrolledTreeCtrl* treeCtrl) { m_treeCtrl = treeCtrl; }
//// Data members //// Data members
protected: protected:
wxRemotelyScrolledTreeCtrl* m_treeCtrl; wxRemotelyScrolledTreeCtrl* m_treeCtrl;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@@ -162,7 +162,7 @@ class wxThinSplitterWindow: public wxSplitterWindow
public: public:
DECLARE_DYNAMIC_CLASS(wxThinSplitterWindow) DECLARE_DYNAMIC_CLASS(wxThinSplitterWindow)
wxThinSplitterWindow(wxWindow* parent, wxWindowID id = -1, wxThinSplitterWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize, const wxSize& sz = wxDefaultSize,
long style = wxSP_3D | wxCLIP_CHILDREN); long style = wxSP_3D | wxCLIP_CHILDREN);
@@ -174,7 +174,7 @@ public:
// Tests for x, y over sash. Overriding this allows us to increase // Tests for x, y over sash. Overriding this allows us to increase
// the tolerance. // the tolerance.
bool SashHitTest(int x, int y, int tolerance = 2); bool SashHitTest(int x, int y, int tolerance = 2);
void DrawSash(wxDC& dc); void DrawSash(wxDC& dc);
//// Events //// Events
@@ -203,7 +203,7 @@ class wxSplitterScrolledWindow: public wxScrolledWindow
public: public:
DECLARE_DYNAMIC_CLASS(wxSplitterScrolledWindow) DECLARE_DYNAMIC_CLASS(wxSplitterScrolledWindow)
wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = -1, wxSplitterScrolledWindow(wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize, const wxSize& sz = wxDefaultSize,
long style = 0); long style = 0);

View File

@@ -24,7 +24,7 @@
class WXDLLIMPEXP_XRC wxGaugeXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxGaugeXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxGaugeXmlHandler) DECLARE_DYNAMIC_CLASS(wxGaugeXmlHandler)
enum enum
{ {
wxGAUGE_DEFAULT_RANGE = 100 wxGAUGE_DEFAULT_RANGE = 100

View File

@@ -31,7 +31,7 @@ private:
class WXDLLIMPEXP_XRC wxMenuBarXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxMenuBarXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxMenuBarXmlHandler) DECLARE_DYNAMIC_CLASS(wxMenuBarXmlHandler)
public: public:
wxMenuBarXmlHandler(); wxMenuBarXmlHandler();
virtual wxObject *DoCreateResource(); virtual wxObject *DoCreateResource();

View File

@@ -22,7 +22,7 @@
class WXDLLIMPEXP_XRC wxScrollBarXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxScrollBarXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxScrollBarXmlHandler) DECLARE_DYNAMIC_CLASS(wxScrollBarXmlHandler)
enum enum
{ {
wxSL_DEFAULT_VALUE = 0, wxSL_DEFAULT_VALUE = 0,

View File

@@ -22,7 +22,7 @@
class WXDLLIMPEXP_XRC wxSliderXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxSliderXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxSliderXmlHandler) DECLARE_DYNAMIC_CLASS(wxSliderXmlHandler)
enum enum
{ {
wxSL_DEFAULT_VALUE = 0, wxSL_DEFAULT_VALUE = 0,

View File

@@ -21,7 +21,7 @@
#if wxUSE_SPINBTN #if wxUSE_SPINBTN
class WXDLLIMPEXP_XRC wxSpinButtonXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxSpinButtonXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxSpinButtonXmlHandler) DECLARE_DYNAMIC_CLASS(wxSpinButtonXmlHandler)
enum enum
{ {
wxSP_DEFAULT_VALUE = 0, wxSP_DEFAULT_VALUE = 0,
@@ -39,7 +39,7 @@ public:
#if wxUSE_SPINCTRL #if wxUSE_SPINCTRL
class WXDLLIMPEXP_XRC wxSpinCtrlXmlHandler : public wxXmlResourceHandler class WXDLLIMPEXP_XRC wxSpinCtrlXmlHandler : public wxXmlResourceHandler
{ {
DECLARE_DYNAMIC_CLASS(wxSpinCtrlXmlHandler) DECLARE_DYNAMIC_CLASS(wxSpinCtrlXmlHandler)
enum enum
{ {
wxSP_DEFAULT_VALUE = 0, wxSP_DEFAULT_VALUE = 0,

View File

@@ -240,7 +240,7 @@ protected:
bool UpdateResources(); bool UpdateResources();
// Finds a resource (calls UpdateResources) and returns a node containing it. // Finds a resource (calls UpdateResources) and returns a node containing it.
wxXmlNode *FindResource(const wxString& name, const wxString& classname, bool recursive = FALSE); wxXmlNode *FindResource(const wxString& name, const wxString& classname, bool recursive = false);
// Helper function: finds a resource (calls UpdateResources) and returns a node containing it. // Helper function: finds a resource (calls UpdateResources) and returns a node containing it.
wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name, const wxString& classname, bool recursive); wxXmlNode *DoFindResource(wxXmlNode *parent, const wxString& name, const wxString& classname, bool recursive);
@@ -329,8 +329,8 @@ public:
// were filled. // were filled.
virtual wxObject *DoCreateResource() = 0; virtual wxObject *DoCreateResource() = 0;
// Returns TRUE if it understands this node and can create // Returns true if it understands this node and can create
// a resource from it, FALSE otherwise. // a resource from it, false otherwise.
virtual bool CanHandle(wxXmlNode *node) = 0; virtual bool CanHandle(wxXmlNode *node) = 0;
// Sets the parent resource. // Sets the parent resource.
@@ -385,7 +385,7 @@ protected:
// - replaces \n, \r, \t by respective chars (according to C syntax) // - replaces \n, \r, \t by respective chars (according to C syntax)
// - replaces _ by & and __ by _ (needed for _File => &File because of XML) // - replaces _ by & and __ by _ (needed for _File => &File because of XML)
// - calls wxGetTranslations (unless disabled in wxXmlResource) // - calls wxGetTranslations (unless disabled in wxXmlResource)
wxString GetText(const wxString& param, bool translate = TRUE); wxString GetText(const wxString& param, bool translate = true);
// Returns the XRCID. // Returns the XRCID.
int GetID(); int GetID();
@@ -393,8 +393,8 @@ protected:
// Returns the resource name. // Returns the resource name.
wxString GetName(); wxString GetName();
// Gets a bool flag (1, t, yes, on, true are TRUE, everything else is FALSE). // Gets a bool flag (1, t, yes, on, true are true, everything else is false).
bool GetBool(const wxString& param, bool defaultv = FALSE); bool GetBool(const wxString& param, bool defaultv = false);
// Gets the integer value from the parameter. // Gets the integer value from the parameter.
long GetLong( const wxString& param, long defaultv = 0 ); long GetLong( const wxString& param, long defaultv = 0 );
@@ -428,7 +428,7 @@ protected:
void SetupWindow(wxWindow *wnd); void SetupWindow(wxWindow *wnd);
// Creates children. // Creates children.
void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE); void CreateChildren(wxObject *parent, bool this_hnd_only = false);
// Helper function. // Helper function.
void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL); void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL);

View File

@@ -119,8 +119,8 @@ void MyResizableListCtrl::ContextSensitiveMenu( wxMouseEvent& event )
// If no listctrl rows selected, then disable the menu items that // If no listctrl rows selected, then disable the menu items that
// require selection // require selection
if ( GetSelectedItemCount() == 0 ) { if ( GetSelectedItemCount() == 0 ) {
a_menu.Enable( PU_EDIT_RECORD, FALSE ); a_menu.Enable( PU_EDIT_RECORD, false );
a_menu.Enable( PU_DELETE_RECORD, FALSE ); a_menu.Enable( PU_DELETE_RECORD, false );
} }
// Show the popup menu (wxWindow::PopupMenu ), at the x,y position // Show the popup menu (wxWindow::PopupMenu ), at the x,y position

View File

@@ -60,7 +60,7 @@ public:
column. column.
*/ */
MyResizableListCtrl( wxWindow *parent = NULL, MyResizableListCtrl( wxWindow *parent = NULL,
wxWindowID id = -1, wxWindowID id = wxID_ANY,
const wxPoint &pos = wxDefaultPosition, const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize, const wxSize &size = wxDefaultSize,
long style = wxLC_REPORT, long style = wxLC_REPORT,

View File

@@ -96,7 +96,7 @@ void PreferencesDialog::OuUpdateUIMyCheckbox( wxUpdateUIEvent &WXUNUSED(event) )
// this is the XRCCTRL way (which is more obvious as to what is going on). // this is the XRCCTRL way (which is more obvious as to what is going on).
myCheckBoxIsChecked = XRCCTRL(*this, "my_checkbox", wxCheckBox)->IsChecked(); myCheckBoxIsChecked = XRCCTRL(*this, "my_checkbox", wxCheckBox)->IsChecked();
// Now call either Enable(TRUE) or Enable(FALSE) on the textctrl, depending // Now call either Enable(true) or Enable(false) on the textctrl, depending
// on the value of that boolean. // on the value of that boolean.
XRCCTRL(*this, "my_textctrl", wxTextCtrl)->Enable(myCheckBoxIsChecked); XRCCTRL(*this, "my_textctrl", wxTextCtrl)->Enable(myCheckBoxIsChecked);
} }

View File

@@ -136,8 +136,8 @@ MyFrame::MyFrame(wxWindow* parent)
void MyFrame::OnExitToolOrMenuCommand(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnExitToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
{ {
// TRUE is to force the frame to close. // true is to force the frame to close.
Close(TRUE); Close(true);
} }
@@ -223,7 +223,7 @@ void MyFrame::OnCustomClassToolOrMenuCommand(wxCommandEvent& WXUNUSED(event))
// Make an instance of our new custom class. // Make an instance of our new custom class.
MyResizableListCtrl* a_myResizableListCtrl = new MyResizableListCtrl(&dlg, MyResizableListCtrl* a_myResizableListCtrl = new MyResizableListCtrl(&dlg,
-1, wxID_ANY,
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize, wxDefaultSize,
wxLC_REPORT, wxLC_REPORT,

View File

@@ -116,9 +116,9 @@ bool MyApp::OnInit()
MyFrame *frame = new MyFrame(); MyFrame *frame = new MyFrame();
// Show the frame. // Show the frame.
frame->Show(TRUE); frame->Show(true);
// Return TRUE to tell program to continue (FALSE would terminate). // Return true to tell program to continue (false would terminate).
return TRUE; return true;
} }

View File

@@ -29,7 +29,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxCheckListBoxXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxCheckListBoxXmlHandler, wxXmlResourceHandler)
wxCheckListBoxXmlHandler::wxCheckListBoxXmlHandler() wxCheckListBoxXmlHandler::wxCheckListBoxXmlHandler()
: wxXmlResourceHandler(), m_insideBox(FALSE) : wxXmlResourceHandler(), m_insideBox(false)
{ {
// no styles // no styles
AddWindowStyles(); AddWindowStyles();
@@ -48,7 +48,7 @@ wxObject *wxCheckListBoxXmlHandler::DoCreateResource()
wxLogDebug(wxT("'wxCheckList' name is deprecated, use 'wxCheckListBox' instead.")); wxLogDebug(wxT("'wxCheckList' name is deprecated, use 'wxCheckListBox' instead."));
#endif #endif
// need to build the list of strings from children // need to build the list of strings from children
m_insideBox = TRUE; m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL; wxString *strings = (wxString *) NULL;
if (strList.GetCount() > 0) if (strList.GetCount() > 0)
@@ -84,7 +84,7 @@ wxObject *wxCheckListBoxXmlHandler::DoCreateResource()
wxString v = n->GetPropVal(wxT("checked"), wxEmptyString); wxString v = n->GetPropVal(wxT("checked"), wxEmptyString);
v.MakeLower(); v.MakeLower();
if (v && v == wxT("1")) if (v && v == wxT("1"))
control->Check( i, TRUE ); control->Check( i, true );
i++; i++;
n = n->GetNext(); n = n->GetNext();

View File

@@ -26,7 +26,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxChoiceXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxChoiceXmlHandler, wxXmlResourceHandler)
wxChoiceXmlHandler::wxChoiceXmlHandler() wxChoiceXmlHandler::wxChoiceXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE) : wxXmlResourceHandler() , m_insideBox(false)
{ {
XRC_ADD_STYLE(wxCB_SORT); XRC_ADD_STYLE(wxCB_SORT);
AddWindowStyles(); AddWindowStyles();
@@ -40,7 +40,7 @@ wxObject *wxChoiceXmlHandler::DoCreateResource()
long selection = GetLong(wxT("selection"), -1); long selection = GetLong(wxT("selection"), -1);
// need to build the list of strings from children // need to build the list of strings from children
m_insideBox = TRUE; m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL; wxString *strings = (wxString *) NULL;
if (strList.GetCount() > 0) if (strList.GetCount() > 0)

View File

@@ -28,7 +28,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxComboBoxXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxComboBoxXmlHandler, wxXmlResourceHandler)
wxComboBoxXmlHandler::wxComboBoxXmlHandler() wxComboBoxXmlHandler::wxComboBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE) : wxXmlResourceHandler() , m_insideBox(false)
{ {
XRC_ADD_STYLE(wxCB_SIMPLE); XRC_ADD_STYLE(wxCB_SIMPLE);
XRC_ADD_STYLE(wxCB_SORT); XRC_ADD_STYLE(wxCB_SORT);
@@ -45,7 +45,7 @@ wxObject *wxComboBoxXmlHandler::DoCreateResource()
long selection = GetLong( wxT("selection"), -1 ); long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children // need to build the list of strings from children
m_insideBox = TRUE; m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL; wxString *strings = (wxString *) NULL;
if (strList.GetCount() > 0) if (strList.GetCount() > 0)

View File

@@ -70,7 +70,7 @@ wxObject *wxDialogXmlHandler::DoCreateResource()
CreateChildren(dlg); CreateChildren(dlg);
if (GetBool(wxT("centered"), FALSE)) if (GetBool(wxT("centered"), false))
dlg->Centre(); dlg->Centre();
return dlg; return dlg;

View File

@@ -75,7 +75,7 @@ wxObject *wxFrameXmlHandler::DoCreateResource()
CreateChildren(frame); CreateChildren(frame);
if (GetBool(wxT("centered"), FALSE)) if (GetBool(wxT("centered"), false))
frame->Centre(); frame->Centre();
return frame; return frame;

View File

@@ -26,7 +26,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxListBoxXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxListBoxXmlHandler, wxXmlResourceHandler)
wxListBoxXmlHandler::wxListBoxXmlHandler() wxListBoxXmlHandler::wxListBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE) : wxXmlResourceHandler() , m_insideBox(false)
{ {
XRC_ADD_STYLE(wxLB_SINGLE); XRC_ADD_STYLE(wxLB_SINGLE);
XRC_ADD_STYLE(wxLB_MULTIPLE); XRC_ADD_STYLE(wxLB_MULTIPLE);
@@ -46,7 +46,7 @@ wxObject *wxListBoxXmlHandler::DoCreateResource()
long selection = GetLong(wxT("selection"), -1); long selection = GetLong(wxT("selection"), -1);
// need to build the list of strings from children // need to build the list of strings from children
m_insideBox = TRUE; m_insideBox = true;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content"))); CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL; wxString *strings = (wxString *) NULL;
if (strList.GetCount() > 0) if (strList.GetCount() > 0)

View File

@@ -26,7 +26,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxMenuXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxMenuXmlHandler, wxXmlResourceHandler)
wxMenuXmlHandler::wxMenuXmlHandler() : wxMenuXmlHandler::wxMenuXmlHandler() :
wxXmlResourceHandler(), m_insideMenu(FALSE) wxXmlResourceHandler(), m_insideMenu(false)
{ {
XRC_ADD_STYLE(wxMENU_TEAROFF); XRC_ADD_STYLE(wxMENU_TEAROFF);
} }
@@ -40,8 +40,8 @@ wxObject *wxMenuXmlHandler::DoCreateResource()
wxString help = GetText(wxT("help")); wxString help = GetText(wxT("help"));
bool oldins = m_insideMenu; bool oldins = m_insideMenu;
m_insideMenu = TRUE; m_insideMenu = true;
CreateChildren(menu, TRUE/*only this handler*/); CreateChildren(menu, true/*only this handler*/);
m_insideMenu = oldins; m_insideMenu = oldins;
wxMenuBar *p_bar = wxDynamicCast(m_parent, wxMenuBar); wxMenuBar *p_bar = wxDynamicCast(m_parent, wxMenuBar);
@@ -69,7 +69,7 @@ wxObject *wxMenuXmlHandler::DoCreateResource()
{ {
int id = GetID(); int id = GetID();
wxString label = GetText(wxT("label")); wxString label = GetText(wxT("label"));
wxString accel = GetText(wxT("accel"), FALSE); wxString accel = GetText(wxT("accel"), false);
wxString fullLabel = label; wxString fullLabel = label;
if (!accel.IsEmpty()) if (!accel.IsEmpty())
fullLabel << wxT("\t") << accel; fullLabel << wxT("\t") << accel;
@@ -91,7 +91,7 @@ wxObject *wxMenuXmlHandler::DoCreateResource()
mitem->SetBitmap(GetBitmap(wxT("bitmap"), wxART_MENU)); mitem->SetBitmap(GetBitmap(wxT("bitmap"), wxART_MENU));
#endif #endif
p_menu->Append(mitem); p_menu->Append(mitem);
mitem->Enable(GetBool(wxT("enabled"), TRUE)); mitem->Enable(GetBool(wxT("enabled"), true));
if (kind == wxITEM_CHECK) if (kind == wxITEM_CHECK)
mitem->Check(GetBool(wxT("checked"))); mitem->Check(GetBool(wxT("checked")));
} }

View File

@@ -30,7 +30,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxNotebookXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxNotebookXmlHandler, wxXmlResourceHandler)
wxNotebookXmlHandler::wxNotebookXmlHandler() wxNotebookXmlHandler::wxNotebookXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_notebook(NULL) : wxXmlResourceHandler(), m_isInside(false), m_notebook(NULL)
{ {
XRC_ADD_STYLE(wxNB_FIXEDWIDTH); XRC_ADD_STYLE(wxNB_FIXEDWIDTH);
XRC_ADD_STYLE(wxNB_LEFT); XRC_ADD_STYLE(wxNB_LEFT);
@@ -51,7 +51,7 @@ wxObject *wxNotebookXmlHandler::DoCreateResource()
if (n) if (n)
{ {
bool old_ins = m_isInside; bool old_ins = m_isInside;
m_isInside = FALSE; m_isInside = false;
wxObject *item = CreateResFromNode(n, m_notebook, NULL); wxObject *item = CreateResFromNode(n, m_notebook, NULL);
m_isInside = old_ins; m_isInside = old_ins;
wxWindow *wnd = wxDynamicCast(item, wxWindow); wxWindow *wnd = wxDynamicCast(item, wxWindow);
@@ -83,12 +83,12 @@ wxObject *wxNotebookXmlHandler::DoCreateResource()
wxNotebook *old_par = m_notebook; wxNotebook *old_par = m_notebook;
m_notebook = nb; m_notebook = nb;
bool old_ins = m_isInside; bool old_ins = m_isInside;
m_isInside = TRUE; m_isInside = true;
CreateChildren(m_notebook, TRUE/*only this handler*/); CreateChildren(m_notebook, true/*only this handler*/);
m_isInside = old_ins; m_isInside = old_ins;
m_notebook = old_par; m_notebook = old_par;
if (GetBool(wxT("usenotebooksizer"), FALSE)) if (GetBool(wxT("usenotebooksizer"), false))
return new wxNotebookSizer(nb); return new wxNotebookSizer(nb);
else else
return nb; return nb;

View File

@@ -28,7 +28,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxRadioBoxXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxRadioBoxXmlHandler, wxXmlResourceHandler)
wxRadioBoxXmlHandler::wxRadioBoxXmlHandler() wxRadioBoxXmlHandler::wxRadioBoxXmlHandler()
: wxXmlResourceHandler(), m_insideBox(FALSE) : wxXmlResourceHandler(), m_insideBox(false)
{ {
XRC_ADD_STYLE(wxRA_SPECIFY_COLS); XRC_ADD_STYLE(wxRA_SPECIFY_COLS);
XRC_ADD_STYLE(wxRA_HORIZONTAL); XRC_ADD_STYLE(wxRA_HORIZONTAL);
@@ -45,7 +45,7 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource()
long selection = GetLong( wxT("selection"), -1 ); long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children // need to build the list of strings from children
m_insideBox = TRUE; m_insideBox = true;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content"))); CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL; wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 ) if( strList.GetCount() > 0 )

View File

@@ -36,8 +36,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxSizerXmlHandler, wxXmlResourceHandler)
wxSizerXmlHandler::wxSizerXmlHandler() wxSizerXmlHandler::wxSizerXmlHandler()
: wxXmlResourceHandler(), : wxXmlResourceHandler(),
m_isInside(FALSE), m_isInside(false),
m_isGBS(FALSE), m_isGBS(false),
m_parentSizer(NULL) m_parentSizer(NULL)
{ {
XRC_ADD_STYLE(wxHORIZONTAL); XRC_ADD_STYLE(wxHORIZONTAL);
@@ -127,7 +127,7 @@ wxObject* wxSizerXmlHandler::Handle_sizeritem()
bool old_gbs = m_isGBS; bool old_gbs = m_isGBS;
bool old_ins = m_isInside; bool old_ins = m_isInside;
wxSizer *old_par = m_parentSizer; wxSizer *old_par = m_parentSizer;
m_isInside = FALSE; m_isInside = false;
if (!IsSizerNode(n)) m_parentSizer = NULL; if (!IsSizerNode(n)) m_parentSizer = NULL;
wxObject *item = CreateResFromNode(n, m_parent, NULL); wxObject *item = CreateResFromNode(n, m_parent, NULL);
m_isInside = old_ins; m_isInside = old_ins;
@@ -212,10 +212,10 @@ wxObject* wxSizerXmlHandler::Handle_sizer()
// set new state // set new state
m_parentSizer = sizer; m_parentSizer = sizer;
m_isInside = TRUE; m_isInside = true;
m_isGBS = (m_class == wxT("wxGridBagSizer")); m_isGBS = (m_class == wxT("wxGridBagSizer"));
CreateChildren(m_parent, TRUE/*only this handler*/); CreateChildren(m_parent, true/*only this handler*/);
// restore state // restore state
m_isInside = old_ins; m_isInside = old_ins;
@@ -223,7 +223,7 @@ wxObject* wxSizerXmlHandler::Handle_sizer()
if (m_parentSizer == NULL) // setup window: if (m_parentSizer == NULL) // setup window:
{ {
m_parentAsWindow->SetAutoLayout(TRUE); m_parentAsWindow->SetAutoLayout(true);
m_parentAsWindow->SetSizer(sizer); m_parentAsWindow->SetSizer(sizer);
wxXmlNode *nd = m_node; wxXmlNode *nd = m_node;

View File

@@ -28,7 +28,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxToolBarXmlHandler, wxXmlResourceHandler) IMPLEMENT_DYNAMIC_CLASS(wxToolBarXmlHandler, wxXmlResourceHandler)
wxToolBarXmlHandler::wxToolBarXmlHandler() wxToolBarXmlHandler::wxToolBarXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_toolbar(NULL) : wxXmlResourceHandler(), m_isInside(false), m_toolbar(NULL)
{ {
XRC_ADD_STYLE(wxTB_FLAT); XRC_ADD_STYLE(wxTB_FLAT);
XRC_ADD_STYLE(wxTB_DOCKABLE); XRC_ADD_STYLE(wxTB_DOCKABLE);
@@ -124,7 +124,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
if (children_node == NULL) return toolbar; if (children_node == NULL) return toolbar;
m_isInside = TRUE; m_isInside = true;
m_toolbar = toolbar; m_toolbar = toolbar;
wxXmlNode *n = children_node; wxXmlNode *n = children_node;
@@ -144,7 +144,7 @@ wxObject *wxToolBarXmlHandler::DoCreateResource()
n = n->GetNext(); n = n->GetNext();
} }
m_isInside = FALSE; m_isInside = false;
m_toolbar = NULL; m_toolbar = NULL;
toolbar->Realize(); toolbar->Realize();

View File

@@ -31,7 +31,7 @@ class wxUnknownControlContainer : public wxPanel
public: public:
wxUnknownControlContainer(wxWindow *parent, wxUnknownControlContainer(wxWindow *parent,
const wxString& controlName, const wxString& controlName,
wxWindowID id = -1, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = 0) long style = 0)
@@ -95,7 +95,7 @@ wxObject *wxUnknownWidgetXmlHandler::DoCreateResource()
wxPanel *panel = wxPanel *panel =
new wxUnknownControlContainer(m_parentAsWindow, new wxUnknownControlContainer(m_parentAsWindow,
GetName(), -1, GetName(), wxID_ANY,
GetPosition(), GetSize(), GetPosition(), GetSize(),
GetStyle(wxT("style"))); GetStyle(wxT("style")));
SetupWindow(panel); SetupWindow(panel);

View File

@@ -82,7 +82,7 @@ bool wxXmlResource::Load(const wxString& filemask)
wxString fnd; wxString fnd;
wxXmlResourceDataRecord *drec; wxXmlResourceDataRecord *drec;
bool iswild = wxIsWild(filemask); bool iswild = wxIsWild(filemask);
bool rt = TRUE; bool rt = true;
#if wxUSE_FILESYSTEM #if wxUSE_FILESYSTEM
wxFileSystem fsys; wxFileSystem fsys;
@@ -260,7 +260,7 @@ bool wxXmlResource::AttachUnknownControl(const wxString& name,
if (!container) if (!container)
{ {
wxLogError(_("Cannot find container for unknown control '%s'."), name.c_str()); wxLogError(_("Cannot find container for unknown control '%s'."), name.c_str());
return FALSE; return false;
} }
return control->Reparent(container); return control->Reparent(container);
} }
@@ -274,9 +274,9 @@ static void ProcessPlatformProperty(wxXmlNode *node)
wxXmlNode *c = node->GetChildren(); wxXmlNode *c = node->GetChildren();
while (c) while (c)
{ {
isok = FALSE; isok = false;
if (!c->GetPropVal(wxT("platform"), &s)) if (!c->GetPropVal(wxT("platform"), &s))
isok = TRUE; isok = true;
else else
{ {
wxStringTokenizer tkn(s, wxT(" |")); wxStringTokenizer tkn(s, wxT(" |"));
@@ -366,8 +366,8 @@ bool wxXmlResource::UpdateResources()
# if wxUSE_FILESYSTEM # if wxUSE_FILESYSTEM
file = fsys.OpenFile(m_data[i].File); file = fsys.OpenFile(m_data[i].File);
if (file) if (file)
stream = file->GetStream(); stream = file->GetStream();
# else # else
stream = new wxFileInputStream(m_data[i].File); stream = new wxFileInputStream(m_data[i].File);
# endif # endif
@@ -391,7 +391,7 @@ bool wxXmlResource::UpdateResources()
rt = false; rt = false;
} }
else else
{ {
long version; long version;
int v1, v2, v3, v4; int v1, v2, v3, v4;
wxString verstr = m_data[i].Doc->GetRoot()->GetPropVal( wxString verstr = m_data[i].Doc->GetRoot()->GetPropVal(
@@ -411,17 +411,17 @@ bool wxXmlResource::UpdateResources()
ProcessPlatformProperty(m_data[i].Doc->GetRoot()); ProcessPlatformProperty(m_data[i].Doc->GetRoot());
#if wxUSE_FILESYSTEM #if wxUSE_FILESYSTEM
m_data[i].Time = file->GetModificationTime(); m_data[i].Time = file->GetModificationTime();
#else #else
m_data[i].Time = wxDateTime(wxFileModificationTime(m_data[i].File)); m_data[i].Time = wxDateTime(wxFileModificationTime(m_data[i].File));
#endif #endif
} }
# if wxUSE_FILESYSTEM # if wxUSE_FILESYSTEM
wxDELETE(file); wxDELETE(file);
wxUnusedVar(file); wxUnusedVar(file);
# else # else
wxDELETE(stream); wxDELETE(stream);
# endif # endif
} }
} }
@@ -456,7 +456,7 @@ wxXmlNode *wxXmlResource::DoFindResource(wxXmlNode *parent,
wxString refName = node->GetPropVal(wxT("ref"), wxEmptyString); wxString refName = node->GetPropVal(wxT("ref"), wxEmptyString);
if (refName.empty()) if (refName.empty())
continue; continue;
wxXmlNode* refNode = FindResource(refName, wxEmptyString, TRUE); wxXmlNode* refNode = FindResource(refName, wxEmptyString, true);
if (refNode && if (refNode &&
refNode->GetPropVal(wxT("class"), wxEmptyString) == classname) refNode->GetPropVal(wxT("class"), wxEmptyString) == classname)
{ {
@@ -473,7 +473,7 @@ wxXmlNode *wxXmlResource::DoFindResource(wxXmlNode *parent,
(node->GetName() == wxT("object") || (node->GetName() == wxT("object") ||
node->GetName() == wxT("object_ref")) ) node->GetName() == wxT("object_ref")) )
{ {
wxXmlNode* found = DoFindResource(node, name, classname, TRUE); wxXmlNode* found = DoFindResource(node, name, classname, true);
if ( found ) if ( found )
return found; return found;
} }
@@ -565,7 +565,7 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent,
if ( node->GetName() == wxT("object_ref") ) if ( node->GetName() == wxT("object_ref") )
{ {
wxString refName = node->GetPropVal(wxT("ref"), wxEmptyString); wxString refName = node->GetPropVal(wxT("ref"), wxEmptyString);
wxXmlNode* refNode = FindResource(refName, wxEmptyString, TRUE); wxXmlNode* refNode = FindResource(refName, wxEmptyString, true);
if ( !refNode ) if ( !refNode )
{ {
@@ -1090,7 +1090,7 @@ wxFont wxXmlResourceHandler::GetFont(const wxString& param)
else if (family == wxT("swiss")) ifamily = wxSWISS; else if (family == wxT("swiss")) ifamily = wxSWISS;
else if (family == wxT("modern")) ifamily = wxMODERN; else if (family == wxT("modern")) ifamily = wxMODERN;
bool underlined = GetBool(wxT("underlined"), FALSE); bool underlined = GetBool(wxT("underlined"), false);
wxString encoding = GetParamValue(wxT("encoding")); wxString encoding = GetParamValue(wxT("encoding"));
wxFontMapper mapper; wxFontMapper mapper;
@@ -1107,7 +1107,7 @@ wxFont wxXmlResourceHandler::GetFont(const wxString& param)
wxStringTokenizer tk(faces, wxT(",")); wxStringTokenizer tk(faces, wxT(","));
while (tk.HasMoreTokens()) while (tk.HasMoreTokens())
{ {
int index = enu.GetFacenames()->Index(tk.GetNextToken(), FALSE); int index = enu.GetFacenames()->Index(tk.GetNextToken(), false);
if (index != wxNOT_FOUND) if (index != wxNOT_FOUND)
{ {
facename = (*enu.GetFacenames())[index]; facename = (*enu.GetFacenames())[index];
@@ -1136,11 +1136,11 @@ void wxXmlResourceHandler::SetupWindow(wxWindow *wnd)
if (HasParam(wxT("fg"))) if (HasParam(wxT("fg")))
wnd->SetForegroundColour(GetColour(wxT("fg"))); wnd->SetForegroundColour(GetColour(wxT("fg")));
if (GetBool(wxT("enabled"), 1) == 0) if (GetBool(wxT("enabled"), 1) == 0)
wnd->Enable(FALSE); wnd->Enable(false);
if (GetBool(wxT("focused"), 0) == 1) if (GetBool(wxT("focused"), 0) == 1)
wnd->SetFocus(); wnd->SetFocus();
if (GetBool(wxT("hidden"), 0) == 1) if (GetBool(wxT("hidden"), 0) == 1)
wnd->Show(FALSE); wnd->Show(false);
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
if (HasParam(wxT("tooltip"))) if (HasParam(wxT("tooltip")))
wnd->SetToolTip(GetText(wxT("tooltip"))); wnd->SetToolTip(GetText(wxT("tooltip")));
@@ -1309,7 +1309,7 @@ public:
{ {
AddStdXRCID_Records(); AddStdXRCID_Records();
wxXmlResource::AddSubclassFactory(new wxXmlSubclassFactoryCXX); wxXmlResource::AddSubclassFactory(new wxXmlSubclassFactoryCXX);
return TRUE; return true;
} }
void OnExit() void OnExit()
{ {

View File

@@ -378,11 +378,11 @@ static bool NodeContainsFilename(wxXmlNode *node)
{ {
// Any bitmaps: // Any bitmaps:
if (node->GetName() == _T("bitmap")) if (node->GetName() == _T("bitmap"))
return TRUE; return true;
// URLs in wxHtmlWindow: // URLs in wxHtmlWindow:
if (node->GetName() == _T("url")) if (node->GetName() == _T("url"))
return TRUE; return true;
// wxBitmapButton: // wxBitmapButton:
wxXmlNode *parent = node->GetParent(); wxXmlNode *parent = node->GetParent();
@@ -391,17 +391,17 @@ static bool NodeContainsFilename(wxXmlNode *node)
(node->GetName() == _T("focus") || (node->GetName() == _T("focus") ||
node->GetName() == _T("disabled") || node->GetName() == _T("disabled") ||
node->GetName() == _T("selected"))) node->GetName() == _T("selected")))
return TRUE; return true;
// wxBitmap or wxIcon toplevel resources: // wxBitmap or wxIcon toplevel resources:
if (node->GetName() == _T("object")) if (node->GetName() == _T("object"))
{ {
wxString klass = node->GetPropVal(_T("class"), wxEmptyString); wxString klass = node->GetPropVal(_T("class"), wxEmptyString);
if (klass == _T("wxBitmap") || klass == _T("wxIcon")) if (klass == _T("wxBitmap") || klass == _T("wxIcon"))
return TRUE; return true;
} }
return FALSE; return false;
} }
// find all files mentioned in structure, e.g. <bitmap>filename</bitmap> // find all files mentioned in structure, e.g. <bitmap>filename</bitmap>
@@ -473,7 +473,7 @@ void XmlResApp::MakePackageZIP(const wxArrayString& flist)
wxSetWorkingDirectory(parOutputPath); wxSetWorkingDirectory(parOutputPath);
int execres = wxExecute(_T("zip -9 -j ") + int execres = wxExecute(_T("zip -9 -j ") +
wxString(flagVerbose ? _T("") : _T("-q ")) + wxString(flagVerbose ? _T("") : _T("-q ")) +
parOutput + _T(" ") + files, TRUE); parOutput + _T(" ") + files, true);
wxSetWorkingDirectory(cwd); wxSetWorkingDirectory(cwd);
if (execres == -1) if (execres == -1)
{ {