file picker: ability to edit bookmark name
This commit is contained in:
parent
e9c16fed11
commit
93be309a39
2 changed files with 31 additions and 1 deletions
|
|
@ -1176,7 +1176,17 @@ void FurnaceFilePicker::drawBookmarks(ImVec2& tableSize, String& newDir) {
|
||||||
newDir=iPath;
|
newDir=iPath;
|
||||||
}
|
}
|
||||||
if (ImGui::BeginPopupContextItem("BookmarkOpts")) {
|
if (ImGui::BeginPopupContextItem("BookmarkOpts")) {
|
||||||
|
if (ImGui::MenuItem(_("edit"))) {
|
||||||
|
|
||||||
|
size_t separator=i.find('\n');
|
||||||
|
if (separator!=String::npos) {
|
||||||
|
editingBookmark=index;
|
||||||
|
newBookmarkName=i.substr(0,separator);
|
||||||
|
newBookmarkPath=i.substr(separator+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ImGui::MenuItem(_("remove"))) {
|
if (ImGui::MenuItem(_("remove"))) {
|
||||||
|
|
||||||
markedForRemoval=index;
|
markedForRemoval=index;
|
||||||
if (iPath==path) isPathBookmarked=false;
|
if (iPath==path) isPathBookmarked=false;
|
||||||
}
|
}
|
||||||
|
|
@ -1189,6 +1199,24 @@ void FurnaceFilePicker::drawBookmarks(ImVec2& tableSize, String& newDir) {
|
||||||
}
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (editingBookmark>=0 && editingBookmark<(int)bookmarks.size()) {
|
||||||
|
ImGui::OpenPopup("BookmarkEdit");
|
||||||
|
}
|
||||||
|
if (ImGui::BeginPopup("BookmarkEdit",ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings)) {
|
||||||
|
ImGui::Text("Name:");
|
||||||
|
ImGui::InputText("##BookEditText",&newBookmarkName);
|
||||||
|
if (ImGui::Button("OK")) {
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
if (!ImGui::IsPopupOpen("BookmarkEdit")) {
|
||||||
|
if (editingBookmark>=0 && editingBookmark<(int)bookmarks.size()) {
|
||||||
|
bookmarks[editingBookmark]=newBookmarkName+"\n"+newBookmarkPath;
|
||||||
|
}
|
||||||
|
editingBookmark=-1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FurnaceFilePicker::draw(ImGuiWindowFlags winFlags) {
|
bool FurnaceFilePicker::draw(ImGuiWindowFlags winFlags) {
|
||||||
|
|
@ -1926,6 +1954,8 @@ FurnaceFilePicker::FurnaceFilePicker():
|
||||||
isPathBookmarked(false),
|
isPathBookmarked(false),
|
||||||
isSearch(false),
|
isSearch(false),
|
||||||
scheduledSort(0),
|
scheduledSort(0),
|
||||||
|
imguiFlags(0),
|
||||||
|
editingBookmark(-1),
|
||||||
curFilterType(0),
|
curFilterType(0),
|
||||||
lastScrollY(0.0f),
|
lastScrollY(0.0f),
|
||||||
enforceScrollY(0),
|
enforceScrollY(0),
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ class FurnaceFilePicker {
|
||||||
bool multiSelect;
|
bool multiSelect;
|
||||||
bool confirmOverwrite, dirSelect, noClose, isModal, isEmbed, hasSizeConstraints;
|
bool confirmOverwrite, dirSelect, noClose, isModal, isEmbed, hasSizeConstraints;
|
||||||
bool isPathBookmarked, isSearch;
|
bool isPathBookmarked, isSearch;
|
||||||
int scheduledSort, imguiFlags;
|
int scheduledSort, imguiFlags, editingBookmark;
|
||||||
size_t curFilterType;
|
size_t curFilterType;
|
||||||
float lastScrollY;
|
float lastScrollY;
|
||||||
int enforceScrollY;
|
int enforceScrollY;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue