X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2193517f1b909b834dc6e314acc3b873dc8196d9..561db924ca6de26dfd38b72be23f71aadc10da7b:/contrib/utils/convertrc/wxr2xml.cpp?ds=sidebyside
diff --git a/contrib/utils/convertrc/wxr2xml.cpp b/contrib/utils/convertrc/wxr2xml.cpp
index 6aa5ad54f7..cbef29444b 100644
--- a/contrib/utils/convertrc/wxr2xml.cpp
+++ b/contrib/utils/convertrc/wxr2xml.cpp
@@ -1,7 +1,7 @@
// wxr2xml.cpp: implementation of the wxr2xml class.
// 8/30/00 Brian Gavin
// only tested on wxMSW so far
-//License: wxWindows Liscense
+// License: wxWindows Liscense
// ////////////////////////////////////////////////////////////////////
/*
@@ -11,9 +11,6 @@ How to use class:
wxr2xml trans;
trans->Convert("Myfile.wxr","Myfile.xml");
*/
-#ifdef __GNUG__
-#pragma implementation "wxr2xml.h"
-#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
@@ -34,31 +31,29 @@ trans->Convert("Myfile.wxr","Myfile.xml");
wxr2xml::wxr2xml()
{
-
}
wxr2xml::~wxr2xml()
{
-
}
bool wxr2xml::Convert(wxString wxrfile, wxString xmlfile)
{
bool result;
- result = m_xmlfile.Open(xmlfile.c_str(), "w+t");
- wxASSERT_MSG(result, "Couldn't create XML file");
+ result = m_xmlfile.Open(xmlfile.c_str(), _T("w+t"));
+ wxASSERT_MSG(result, _T("Couldn't create XML file"));
if (!result)
- return FALSE;
+ return false;
result = m_table.ParseResourceFile(wxrfile);
- wxASSERT_MSG(result, "Couldn't Load WXR file");
+ wxASSERT_MSG(result, _T("Couldn't Load WXR file"));
if (!result)
- return FALSE;
+ return false;
// Write basic xml header
- m_xmlfile.Write("\n");
- m_xmlfile.Write("\n");
+ m_xmlfile.Write(_T("\n"));
+ m_xmlfile.Write(_T("\n"));
result = ParseResources();
- m_xmlfile.Write("\n");
+ m_xmlfile.Write(_T("\n"));
m_xmlfile.Close();
@@ -68,95 +63,93 @@ bool wxr2xml::Convert(wxString wxrfile, wxString xmlfile)
bool wxr2xml::ParseResources()
{
m_table.BeginFind();
- wxNode *node;
+ wxHashTable::Node *node;
- while ((node = m_table.Next()))
+ node = m_table.Next();
+ while (node)
{
- wxItemResource *res = (wxItemResource *) node->Data();
+ wxItemResource *res = (wxItemResource *) node->GetData();
wxString resType(res->GetType());
- if (resType == "wxDialog")
+ if (resType == _T("wxDialog"))
ParseDialog(res);
- else if (resType == "wxPanel")
+ else if (resType == _T("wxPanel"))
ParsePanel(res);
- else if (resType == "wxPanel")
+ else if (resType == _T("wxPanel"))
ParsePanel(res);
- else if (resType == "wxMenu")
+ else if (resType == _T("wxMenu"))
ParseMenuBar(res);
- else if (resType == "wxBitmap")
+ else if (resType == _T("wxBitmap"))
ParseBitmap(res);
else
- wxLogError("Found unsupported resource " + resType);
+ wxLogError(_T("Found unsupported resource ") + resType);
+ node = m_table.Next();
}
- return TRUE;
+ return true;
}
void wxr2xml::ParsePanel(wxItemResource * res)
{
- m_xmlfile.Write("\t\n");
+ m_xmlfile.Write(_T("\n"));
ParseControls(res);
- m_xmlfile.Write(" \t\t\n");
- m_xmlfile.Write("\t\n\n");
+ m_xmlfile.Write(_T("\t\n\n"));
}
void wxr2xml::ParseDialog(wxItemResource * res)
{
PanelStuff(res);
- m_xmlfile.Write("\t\n\n");
+ m_xmlfile.Write(_T("\t\n\n"));
}
void wxr2xml::ParseControls(wxItemResource * res)
{
- wxNode *node = res->GetChildren().First();
- while (node)
+ wxNode *node = res->GetChildren().GetFirst();
+ while (node)
{
- wxItemResource *res = (wxItemResource *) node->Data();
+ wxItemResource *res = (wxItemResource *) node->GetData();
wxString resType(res->GetType());
- if (resType == "wxButton")
+ if (resType == _T("wxButton"))
ParseButton(res);
- else if ((resType == "wxTextCtrl") | (resType == "wxText")
- | (resType == "wxMultiText"))
+ else if ((resType == _T("wxTextCtrl")) | (resType == _T("wxText"))
+ | (resType == _T("wxMultiText")))
ParseTextCtrl(res);
- else if (resType == "wxCheckBox")
+ else if (resType == _T("wxCheckBox"))
ParseCheckBox(res);
- else if (resType == "wxRadioBox")
+ else if (resType == _T("wxRadioBox"))
ParseRadioBox(res);
- else if (resType == "wxListBox")
+ else if (resType == _T("wxListBox"))
ParseListBox(res);
- else if ((resType == "wxStaticText") | (resType == "wxMessage"))
+ else if ((resType == _T("wxStaticText")) | (resType == _T("wxMessage")))
ParseStaticText(res);
- else if (resType == "wxChoice")
+ else if (resType == _T("wxChoice"))
ParseChoice(res);
- else if (resType == "wxGauge")
+ else if (resType == _T("wxGauge"))
ParseGauge(res);
- else if (resType == "wxSlider")
+ else if (resType == _T("wxSlider"))
ParseSlider(res);
- else if (resType == "wxComboBox")
+ else if (resType == _T("wxComboBox"))
ParseComboBox(res);
- else if (resType == "wxRadioButton")
+ else if (resType == _T("wxRadioButton"))
ParseRadioButton(res);
- else if (resType == "wxStaticBitmap")
+ else if (resType == _T("wxStaticBitmap"))
ParseStaticBitmap(res);
- else if (resType == "wxScrollBar")
+ else if (resType == _T("wxScrollBar"))
ParseScrollBar(res);
- else if ((resType == "wxStaticBox") | (resType == "wxGroupBox"))
+ else if ((resType == _T("wxStaticBox")) | (resType == _T("wxGroupBox")))
ParseStaticBox(res);
- else if (resType == "wxBitmapButton")
+ else if (resType == _T("wxBitmapButton"))
ParseBitmapButton(res);
else
- wxLogError("Found unsupported resource " + resType);
- node = node->Next();
+ wxLogError(_T("Found unsupported resource ") + resType);
+ node = node->GetNext();
}
}
@@ -165,7 +158,7 @@ void wxr2xml::ParseControls(wxItemResource * res)
void wxr2xml::WriteControlInfo(wxItemResource * res)
{
m_xmlfile.Write(GenerateName(res));
- m_xmlfile.Write(">\n");
+ m_xmlfile.Write(_T(">\n"));
m_xmlfile.Write(GetPosition(res));
m_xmlfile.Write(GetSize(res));
m_xmlfile.Write(GetStyles(res));
@@ -176,9 +169,9 @@ wxString wxr2xml::GetSize(wxItemResource * res)
{
wxString msg;
if (m_dlgunits)
- msg << "\t\t\t\t" << res->GetWidth() << "," << res->GetHeight() << "d\n";
+ msg << _T("\t\t\t\t") << res->GetWidth() << _T(",") << res->GetHeight() << _T("d\n");
else
- msg << "\t\t\t\t" << res->GetWidth() << "," << res->GetHeight() << "\n";
+ msg << _T("\t\t\t\t") << res->GetWidth() << _T(",") << res->GetHeight() << _T("\n");
return msg;
}
@@ -186,196 +179,196 @@ wxString wxr2xml::GetPosition(wxItemResource * res)
{
wxString msg;
if (m_dlgunits)
- msg << "\t\t\t\t" << res->GetX() << "," << res->GetY() << "d\n";
+ msg << _T("\t\t\t\t") << res->GetX() << _T(",") << res->GetY() << _T("d\n");
else
- msg << "\t\t\t\t" << res->GetX() << "," << res->GetY() << "\n";
+ msg << _T("\t\t\t\t") << res->GetX() << _T(",") << res->GetY() << _T("\n");
return msg;
}
void wxr2xml::ParseButton(wxItemResource * res)
{
- m_xmlfile.Write("\t\t\t