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
This commit is contained in:
Julian Smart
2003-09-18 13:47:05 +00:00
parent 66b9ec3dab
commit 859e5b177d
10 changed files with 74 additions and 62 deletions

View File

@@ -49,7 +49,7 @@ bool MyApp::OnInit()
{ {
SetVendorName(wxT("wxWindows")); SetVendorName(wxT("wxWindows"));
SetAppName(wxT("wxrcedit")); SetAppName(wxT("wxrcedit"));
wxString arg = (argc >= 1) ? argv[1] : ""; wxString arg = (argc >= 1) ? argv[1] : _T("");
wxInitAllImageHandlers(); wxInitAllImageHandlers();
wxFrame *frame = new EditorFrame(NULL, arg); wxFrame *frame = new EditorFrame(NULL, arg);
SetTopWindow(frame); SetTopWindow(frame);

View File

@@ -192,35 +192,35 @@ EditorFrame::EditorFrame(wxFrame *parent, const wxString& filename)
wxConfigBase *cfg = wxConfigBase::Get(); wxConfigBase *cfg = wxConfigBase::Get();
SetSize(wxRect(wxPoint(cfg->Read("editor_x", -1), cfg->Read("editor_y", -1)), SetSize(wxRect(wxPoint(cfg->Read(_T("editor_x"), -1), cfg->Read(_T("editor_y"), -1)),
wxSize(cfg->Read("editor_w", 400), cfg->Read("editor_h", 400)))); wxSize(cfg->Read(_T("editor_w"), 400), cfg->Read(_T("editor_h"), 400))));
m_SelectedNode = NULL; m_SelectedNode = NULL;
m_Resource = NULL; m_Resource = NULL;
m_FileName = wxEmptyString; m_FileName = wxEmptyString;
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(ID_NEW, "&New"); menuFile->Append(ID_NEW, _T("&New"));
menuFile->Append(ID_OPEN, "&Open\tCtrl-O"); menuFile->Append(ID_OPEN, _T("&Open\tCtrl-O"));
menuFile->Append(ID_SAVE, "&Save\tCtrl-S"); menuFile->Append(ID_SAVE, _T("&Save\tCtrl-S"));
menuFile->Append(ID_SAVEAS, "Save &as..."); menuFile->Append(ID_SAVEAS, _T("Save &as..."));
menuFile->AppendSeparator(); menuFile->AppendSeparator();
menuFile->Append(ID_EXIT, "E&xit\tAlt-X"); menuFile->Append(ID_EXIT, _T("E&xit\tAlt-X"));
wxMenu *menuEdit = new wxMenu; wxMenu *menuEdit = new wxMenu;
menuEdit->Append(ID_CUT, "Cut\tCtrl-X"); menuEdit->Append(ID_CUT, _T("Cut\tCtrl-X"));
menuEdit->Append(ID_COPY, "Copy\tCtrl-C"); menuEdit->Append(ID_COPY, _T("Copy\tCtrl-C"));
menuEdit->Append(ID_PASTE_SYBLING, "Paste as sybling\tCtrl-V"); menuEdit->Append(ID_PASTE_SYBLING, _T("Paste as sybling\tCtrl-V"));
menuEdit->Append(ID_PASTE_CHILD, "Paste as child"); menuEdit->Append(ID_PASTE_CHILD, _T("Paste as child"));
menuEdit->AppendSeparator(); 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_SYBLING, FALSE);
menuEdit->Enable(ID_PASTE_CHILD, FALSE); menuEdit->Enable(ID_PASTE_CHILD, FALSE);
wxMenuBar *menuBar = new wxMenuBar(); wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(menuFile, "&File"); menuBar->Append(menuFile, _T("&File"));
menuBar->Append(menuEdit, "&Edit"); menuBar->Append(menuEdit, _T("&Edit"));
SetMenuBar(menuBar); SetMenuBar(menuBar);
// Create toolbar: // Create toolbar:
@@ -294,7 +294,7 @@ void EditorFrame::LoadFile(const wxString& filename)
// create new resource in order to handle version differences properly // create new resource in order to handle version differences properly
PreviewFrame::Get()->ResetResource(); PreviewFrame::Get()->ResetResource();
m_FileName = ""; m_FileName = wxEmptyString;
m_Resource = new wxXmlRcEditDocument; m_Resource = new wxXmlRcEditDocument;
m_Modified = FALSE; m_Modified = FALSE;
@@ -303,7 +303,7 @@ void EditorFrame::LoadFile(const wxString& filename)
delete m_Resource; delete m_Resource;
m_Resource = NULL; m_Resource = NULL;
NewFile(); NewFile();
wxLogError("Error parsing " + filename); wxLogError(_T("Error parsing ") + filename);
} }
else else
{ {
@@ -339,11 +339,11 @@ void EditorFrame::NewFile()
delete m_Resource; delete m_Resource;
m_FileName = ""; m_FileName = wxEmptyString;
m_Resource = new wxXmlRcEditDocument; m_Resource = new wxXmlRcEditDocument;
m_Resource->SetRoot(new wxXmlNode(wxXML_ELEMENT_NODE, _("resource"))); m_Resource->SetRoot(new wxXmlNode(wxXML_ELEMENT_NODE, _("resource")));
m_Resource->SetFileEncoding("utf-8"); m_Resource->SetFileEncoding(_T("utf-8"));
#if !wxUSE_UNICODE #if !wxUSE_UNICODE
m_Resource->SetEncoding(wxLocale::GetSystemEncodingName()); m_Resource->SetEncoding(wxLocale::GetSystemEncodingName());
#endif #endif
@@ -363,7 +363,7 @@ void EditorFrame::RefreshTitle()
wxString s; wxString s;
if (m_Modified) s << _T("* "); if (m_Modified) s << _T("* ");
s << _("wxrcedit"); s << _("wxrcedit");
if (m_FileName != "") if (m_FileName != wxEmptyString)
s << _T(" - ") << wxFileNameFromPath(m_FileName); s << _T(" - ") << wxFileNameFromPath(m_FileName);
SetTitle(s); SetTitle(s);
} }
@@ -376,7 +376,7 @@ void EditorFrame::RefreshTree()
m_TreeCtrl->DeleteAllItems(); 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(); wxXmlNode *n = m_Resource->GetRoot()->GetChildren();
while (n) while (n)
@@ -541,7 +541,7 @@ void EditorFrame::OnToolbar(wxCommandEvent& event)
} }
case ID_SAVE : case ID_SAVE :
if (m_FileName != "") { SaveFile(m_FileName); break;} if (m_FileName != wxEmptyString) { SaveFile(m_FileName); break;}
// else go to SAVEAS // else go to SAVEAS
case ID_SAVEAS : case ID_SAVEAS :

View File

@@ -100,7 +100,7 @@ bool NodeHandler::CanHandle(wxXmlNode *node)
PropertyInfoArray& NodeHandler::GetPropsList(wxXmlNode *node) PropertyInfoArray& NodeHandler::GetPropsList(wxXmlNode *WXUNUSED(node))
{ {
return m_NodeInfo->Props; 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; delete node;
wxLogError(_("Cannot insert child into this type of 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); wxTreeItemId root = NodeHandler::CreateTreeNode(treectrl, parent, node);
wxXmlNode *n = XmlFindNode(node, "object"); wxXmlNode *n = XmlFindNode(node, _T("object"));
while (n) while (n)
{ {

View File

@@ -159,7 +159,7 @@ void NodesDb::LoadDir(const wxString& path)
wxString filename; wxString filename;
bool cont; bool cont;
cont = dir.GetFirst(&filename, "*.df"); cont = dir.GetFirst(&filename, _T("*.df"));
while (cont) while (cont)
{ {
LoadFile(filename); LoadFile(filename);

View File

@@ -94,7 +94,7 @@ void PropEditCtrlChoice::WriteValue()
void PropEditCtrlChoice::OnChoice(wxCommandEvent& event) void PropEditCtrlChoice::OnChoice(wxCommandEvent& WXUNUSED(event))
{ {
if (CanSave()) if (CanSave())
{ {

View File

@@ -39,7 +39,7 @@ wxWindow *PropEditCtrlTxt::CreateEditCtrl()
void PropEditCtrlTxt::OnText(wxCommandEvent& event) void PropEditCtrlTxt::OnText(wxCommandEvent& WXUNUSED(event))
{ {
if (CanSave()) if (CanSave())
{ {
@@ -126,7 +126,7 @@ wxString PropEditCtrlBool::GetValueAsText(wxTreeItemId ti)
void PropEditCtrlBool::OnChoice(wxCommandEvent& event) void PropEditCtrlBool::OnChoice(wxCommandEvent& WXUNUSED(event))
{ {
if (CanSave()) if (CanSave())
{ {
@@ -398,7 +398,7 @@ void PropEditCtrlXRCID::Clear()
void PropEditCtrlXRCID::OnDetails() void PropEditCtrlXRCID::OnDetails()
{ {
wxString choices[] = {wxString(_T("-1")) wxString choices[] = {wxString(_T("-1"))
#define stdID(id) , wxString(#id) #define stdID(id) , wxString(_T(#id))
stdID(wxID_OK) stdID(wxID_CANCEL) stdID(wxID_OK) stdID(wxID_CANCEL)
stdID(wxID_YES) stdID(wxID_NO) stdID(wxID_YES) stdID(wxID_NO)
stdID(wxID_APPLY) stdID(wxID_HELP) 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); 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")); return REAL_NODE->HasProp(_T("name"));
} }

View File

@@ -202,7 +202,7 @@ void PreviewFrame::Preview(wxXmlNode *node, wxXmlDocument *orig_doc)
void PreviewFrame::PreviewMenu() void PreviewFrame::PreviewMenu()
{ {
wxMenuBar *mbar; wxMenuBar *mbar = NULL;
if (XmlGetClass(m_Node) == _T("wxMenuBar")) if (XmlGetClass(m_Node) == _T("wxMenuBar"))
mbar = m_RC->LoadMenuBar(m_Node->GetPropVal(_T("name"), _T("-1"))); 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) EVT_ENTER_WINDOW(PreviewFrame::OnMouseEnter)
END_EVENT_TABLE() END_EVENT_TABLE()
void PreviewFrame::OnMouseEnter(wxMouseEvent& event) void PreviewFrame::OnMouseEnter(wxMouseEvent& WXUNUSED(event))
{ {
if (m_Dirty) Preview(m_Node,m_Doc); if (m_Dirty) Preview(m_Node,m_Doc);
} }

View File

@@ -37,12 +37,12 @@ BEGIN_EVENT_TABLE(PropEditCtrl, wxPanel)
EVT_BUTTON(ID_DETAILS, PropEditCtrl::OnButtonDetails) EVT_BUTTON(ID_DETAILS, PropEditCtrl::OnButtonDetails)
END_EVENT_TABLE() END_EVENT_TABLE()
void PropEditCtrl::OnButtonDetails(wxCommandEvent& event) void PropEditCtrl::OnButtonDetails(wxCommandEvent& WXUNUSED(event))
{ {
OnDetails(); OnDetails();
} }
void PropEditCtrl::OnButtonClear(wxCommandEvent& event) void PropEditCtrl::OnButtonClear(wxCommandEvent& WXUNUSED(event))
{ {
Clear(); Clear();
EditorFrame::Get()->NotifyChanged(CHANGED_PROPS); EditorFrame::Get()->NotifyChanged(CHANGED_PROPS);

View File

@@ -92,12 +92,12 @@ void wxRemotelyScrolledTreeCtrl::HideVScrollbar()
// Number of pixels per user unit (0 or -1 for no scrollbar) // Number of pixels per user unit (0 or -1 for no scrollbar)
// Length of virtual canvas in user units // Length of virtual canvas in user units
// Length of page in user units // Length of page in user units
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
int noUnitsX, int noUnitsY, int noUnitsX, int noUnitsY,
int xPos, int yPos, int xPos, int yPos,
bool noRefresh) bool noRefresh)
{ {
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
{ {
wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
@@ -109,15 +109,21 @@ void wxRemotelyScrolledTreeCtrl::SetScrollbars(int pixelsPerUnitX, int pixelsPer
scrolledWindow->SetScrollbars(0, pixelsPerUnitY, 0, noUnitsY, 0, yPos, noRefresh); 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 #endif
} }
// In case we're using the generic tree control. // In case we're using the generic tree control.
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
int wxRemotelyScrolledTreeCtrl::GetScrollPos(int orient) const int wxRemotelyScrolledTreeCtrl::GetScrollPos(int orient) const
{ {
wxScrolledWindow* scrolledWindow = GetScrolledWindow(); wxScrolledWindow* scrolledWindow = GetScrolledWindow();
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
{ {
wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this; wxGenericTreeCtrl* win = (wxGenericTreeCtrl*) this;
@@ -129,6 +135,9 @@ int wxRemotelyScrolledTreeCtrl::GetScrollPos(int orient) const
return scrolledWindow->GetScrollPos(orient); return scrolledWindow->GetScrollPos(orient);
} }
} }
#else
int wxRemotelyScrolledTreeCtrl::GetScrollPos(int WXUNUSED(orient)) const
{
#endif #endif
return 0; return 0;
} }
@@ -164,9 +173,9 @@ void wxRemotelyScrolledTreeCtrl::GetViewStart(int *x, int *y) const
} }
// In case we're using the generic tree control. // In case we're using the generic tree control.
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc) void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc)
{ {
#if USE_GENERIC_TREECTRL || !defined(__WXMSW__)
if (IsKindOf(CLASSINFO(wxGenericTreeCtrl))) if (IsKindOf(CLASSINFO(wxGenericTreeCtrl)))
{ {
wxScrolledWindow* scrolledWindow = GetScrolledWindow(); wxScrolledWindow* scrolledWindow = GetScrolledWindow();
@@ -183,12 +192,15 @@ void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& dc)
dc.SetDeviceOrigin( -startX * xppu1, -startY * yppu2 ); dc.SetDeviceOrigin( -startX * xppu1, -startY * yppu2 );
// dc.SetUserScale( win->GetScaleX(), win->GetScaleY() ); // dc.SetUserScale( win->GetScaleX(), win->GetScaleY() );
} }
#else
void wxRemotelyScrolledTreeCtrl::PrepareDC(wxDC& WXUNUSED(dc))
{
#endif #endif
} }
// Scroll to the given line (in scroll units where each unit is // Scroll to the given line (in scroll units where each unit is
// the height of an item) // the height of an item)
void wxRemotelyScrolledTreeCtrl::ScrollToLine(int posHoriz, int posVert) void wxRemotelyScrolledTreeCtrl::ScrollToLine(int WXUNUSED(posHoriz), int posVert)
{ {
#ifdef __WXMSW__ #ifdef __WXMSW__
#if USE_GENERIC_TREECTRL #if USE_GENERIC_TREECTRL
@@ -417,7 +429,7 @@ void wxTreeCompanionWindow::DrawItem(wxDC& dc, wxTreeItemId id, const wxRect& re
#endif #endif
} }
void wxTreeCompanionWindow::OnPaint(wxPaintEvent& event) void wxTreeCompanionWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
{ {
wxPaintDC dc(this); wxPaintDC dc(this);
@@ -470,7 +482,7 @@ void wxTreeCompanionWindow::OnScroll(wxScrollWinEvent& event)
Refresh(TRUE); Refresh(TRUE);
} }
void wxTreeCompanionWindow::OnExpand(wxTreeEvent& event) void wxTreeCompanionWindow::OnExpand(wxTreeEvent& WXUNUSED(event))
{ {
// TODO: something more optimized than simply refresh the whole // TODO: something more optimized than simply refresh the whole
// window when the tree is expanded/collapsed. Tricky. // window when the tree is expanded/collapsed. Tricky.
@@ -509,7 +521,7 @@ void wxThinSplitterWindow::SizeWindows()
} }
// Tests for x, y over sash // 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); 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(); 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 // Find targets in splitter window and send the event to them
wxNode* node = GetChildren().First(); wxNode* node = (wxNode *)GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindow* child = (wxWindow*) node->Data(); wxWindow* child = (wxWindow*) node->GetData();
if (child->IsKindOf(CLASSINFO(wxSplitterWindow))) if (child->IsKindOf(CLASSINFO(wxSplitterWindow)))
{ {
wxSplitterWindow* splitter = (wxSplitterWindow*) child; wxSplitterWindow* splitter = (wxSplitterWindow*) child;
@@ -650,7 +662,7 @@ void wxSplitterScrolledWindow::OnScroll(wxScrollWinEvent& event)
splitter->GetWindow2()->ProcessEvent(event); splitter->GetWindow2()->ProcessEvent(event);
break; break;
} }
node = node->Next(); node = node->GetNext();
} }
#ifdef __WXMAC__ #ifdef __WXMAC__

View File

@@ -1,17 +1,17 @@
#include "wx/msw/wx.rc" #include "wx/msw/wx.rc"
aaa ICON mondrian.ico aaa ICON "mondrian.ico"
close BITMAP bitmaps/close.bmp close BITMAP "bitmaps/close.bmp"
open BITMAP bitmaps/open.bmp open BITMAP "bitmaps/open.bmp"
preview BITMAP bitmaps/preview.bmp preview BITMAP "bitmaps/preview.bmp"
save BITMAP bitmaps/save.bmp save BITMAP "bitmaps/save.bmp"
control ICON bitmaps/control.ico control ICON "bitmaps/control.ico"
hsizer ICON bitmaps/hsizer.ico hsizer ICON "bitmaps/hsizer.ico"
vsizer ICON bitmaps/vsizer.ico vsizer ICON "bitmaps/vsizer.ico"
panel ICON bitmaps/panel.ico panel ICON "bitmaps/panel.ico"
unused ICON bitmaps/unused.ico unused ICON "bitmaps/unused.ico"
used ICON bitmaps/used.ico used ICON "bitmaps/used.ico"
resicon ICON bitmaps/resicon.ico resicon ICON "bitmaps/resicon.ico"
gsizer ICON bitmaps/gsizer.ico gsizer ICON "bitmaps/gsizer.ico"