X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2193517f1b909b834dc6e314acc3b873dc8196d9..dfc6f510c5f5efdc1f072996ddf1ae0416a4a4ad:/contrib/utils/convertrc/convert.cpp?ds=sidebyside diff --git a/contrib/utils/convertrc/convert.cpp b/contrib/utils/convertrc/convert.cpp index c4871d112c..b0eb0e569c 100644 --- a/contrib/utils/convertrc/convert.cpp +++ b/contrib/utils/convertrc/convert.cpp @@ -6,25 +6,26 @@ */ #ifdef __GNUG__ -#pragma implementation "convert.cpp" -#pragma interface "convert.cpp" +#pragma implementation "convert.h" #endif // For compilers that support precompilation, includes "wx/wx.h". -#include +#include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif // 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 #include #endif #include -#include "wx/resource.h" + +#include "wx/deprecated/setup.h" +#include "wx/deprecated/resource.h" #include "convert.h" #include "rc2wxr.h" @@ -53,20 +54,20 @@ bool wxConvertApp::OnInit() { //Initialize all image loaders(JPEG,BMP,PNG,and etc) wxInitAllImageHandlers(); - SetAppName("wxConvertApp"); + SetAppName(_T("wxConvertApp")); if (HandleCommandLine()) - return TRUE; + 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, wxID_ANY, _T("wxConvertApp"), wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL); - + InitMenu(); - m_pFrame->Show(TRUE); + m_pFrame->Show(true); SetTopWindow(m_pFrame); - return TRUE; + return true; } void wxConvertApp::InitMenu() @@ -75,12 +76,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); } @@ -104,12 +105,12 @@ END_EVENT_TABLE() // Construction/Destruction ////////////////////////////////////////////////////////////////////// -wxMainFrame::wxMainFrame(wxWindow* parent,wxWindowID id, +wxMainFrame::wxMainFrame(wxWindow* parent,wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name) :wxFrame(parent,id,title,pos,size,style,name) { - + } wxMainFrame::~wxMainFrame() @@ -118,25 +119,25 @@ wxMainFrame::~wxMainFrame() -void wxMainFrame::OnQuit() +void wxMainFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - Close(TRUE); + 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; @@ -145,38 +146,38 @@ 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; wxr2xml XMLCon; XMLCon.Convert(f.GetPath(),xmlfile.GetPath()); - + } -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; @@ -189,34 +190,35 @@ void wxMainFrame::OnRC2XML() bool wxConvertApp::HandleCommandLine() { - if (argc != 2) - return FALSE; + if (argc != 2) + return false; //Figure out kind of conversion wxString source,target; + wxr2xml trans_wxr2xml; rc2xml trans_rc2xml; rc2wxr trans_rc2wxr; source=argv[1]; 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; + return true; } - else if ((source.Find(".rc")!=-1)&(target.Find(".wxr")!=-1)) + else if ((source.Find(_T(".rc"))!=wxNOT_FOUND)&(target.Find(_T(".wxr"))!=wxNOT_FOUND)) { trans_rc2wxr.Convert(source,target); - return TRUE; + return true; } - else if ((source.Find(".rc")!=-1)&(target.Find(".xml")!=-1)) + else if ((source.Find(_T(".rc"))!=wxNOT_FOUND)&(target.Find(_T(".xml"))!=wxNOT_FOUND)) { trans_rc2xml.Convert(source,target); - return TRUE; + return true; } - - return FALSE; + + return false; }