X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/19d0f58d39047447a6908520498720c8bff35a1b..e8cd0e5884f1f77ddc10c70ae6edcd0e308db7c3:/contrib/utils/convertrc/rc2wxr.cpp diff --git a/contrib/utils/convertrc/rc2wxr.cpp b/contrib/utils/convertrc/rc2wxr.cpp index 44f75d959c..6ae35ab719 100644 --- a/contrib/utils/convertrc/rc2wxr.cpp +++ b/contrib/utils/convertrc/rc2wxr.cpp @@ -46,7 +46,7 @@ This code was used as a starting point for my rc2xml converter // for all others, include the necessary headers (this file is usually all you -// need because it includes almost all "standard" wxWindows headers +// need because it includes almost all "standard" wxWidgets headers #ifndef WX_PRECOMP @@ -77,7 +77,7 @@ rc2wxr::rc2wxr() { -m_done=FALSE; +m_done=false; m_controlid=6000; @@ -96,77 +96,36 @@ rc2wxr::~rc2wxr() void rc2wxr::Convert(wxString wxrfile, wxString rcfile) - { + m_rc.Open(rcfile); + m_filesize=m_rc.Length(); + if( (m_wxr = wxFopen( wxrfile.fn_str(), _T("wt") )) == NULL ) + { + return; + } -m_rc.Open(rcfile); - -m_filesize=m_rc.Length(); - -if( (m_wxr = wxFopen( wxrfile, _T("wt") )) == NULL ) - -{ - - return; - -} - - - - - -wxString tok,prevtok; - - - - - -while (!m_done) - -{ - - - -tok=GetToken(); - - - -if (tok==_T("DIALOG")) - -{ - -ParseDialog(prevtok); - -} - - - - - -if (tok==_T("MENU")) - -{ - -ParseMenu(prevtok); - -} - - - -prevtok=tok; - -} - - + wxString tok,prevtok; -fclose(m_wxr); + while (!m_done) + { + tok=GetToken(); -//fclose(m_rc); + if (tok==_T("DIALOG")) + { + ParseDialog(prevtok); + } -m_rc.Close(); + if (tok==_T("MENU")) + { + ParseMenu(prevtok); + } + prevtok=tok; + } + fclose(m_wxr); + m_rc.Close(); } @@ -511,7 +470,7 @@ bool rc2wxr::Seperator(int ch) if ((ch==' ')|(ch==',')|(ch==13)|(ch==10)|(ch=='|')) - return TRUE; + return true; @@ -519,13 +478,13 @@ if (ch==EOF) { -m_done=TRUE; +m_done=true; -return TRUE; +return true; } -return FALSE; +return false; } @@ -595,7 +554,7 @@ if (m_rc.Eof()) { -m_done=TRUE; +m_done=true; return tok; @@ -611,7 +570,7 @@ if (ch==EOF) { -m_done=TRUE; +m_done=true; return tok; @@ -637,7 +596,7 @@ if (ch==EOF) { -m_done=TRUE; +m_done=true; @@ -663,7 +622,7 @@ ReadChar(ch); if (ch==EOF) - m_done=TRUE; + m_done=true; @@ -719,7 +678,7 @@ void rc2wxr::ReadChar(int &ch) { - int result; + int result; result=m_rc.Tell(); @@ -727,7 +686,7 @@ result=m_rc.Tell(); if((result>=m_filesize)) - m_done=TRUE; + m_done=true; @@ -737,13 +696,13 @@ result=m_rc.Read(&ch,1); if((result==-1)) - m_done=TRUE; + m_done=true; if(ch==EOF) - m_done=TRUE; + m_done=true; } @@ -817,13 +776,13 @@ while ((tok!=_T("END"))&(tok!=_T("}"))) if (tok==_T("POPUP")) - { + { ParsePopupMenu(); - wxFprintf(m_wxr,_T(" ],\\\n")); + wxFprintf(m_wxr,_T(" ],\\\n")); - } + } } @@ -979,7 +938,8 @@ void rc2wxr::ParseSlider(wxString WXUNUSED(label), wxString varname) wxString tok; -while (ReadOrs(tok)); +while (ReadOrs(tok)) + ; wxFprintf(m_wxr,_T(" control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',"),m_controlid,varname.c_str()); @@ -1009,7 +969,8 @@ void rc2wxr::ParseProgressBar(wxString WXUNUSED(label), wxString varname) wxString tok; -while (ReadOrs(tok)); +while (ReadOrs(tok)) + ; wxFprintf(m_wxr,_T(" control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',"),m_controlid,varname.c_str()); @@ -1041,7 +1002,7 @@ if (tok.IsNumber()) w=GetToken(); -return TRUE; +return true; } @@ -1071,7 +1032,8 @@ if (tok==_T("BS_AUTOCHECKBOX")) wxFprintf(m_wxr,_T(" control = [%i,wxCheckBox,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str()); - while (ReadOrs(tok)); + while (ReadOrs(tok)) + ; ReadRect(x,y,width,height); @@ -1089,7 +1051,8 @@ if (tok==_T("BS_AUTORADIOBUTTON")) wxFprintf(m_wxr,_T(" control = [%i,wxRadioButton,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str()); - while(ReadOrs(tok)); + while(ReadOrs(tok)) + ; ReadRect(x,y,width,height);