X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/19d0f58d39047447a6908520498720c8bff35a1b..561db924ca6de26dfd38b72be23f71aadc10da7b:/contrib/utils/convertrc/wxr2xml.cpp?ds=sidebyside diff --git a/contrib/utils/convertrc/wxr2xml.cpp b/contrib/utils/convertrc/wxr2xml.cpp index 8c4a70e6e0..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,12 +31,10 @@ trans->Convert("Myfile.wxr","Myfile.xml"); wxr2xml::wxr2xml() { - } wxr2xml::~wxr2xml() { - } bool wxr2xml::Convert(wxString wxrfile, wxString xmlfile) @@ -48,12 +43,12 @@ bool wxr2xml::Convert(wxString wxrfile, wxString xmlfile) 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, _T("Couldn't Load WXR file")); if (!result) - return FALSE; + return false; // Write basic xml header m_xmlfile.Write(_T("\n")); m_xmlfile.Write(_T("\n")); @@ -68,10 +63,10 @@ bool wxr2xml::Convert(wxString wxrfile, wxString xmlfile) bool wxr2xml::ParseResources() { m_table.BeginFind(); - wxNode *node; + wxHashTable::Node *node; node = m_table.Next(); - while (node) + while (node) { wxItemResource *res = (wxItemResource *) node->GetData(); wxString resType(res->GetType()); @@ -89,7 +84,7 @@ bool wxr2xml::ParseResources() wxLogError(_T("Found unsupported resource ") + resType); node = m_table.Next(); } - return TRUE; + return true; } void wxr2xml::ParsePanel(wxItemResource * res) @@ -117,7 +112,7 @@ void wxr2xml::ParseDialog(wxItemResource * res) void wxr2xml::ParseControls(wxItemResource * res) { wxNode *node = res->GetChildren().GetFirst(); - while (node) + while (node) { wxItemResource *res = (wxItemResource *) node->GetData(); wxString resType(res->GetType()); @@ -405,16 +400,18 @@ wxString wxr2xml::GetStyles(wxItemResource * res) if (style & wxNO_FULL_REPAINT_ON_RESIZE) s += _T("wxNO_FULL_REPAINT_ON_RESIZE|"); - if (restype == _T("wxDialog")) + if (restype == _T("wxDialog")) { - if (style & wxDIALOG_MODAL) - s += _T("wxDIALOG_MODAL|"); if (style & wxDEFAULT_DIALOG_STYLE) s += _T("wxDEFAULT_DIALOG_STYLE|"); +#if WXWIN_COMPATIBILITY_2_6 + if (style & wxDIALOG_MODAL) + s += _T("wxDIALOG_MODAL|"); if (style & wxDIALOG_MODELESS) s += _T("wxDIALOG_MODELESS|"); if (style & wxNO_3D) s += _T("wxNO_3D|"); +#endif // WXWIN_COMPATIBILITY_2_6 if (style & wxTAB_TRAVERSAL) s += _T("wxTAB_TRAVERSAL|"); if (style & wxWS_EX_VALIDATE_RECURSIVELY) @@ -423,10 +420,12 @@ wxString wxr2xml::GetStyles(wxItemResource * res) s += _T("wxSTAY_ON_TOP|"); if (style & wxCAPTION) s += _T("wxCAPTION|"); - if (style & wxTHICK_FRAME) - s += _T("wxTHICK_FRAME|"); + if (style & wxRESIZE_BORDER) + s += _T("wxRESIZE_BORDER|"); +#if WXWIN_COMPATIBILITY_2_6 if (style & wxRESIZE_BOX) s += _T("wxRESIZE_BOX|"); +#endif // WXWIN_COMPATIBILITY_2_6 if (style & wxRESIZE_BORDER) s += _T("wxRESIZE_BORDER|"); if (style & wxSYSTEM_MENU) @@ -435,19 +434,21 @@ wxString wxr2xml::GetStyles(wxItemResource * res) s += _T("wxCLIP_CHILDREN|"); } - if (restype == _T("wxPanel")) + if (restype == _T("wxPanel")) { if (style & wxCLIP_CHILDREN) s += _T("wxCLIP_CHILDREN|"); +#if WXWIN_COMPATIBILITY_2_6 if (style & wxNO_3D) s += _T("wxNO_3D|"); +#endif // WXWIN_COMPATIBILITY_2_6 if (style & wxTAB_TRAVERSAL) s += _T("wxTAB_TRAVERSAL|"); if (style & wxWS_EX_VALIDATE_RECURSIVELY) s += _T("wxWS_EX_VALIDATE_RECURSIVELY|"); } - if (restype == _T("wxComboBox")) + if (restype == _T("wxComboBox")) { if (style & wxCB_SORT) s += _T("wxCB_SORT|"); @@ -459,32 +460,30 @@ wxString wxr2xml::GetStyles(wxItemResource * res) s += _T("wxCB_DROPDOWN|"); } - if (restype == _T("wxGauge")) + if (restype == _T("wxGauge")) { if (style & wxGA_HORIZONTAL) s += _T("wxGA_HORIZONTAL|"); if (style & wxGA_VERTICAL) s += _T("wxGA_VERTICAL|"); - if (style & wxGA_PROGRESSBAR) - s += _T("wxGA_PROGRESSBAR|"); // windows only if (style & wxGA_SMOOTH) s += _T("wxGA_SMOOTH|"); } - if (restype == _T("wxRadioButton")) + if (restype == _T("wxRadioButton")) { if (style & wxRB_GROUP) s += _T("wxRB_GROUP|"); } - if (restype == _T("wxStaticText")) + if (restype == _T("wxStaticText")) { if (style & wxST_NO_AUTORESIZE) s += _T("wxST_NO_AUTORESIZEL|"); } - if (restype == _T("wxRadioBox")) + if (restype == _T("wxRadioBox")) { if (style & wxRA_HORIZONTAL) s += _T("wxRA_HORIZONTAL|"); @@ -496,7 +495,7 @@ wxString wxr2xml::GetStyles(wxItemResource * res) s += _T("wxRA_VERTICAL|"); } - if (restype == _T("wxListBox")) + if (restype == _T("wxListBox")) { if (style & wxLB_SINGLE) s += _T("wxLB_SINGLE|"); @@ -514,7 +513,7 @@ wxString wxr2xml::GetStyles(wxItemResource * res) s += _T("wxLB_SORT|"); } - if (restype == _T("wxTextCtrl")) + if (restype == _T("wxTextCtrl")) { if (style & wxTE_PROCESS_ENTER) s += _T("wxTE_PROCESS_ENTER|"); @@ -535,15 +534,14 @@ wxString wxr2xml::GetStyles(wxItemResource * res) { if (style & wxSB_HORIZONTAL) s += _T("wxSB_HORIZONTAL|"); - if (style & wxSB_VERTICAL) + if (style & wxSB_VERTICAL) s += _T("wxSB_VERTICAL|"); } - int l; - l = s.Length(); + int l = s.length(); // No styles defined if (l == 11) - return _T(""); + return wxEmptyString; // Trim off last | s = s.Truncate(l - 1); @@ -598,7 +596,7 @@ void wxr2xml::ParseMenu(wxItemResource * res) { wxItemResource *child; wxNode *node = res->GetChildren().GetFirst(); - // Get Menu + // Get Menu m_xmlfile.Write(_T("\t\t\tGetValue1() << _T("\""); @@ -606,7 +604,7 @@ void wxr2xml::ParseMenu(wxItemResource * res) m_xmlfile.Write(_T(">\n")); m_xmlfile.Write(_T("\t\t\t\t\n")); - if (res->GetValue4() != _T("")) + if (!res->GetValue4().empty()) m_xmlfile.Write(_T("\t\t\t\t") + res->GetValue4() + _T("\n")); // Read in menu items and additional menus @@ -624,7 +622,7 @@ void wxr2xml::ParseMenu(wxItemResource * res) void wxr2xml::ParseMenuItem(wxItemResource * res) { // Get Menu Item or Separator - if (res->GetTitle() == _T("")) { + if (res->GetTitle().empty()) { m_xmlfile.Write(_T("\t\t\t\n")); } else { m_xmlfile.Write(_T("\t\t\t\tGetValue1() << _T("\""); m_xmlfile.Write(menuname); m_xmlfile.Write(_T(">\n")); - m_xmlfile.Write(_T("