X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b0e43bafc9e14e439a404a1f5b9f25b90d2a1629..94709f191133613e115fdbf913eba5a81ddd207e:/contrib/utils/convertrc/rc2xml.cpp
diff --git a/contrib/utils/convertrc/rc2xml.cpp b/contrib/utils/convertrc/rc2xml.cpp
index 9f4246b19a..ddc225b77b 100644
--- a/contrib/utils/convertrc/rc2xml.cpp
+++ b/contrib/utils/convertrc/rc2xml.cpp
@@ -16,8 +16,7 @@ cross platform (wxGTK,etc)
*/
#ifdef __GNUG__
-#pragma implementation "rc2xml.cpp"
-#pragma interface "rc2xml.cpp"
+#pragma implementation "rc2xml.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
@@ -146,22 +145,22 @@ microsoft reuses the keyword DIALOG for other things
while ((token!=_T("BEGIN"))&(token!=_T("{")))
{
- if (token==_T("CAPTION"))
+ if (token==_T("CAPTION"))
{
- title=GetQuoteField();
+ title=GetQuoteField();
}
//TODO fix face name so that it is cross platform name
// FONT 8, "MS Sans Serif"
if (token==_T("FONT"))
- {
+ {
ptsize=GetToken();
face=GetQuoteField();
m_xmlfile.Write(_T("\t\t\n"));
m_xmlfile.Write(_T("\t\t\t")+ptsize+_T("\n"));
m_xmlfile.Write(_T("\t\t\t")+face+_T("\n"));
m_xmlfile.Write(_T("\t\t\n"));
- }
+ }
token=GetToken();
}
@@ -343,17 +342,17 @@ void rc2xml::ParsePushButton(wxString phrase, wxString varname)
}
-bool rc2xml::Seperator(int ch)
+bool rc2xml::Separator(int ch)
{
//if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='|')|(ch=='\t'))
if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='\t'))
return true;
if (ch==EOF)
- {
+ {
m_done=true;
return true;
- }
+ }
return false;
}
@@ -388,7 +387,7 @@ bool rc2xml::ReadRect(int & x, int & y, int & width, int & height)
return ret; // check for more parameters
}
-wxString rc2xml::GetToken(bool *listseperator)
+wxString rc2xml::GetToken(bool *listseparator)
{
wxString token=wxEmptyString;
@@ -406,7 +405,7 @@ wxString rc2xml::GetToken(bool *listseperator)
return token;
}
- while (Seperator(ch))
+ while (Separator(ch))
{
ReadChar(ch);
if (m_done)
@@ -419,7 +418,7 @@ wxString rc2xml::GetToken(bool *listseperator)
}
- while (!Seperator(ch))
+ while (!Separator(ch))
{
token += (char)ch;
ReadChar(ch);
@@ -428,8 +427,8 @@ wxString rc2xml::GetToken(bool *listseperator)
if (ch == EOF)
m_done = true;
- if (listseperator)
- *listseperator = (ch == ',');
+ if (listseparator)
+ *listseparator = (ch == ',');
return token;
}
@@ -477,23 +476,24 @@ wxString rc2xml::GetStringQuote()
wxString phrase;
//ASCII code 34 "
bool done=false;
- int p,ch=0,lastch=0;
+ int ch=0,lastch=0;
ReadChar(ch);
while (ch!=34)
ReadChar(ch);
+
ReadChar(ch);
while (done==false)
- {
+ {
if ((ch==34)&&(lastch!='\\'))
- {
- p=m_rc.Tell();
+ {
+ wxFileOffset p = m_rc.Tell();
ReadChar(ch);
-// RC supports "", for embedded quote, as well as \"
+ // RC supports "", for embedded quote, as well as \"
if (ch==34)
phrase+='\\';
else
- {
+ {
m_rc.Seek(p);
done = true;
}
@@ -505,9 +505,10 @@ wxString rc2xml::GetStringQuote()
if ((ch=='\n')&&(lastch=='\\')) // lastch be this
phrase+='n'; // escape
else
- phrase+=(char)ch;
+ phrase+=(char)ch;
+
lastch=ch;
- ReadChar(ch);
+ ReadChar(ch);
}
return phrase;
@@ -515,15 +516,14 @@ wxString rc2xml::GetStringQuote()
void rc2xml::ReadChar(int &ch)
{
- int result;
- result=m_rc.Tell();
+ wxFileOffset result = m_rc.Tell();
if((result>=m_filesize))
m_done=true;
- result=m_rc.Read(&ch,1);
+ result = m_rc.Read(&ch,1);
- if((result==-1))
+ if( result == wxInvalidOffset )
m_done=true;
if(ch==EOF)
@@ -620,25 +620,22 @@ void rc2xml::ParsePopupMenu()
wxString rc2xml::PeekToken()
{
- wxString token;
- int p;
- p=m_rc.Tell();
- token=GetToken();
+ wxFileOffset p = m_rc.Tell();
+ wxString token=GetToken();
m_rc.Seek(p);
return token;
}
+
//MS Windows pain in the butt CONTROL
void rc2xml::ParseControlMS()
{
- wxString label,varname,kindctrl,token;
- token=PeekToken();
+ wxString token = PeekToken();
if (token.Contains(_T("\"")))
ParseNormalMSControl();
else
ParseWeirdMSControl();
-
}
/* CONTROL "Slider1",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH |
@@ -705,15 +702,14 @@ bool rc2xml::ReadOrs(wxString & orstring)
void rc2xml::ParseCtrlButton(wxString label, wxString varname)
{
wxString token;
- int p;
- p=m_rc.Tell();
+ wxFileOffset p = m_rc.Tell();
ReadOrs(token);
m_rc.Seek(p);
if (token.Find(_T("BS_AUTOCHECKBOX"))!=wxNOT_FOUND)
ParseCheckBox(label, varname);
else if ((token.Find(_T("BS_AUTORADIOBUTTON"))!=wxNOT_FOUND)||
- (token.Find(_T("BS_RADIOBUTTON"))!=wxNOT_FOUND))
+ (token.Find(_T("BS_RADIOBUTTON"))!=wxNOT_FOUND))
ParseRadioButton(label, varname);
else if (token.Find(_T("BS_GROUPBOX"))!=wxNOT_FOUND)
ParseGroupBox(label, varname);
@@ -842,7 +838,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));
@@ -901,7 +897,8 @@ void rc2xml::FirstPass()
void rc2xml::ParseBitmap(wxString varname)
{
- wxString token,*bitmapfile;
+ wxString token;
+ wxString *bitmapfile;
token=PeekToken();
//Microsoft notation?
@@ -1013,7 +1010,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();
@@ -1023,13 +1020,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)
@@ -1139,7 +1135,8 @@ void rc2xml::ParseIconStatic()
//IDR_MAINFRAME ICON DISCARDABLE "res\\mfcexample.ico"
void rc2xml::ParseIcon(wxString varname)
{
- wxString token,*iconfile;
+ wxString token;
+ wxString *iconfile;
iconfile=new wxString;
token=PeekToken();
@@ -1183,70 +1180,63 @@ void rc2xml::ParseStaticBitmap(wxString bitmapname, wxString varname)
void rc2xml::ParseNormalMSControl()
{
-wxString label,varname,kindctrl;
-
-label=GetQuoteField();
-varname=GetToken();
-kindctrl=GetQuoteField();
-kindctrl.MakeUpper();
+ wxString label=GetQuoteField();
+ wxString varname=GetToken();
+ wxString kindctrl=GetQuoteField();
+ kindctrl.MakeUpper();
if (kindctrl==_T("MSCTLS_UPDOWN32"))
ParseSpinCtrl(label,varname);
- if (kindctrl==_T("MSCTLS_TRACKBAR32"))
+ else if (kindctrl==_T("MSCTLS_TRACKBAR32"))
ParseSlider(label,varname);
- if (kindctrl==_T("MSCTLS_PROGRESS32"))
+ else if (kindctrl==_T("MSCTLS_PROGRESS32"))
ParseProgressBar(label,varname);
- if (kindctrl==_T("SYSTREEVIEW32"))
+ else if (kindctrl==_T("SYSTREEVIEW32"))
ParseTreeCtrl(label,varname);
- if (kindctrl==_T("SYSMONTHCAL32"))
+ else if (kindctrl==_T("SYSMONTHCAL32"))
ParseCalendar(label,varname);
- if (kindctrl==_T("SYSLISTVIEW32"))
+ else if (kindctrl==_T("SYSLISTVIEW32"))
ParseListCtrl(label,varname);
- if (kindctrl==_T("BUTTON"))
+ else if (kindctrl==_T("BUTTON"))
ParseCtrlButton(label,varname);
- if (kindctrl==_T("RICHEDIT"))
+ else if (kindctrl==_T("RICHEDIT"))
ParseRichEdit(label,varname);
- if (kindctrl==_T("STATIC"))
- {
+ else if (kindctrl==_T("STATIC"))
+ {
wxString token;
- int p=m_rc.Tell();
+ wxFileOffset p = m_rc.Tell();
ReadOrs(token);
m_rc.Seek(p);
if (token.Find(_T("SS_BITMAP"))!=wxNOT_FOUND)
ParseStaticBitmap(label,varname);
else
ParseStaticText(label,varname);
- }
- if (kindctrl==_T("EDIT"))
+ }
+ else if (kindctrl==_T("EDIT"))
ParseTextCtrl(varname);
- if (kindctrl==_T("LISTBOX"))
+ else if (kindctrl==_T("LISTBOX"))
ParseListBox(varname);
- if (kindctrl==_T("COMBOBOX"))
+ else if (kindctrl==_T("COMBOBOX"))
ParseComboBox(varname);
-
}
void rc2xml::ParseWeirdMSControl()
{
- wxString kindctrl;
- wxString varname;
- wxString id;
- id=GetToken();
- varname=GetToken();
- kindctrl=GetQuoteField();
+ wxString id = GetToken();
+ wxString varname = GetToken();
+ wxString kindctrl = GetQuoteField();
kindctrl.MakeUpper();
// CONTROL IDB_FACE,IDC_STATIC,"Static",SS_BITMAP,26,62,32,30
if (kindctrl==_T("STATIC"))
- {
+ {
if (PeekToken()==_T("SS_BITMAP"))
ParseStaticBitmap(id,varname);
else
wxLogError(_T("Unknown MS Control Static token"));
- }
-
+ }
}
-//SCROLLBAR IDC_SCROLLBAR1,219,56,10,40,SBS_VERT
+//SCROLLBAR IDC_SCROLLBAR1,219,56,10,40,SBS_VERT
void rc2xml::ParseScrollBar()
{
wxString token;