From 859e5b177d4bc319089c23015b9a55b3e9746a69 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 18 Sep 2003 13:47:05 +0000 Subject: [PATCH 1/1] Applied patch [ 807366 ] fixes for wxrcedit contrib util git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23671 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/utils/wxrcedit/edapp.cpp | 2 +- contrib/utils/wxrcedit/editor.cpp | 42 ++++++++++++++-------------- contrib/utils/wxrcedit/nodehnd.cpp | 6 ++-- contrib/utils/wxrcedit/nodesdb.cpp | 2 +- contrib/utils/wxrcedit/pe_adv.cpp | 2 +- contrib/utils/wxrcedit/pe_basic.cpp | 10 +++---- contrib/utils/wxrcedit/preview.cpp | 4 +-- contrib/utils/wxrcedit/propedit.cpp | 4 +-- contrib/utils/wxrcedit/splittree.cpp | 38 ++++++++++++++++--------- contrib/utils/wxrcedit/wxrcedit.rc | 26 ++++++++--------- 10 files changed, 74 insertions(+), 62 deletions(-) diff --git a/contrib/utils/wxrcedit/edapp.cpp b/contrib/utils/wxrcedit/edapp.cpp index 9c3602ffaa..ffce6a4fe5 100644 --- a/contrib/utils/wxrcedit/edapp.cpp +++ b/contrib/utils/wxrcedit/edapp.cpp @@ -49,7 +49,7 @@ bool MyApp::OnInit() { SetVendorName(wxT("wxWindows")); SetAppName(wxT("wxrcedit")); - wxString arg = (argc >= 1) ? argv[1] : ""; + wxString arg = (argc >= 1) ? argv[1] : _T(""); wxInitAllImageHandlers(); wxFrame *frame = new EditorFrame(NULL, arg); SetTopWindow(frame); diff --git a/contrib/utils/wxrcedit/editor.cpp b/contrib/utils/wxrcedit/editor.cpp index a77da8d858..7afb2b2377 100644 --- a/contrib/utils/wxrcedit/editor.cpp +++ b/contrib/utils/wxrcedit/editor.cpp @@ -192,35 +192,35 @@ EditorFrame::EditorFrame(wxFrame *parent, const wxString& filename) wxConfigBase *cfg = wxConfigBase::Get(); - SetSize(wxRect(wxPoint(cfg->Read("editor_x", -1), cfg->Read("editor_y", -1)), - wxSize(cfg->Read("editor_w", 400), cfg->Read("editor_h", 400)))); + SetSize(wxRect(wxPoint(cfg->Read(_T("editor_x"), -1), cfg->Read(_T("editor_y"), -1)), + wxSize(cfg->Read(_T("editor_w"), 400), cfg->Read(_T("editor_h"), 400)))); m_SelectedNode = NULL; m_Resource = NULL; m_FileName = wxEmptyString; wxMenu *menuFile = new wxMenu; - menuFile->Append(ID_NEW, "&New"); - menuFile->Append(ID_OPEN, "&Open\tCtrl-O"); - menuFile->Append(ID_SAVE, "&Save\tCtrl-S"); - menuFile->Append(ID_SAVEAS, "Save &as..."); + menuFile->Append(ID_NEW, _T("&New")); + menuFile->Append(ID_OPEN, _T("&Open\tCtrl-O")); + menuFile->Append(ID_SAVE, _T("&Save\tCtrl-S")); + menuFile->Append(ID_SAVEAS, _T("Save &as...")); menuFile->AppendSeparator(); - menuFile->Append(ID_EXIT, "E&xit\tAlt-X"); + menuFile->Append(ID_EXIT, _T("E&xit\tAlt-X")); wxMenu *menuEdit = new wxMenu; - menuEdit->Append(ID_CUT, "Cut\tCtrl-X"); - menuEdit->Append(ID_COPY, "Copy\tCtrl-C"); - menuEdit->Append(ID_PASTE_SYBLING, "Paste as sybling\tCtrl-V"); - menuEdit->Append(ID_PASTE_CHILD, "Paste as child"); + menuEdit->Append(ID_CUT, _T("Cut\tCtrl-X")); + menuEdit->Append(ID_COPY, _T("Copy\tCtrl-C")); + menuEdit->Append(ID_PASTE_SYBLING, _T("Paste as sybling\tCtrl-V")); + menuEdit->Append(ID_PASTE_CHILD, _T("Paste as child")); menuEdit->AppendSeparator(); - menuEdit->Append(ID_DELETE_NODE, "Delete"); + menuEdit->Append(ID_DELETE_NODE, _T("Delete")); menuEdit->Enable(ID_PASTE_SYBLING, FALSE); menuEdit->Enable(ID_PASTE_CHILD, FALSE); wxMenuBar *menuBar = new wxMenuBar(); - menuBar->Append(menuFile, "&File"); - menuBar->Append(menuEdit, "&Edit"); + menuBar->Append(menuFile, _T("&File")); + menuBar->Append(menuEdit, _T("&Edit")); SetMenuBar(menuBar); // Create toolbar: @@ -294,7 +294,7 @@ void EditorFrame::LoadFile(const wxString& filename) // create new resource in order to handle version differences properly PreviewFrame::Get()->ResetResource(); - m_FileName = ""; + m_FileName = wxEmptyString; m_Resource = new wxXmlRcEditDocument; m_Modified = FALSE; @@ -303,7 +303,7 @@ void EditorFrame::LoadFile(const wxString& filename) delete m_Resource; m_Resource = NULL; NewFile(); - wxLogError("Error parsing " + filename); + wxLogError(_T("Error parsing ") + filename); } else { @@ -339,11 +339,11 @@ void EditorFrame::NewFile() delete m_Resource; - m_FileName = ""; + m_FileName = wxEmptyString; m_Resource = new wxXmlRcEditDocument; m_Resource->SetRoot(new wxXmlNode(wxXML_ELEMENT_NODE, _("resource"))); - m_Resource->SetFileEncoding("utf-8"); + m_Resource->SetFileEncoding(_T("utf-8")); #if !wxUSE_UNICODE m_Resource->SetEncoding(wxLocale::GetSystemEncodingName()); #endif @@ -363,7 +363,7 @@ void EditorFrame::RefreshTitle() wxString s; if (m_Modified) s << _T("* "); s << _("wxrcedit"); - if (m_FileName != "") + if (m_FileName != wxEmptyString) s << _T(" - ") << wxFileNameFromPath(m_FileName); SetTitle(s); } @@ -376,7 +376,7 @@ void EditorFrame::RefreshTree() m_TreeCtrl->DeleteAllItems(); - wxTreeItemId root = m_TreeCtrl->AddRoot("Resource: " + wxFileNameFromPath(m_FileName), 5, 5); + wxTreeItemId root = m_TreeCtrl->AddRoot(_T("Resource: ") + wxFileNameFromPath(m_FileName), 5, 5); wxXmlNode *n = m_Resource->GetRoot()->GetChildren(); while (n) @@ -541,7 +541,7 @@ void EditorFrame::OnToolbar(wxCommandEvent& event) } case ID_SAVE : - if (m_FileName != "") { SaveFile(m_FileName); break;} + if (m_FileName != wxEmptyString) { SaveFile(m_FileName); break;} // else go to SAVEAS case ID_SAVEAS : diff --git a/contrib/utils/wxrcedit/nodehnd.cpp b/contrib/utils/wxrcedit/nodehnd.cpp index e8a9abc39b..ff5c07cd66 100644 --- a/contrib/utils/wxrcedit/nodehnd.cpp +++ b/contrib/utils/wxrcedit/nodehnd.cpp @@ -100,7 +100,7 @@ bool NodeHandler::CanHandle(wxXmlNode *node) -PropertyInfoArray& NodeHandler::GetPropsList(wxXmlNode *node) +PropertyInfoArray& NodeHandler::GetPropsList(wxXmlNode *WXUNUSED(node)) { return m_NodeInfo->Props; } @@ -159,7 +159,7 @@ wxArrayString& NodeHandler::GetChildTypes() -void NodeHandler::InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before) +void NodeHandler::InsertNode(wxXmlNode *WXUNUSED(parent), wxXmlNode *node, wxXmlNode *WXUNUSED(insert_before)) { delete node; wxLogError(_("Cannot insert child into this type of node!")); @@ -178,7 +178,7 @@ wxTreeItemId NodeHandlerPanel::CreateTreeNode(wxTreeCtrl *treectrl, { wxTreeItemId root = NodeHandler::CreateTreeNode(treectrl, parent, node); - wxXmlNode *n = XmlFindNode(node, "object"); + wxXmlNode *n = XmlFindNode(node, _T("object")); while (n) { diff --git a/contrib/utils/wxrcedit/nodesdb.cpp b/contrib/utils/wxrcedit/nodesdb.cpp index 53a9a9595c..1fe48b08af 100644 --- a/contrib/utils/wxrcedit/nodesdb.cpp +++ b/contrib/utils/wxrcedit/nodesdb.cpp @@ -159,7 +159,7 @@ void NodesDb::LoadDir(const wxString& path) wxString filename; bool cont; - cont = dir.GetFirst(&filename, "*.df"); + cont = dir.GetFirst(&filename, _T("*.df")); while (cont) { LoadFile(filename); diff --git a/contrib/utils/wxrcedit/pe_adv.cpp b/contrib/utils/wxrcedit/pe_adv.cpp index 88b447b8d0..80abc878e5 100644 --- a/contrib/utils/wxrcedit/pe_adv.cpp +++ b/contrib/utils/wxrcedit/pe_adv.cpp @@ -94,7 +94,7 @@ void PropEditCtrlChoice::WriteValue() -void PropEditCtrlChoice::OnChoice(wxCommandEvent& event) +void PropEditCtrlChoice::OnChoice(wxCommandEvent& WXUNUSED(event)) { if (CanSave()) { diff --git a/contrib/utils/wxrcedit/pe_basic.cpp b/contrib/utils/wxrcedit/pe_basic.cpp index b55b81f9eb..ab467eb453 100644 --- a/contrib/utils/wxrcedit/pe_basic.cpp +++ b/contrib/utils/wxrcedit/pe_basic.cpp @@ -39,7 +39,7 @@ wxWindow *PropEditCtrlTxt::CreateEditCtrl() -void PropEditCtrlTxt::OnText(wxCommandEvent& event) +void PropEditCtrlTxt::OnText(wxCommandEvent& WXUNUSED(event)) { if (CanSave()) { @@ -126,7 +126,7 @@ wxString PropEditCtrlBool::GetValueAsText(wxTreeItemId ti) -void PropEditCtrlBool::OnChoice(wxCommandEvent& event) +void PropEditCtrlBool::OnChoice(wxCommandEvent& WXUNUSED(event)) { if (CanSave()) { @@ -398,7 +398,7 @@ void PropEditCtrlXRCID::Clear() void PropEditCtrlXRCID::OnDetails() { wxString choices[] = {wxString(_T("-1")) - #define stdID(id) , wxString(#id) + #define stdID(id) , wxString(_T(#id)) stdID(wxID_OK) stdID(wxID_CANCEL) stdID(wxID_YES) stdID(wxID_NO) stdID(wxID_APPLY) stdID(wxID_HELP) @@ -430,14 +430,14 @@ void PropEditCtrlXRCID::OnDetails() -wxString PropEditCtrlXRCID::GetValueAsText(wxTreeItemId ti) +wxString PropEditCtrlXRCID::GetValueAsText(wxTreeItemId WXUNUSED(ti)) { return REAL_NODE->GetPropVal(_T("name"), wxEmptyString); } -bool PropEditCtrlXRCID::IsPresent(const PropertyInfo& pinfo) +bool PropEditCtrlXRCID::IsPresent(const PropertyInfo& WXUNUSED(pinfo)) { return REAL_NODE->HasProp(_T("name")); } diff --git a/contrib/utils/wxrcedit/preview.cpp b/contrib/utils/wxrcedit/preview.cpp index 22d9ceeaab..29a11c77bd 100644 --- a/contrib/utils/wxrcedit/preview.cpp +++ b/contrib/utils/wxrcedit/preview.cpp @@ -202,7 +202,7 @@ void PreviewFrame::Preview(wxXmlNode *node, wxXmlDocument *orig_doc) void PreviewFrame::PreviewMenu() { - wxMenuBar *mbar; + wxMenuBar *mbar = NULL; if (XmlGetClass(m_Node) == _T("wxMenuBar")) mbar = m_RC->LoadMenuBar(m_Node->GetPropVal(_T("name"), _T("-1"))); @@ -274,7 +274,7 @@ BEGIN_EVENT_TABLE(PreviewFrame, wxFrame) EVT_ENTER_WINDOW(PreviewFrame::OnMouseEnter) END_EVENT_TABLE() -void PreviewFrame::OnMouseEnter(wxMouseEvent& event) +void PreviewFrame::OnMouseEnter(wxMouseEvent& WXUNUSED(event)) { if (m_Dirty) Preview(m_Node,m_Doc); } diff --git a/contrib/utils/wxrcedit/propedit.cpp b/contrib/utils/wxrcedit/propedit.cpp index a2021b83d0..288dd3ee6c 100644 --- a/contrib/utils/wxrcedit/propedit.cpp +++ b/contrib/utils/wxrcedit/propedit.cpp @@ -37,12 +37,12 @@ BEGIN_EVENT_TABLE(PropEditCtrl, wxPanel) EVT_BUTTON(ID_DETAILS, PropEditCtrl::OnButtonDetails) END_EVENT_TABLE() -void PropEditCtrl::OnButtonDetails(wxCommandEvent& event) +void PropEditCtrl::OnButtonDetails(wxCommandEvent& WXUNUSED(event)) { OnDetails(); } -void PropEditCtrl::OnButtonClear(wxCommandEvent& event) +void PropEditCtrl::OnButtonClear(wxCommandEvent& WXUNUSED(event)) { Clear(); EditorFrame::Get()->NotifyChanged(CHANGED_PROPS); diff --git a/contrib/utils/wxrcedit/splittree.cpp b/contrib/utils/wxrcedit/splittree.cpp index 5955bc135f..263d9df88b 100644 --- a/contrib/utils/wxrcedit/splittree.cpp +++ b/contrib/utils/wxrcedit/splittree.cpp @@ -92,12 +92,12 @@ void wxRemotelyScrolledTreeCtrl::HideVScrollbar() // Number of pixels per user unit (0 or -1 for no scrollbar) // Length of virtual canvas in user units // Length of page in user units +#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, int noUnitsX, int noUnitsY, int xPos, int yPos, bool noRefresh) { -#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; @@ -109,15 +109,21 @@ void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPer scrolledWindow->SetScrollbars(0, pixelsPerUnitY, 0, noUnitsY, 0, yPos, noRefresh); } } +#else +void wxRemotelyScrolledTreeCtrl::SetScrollbars(int WXUNUSED(pixelsPerUnitX), int WXUNUSED(pixelsPerUnitY), + int WXUNUSED(noUnitsX), int WXUNUSED(noUnitsY), + int WXUNUSED(xPos), int WXUNUSED(yPos), + bool WXUNUSED(noRefresh)) +{ #endif } // In case we're using the generic tree control. +#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) int wxRemotelyScrolledTreeCtrl::GetScrollPos(int orient) const { wxScrolledWindow* scrolledWindow = GetScrolledWindow(); -#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; @@ -129,6 +135,9 @@ int wxRemotelyScrolledTreeCtrl::GetScrollPos(int orient) const return scrolledWindow->GetScrollPos(orient); } } +#else +int wxRemotelyScrolledTreeCtrl::GetScrollPos(int WXUNUSED(orient)) const +{ #endif return 0; } @@ -164,9 +173,9 @@ void wxRemotelyScrolledTreeCtrl::GetViewStart(int *x, int *y) const } // In case we're using the generic tree control. +#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc) { -#if USE_GENERIC_TREECTRL || !defined(__WXMSW__) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) { wxScrolledWindow* scrolledWindow = GetScrolledWindow(); @@ -183,12 +192,15 @@ void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc) dc.SetDeviceOrigin( -startX * xppu1, -startY * yppu2 ); // dc.SetUserScale( win->GetScaleX(), win->GetScaleY() ); } +#else +void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& WXUNUSED(dc)) +{ #endif } // Scroll to the given line (in scroll units where each unit is // the height of an item) -void wxRemotelyScrolledTreeCtrl::ScrollToLine(int posHoriz, int posVert) +void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVert) { #ifdef __WXMSW__ #if USE_GENERIC_TREECTRL @@ -417,7 +429,7 @@ void wxTreeCompanionWindow::DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& re #endif } -void wxTreeCompanionWindow::OnPaint(wxPaintEvent& event) +void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); @@ -470,7 +482,7 @@ void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event) Refresh(TRUE); } -void wxTreeCompanionWindow::OnExpand(wxTreeEvent& event) +void wxTreeCompanionWindow::OnExpand(wxTreeEvent& WXUNUSED(event)) { // TODO: something more optimized than simply refresh the whole // window when the tree is expanded/collapsed. Tricky. @@ -509,7 +521,7 @@ void wxThinSplitterWindow::SizeWindows() } // Tests for x, y over sash -bool wxThinSplitterWindow::SashHitTest(int x, int y, int tolerance) +bool wxThinSplitterWindow::SashHitTest(int x, int y, int WXUNUSED(tolerance)) { return wxSplitterWindow::SashHitTest(x, y, 4); } @@ -581,12 +593,12 @@ wxSplitterScrolledWindow::wxSplitterScrolledWindow(wxWindow* parent, wxWindowID { } -void wxSplitterScrolledWindow::OnSize(wxSizeEvent& event) +void wxSplitterScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event)) { wxSize sz = GetClientSize(); - if (GetChildren().First()) + if (GetChildren().GetFirst()) { - ((wxWindow*) GetChildren().First()->Data())->SetSize(0, 0, sz.x, sz.y); + ((wxWindow*) GetChildren().GetFirst()->GetData())->SetSize(0, 0, sz.x, sz.y); } } @@ -637,10 +649,10 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event) } // Find targets in splitter window and send the event to them - wxNode* node = GetChildren().First(); + wxNode* node = (wxNode *)GetChildren().GetFirst(); while (node) { - wxWindow* child = (wxWindow*) node->Data(); + wxWindow* child = (wxWindow*) node->GetData(); if (child->IsKindOf(CLASSINFO(wxSplitterWindow))) { wxSplitterWindow* splitter = (wxSplitterWindow*) child; @@ -650,7 +662,7 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event) splitter->GetWindow2()->ProcessEvent(event); break; } - node = node->Next(); + node = node->GetNext(); } #ifdef __WXMAC__ diff --git a/contrib/utils/wxrcedit/wxrcedit.rc b/contrib/utils/wxrcedit/wxrcedit.rc index cf5a5202c0..f61f0e5885 100644 --- a/contrib/utils/wxrcedit/wxrcedit.rc +++ b/contrib/utils/wxrcedit/wxrcedit.rc @@ -1,17 +1,17 @@ #include "wx/msw/wx.rc" -aaa ICON mondrian.ico +aaa ICON "mondrian.ico" -close BITMAP bitmaps/close.bmp -open BITMAP bitmaps/open.bmp -preview BITMAP bitmaps/preview.bmp -save BITMAP bitmaps/save.bmp +close BITMAP "bitmaps/close.bmp" +open BITMAP "bitmaps/open.bmp" +preview BITMAP "bitmaps/preview.bmp" +save BITMAP "bitmaps/save.bmp" -control ICON bitmaps/control.ico -hsizer ICON bitmaps/hsizer.ico -vsizer ICON bitmaps/vsizer.ico -panel ICON bitmaps/panel.ico -unused ICON bitmaps/unused.ico -used ICON bitmaps/used.ico -resicon ICON bitmaps/resicon.ico -gsizer ICON bitmaps/gsizer.ico +control ICON "bitmaps/control.ico" +hsizer ICON "bitmaps/hsizer.ico" +vsizer ICON "bitmaps/vsizer.ico" +panel ICON "bitmaps/panel.ico" +unused ICON "bitmaps/unused.ico" +used ICON "bitmaps/used.ico" +resicon ICON "bitmaps/resicon.ico" +gsizer ICON "bitmaps/gsizer.ico" -- 2.45.2