X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be5a51fb592f3fa2ba38ac6cd1e488d6d806058c..289cd4e2dca6beefe137a73c32f43ec3bb8517c4:/contrib/utils/convertrc/rc2xml.cpp?ds=inline diff --git a/contrib/utils/convertrc/rc2xml.cpp b/contrib/utils/convertrc/rc2xml.cpp index fdc82ee0f3..4279eaef82 100644 --- a/contrib/utils/convertrc/rc2xml.cpp +++ b/contrib/utils/convertrc/rc2xml.cpp @@ -49,7 +49,7 @@ cross platform (wxGTK,etc) rc2xml::rc2xml() { - m_done=FALSE; + m_done=false; m_bitmaplist=new wxList(wxKEY_STRING); m_stringtable=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")); wxASSERT_MSG(result,_T("Couldn't create XML file")); if (!result) - return FALSE; + return false; /* Write Basic header for XML file */ @@ -94,7 +94,7 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile) ParseResourceHeader(); //Gather all the resource we need for toolbars,menus, and etc FirstPass(); - m_done=FALSE; + m_done=false; m_rc.Seek(0); //Read in dialogs, toolbars,menus SecondPass(); @@ -105,7 +105,7 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile) wxMessageBox(_("Conversion complete."), _("Done"), wxOK | wxICON_INFORMATION); -return TRUE; +return true; } @@ -308,9 +308,9 @@ void rc2xml::ParseRadioButton(wxString phrase, wxString varname) bool GotOrs; GotOrs = ReadOrs(token); if (ReadRect(x,y,width,height)) - if (GotOrs==FALSE) + if (GotOrs==false) ReadOrs(token); - if (token.Find(_T("WS_GROUP")) != -1) + if (token.Find(_T("WS_GROUP")) != wxNOT_FOUND) style += _T("wxRB_GROUP"); m_xmlfile.Write(_T("\t\t=m_filesize)) - m_done=TRUE; + m_done=true; result=m_rc.Read(&ch,1); if((result==-1)) - m_done=TRUE; + m_done=true; if(ch==EOF) - m_done=TRUE; + m_done=true; } void rc2xml::ParseComboBox(wxString varname) @@ -521,16 +539,16 @@ void rc2xml::ParseComboBox(wxString varname) bool GotOrs; GotOrs = ReadOrs(token); if (ReadRect(x,y,width,height)) - if (GotOrs==FALSE) + if (GotOrs==false) ReadOrs(token); m_xmlfile.Write(_T("\t\t\n")); @@ -631,7 +649,7 @@ void rc2xml::ParseSlider(wxString WXUNUSED(label), wxString varname) { wxString token,style; ReadOrs(token); - if (token.Find(_T("TBS_VERT"))!=-1) + if (token.Find(_T("TBS_VERT"))!=wxNOT_FOUND) style+=_T("wxSL_VERTICAL"); //MFC RC Default is horizontal else @@ -670,7 +688,7 @@ bool rc2xml::ReadOrs(wxString & orstring) token=PeekToken(); if (token.IsNumber()) - return FALSE; + return false; orstring=GetToken(); while(PeekToken()==_T("|")) @@ -680,7 +698,7 @@ bool rc2xml::ReadOrs(wxString & orstring) //Grab next token orstring+=GetToken(); } - return TRUE; + return true; } //Is it a checkbutton or a radiobutton or a pushbutton or a groupbox @@ -692,15 +710,15 @@ void rc2xml::ParseCtrlButton(wxString label, wxString varname) ReadOrs(token); m_rc.Seek(p); - if (token.Find(_T("BS_AUTOCHECKBOX"))!=-1) + if (token.Find(_T("BS_AUTOCHECKBOX"))!=wxNOT_FOUND) ParseCheckBox(label, varname); - else if ((token.Find(_T("BS_AUTORADIOBUTTON"))!=-1)|| - (token.Find(_T("BS_RADIOBUTTON"))!=-1)) + else if ((token.Find(_T("BS_AUTORADIOBUTTON"))!=wxNOT_FOUND)|| + (token.Find(_T("BS_RADIOBUTTON"))!=wxNOT_FOUND)) ParseRadioButton(label, varname); - else if (token.Find(_T("BS_GROUPBOX"))!=-1) + else if (token.Find(_T("BS_GROUPBOX"))!=wxNOT_FOUND) ParseGroupBox(label, varname); - else // if ((token.Find("BS_PUSHBUTTON")!=-1)|| -// (token.Find("BS_DEFPUSHBUTTON")!=-1)) + else // if ((token.Find("BS_PUSHBUTTON")!=wxNOT_FOUND)|| +// (token.Find("BS_DEFPUSHBUTTON")!=wxNOT_FOUND)) ParsePushButton(label, varname); // make default case } @@ -777,6 +795,9 @@ name=LookUpId(name); void rc2xml::WriteLabel(wxString label) { label.Replace(_T("&"),_T("$")); + // changes by MS, handle '<' '>' characters within a label. + label.Replace(_T("<"),_T("<")); + label.Replace(_T(">"),_T(">")); m_xmlfile.Write(_T("\t\t\t\n")); } @@ -821,7 +842,7 @@ void rc2xml::ParseListBox(wxString varname) CONTROL "",IDC_RICHEDIT1,"RICHEDIT",ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP,103,110,40,14 */ -void rc2xml::ParseRichEdit(wxString label, wxString varname) +void rc2xml::ParseRichEdit(wxString WXUNUSED(label), wxString varname) { wxString token; //while (ReadOrs(token)); @@ -846,7 +867,7 @@ void rc2xml::ParseSpinCtrl(wxString WXUNUSED(label), wxString varname) wxString token,style; ReadOrs(token); - if (token.Find(_T("UDS_HORZ"))!=-1) + if (token.Find(_T("UDS_HORZ"))!=wxNOT_FOUND) style=_T("wxSP_HORIZONTAL"); //MFC default else @@ -928,7 +949,7 @@ void rc2xml::ParseToolBar(wxString varname) wxLogError(_T("Unable to load bitmap:")+*bitmappath); //Write toolbar to xml file - m_xmlfile.Write(_T(" ")+tip+_T("\n")); - m_xmlfile.Write(_T(" ")+longhelp+_T("\n")); + m_xmlfile.Write(_T("\t\t")+longhelp+_T("\n")); } //Make a bitmap file name buttonname=CleanName(buttonname); @@ -992,7 +1013,7 @@ void rc2xml::WriteToolButton(wxString name,int index, int width, int height, wxB little.SaveFile(m_targetpath+name,wxBITMAP_TYPE_BMP); } -void rc2xml::ParseStringTable(wxString varname) +void rc2xml::ParseStringTable(wxString WXUNUSED(varname)) { wxString token; token=GetToken(); @@ -1002,13 +1023,12 @@ void rc2xml::ParseStringTable(wxString varname) wxString *msg; while ((token!=_T("END"))&(token!=_T("}"))) - { + { msg=new wxString; *msg=GetStringQuote(); m_stringtable->Append(token,msg); token=GetToken(); - } - + } } bool rc2xml::LookUpString(wxString strid,wxString & st) @@ -1016,19 +1036,19 @@ bool rc2xml::LookUpString(wxString strid,wxString & st) wxNode *node=m_stringtable->Find(strid); wxString *s; if (node==NULL) - return FALSE; + return false; s=(wxString *)node->GetData(); st=*s; - return TRUE; + return true; } bool rc2xml::SplitHelp(wxString msg, wxString &shorthelp, wxString &longhelp) { int spot; spot=msg.Find(_T("\\n")); - if (spot==-1) + if (spot==wxNOT_FOUND) { shorthelp=msg; longhelp=msg; @@ -1037,7 +1057,7 @@ bool rc2xml::SplitHelp(wxString msg, wxString &shorthelp, wxString &longhelp) longhelp=msg.Left(spot); spot=msg.Length()-spot-2; shorthelp=msg.Right(spot); - return TRUE; + return true; } void rc2xml::ParseMenuItem() @@ -1191,7 +1211,7 @@ kindctrl.MakeUpper(); int p=m_rc.Tell(); ReadOrs(token); m_rc.Seek(p); - if (token.Find(_T("SS_BITMAP"))!=-1) + if (token.Find(_T("SS_BITMAP"))!=wxNOT_FOUND) ParseStaticBitmap(label,varname); else ParseStaticText(label,varname); @@ -1238,7 +1258,7 @@ void rc2xml::ParseScrollBar() ReadOrs(token); -if (token.Find(_T("SBS_VERT"))!=-1) +if (token.Find(_T("SBS_VERT"))!=wxNOT_FOUND) style=_T("wxSB_VERTICAL"); //Default MFC style is horizontal else @@ -1377,7 +1397,7 @@ wxTextFile r; //Read through entire file 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); //Just ignore #define token