X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9c8849722a71ee7139e035bca5fdb2ae7b0af570..eb254be6df56f99bd2691e4ca38d59004d2f39f5:/src/generic/filedlgg.cpp diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 39642ac8dd..6dfcb6a234 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -37,12 +37,13 @@ #include "wx/tooltip.h" #endif -#include "sys/types.h" -#include "sys/stat.h" -#include "dirent.h" -#include "pwd.h" -#include "grp.h" -#include "time.h" +#include +#include +#include +#include +#include +#include +#include #include "wx/generic/home.xpm" #include "wx/generic/listview.xpm" @@ -522,14 +523,15 @@ void wxFileCtrl::OnListEndLabelEdit( wxListEvent &event ) // wxFileDialog //----------------------------------------------------------------------------- -#define ID_LIST_MODE 5000 -#define ID_REPORT_MODE 5001 -#define ID_UP_DIR 5005 -#define ID_PARENT_DIR 5006 -#define ID_NEW_DIR 5007 -#define ID_CHOICE 5008 -#define ID_TEXT 5009 -#define ID_LIST_CTRL 5010 +#define ID_LIST_MODE wxID_FILEDLGG +#define ID_REPORT_MODE wxID_FILEDLGG + 1 +#define ID_UP_DIR wxID_FILEDLGG + 5 +#define ID_PARENT_DIR wxID_FILEDLGG + 6 +#define ID_NEW_DIR wxID_FILEDLGG + 7 +#define ID_CHOICE wxID_FILEDLGG + 8 +#define ID_TEXT wxID_FILEDLGG + 9 +#define ID_LIST_CTRL wxID_FILEDLGG + 10 +#define ID_ACTIVATED wxID_FILEDLGG + 11 IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog) @@ -560,7 +562,11 @@ wxFileDialog::wxFileDialog(wxWindow *parent, m_message = message; m_dialogStyle = style; m_dir = defaultDir; - if (m_dir.IsEmpty()) m_dir = wxGetUserHome(); + if (m_dir.IsEmpty()) + { + char buf[200]; + m_dir = getcwd( buf, sizeof(buf) ); + } m_path = defaultDir; m_path += _T("/"); m_path += defaultFile; @@ -670,8 +676,11 @@ wxFileDialog::wxFileDialog(wxWindow *parent, mainsizer->SetSizeHints( this ); Centre( wxBOTH ); - - m_list->SetFocus(); + + if (m_fileName.IsEmpty()) + m_list->SetFocus(); + else + m_text->SetFocus(); wxEndBusyCursor(); } @@ -723,6 +732,24 @@ void wxFileDialog::OnListOk( wxCommandEvent &event ) return; } + if (filename == _T("~")) + { + m_list->GoToHomeDir(); + m_list->SetFocus(); + m_list->GetDir( dir ); + m_static->SetLabel( dir ); + return; + } + + if (filename[0] == _T('~')) + { + filename.Remove( 0, 1 ); + wxString tmp( wxGetUserHome() ); + tmp += _T('/'); + tmp += filename; + filename = tmp; + } + if ((filename.Find(_T('*')) != wxNOT_FOUND) || (filename.Find(_T('?')) != wxNOT_FOUND)) { @@ -736,13 +763,19 @@ void wxFileDialog::OnListOk( wxCommandEvent &event ) } if (dir != _T("/")) dir += _T("/"); - dir += filename; - filename = dir; + if (filename[0] != _T('/')) + { + dir += filename; + filename = dir; + } if (wxDirExists(filename)) { m_list->GoToDir( filename ); - m_text->SetValue( _T("..") ); + if (filename == _T("/")) + m_text->SetValue( _T("") ); + else + m_text->SetValue( _T("..") ); m_list->GetDir( dir ); m_static->SetLabel( dir ); return;