From b338e29fd3eaf700f8c8360aa0310048ba941d54 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:12:46 +0200 Subject: 3.19 --- shared/dir_name.cpp | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'shared/dir_name.cpp') diff --git a/shared/dir_name.cpp b/shared/dir_name.cpp index dda9407e..6566bb3a 100644 --- a/shared/dir_name.cpp +++ b/shared/dir_name.cpp @@ -15,7 +15,6 @@ #include "check_exist.h" #include "util.h" #include "i18n.h" -#include "system_constants.h" using namespace zen; @@ -24,7 +23,7 @@ namespace { void setDirectoryNameImpl(const wxString& dirname, wxDirPickerCtrl* dirPicker, wxWindow& tooltipWnd, wxStaticBoxSizer* staticBox, size_t timeout) { - const wxString dirFormatted = zToWx(getFormattedDirectoryName(wxToZ(dirname))); + const wxString dirFormatted = toWx(getFormattedDirectoryName(toZ(dirname))); tooltipWnd.SetToolTip(dirFormatted); //wxComboBox bug: the edit control is not updated... hope this will be fixed: http://trac.wxwidgets.org/ticket/12659 @@ -32,17 +31,16 @@ void setDirectoryNameImpl(const wxString& dirname, wxDirPickerCtrl* dirPicker, w { //change static box label only if there is a real difference to what is shown in wxTextCtrl anyway wxString dirNormalized = dirname; - dirNormalized.Trim(true); - dirNormalized.Trim(false); - if (!dirNormalized.empty() && !dirNormalized.EndsWith(zToWx(common::FILE_NAME_SEPARATOR))) - dirNormalized += zToWx(common::FILE_NAME_SEPARATOR); + trim(dirNormalized); + if (!dirNormalized.empty() && !endsWith(dirNormalized, FILE_NAME_SEPARATOR)) + dirNormalized += FILE_NAME_SEPARATOR; staticBox->GetStaticBox()->SetLabel(dirNormalized == dirFormatted ? wxString(_("Drag && drop")) : dirFormatted); } if (dirPicker) { - if (!dirFormatted.empty() && util::dirExists(wxToZ(dirFormatted), timeout) == util::EXISTING_TRUE) //potentially slow network access: wait 200ms at most + if (!dirFormatted.empty() && util::dirExists(toZ(dirFormatted), timeout) == util::EXISTING_TRUE) //potentially slow network access: wait 200ms at most dirPicker->SetPath(dirFormatted); } } @@ -113,14 +111,14 @@ void DirectoryNameMainDlg::OnFilesDropped(FFSFileDropEvent& event) if (AcceptDrop(event.getFiles())) { - Zstring fileName = wxToZ(event.getFiles()[0]); - if (dirExists(fileName)) - setDirectoryName(zToWx(fileName), &dirName_, &dirPicker_, dirName_, staticBox_); + wxString fileName = event.getFiles()[0]; + if (dirExists(toZ(fileName))) + setDirectoryName(fileName, &dirName_, &dirPicker_, dirName_, staticBox_); else { - fileName = fileName.BeforeLast(common::FILE_NAME_SEPARATOR); - if (dirExists(fileName)) - setDirectoryName(zToWx(fileName), &dirName_, &dirPicker_, dirName_, staticBox_); + fileName = beforeLast(fileName, FILE_NAME_SEPARATOR); + if (dirExists(toZ(fileName))) + setDirectoryName(fileName, &dirName_, &dirPicker_, dirName_, staticBox_); } } } @@ -183,14 +181,14 @@ void DirectoryName::OnFilesDropped(FFSFileDropEvent& event) if (event.getFiles().empty()) return; - Zstring fileName = wxToZ(event.getFiles()[0]); - if (dirExists(fileName)) - setDirectoryName(zToWx(fileName), &dirName_, &dirPicker_, dirName_, staticBox_); + wxString fileName = event.getFiles()[0]; + if (dirExists(toZ(fileName))) + setDirectoryName(fileName, &dirName_, &dirPicker_, dirName_, staticBox_); else { - fileName = fileName.BeforeLast(common::FILE_NAME_SEPARATOR); - if (dirExists(fileName)) - setDirectoryName(zToWx(fileName), &dirName_, &dirPicker_, dirName_, staticBox_); + fileName = beforeLast(fileName, FILE_NAME_SEPARATOR); + if (dirExists(toZ(fileName))) + setDirectoryName(fileName, &dirName_, &dirPicker_, dirName_, staticBox_); } } -- cgit