From 19d0f58d39047447a6908520498720c8bff35a1b Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 11 Dec 2003 11:27:56 +0000 Subject: [PATCH] Applied patch [ 843965 ] RC/WXRC/XML related contribs and utils cleaning git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24765 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/src/xrc/xh_sizer.cpp | 2 - contrib/src/xrc/xh_wizrd.cpp | 2 + contrib/src/xrc/xmlres.cpp | 5 +- contrib/utils/convertrc/convert.cpp | 52 +-- contrib/utils/convertrc/convert.h | 10 +- contrib/utils/convertrc/rc2wxr.cpp | 170 ++++----- contrib/utils/convertrc/rc2xml.cpp | 496 +++++++++++++-------------- contrib/utils/convertrc/wxr2xml.cpp | 422 +++++++++++------------ contrib/utils/wxrcedit/pe_adv.cpp | 6 +- contrib/utils/wxrcedit/preview.cpp | 3 +- contrib/utils/wxrcedit/splittree.cpp | 5 +- src/xrc/xh_sizer.cpp | 2 - src/xrc/xh_wizrd.cpp | 2 + src/xrc/xmlres.cpp | 5 +- 14 files changed, 590 insertions(+), 592 deletions(-) diff --git a/contrib/src/xrc/xh_sizer.cpp b/contrib/src/xrc/xh_sizer.cpp index 5022ffb8f4..db47dceec3 100644 --- a/contrib/src/xrc/xh_sizer.cpp +++ b/contrib/src/xrc/xh_sizer.cpp @@ -206,7 +206,6 @@ wxObject* wxSizerXmlHandler::Handle_sizer() // save state wxSizer *old_par = m_parentSizer; bool old_ins = m_isInside; - bool old_gbs = m_isGBS; // set new state m_parentSizer = sizer; @@ -216,7 +215,6 @@ wxObject* wxSizerXmlHandler::Handle_sizer() CreateChildren(m_parent, TRUE/*only this handler*/); // restore state - old_gbs = m_isGBS; m_isInside = old_ins; m_parentSizer = old_par; diff --git a/contrib/src/xrc/xh_wizrd.cpp b/contrib/src/xrc/xh_wizrd.cpp index db9e52cd10..e8cb354448 100644 --- a/contrib/src/xrc/xh_wizrd.cpp +++ b/contrib/src/xrc/xh_wizrd.cpp @@ -59,6 +59,8 @@ wxObject *wxWizardXmlHandler::DoCreateResource() else { wxWizardPage *page = NULL; + wxUnusedVar(page); + if (m_class == wxT("wxWizardPageSimple")) { XRC_MAKE_INSTANCE(p, wxWizardPageSimple) diff --git a/contrib/src/xrc/xmlres.cpp b/contrib/src/xrc/xmlres.cpp index 7587547408..a50a9e70d9 100644 --- a/contrib/src/xrc/xmlres.cpp +++ b/contrib/src/xrc/xmlres.cpp @@ -324,6 +324,7 @@ bool wxXmlResource::UpdateResources() bool modif; # if wxUSE_FILESYSTEM wxFSFile *file = NULL; + wxUnusedVar(file); wxFileSystem fsys; # endif @@ -353,6 +354,7 @@ bool wxXmlResource::UpdateResources() rt = false; } wxDELETE(file); + wxUnusedVar(file); # else modif = wxDateTime(wxFileModificationTime(m_data[i].File)) > m_data[i].Time; # endif @@ -413,6 +415,7 @@ bool wxXmlResource::UpdateResources() # if wxUSE_FILESYSTEM wxDELETE(file); + wxUnusedVar(file); # else wxDELETE(stream); # endif @@ -1180,14 +1183,12 @@ static int XRCID_Lookup(const wxChar *str_id, int value_if_not_found = -2) index %= XRCID_TABLE_SIZE; XRCID_record *oldrec = NULL; - int matchcnt = 0; for (XRCID_record *rec = XRCID_Records[index]; rec; rec = rec->next) { if (wxStrcmp(rec->key, str_id) == 0) { return rec->id; } - matchcnt++; oldrec = rec; } diff --git a/contrib/utils/convertrc/convert.cpp b/contrib/utils/convertrc/convert.cpp index 17927d3b2a..b2d17962ef 100644 --- a/contrib/utils/convertrc/convert.cpp +++ b/contrib/utils/convertrc/convert.cpp @@ -55,14 +55,14 @@ bool wxConvertApp::OnInit() { //Initialize all image loaders(JPEG,BMP,PNG,and etc) wxInitAllImageHandlers(); - SetAppName("wxConvertApp"); + SetAppName(_T("wxConvertApp")); if (HandleCommandLine()) return TRUE; // Create the main frame window - m_pFrame = new wxMainFrame(NULL, -1, "wxConvertApp", wxPoint(0, 0), wxSize(500, 400), + m_pFrame = new wxMainFrame(NULL, -1, _T("wxConvertApp"), wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL); InitMenu(); @@ -77,12 +77,12 @@ void wxConvertApp::InitMenu() wxASSERT(m_pMenuBar); wxMenu *filemenu=new wxMenu; - filemenu->Append(ID_RC2WXR,"Convert RC file to WXR file"); - filemenu->Append(ID_WXR2XML,"Convert WXR file to XML file"); - filemenu->Append(ID_RC2XML,"Convert RC file to XML file"); + filemenu->Append(ID_RC2WXR,_T("Convert RC file to WXR file")); + filemenu->Append(ID_WXR2XML,_T("Convert WXR file to XML file")); + filemenu->Append(ID_RC2XML,_T("Convert RC file to XML file")); - filemenu->Append(ID_QUIT, "E&xit"); - m_pMenuBar->Append(filemenu,"&File"); + filemenu->Append(ID_QUIT, _T("E&xit")); + m_pMenuBar->Append(filemenu,_T("&File")); m_pFrame->SetMenuBar(m_pMenuBar); } @@ -120,25 +120,25 @@ wxMainFrame::~wxMainFrame() -void wxMainFrame::OnQuit() +void wxMainFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { Close(TRUE); } -void wxMainFrame::OnRc2Wxr() +void wxMainFrame::OnRc2Wxr(wxCommandEvent& WXUNUSED(event)) { wxFileDialog filed(this); - filed.SetWildcard("*.rc"); + filed.SetWildcard(_T("*.rc")); filed.SetStyle(wxOPEN); if (filed.ShowModal()!=wxID_OK) return; - wxFileDialog wxrfile(this,"Enter Desired WXR file name"); - wxrfile.SetWildcard("*.wxr"); + wxFileDialog wxrfile(this,_T("Enter Desired WXR file name")); + wxrfile.SetWildcard(_T("*.wxr")); wxrfile.SetStyle(wxOPEN); - wxrfile.SetFilename("resource.wxr"); + wxrfile.SetFilename(_T("resource.wxr")); if (wxrfile.ShowModal()!=wxID_OK) return; @@ -147,18 +147,18 @@ void wxMainFrame::OnRc2Wxr() convert.Convert(wxrfile.GetPath(),filed.GetPath()); } -void wxMainFrame::OnWXR2XML() +void wxMainFrame::OnWXR2XML(wxCommandEvent& WXUNUSED(event)) { wxFileDialog f(this); - f.SetWildcard("*.wxr"); + f.SetWildcard(_T("*.wxr")); if (f.ShowModal()!=wxID_OK) return; - wxFileDialog xmlfile(this,"Enter Desired XML file name"); - xmlfile.SetWildcard("*.xml"); + wxFileDialog xmlfile(this,_T("Enter Desired XML file name")); + xmlfile.SetWildcard(_T("*.xml")); xmlfile.SetStyle(wxOPEN); - xmlfile.SetFilename("resource.xml"); + xmlfile.SetFilename(_T("resource.xml")); if (xmlfile.ShowModal()!=wxID_OK) return; @@ -168,17 +168,17 @@ void wxMainFrame::OnWXR2XML() } -void wxMainFrame::OnRC2XML() +void wxMainFrame::OnRC2XML(wxCommandEvent& WXUNUSED(event)) { wxFileDialog f(this); - f.SetWildcard("*.rc"); + f.SetWildcard(_T("*.rc")); if (f.ShowModal()!=wxID_OK) return; - wxFileDialog xmlfile(this,"Enter Desired XML file name"); - xmlfile.SetWildcard("*.xml"); + wxFileDialog xmlfile(this,_T("Enter Desired XML file name")); + xmlfile.SetWildcard(_T("*.xml")); xmlfile.SetStyle(wxOPEN); - xmlfile.SetFilename("resource.xml"); + xmlfile.SetFilename(_T("resource.xml")); if (xmlfile.ShowModal()!=wxID_OK) return; @@ -205,17 +205,17 @@ bool wxConvertApp::HandleCommandLine() target=argv[2]; - if ((source.Find(".wxr")>0)&&(target.Find(".xml")>0)) + if ((source.Find(_T(".wxr"))>0)&&(target.Find(_T(".xml"))>0)) { trans_wxr2xml.Convert(source,target); return TRUE; } - else if ((source.Find(".rc")!=-1)&(target.Find(".wxr")!=-1)) + else if ((source.Find(_T(".rc"))!=-1)&(target.Find(_T(".wxr"))!=-1)) { trans_rc2wxr.Convert(source,target); return TRUE; } - else if ((source.Find(".rc")!=-1)&(target.Find(".xml")!=-1)) + else if ((source.Find(_T(".rc"))!=-1)&(target.Find(_T(".xml"))!=-1)) { trans_rc2xml.Convert(source,target); return TRUE; diff --git a/contrib/utils/convertrc/convert.h b/contrib/utils/convertrc/convert.h index 472953e229..7c1738fd01 100644 --- a/contrib/utils/convertrc/convert.h +++ b/contrib/utils/convertrc/convert.h @@ -17,14 +17,14 @@ class wxMainFrame:public wxFrame { public: - void OnRC2XML(); - void OnWXR2XML(); - void OnRc2Wxr(); - void OnQuit(); + void OnRC2XML(wxCommandEvent& event); + void OnWXR2XML(wxCommandEvent& event); + void OnRc2Wxr(wxCommandEvent& event); + void OnQuit(wxCommandEvent& event); wxMainFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, - const wxString& name = "frame"); + const wxString& name = _T("frame")); virtual ~wxMainFrame(); protected: diff --git a/contrib/utils/convertrc/rc2wxr.cpp b/contrib/utils/convertrc/rc2wxr.cpp index 8adf43bec5..44f75d959c 100644 --- a/contrib/utils/convertrc/rc2wxr.cpp +++ b/contrib/utils/convertrc/rc2wxr.cpp @@ -103,7 +103,7 @@ m_rc.Open(rcfile); m_filesize=m_rc.Length(); -if( (m_wxr = fopen( wxrfile, "wt" )) == NULL ) +if( (m_wxr = wxFopen( wxrfile, _T("wt") )) == NULL ) { @@ -131,7 +131,7 @@ tok=GetToken(); -if (tok=="DIALOG") +if (tok==_T("DIALOG")) { @@ -143,7 +143,7 @@ ParseDialog(prevtok); -if (tok=="MENU") +if (tok==_T("MENU")) { @@ -233,7 +233,7 @@ tok=PeekToken(); //Microsoft notation? -if (tok=="DISCARDABLE") +if (tok==_T("DISCARDABLE")) { @@ -251,15 +251,15 @@ if (!tok.IsNumber()) //Generate Dialog text -fprintf(m_wxr,"static char *dialog%i = \"dialog(name = '%s',\\\n",dlgid,dlgname.c_str()); +wxFprintf(m_wxr,_T("static char *dialog%i = \"dialog(name = '%s',\\\n"),dlgid,dlgname.c_str()); //be lazy about style for now. add it later -fprintf(m_wxr,"style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\\\n"); +wxFprintf(m_wxr,_T("style = 'wxRAISED_BORDER | wxCAPTION | wxTHICK_FRAME | wxSYSTEM_MENU',\\\n")); -fprintf(m_wxr,"id = %i,\\\n",dlgid); +wxFprintf(m_wxr,_T("id = %i,\\\n"),dlgid); @@ -269,7 +269,7 @@ int x,y,width,height; ReadRect(x,y,width,height); -fprintf(m_wxr,"x = %i, y = %i, width = %i, height = %i,\\\n",x,y,width,height); +wxFprintf(m_wxr,_T("x = %i, y = %i, width = %i, height = %i,\\\n"),x,y,width,height); @@ -285,17 +285,17 @@ wxString title; -while ((tok!="BEGIN")&(tok!="{")) +while ((tok!=_T("BEGIN"))&(tok!=_T("{"))) { -if (tok=="CAPTION") +if (tok==_T("CAPTION")) { title=GetQuoteField(); -fprintf(m_wxr,"title = '%s',\\\n",title.c_str()); +wxFprintf(m_wxr,_T("title = '%s',\\\n"),title.c_str()); } @@ -303,17 +303,17 @@ tok=GetToken(); } -fprintf(m_wxr,"use_dialog_units = 1,\\\n"); +wxFprintf(m_wxr,_T("use_dialog_units = 1,\\\n")); -fprintf(m_wxr,"use_system_defaults = 0,\\\n"); +wxFprintf(m_wxr,_T("use_system_defaults = 0,\\\n")); -fprintf(m_wxr,"font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\\\n"); +wxFprintf(m_wxr,_T("font = [8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif'],\\\n")); ParseControls(); -fprintf(m_wxr,").\";\n\n"); +wxFprintf(m_wxr,_T(").\";\n\n")); } @@ -351,35 +351,35 @@ wxString tok; tok=GetToken(); -while ((tok!="END")&(tok!="}")) +while ((tok!=_T("END"))&(tok!=_T("}"))) { -if (tok=="LTEXT") +if (tok==_T("LTEXT")) ParseStaticText(); -if (tok=="EDITTEXT") +if (tok==_T("EDITTEXT")) ParseTextCtrl(); -if (tok=="PUSHBUTTON") +if (tok==_T("PUSHBUTTON")) ParsePushButton(); -if (tok=="DEFPUSHBUTTON") +if (tok==_T("DEFPUSHBUTTON")) ParsePushButton(); -if (tok=="GROUPBOX") +if (tok==_T("GROUPBOX")) ParseGroupBox(); -if (tok=="COMBOBOX") +if (tok==_T("COMBOBOX")) ParseComboBox(); -if (tok=="CONTROL") +if (tok==_T("CONTROL")) ParseControlMS(); @@ -413,11 +413,11 @@ int x,y,width,height; ReadRect(x,y,width,height); -fprintf(m_wxr," control = [%i,wxStaticText,'%s','0','%s',",m_controlid,phrase.c_str(),varname.c_str()); +wxFprintf(m_wxr,_T(" control = [%i,wxStaticText,'%s','0','%s',"),m_controlid,phrase.c_str(),varname.c_str()); -fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height); +wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height); -fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"); +wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n")); } @@ -439,11 +439,11 @@ int x,y,width,height; ReadRect(x,y,width,height); -fprintf(m_wxr," control = [%i,wxTextCtrl,'','0','%s',",m_controlid,varname.c_str()); +wxFprintf(m_wxr,_T(" control = [%i,wxTextCtrl,'','0','%s',"),m_controlid,varname.c_str()); -fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height); +wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height); -fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"); +wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n")); @@ -469,19 +469,19 @@ m_controlid++; c=m_controlid; -if (varname=="IDOK") +if (varname==_T("IDOK")) c=wxID_OK; -if (varname=="IDCANCEL") +if (varname==_T("IDCANCEL")) c=wxID_CANCEL; -if (varname=="IDAPPLY") +if (varname==_T("IDAPPLY")) c=wxID_APPLY; @@ -491,11 +491,11 @@ int x,y,width,height; ReadRect(x,y,width,height); -fprintf(m_wxr," control = [%i,wxButton,'%s','0','%s',",c,phrase.c_str(),varname.c_str()); +wxFprintf(m_wxr,_T(" control = [%i,wxButton,'%s','0','%s',"),c,phrase.c_str(),varname.c_str()); -fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height); +wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height); -fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"); +wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n")); @@ -551,11 +551,11 @@ int x,y,width,height; ReadRect(x,y,width,height); -fprintf(m_wxr," control = [%i,wxStaticBox,'%s','0','%s',",m_controlid,phrase.c_str(),varname.c_str()); +wxFprintf(m_wxr,_T(" control = [%i,wxStaticBox,'%s','0','%s',"),m_controlid,phrase.c_str(),varname.c_str()); -fprintf(m_wxr,"%i,%i,%i,%i,'',\\\n",x,y,width,height); +wxFprintf(m_wxr,_T("%i,%i,%i,%i,'',\\\n"),x,y,width,height); -fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"); +wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n")); @@ -569,13 +569,13 @@ void rc2wxr::ReadRect(int & x, int & y, int & width, int & height) { -x=atoi(GetToken()); +x=wxAtoi(GetToken()); -y=atoi(GetToken()); +y=wxAtoi(GetToken()); -width=atoi(GetToken()); +width=wxAtoi(GetToken()); -height=atoi(GetToken()); +height=wxAtoi(GetToken()); @@ -587,7 +587,7 @@ wxString rc2wxr::GetToken() { -wxString tok=""; +wxString tok=wxEmptyString; @@ -771,11 +771,11 @@ ReadRect(x,y,width,height); -fprintf(m_wxr," control = [%i,wxChoice,'','0','%s',",m_controlid,varname.c_str()); +wxFprintf(m_wxr,_T(" control = [%i,wxChoice,'','0','%s',"),m_controlid,varname.c_str()); -fprintf(m_wxr,"%i,%i,%i,%i,[],\\\n",x,y,width,height); +wxFprintf(m_wxr,_T("%i,%i,%i,%i,[],\\\n"),x,y,width,height); -fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"); +wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n")); @@ -789,39 +789,39 @@ void rc2wxr::ParseMenu(wxString name) { -wxString tok=""; +wxString tok=wxEmptyString; static int menuid=0; menuid++; -fprintf(m_wxr,"static char *MenuBar%i = \"menu(name = '%s',\\\n",menuid,name.c_str()); +wxFprintf(m_wxr,_T("static char *MenuBar%i = \"menu(name = '%s',\\\n"),menuid,name.c_str()); -fprintf(m_wxr,"menu = \\\n"); +wxFprintf(m_wxr,_T("menu = \\\n")); -fprintf(m_wxr,"[\\\n"); +wxFprintf(m_wxr,_T("[\\\n")); -while ((tok!="BEGIN")&(tok!="{")) +while ((tok!=_T("BEGIN"))&(tok!=_T("{"))) tok=GetToken(); -while ((tok!="END")&(tok!="}")) +while ((tok!=_T("END"))&(tok!=_T("}"))) { tok=GetToken(); -if (tok=="POPUP") +if (tok==_T("POPUP")) { ParsePopupMenu(); - fprintf(m_wxr," ],\\\n"); + wxFprintf(m_wxr,_T(" ],\\\n")); } @@ -829,7 +829,7 @@ if (tok=="POPUP") -fprintf(m_wxr,"]).\";\n\n"); +wxFprintf(m_wxr,_T("]).\";\n\n")); } @@ -853,31 +853,31 @@ int spot; //Remove /t because it causes problems -spot=tok.First("\\t"); +spot=tok.First(_T("\\t")); tok=tok.Left(spot); -fprintf(m_wxr," ['%s',%i,'',\\\n",tok.c_str(),menuitem); +wxFprintf(m_wxr,_T(" ['%s',%i,'',\\\n"),tok.c_str(),menuitem); -while ((tok!="BEGIN")&(tok!="{")) +while ((tok!=_T("BEGIN"))&(tok!=_T("{"))) tok=GetToken(); -while ((tok!="END")&(tok!="}")) +while ((tok!=_T("END"))&(tok!=_T("}"))) { tok=GetToken(); -if (tok=="MENUITEM") +if (tok==_T("MENUITEM")) { -if (PeekToken()=="SEPARATOR") +if (PeekToken()==_T("SEPARATOR")) -fprintf(m_wxr," [],\\\n"); +wxFprintf(m_wxr,_T(" [],\\\n")); else @@ -887,13 +887,13 @@ tok=GetQuoteField(); //Remove /t because it causes problems -spot=tok.First("\\t"); +spot=tok.First(_T("\\t")); tok=tok.Left(spot); menuitem++; -fprintf(m_wxr," ['%s',%i,''],\\\n",tok.c_str(),menuitem); +wxFprintf(m_wxr,_T(" ['%s',%i,''],\\\n"),tok.c_str(),menuitem); } @@ -951,15 +951,15 @@ kindctrl.MakeUpper(); -if (kindctrl=="MSCTLS_TRACKBAR32") +if (kindctrl==_T("MSCTLS_TRACKBAR32")) ParseSlider(label,varname); -if (kindctrl=="MSCTLS_PROGRESS32") +if (kindctrl==_T("MSCTLS_PROGRESS32")) ParseProgressBar(label,varname); -if (kindctrl=="BUTTON") +if (kindctrl==_T("BUTTON")) ParseCtrlButton(label,varname); @@ -973,7 +973,7 @@ if (kindctrl=="BUTTON") -void rc2wxr::ParseSlider(wxString label, wxString varname) +void rc2wxr::ParseSlider(wxString WXUNUSED(label), wxString varname) { @@ -981,17 +981,17 @@ wxString tok; while (ReadOrs(tok)); -fprintf(m_wxr," control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',",m_controlid,varname.c_str()); +wxFprintf(m_wxr,_T(" control = [%i,wxSlider,'','wxSL_HORIZONTAL','%s',"),m_controlid,varname.c_str()); int x,y,width,height; ReadRect(x,y,width,height); -fprintf(m_wxr,"%i,%i,%i,%i,",x,y,width,height); +wxFprintf(m_wxr,_T("%i,%i,%i,%i,"),x,y,width,height); -fprintf(m_wxr," 1, 1, 10,\\\n"); +wxFprintf(m_wxr,_T(" 1, 1, 10,\\\n")); -fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"); +wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n")); } @@ -1003,7 +1003,7 @@ CONTROL "Progress1",CG_IDC_PROGDLG_PROGRESS,"msctls_progress32", */ -void rc2wxr::ParseProgressBar(wxString label, wxString varname) +void rc2wxr::ParseProgressBar(wxString WXUNUSED(label), wxString varname) { @@ -1011,17 +1011,17 @@ wxString tok; while (ReadOrs(tok)); -fprintf(m_wxr," control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',",m_controlid,varname.c_str()); +wxFprintf(m_wxr,_T(" control = [%i,wxGauge,'','wxGA_HORIZONTAL','%s',"),m_controlid,varname.c_str()); int x,y,width,height; ReadRect(x,y,width,height); -fprintf(m_wxr,"%i,%i,%i,%i,",x,y,width,height); +wxFprintf(m_wxr,_T("%i,%i,%i,%i,"),x,y,width,height); -fprintf(m_wxr," 0, 10,\\\n"); +wxFprintf(m_wxr,_T(" 0, 10,\\\n")); -fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"); +wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n")); } @@ -1065,37 +1065,37 @@ int x,y,width,height; -if (tok=="BS_AUTOCHECKBOX") +if (tok==_T("BS_AUTOCHECKBOX")) { - fprintf(m_wxr," control = [%i,wxCheckBox,'%s','0','%s',",m_controlid,label.c_str(),varname.c_str()); + wxFprintf(m_wxr,_T(" control = [%i,wxCheckBox,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str()); while (ReadOrs(tok)); ReadRect(x,y,width,height); - fprintf(m_wxr,"%i,%i,%i,%i,0,\\\n",x,y,width,height); + wxFprintf(m_wxr,_T("%i,%i,%i,%i,0,\\\n"),x,y,width,height); - fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"); + wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n")); } -if (tok=="BS_AUTORADIOBUTTON") +if (tok==_T("BS_AUTORADIOBUTTON")) { - fprintf(m_wxr," control = [%i,wxRadioButton,'%s','0','%s',",m_controlid,label.c_str(),varname.c_str()); + wxFprintf(m_wxr,_T(" control = [%i,wxRadioButton,'%s','0','%s',"),m_controlid,label.c_str(),varname.c_str()); while(ReadOrs(tok)); ReadRect(x,y,width,height); - fprintf(m_wxr,"%i,%i,%i,%i,0,\\\n",x,y,width,height); + wxFprintf(m_wxr,_T("%i,%i,%i,%i,0,\\\n"),x,y,width,height); - fprintf(m_wxr,"[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n"); + wxFprintf(m_wxr,_T("[8, 'wxSWISS', 'wxNORMAL', 'wxNORMAL', 0, 'MS Sans Serif']],\\\n")); } diff --git a/contrib/utils/convertrc/rc2xml.cpp b/contrib/utils/convertrc/rc2xml.cpp index fc65fe51b3..d4db74abed 100644 --- a/contrib/utils/convertrc/rc2xml.cpp +++ b/contrib/utils/convertrc/rc2xml.cpp @@ -72,7 +72,7 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile) m_workingpath=wxPathOnly(rcfile); - m_targetpath=wxPathOnly(xmlfile)+"\\"; + m_targetpath=wxPathOnly(xmlfile) + _T("\\"); @@ -80,15 +80,15 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile) bool result; - result=m_xmlfile.Open(xmlfile.c_str(),"w+t"); - wxASSERT_MSG(result,"Couldn't create XML file"); + result=m_xmlfile.Open(xmlfile.c_str(),_T("w+t")); + wxASSERT_MSG(result,_T("Couldn't create XML file")); if (!result) return FALSE; /* Write Basic header for XML file */ - m_xmlfile.Write("\n"); - m_xmlfile.Write("\n"); + m_xmlfile.Write(_T("\n")); + m_xmlfile.Write(_T("\n")); //Read resource.h ParseResourceHeader(); @@ -99,7 +99,7 @@ bool rc2xml::Convert(wxString rcfile, wxString xmlfile) //Read in dialogs, toolbars,menus SecondPass(); - m_xmlfile.Write("\n"); + m_xmlfile.Write(_T("\n")); m_xmlfile.Close(); m_rc.Close(); wxMessageBox(_("Conversion complete."), _("Done"), @@ -119,8 +119,8 @@ microsoft reuses the keyword DIALOG for other things */ token=PeekToken(); //Microsoft notation? - while ((token=="DISCARDABLE") - ||(token=="LOADONCALL")||(token=="MOVEABLE")) + while ((token==_T("DISCARDABLE")) + ||(token==_T("LOADONCALL"))||(token==_T("MOVEABLE"))) { token=GetToken(); token=PeekToken(); @@ -137,37 +137,37 @@ microsoft reuses the keyword DIALOG for other things wxString title; wxString ptsize,face; - m_xmlfile.Write("\t\n"); - m_xmlfile.Write("\t\t\t"+ptsize+"\n"); - m_xmlfile.Write("\t\t\t"+face+"\n"); - m_xmlfile.Write("\t\t\n"); + 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(); } ParseControls(); - m_xmlfile.Write("\t\n"); + m_xmlfile.Write(_T("\t\n")); } /* @@ -184,60 +184,60 @@ void rc2xml::ParseControls() wxString label,varname; token=GetToken(); - while ((token!="END")&(token!="}")) + while ((token!=_T("END"))&(token!=_T("}"))) { - if (token=="AUTOCHECKBOX") + if (token==_T("AUTOCHECKBOX")) { label=GetQuoteField(); varname=GetToken(); ParseCheckBox(label,varname); } else - if (token=="AUTORADIOBUTTON") + if (token==_T("AUTORADIOBUTTON")) { label=GetQuoteField(); varname=GetToken(); ParseRadioButton(label,varname); } else - if (token=="LTEXT") + if (token==_T("LTEXT")) { label=GetQuoteField(); varname=GetToken(); ParseStaticText(label,varname); } - else if (token=="EDITTEXT") + else if (token==_T("EDITTEXT")) { varname=GetToken(); ParseTextCtrl(varname); } - else if ((token=="PUSHBUTTON")||(token=="DEFPUSHBUTTON")) + else if ((token==_T("PUSHBUTTON"))||(token==_T("DEFPUSHBUTTON"))) { label=GetQuoteField(); varname=GetToken(); ParsePushButton(label,varname); } - else if (token=="GROUPBOX") + else if (token==_T("GROUPBOX")) { label=GetQuoteField(); varname=GetToken(); ParseGroupBox(label,varname); } - else if (token=="COMBOBOX") + else if (token==_T("COMBOBOX")) { varname=GetToken(); ParseComboBox(varname); } - else if (token=="CONTROL") + else if (token==_T("CONTROL")) ParseControlMS(); - else if (token=="LISTBOX") + else if (token==_T("LISTBOX")) { varname=GetToken(); ParseListBox(varname); } - else if (token=="ICON") + else if (token==_T("ICON")) ParseIconStatic(); - else if (token=="SCROLLBAR") + else if (token==_T("SCROLLBAR")) ParseScrollBar(); token=GetToken(); } @@ -256,9 +256,9 @@ void rc2xml::ParseStaticText(wxString phrase, wxString varname) int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } //EDITTEXT IDC_RADIUS,36,65,40,14,ES_AUTOHSCROLL @@ -276,9 +276,9 @@ void rc2xml::ParseTextCtrl(wxString varname) ReadRect(x,y,width,height); //TODO //style=GetToken(); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } //AUTOCHECKBOX "&log.", ID_XLOG, 25, 24, 21, 12 @@ -294,10 +294,10 @@ void rc2xml::ParseCheckBox(wxString phrase, wxString varname) int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } //AUTORADIOBUTTON "&text", ID_SW10, 13, 12, 68, 10, BS_AUTORADIOBUTTON | WS_GROUP @@ -310,14 +310,14 @@ void rc2xml::ParseRadioButton(wxString phrase, wxString varname) if (ReadRect(x,y,width,height)) if (GotOrs==FALSE) ReadOrs(token); - if (token.Find("WS_GROUP") != -1) - style += "wxRB_GROUP"; + if (token.Find(_T("WS_GROUP")) != -1) + style += _T("wxRB_GROUP"); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } @@ -335,10 +335,10 @@ void rc2xml::ParsePushButton(wxString phrase, wxString varname) int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } @@ -371,26 +371,26 @@ void rc2xml::ParseGroupBox(wxString phrase, wxString varname) int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } bool rc2xml::ReadRect(int & x, int & y, int & width, int & height) { - x=atoi(GetToken()); - y=atoi(GetToken()); - width=atoi(GetToken()); + x=wxAtoi(GetToken()); + y=wxAtoi(GetToken()); + width=wxAtoi(GetToken()); bool ret; wxString tmp = GetToken(&ret); - height=atoi(tmp); + height=wxAtoi(tmp); return ret; // check for more parameters } wxString rc2xml::GetToken(bool *listseperator) { - wxString token=""; + wxString token=wxEmptyString; if (m_rc.Eof()) { @@ -524,43 +524,43 @@ void rc2xml::ParseComboBox(wxString varname) if (GotOrs==FALSE) ReadOrs(token); - m_xmlfile.Write("\t\t\n"); + if (token.Find(_T("CBS_SIMPLE")) != -1) + WriteStyle(_T("wxCB_SIMPLE")); + if (token.Find(_T("CBS_SORT")) != -1) + WriteStyle(_T("wxCB_SORT")); + if (token.Find(_T("CBS_DISABLENOSCROLL")) != -1) + WriteStyle(_T("wxLB_ALWAYS_SB")); + m_xmlfile.Write(_T("\n\t\t\n")); } void rc2xml::ParseMenu(wxString varname) { - wxString token=""; + wxString token=wxEmptyString; //Write menubar to xml file - m_xmlfile.Write("\t\n"); + m_xmlfile.Write(_T(">\n")); - while ((token!="BEGIN")&(token!="{")) + while ((token!=_T("BEGIN"))&(token!=_T("{"))) token=GetToken(); - while ((token!="END")&(token!="}")) + while ((token!=_T("END"))&(token!=_T("}"))) { token=GetToken(); token.MakeUpper(); - if (token=="POPUP") + if (token==_T("POPUP")) { ParsePopupMenu(); } } - m_xmlfile.Write("\t\n"); + m_xmlfile.Write(_T("\t\n")); } void rc2xml::ParsePopupMenu() @@ -577,27 +577,27 @@ void rc2xml::ParsePopupMenu() //Write Menu item //Generate a fake name since RC menus don't have one - name<<"Menu_"<\n"); + m_xmlfile.Write(_T(">\n")); WriteLabel(token); - while ((token!="BEGIN")&(token!="{")) + while ((token!=_T("BEGIN"))&(token!=_T("{"))) token=GetToken(); - while ((token!="END")&(token!="}")) + while ((token!=_T("END"))&(token!=_T("}"))) { token=GetToken(); token.MakeUpper(); - if (token=="POPUP") + if (token==_T("POPUP")) ParsePopupMenu(); - if (token=="MENUITEM") + if (token==_T("MENUITEM")) ParseMenuItem(); } - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } wxString rc2xml::PeekToken() @@ -616,7 +616,7 @@ void rc2xml::ParseControlMS() wxString label,varname,kindctrl,token; token=PeekToken(); - if (token.Contains("\"")) + if (token.Contains(_T("\""))) ParseNormalMSControl(); else ParseWeirdMSControl(); @@ -627,29 +627,29 @@ void rc2xml::ParseControlMS() TBS_NOTICKS | WS_TABSTOP,52,73,100,15 */ -void rc2xml::ParseSlider(wxString label, wxString varname) +void rc2xml::ParseSlider(wxString WXUNUSED(label), wxString varname) { wxString token,style; ReadOrs(token); - if (token.Find("TBS_VERT")!=-1) - style+="wxSL_VERTICAL"; + if (token.Find(_T("TBS_VERT"))!=-1) + style+=_T("wxSL_VERTICAL"); //MFC RC Default is horizontal else - style+="wxSL_HORIZONTAL"; + style+=_T("wxSL_HORIZONTAL"); int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\n\t\t\n")); } /* CONTROL "Progress1",CG_IDC_PROGDLG_PROGRESS,"msctls_progress32", WS_BORDER,15,52,154,13 */ -void rc2xml::ParseProgressBar(wxString label, wxString varname) +void rc2xml::ParseProgressBar(wxString WXUNUSED(label), wxString varname) { wxString token,style; ReadOrs(token); @@ -658,10 +658,10 @@ void rc2xml::ParseProgressBar(wxString label, wxString varname) ReadRect(x,y,width,height); //Always horizontal in MFC - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } bool rc2xml::ReadOrs(wxString & orstring) @@ -692,12 +692,12 @@ void rc2xml::ParseCtrlButton(wxString label, wxString varname) ReadOrs(token); m_rc.Seek(p); - if (token.Find("BS_AUTOCHECKBOX")!=-1) + if (token.Find(_T("BS_AUTOCHECKBOX"))!=-1) ParseCheckBox(label, varname); - else if ((token.Find("BS_AUTORADIOBUTTON")!=-1)|| - (token.Find("BS_RADIOBUTTON")!=-1)) + else if ((token.Find(_T("BS_AUTORADIOBUTTON"))!=-1)|| + (token.Find(_T("BS_RADIOBUTTON"))!=-1)) ParseRadioButton(label, varname); - else if (token.Find("BS_GROUPBOX")!=-1) + else if (token.Find(_T("BS_GROUPBOX"))!=-1) ParseGroupBox(label, varname); else // if ((token.Find("BS_PUSHBUTTON")!=-1)|| // (token.Find("BS_DEFPUSHBUTTON")!=-1)) @@ -707,21 +707,21 @@ void rc2xml::ParseCtrlButton(wxString label, wxString varname) void rc2xml::WriteSize(int width, int height) { wxString msg; - msg<<" "<"; + msg << _T(" ") << width << _T(",") << height << _T("d"); m_xmlfile.Write(msg); } void rc2xml::WritePosition(int x, int y) { wxString msg; - msg<<" "<"; + msg << _T(" ") << x << _T(",") << y << _T("d"); m_xmlfile.Write(msg); } void rc2xml::WriteTitle(wxString title) { wxString msg; - msg=_T("\t\t"+title+"\n"); + msg=_T("\t\t")+title+_T("\n"); m_xmlfile.Write(msg); } @@ -732,69 +732,69 @@ void rc2xml::WriteName(wxString name) name=LookUpId(name); //Replace common MS ids with wxWindows ids //I didn't do everyone of them - if (name=="IDOK") - name="wxID_OK"; - else if (name=="IDCANCEL") - name="wxID_CANCEL"; - else if (name=="IDAPPLY") - name="wxID_APPLY"; - else if (name=="ID_FILE_OPEN") - name="wxID_OPEN"; - else if (name=="ID_FILE_CLOSE") - name="wxID_CLOSE"; - else if (name=="ID_FILE_SAVE") - name="wxID_SAVE"; - else if (name=="ID_FILE_SAVE_AS") - name="wxID_SAVEAS"; - else if (name=="ID_APP_EXIT") - name="wxID_EXIT"; - else if (name=="ID_FILE_PRINT") - name="wxID_PRINT"; - else if (name=="ID_FILE_PRINT_PREVIEW") - name="wxID_PREVIEW"; - else if (name=="ID_FILE_PRINT_SETUP") - name="wxID_PRINT_SETUP"; - else if (name=="ID_APP_ABOUT") - name="wxID_ABOUT"; - else if (name=="ID_EDIT_UNDO") - name="wxID_UNDO"; - else if (name=="ID_EDIT_CUT") - name="wxID_CUT"; - else if (name=="ID_EDIT_COPY") - name="wxID_COPY"; - else if (name=="ID_EDIT_PASTE") - name="wxID_PASTE"; - else if (name=="IDYES") - name="wxID_YES"; - else if (name=="IDNO") - name="wxID_NO"; - else if (name=="IDHELP") - name="wxID_HELP"; - - m_xmlfile.Write(" name= \""+name+"\""); + if (name==_T("IDOK")) + name=_T("wxID_OK"); + else if (name==_T("IDCANCEL")) + name=_T("wxID_CANCEL"); + else if (name==_T("IDAPPLY")) + name=_T("wxID_APPLY"); + else if (name==_T("ID_FILE_OPEN")) + name=_T("wxID_OPEN"); + else if (name==_T("ID_FILE_CLOSE")) + name=_T("wxID_CLOSE"); + else if (name==_T("ID_FILE_SAVE")) + name=_T("wxID_SAVE"); + else if (name==_T("ID_FILE_SAVE_AS")) + name=_T("wxID_SAVEAS"); + else if (name==_T("ID_APP_EXIT")) + name=_T("wxID_EXIT"); + else if (name==_T("ID_FILE_PRINT")) + name=_T("wxID_PRINT"); + else if (name==_T("ID_FILE_PRINT_PREVIEW")) + name=_T("wxID_PREVIEW"); + else if (name==_T("ID_FILE_PRINT_SETUP")) + name=_T("wxID_PRINT_SETUP"); + else if (name==_T("ID_APP_ABOUT")) + name=_T("wxID_ABOUT"); + else if (name==_T("ID_EDIT_UNDO")) + name=_T("wxID_UNDO"); + else if (name==_T("ID_EDIT_CUT")) + name=_T("wxID_CUT"); + else if (name==_T("ID_EDIT_COPY")) + name=_T("wxID_COPY"); + else if (name==_T("ID_EDIT_PASTE")) + name=_T("wxID_PASTE"); + else if (name==_T("IDYES")) + name=_T("wxID_YES"); + else if (name==_T("IDNO")) + name=_T("wxID_NO"); + else if (name==_T("IDHELP")) + name=_T("wxID_HELP"); + + m_xmlfile.Write(_T(" name= \"")+name+_T("\"")); } void rc2xml::WriteLabel(wxString label) { - label.Replace("&","$"); - m_xmlfile.Write("\t\t\t\n"); + label.Replace(_T("&"),_T("$")); + m_xmlfile.Write(_T("\t\t\t\n")); } void rc2xml::WriteBasicInfo(int x, int y, int width, int height, wxString name) { WriteName(name); - m_xmlfile.Write(">\n"); - m_xmlfile.Write("\t\t\t"); + m_xmlfile.Write(_T(">\n")); + m_xmlfile.Write(_T("\t\t\t")); WritePosition(x,y); WriteSize(width,height); - m_xmlfile.Write("\n"); + m_xmlfile.Write(_T("\n")); } void rc2xml::WriteStyle(wxString style) { if (style.Length()==0) return; - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } /* LISTBOX IDC_LIST1,16,89,48,40,LBS_SORT | LBS_MULTIPLESEL | @@ -812,9 +812,9 @@ void rc2xml::ParseListBox(wxString varname) int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\n\t\t\n")); } /* @@ -830,34 +830,34 @@ void rc2xml::ParseRichEdit(wxString label, wxString varname) ReadRect(x,y,width,height); wxString style; //Make it a rich text control - style+="wxTE_MULTILINE "; - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } /* CONTROL "Spin1",IDC_SPIN1,"msctls_updown32",UDS_ARROWKEYS,209,72, 19,26 */ -void rc2xml::ParseSpinCtrl(wxString label, wxString varname) +void rc2xml::ParseSpinCtrl(wxString WXUNUSED(label), wxString varname) { wxString token,style; ReadOrs(token); - if (token.Find("UDS_HORZ")!=-1) - style="wxSP_HORIZONTAL"; + if (token.Find(_T("UDS_HORZ"))!=-1) + style=_T("wxSP_HORIZONTAL"); //MFC default else - style="wxSP_VERTICAL"; + style=_T("wxSP_VERTICAL"); int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\n\t\t\n")); } @@ -867,11 +867,11 @@ void rc2xml::FirstPass() while (!m_done) { token=GetToken(); - if (token=="BITMAP") + if (token==_T("BITMAP")) ParseBitmap(prevtok); - else if (token=="STRINGTABLE") + else if (token==_T("STRINGTABLE")) ParseStringTable(prevtok); - else if (token=="ICON") + else if (token==_T("ICON")) ParseIcon(prevtok); prevtok=token; @@ -884,7 +884,7 @@ void rc2xml::ParseBitmap(wxString varname) token=PeekToken(); //Microsoft notation? - if (token=="DISCARDABLE") + if (token==_T("DISCARDABLE")) { token=GetToken(); token=PeekToken(); @@ -902,11 +902,11 @@ void rc2xml::SecondPass() while (!m_done) { token=GetToken(); - if ((token=="DIALOG")||(token=="DIALOGEX")) + if ((token==_T("DIALOG"))||(token==_T("DIALOGEX"))) ParseDialog(prevtok); - else if (token=="MENU") + else if (token==_T("MENU")) ParseMenu(prevtok); - else if (token=="TOOLBAR") + else if (token==_T("TOOLBAR")) ParseToolBar(prevtok); prevtok=token; @@ -918,67 +918,67 @@ void rc2xml::ParseToolBar(wxString varname) { wxString token; token=GetToken(); - wxASSERT_MSG(token=="DISCARDABLE","Error in toolbar parsing"); + wxASSERT_MSG(token==_T("DISCARDABLE"),_T("Error in toolbar parsing")); //Look up bitmap for toolbar and load wxNode *node=m_bitmaplist->Find(LookUpId(varname)); wxString *bitmappath; - bitmappath=(wxString *)node->Data(); + bitmappath=(wxString *)node->GetData(); wxBitmap bitmap; if (!bitmap.LoadFile(*bitmappath,wxBITMAP_TYPE_BMP )) - wxLogError("Unable to load bitmap:"+*bitmappath); + wxLogError(_T("Unable to load bitmap:")+*bitmappath); //Write toolbar to xml file - m_xmlfile.Write(" \n"); + m_xmlfile.Write(_T(">\n")); wxString style; - style+="wxTB_FLAT"; + style+=_T("wxTB_FLAT"); WriteStyle(style); //Grab width and height int width,height; - width=atoi(GetToken()); - height=atoi(GetToken()); + width=wxAtoi(GetToken()); + height=wxAtoi(GetToken()); int c=0; wxString buttonname,msg,tip,longhelp; token=GetToken(); - while ((token!="BEGIN")&(token!="{")) + while ((token!=_T("BEGIN"))&(token!=_T("{"))) token=GetToken(); - while ((token!="END")&(token!="}")) + while ((token!=_T("END"))&(token!=_T("}"))) { - if (token=="BUTTON") + if (token==_T("BUTTON")) { buttonname=GetToken(); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T(">\n")); //Write tool tip if any if (LookUpString(buttonname,msg)) { SplitHelp(msg,tip,longhelp); - m_xmlfile.Write("\t\t\t\t"+tip+"\n"); - m_xmlfile.Write(" "+longhelp+"\n"); + m_xmlfile.Write(_T("\t\t\t\t")+tip+_T("\n")); + m_xmlfile.Write(_T(" ")+longhelp+_T("\n")); } //Make a bitmap file name buttonname=CleanName(buttonname); - buttonname+=".bmp"; - m_xmlfile.Write("\t\t\t\t"+buttonname+"\n"); + buttonname+=_T(".bmp"); + m_xmlfile.Write(_T("\t\t\t\t")+buttonname+_T("\n")); WriteToolButton(buttonname,c,width,height,bitmap); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); c++; } - else if (token=="SEPARATOR") + else if (token==_T("SEPARATOR")) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } token=GetToken(); } - m_xmlfile.Write("\t\n"); + m_xmlfile.Write(_T("\t\n")); } //Extract bitmaps from larger toolbar bitmap @@ -996,12 +996,12 @@ void rc2xml::ParseStringTable(wxString varname) { wxString token; token=GetToken(); - while ((token!="BEGIN")&(token!="{")) + while ((token!=_T("BEGIN"))&(token!=_T("{"))) token=GetToken(); token=GetToken(); wxString *msg; - while ((token!="END")&(token!="}")) + while ((token!=_T("END"))&(token!=_T("}"))) { msg=new wxString; *msg=GetStringQuote(); @@ -1018,7 +1018,7 @@ bool rc2xml::LookUpString(wxString strid,wxString & st) if (node==NULL) return FALSE; - s=(wxString *)node->Data(); + s=(wxString *)node->GetData(); st=*s; return TRUE; @@ -1027,7 +1027,7 @@ bool rc2xml::LookUpString(wxString strid,wxString & st) bool rc2xml::SplitHelp(wxString msg, wxString &shorthelp, wxString &longhelp) { int spot; - spot=msg.Find("\\n"); + spot=msg.Find(_T("\\n")); if (spot==-1) { shorthelp=msg; @@ -1044,9 +1044,9 @@ void rc2xml::ParseMenuItem() { wxString token,name,msg,tip,longhelp; //int spot; - if (PeekToken()=="SEPARATOR") + if (PeekToken()==_T("SEPARATOR")) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); return; } @@ -1055,38 +1055,38 @@ void rc2xml::ParseMenuItem() //Remove \t because it causes problems //spot=token.First("\\t"); //token=token.Left(spot); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T(">\n")); WriteLabel(token); //Look up help if any listed in stringtable //can't assume numbers correlate, restrict to string identifiers if ((!name.IsNumber())&&(LookUpString(name,msg))) { SplitHelp(msg,tip,longhelp); - m_xmlfile.Write("\t\t\t" - +longhelp+"\n"); + m_xmlfile.Write(_T("\t\t\t") + +longhelp+_T("\n")); } //look for extra attributes like checked and break wxString ptoken; ptoken=PeekToken(); ptoken.MakeUpper(); - while ((ptoken!="MENUITEM")&(ptoken!="POPUP")&(ptoken!="END")) + while ((ptoken!=_T("MENUITEM"))&(ptoken!=_T("POPUP"))&(ptoken!=_T("END"))) { token=GetToken(); ptoken.MakeUpper(); - if (token=="CHECKED") - m_xmlfile.Write("\t\t\t1\n"); - else if (token=="MENUBREAK"); + if (token==_T("CHECKED")) + m_xmlfile.Write(_T("\t\t\t1\n")); + else if (token==_T("MENUBREAK")); //m_xmlfile.Write("\t\t\t\n"); - else if (token=="GRAYED"); + else if (token==_T("GRAYED")); else - wxLogError("Unknown Menu Item token:"+token); + wxLogError(_T("Unknown Menu Item token:")+token); ptoken=PeekToken(); ptoken.MakeUpper(); } - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } @@ -1096,7 +1096,7 @@ void rc2xml::ParseIconStatic() wxString token; wxString varname,iconname; token = PeekToken(); - if (token.Contains("\"")) + if (token.Contains(_T("\""))) iconname = GetQuoteField(); else iconname=GetToken(); @@ -1106,11 +1106,11 @@ void rc2xml::ParseIconStatic() int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } //IDR_MAINFRAME ICON DISCARDABLE "res\\mfcexample.ico" @@ -1129,14 +1129,14 @@ void rc2xml::ParseIcon(wxString varname) wxString rc2xml::CleanName(wxString name) { name.MakeLower(); - name.Replace("id_",""); - name.Replace("idr_",""); - name.Replace("idb_",""); - name.Replace("idc_",""); + name.Replace(_T("id_"),wxEmptyString); + name.Replace(_T("idr_"),wxEmptyString); + name.Replace(_T("idb_"),wxEmptyString); + name.Replace(_T("idc_"),wxEmptyString); - name.Replace(".ico",""); + name.Replace(_T(".ico"),wxEmptyString); - name.Replace(".bmp",""); + name.Replace(_T(".bmp"),wxEmptyString); return name; } // And the award for most messed up control goes to... @@ -1151,10 +1151,10 @@ void rc2xml::ParseStaticBitmap(wxString bitmapname, wxString varname) int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } @@ -1167,38 +1167,38 @@ varname=GetToken(); kindctrl=GetQuoteField(); kindctrl.MakeUpper(); - if (kindctrl=="MSCTLS_UPDOWN32") + if (kindctrl==_T("MSCTLS_UPDOWN32")) ParseSpinCtrl(label,varname); - if (kindctrl=="MSCTLS_TRACKBAR32") + if (kindctrl==_T("MSCTLS_TRACKBAR32")) ParseSlider(label,varname); - if (kindctrl=="MSCTLS_PROGRESS32") + if (kindctrl==_T("MSCTLS_PROGRESS32")) ParseProgressBar(label,varname); - if (kindctrl=="SYSTREEVIEW32") + if (kindctrl==_T("SYSTREEVIEW32")) ParseTreeCtrl(label,varname); - if (kindctrl=="SYSMONTHCAL32") + if (kindctrl==_T("SYSMONTHCAL32")) ParseCalendar(label,varname); - if (kindctrl=="SYSLISTVIEW32") + if (kindctrl==_T("SYSLISTVIEW32")) ParseListCtrl(label,varname); - if (kindctrl=="BUTTON") + if (kindctrl==_T("BUTTON")) ParseCtrlButton(label,varname); - if (kindctrl=="RICHEDIT") + if (kindctrl==_T("RICHEDIT")) ParseRichEdit(label,varname); - if (kindctrl=="STATIC") + if (kindctrl==_T("STATIC")) { wxString token; int p=m_rc.Tell(); ReadOrs(token); m_rc.Seek(p); - if (token.Find("SS_BITMAP")!=-1) + if (token.Find(_T("SS_BITMAP"))!=-1) ParseStaticBitmap(label,varname); else ParseStaticText(label,varname); } - if (kindctrl=="EDIT") + if (kindctrl==_T("EDIT")) ParseTextCtrl(varname); - if (kindctrl=="LISTBOX") + if (kindctrl==_T("LISTBOX")) ParseListBox(varname); - if (kindctrl=="COMBOBOX") + if (kindctrl==_T("COMBOBOX")) ParseComboBox(varname); } @@ -1213,12 +1213,12 @@ void rc2xml::ParseWeirdMSControl() kindctrl=GetQuoteField(); kindctrl.MakeUpper(); // CONTROL IDB_FACE,IDC_STATIC,"Static",SS_BITMAP,26,62,32,30 - if (kindctrl=="STATIC") + if (kindctrl==_T("STATIC")) { - if (PeekToken()=="SS_BITMAP") + if (PeekToken()==_T("SS_BITMAP")) ParseStaticBitmap(id,varname); else - wxLogError("Unknown MS Control Static token"); + wxLogError(_T("Unknown MS Control Static token")); } } @@ -1236,60 +1236,60 @@ void rc2xml::ParseScrollBar() ReadOrs(token); -if (token.Find("SBS_VERT")!=-1) +if (token.Find(_T("SBS_VERT"))!=-1) style=_T("wxSB_VERTICAL"); //Default MFC style is horizontal else style=_T("wxSB_HORIZONTAL"); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\n\t\t\n")); } // CONTROL "Tree1",IDC_TREE1,"SysTreeView32",WS_BORDER | WS_TABSTOP, // 7,7,66,61 -void rc2xml::ParseTreeCtrl(wxString label, wxString varname) +void rc2xml::ParseTreeCtrl(wxString WXUNUSED(label), wxString varname) { wxString token; //while (ReadOrs(token)); ReadOrs(token); int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } // CONTROL "MonthCalendar1",IDC_MONTHCALENDAR1,"SysMonthCal32", //MCS_NOTODAY | WS_TABSTOP,105,71,129,89 -void rc2xml::ParseCalendar(wxString label, wxString varname) +void rc2xml::ParseCalendar(wxString WXUNUSED(label), wxString varname) { wxString token; //while (ReadOrs(token)); ReadOrs(token); int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } // CONTROL "List1",IDC_LIST1,"SysListView32",WS_BORDER | WS_TABSTOP, // 7,89,68,71 -void rc2xml::ParseListCtrl(wxString label, wxString varname) +void rc2xml::ParseListCtrl(wxString WXUNUSED(label), wxString varname) { wxString token; //while (ReadOrs(token)); ReadOrs(token); int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write(_T("\t\t\n")); } @@ -1299,23 +1299,23 @@ void rc2xml::WriteBitmap(wxString bitmapname) wxNode *node=m_bitmaplist->Find(LookUpId(bitmapname)); if (node==NULL) { - m_xmlfile.Write("\t\t\tmissingfile\n"); - wxLogError("Unable to find bitmap:"+bitmapname); + m_xmlfile.Write(_T("\t\t\tmissingfile\n")); + wxLogError(_T("Unable to find bitmap:")+bitmapname); return; } wxString *bitmappath; - bitmappath=(wxString *)node->Data(); + bitmappath=(wxString *)node->GetData(); bitmapname=wxFileNameFromPath(*bitmappath); wxBitmap bitmap; if (!bitmap.LoadFile(*bitmappath,wxBITMAP_TYPE_BMP )) - wxLogError("Unable to load bitmap:"+*bitmappath); + wxLogError(_T("Unable to load bitmap:")+*bitmappath); //Make a bitmap file name bitmapname=CleanName(bitmapname); - bitmapname+=".bmp"; - m_xmlfile.Write("\t\t\t"+bitmapname+"\n"); + bitmapname+=_T(".bmp"); + m_xmlfile.Write(_T("\t\t\t")+bitmapname+_T("\n")); bitmap.SaveFile(m_targetpath+bitmapname,wxBITMAP_TYPE_BMP); } @@ -1324,15 +1324,15 @@ void rc2xml::WriteIcon(wxString iconname) wxNode *node=m_iconlist->Find(iconname); if (node==NULL) { - m_xmlfile.Write("\t\t\tmissing_file\n"); - wxLogError("Unable to find icon:"+iconname); + m_xmlfile.Write(_T("\t\t\tmissing_file\n")); + wxLogError(_T("Unable to find icon:")+iconname); } wxString *iconpath; - iconpath=(wxString *)node->Data(); + iconpath=(wxString *)node->GetData(); wxIcon icon; wxBitmap bitmap; if (!icon.LoadFile(*iconpath,wxBITMAP_TYPE_ICO )) - wxLogError("Unable to load icon:"+*iconpath); + wxLogError(_T("Unable to load icon:")+*iconpath); #ifdef __WXMSW__ bitmap.CopyFromIcon(icon); #else @@ -1341,8 +1341,8 @@ wxNode *node=m_iconlist->Find(iconname); iconname=wxFileNameFromPath(*iconpath); //Make a bitmap file name iconname=CleanName(iconname); - iconname+=".bmp"; - m_xmlfile.Write("\t\t\t"+iconname+"\n"); + iconname+=_T(".bmp"); + m_xmlfile.Write(_T("\t\t\t")+iconname+_T("\n")); bitmap.SaveFile(m_targetpath+iconname,wxBITMAP_TYPE_BMP); @@ -1358,9 +1358,9 @@ void rc2xml::ParseResourceHeader() { wxTextFile r; //Attempt to load resource.h in current path - if (!r.Open("resource.h")) + if (!r.Open(_T("resource.h"))) { - wxLogError("Warining Unable to load resource.h file"); + wxLogError(_T("Warining Unable to load resource.h file")); return; } @@ -1375,7 +1375,7 @@ wxTextFile r; //Read through entire file for ( str = r.GetFirstLine(); !r.Eof(); str = r.GetNextLine() ) { - if (str.Find("#define")!=-1) + if (str.Find(_T("#define"))!=-1) { tok.SetString(str); //Just ignore #define token @@ -1410,7 +1410,7 @@ wxNode *node=m_resourcelist->Find(n); if (node==NULL) return id; - s=(wxString *)node->Data(); + s=(wxString *)node->GetData(); st=*s; return st; } diff --git a/contrib/utils/convertrc/wxr2xml.cpp b/contrib/utils/convertrc/wxr2xml.cpp index f2e331ec5c..8c4a70e6e0 100644 --- a/contrib/utils/convertrc/wxr2xml.cpp +++ b/contrib/utils/convertrc/wxr2xml.cpp @@ -45,20 +45,20 @@ wxr2xml::~wxr2xml() bool wxr2xml::Convert(wxString wxrfile, wxString xmlfile) { bool result; - result = m_xmlfile.Open(xmlfile.c_str(), "w+t"); - wxASSERT_MSG(result, "Couldn't create XML file"); + result = m_xmlfile.Open(xmlfile.c_str(), _T("w+t")); + wxASSERT_MSG(result, _T("Couldn't create XML file")); if (!result) return FALSE; result = m_table.ParseResourceFile(wxrfile); - wxASSERT_MSG(result, "Couldn't Load WXR file"); + wxASSERT_MSG(result, _T("Couldn't Load WXR file")); if (!result) return FALSE; // Write basic xml header - m_xmlfile.Write("\n"); - m_xmlfile.Write("\n"); + m_xmlfile.Write(_T("\n")); + m_xmlfile.Write(_T("\n")); result = ParseResources(); - m_xmlfile.Write("\n"); + m_xmlfile.Write(_T("\n")); m_xmlfile.Close(); @@ -70,89 +70,91 @@ bool wxr2xml::ParseResources() m_table.BeginFind(); wxNode *node; - while ((node = m_table.Next())) + node = m_table.Next(); + while (node) { - wxItemResource *res = (wxItemResource *) node->Data(); + wxItemResource *res = (wxItemResource *) node->GetData(); wxString resType(res->GetType()); - if (resType == "wxDialog") + if (resType == _T("wxDialog")) ParseDialog(res); - else if (resType == "wxPanel") + else if (resType == _T("wxPanel")) ParsePanel(res); - else if (resType == "wxPanel") + else if (resType == _T("wxPanel")) ParsePanel(res); - else if (resType == "wxMenu") + else if (resType == _T("wxMenu")) ParseMenuBar(res); - else if (resType == "wxBitmap") + else if (resType == _T("wxBitmap")) ParseBitmap(res); else - wxLogError("Found unsupported resource " + resType); + wxLogError(_T("Found unsupported resource ") + resType); + node = m_table.Next(); } return TRUE; } void wxr2xml::ParsePanel(wxItemResource * res) { - m_xmlfile.Write("\t\n\n"); + m_xmlfile.Write(_T("\t\n\n")); } void wxr2xml::ParseDialog(wxItemResource * res) { PanelStuff(res); - m_xmlfile.Write("\t\n\n"); + m_xmlfile.Write(_T("\t\n\n")); } void wxr2xml::ParseControls(wxItemResource * res) { - wxNode *node = res->GetChildren().First(); + wxNode *node = res->GetChildren().GetFirst(); while (node) { - wxItemResource *res = (wxItemResource *) node->Data(); + wxItemResource *res = (wxItemResource *) node->GetData(); wxString resType(res->GetType()); - if (resType == "wxButton") + if (resType == _T("wxButton")) ParseButton(res); - else if ((resType == "wxTextCtrl") | (resType == "wxText") - | (resType == "wxMultiText")) + else if ((resType == _T("wxTextCtrl")) | (resType == _T("wxText")) + | (resType == _T("wxMultiText"))) ParseTextCtrl(res); - else if (resType == "wxCheckBox") + else if (resType == _T("wxCheckBox")) ParseCheckBox(res); - else if (resType == "wxRadioBox") + else if (resType == _T("wxRadioBox")) ParseRadioBox(res); - else if (resType == "wxListBox") + else if (resType == _T("wxListBox")) ParseListBox(res); - else if ((resType == "wxStaticText") | (resType == "wxMessage")) + else if ((resType == _T("wxStaticText")) | (resType == _T("wxMessage"))) ParseStaticText(res); - else if (resType == "wxChoice") + else if (resType == _T("wxChoice")) ParseChoice(res); - else if (resType == "wxGauge") + else if (resType == _T("wxGauge")) ParseGauge(res); - else if (resType == "wxSlider") + else if (resType == _T("wxSlider")) ParseSlider(res); - else if (resType == "wxComboBox") + else if (resType == _T("wxComboBox")) ParseComboBox(res); - else if (resType == "wxRadioButton") + else if (resType == _T("wxRadioButton")) ParseRadioButton(res); - else if (resType == "wxStaticBitmap") + else if (resType == _T("wxStaticBitmap")) ParseStaticBitmap(res); - else if (resType == "wxScrollBar") + else if (resType == _T("wxScrollBar")) ParseScrollBar(res); - else if ((resType == "wxStaticBox") | (resType == "wxGroupBox")) + else if ((resType == _T("wxStaticBox")) | (resType == _T("wxGroupBox"))) ParseStaticBox(res); - else if (resType == "wxBitmapButton") + else if (resType == _T("wxBitmapButton")) ParseBitmapButton(res); else - wxLogError("Found unsupported resource " + resType); - node = node->Next(); + wxLogError(_T("Found unsupported resource ") + resType); + node = node->GetNext(); } } @@ -161,7 +163,7 @@ void wxr2xml::ParseControls(wxItemResource * res) void wxr2xml::WriteControlInfo(wxItemResource * res) { m_xmlfile.Write(GenerateName(res)); - m_xmlfile.Write(">\n"); + m_xmlfile.Write(_T(">\n")); m_xmlfile.Write(GetPosition(res)); m_xmlfile.Write(GetSize(res)); m_xmlfile.Write(GetStyles(res)); @@ -172,9 +174,9 @@ wxString wxr2xml::GetSize(wxItemResource * res) { wxString msg; if (m_dlgunits) - msg << "\t\t\t\t" << res->GetWidth() << "," << res->GetHeight() << "d\n"; + msg << _T("\t\t\t\t") << res->GetWidth() << _T(",") << res->GetHeight() << _T("d\n"); else - msg << "\t\t\t\t" << res->GetWidth() << "," << res->GetHeight() << "\n"; + msg << _T("\t\t\t\t") << res->GetWidth() << _T(",") << res->GetHeight() << _T("\n"); return msg; } @@ -182,196 +184,196 @@ wxString wxr2xml::GetPosition(wxItemResource * res) { wxString msg; if (m_dlgunits) - msg << "\t\t\t\t" << res->GetX() << "," << res->GetY() << "d\n"; + msg << _T("\t\t\t\t") << res->GetX() << _T(",") << res->GetY() << _T("d\n"); else - msg << "\t\t\t\t" << res->GetX() << "," << res->GetY() << "\n"; + msg << _T("\t\t\t\t") << res->GetX() << _T(",") << res->GetY() << _T("\n"); return msg; } void wxr2xml::ParseButton(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } void wxr2xml::ParseTextCtrl(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } wxString wxr2xml::GetTitle(wxItemResource * res) { wxString msg; - msg = _T("\t\t\t\t" + res->GetTitle() + ""); + msg = _T("\t\t\t\t") + res->GetTitle() + _T(""); return msg; } wxString wxr2xml::GetValue4(wxItemResource * res) { wxString msg; - msg = _T("\t\t\t\t" + res->GetValue4() + "\n"); + msg = _T("\t\t\t\t") + res->GetValue4() + _T("\n"); return msg; } void wxr2xml::ParseCheckBox(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } wxString wxr2xml::GetLabel(wxItemResource * res) { - return _T("\t\t\t\t\n"); + return _T("\t\t\t\t\n"); } void wxr2xml::ParseRadioBox(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } void wxr2xml::ParseListBox(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } void wxr2xml::ParseStaticText(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } void wxr2xml::ParseStaticBox(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } void wxr2xml::WriteStringList(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\t\n")); for (wxStringListNode * node = res->GetStringValues().GetFirst(); node;node = node->GetNext()) { const wxString s1 = node->GetData(); - m_xmlfile.Write("\t\t\t\t\t" + s1 + "\n"); + m_xmlfile.Write(_T("\t\t\t\t\t") + s1 + _T("\n")); } - m_xmlfile.Write("\t\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\t\n")); } void wxr2xml::ParseChoice(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } void wxr2xml::ParseGauge(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\n\t\t\t\n")); } wxString wxr2xml::GetValue1(wxItemResource * res) { wxString msg; - msg << "\t\t\t\t" << res->GetValue1() << "\n"; + msg << _T("\t\t\t\t") << res->GetValue1() << _T("\n"); return msg; } wxString wxr2xml::GetRange(wxItemResource * res) { wxString msg; - msg << "\t\t\t\t" << res->GetValue2() << ""; + msg << _T("\t\t\t\t") << res->GetValue2() << _T(""); return msg; } void wxr2xml::ParseSlider(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\n\t\t\t\n")); } wxString wxr2xml::GetMax(wxItemResource * res) { wxString msg; - msg << "\t\t\t\t" << res->GetValue3() << "\n"; + msg << _T("\t\t\t\t") << res->GetValue3() << _T("\n"); return msg; } wxString wxr2xml::GetMin(wxItemResource * res) { wxString msg; - msg << "\t\t\t\t" << res->GetValue2() << ""; + msg << _T("\t\t\t\t") << res->GetValue2() << _T(""); return msg; } void wxr2xml::ParseComboBox(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\n\t\t\t\n")); } void wxr2xml::ParseRadioButton(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } void wxr2xml::ParseScrollBar(wxItemResource * res) { - m_xmlfile.Write("\t\t\t"+GetValue2(res)+"\n"); - m_xmlfile.Write("\t\t\t\t"+GetValue3(res)+"\n"); - m_xmlfile.Write("\t\t\t\t"+GetValue5(res)+"\n"); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\t")+GetValue2(res)+_T("\n")); + m_xmlfile.Write(_T("\t\t\t\t")+GetValue3(res)+_T("\n")); + m_xmlfile.Write(_T("\t\t\t\t")+GetValue5(res)+_T("\n")); + m_xmlfile.Write(_T("\t\t\t\n")); } wxString wxr2xml::GetCheckStatus(wxItemResource * res) { wxString msg; - msg << "\t\t\t\t" << res->GetValue1() << "\n"; + msg << _T("\t\t\t\t") << res->GetValue1() << _T("\n"); return msg; } @@ -383,158 +385,158 @@ wxString wxr2xml::GetStyles(wxItemResource * res) restype = res->GetType(); style = res->GetStyle(); - s = "\t\t\t\t\n"; + s += _T("\n"); return s; } wxString wxr2xml::GetDimension(wxItemResource * res) { wxString msg; - msg << "\t\t\t\t" << res->GetValue1() << "\n"; + msg << _T("\t\t\t\t") << res->GetValue1() << _T("\n"); return msg; } @@ -571,85 +573,85 @@ wxString wxr2xml::GenerateName(wxItemResource * res) name += res->GetName(); } - name += "\""; + name += _T("\""); return name; } void wxr2xml::ParseMenuBar(wxItemResource * res) { wxItemResource *child; - wxNode *node = res->GetChildren().First(); + wxNode *node = res->GetChildren().GetFirst(); // Get Menu Bar Name - m_xmlfile.Write("\t\n"); + m_xmlfile.Write(_T(">\n")); while (node) { - child = (wxItemResource *) node->Data(); + child = (wxItemResource *) node->GetData(); ParseMenu(child); - node = node->Next(); + node = node->GetNext(); } - m_xmlfile.Write("\t \n\n"); + m_xmlfile.Write(_T("\t \n\n")); } void wxr2xml::ParseMenu(wxItemResource * res) { wxItemResource *child; - wxNode *node = res->GetChildren().First(); + wxNode *node = res->GetChildren().GetFirst(); // Get Menu - m_xmlfile.Write("\t\t\tGetValue1() << "\""; + menuname << _T("name = \"menu_") << res->GetValue1() << _T("\""); m_xmlfile.Write(menuname); - m_xmlfile.Write(">\n"); - m_xmlfile.Write("\t\t\t\t\n"); - if (res->GetValue4() != "") - m_xmlfile.Write("\t\t\t\t" + res->GetValue4() + - "\n"); + m_xmlfile.Write(_T(">\n")); + m_xmlfile.Write(_T("\t\t\t\t\n")); + if (res->GetValue4() != _T("")) + m_xmlfile.Write(_T("\t\t\t\t") + res->GetValue4() + + _T("\n")); // Read in menu items and additional menus while (node) { - child = (wxItemResource *) node->Data(); - if (!child->GetChildren().First()) + child = (wxItemResource *) node->GetData(); + if (!child->GetChildren().GetFirst()) ParseMenuItem(child); else ParseMenu(child); - node = node->Next(); + node = node->GetNext(); } - m_xmlfile.Write("\t\t\t \n"); + m_xmlfile.Write(_T("\t\t\t \n")); } void wxr2xml::ParseMenuItem(wxItemResource * res) { // Get Menu Item or Separator - if (res->GetTitle() == "") { - m_xmlfile.Write("\t\t\t\n"); + if (res->GetTitle() == _T("")) { + m_xmlfile.Write(_T("\t\t\t\n")); } else { - m_xmlfile.Write("\t\t\t\tGetValue1() << "\""; + menuname << _T("name = \"menuitem_") << res->GetValue1() << _T("\""); m_xmlfile.Write(menuname); - m_xmlfile.Write(">\n"); - m_xmlfile.Write(" \n"); - if (res->GetValue4() != "") - m_xmlfile.Write(" " + - res->GetValue4() + "\n"); + m_xmlfile.Write(_T(">\n")); + m_xmlfile.Write(_T(" \n")); + if (res->GetValue4() != _T("")) + m_xmlfile.Write(_T(" ") + + res->GetValue4() + _T("\n")); if (res->GetValue2()) - m_xmlfile.Write("\t\t\t\t1\n"); - m_xmlfile.Write("\t\t\t \n"); + m_xmlfile.Write(_T("\t\t\t\t1\n")); + m_xmlfile.Write(_T("\t\t\t \n")); } } wxString wxr2xml::FixMenuString(wxString phrase) { - phrase.Replace("&", "$"); + phrase.Replace(_T("&"), _T("$")); return phrase; } void wxr2xml::ParseStaticBitmap(wxItemResource * res) { - m_xmlfile.Write("\t\t\t" + bitmapname + ""); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\n\t\t\t\t") + bitmapname + _T("")); + m_xmlfile.Write(_T("\t\t\t\n")); // bitmap5 } //Parse a bitmap resource void wxr2xml::ParseBitmap(wxItemResource * res) { - m_xmlfile.Write("\t"); + m_xmlfile.Write(_T("\t")); wxString bitmapname; bitmapname = res->GetName(); wxBitmap bitmap; @@ -674,7 +676,7 @@ void wxr2xml::ParseBitmap(wxItemResource * res) bitmapname += _T(".bmp"); bitmap.SaveFile(bitmapname, wxBITMAP_TYPE_BMP); m_xmlfile.Write(bitmapname); - m_xmlfile.Write("\n\n"); + m_xmlfile.Write(_T("\n\n")); } void wxr2xml::PanelStuff(wxItemResource * res) @@ -719,7 +721,7 @@ wxString wxr2xml::GetValue5(wxItemResource *res) void wxr2xml::ParseBitmapButton(wxItemResource *res) { - m_xmlfile.Write("\t\t\t" + bitmapname + "\n"); + m_xmlfile.Write(_T("\t\t\t\t") + bitmapname + _T("\n")); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } void wxr2xml::WriteFontInfo(wxItemResource *res) @@ -743,21 +745,21 @@ void wxr2xml::WriteFontInfo(wxItemResource *res) if (!font.GetRefData()) return; - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); //Get font point size,font family,weight,font style,underline int pt; wxString msg; pt=font.GetPointSize(); - msg<<"\t\t\t\t"<\n"; + msg<<_T("\t\t\t\t")<\n"); m_xmlfile.Write(msg); GetFontFace(font); GetFontStyle(font); GetFontWeight(font); if (font.GetUnderlined()) - m_xmlfile.Write("\t\t\t\t1\n"); + m_xmlfile.Write(_T("\t\t\t\t1\n")); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write(_T("\t\t\t\n")); } //WARNING possible make here @@ -771,22 +773,22 @@ void wxr2xml::GetFontFace(wxFont font) case wxDEFAULT: break; case wxDECORATIVE: - m_xmlfile.Write("\t\t\t\tdecorative\n"); + m_xmlfile.Write(_T("\t\t\t\tdecorative\n")); break; case wxROMAN: - m_xmlfile.Write("\t\t\t\troman\n"); + m_xmlfile.Write(_T("\t\t\t\troman\n")); break; case wxSCRIPT: - m_xmlfile.Write("\t\t\t\tscript\n"); + m_xmlfile.Write(_T("\t\t\t\tscript\n")); break; case wxSWISS: - m_xmlfile.Write("\t\t\t\tswiss\n"); + m_xmlfile.Write(_T("\t\t\t\tswiss\n")); break; case wxMODERN: - m_xmlfile.Write("\t\t\t\tmodern\n"); + m_xmlfile.Write(_T("\t\t\t\tmodern\n")); break; default: - wxLogError("Unknown font face"); + wxLogError(_T("Unknown font face")); } } @@ -801,13 +803,13 @@ void wxr2xml::GetFontStyle(wxFont font) case wxNORMAL: break; case wxITALIC: - m_xmlfile.Write("\n"); + m_xmlfile.Write(_T("\n")); break; case wxSLANT: - m_xmlfile.Write("\n"); + m_xmlfile.Write(_T("\n")); break; default: - wxLogError("Unknown font style"); + wxLogError(_T("Unknown font style")); } } @@ -821,12 +823,12 @@ void wxr2xml::GetFontWeight(wxFont font) case wxNORMAL: break; case wxLIGHT: - m_xmlfile.Write("\t\t\t\tlight\n"); + m_xmlfile.Write(_T("\t\t\t\tlight\n")); break; case wxBOLD: - m_xmlfile.Write("\t\t\t\tbold\n"); + m_xmlfile.Write(_T("\t\t\t\tbold\n")); break; default: - wxLogError("Unknown font weight"); + wxLogError(_T("Unknown font weight")); } } diff --git a/contrib/utils/wxrcedit/pe_adv.cpp b/contrib/utils/wxrcedit/pe_adv.cpp index 80abc878e5..4f7b59f398 100644 --- a/contrib/utils/wxrcedit/pe_adv.cpp +++ b/contrib/utils/wxrcedit/pe_adv.cpp @@ -256,9 +256,5 @@ void PropEditCtrlFile::OnDetails() wxString PropEditCtrlImageFile::GetFileTypes() { - return _("GIF files (*.gif)|*.gif|" - "JPEG files (*.jpg)|*.jpg|" - "PNG files (*.png)|*.png|" - "BMP files (*.bmp)|*.bmp|" - "All files (*)|*"); + return _("GIF files (*.gif)|*.gif|JPEG files (*.jpg)|*.jpg|PNG files (*.png)|*.png|BMP files (*.bmp)|*.bmp|All files (*)|*"); } diff --git a/contrib/utils/wxrcedit/preview.cpp b/contrib/utils/wxrcedit/preview.cpp index 29a11c77bd..0d84d45db5 100644 --- a/contrib/utils/wxrcedit/preview.cpp +++ b/contrib/utils/wxrcedit/preview.cpp @@ -134,8 +134,7 @@ void PreviewFrame::MakeDirty() if (m_Dirty) return; m_Dirty = TRUE; m_LogCtrl->Clear(); - m_LogCtrl->SetValue(_("Resource modified.\n" - "Move mouse cursor over the preview window to refresh it.")); + m_LogCtrl->SetValue(_("Resource modified.\nMove mouse cursor over the preview window to refresh it.")); } diff --git a/contrib/utils/wxrcedit/splittree.cpp b/contrib/utils/wxrcedit/splittree.cpp index 263d9df88b..57c241d954 100644 --- a/contrib/utils/wxrcedit/splittree.cpp +++ b/contrib/utils/wxrcedit/splittree.cpp @@ -444,13 +444,12 @@ void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) wxSize clientSize = GetClientSize(); wxRect itemRect; - int cy=0; wxTreeItemId h, lastH; for(h=m_treeCtrl->GetFirstVisibleItem();h;h=m_treeCtrl->GetNextVisible(h)) { if (m_treeCtrl->GetBoundingRect(h, itemRect)) { - cy = itemRect.GetTop(); + int cy = itemRect.GetTop(); wxRect drawItemRect(0, cy, clientSize.x, itemRect.GetHeight()); lastH = h; @@ -462,7 +461,7 @@ void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) } if (lastH.IsOk() && m_treeCtrl->GetBoundingRect(lastH, itemRect)) { - cy = itemRect.GetBottom(); + int cy = itemRect.GetBottom(); dc.DrawLine(0, cy, clientSize.x, cy); } } diff --git a/src/xrc/xh_sizer.cpp b/src/xrc/xh_sizer.cpp index 5022ffb8f4..db47dceec3 100644 --- a/src/xrc/xh_sizer.cpp +++ b/src/xrc/xh_sizer.cpp @@ -206,7 +206,6 @@ wxObject* wxSizerXmlHandler::Handle_sizer() // save state wxSizer *old_par = m_parentSizer; bool old_ins = m_isInside; - bool old_gbs = m_isGBS; // set new state m_parentSizer = sizer; @@ -216,7 +215,6 @@ wxObject* wxSizerXmlHandler::Handle_sizer() CreateChildren(m_parent, TRUE/*only this handler*/); // restore state - old_gbs = m_isGBS; m_isInside = old_ins; m_parentSizer = old_par; diff --git a/src/xrc/xh_wizrd.cpp b/src/xrc/xh_wizrd.cpp index db9e52cd10..e8cb354448 100644 --- a/src/xrc/xh_wizrd.cpp +++ b/src/xrc/xh_wizrd.cpp @@ -59,6 +59,8 @@ wxObject *wxWizardXmlHandler::DoCreateResource() else { wxWizardPage *page = NULL; + wxUnusedVar(page); + if (m_class == wxT("wxWizardPageSimple")) { XRC_MAKE_INSTANCE(p, wxWizardPageSimple) diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 7587547408..a50a9e70d9 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -324,6 +324,7 @@ bool wxXmlResource::UpdateResources() bool modif; # if wxUSE_FILESYSTEM wxFSFile *file = NULL; + wxUnusedVar(file); wxFileSystem fsys; # endif @@ -353,6 +354,7 @@ bool wxXmlResource::UpdateResources() rt = false; } wxDELETE(file); + wxUnusedVar(file); # else modif = wxDateTime(wxFileModificationTime(m_data[i].File)) > m_data[i].Time; # endif @@ -413,6 +415,7 @@ bool wxXmlResource::UpdateResources() # if wxUSE_FILESYSTEM wxDELETE(file); + wxUnusedVar(file); # else wxDELETE(stream); # endif @@ -1180,14 +1183,12 @@ static int XRCID_Lookup(const wxChar *str_id, int value_if_not_found = -2) index %= XRCID_TABLE_SIZE; XRCID_record *oldrec = NULL; - int matchcnt = 0; for (XRCID_record *rec = XRCID_Records[index]; rec; rec = rec->next) { if (wxStrcmp(rec->key, str_id) == 0) { return rec->id; } - matchcnt++; oldrec = rec; } -- 2.45.2