mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-03 14:11:11 +00:00
prepare for the GUI!
This commit is contained in:
parent
d4fb9bac83
commit
e8ac2947ab
18 changed files with 19753 additions and 12 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -9,3 +9,6 @@
|
|||
path = extern/libsndfile
|
||||
url = https://github.com/libsndfile/libsndfile.git
|
||||
branch = master
|
||||
[submodule "extern/imgui"]
|
||||
path = extern/imgui
|
||||
url = https://github.com/ocornut/imgui.git
|
||||
|
|
|
@ -3,6 +3,12 @@ project(furnace)
|
|||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
if (ANDROID)
|
||||
set(BUILD_GUI OFF)
|
||||
else()
|
||||
set(BUILD_GUI ON)
|
||||
endif()
|
||||
|
||||
set(BUILD_TESTING OFF)
|
||||
set(BUILD_PROGRAMS OFF)
|
||||
set(BUILD_EXAMPLES OFF)
|
||||
|
@ -14,9 +20,16 @@ if (WIN32)
|
|||
add_subdirectory(extern/zlib)
|
||||
set(HAVE_SDL2 SDL2-static)
|
||||
set(HAVE_Z zlibstatic)
|
||||
include_directories(extern/zlib ${CMAKE_CURRENT_BINARY_DIR}/extern/zlib)
|
||||
include_directories(extern/imgui extern/zlib ${CMAKE_CURRENT_BINARY_DIR}/extern/zlib)
|
||||
else()
|
||||
find_library(HAVE_SDL2 SDL2)
|
||||
if (BUILD_GUI)
|
||||
set(SDL_SHARED ON)
|
||||
add_subdirectory(extern/SDL)
|
||||
include_directories(extern/SDL/include extern/imgui)
|
||||
set(HAVE_SDL2 SDL2)
|
||||
else()
|
||||
find_library(HAVE_SDL2 SDL2)
|
||||
endif()
|
||||
if (NOT APPLE)
|
||||
find_library(HAVE_JACK jack)
|
||||
endif()
|
||||
|
@ -85,17 +98,23 @@ src/engine/platform/arcade.cpp
|
|||
src/engine/platform/ym2610.cpp
|
||||
src/engine/platform/dummy.cpp)
|
||||
|
||||
#imgui/imgui.cpp
|
||||
#imgui/imgui_demo.cpp
|
||||
#imgui/imgui_draw.cpp
|
||||
#imgui/imgui_tables.cpp
|
||||
#imgui/imgui_widgets.cpp
|
||||
#imgui/backends/imgui_impl_opengl3.cpp
|
||||
#imgui/backends/imgui_impl_sdl.cpp
|
||||
#src/gui/main.cpp)
|
||||
set(GUI_SOURCES
|
||||
extern/imgui/imgui.cpp
|
||||
extern/imgui/imgui_demo.cpp
|
||||
extern/imgui/imgui_draw.cpp
|
||||
extern/imgui/imgui_tables.cpp
|
||||
extern/imgui/imgui_widgets.cpp
|
||||
extern/imgui/backends/imgui_impl_sdlrenderer.cpp
|
||||
extern/imgui/backends/imgui_impl_sdl.cpp
|
||||
extern/igfd/ImGuiFileDialog.cpp
|
||||
|
||||
add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES}
|
||||
src/main.cpp)
|
||||
src/gui/gui.cpp)
|
||||
|
||||
if (BUILD_GUI)
|
||||
add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} ${GUI_SOURCES} src/main.cpp)
|
||||
else()
|
||||
add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} src/main.cpp)
|
||||
endif()
|
||||
|
||||
target_link_libraries(furnace ${HAVE_SDL2} ${HAVE_Z} sndfile)
|
||||
|
||||
|
|
5059
extern/igfd/ImGuiFileDialog.cpp
vendored
Normal file
5059
extern/igfd/ImGuiFileDialog.cpp
vendored
Normal file
File diff suppressed because it is too large
Load diff
1594
extern/igfd/ImGuiFileDialog.h
vendored
Normal file
1594
extern/igfd/ImGuiFileDialog.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
97
extern/igfd/ImGuiFileDialogConfig.h
vendored
Normal file
97
extern/igfd/ImGuiFileDialogConfig.h
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
#pragma once
|
||||
|
||||
// uncomment and modify defines under for customize ImGuiFileDialog
|
||||
|
||||
//this options need c++17
|
||||
//#define USE_STD_FILESYSTEM
|
||||
|
||||
//#define MAX_FILE_DIALOG_NAME_BUFFER 1024
|
||||
//#define MAX_PATH_BUFFER_SIZE 1024
|
||||
|
||||
//#define USE_THUMBNAILS
|
||||
//the thumbnail generation use the stb_image and stb_resize lib who need to define the implementation
|
||||
//btw if you already use them in your app, you can have compiler error due to "implemntation found in double"
|
||||
//so uncomment these line for prevent the creation of implementation of these libs again
|
||||
//#define DONT_DEFINE_AGAIN__STB_IMAGE_IMPLEMENTATION
|
||||
//#define DONT_DEFINE_AGAIN__STB_IMAGE_RESIZE_IMPLEMENTATION
|
||||
//#define IMGUI_RADIO_BUTTON RadioButton
|
||||
//#define DisplayMode_ThumbailsList_ImageHeight 32.0f
|
||||
//#define tableHeaderFileThumbnailsString "Thumbnails"
|
||||
//#define DisplayMode_FilesList_ButtonString "FL"
|
||||
//#define DisplayMode_FilesList_ButtonHelp "File List"
|
||||
//#define DisplayMode_ThumbailsList_ButtonString "TL"
|
||||
//#define DisplayMode_ThumbailsList_ButtonHelp "Thumbnails List"
|
||||
// todo
|
||||
//#define DisplayMode_ThumbailsGrid_ButtonString "TG"
|
||||
//#define DisplayMode_ThumbailsGrid_ButtonHelp "Thumbnails Grid"
|
||||
|
||||
|
||||
//#define USE_EXPLORATION_BY_KEYS
|
||||
// this mapping by default is for GLFW but you can use another
|
||||
//#include <GLFW/glfw3.h>
|
||||
// Up key for explore to the top
|
||||
//#define IGFD_KEY_UP GLFW_KEY_UP
|
||||
// Down key for explore to the bottom
|
||||
//#define IGFD_KEY_DOWN GLFW_KEY_DOWN
|
||||
// Enter key for open directory
|
||||
//#define IGFD_KEY_ENTER GLFW_KEY_ENTER
|
||||
// BackSpace for comming back to the last directory
|
||||
//#define IGFD_KEY_BACKSPACE GLFW_KEY_BACKSPACE
|
||||
|
||||
// by ex you can quit the dialog by pressing the key excape
|
||||
//#define USE_DIALOG_EXIT_WITH_KEY
|
||||
//#define IGFD_EXIT_KEY GLFW_KEY_ESCAPE
|
||||
|
||||
// widget
|
||||
// filter combobox width
|
||||
//#define FILTER_COMBO_WIDTH 120.0f
|
||||
// button widget use for compose path
|
||||
//#define IMGUI_PATH_BUTTON ImGui::Button
|
||||
// standard button
|
||||
//#define IMGUI_BUTTON ImGui::Button
|
||||
|
||||
// locales string
|
||||
//#define createDirButtonString "+"
|
||||
//#define okButtonString " OK"
|
||||
//#define cancelButtonString " Cancel"
|
||||
//#define resetButtonString "R"
|
||||
//#define drivesButtonString "Drives"
|
||||
//#define editPathButtonString "E"
|
||||
//#define searchString "Search"
|
||||
//#define dirEntryString "[DIR] "
|
||||
//#define linkEntryString "[LINK] "
|
||||
//#define fileEntryString "[FILE] "
|
||||
//#define fileNameString "File Name : "
|
||||
//#define dirNameString "Directory Path :"
|
||||
//#define buttonResetSearchString "Reset search"
|
||||
//#define buttonDriveString "Drives"
|
||||
//#define buttonEditPathString "Edit path\nYou can also right click on path buttons"
|
||||
//#define buttonResetPathString "Reset to current directory"
|
||||
//#define buttonCreateDirString "Create Directory"
|
||||
//#define OverWriteDialogTitleString "The file Already Exist !"
|
||||
//#define OverWriteDialogMessageString "Would you like to OverWrite it ?"
|
||||
//#define OverWriteDialogConfirmButtonString "Confirm"
|
||||
//#define OverWriteDialogCancelButtonString "Cancel"
|
||||
|
||||
// DateTimeFormat
|
||||
// see strftime functionin <ctime> for customize
|
||||
// "%Y/%m/%d %H:%M" give 2021:01:22 11:47
|
||||
// "%Y/%m/%d %i:%M%p" give 2021:01:22 11:45PM
|
||||
//#define DateTimeFormat "%Y/%m/%d %i:%M%p"
|
||||
|
||||
// theses icons will appear in table headers
|
||||
//#define USE_CUSTOM_SORTING_ICON
|
||||
//#define tableHeaderAscendingIcon "A|"
|
||||
//#define tableHeaderDescendingIcon "D|"
|
||||
//#define tableHeaderFileNameString " File name"
|
||||
//#define tableHeaderFileTypeString " Type"
|
||||
//#define tableHeaderFileSizeString " Size"
|
||||
//#define tableHeaderFileDateTimeString " Date"
|
||||
|
||||
//#define USE_BOOKMARK
|
||||
//#define bookmarkPaneWith 150.0f
|
||||
//#define IMGUI_TOGGLE_BUTTON ToggleButton
|
||||
//#define bookmarksButtonString "Bookmark"
|
||||
//#define bookmarksButtonHelpString "Bookmark"
|
||||
//#define addBookmarkButtonString "+"
|
||||
//#define removeBookmarkButtonString "-"
|
21
extern/igfd/LICENSE
vendored
Normal file
21
extern/igfd/LICENSE
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018-2020 Stephane Cuillerdier (aka Aiekick)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
928
extern/igfd/README.md
vendored
Normal file
928
extern/igfd/README.md
vendored
Normal file
|
@ -0,0 +1,928 @@
|
|||
[<img src="https://github.com/aiekick/ImGuiFileDialog/workflows/Win/badge.svg" width="150"/>](https://github.com/aiekick/ImGuiFileDialog/actions?query=workflow%3AWin)
|
||||
[<img src="https://github.com/aiekick/ImGuiFileDialog/workflows/Linux/badge.svg" width="165"/>](https://github.com/aiekick/ImGuiFileDialog/actions?query=workflow%3ALinux)
|
||||
[<img src="https://github.com/aiekick/ImGuiFileDialog/workflows/Osx/badge.svg" width="150"/>](https://github.com/aiekick/ImGuiFileDialog/actions?query=workflow%3AOsx)
|
||||
|
||||
# ImGuiFileDialog
|
||||
|
||||
## Purpose
|
||||
|
||||
ImGuiFileDialog is a file selection dialog built for (and using only) [Dear ImGui](https://github.com/ocornut/imgui).
|
||||
|
||||
My primary goal was to have a custom pane with widgets according to file extension. This was not possible using other
|
||||
solutions.
|
||||
|
||||
## Structure
|
||||
|
||||
* The library is in [Lib_Only branch](https://github.com/aiekick/ImGuiFileDialog/tree/Lib_Only)
|
||||
* A demo app can be found the [master branch](https://github.com/aiekick/ImGuiFileDialog/tree/master)
|
||||
|
||||
This library is designed to be dropped into your source code rather than compiled separately.
|
||||
|
||||
From your project directory:
|
||||
|
||||
```
|
||||
mkdir lib <or 3rdparty, or externals, etc.>
|
||||
cd lib
|
||||
git clone https://github.com/aiekick/ImGuiFileDialog.git
|
||||
git checkout Lib_Only
|
||||
```
|
||||
|
||||
These commands create a `lib` directory where you can store any third-party dependencies used in your project, downloads
|
||||
the ImGuiFileDialog git repository and checks out the Lib_Only branch where the actual library code is located.
|
||||
|
||||
Add `lib/ImGuiFileDialog/ImGuiFileDialog.cpp` to your build system and include
|
||||
`lib/ImGuiFileDialog/ImGuiFileDialog.h` in your source code. ImGuiFileLib will compile with and be included directly in
|
||||
your executable file.
|
||||
|
||||
If, for example, your project uses cmake, look for a line like `add_executable(my_project_name main.cpp)`
|
||||
and change it to `add_executable(my_project_name lib/ImGuiFileDialog/ImGuiFileDialog.cpp main.cpp)`. This tells the
|
||||
compiler where to find the source code declared in `ImGuiFileDialog.h` which you included in your own source code.
|
||||
|
||||
## Requirements:
|
||||
|
||||
You must also, of course, have added [Dear ImGui](https://github.com/ocornut/imgui) to your project for this to work at
|
||||
all.
|
||||
|
||||
[dirent v1.23](https://github.com/tronkko/dirent/tree/v1.23) is required to use ImGuiFileDialog under Windows. It is
|
||||
included in the Lib_Only branch for your convenience.
|
||||
|
||||
## Features
|
||||
|
||||
- Separate system for call and display
|
||||
- Can have many function calls with different parameters for one display function, for example
|
||||
- Can create a custom pane with any widgets via function binding
|
||||
- This pane can block the validation of the dialog
|
||||
- Can also display different things according to current filter and UserDatas
|
||||
- Advanced file style for file/dir/link coloring / icons / font
|
||||
- Multi-selection (ctrl/shift + click) :
|
||||
- 0 => Infinite
|
||||
- 1 => One file (default)
|
||||
- n => n files
|
||||
- Compatible with MacOs, Linux, Windows
|
||||
- Windows version can list drives
|
||||
- Supports modal or standard dialog types
|
||||
- Select files or directories
|
||||
- Filter groups and custom filter names
|
||||
- Keyboard navigation (arrows, backspace, enter)
|
||||
- Exploring by entering characters (case insensitive)
|
||||
- Directory bookmarks
|
||||
- Directory manual entry (right click on any path element)
|
||||
- Optional 'Confirm to Overwrite" dialog if file exists
|
||||
- Thumbnails Display (agnostic way for compatibility with any backend, sucessfully tested with OpenGl and Vulkan)
|
||||
- C Api (succesfully tested with CimGui)
|
||||
|
||||
## Singleton Pattern vs. Multiple Instances
|
||||
|
||||
### Single Dialog :
|
||||
|
||||
If you only need to display one file dialog at a time, use ImGuiFileDialog's singleton pattern to avoid explicitly
|
||||
declaring an object:
|
||||
|
||||
```cpp
|
||||
ImGuiFileDialog::Instance()->method_of_your_choice();
|
||||
```
|
||||
|
||||
### Multiple Dialogs :
|
||||
|
||||
If you need to have multiple file dialogs open at once, declare each dialog explicity:
|
||||
|
||||
```cpp
|
||||
ImGuiFileDialog instance_a;
|
||||
instance_a.method_of_your_choice();
|
||||
ImGuiFileDialog instance_b;
|
||||
instance_b.method_of_your_choice();
|
||||
```
|
||||
|
||||
## Simple Dialog :
|
||||
|
||||
```cpp
|
||||
void drawGui()
|
||||
{
|
||||
// open Dialog Simple
|
||||
if (ImGui::Button("Open File Dialog"))
|
||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Choose File", ".cpp,.h,.hpp", ".");
|
||||
|
||||
// display
|
||||
if (ImGuiFileDialog::Instance()->Display("ChooseFileDlgKey"))
|
||||
{
|
||||
// action if OK
|
||||
if (ImGuiFileDialog::Instance()->IsOk())
|
||||
{
|
||||
std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName();
|
||||
std::string filePath = ImGuiFileDialog::Instance()->GetCurrentPath();
|
||||
// action
|
||||
}
|
||||
|
||||
// close
|
||||
ImGuiFileDialog::Instance()->Close();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
![alt text](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/dlg_simple.gif)
|
||||
|
||||
## Directory Chooser :
|
||||
|
||||
To have a directory chooser, set the file extension filter to nullptr:
|
||||
|
||||
```cpp
|
||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseDirDlgKey", "Choose a Directory", nullptr, ".");
|
||||
```
|
||||
|
||||
In this mode you can select any directory with one click and open a directory with a double-click.
|
||||
|
||||
![directoryChooser](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/directoryChooser.gif)
|
||||
|
||||
## Dialog with Custom Pane :
|
||||
|
||||
The signature of the custom pane callback is:
|
||||
|
||||
### for C++ :
|
||||
|
||||
```cpp
|
||||
void(const char *vFilter, IGFDUserDatas vUserDatas, bool *vCantContinue)
|
||||
```
|
||||
|
||||
### for C :
|
||||
|
||||
```c
|
||||
void(const char *vFilter, void* vUserDatas, bool *vCantContinue)
|
||||
```
|
||||
|
||||
### Example :
|
||||
|
||||
```cpp
|
||||
static bool canValidateDialog = false;
|
||||
inline void InfosPane(cosnt char *vFilter, IGFDUserDatas vUserDatas, bool *vCantContinue) // if vCantContinue is false, the user cant validate the dialog
|
||||
{
|
||||
ImGui::TextColored(ImVec4(0, 1, 1, 1), "Infos Pane");
|
||||
ImGui::Text("Selected Filter : %s", vFilter.c_str());
|
||||
if (vUserDatas)
|
||||
ImGui::Text("UserDatas : %s", vUserDatas);
|
||||
ImGui::Checkbox("if not checked you cant validate the dialog", &canValidateDialog);
|
||||
if (vCantContinue)
|
||||
*vCantContinue = canValidateDialog;
|
||||
}
|
||||
|
||||
void drawGui()
|
||||
{
|
||||
// open Dialog with Pane
|
||||
if (ImGui::Button("Open File Dialog with a custom pane"))
|
||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Choose File", ".cpp,.h,.hpp",
|
||||
".", "", std::bind(&InfosPane, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), 350, 1, UserDatas("InfosPane"));
|
||||
|
||||
// display and action if ok
|
||||
if (ImGuiFileDialog::Instance()->Display("ChooseFileDlgKey"))
|
||||
{
|
||||
if (ImGuiFileDialog::Instance()->IsOk())
|
||||
{
|
||||
std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName();
|
||||
std::string filePath = ImGuiFileDialog::Instance()->GetCurrentPath();
|
||||
std::string filter = ImGuiFileDialog::Instance()->GetCurrentFilter();
|
||||
// here convert from string because a string was passed as a userDatas, but it can be what you want
|
||||
std::string userDatas;
|
||||
if (ImGuiFileDialog::Instance()->GetUserDatas())
|
||||
userDatas = std::string((const char*)ImGuiFileDialog::Instance()->GetUserDatas());
|
||||
auto selection = ImGuiFileDialog::Instance()->GetSelection(); // multiselection
|
||||
|
||||
// action
|
||||
}
|
||||
// close
|
||||
ImGuiFileDialog::Instance()->Close();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
![alt text](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/doc/dlg_with_pane.gif)
|
||||
|
||||
## File Style : Custom icons and colors by extension
|
||||
|
||||
You can define style for files/dirs/links in many ways :
|
||||
|
||||
the style can be colors, icons and fonts
|
||||
|
||||
the general form is :
|
||||
```cpp
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(styleType, criteria, color, icon, font);
|
||||
|
||||
styleType can be thoses :
|
||||
|
||||
IGFD_FileStyleByTypeFile // define style for all files
|
||||
IGFD_FileStyleByTypeDir // define style for all dir
|
||||
IGFD_FileStyleByTypeLink // define style for all link
|
||||
IGFD_FileStyleByExtention // define style by extention, for files or links
|
||||
IGFD_FileStyleByFullName // define style for particular file/dir/link full name (filename + extention)
|
||||
IGFD_FileStyleByContainedInFullName // define style for file/dir/link when criteria is contained in full name
|
||||
```
|
||||
|
||||
ImGuiFileDialog accepts icon font macros as well as text tags for file types.
|
||||
|
||||
[ImGuIFontStudio](https://github.com/aiekick/ImGuiFontStudio) is useful here. I wrote it to make it easy to create
|
||||
custom icon sets for use with Dear ImGui.
|
||||
|
||||
It is inspired by [IconFontCppHeaders](https://github.com/juliettef/IconFontCppHeaders), which can also be used with
|
||||
ImGuiFileDialog.
|
||||
|
||||
samples :
|
||||
|
||||
```cpp
|
||||
// define style by file extention and Add an icon for .png files
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtention, ".png", ImVec4(0.0f, 1.0f, 1.0f, 0.9f), ICON_IGFD_FILE_PIC, font1);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtention, ".gif", ImVec4(0.0f, 1.0f, 0.5f, 0.9f), "[GIF]");
|
||||
|
||||
// define style for all directories
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeDir, "", ImVec4(0.5f, 1.0f, 0.9f, 0.9f), ICON_IGFD_FOLDER);
|
||||
// can be for a specific directory
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeDir, ".git", ImVec4(0.5f, 1.0f, 0.9f, 0.9f), ICON_IGFD_FOLDER);
|
||||
|
||||
// define style for all files
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeFile, "", ImVec4(0.5f, 1.0f, 0.9f, 0.9f), ICON_IGFD_FILE);
|
||||
// can be for a specific file
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeFile, ".git", ImVec4(0.5f, 1.0f, 0.9f, 0.9f), ICON_IGFD_FILE);
|
||||
|
||||
// define style for all links
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeLink, "", ImVec4(0.5f, 1.0f, 0.9f, 0.9f));
|
||||
// can be for a specific link
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeLink, "Readme.md", ImVec4(0.5f, 1.0f, 0.9f, 0.9f));
|
||||
|
||||
// define style for any files/dirs/links by fullname
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByFullName, "doc", ImVec4(0.9f, 0.2f, 0.0f, 0.9f), ICON_IGFD_FILE_PIC);
|
||||
|
||||
// define style by file who are containing this string
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByContainedInFullName, ".git", ImVec4(0.9f, 0.2f, 0.0f, 0.9f), ICON_IGFD_BOOKMARK);
|
||||
|
||||
all of theses can be miwed with IGFD_FileStyleByTypeDir / IGFD_FileStyleByTypeFile / IGFD_FileStyleByTypeLink
|
||||
like theses by ex :
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeDir | IGFD_FileStyleByContainedInFullName, ".git", ImVec4(0.9f, 0.2f, 0.0f, 0.9f), ICON_IGFD_BOOKMARK);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeFile | IGFD_FileStyleByFullName, "cmake", ImVec4(0.5f, 0.8f, 0.5f, 0.9f), ICON_IGFD_SAVE);
|
||||
```
|
||||
|
||||
this sample code of [master/main.cpp](https://github.com/aiekick/ImGuiFileDialog/blob/master/main.cpp) produce the picture above :
|
||||
|
||||
```cpp
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtention, ".cpp", ImVec4(1.0f, 1.0f, 0.0f, 0.9f));
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtention, ".h", ImVec4(0.0f, 1.0f, 0.0f, 0.9f));
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtention, ".hpp", ImVec4(0.0f, 0.0f, 1.0f, 0.9f));
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtention, ".md", ImVec4(1.0f, 0.0f, 1.0f, 0.9f));
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtention, ".png", ImVec4(0.0f, 1.0f, 1.0f, 0.9f), ICON_IGFD_FILE_PIC); // add an icon for the filter type
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtention, ".gif", ImVec4(0.0f, 1.0f, 0.5f, 0.9f), "[GIF]"); // add an text for a filter type
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeDir, nullptr, ImVec4(0.5f, 1.0f, 0.9f, 0.9f), ICON_IGFD_FOLDER); // for all dirs
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeFile, "CMakeLists.txt", ImVec4(0.1f, 0.5f, 0.5f, 0.9f), ICON_IGFD_ADD);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByFullName, "doc", ImVec4(0.9f, 0.2f, 0.0f, 0.9f), ICON_IGFD_FILE_PIC);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeDir | IGFD_FileStyleByContainedInFullName, ".git", ImVec4(0.9f, 0.2f, 0.0f, 0.9f), ICON_IGFD_BOOKMARK);
|
||||
ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByTypeFile | IGFD_FileStyleByContainedInFullName, ".git", ImVec4(0.5f, 0.8f, 0.5f, 0.9f), ICON_IGFD_SAVE);
|
||||
```
|
||||
|
||||
![alt text](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/color_filter.png)
|
||||
|
||||
## Filter Collections
|
||||
|
||||
You can define a custom filter name that corresponds to a group of filters using this syntax:
|
||||
|
||||
```custom_name1{filter1,filter2,filter3},custom_name2{filter1,filter2},filter1```
|
||||
|
||||
When you select custom_name1, filters 1 to 3 will be applied. The characters `{` and `}` are reserved. Don't use them
|
||||
for filter names.
|
||||
|
||||
this code :
|
||||
|
||||
```cpp
|
||||
const char *filters = "Source files (*.cpp *.h *.hpp){.cpp,.h,.hpp},Image files (*.png *.gif *.jpg *.jpeg){.png,.gif,.jpg,.jpeg},.md";
|
||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", ICON_IMFDLG_FOLDER_OPEN " Choose a File", filters, ".");
|
||||
```
|
||||
|
||||
will produce :
|
||||
![alt text](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/collectionFilters.gif)
|
||||
|
||||
## Multi Selection
|
||||
|
||||
You can define in OpenDialog/OpenModal call the count file you want to select :
|
||||
|
||||
- 0 => infinite
|
||||
- 1 => one file only (default)
|
||||
- n => n files only
|
||||
|
||||
See the define at the end of these funcs after path.
|
||||
|
||||
```cpp
|
||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Choose File", ".*,.cpp,.h,.hpp", ".");
|
||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Choose 1 File", ".*,.cpp,.h,.hpp", ".", 1);
|
||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Choose 5 File", ".*,.cpp,.h,.hpp", ".", 5);
|
||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Choose many File", ".*,.cpp,.h,.hpp", ".", 0);
|
||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Choose File", ".png,.jpg",
|
||||
".", "", std::bind(&InfosPane, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), 350, 1, "SaveFile"); // 1 file
|
||||
```
|
||||
|
||||
![alt text](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/multiSelection.gif)
|
||||
|
||||
## File Dialog Constraints
|
||||
|
||||
You can set the minimum and/or maximum size of the dialog:
|
||||
|
||||
```cpp
|
||||
ImVec2 maxSize = ImVec2((float)display_w, (float)display_h); // The full display area
|
||||
ImVec2 minSize = maxSize * 0.5f; // Half the display area
|
||||
ImGuiFileDialog::Instance()->Display("ChooseFileDlgKey", ImGuiWindowFlags_NoCollapse, minSize, maxSize);
|
||||
```
|
||||
|
||||
![alt text](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/dialog_constraints.gif)
|
||||
|
||||
## Detail View Mode
|
||||
|
||||
Dear ImGui just released an improved table API. If your downloaded version of Dear ImGui includes the beta version of
|
||||
table support (included for some time now) you can enable table support by uncommenting `#define USE_IMGUI_TABLES` in
|
||||
you custom config file (CustomImGuiFileDialogConfig.h)
|
||||
|
||||
If your version of Dear ImGui has finalized tables support, it will be enabled by default.
|
||||
![alt text](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/imgui_tables_branch.gif)
|
||||
|
||||
## Exploring by keys
|
||||
|
||||
You can activate this feature by uncommenting `#define USE_EXPLORATION_BY_KEYS`
|
||||
in your custom config file (CustomImGuiFileDialogConfig.h)
|
||||
|
||||
You can also uncomment the next lines to define navigation keys:
|
||||
|
||||
* IGFD_KEY_UP => Up key for explore to the top
|
||||
* IGFD_KEY_DOWN => Down key for explore to the bottom
|
||||
* IGFD_KEY_ENTER => Enter key for open directory
|
||||
* IGFD_KEY_BACKSPACE => BackSpace for comming back to the last directory
|
||||
|
||||
You can also jump to a point in the file list by pressing the corresponding key of the first filename character.
|
||||
|
||||
![alt text](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/explore_ny_keys.gif)
|
||||
|
||||
As you see the current item is flashed by default for 1 second. You can define the flashing lifetime with the function
|
||||
|
||||
```cpp
|
||||
ImGuiFileDialog::Instance()->SetFlashingAttenuationInSeconds(1.0f);
|
||||
```
|
||||
|
||||
## Bookmarks
|
||||
|
||||
You can create/edit/call path bookmarks and load/save them.
|
||||
|
||||
Activate this feature by uncommenting: `#define USE_BOOKMARK` in your custom config file (CustomImGuiFileDialogConfig.h)
|
||||
|
||||
More customization options:
|
||||
|
||||
```cpp
|
||||
#define bookmarkPaneWith 150.0f => width of the bookmark pane
|
||||
#define IMGUI_TOGGLE_BUTTON ToggleButton => customize the Toggled button (button stamp must be : (const char* label, bool *toggle)
|
||||
#define bookmarksButtonString "Bookmark" => the text in the toggle button
|
||||
#define bookmarksButtonHelpString "Bookmark" => the helper text when mouse over the button
|
||||
#define addBookmarkButtonString "+" => the button for add a bookmark
|
||||
#define removeBookmarkButtonString "-" => the button for remove the selected bookmark
|
||||
```
|
||||
|
||||
* You can select each bookmark to edit the displayed name corresponding to a path
|
||||
* Double-click on the label to apply the bookmark
|
||||
|
||||
![bookmarks.gif](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/bookmarks.gif)
|
||||
|
||||
You can also serialize/deserialize bookmarks (for example to load/save from/to a file):
|
||||
```cpp
|
||||
Load => ImGuiFileDialog::Instance()->DeserializeBookmarks(bookmarString);
|
||||
Save => std::string bookmarkString = ImGuiFileDialog::Instance()->SerializeBookmarks();
|
||||
```
|
||||
(please see example code for details)
|
||||
|
||||
## Path Edition :
|
||||
|
||||
Right clicking on any path element button allows the user to manually edit the path from that portion of the tree.
|
||||
Pressing the completion key (GLFW uses `enter` by default) validates the new path. Pressing the cancel key (GLFW
|
||||
uses`escape` by default) cancels the manual entry and restores the original path.
|
||||
|
||||
Here's the manual entry operation in action:
|
||||
![inputPathEdition.gif](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/inputPathEdition.gif)
|
||||
|
||||
## Confirm Overwrite Dialog :
|
||||
|
||||
If you want avoid overwriting files after selection, ImGuiFileDialog can show a dialog to confirm or cancel the
|
||||
operation.
|
||||
|
||||
To do so, define the flag ImGuiFileDialogFlags_ConfirmOverwrite in your call to OpenDialog/OpenModal.
|
||||
|
||||
By default this flag is not set since there is no pre-defined way to define if a dialog will be for Open or Save
|
||||
behavior. (by design! :) )
|
||||
|
||||
Example code For Standard Dialog :
|
||||
|
||||
```cpp
|
||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey",
|
||||
ICON_IGFD_SAVE " Choose a File", filters,
|
||||
".", "", 1, nullptr, ImGuiFileDialogFlags_ConfirmOverwrite);
|
||||
```
|
||||
|
||||
Example code For Modal Dialog :
|
||||
|
||||
```cpp
|
||||
ImGuiFileDialog::Instance()->OpenModal("ChooseFileDlgKey",
|
||||
ICON_IGFD_SAVE " Choose a File", filters,
|
||||
".", "", 1, nullptr, ImGuiFileDialogFlags_ConfirmOverwrite);
|
||||
```
|
||||
|
||||
This dialog will only verify the file in the file field, not with `GetSelection()`.
|
||||
|
||||
The confirmation dialog will be a non-movable modal (input blocking) dialog displayed in the middle of the current
|
||||
ImGuiFileDialog window.
|
||||
|
||||
As usual, you can customize the dialog in your custom config file (CustomImGuiFileDialogConfig.h in this example)
|
||||
|
||||
Uncomment these line for customization options:
|
||||
|
||||
```cpp
|
||||
//#define OverWriteDialogTitleString "The file Already Exist !"
|
||||
//#define OverWriteDialogMessageString "Would you like to OverWrite it ?"
|
||||
//#define OverWriteDialogConfirmButtonString "Confirm"
|
||||
//#define OverWriteDialogCancelButtonString "Cancel"
|
||||
```
|
||||
|
||||
See the result :
|
||||
|
||||
![ConfirmToOverWrite.gif](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/ConfirmToOverWrite.gif)
|
||||
|
||||
## Open / Save dialog Behavior :
|
||||
|
||||
ImGuiFileDialog uses the same code internally for Open and Save dialogs. To distinguish between them access the various
|
||||
data return functions depending on what the dialog is doing.
|
||||
|
||||
When selecting an existing file (for example, a Load or Open dialog), use
|
||||
|
||||
```cpp
|
||||
std::map<std::string, std::string> GetSelection(); // Returns selection via a map<FileName, FilePathName>
|
||||
UserDatas GetUserDatas(); // Get user data provided by the Open dialog
|
||||
```
|
||||
|
||||
To selecting a new file (for example, a Save As... dialog), use:
|
||||
|
||||
```cpp
|
||||
std::string GetFilePathName(); // Returns the content of the selection field with current file extension and current path
|
||||
std::string GetCurrentFileName(); // Returns the content of the selection field with current file extension but no path
|
||||
std::string GetCurrentPath(); // Returns current path only
|
||||
std::string GetCurrentFilter(); // The file extension
|
||||
```
|
||||
|
||||
## Thumbnails Display
|
||||
|
||||
You can now, display thumbnails of pictures.
|
||||
|
||||
![thumbnails.gif](https://github.com/aiekick/ImGuiFileDialog/blob/master/doc/thumbnails.gif)
|
||||
|
||||
The file resize use stb/image so the following files extentions are supported :
|
||||
* .png (tested sucessfully)
|
||||
* .bmp (tested sucessfully)
|
||||
* .tga (tested sucessfully)
|
||||
* .jpg (tested sucessfully)
|
||||
* .jpeg (tested sucessfully)
|
||||
* .gif (tested sucessfully_ but not animation just first frame)
|
||||
* .psd (not tested)
|
||||
* .pic (not tested)
|
||||
* .ppm (not tested)
|
||||
* .pgm (not tested)
|
||||
|
||||
Corresponding to your backend (ex : OpenGl) you need to define two callbacks :
|
||||
* the first is a callback who will be called by ImGuiFileDialog for create the backend texture
|
||||
* the second is a callback who will be called by ImGuiFileDialog for destroy the backend texture
|
||||
|
||||
After that you need to call the function who is responsible to create / destroy the textures.
|
||||
this function must be called in your GPU Rendering zone for avoid destroying of used texture.
|
||||
if you do that at the same place of your imgui code, some backend can crash your app, by ex with vulkan.
|
||||
|
||||
ex, for opengl :
|
||||
|
||||
```cpp
|
||||
// Create thumbnails texture
|
||||
ImGuiFileDialog::Instance()->SetCreateThumbnailCallback([](IGFD_Thumbnail_Info *vThumbnail_Info) -> void
|
||||
{
|
||||
if (vThumbnail_Info &&
|
||||
vThumbnail_Info->isReadyToUpload &&
|
||||
vThumbnail_Info->textureFileDatas)
|
||||
{
|
||||
GLuint textureId = 0;
|
||||
glGenTextures(1, &textureId);
|
||||
vThumbnail_Info->textureID = (void*)textureId;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, textureId);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
||||
(GLsizei)vThumbnail_Info->textureWidth, (GLsizei)vThumbnail_Info->textureHeight,
|
||||
0, GL_RGBA, GL_UNSIGNED_BYTE, vThumbnail_Info->textureFileDatas);
|
||||
glFinish();
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
delete[] vThumbnail_Info->textureFileDatas;
|
||||
vThumbnail_Info->textureFileDatas = nullptr;
|
||||
|
||||
vThumbnail_Info->isReadyToUpload = false;
|
||||
vThumbnail_Info->isReadyToDisplay = true;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
```cpp
|
||||
// Destroy thumbnails texture
|
||||
ImGuiFileDialog::Instance()->SetDestroyThumbnailCallback([](IGFD_Thumbnail_Info* vThumbnail_Info)
|
||||
{
|
||||
if (vThumbnail_Info)
|
||||
{
|
||||
GLuint texID = (GLuint)vThumbnail_Info->textureID;
|
||||
glDeleteTextures(1, &texID);
|
||||
glFinish();
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
```cpp
|
||||
// GPU Rendering Zone // To call for Create/ Destroy Textures
|
||||
ImGuiFileDialog::Instance()->ManageGPUThumbnails();
|
||||
```
|
||||
|
||||
## How to Integrate ImGuiFileDialog in your project
|
||||
|
||||
### Customize ImGuiFileDialog :
|
||||
|
||||
You can customize many aspects of ImGuiFileDialog by overriding `ImGuiFileDialogConfig.h`.
|
||||
|
||||
To enable your customizations, define the preprocessor directive CUSTOM_IMGUIFILEDIALOG_CONFIG with the path of your
|
||||
custom config file. This path must be relative to the directory where you put the ImGuiFileDialog module.
|
||||
|
||||
This operation is demonstrated in `CustomImGuiFileDialog.h` in the example project to:
|
||||
|
||||
* Have a custom icon font instead of labels for buttons or message titles
|
||||
* Customize the button text (the button call signature must be the same, by the way! :)
|
||||
|
||||
The custom icon font used in the example code ([CustomFont.cpp](CustomFont.cpp) and [CustomFont.h](CustomFont.h)) was made
|
||||
with [ImGuiFontStudio](https://github.com/aiekick/ImGuiFontStudio), which I wrote. :)
|
||||
|
||||
ImGuiFontStudio uses ImGuiFileDialog! Check it out.
|
||||
|
||||
## Api's C/C++ :
|
||||
|
||||
### C++.
|
||||
|
||||
this is the base API :
|
||||
|
||||
```cpp
|
||||
static FileDialog* Instance() // Singleton for easier accces form anywhere but only one dialog at a time
|
||||
|
||||
FileDialog(); // ImGuiFileDialog Constructor. can be used for have many dialog at same tiem (not possible with singleton)
|
||||
|
||||
// standard dialog
|
||||
void OpenDialog( // open simple dialog (path and fileName can be specified)
|
||||
const std::string& vKey, // key dialog
|
||||
const std::string& vTitle, // title
|
||||
const char* vFilters, // filters
|
||||
const std::string& vPath, // path
|
||||
const std::string& vFileName, // defaut file name
|
||||
const int& vCountSelectionMax = 1, // count selection max
|
||||
UserDatas vUserDatas = nullptr, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags = 0); // ImGuiFileDialogFlags
|
||||
|
||||
void OpenDialog( // open simple dialog (path and filename are obtained from filePathName)
|
||||
const std::string& vKey, // key dialog
|
||||
const std::string& vTitle, // title
|
||||
const char* vFilters, // filters
|
||||
const std::string& vFilePathName, // file path name (will be decompsoed in path and fileName)
|
||||
const int& vCountSelectionMax = 1, // count selection max
|
||||
UserDatas vUserDatas = nullptr, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags = 0); // ImGuiFileDialogFlags
|
||||
|
||||
// with pane
|
||||
void OpenDialog( // open dialog with custom right pane (path and fileName can be specified)
|
||||
const std::string& vKey, // key dialog
|
||||
const std::string& vTitle, // title
|
||||
const char* vFilters, // filters
|
||||
const std::string& vPath, // path
|
||||
const std::string& vFileName, // defaut file name
|
||||
const PaneFun& vSidePane, // side pane
|
||||
const float& vSidePaneWidth = 250.0f, // side pane width
|
||||
const int& vCountSelectionMax = 1, // count selection max
|
||||
UserDatas vUserDatas = nullptr, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags = 0); // ImGuiFileDialogFlags
|
||||
|
||||
void OpenDialog( // open dialog with custom right pane (path and filename are obtained from filePathName)
|
||||
const std::string& vKey, // key dialog
|
||||
const std::string& vTitle, // title
|
||||
const char* vFilters, // filters
|
||||
const std::string& vFilePathName, // file path name (will be decompsoed in path and fileName)
|
||||
const PaneFun& vSidePane, // side pane
|
||||
const float& vSidePaneWidth = 250.0f, // side pane width
|
||||
const int& vCountSelectionMax = 1, // count selection max
|
||||
UserDatas vUserDatas = nullptr, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags = 0); // ImGuiFileDialogFlags
|
||||
|
||||
// modal dialog
|
||||
void OpenModal( // open simple modal (path and fileName can be specified)
|
||||
const std::string& vKey, // key dialog
|
||||
const std::string& vTitle, // title
|
||||
const char* vFilters, // filters
|
||||
const std::string& vPath, // path
|
||||
const std::string& vFileName, // defaut file name
|
||||
const int& vCountSelectionMax = 1, // count selection max
|
||||
UserDatas vUserDatas = nullptr, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags = 0); // ImGuiFileDialogFlags
|
||||
|
||||
void OpenModal( // open simple modal (path and fielname are obtained from filePathName)
|
||||
const std::string& vKey, // key dialog
|
||||
const std::string& vTitle, // title
|
||||
const char* vFilters, // filters
|
||||
const std::string& vFilePathName, // file path name (will be decompsoed in path and fileName)
|
||||
const int& vCountSelectionMax = 1, // count selection max
|
||||
UserDatas vUserDatas = nullptr, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags = 0); // ImGuiFileDialogFlags
|
||||
|
||||
// with pane
|
||||
void OpenModal( // open modal with custom right pane (path and filename are obtained from filePathName)
|
||||
const std::string& vKey, // key dialog
|
||||
const std::string& vTitle, // title
|
||||
const char* vFilters, // filters
|
||||
const std::string& vPath, // path
|
||||
const std::string& vFileName, // defaut file name
|
||||
const PaneFun& vSidePane, // side pane
|
||||
const float& vSidePaneWidth = 250.0f, // side pane width
|
||||
const int& vCountSelectionMax = 1, // count selection max
|
||||
UserDatas vUserDatas = nullptr, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags = 0); // ImGuiFileDialogFlags
|
||||
|
||||
void OpenModal( // open modal with custom right pane (path and fielname are obtained from filePathName)
|
||||
const std::string& vKey, // key dialog
|
||||
const std::string& vTitle, // title
|
||||
const char* vFilters, // filters
|
||||
const std::string& vFilePathName, // file path name (will be decompsoed in path and fileName)
|
||||
const PaneFun& vSidePane, // side pane
|
||||
const float& vSidePaneWidth = 250.0f, // side pane width
|
||||
const int& vCountSelectionMax = 1, // count selection max
|
||||
UserDatas vUserDatas = nullptr, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags = 0); // ImGuiFileDialogFlags
|
||||
|
||||
// Display / Close dialog form
|
||||
bool Display( // Display the dialog. return true if a result was obtained (Ok or not)
|
||||
const std::string& vKey, // key dialog to display (if not the same key as defined by OpenDialog/Modal => no opening)
|
||||
ImGuiWindowFlags vFlags = ImGuiWindowFlags_NoCollapse, // ImGuiWindowFlags
|
||||
ImVec2 vMinSize = ImVec2(0, 0), // mininmal size contraint for the ImGuiWindow
|
||||
ImVec2 vMaxSize = ImVec2(FLT_MAX, FLT_MAX)); // maximal size contraint for the ImGuiWindow
|
||||
void Close(); // close dialog
|
||||
|
||||
// queries
|
||||
bool WasOpenedThisFrame(const std::string& vKey); // say if the dialog key was already opened this frame
|
||||
bool WasOpenedThisFrame(); // say if the dialog was already opened this frame
|
||||
bool IsOpened(const std::string& vKey); // say if the key is opened
|
||||
bool IsOpened(); // say if the dialog is opened somewhere
|
||||
std::string GetOpenedKey(); // return the dialog key who is opened, return nothing if not opened
|
||||
|
||||
// get result
|
||||
bool IsOk(); // true => Dialog Closed with Ok result / false : Dialog closed with cancel result
|
||||
std::map<std::string, std::string> GetSelection(); // Open File behavior : will return selection via a map<FileName, FilePathName>
|
||||
std::string GetFilePathName(); // Save File behavior : will always return the content of the field with current filter extention and current path
|
||||
std::string GetCurrentFileName(); // Save File behavior : will always return the content of the field with current filter extention
|
||||
std::string GetCurrentPath(); // will return current path
|
||||
std::string GetCurrentFilter(); // will return selected filter
|
||||
UserDatas GetUserDatas(); // will return user datas send with Open Dialog/Modal
|
||||
|
||||
// extentions displaying
|
||||
void SetExtentionInfos( // SetExtention datas for have custom display of particular file type
|
||||
const std::string& vFilter, // extention filter to tune
|
||||
const FileExtentionInfosStruct& vInfos); // Filter Extention Struct who contain Color and Icon/Text for the display of the file with extention filter
|
||||
void SetExtentionInfos( // SetExtention datas for have custom display of particular file type
|
||||
const std::string& vFilter, // extention filter to tune
|
||||
const ImVec4& vColor, // wanted color for the display of the file with extention filter
|
||||
const std::string& vIcon = ""); // wanted text or icon of the file with extention filter
|
||||
bool GetExtentionInfos( // GetExtention datas. return true is extention exist
|
||||
const std::string& vFilter, // extention filter (same as used in SetExtentionInfos)
|
||||
ImVec4 *vOutColor, // color to retrieve
|
||||
std::string* vOutIcon = 0); // icon or text to retrieve
|
||||
void ClearExtentionInfos(); // clear extentions setttings
|
||||
|
||||
feature : USE_EXPLORATION_BY_KEYS
|
||||
void SetFlashingAttenuationInSeconds( // set the flashing time of the line in file list when use exploration keys
|
||||
float vAttenValue); // set the attenuation (from flashed to not flashed) in seconds
|
||||
|
||||
feature : USE_BOOKMARK
|
||||
std::string SerializeBookmarks(); // serialize bookmarks : return bookmark buffer to save in a file
|
||||
void DeserializeBookmarks( // deserialize bookmarks : load bookmar buffer to load in the dialog (saved from previous use with SerializeBookmarks())
|
||||
const std::string& vBookmarks); // bookmark buffer to load
|
||||
|
||||
feature : USE_THUMBNAILS
|
||||
void SetCreateThumbnailCallback(const CreateThumbnailFun vCreateThumbnailFun); // define the texture creation callback
|
||||
void SetDestroyThumbnailCallback(const DestroyThumbnailFun vCreateThumbnailFun); // define the texture destroy callback
|
||||
void ManageGPUThumbnails(); // in gpu rendering zone, whill create or destroy textures
|
||||
```
|
||||
|
||||
### C Api
|
||||
|
||||
this api was sucessfully tested with CImGui
|
||||
|
||||
```cpp
|
||||
struct IGFD_Selection_Pair
|
||||
{
|
||||
char* fileName;
|
||||
char* filePathName;
|
||||
};
|
||||
|
||||
IMGUIFILEDIALOG_API IGFD_Selection_Pair IGFD_Selection_Pair_Get(); // return an initialized IGFD_Selection_Pair
|
||||
IMGUIFILEDIALOG_API void IGFD_Selection_Pair_DestroyContent(
|
||||
IGFD_Selection_Pair *vSelection_Pair); // destroy the content of a IGFD_Selection_Pair
|
||||
|
||||
struct IGFD_Selection
|
||||
{
|
||||
IGFD_Selection_Pair* table;
|
||||
size_t count;
|
||||
};
|
||||
|
||||
IMGUIFILEDIALOG_API IGFD_Selection IGFD_Selection_Get(); // return an initialized IGFD_Selection
|
||||
IMGUIFILEDIALOG_API void IGFD_Selection_DestroyContent(
|
||||
IGFD_Selection* vSelection); // destroy the content of a IGFD_Selection
|
||||
|
||||
// constructor / destructor
|
||||
IMGUIFILEDIALOG_API ImGuiFileDialog* IGFD_Create(void); // create the filedialog context
|
||||
IMGUIFILEDIALOG_API void IGFD_Destroy(ImGuiFileDialog *vContext); // destroy the filedialog context
|
||||
|
||||
typedef void (*IGFD_PaneFun)(const char*, void*, bool*); // callback fucntion for display the pane
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_OpenDialog( // open a standard dialog
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vKey, // key dialog
|
||||
const char* vTitle, // title
|
||||
const char* vFilters, // filters/filter collections. set it to null for directory mode
|
||||
const char* vPath, // path
|
||||
const char* vFileName, // defaut file name
|
||||
const int vCountSelectionMax, // count selection max
|
||||
void* vUserDatas, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags); // ImGuiFileDialogFlags
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_OpenDialog2( // open a standard dialog
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vKey, // key dialog
|
||||
const char* vTitle, // title
|
||||
const char* vFilters, // filters/filter collections. set it to null for directory mode
|
||||
const char* vFilePathName, // defaut file path name (path and filename witl be extracted from it)
|
||||
const int vCountSelectionMax, // count selection max
|
||||
void* vUserDatas, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags); // ImGuiFileDialogFlags
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_OpenPaneDialog( // open a standard dialog with pane
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vKey, // key dialog
|
||||
const char* vTitle, // title
|
||||
const char* vFilters, // filters/filter collections. set it to null for directory mode
|
||||
const char* vPath, // path
|
||||
const char* vFileName, // defaut file name
|
||||
const IGFD_PaneFun vSidePane, // side pane
|
||||
const float vSidePaneWidth, // side pane base width
|
||||
const int vCountSelectionMax, // count selection max
|
||||
void* vUserDatas, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags); // ImGuiFileDialogFlags
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_OpenPaneDialog2( // open a standard dialog with pane
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vKey, // key dialog
|
||||
const char* vTitle, // title
|
||||
const char* vFilters, // filters/filter collections. set it to null for directory mode
|
||||
const char* vFilePathName, // defaut file name (path and filename witl be extracted from it)
|
||||
const IGFD_PaneFun vSidePane, // side pane
|
||||
const float vSidePaneWidth, // side pane base width
|
||||
const int vCountSelectionMax, // count selection max
|
||||
void* vUserDatas, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags); // ImGuiFileDialogFlags
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_OpenModal( // open a modal dialog
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vKey, // key dialog
|
||||
const char* vTitle, // title
|
||||
const char* vFilters, // filters/filter collections. set it to null for directory mode
|
||||
const char* vPath, // path
|
||||
const char* vFileName, // defaut file name
|
||||
const int vCountSelectionMax, // count selection max
|
||||
void* vUserDatas, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags); // ImGuiFileDialogFlags
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_OpenModal2( // open a modal dialog
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vKey, // key dialog
|
||||
const char* vTitle, // title
|
||||
const char* vFilters, // filters/filter collections. set it to null for directory mode
|
||||
const char* vFilePathName, // defaut file name (path and filename witl be extracted from it)
|
||||
const int vCountSelectionMax, // count selection max
|
||||
void* vUserDatas, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags); // ImGuiFileDialogFlags
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_OpenPaneModal( // open a modal dialog with pane
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vKey, // key dialog
|
||||
const char* vTitle, // title
|
||||
const char* vFilters, // filters/filter collections. set it to null for directory mode
|
||||
const char* vPath, // path
|
||||
const char* vFileName, // defaut file name
|
||||
const IGFD_PaneFun vSidePane, // side pane
|
||||
const float vSidePaneWidth, // side pane base width
|
||||
const int vCountSelectionMax, // count selection max
|
||||
void* vUserDatas, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags); // ImGuiFileDialogFlags
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_OpenPaneModal2( // open a modal dialog with pane
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vKey, // key dialog
|
||||
const char* vTitle, // title
|
||||
const char* vFilters, // filters/filter collections. set it to null for directory mode
|
||||
const char* vFilePathName, // defaut file name (path and filename witl be extracted from it)
|
||||
const IGFD_PaneFun vSidePane, // side pane
|
||||
const float vSidePaneWidth, // side pane base width
|
||||
const int vCountSelectionMax, // count selection max
|
||||
void* vUserDatas, // user datas (can be retrieved in pane)
|
||||
ImGuiFileDialogFlags vFlags); // ImGuiFileDialogFlags
|
||||
|
||||
IMGUIFILEDIALOG_API bool IGFD_DisplayDialog( // Display the dialog
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vKey, // key dialog to display (if not the same key as defined by OpenDialog/Modal => no opening)
|
||||
ImGuiWindowFlags vFlags, // ImGuiWindowFlags
|
||||
ImVec2 vMinSize, // mininmal size contraint for the ImGuiWindow
|
||||
ImVec2 vMaxSize); // maximal size contraint for the ImGuiWindow
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_CloseDialog( // Close the dialog
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
IMGUIFILEDIALOG_API bool IGFD_IsOk( // true => Dialog Closed with Ok result / false : Dialog closed with cancel result
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
IMGUIFILEDIALOG_API bool IGFD_WasKeyOpenedThisFrame( // say if the dialog key was already opened this frame
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vKey);
|
||||
|
||||
IMGUIFILEDIALOG_API bool IGFD_WasOpenedThisFrame( // say if the dialog was already opened this frame
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
IMGUIFILEDIALOG_API bool IGFD_IsKeyOpened( // say if the dialog key is opened
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vCurrentOpenedKey); // the dialog key
|
||||
|
||||
IMGUIFILEDIALOG_API bool IGFD_IsOpened( // say if the dialog is opened somewhere
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
IMGUIFILEDIALOG_API IGFD_Selection IGFD_GetSelection( // Open File behavior : will return selection via a map<FileName, FilePathName>
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
IMGUIFILEDIALOG_API char* IGFD_GetFilePathName( // Save File behavior : will always return the content of the field with current filter extention and current path
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
IMGUIFILEDIALOG_API char* IGFD_GetCurrentFileName( // Save File behavior : will always return the content of the field with current filter extention
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
IMGUIFILEDIALOG_API char* IGFD_GetCurrentPath( // will return current path
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
IMGUIFILEDIALOG_API char* IGFD_GetCurrentFilter( // will return selected filter
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
IMGUIFILEDIALOG_API void* IGFD_GetUserDatas( // will return user datas send with Open Dialog/Modal
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_SetExtentionInfos( // SetExtention datas for have custom display of particular file type
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vFilter, // extention filter to tune
|
||||
ImVec4 vColor, // wanted color for the display of the file with extention filter
|
||||
const char* vIconText); // wanted text or icon of the file with extention filter (can be sued with font icon)
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_SetExtentionInfos2( // SetExtention datas for have custom display of particular file type
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vFilter, // extention filter to tune
|
||||
float vR, float vG, float vB, float vA, // wanted color channels RGBA for the display of the file with extention filter
|
||||
const char* vIconText); // wanted text or icon of the file with extention filter (can be sued with font icon)
|
||||
|
||||
IMGUIFILEDIALOG_API bool IGFD_GetExtentionInfos(
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vFilter, // extention filter (same as used in SetExtentionInfos)
|
||||
ImVec4* vOutColor, // color to retrieve
|
||||
char** vOutIconText); // icon or text to retrieve
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_ClearExtentionInfos( // clear extentions setttings
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
feature : USE_EXPLORATION_BY_KEYS
|
||||
IMGUIFILEDIALOG_API void IGFD_SetFlashingAttenuationInSeconds( // set the flashing time of the line in file list when use exploration keys
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
float vAttenValue); // set the attenuation (from flashed to not flashed) in seconds
|
||||
|
||||
feature : USE_BOOKMARK
|
||||
IMGUIFILEDIALOG_API char* IGFD_SerializeBookmarks( // serialize bookmarks : return bookmark buffer to save in a file
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
|
||||
IMGUIFILEDIALOG_API void IGFD_DeserializeBookmarks( // deserialize bookmarks : load bookmar buffer to load in the dialog (saved from previous use with SerializeBookmarks())
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const char* vBookmarks); // bookmark buffer to load
|
||||
|
||||
feature : USE_THUMBNAILS
|
||||
IMGUIFILEDIALOG_API void SetCreateThumbnailCallback( // define the callback for create the thumbnails texture
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const IGFD_CreateThumbnailFun vCreateThumbnailFun); // the callback for create the thumbnails texture
|
||||
|
||||
IMGUIFILEDIALOG_API void SetDestroyThumbnailCallback( // define the callback for destroy the thumbnails texture
|
||||
ImGuiFileDialog* vContext, // ImGuiFileDialog context
|
||||
const IGFD_DestroyThumbnailFun vDestroyThumbnailFun); // the callback for destroy the thumbnails texture
|
||||
|
||||
IMGUIFILEDIALOG_API void ManageGPUThumbnails( // must be call in gpu zone, possibly a thread, will call the callback for create / destroy the textures
|
||||
ImGuiFileDialog* vContext); // ImGuiFileDialog context
|
||||
```
|
129
extern/igfd/dirent/ChangeLog
vendored
Normal file
129
extern/igfd/dirent/ChangeLog
vendored
Normal file
|
@ -0,0 +1,129 @@
|
|||
2018-05-08 Toni Rönkkö
|
||||
|
||||
* Version 1.23.2: fixes bad scandir prototype.
|
||||
|
||||
2017-08-27 Toni Rönkkö
|
||||
|
||||
* Version 1.23: support readdir_r and scandir functions.
|
||||
|
||||
2017-07-18 Toni Rönkkö
|
||||
|
||||
* Created release branches v1.22 and v1.21 to Git. Published version
|
||||
1.22 at softagalleria.net.
|
||||
|
||||
2016-09-11 Toni Rönkkö
|
||||
|
||||
* Version 1.22: added support for CMake. Thanks to Paul Fultz II.
|
||||
|
||||
2014-09-25 Toni Rönkkö
|
||||
|
||||
* Version 1.21: compiles correctly under Open Watcom. Thanks to
|
||||
Virgil Banowetz for a patch!
|
||||
|
||||
2014-04-07 Toni Rönkkö
|
||||
|
||||
* Version 1.20.1: the zip file from the previous version did not open
|
||||
correctly with Microsoft's compressed folders. Thanks to Alexandre
|
||||
for info!
|
||||
|
||||
2014-03-17 Toni Ronkko
|
||||
|
||||
* Version 1.20: dirent.h compiles correctly in 64-bit architecture.
|
||||
Thanks to Aaron Simmons!
|
||||
|
||||
2014-03-03 Toni Ronkko
|
||||
|
||||
* Version 1.13.2: define DT_LNK for compatibility with Unix
|
||||
programs. Thanks to Joel Bruick for suggestion!
|
||||
|
||||
2013-01-27 Toni Ronkko
|
||||
|
||||
* Version 1.13.1: patch from Edward Berner fixes set_errno() on
|
||||
Windows NT 4.0.
|
||||
|
||||
* Revised wcstombs() and mbstowcs() wrappers to make sure that they do
|
||||
not write past their target string.
|
||||
|
||||
* PATH_MAX from windows.h includes zero terminator so there is no
|
||||
need to add one extra byte to variables and structures.
|
||||
|
||||
2012-12-12 Toni Ronkko
|
||||
|
||||
* Version 1.13: use the traditional 8+3 file naming scheme if a file
|
||||
name cannot be represented in the default ANSI code page. Now
|
||||
compiles again with MSVC 6.0. Thanks to Konstantin Khomoutov for
|
||||
testing.
|
||||
|
||||
2012-10-01 Toni Ronkko
|
||||
|
||||
* Version 1.12.1: renamed wide-character DIR structure _wDIR to
|
||||
_WDIR (with capital W) in order to maintain compatibility with MingW.
|
||||
|
||||
2012-09-30 Toni Ronkko
|
||||
|
||||
* Version 1.12: define PATH_MAX and NAME_MAX. Added wide-character
|
||||
variants _wDIR, _wdirent, _wopendir(), _wreaddir(), _wclosedir() and
|
||||
_wrewinddir(). Thanks to Edgar Buerkle and Jan Nijtmans for ideas
|
||||
and code.
|
||||
|
||||
* Now avoiding windows.h. This allows dirent.h to be integrated
|
||||
more easily into programs using winsock. Thanks to Fernando
|
||||
Azaldegui.
|
||||
|
||||
2011-03-15 Toni Ronkko
|
||||
|
||||
* Version 1.11: defined FILE_ATTRIBUTE_DEVICE for MSVC 6.0.
|
||||
|
||||
2010-08-11 Toni Ronkko
|
||||
|
||||
* Version 1.10: added d_type and d_namlen fields to dirent structure.
|
||||
The former is especially useful for determining whether directory
|
||||
entry represents a file or a directory. For more information, see
|
||||
http://www.delorie.com/gnu/docs/glibc/libc_270.html
|
||||
|
||||
* Improved conformance to the standards. For example, errno is now
|
||||
set properly on failure and assert() is never used. Thanks to Peter
|
||||
Brockam for suggestions.
|
||||
|
||||
* Fixed a bug in rewinddir(): when using relative directory names,
|
||||
change of working directory no longer causes rewinddir() to fail.
|
||||
|
||||
2009-12-15 John Cunningham
|
||||
|
||||
* Version 1.9: added rewinddir member function
|
||||
|
||||
2008-01-18 Toni Ronkko
|
||||
|
||||
* Version 1.8: Using FindFirstFileA and WIN32_FIND_DATAA to avoid
|
||||
converting string between multi-byte and unicode representations.
|
||||
This makes the code simpler and also allows the code to be compiled
|
||||
under MingW. Thanks to Azriel Fasten for the suggestion.
|
||||
|
||||
2007-03-04 Toni Ronkko
|
||||
|
||||
* Bug fix: due to the strncpy_s() function this file only compiled in
|
||||
Visual Studio 2005. Using the new string functions only when the
|
||||
compiler version allows.
|
||||
|
||||
2006-11-02 Toni Ronkko
|
||||
|
||||
* Major update: removed support for Watcom C, MS-DOS and Turbo C to
|
||||
simplify the file, updated the code to compile cleanly on Visual
|
||||
Studio 2005 with both unicode and multi-byte character strings,
|
||||
removed rewinddir() as it had a bug.
|
||||
|
||||
2006-08-20 Toni Ronkko
|
||||
|
||||
* Removed all remarks about MSVC 1.0, which is antiqued now.
|
||||
Simplified comments by removing SGML tags.
|
||||
|
||||
2002-05-14 Toni Ronkko
|
||||
|
||||
* Embedded the function definitions directly to the header so that no
|
||||
source modules need to be included in the Visual Studio project.
|
||||
Removed all the dependencies to other projects so that this header
|
||||
file can be used independently.
|
||||
|
||||
1998-05-28 Toni Ronkko
|
||||
|
||||
* First version.
|
21
extern/igfd/dirent/LICENSE
vendored
Normal file
21
extern/igfd/dirent/LICENSE
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 1998-2019 Toni Ronkko
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
96
extern/igfd/dirent/README.md
vendored
Normal file
96
extern/igfd/dirent/README.md
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
# Dirent
|
||||
Dirent is a C/C++ programming interface that allows programmers to retrieve
|
||||
information about files and directories under Linux/UNIX. This project
|
||||
provides Linux compatible Dirent interface for Microsoft Windows.
|
||||
|
||||
|
||||
# Installation
|
||||
|
||||
Download the latest Dirent installation package from
|
||||
[GitHub](https://github.com/tronkko/dirent/releases) and
|
||||
unpack the installation file with 7-zip, for example. The installation
|
||||
package contains dirent.h file as well as a few example programs and
|
||||
tests.
|
||||
|
||||
|
||||
## Install Dirent for All Programs
|
||||
|
||||
To make dirent.h available for all C/C++ programs, simply copy the
|
||||
``include/dirent.h`` file to the system include directory. System include
|
||||
directory contains header files such as assert.h and windows.h. In Visual
|
||||
Studio 2008, for example, the system include may be found at
|
||||
``C:\Program Files\Microsoft Visual Studio 9.0\VC\include``.
|
||||
|
||||
Everything you need is included in the single dirent.h file, and you can
|
||||
start using Dirent immediately -- there is no need to add files to your
|
||||
Visual Studio project.
|
||||
|
||||
|
||||
## Embed Dirent into Your Own Project
|
||||
|
||||
If you wish to distribute dirent.h alongside with your own source code, then
|
||||
copy ``include/dirent.h`` file to a new sub-directory within your project and
|
||||
add that directory to include path on Windows while omitting the directory
|
||||
under Linux/UNIX. This allows your project to be compiled against native
|
||||
dirent.h on Linux/UNIX while substituting the functionality on Microsoft
|
||||
Windows.
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
The installation package contains four example programs:
|
||||
|
||||
Program | Purpose
|
||||
-------- | -----------------------------------------------------------------
|
||||
ls | List files in a directory, e.g. ls "c:\Program Files"
|
||||
find | Find files in subdirectories, e.g. find "c:\Program Files\CMake"
|
||||
updatedb | Build database of files in a drive, e.g. updatedb c:\
|
||||
locate | Locate a file from database, e.g. locate notepad.exe
|
||||
|
||||
To build the example programs, first install [CMake](https://cmake.org/).
|
||||
Then, with CMake installed, open command prompt and create a temporary
|
||||
directory ``c:\temp\dirent`` for the build files as
|
||||
|
||||
```
|
||||
c:\
|
||||
mkdir temp
|
||||
mkdir temp\dirent
|
||||
cd temp\dirent
|
||||
```
|
||||
|
||||
Generate build files as
|
||||
|
||||
```
|
||||
cmake d:\dirent
|
||||
```
|
||||
|
||||
where ``d:\dirent`` is the root directory of the Dirent package (containing
|
||||
this README.md and LICENSE file).
|
||||
|
||||
Once CMake is finished, open Visual Studio, load the generated dirent.sln file
|
||||
from the build directory and build the solution. Once the build completes, run
|
||||
the example programs from the command prompt as
|
||||
|
||||
```
|
||||
cd Debug
|
||||
ls .
|
||||
find .
|
||||
updatedb c:\
|
||||
locate cmd.exe
|
||||
```
|
||||
|
||||
|
||||
# Copying
|
||||
|
||||
Dirent may be freely distributed under the MIT license. See the
|
||||
[LICENSE](LICENSE) file for details.
|
||||
|
||||
|
||||
# Alternatives to Dirent
|
||||
|
||||
I ported Dirent to Microsoft Windows in 1998 when only a few alternatives
|
||||
were available. However, the situation has changed since then and nowadays
|
||||
both [Cygwin](http://www.cygwin.com) and [MingW](http://www.mingw.org)
|
||||
allow you to compile a great number of UNIX programs in Microsoft Windows.
|
||||
They both provide a full dirent API as well as many other UNIX APIs. MingW
|
||||
can even be used for commercial applications!
|
1160
extern/igfd/dirent/dirent.h
vendored
Normal file
1160
extern/igfd/dirent/dirent.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
37
extern/igfd/stb/LICENSE
vendored
Normal file
37
extern/igfd/stb/LICENSE
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
This software is available under 2 licenses -- choose whichever you prefer.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE A - MIT License
|
||||
Copyright (c) 2017 Sean Barrett
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
||||
This is free and unencumbered software released into the public domain.
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
||||
software, either in source code form or as a compiled binary, for any purpose,
|
||||
commercial or non-commercial, and by any means.
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||
software dedicate any and all copyright interest in the software to the public
|
||||
domain. We make this dedication for the benefit of the public at large and to
|
||||
the detriment of our heirs and successors. We intend this dedication to be an
|
||||
overt act of relinquishment in perpetuity of all present and future rights to
|
||||
this software under copyright law.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
165
extern/igfd/stb/README.md
vendored
Normal file
165
extern/igfd/stb/README.md
vendored
Normal file
|
@ -0,0 +1,165 @@
|
|||
<!--- THIS FILE IS AUTOMATICALLY GENERATED, DO NOT CHANGE IT BY HAND --->
|
||||
|
||||
stb
|
||||
===
|
||||
|
||||
single-file public domain (or MIT licensed) libraries for C/C++
|
||||
|
||||
Noteworthy:
|
||||
|
||||
* image loader: [stb_image.h](stb_image.h)
|
||||
* image writer: [stb_image_write.h](stb_image_write.h)
|
||||
* image resizer: [stb_image_resize.h](stb_image_resize.h)
|
||||
* font text rasterizer: [stb_truetype.h](stb_truetype.h)
|
||||
* typesafe containers: [stb_ds.h](stb_ds.h)
|
||||
|
||||
Most libraries by stb, except: stb_dxt by Fabian "ryg" Giesen, stb_image_resize
|
||||
by Jorge L. "VinoBS" Rodriguez, and stb_sprintf by Jeff Roberts.
|
||||
|
||||
<a name="stb_libs"></a>
|
||||
|
||||
library | lastest version | category | LoC | description
|
||||
--------------------- | ---- | -------- | --- | --------------------------------
|
||||
**[stb_vorbis.c](stb_vorbis.c)** | 1.20 | audio | 5563 | decode ogg vorbis files from file/memory to float/16-bit signed output
|
||||
**[stb_image.h](stb_image.h)** | 2.26 | graphics | 7762 | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC
|
||||
**[stb_truetype.h](stb_truetype.h)** | 1.24 | graphics | 5011 | parse, decode, and rasterize characters from truetype fonts
|
||||
**[stb_image_write.h](stb_image_write.h)** | 1.15 | graphics | 1690 | image writing to disk: PNG, TGA, BMP
|
||||
**[stb_image_resize.h](stb_image_resize.h)** | 0.96 | graphics | 2631 | resize images larger/smaller with good quality
|
||||
**[stb_rect_pack.h](stb_rect_pack.h)** | 1.00 | graphics | 628 | simple 2D rectangle packer with decent quality
|
||||
**[stb_ds.h](stb_ds.h)** | 0.65 | utility | 1880 | typesafe dynamic array and hash tables for C, will compile in C++
|
||||
**[stb_sprintf.h](stb_sprintf.h)** | 1.09 | utility | 1879 | fast sprintf, snprintf for C/C++
|
||||
**[stretchy_buffer.h](stretchy_buffer.h)** | 1.04 | utility | 263 | typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++
|
||||
**[stb_textedit.h](stb_textedit.h)** | 1.13 | user interface | 1404 | guts of a text editor for games etc implementing them from scratch
|
||||
**[stb_voxel_render.h](stb_voxel_render.h)** | 0.89 | 3D graphics | 3807 | Minecraft-esque voxel rendering "engine" with many more features
|
||||
**[stb_dxt.h](stb_dxt.h)** | 1.10 | 3D graphics | 753 | Fabian "ryg" Giesen's real-time DXT compressor
|
||||
**[stb_perlin.h](stb_perlin.h)** | 0.5 | 3D graphics | 428 | revised Perlin noise (3D input, 1D output)
|
||||
**[stb_easy_font.h](stb_easy_font.h)** | 1.1 | 3D graphics | 305 | quick-and-dirty easy-to-deploy bitmap font for printing frame rate, etc
|
||||
**[stb_tilemap_editor.h](stb_tilemap_editor.h)** | 0.41 | game dev | 4161 | embeddable tilemap editor
|
||||
**[stb_herringbone_wa...](stb_herringbone_wang_tile.h)** | 0.7 | game dev | 1221 | herringbone Wang tile map generator
|
||||
**[stb_c_lexer.h](stb_c_lexer.h)** | 0.11 | parsing | 966 | simplify writing parsers for C-like languages
|
||||
**[stb_divide.h](stb_divide.h)** | 0.93 | math | 430 | more useful 32-bit modulus e.g. "euclidean divide"
|
||||
**[stb_connected_comp...](stb_connected_components.h)** | 0.96 | misc | 1049 | incrementally compute reachability on grids
|
||||
**[stb.h](stb.h)** | 2.37 | misc | 14454 | helper functions for C, mostly redundant in C++; basically author's personal stuff
|
||||
**[stb_leakcheck.h](stb_leakcheck.h)** | 0.6 | misc | 194 | quick-and-dirty malloc/free leak-checking
|
||||
**[stb_include.h](stb_include.h)** | 0.02 | misc | 295 | implement recursive #include support, particularly for GLSL
|
||||
|
||||
Total libraries: 22
|
||||
Total lines of C code: 56774
|
||||
|
||||
|
||||
FAQ
|
||||
---
|
||||
|
||||
#### What's the license?
|
||||
|
||||
These libraries are in the public domain. You can do anything you
|
||||
want with them. You have no legal obligation
|
||||
to do anything else, although I appreciate attribution.
|
||||
|
||||
They are also licensed under the MIT open source license, if you have lawyers
|
||||
who are unhappy with public domain. Every source file includes an explicit
|
||||
dual-license for you to choose from.
|
||||
|
||||
#### <a name="other_libs"></a> Are there other single-file public-domain/open source libraries with minimal dependencies out there?
|
||||
|
||||
[Yes.](https://github.com/nothings/single_file_libs)
|
||||
|
||||
#### If I wrap an stb library in a new library, does the new library have to be public domain/MIT?
|
||||
|
||||
No, because it's public domain you can freely relicense it to whatever license your new
|
||||
library wants to be.
|
||||
|
||||
#### What's the deal with SSE support in GCC-based compilers?
|
||||
|
||||
stb_image will either use SSE2 (if you compile with -msse2) or
|
||||
will not use any SIMD at all, rather than trying to detect the
|
||||
processor at runtime and handle it correctly. As I understand it,
|
||||
the approved path in GCC for runtime-detection require
|
||||
you to use multiple source files, one for each CPU configuration.
|
||||
Because stb_image is a header-file library that compiles in only
|
||||
one source file, there's no approved way to build both an
|
||||
SSE-enabled and a non-SSE-enabled variation.
|
||||
|
||||
While we've tried to work around it, we've had multiple issues over
|
||||
the years due to specific versions of gcc breaking what we're doing,
|
||||
so we've given up on it. See https://github.com/nothings/stb/issues/280
|
||||
and https://github.com/nothings/stb/issues/410 for examples.
|
||||
|
||||
#### Some of these libraries seem redundant to existing open source libraries. Are they better somehow?
|
||||
|
||||
Generally they're only better in that they're easier to integrate,
|
||||
easier to use, and easier to release (single file; good API; no
|
||||
attribution requirement). They may be less featureful, slower,
|
||||
and/or use more memory. If you're already using an equivalent
|
||||
library, there's probably no good reason to switch.
|
||||
|
||||
#### Can I link directly to the table of stb libraries?
|
||||
|
||||
You can use [this URL](https://github.com/nothings/stb#stb_libs) to link directly to that list.
|
||||
|
||||
#### Why do you list "lines of code"? It's a terrible metric.
|
||||
|
||||
Just to give you some idea of the internal complexity of the library,
|
||||
to help you manage your expectations, or to let you know what you're
|
||||
getting into. While not all the libraries are written in the same
|
||||
style, they're certainly similar styles, and so comparisons between
|
||||
the libraries are probably still meaningful.
|
||||
|
||||
Note though that the lines do include both the implementation, the
|
||||
part that corresponds to a header file, and the documentation.
|
||||
|
||||
#### Why single-file headers?
|
||||
|
||||
Windows doesn't have standard directories where libraries
|
||||
live. That makes deploying libraries in Windows a lot more
|
||||
painful than open source developers on Unix-derivates generally
|
||||
realize. (It also makes library dependencies a lot worse in Windows.)
|
||||
|
||||
There's also a common problem in Windows where a library was built
|
||||
against a different version of the runtime library, which causes
|
||||
link conflicts and confusion. Shipping the libs as headers means
|
||||
you normally just compile them straight into your project without
|
||||
making libraries, thus sidestepping that problem.
|
||||
|
||||
Making them a single file makes it very easy to just
|
||||
drop them into a project that needs them. (Of course you can
|
||||
still put them in a proper shared library tree if you want.)
|
||||
|
||||
Why not two files, one a header and one an implementation?
|
||||
The difference between 10 files and 9 files is not a big deal,
|
||||
but the difference between 2 files and 1 file is a big deal.
|
||||
You don't need to zip or tar the files up, you don't have to
|
||||
remember to attach *two* files, etc.
|
||||
|
||||
#### Why "stb"? Is this something to do with Set-Top Boxes?
|
||||
|
||||
No, they are just the initials for my name, Sean T. Barrett.
|
||||
This was not chosen out of egomania, but as a moderately sane
|
||||
way of namespacing the filenames and source function names.
|
||||
|
||||
#### Will you add more image types to stb_image.h?
|
||||
|
||||
No. As stb_image use has grown, it has become more important
|
||||
for us to focus on security of the codebase. Adding new image
|
||||
formats increases the amount of code we need to secure, so it
|
||||
is no longer worth adding new formats.
|
||||
|
||||
#### Do you have any advice on how to create my own single-file library?
|
||||
|
||||
Yes. https://github.com/nothings/stb/blob/master/docs/stb_howto.txt
|
||||
|
||||
#### Why public domain?
|
||||
|
||||
I prefer it over GPL, LGPL, BSD, zlib, etc. for many reasons.
|
||||
Some of them are listed here:
|
||||
https://github.com/nothings/stb/blob/master/docs/why_public_domain.md
|
||||
|
||||
#### Why C?
|
||||
|
||||
Primarily, because I use C, not C++. But it does also make it easier
|
||||
for other people to use them from other languages.
|
||||
|
||||
#### Why not C99? stdint.h, declare-anywhere, etc.
|
||||
|
||||
I still use MSVC 6 (1998) as my IDE because it has better human factors
|
||||
for me than later versions of MSVC.
|
7762
extern/igfd/stb/stb_image.h
vendored
Normal file
7762
extern/igfd/stb/stb_image.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
2631
extern/igfd/stb/stb_image_resize.h
vendored
Normal file
2631
extern/igfd/stb/stb_image_resize.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
extern/imgui
vendored
Submodule
1
extern/imgui
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 8a9fe268662292ed9495048d942d8d0341c03185
|
9
src/gui/gui.cpp
Normal file
9
src/gui/gui.cpp
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "gui.h"
|
||||
|
||||
void FurnaceGUI::bindEngine(DivEngine* eng) {
|
||||
e=eng;
|
||||
}
|
||||
|
||||
FurnaceGUI::FurnaceGUI():
|
||||
e(NULL) {
|
||||
}
|
9
src/gui/gui.h
Normal file
9
src/gui/gui.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#include "../engine/engine.h"
|
||||
|
||||
class FurnaceGUI {
|
||||
DivEngine* e;
|
||||
|
||||
public:
|
||||
void bindEngine(DivEngine* eng);
|
||||
FurnaceGUI();
|
||||
};
|
Loading…
Reference in a new issue