mirror of https://github.com/buggins/dlangui.git
Merge branch 'master' of github.com:buggins/dlangui
This commit is contained in:
commit
03a878f5f1
|
@ -17,5 +17,16 @@
|
||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dlangui": {"path": "../../"}
|
"dlangui": {"path": "../../"}
|
||||||
|
},
|
||||||
|
"configurations" : [
|
||||||
|
{
|
||||||
|
"name" : "default",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "sdl",
|
||||||
|
"subConfigurations" : {
|
||||||
|
"dlangui" : "sdl"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
|
@ -352,9 +352,10 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
UIString caption;
|
UIString caption;
|
||||||
caption = "Open Text File"d;
|
caption = "Open Text File"d;
|
||||||
FileDialog dlg = new FileDialog(caption, window, null);
|
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_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_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.filterIndex = 2;
|
||||||
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
|
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
|
||||||
if (result.id == ACTION_OPEN.id) {
|
if (result.id == ACTION_OPEN.id) {
|
||||||
|
|
|
@ -119,7 +119,7 @@ struct RootEntry {
|
||||||
@property RootEntry[] getRootPaths() {
|
@property RootEntry[] getRootPaths() {
|
||||||
RootEntry[] res;
|
RootEntry[] res;
|
||||||
res ~= RootEntry(RootEntryType.HOME, homePath);
|
res ~= RootEntry(RootEntryType.HOME, homePath);
|
||||||
version (posix) {
|
version (Posix) {
|
||||||
res ~= RootEntry(RootEntryType.ROOT, "/", "File System"d);
|
res ~= RootEntry(RootEntryType.ROOT, "/", "File System"d);
|
||||||
}
|
}
|
||||||
version (Windows) {
|
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.
|
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) {
|
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;
|
entries.length = 0;
|
||||||
|
|
||||||
if (!isDir(dir)) {
|
import std.exception : collectException;
|
||||||
|
bool dirExists;
|
||||||
|
collectException(dir.isDir, dirExists);
|
||||||
|
if (!dirExists) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,6 +218,8 @@ bool listDirectory(in string dir, in bool includeDirs, in bool includeFiles, in
|
||||||
files ~= e;
|
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)
|
if (includeDirs)
|
||||||
foreach(DirEntry e; dirs)
|
foreach(DirEntry e; dirs)
|
||||||
entries ~= e;
|
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")
|
passed = e.name.endsWith(".exe") || e.name.endsWith(".EXE")
|
||||||
|| e.name.endsWith(".cmd") || e.name.endsWith(".CMD")
|
|| e.name.endsWith(".cmd") || e.name.endsWith(".CMD")
|
||||||
|| e.name.endsWith(".bat") || e.name.endsWith(".BAT");
|
|| e.name.endsWith(".bat") || e.name.endsWith(".BAT");
|
||||||
} else version (posix) {
|
} else version (Posix) {
|
||||||
// execute permission for others
|
// execute permission for others
|
||||||
passed = (e.attributes & attr_mask) != 0;
|
passed = (e.attributes & attr_mask) != 0;
|
||||||
} else version(OSX) {
|
} else version(OSX) {
|
||||||
|
|
|
@ -1056,6 +1056,9 @@ class SDLPlatform : Platform {
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_EXPOSED:
|
case SDL_WINDOWEVENT_EXPOSED:
|
||||||
debug(DebugSDL) Log.d("SDL_WINDOWEVENT_EXPOSED");
|
debug(DebugSDL) Log.d("SDL_WINDOWEVENT_EXPOSED");
|
||||||
|
version(linux) {
|
||||||
|
w.redraw();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MOVED:
|
case SDL_WINDOWEVENT_MOVED:
|
||||||
debug(DebugSDL) Log.d("SDL_WINDOWEVENT_MOVED");
|
debug(DebugSDL) Log.d("SDL_WINDOWEVENT_MOVED");
|
||||||
|
@ -1068,6 +1071,9 @@ class SDLPlatform : Platform {
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_RESTORED:
|
case SDL_WINDOWEVENT_RESTORED:
|
||||||
debug(DebugSDL) Log.d("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;
|
break;
|
||||||
case SDL_WINDOWEVENT_ENTER:
|
case SDL_WINDOWEVENT_ENTER:
|
||||||
debug(DebugSDL) Log.d("SDL_WINDOWEVENT_ENTER");
|
debug(DebugSDL) Log.d("SDL_WINDOWEVENT_ENTER");
|
||||||
|
|
Loading…
Reference in New Issue