Merge branch 'master' of github.com:buggins/dlangui

This commit is contained in:
Vadim Lopatin 2016-03-14 08:42:08 +03:00
commit 03a878f5f1
4 changed files with 29 additions and 7 deletions

View File

@ -17,5 +17,16 @@
"dependencies": {
"dlangui": {"path": "../../"}
}
},
"configurations" : [
{
"name" : "default",
},
{
"name" : "sdl",
"subConfigurations" : {
"dlangui" : "sdl"
}
}
]
}

View File

@ -352,9 +352,10 @@ extern (C) int UIAppMain(string[] args) {
UIString caption;
caption = "Open Text File"d;
FileDialog dlg = new FileDialog(caption, window, null);
dlg.addFilter(FileFilterEntry(UIString("FILTER_ALL_FILES", "All files (*.*)"d), "*.*"));
dlg.addFilter(FileFilterEntry(UIString("FILTER_ALL_FILES", "All files (*)"d), "*"));
dlg.addFilter(FileFilterEntry(UIString("FILTER_TEXT_FILES", "Text files (*.txt)"d), "*.txt"));
dlg.addFilter(FileFilterEntry(UIString("FILTER_SOURCE_FILES", "Source files"d), "*.d;*.dd;*.c;*.cc;*.cpp;*.h;*.hpp"));
dlg.addFilter(FileFilterEntry(UIString("FILTER_EXECUTABLE_FILES", "Executable files"d), "*", true));
//dlg.filterIndex = 2;
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
if (result.id == ACTION_OPEN.id) {

View File

@ -119,7 +119,7 @@ struct RootEntry {
@property RootEntry[] getRootPaths() {
RootEntry[] res;
res ~= RootEntry(RootEntryType.HOME, homePath);
version (posix) {
version (Posix) {
res ~= RootEntry(RootEntryType.ROOT, "/", "File System"d);
}
version (Windows) {
@ -192,10 +192,12 @@ bool filterFilename(in string filename, in string[] filters) pure nothrow {
Returns true if directory exists and listed successfully, false otherwise.
*/
bool listDirectory(in string dir, in bool includeDirs, in bool includeFiles, in bool showHiddenFiles, in string[] filters, ref DirEntry[] entries, in bool showExecutables = false) {
entries.length = 0;
if (!isDir(dir)) {
import std.exception : collectException;
bool dirExists;
collectException(dir.isDir, dirExists);
if (!dirExists) {
return false;
}
@ -216,6 +218,8 @@ bool listDirectory(in string dir, in bool includeDirs, in bool includeFiles, in
files ~= e;
}
}
dirs.sort!((a,b) => filenameCmp!(std.path.CaseSensitive.no)(a,b) < 0);
files.sort!((a,b) => filenameCmp!(std.path.CaseSensitive.no)(a,b) < 0);
if (includeDirs)
foreach(DirEntry e; dirs)
entries ~= e;
@ -228,7 +232,7 @@ bool listDirectory(in string dir, in bool includeDirs, in bool includeFiles, in
passed = e.name.endsWith(".exe") || e.name.endsWith(".EXE")
|| e.name.endsWith(".cmd") || e.name.endsWith(".CMD")
|| e.name.endsWith(".bat") || e.name.endsWith(".BAT");
} else version (posix) {
} else version (Posix) {
// execute permission for others
passed = (e.attributes & attr_mask) != 0;
} else version(OSX) {

View File

@ -1056,6 +1056,9 @@ class SDLPlatform : Platform {
break;
case SDL_WINDOWEVENT_EXPOSED:
debug(DebugSDL) Log.d("SDL_WINDOWEVENT_EXPOSED");
version(linux) {
w.redraw();
}
break;
case SDL_WINDOWEVENT_MOVED:
debug(DebugSDL) Log.d("SDL_WINDOWEVENT_MOVED");
@ -1068,6 +1071,9 @@ class SDLPlatform : Platform {
break;
case SDL_WINDOWEVENT_RESTORED:
debug(DebugSDL) Log.d("SDL_WINDOWEVENT_RESTORED");
version(linux) { //not sure if needed on Windows or OSX. Also need to check on FreeBSD
w.redraw();
}
break;
case SDL_WINDOWEVENT_ENTER:
debug(DebugSDL) Log.d("SDL_WINDOWEVENT_ENTER");