#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 <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <pwd.h>
+#include <grp.h>
+#include <time.h>
+#include <unistd.h>
#include "wx/generic/home.xpm"
#include "wx/generic/listview.xpm"
// 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)
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;
mainsizer->SetSizeHints( this );
Centre( wxBOTH );
-
- m_list->SetFocus();
+
+ if (m_fileName.IsEmpty())
+ m_list->SetFocus();
+ else
+ m_text->SetFocus();
wxEndBusyCursor();
}
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))
{
}
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;