dfranx / imfiledialog Goto Github PK
View Code? Open in Web Editor NEWA file dialog library for Dear ImGui
License: MIT License
A file dialog library for Dear ImGui
License: MIT License
Please fix it! in paths I see "??? ? ? ? ????? ? ? ? ?? ?" instead of cyrillic symbols.
I was wondering if you'd like to help maintain my fork with me, which takes a bit of a different direction from the original software, because it relies specifically on SDL2 and OpenGL on Windows and Linux, with added BSD and Illumos support, and uses SDL2 Renderer on MacOS since OpenGL is deprecated on that platform. The reason I am using SDL2 is to mask the fact it uses Dear ImGui and uses a custom theme as well as makes it run in its own a floating window, without being embedded in an existing window. It also relies on my filesystem API, and ghc::filesystem so it can be built with versions of C++ besides C++17 like C++11, C++14, and C++20. I also added full localization and UTF-8 font loading support. It can be used as a CLI and as a client library. Many other things I did to improve it, and I did in my own fork instead of making a pull request to save time that it takes to be accepted in code review. I intend to add support for loading system icons for different file types like can be done on Windows for all other platforms I support. Let me know what you think, here's my fork: https://github.com/time-killer-games/libfiledialogs
This library looks really good, nice work! 👍🏻 And thanks for sharing the code. I'm considering switching to this one for my project.
While reading the API, I was wondering if you'd be open to providing the result as std:: filesystem::path
instead of std::wstring
(maybe via an additional function, like GetResultPath
or similar)? The library is already using the filesystem header internally, after all. And having a path
object would be nice for when you intend to do some more manipulation on the resulting path, or if you need the path as UTF-8 encoded string etc. The latter can be obtained easily via the std:: filesystem::u8string
function, whereas it's more complicated to do with a std::wstring
.
c++20 can't compiled ?
From c++20 removed some features to convert between u8string and string ?
How to select dir instead of file via ImFileDialog ?
I somehow managed to encounter a bug in the file folder enumerations.
when I open a file dialog, double clicking to the C: drive show me nothing but when opening for exemple the Onedrive shortcut, and go back with the up arrow, i eventually show files in C: view...
Images are better than word, here is a little screenshot series :
By the way :
Many thanks,
Grégory
Need replace all u8string and u8path to string and path for c++20 for compile it?
Just curious if there is any way possible to also include a directx 11 example?
u8string is not able to convert to string anymore in new c++ standard.
Had make a slight change handling the ESC key in order to build. Not sure what the escapeKey >= 0 was doing?
diff --git a/ImFileDialog.cpp b/ImFileDialog.cpp
index 53832d9..439f0e9 100644
--- a/ImFileDialog.cpp
+++ b/ImFileDialog.cpp
@@ -1406,9 +1406,9 @@ namespace ifd {
m_finalize();
}
- int escapeKey = ImGui::GetIO().KeyMap[ImGuiKey_Escape];
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) &&
- escapeKey >= 0 && ImGui::IsKeyPressed(escapeKey))
+ ImGui::IsKeyPressed(ImGuiKey_Escape))
m_isOpen = false;
}
}
I cannot open folders by double clicking. What can be the reason?
Here you can share screenshots or projects that use ImFileDialog.
README.md
recommends using glGenerateMipmap()
which requires OpenGL 3.0 (not available in VirtualBox for example, limited to 2.1, and some older systems).
README.md
should warn about this requirement and suggest an alternative for OpenGL >= 1.4 && < 3.0:
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
or no automatic mipmap generation for OpenGL < 1.4.
https://www.khronos.org/opengl/wiki/Common_Mistakes#Automatic_mipmap_generation
I'm not sure if this is planned or not, but a suggestion I'd have for this project is a modal popup specifically during the "Save" version of the dialog. If the user tries to save over a file that already exists, tested likely through an std::ios::in
std::fstream
, the file dialog opens a confirmation window asking the user if they want to overwrite that file.
Hypothetically speaking, this could probably be cleanly implemented into the FileDialog::m_finalize
function:
/* ERRONEOUS DETAIL REMOVED */
if (m_type == IFD_DIALOG_SAVE) {
// add the extension
if (m_filterSelection < m_filterExtensions.size() && m_filterExtensions[m_filterSelection].size() > 0) {
if (!m_result.back().has_extension()) {
std::string extAdd = m_filterExtensions[m_filterSelection][0];
m_result.back().replace_extension(extAdd);
}
}
std::fstream m_checkfile;
m_checkfile.open(/*filename here*/, std::ios::in);
if (m_checkfile.is_open())
{
m_checkfile.close();
ImGui::OpenPopup("OnOverwriteFilePopup");
return false
}
}
/* ... */
I really think that this would drastically increase usability of the product, as users wouldn't be accidentally overwriting files that already existed.
Hi, first this work is amazing !
I'm French and using special character in filename like 'é' î' ...
When I open a file picker, the file name are not shown in totality, part are truncated where the special character is located :
Exemple :
Here the folder name is '§Rangement à trier' and it shown '?rangement ?rier'.
I hope you can fix this because this file/folder browser is great.
If I can be of any help...
Grégory
I'm happy to announce the first public release of Dear ImGui Bundle. Dear ImGui Bundle is a bundle for Dear ImGui, including many powerful libraries from its ecosystem. It enables to easily create ImGui applications in C++ and Python, under Windows, macOS, Linux, emscripten. It is aimed at application developers, researchers, and beginner developers who want to quickly get started.
ImFleDialog is a included in the widgets provided with it.
@dfranx: sorry to hijack the issues list for this, and feel to close this issue; as this is just for your information. I informed @ocornut yesterday, and I plan to communicate about it in the ImGui gallery in the next hours.
The file modification time is displaying as the creation time.
Windos.h defines some min/max macro's which conflict with std::max. For windows one can define NOMINMAX to disable these macro's.
i.e.: sphaero@c89aa80
I'm trying to compile last version with last official Imgui release and I get these 2 errors:
Error C2039 'LastItemRect': is not a member of 'ImGuiWindowTempData'
Error C2660 'ImDrawList::AddRectFilled': function does not take 2 arguments Easy Dear ImGui
But Looking at the last commits , the lib was updated for 1.84 :-/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.