X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b2247ee93bd093d52417ea063720f4165d8a0da8..19311d4e7c43a3f6243bf805c164fd76cada0386:/contrib/utils/convertrc/rc2wxr.cpp diff --git a/contrib/utils/convertrc/rc2wxr.cpp b/contrib/utils/convertrc/rc2wxr.cpp index 13b4b8406a..2a923d5445 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, _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); + } -wxString tok,prevtok; - - - - - -while (!m_done) - -{ - - - -tok=GetToken(); - - - -if (tok==_T("DIALOG")) - -{ - -ParseDialog(prevtok); - -} - - - - - -if (tok==_T("MENU")) - -{ - -ParseMenu(prevtok); - -} - - - -prevtok=tok; - -} - - - -fclose(m_wxr); - -//fclose(m_rc); - -m_rc.Close(); - + 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; @@ -716,41 +675,24 @@ return phrase; void rc2wxr::ReadChar(int &ch) - { + wxFileOffset result = m_rc.Tell(); - int result; - -result=m_rc.Tell(); - - - -if((result>=m_filesize)) - - m_done=TRUE; - - + if ( result >= m_filesize ) + m_done=true; -result=m_rc.Read(&ch,1); + result = m_rc.Read(&ch,1); + if ( result==wxInvalidOffset ) + m_done=true; - -if((result==-1)) - - m_done=TRUE; - - - -if(ch==EOF) - - m_done=TRUE; - + if(ch==EOF) + m_done=true; } void rc2wxr::ParseComboBox() - { /* COMBOBOX IDC_SCALECOMBO,10,110,48,52,CBS_DROPDOWNLIST | CBS_SORT | @@ -817,13 +759,13 @@ while ((tok!=_T("END"))&(tok!=_T("}"))) if (tok==_T("POPUP")) - { + { ParsePopupMenu(); - wxFprintf(m_wxr,_T(" ],\\\n")); + wxFprintf(m_wxr,_T(" ],\\\n")); - } + } } @@ -1043,7 +985,7 @@ if (tok.IsNumber()) w=GetToken(); -return TRUE; +return true; }