mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-06 14:00:39 +00:00
NFD updated to 1.1.4
This commit is contained in:
parent
3d94cb5b93
commit
b0aa733c4e
6 changed files with 658 additions and 68 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Native File Dialog #
|
||||
|
||||
A tiny, neat C library that portably invokes native file open and save dialogs. Write dialog code once and have it pop up native dialogs on all supported platforms. Avoid linking large dependencies like wxWidgets and qt.
|
||||
A tiny, neat C library that portably invokes native file open, folder select and save dialogs. Write dialog code once and have it pop up native dialogs on all supported platforms. Avoid linking large dependencies like wxWidgets and qt.
|
||||
|
||||
Features:
|
||||
|
||||
|
|
@ -11,11 +11,12 @@ Features:
|
|||
- Paid support available.
|
||||
- Multiple file selection support.
|
||||
- 64-bit and 32-bit friendly.
|
||||
- GCC, Clang and Visual Studio supported.
|
||||
- No third party dependencies.
|
||||
- GCC, Clang, Xcode, Mingw and Visual Studio supported.
|
||||
- No third party dependencies for building or linking.
|
||||
- Support for Vista's modern `IFileDialog` on Windows.
|
||||
- Support for non-deprecated Cocoa APIs on OS X.
|
||||
- GTK+3 dialog on Linux.
|
||||
- GTK3 dialog on Linux.
|
||||
- Optional Zenity support on Linux to avoid linking GTK.
|
||||
- Tested, works alongside [http://www.libsdl.org](SDL2) on all platforms, for the game developers out there.
|
||||
|
||||
# Example Usage #
|
||||
|
|
@ -50,47 +51,74 @@ See [NFD.h](src/include/nfd.h) for more options.
|
|||
|
||||
# Screenshots #
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## Changelog ##
|
||||
|
||||
release | what's new | date
|
||||
--------|-----------------------------|---------
|
||||
1.0.0 | initial | oct 2014
|
||||
1.1.0 | premake5; scons deprecated | aug 2016
|
||||
1.1.1 | mingw support, build fixes | aug 2016
|
||||
1.1.2 | test_pickfolder() added | aug 2016
|
||||
1.1.3 | zenity linux backend added | nov 2017
|
||||
1.1.3 | fix char type in decls | nov 2017
|
||||
1.1.4 | fix win32 memleaks | dec 2018
|
||||
1.1.4 | improve win32 errorhandling | dec 2018
|
||||
1.1.4 | macos fix focus bug | dec 2018
|
||||
|
||||
|
||||
## Building ##
|
||||
|
||||
NFD uses [SCons](http://www.scons.org) for cross-platform builds. After installing SCons, build it with:
|
||||
NFD uses [Premake5](https://premake.github.io/download.html) generated Makefiles and IDE project files. The generated project files are checked in under `build/` so you don't have to download and use Premake in most cases.
|
||||
|
||||
cd src
|
||||
scons debug=[0,1]
|
||||
If you need to run Premake5 directly, further [build documentation](docs/build.md) is available.
|
||||
|
||||
Alternatively, you can avoid Scons by just including NFD files to your existing project:
|
||||
Previously, NFD used SCons to build. It still works, but is now deprecated; updates to it are discouraged. Opt to use the native build system where possible.
|
||||
|
||||
1. Add all header files in `src/` and `src/include` to your project.
|
||||
2. Add `src/include` to your include search path or copy it into your existing search path.
|
||||
3. Add `src/nfd_common.c` to your project.
|
||||
4. Add `src/nfd_<platform>` to your project, where `<platform>` is the NFD backend for the platform you are fixing to build.
|
||||
5. On Visual Studio, define `_CRT_SECURE_NO_WARNINGS` to avoid warnings.
|
||||
`nfd.a` will be built for release builds, and `nfd_d.a` will be built for debug builds.
|
||||
|
||||
### Makefiles ###
|
||||
|
||||
The makefile offers five options, with `release_x64` as the default.
|
||||
|
||||
make config=release_x86
|
||||
make config=release_x64
|
||||
make config=debug_x86
|
||||
make config=debug_x64
|
||||
|
||||
### Compiling Your Programs ###
|
||||
|
||||
1. Add `src/include` to your include search path.
|
||||
2. Add `nfd.lib` to the list of list of static libraries to link against.
|
||||
3. Add `src/` to the library search path.
|
||||
2. Add `nfd.lib` or `nfd_d.lib` to the list of list of static libraries to link against (for release or debug, respectively).
|
||||
3. Add `build/<debug|release>/<arch>` to the library search path.
|
||||
|
||||
On Linux, you must compile and link against GTK+. Recommend use of `pkg-config --cflags --libs gtk+-3.0`.
|
||||
#### Linux GTK ####
|
||||
`apt-get libgtk-3-dev` installs the gtk dependency for library compilation.
|
||||
|
||||
On Mac OS X, add `AppKit` to the list of frameworks.
|
||||
On Linux, you have the option of compiling and linking against GTK. If you use it, the recommended way to compile is to include the arguments of `pkg-config --cflags --libs gtk+-3.0`.
|
||||
|
||||
#### Linux Zenity ####
|
||||
|
||||
Alternatively, you can use the Zenity backend by running the Makefile in `build/gmake_linux_zenity`. Zenity runs the dialog in its own address space, but requires the user to have Zenity correctly installed and configured on their system.
|
||||
|
||||
#### MacOS ####
|
||||
On Mac OS, add `AppKit` to the list of frameworks.
|
||||
|
||||
#### Windows ####
|
||||
On Windows, ensure you are building against `comctl32.lib`.
|
||||
|
||||
## Usage ##
|
||||
|
||||
See `NFD.h` for API calls. See `tests/*.c` for example code.
|
||||
|
||||
See `tests/SConstruct` for a working build script that compiles on all platforms.
|
||||
After compiling, `build/bin` contains compiled test programs.
|
||||
|
||||
## File Filter Syntax ##
|
||||
|
||||
There is a form of file filtering in every file dialog, but no consistent means of supporting it. NFD provides support for filtering files by groups of extensions, providing its own descriptions (where applicable) for the extensions.
|
||||
There is a form of file filtering in every file dialog API, but no consistent means of supporting it. NFD provides support for filtering files by groups of extensions, providing its own descriptions (where applicable) for the extensions.
|
||||
|
||||
A wildcard filter is always added to every dialog.
|
||||
|
||||
|
|
@ -113,16 +141,14 @@ See [test_opendialogmultiple.c](test/test_opendialogmultiple.c).
|
|||
|
||||
# Known Limitations #
|
||||
|
||||
I accept quality code patches, or will resolve these and other matters through support.
|
||||
I accept quality code patches, or will resolve these and other matters through support. See [submitting pull requests](docs/submitting_pull_requests.md) for details.
|
||||
|
||||
- No support for Windows XP's legacy dialogs such as `GetOpenFileName`.
|
||||
- No support for file filter names -- ex: "Image Files" (*.png, *.jpg). Nameless filters are supported, though.
|
||||
- No support for selecting folders instead of files.
|
||||
- On Linux, GTK+ cannot be uninitialized to save memory. Launching a file dialog costs memory. I am open to accepting an alternative `nfd_zenity.c` implementation which uses Zenity and pipes.
|
||||
- No support for file filter names -- ex: "Image Files" (*.png, *.jpg). Nameless filters are supported, however.
|
||||
|
||||
# Copyright and Credit #
|
||||
|
||||
Copyright © 2014 [Frogtoss Games](http://www.frogtoss.com), Inc.
|
||||
Copyright © 2014-2017 [Frogtoss Games](http://www.frogtoss.com), Inc.
|
||||
File [LICENSE](LICENSE) covers all files in this repo.
|
||||
|
||||
Native File Dialog by Michael Labbe
|
||||
|
|
@ -130,6 +156,10 @@ Native File Dialog by Michael Labbe
|
|||
|
||||
Tomasz Konojacki for [microutf8](http://puszcza.gnu.org.ua/software/microutf8/)
|
||||
|
||||
[Denis Kolodin](https://github.com/DenisKolodin) for mingw support.
|
||||
|
||||
[Tom Mason](https://github.com/wheybags) for Zenity support.
|
||||
|
||||
## Support ##
|
||||
|
||||
Directed support for this work is available from the original author under a paid agreement.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue