This commit is contained in:
tildearrow 2022-03-13 22:02:50 -05:00
parent 2ba0185701
commit 0874d58fb8
23 changed files with 2661 additions and 11 deletions

View File

@ -398,7 +398,7 @@ if (APPLE)
endif()
if (NOT MSVC)
set(WARNING_FLAGS -Wall -Wextra -Wno-unused-parameter)
set(WARNING_FLAGS -Wall -Wextra -Wno-unused-parameter -Wno-cast-function-type)
if (WARNINGS_ARE_ERRORS)
list(APPEND WARNING_FLAGS -Werror)
endif()

4
extern/pfd-fixed/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake

5
extern/pfd-fixed/.lgtm.yml vendored Normal file
View File

@ -0,0 +1,5 @@
extraction:
cpp:
index:
build_command:
- make -C examples

6
extern/pfd-fixed/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.1.0)
project(portable_file_dialogs VERSION 1.00 LANGUAGES CXX)
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

14
extern/pfd-fixed/COPYING vendored Normal file
View File

@ -0,0 +1,14 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

64
extern/pfd-fixed/README.md vendored Normal file
View File

@ -0,0 +1,64 @@
# Portable File Dialogs
A free C++11 file dialog library.
- works on Windows, Mac OS X, Linux
- **single-header**, no extra library dependencies
- **synchronous *or* asynchronous** (does not block the rest of your program!)
- **cancelable** (kill asynchronous dialogues without user interaction)
- **secure** (immune to shell-quote vulnerabilities)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/a25d3fd6959a4333871f630ac70b6e09)](https://www.codacy.com/manual/samhocevar/portable-file-dialogs?utm_source=github.com&utm_medium=referral&utm_content=samhocevar/portable-file-dialogs&utm_campaign=Badge_Grade)
## Status
The library is now pretty robust. It is not as feature-complete as
[Tiny File Dialogs](https://sourceforge.net/projects/tinyfiledialogs/),
but has asynchonous dialogs, more maintainable code, and fewer potential
security issues.
The currently available backends are:
- Win32 API (all known versions of Windows)
- Mac OS X (using AppleScript)
- GNOME desktop (using [Zenity](https://en.wikipedia.org/wiki/Zenity) or its clones Matedialog and Qarma)
- KDE desktop (using [KDialog](https://github.com/KDE/kdialog))
Experimental support for Emscripten is on its way.
## Documentation
- [`pfd`](doc/pfd.md) general documentation
- [`pfd::message`](doc/message.md) message box
- [`pfd::notify`](doc/notify.md) notification
- [`pfd::open_file`](doc/open_file.md) file open
- [`pfd::save_file`](doc/save_file.md) file save
- [`pfd::select_folder`](doc/select_folder.md) folder selection
## History
- 0.1.0 (July 16, 2020): first public release
## Screenshots (Windows 10)
![warning-win32](https://user-images.githubusercontent.com/245089/47136607-76919a00-d2b4-11e8-8f42-e2d62c4f9570.png)
![notify-win32](https://user-images.githubusercontent.com/245089/47142453-2ff76c00-d2c3-11e8-871a-1a110ac91eb2.png)
![open-win32](https://user-images.githubusercontent.com/245089/47155865-0f8cd900-d2e6-11e8-8041-1e20b6f77dee.png)
## Screenshots (Mac OS X, dark theme)
![warning-osxdark](https://user-images.githubusercontent.com/245089/56053001-22dba700-5d53-11e9-8233-ca7a2c58188d.png)
![notify-osxdark](https://user-images.githubusercontent.com/245089/56053188-bc0abd80-5d53-11e9-8298-68aa96315c6c.png)
![open-osxdark](https://user-images.githubusercontent.com/245089/56053378-39363280-5d54-11e9-9583-9f1c978fa0db.png)
## Screenshots (Linux, GNOME desktop)
![warning-gnome](https://user-images.githubusercontent.com/245089/47136608-772a3080-d2b4-11e8-9e1d-60a7e743e908.png)
![notify-gnome](https://user-images.githubusercontent.com/245089/47142455-30900280-d2c3-11e8-8b76-ea16c7e502d4.png)
![open-gnome](https://user-images.githubusercontent.com/245089/47155867-0f8cd900-d2e6-11e8-93af-275636491ec4.png)
## Screenshots (Linux, KDE Plasma desktop)
![warning-kde](https://user-images.githubusercontent.com/245089/47149255-4dcccd00-d2d3-11e8-84c9-f85612784680.png)
![notify-kde](https://user-images.githubusercontent.com/245089/47149206-27a72d00-d2d3-11e8-8f1b-96e462f08c2b.png)
![open-kde](https://user-images.githubusercontent.com/245089/47155866-0f8cd900-d2e6-11e8-8006-f14b948afc55.png)

97
extern/pfd-fixed/doc/message.md vendored Normal file
View File

@ -0,0 +1,97 @@
## Message Box API
Displaying a message box is done using the `pfd::message` class. It can be provided a title, a
message text, a `choice` representing which buttons need to be rendered, and an `icon` for the
message:
```cpp
pfd::message::message(std::string const &title,
std::string const &text,
pfd::choice choice = pfd::choice::ok_cancel,
pfd::icon icon = pfd::icon::info);
enum class pfd::choice { ok, ok_cancel, yes_no, yes_no_cancel };
enum class pfd::icon { info, warning, error, question };
```
The pressed button is queried using `pfd::message::result()`. If the dialog box is closed by any
other means, the `pfd::button::cancel` is assumed:
```cpp
pfd::button pfd::message::result();
enum class pfd::button { ok, cancel, yes, no };
```
It is possible to ask the dialog box whether the user took action using the `pfd::message::ready()`
method, with an optional `timeout` argument. If the user did not press a button within `timeout`
milliseconds, the function will return `false`:
```cpp
bool pfd::message::ready(int timeout = pfd::default_wait_timeout);
```
## Example 1: simple notification
The `pfd::message` destructor waits for user action, so this operation will block until the user
closes the message box:
```cpp
pfd::message("Problem", "An error occurred while doing things",
pfd::choice::ok, pfd::icon::error);
```
## Example 2: retrieving the pressed button
Using `pfd::message::result()` will also wait for user action before returning. This operation will block and return the user choice:
```cpp
// Ask for user opinion
auto button = pfd::message("Action requested", "Do you want to proceed with things?",
pfd::choice::yes_no, pfd::icon::question).result();
// Do something with button…
```
## Example 3: asynchronous message box
Using `pfd::message::ready()` allows the application to perform other tasks while waiting for
user input:
```cpp
// Message box with nice message
auto box = pfd::message("Unsaved Files", "Do you want to save the current "
"document before closing the application?",
pfd::choice::yes_no_cancel,
pfd::icon::warning);
// Do something while waiting for user input
while (!box.ready(1000))
std::cout << "Waited 1 second for user input...\n";
// Act depending on the selected button
switch (box.result())
{
case pfd::button::yes: std::cout << "User agreed.\n"; break;
case pfd::button::no: std::cout << "User disagreed.\n"; break;
case pfd::button::cancel: std::cout << "User freaked out.\n"; break;
}
```
## Screenshots
#### Windows 10
![warning-win32](https://user-images.githubusercontent.com/245089/47136607-76919a00-d2b4-11e8-8f42-e2d62c4f9570.png)
#### Mac OS X
![warning-osx-dark](https://user-images.githubusercontent.com/245089/56053001-22dba700-5d53-11e9-8233-ca7a2c58188d.png) ![warning-osx-light](https://user-images.githubusercontent.com/245089/56053055-49014700-5d53-11e9-8306-e9a03a25e044.png)
#### Linux (GNOME desktop)
![warning-gnome](https://user-images.githubusercontent.com/245089/47140824-8662ab80-d2bf-11e8-9c87-2742dd5b58af.png)
#### Linux (KDE desktop)
![warning-kde](https://user-images.githubusercontent.com/245089/47149255-4dcccd00-d2d3-11e8-84c9-f85612784680.png)

40
extern/pfd-fixed/doc/notify.md vendored Normal file
View File

@ -0,0 +1,40 @@
## Notification API
Displaying a desktop notification is done using the `pfd::notify` class. It can be provided a
title, a message text, and an `icon` for the notification style:
```cpp
pfd::notify::notify(std::string const &title,
std::string const &text,
pfd::icon icon = pfd::icon::info);
enum class pfd::icon { info, warning, error };
```
## Example
Displaying a notification is straightforward. Emoji are supported:
```cpp
pfd::notify("System event", "Something might be on fire 🔥",
pfd::icon::warning);
```
The `pfd::notify` object needs not be kept around, letting the object clean up itself is enough.
## Screenshots
Windows 10:
![notify-win32](https://user-images.githubusercontent.com/245089/47142453-2ff76c00-d2c3-11e8-871a-1a110ac91eb2.png)
Mac OS X (dark theme):
![image](https://user-images.githubusercontent.com/245089/56053188-bc0abd80-5d53-11e9-8298-68aa96315c6c.png)
Mac OS X (light theme):
![image](https://user-images.githubusercontent.com/245089/56053137-92ea2d00-5d53-11e9-8cf2-049486c45713.png)
Linux (GNOME desktop):
![notify-gnome](https://user-images.githubusercontent.com/245089/47142455-30900280-d2c3-11e8-8b76-ea16c7e502d4.png)
Linux (KDE desktop):
![notify-kde](https://user-images.githubusercontent.com/245089/47149206-27a72d00-d2d3-11e8-8f1b-96e462f08c2b.png)

90
extern/pfd-fixed/doc/open_file.md vendored Normal file
View File

@ -0,0 +1,90 @@
## File Open API
The `pfd::open_file` class handles file opening dialogs. It can be provided a title, a starting
directory and/or pre-selected file, an optional filter for recognised file types, and an optional
flag to allow multiple selection:
```cpp
pfd::open_file::open_file(std::string const &title,
std::string const &initial_path,
std::vector<std::string> filters = { "All Files", "*" },
pfd::opt option = pfd::opt::none);
```
The `option` parameter can be `pfd::opt::multiselect` to allow selecting multiple files.
The selected files are queried using `pfd::open_file::result()`. If the user canceled the
operation, the returned list is empty:
```cpp
std::vector<std::string> pfd::open_file::result();
```
It is possible to ask the file open dialog whether the user took action using the
`pfd::message::ready()` method, with an optional `timeout` argument. If the user did not validate
the dialog within `timeout` milliseconds, the function will return `false`:
```cpp
bool pfd::open_file::ready(int timeout = pfd::default_wait_timeout);
```
## Example 1: simple file selection
Using `pfd::open_file::result()` will wait for user action before returning. This operation will
block and return the user choice:
```cpp
auto selection = pfd::open_file("Select a file").result();
if (!selection.empty())
std::cout << "User selected file " << selection[0] << "\n";
```
## Example 2: filters
The filter list enumerates filter names and corresponded space-separated wildcard lists. It
defaults to `{ "All Files", "*" }`, but here is how to use other options:
```cpp
auto selection = pfd::open_file("Select a file", ".",
{ "Image Files", "*.png *.jpg *.jpeg *.bmp",
"Audio Files", "*.wav *.mp3",
"All Files", "*" },
pfd::opt::multiselect).result();
// Do something with selection
for (auto const &filename : dialog.result())
std::cout << "Selected file: " << filename << "\n";
```
## Example 3: asynchronous file open
Using `pfd::open_file::ready()` allows the application to perform other tasks while waiting for
user input:
```cpp
// File open dialog
auto dialog = pfd::open_file("Select file to open");
// Do something while waiting for user input
while (!dialog.ready(1000))
std::cout << "Waited 1 second for user input...\n";
// Act depending on the user choice
std::cout << "Number of selected files: " << dialog.result().size() << "\n";
```
## Screenshots
Windows 10:
![open-win32](https://user-images.githubusercontent.com/245089/47155865-0f8cd900-d2e6-11e8-8041-1e20b6f77dee.png)
Mac OS X (dark theme):
![image](https://user-images.githubusercontent.com/245089/56053378-39363280-5d54-11e9-9583-9f1c978fa0db.png)
Mac OS X (light theme):
![image](https://user-images.githubusercontent.com/245089/56053413-4fdc8980-5d54-11e9-85e3-e9e5d0e10772.png)
Linux (GNOME desktop):
![open-gnome](https://user-images.githubusercontent.com/245089/47155867-0f8cd900-d2e6-11e8-93af-275636491ec4.png)
Linux (KDE desktop):
![open-kde](https://user-images.githubusercontent.com/245089/47155866-0f8cd900-d2e6-11e8-8006-f14b948afc55.png)

120
extern/pfd-fixed/doc/pfd.md vendored Normal file
View File

@ -0,0 +1,120 @@
## Portable File Dialogs documentation
The library can be used either as a [header-only library](https://en.wikipedia.org/wiki/Header-only),
or as a [single file library](https://github.com/nothings/single_file_libs).
### Use as header-only library
Just include the main header file wherever needed:
```cpp
#include "portable-file-dialogs.h"
/* ... */
pfd::message::message("Hello", "This is a test");
/* ... */
```
### Use as a single-file library
Defining the `PFD_SKIP_IMPLEMENTATION` macro before including `portable-file-dialogs.h` will
skip all the implementation code and reduce compilation times. You still need to include the
header without the macro at least once, typically in a `pfd-impl.cpp` file.
```cpp
// In pfd-impl.cpp
#include "portable-file-dialogs.h"
```
```cpp
// In all other files
#define PFD_SKIP_IMPLEMENTATION 1
#include "portable-file-dialogs.h"
```
### General concepts
Dialogs inherit from `pfd::dialog` and are created by calling their class constructor. Their
destructor will block until the window is closed by user interaction. So for instance this
will block until the end of the line:
```cpp
pfd::message::message("Hi", "there");
```
Whereas this will only block until the end of the scope, allowing the program to perform
additional operations while the dialog is open:
```cpp
{
auto m = pfd::message::message("Hi", "there");
// ... perform asynchronous operations here
}
```
It is possible to call `bool pfd::dialog::ready(timeout)` on the dialog in order to query its
status and perform asynchronous operations as long as the user has not interacted:
```cpp
{
auto m = pfd::message::message("Hi", "there");
while (!m.ready())
{
// ... perform asynchronous operations here
}
}
```
If necessary, a dialog can be forcibly closed using `bool pfd::dialog::kill()`. Note that this
may be confusing to the user and should only be used in very specific situations. It is also not
possible to close a Windows message box that provides no _Cancel_ button.
```cpp
{
auto m = pfd::message::message("Hi", "there");
while (!m.ready())
{
// ... perform asynchronous operations here
if (too_much_time_has_passed())
m.kill();
}
}
```
Finally, the user response can be retrieved using `pfd::dialog::result()`. The return value of
this function depends on which dialog is being used. See their respective documentation for more
information:
* [`pfd::message`](message.md) (message box)
* [`pfd::notify`](notify.md) (notification)
* [`pfd::open_file`](open_file.md) (file open)
* [`pfd::save_file`](save_file.md) (file save)
* [`pfd::select_folder`](select_folder.md) (folder selection)
### Settings
The library can be queried and configured through the `pfd::settings` class.
```cpp
bool pfd::settings::available();
void pfd::settings::verbose(bool value);
void pfd::settings::rescan();
```
The return value of `pfd::settings::available()` indicates whether a suitable dialog backend (such
as Zenity or KDialog on Linux) has been found. If not, the library will not work and all dialog
invocations will be no-ops. The program will not crash but you should account for this situation
and add a fallback mechanism or exit gracefully.
Calling `pfd::settings::rescan()` will force a rescan of available backends. This may change the
result of `pfd::settings::available()` if a backend was installed on the system in the meantime.
This is probably only useful for debugging purposes.
Calling `pfd::settings::verbose(true)` may help debug the library. It will output debug information
to `std::cout` about some operations being performed.

73
extern/pfd-fixed/doc/save_file.md vendored Normal file
View File

@ -0,0 +1,73 @@
## File Open API
The `pfd::save_file` class handles file saving dialogs. It can be provided a title, a starting
directory and/or pre-selected file, an optional filter for recognised file types, and an optional
flag to allow multiple selection:
```cpp
pfd::save_file::save_file(std::string const &title,
std::string const &initial_path,
std::vector<std::string> filters = { "All Files", "*" },
pfd::opt option = pfd::opt::none);
```
The `option` parameter can be `pfd::opt::force_overwrite` to disable a potential warning when
saving to an existing file.
The selected file is queried using `pfd::save_file::result()`. If the user canceled the
operation, the returned file name is empty:
```cpp
std::string pfd::save_file::result();
```
It is possible to ask the file save dialog whether the user took action using the
`pfd::message::ready()` method, with an optional `timeout` argument. If the user did not validate
the dialog within `timeout` milliseconds, the function will return `false`:
```cpp
bool pfd::save_file::ready(int timeout = pfd::default_wait_timeout);
```
## Example 1: simple file selection
Using `pfd::save_file::result()` will wait for user action before returning. This operation will
block and return the user choice:
```cpp
auto destination = pfd::save_file("Select a file").result();
if (!destination.empty())
std::cout << "User selected file " << destination << "\n";
```
## Example 2: filters
The filter list enumerates filter names and corresponded space-separated wildcard lists. It
defaults to `{ "All Files", "*" }`, but here is how to use other options:
```cpp
auto destination = pfd::save_file("Select a file", ".",
{ "Image Files", "*.png *.jpg *.jpeg *.bmp",
"Audio Files", "*.wav *.mp3",
"All Files", "*" },
pfd::opt::force_overwrite).result();
// Do something with destination
std::cout << "Selected file: " << destination << "\n";
```
## Example 3: asynchronous file save
Using `pfd::save_file::ready()` allows the application to perform other tasks while waiting for
user input:
```cpp
// File save dialog
auto dialog = pfd::save_file("Select file to save");
// Do something while waiting for user input
while (!dialog.ready(1000))
std::cout << "Waited 1 second for user input...\n";
// Act depending on the user choice
std::cout << "User selected file: " << dialog.result() << "\n";
```

55
extern/pfd-fixed/doc/select_folder.md vendored Normal file
View File

@ -0,0 +1,55 @@
## Folder Selection API
The `pfd::select_folder` class handles folder opening dialogs. It can be provided a title, and an
optional starting directory:
```cpp
pfd::select_folder::select_folder(std::string const &title,
std::string const &default_path = "",
pfd::opt option = pfd::opt::none);
```
The `option` parameter can be `pfd::opt::force_path` to force the operating system to use the
provided path. Some systems default to the most recently used path, if applicable.
The selected folder is queried using `pfd::select_folder::result()`. If the user canceled the
operation, the returned string is empty:
```cpp
std::string pfd::select_folder::result();
```
It is possible to ask the folder selection dialog whether the user took action using the
`pfd::message::ready()` method, with an optional `timeout` argument. If the user did not validate
the dialog within `timeout` milliseconds, the function will return `false`:
```cpp
bool pfd::select_folder::ready(int timeout = pfd::default_wait_timeout);
```
## Example 1: simple folder selection
Using `pfd::select_folder::result()` will wait for user action before returning. This operation
will block and return the user choice:
```cpp
auto selection = pfd::select_folder("Select a folder").result();
if (!selection.empty())
std::cout << "User selected folder " << selection << "\n";
```
## Example 2: asynchronous folder open
Using `pfd::select_folder::ready()` allows the application to perform other tasks while waiting for user input:
```cpp
// Folder selection dialog
auto dialog = pfd::select_folder("Select folder to open");
// Do something while waiting for user input
while (!dialog.ready(1000))
std::cout << "Waited 1 second for user input...\n";
// Act depending on the user choice
std::cout << "Selected folder: " << dialog.result() << "\n";
```

11
extern/pfd-fixed/examples/.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
example
example.exe
kill
kill.exe
Debug
Release
*.vcxproj.user
.idea
cmake-build-*

110
extern/pfd-fixed/examples/example.cpp vendored Normal file
View File

@ -0,0 +1,110 @@
//
// Portable File Dialogs
//
// Copyright © 2018—2020 Sam Hocevar <sam@hocevar.net>
//
// This program is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//
#include "portable-file-dialogs.h"
#include <iostream>
#if _WIN32
#define DEFAULT_PATH "C:\\"
#else
#define DEFAULT_PATH "/tmp"
#endif
int main()
{
// Check that a backend is available
if (!pfd::settings::available())
{
std::cout << "Portable File Dialogs are not available on this platform.\n";
return 1;
}
// Set verbosity to true
pfd::settings::verbose(true);
// Notification
pfd::notify("Important Notification",
"This is ' a message, pay \" attention \\ to it!",
pfd::icon::info);
// Message box with nice message
auto m = pfd::message("Personal Message",
"You are an amazing person, dont let anyone make you think otherwise.",
pfd::choice::yes_no_cancel,
pfd::icon::warning);
// Optional: do something while waiting for user action
for (int i = 0; i < 10 && !m.ready(1000); ++i)
std::cout << "Waited 1 second for user input...\n";
// Do something according to the selected button
switch (m.result())
{
case pfd::button::yes: std::cout << "User agreed.\n"; break;
case pfd::button::no: std::cout << "User disagreed.\n"; break;
case pfd::button::cancel: std::cout << "User freaked out.\n"; break;
default: break; // Should not happen
}
// Directory selection
auto dir = pfd::select_folder("Select any directory", DEFAULT_PATH).result();
std::cout << "Selected dir: " << dir << "\n";
// File open
auto f = pfd::open_file("Choose files to read", DEFAULT_PATH,
{ "Text Files (.txt .text)", "*.txt *.text",
"All Files", "*" },
pfd::opt::multiselect);
std::cout << "Selected files:";
for (auto const &name : f.result())
std::cout << " " + name;
std::cout << "\n";
}
// Unused function that just tests the whole API
void api()
{
// pfd::settings
pfd::settings::verbose(true);
pfd::settings::rescan();
// pfd::notify
pfd::notify("", "");
pfd::notify("", "", pfd::icon::info);
pfd::notify("", "", pfd::icon::warning);
pfd::notify("", "", pfd::icon::error);
pfd::notify("", "", pfd::icon::question);
pfd::notify a("", "");
(void)a.ready();
(void)a.ready(42);
// pfd::message
pfd::message("", "");
pfd::message("", "", pfd::choice::ok);
pfd::message("", "", pfd::choice::ok_cancel);
pfd::message("", "", pfd::choice::yes_no);
pfd::message("", "", pfd::choice::yes_no_cancel);
pfd::message("", "", pfd::choice::retry_cancel);
pfd::message("", "", pfd::choice::abort_retry_ignore);
pfd::message("", "", pfd::choice::ok, pfd::icon::info);
pfd::message("", "", pfd::choice::ok, pfd::icon::warning);
pfd::message("", "", pfd::choice::ok, pfd::icon::error);
pfd::message("", "", pfd::choice::ok, pfd::icon::question);
pfd::message b("", "");
(void)b.ready();
(void)b.ready(42);
(void)b.result();
}

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="example.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="../portable-file-dialogs.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{10F4364D-27C4-4C74-8079-7C42971E81E7}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>example</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

42
extern/pfd-fixed/examples/kill.cpp vendored Normal file
View File

@ -0,0 +1,42 @@
//
// Portable File Dialogs
//
// Copyright © 2018—2020 Sam Hocevar <sam@hocevar.net>
//
// This program is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
// and/or modify it under the terms of the Do What the Fuck You Want
// to Public License, Version 2, as published by the WTFPL Task Force.
// See http://www.wtfpl.net/ for more details.
//
#include "portable-file-dialogs.h"
#include <cstdio>
int main()
{
// Set verbosity to true
pfd::settings::verbose(true);
// Message box with nice message
auto m = pfd::message("Upgrade software?",
"Press OK to upgrade this software.\n"
"\n"
"By default, the software will update itself\n"
"automatically in 10 seconds.",
pfd::choice::ok_cancel,
pfd::icon::warning);
// Wait for an answer for up to 10 seconds
for (int i = 0; i < 10 && !m.ready(1000); ++i)
;
// Upgrade software if user clicked OK, or if user didnt interact
bool upgrade = m.ready() ? m.result() == pfd::button::ok : m.kill();
if (upgrade)
std::cout << "Upgrading software!\n";
else
std::cout << "Not upgrading software.\n";
}

96
extern/pfd-fixed/examples/kill.vcxproj vendored Normal file
View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="kill.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="../portable-file-dialogs.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{B94D26B1-7EF7-43A2-A973-9A96A08E2E17}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>kill</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

1731
extern/pfd-fixed/portable-file-dialogs.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ fi
cd win32build
# TODO: potential Arch-ism?
i686-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-O2" -DCMAKE_CXX_FLAGS="-O2 -Wall -Wextra -Wno-unused-parameter -Werror" -DBUILD_SHARED_LIBS=OFF .. || exit 1
i686-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-O2" -DCMAKE_CXX_FLAGS="-O2 -Wall -Wextra -Wno-unused-parameter -Wno-cast-function-type -Werror" -DBUILD_SHARED_LIBS=OFF .. || exit 1
make -j8 || exit 1
i686-w64-mingw32-strip -s furnace.exe || exit 1

View File

@ -15,7 +15,7 @@ fi
cd winbuild
# TODO: potential Arch-ism?
x86_64-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-O2" -DCMAKE_CXX_FLAGS="-O2 -Wall -Wextra -Wno-unused-parameter -Werror" .. || exit 1
x86_64-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-O2" -DCMAKE_CXX_FLAGS="-O2 -Wall -Wextra -Wno-unused-parameter -Wno-cast-function-type -Werror" .. || exit 1
make -j8 || exit 1
x86_64-w64-mingw32-strip -s furnace.exe || exit 1

View File

@ -1,11 +1,7 @@
#include "fileDialog.h"
#include "ImGuiFileDialog.h"
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wcast-function-type"
#endif
#include "../../extern/pfd/portable-file-dialogs.h"
#include "../../extern/pfd-fixed/portable-file-dialogs.h"
bool FurnaceGUIFileDialog::openLoad(String header, std::vector<String> filter, String path, double dpiScale) {
if (opened) return false;

View File

@ -6581,6 +6581,9 @@ void FurnaceGUI::applyUISettings() {
if ((bigFont=ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(font_plexSans_compressed_data,font_plexSans_compressed_size,40*dpiScale))==NULL) {
logE("could not load big UI font!\n");
}
if (fileDialog!=NULL) delete fileDialog;
fileDialog=new FurnaceGUIFileDialog(settings.sysFileDialog);
}
bool FurnaceGUI::init() {

View File

@ -1091,9 +1091,6 @@ void FurnaceGUI::syncSettings() {
decodeKeyMap(noteKeys,e->getConfString("noteKeys",DEFAULT_NOTE_KEYS));
parseKeybinds();
if (fileDialog!=NULL) delete fileDialog;
fileDialog=new FurnaceGUIFileDialog(settings.sysFileDialog);
}
#define PUT_UI_COLOR(source) e->setConf(#source,(int)ImGui::GetColorU32(uiColors[source]));