X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/254a21292b0ccf234ed1dbc6acd37708672ffcc0..3a39df31ff47004a46cfb06f3fb2d3e317f96d2b:/utils/configtool/src/configtoolview.cpp?ds=sidebyside diff --git a/utils/configtool/src/configtoolview.cpp b/utils/configtool/src/configtoolview.cpp index 6cd42bc8fa..59668482b3 100644 --- a/utils/configtool/src/configtoolview.cpp +++ b/utils/configtool/src/configtoolview.cpp @@ -21,6 +21,7 @@ #endif #include "wx/wfstream.h" +#include "wx/txtstrm.h" #include "configtoolview.h" #include "configtooldoc.h" #include "configtree.h" @@ -259,7 +260,7 @@ void ctConfigToolView::SyncItem(ctConfigTreeCtrl* treeControl, ctConfigItem* ite { if (!item->GetParent()) { - item->SetTreeItem(treeControl->AddRoot(_(""), -1, -1, new ctTreeItemData(item))); + item->SetTreeItem(treeControl->AddRoot(wxEmptyString, -1, -1, new ctTreeItemData(item))); } else { @@ -423,9 +424,8 @@ void ctConfigToolView::AddItem(ctConfigType type, const wxString& msg) ctConfigItem* sel = GetSelection(); if (sel) { - wxString name = wxGetTextFromUser(_("Please enter a name for the new item."), - msg, wxT("")); - if (!name.IsEmpty()) + wxString name = wxGetTextFromUser(_("Please enter a name for the new item."), msg); + if (!name.empty()) { ctConfigItem* parent ; ctConfigItem* insertBefore ; @@ -474,7 +474,7 @@ void ctConfigToolView::OnRenameItem(wxCommandEvent& WXUNUSED(event)) { wxString name = wxGetTextFromUser(_("Please enter a new name for the item."), _("Rename item"), sel->GetName()); - if (!name.IsEmpty()) + if (!name.empty()) { sel->SetName(name); SyncItem(wxGetApp().GetMainFrame()->GetConfigTreeCtrl(), sel); @@ -686,7 +686,7 @@ void ctConfigToolView::OnItemHelp(wxCommandEvent& WXUNUSED(event)) if ( doc && GetSelection() ) { wxString helpTopic = GetSelection()->GetPropertyString(wxT("help-topic")); - if (!helpTopic.IsEmpty()) + if (!helpTopic.empty()) { wxGetApp().GetReferenceHelpController().DisplaySection(helpTopic); } @@ -732,7 +732,7 @@ void ctConfigToolView::OnAddCustomProperty(wxCommandEvent& WXUNUSED(event)) else if (type == wxT("long")) property->GetVariant() = wxVariant((long) 0, name); else - property->GetVariant() = wxVariant(wxT(""), name); + property->GetVariant() = wxVariant(wxEmptyString, name); property->SetCustom(true); property->SetDescription(descr); property->SetChoices(choices); @@ -791,7 +791,7 @@ void ctConfigToolView::OnEditCustomProperty(wxCommandEvent& WXUNUSED(event)) else if (type == wxT("long")) property->GetVariant() = wxVariant((long) 0, name); else - property->GetVariant() = wxVariant(wxT(""), name); + property->GetVariant() = wxVariant(wxEmptyString, name); } if (name != oldName) property->GetVariant().SetName(name); @@ -910,7 +910,7 @@ void ctConfigToolView::OnSaveSetupFile(wxCommandEvent& WXUNUSED(event)) wxString filename = _T("setup.h"); wxString path = wxGetApp().GetSettings().m_lastSetupSaveDir; - if (path.IsEmpty()) + if (path.empty()) path = doc->GetFrameworkDir(false); wxString wildcard = _T("Header files (*.h)|*.h|All files (*.*)|*.*"); @@ -924,13 +924,14 @@ void ctConfigToolView::OnSaveSetupFile(wxCommandEvent& WXUNUSED(event)) wxString fullPath = dialog.GetPath(); wxGetApp().GetSettings().m_lastSetupSaveDir = wxPathOnly(fullPath); - wxFileOutputStream stream(fullPath); - if (!stream.Ok()) + wxFileOutputStream osFile(fullPath); + if (!osFile.Ok()) { wxMessageBox(_("Sorry, could not save this file."), _("Save Setup File"), wxICON_EXCLAMATION|wxOK); return; } + wxTextOutputStream stream(osFile); stream << setupStr; } } @@ -942,7 +943,7 @@ void ctConfigToolView::OnSaveConfigureCommand(wxCommandEvent& WXUNUSED(event)) wxString filename = _T("configurewx.sh"); wxString path = wxGetApp().GetSettings().m_lastSetupSaveDir; - if (path.IsEmpty()) + if (path.empty()) path = doc->GetFrameworkDir(false); wxString wildcard = _T("Shell script files (*.sh)|*.sh|All files (*.*)|*.*"); @@ -956,13 +957,14 @@ void ctConfigToolView::OnSaveConfigureCommand(wxCommandEvent& WXUNUSED(event)) wxString fullPath = dialog.GetPath(); wxGetApp().GetSettings().m_lastSetupSaveDir = wxPathOnly(fullPath); - wxFileOutputStream stream(fullPath); - if (!stream.Ok()) + wxFileOutputStream osFile(fullPath); + if (!osFile.Ok()) { wxMessageBox(_("Sorry, could not save this file."), _("Save Configure Command File"), wxICON_EXCLAMATION|wxOK); return; } + wxTextOutputStream stream(osFile); stream << configureStr; } } @@ -1014,7 +1016,7 @@ void ctConfigToolView::OnGo(wxCommandEvent& WXUNUSED(event)) { ctConfigToolDoc* doc = (ctConfigToolDoc*) GetDocument(); wxString path = wxGetApp().GetSettings().m_lastSetupSaveDir; - if (!path.IsEmpty()) + if (!path.empty()) { if (wxGetApp().GetSettings().m_defaultFileKind == wxT("Setup file")) { @@ -1075,7 +1077,7 @@ void ctConfigToolView::OnGo(wxCommandEvent& WXUNUSED(event)) void ctConfigToolView::OnUpdateGo(wxUpdateUIEvent& event) { wxString path = wxGetApp().GetSettings().m_lastSetupSaveDir; - event.Enable(!path.IsEmpty()); + event.Enable(!path.empty()); } //---------------------------------------------------------------------------- @@ -1132,7 +1134,7 @@ bool ctFindReplaceDialog::DoFind(const wxString& textToFind, bool matchCase, boo return false; } - if (!sm_currentItem.IsEmpty()) + if (!sm_currentItem.empty()) { currentItem = doc->GetTopItem()->FindItem(sm_currentItem); }