@@ -325,14 +325,23 @@ inline bool inRadioButton(const char* vLabel, bool vToggled) {
325325#define defaultPlacePaneWith 150 .0f
326326#endif // defaultPlacePaneWith
327327#ifndef placesButtonString
328- #define placesButtonString " Place "
328+ #define placesButtonString " Places "
329329#endif // placesButtonString
330- #ifndef bookmarksGroupString
331- #define bookmarksGroupString " Bookmarks"
332- #endif // bookmarksGroupString
333330#ifndef placesButtonHelpString
334- #define placesButtonHelpString " Place "
331+ #define placesButtonHelpString " Places "
335332#endif // placesButtonHelpString
333+ #ifndef placesBookmarksGroupName
334+ #define placesBookmarksGroupName " Bookmarks"
335+ #endif // placesBookmarksName
336+ #ifndef placesBookmarksDisplayOrder
337+ #define placesBookmarksDisplayOrder 0
338+ #endif // placesBookmarksDisplayOrder
339+ #ifndef placesDevicesGroupName
340+ #define placesDevicesGroupName " Devices"
341+ #endif // placesDevicesGroupName
342+ #ifndef placesDevicesDisplayOrder
343+ #define placesDevicesDisplayOrder 10
344+ #endif // placesDevicesDisplayOrder
336345#ifndef addPlaceButtonString
337346#define addPlaceButtonString " +"
338347#endif // addPlaceButtonString
@@ -2990,17 +2999,15 @@ IGFD::PlacesFeature::PlacesFeature() {
29902999#ifdef USE_PLACES_FEATURE
29913000void IGFD::PlacesFeature::m_InitPlaces (FileDialogInternal& vFileDialogInternal) {
29923001#ifdef USE_PLACES_BOOKMARKS
2993- AddPlacesGroup (PLACE_BOOKMARKS_NAME, PLACE_BOOKMARKS_DISPLAY_ORDER , true );
3002+ AddPlacesGroup (placesBookmarksGroupName, placesBookmarksDisplayOrder , true );
29943003#endif // USE_PLACES_BOOKMARK
29953004#ifdef USE_PLACES_DEVICES
2996- AddPlacesGroup (PLACE_DEVICES_NAME, PLACE_DEVICES_DISPLAY_ORDER , false );
2997- auto devices_ptr = GetPlacesGroupPtr (PLACE_DEVICES_NAME );
3005+ AddPlacesGroup (placesDevicesGroupName, placesDevicesDisplayOrder , false );
3006+ auto devices_ptr = GetPlacesGroupPtr (placesDevicesGroupName );
29983007 if (devices_ptr != nullptr && vFileDialogInternal.fileManager .GetFileSystemInstance () != nullptr ) {
29993008 const auto & devices = vFileDialogInternal.fileManager .GetFileSystemInstance ()->GetDevicesList ();
3000- IGFD::FileStyle style;
3001- style.icon = PLACE_DEVICES_ICON;
30023009 for (const auto & device : devices) {
3003- devices_ptr->AddPlace (device.first + " " + device.second , device.first + IGFD::Utils::GetPathSeparator (), false , style );
3010+ devices_ptr->AddPlace (device.first + " " + device.second , device.first + IGFD::Utils::GetPathSeparator (), false );
30043011 }
30053012 devices_ptr = nullptr ;
30063013 }
@@ -3014,9 +3021,7 @@ void IGFD::PlacesFeature::m_DrawPlacesButton() {
30143021
30153022bool IGFD::PlacesFeature::m_DrawPlacesPane (FileDialogInternal& vFileDialogInternal, const ImVec2& vSize) {
30163023 bool res = false ;
3017-
30183024 ImGui::BeginChild (" ##placespane" , vSize);
3019-
30203025 for (const auto & group : m_OrderedGroups) {
30213026 auto group_ptr = group.second .lock ();
30223027 if (group_ptr != nullptr ) {
@@ -3025,10 +3030,7 @@ bool IGFD::PlacesFeature::m_DrawPlacesPane(FileDialogInternal& vFileDialogIntern
30253030 ImGui::PushID (group_ptr.get ());
30263031 if (IMGUI_BUTTON (addPlaceButtonString " ##ImGuiFileDialogAddPlace" )) {
30273032 if (!vFileDialogInternal.fileManager .IsComposerEmpty ()) {
3028- PlaceStruct place;
3029- place.name = vFileDialogInternal.fileManager .GetBack ();
3030- place.path = vFileDialogInternal.fileManager .GetCurrentPath ();
3031- group_ptr->places .push_back (place);
3033+ group_ptr->AddPlace (vFileDialogInternal.fileManager .GetBack (), vFileDialogInternal.fileManager .GetCurrentPath (), true );
30323034 }
30333035 }
30343036 if (group_ptr->selectedPlaceForEdition >= 0 && group_ptr->selectedPlaceForEdition < (int )group_ptr->places .size ()) {
@@ -3039,7 +3041,6 @@ bool IGFD::PlacesFeature::m_DrawPlacesPane(FileDialogInternal& vFileDialogIntern
30393041 --group_ptr->selectedPlaceForEdition ;
30403042 }
30413043 }
3042-
30433044 if (group_ptr->selectedPlaceForEdition >= 0 && group_ptr->selectedPlaceForEdition < (int )group_ptr->places .size ()) {
30443045 ImGui::SameLine ();
30453046 ImGui::PushItemWidth (vSize.x - ImGui::GetCursorPosX ());
@@ -3052,7 +3053,6 @@ bool IGFD::PlacesFeature::m_DrawPlacesPane(FileDialogInternal& vFileDialogIntern
30523053 ImGui::PopID ();
30533054 ImGui::Separator ();
30543055 }
3055-
30563056 if (!group_ptr->places .empty ()) {
30573057 group_ptr->clipper .Begin ((int )group_ptr->places .size (), ImGui::GetTextLineHeightWithSpacing ());
30583058 while (group_ptr->clipper .Step ()) {
@@ -3081,13 +3081,10 @@ bool IGFD::PlacesFeature::m_DrawPlacesPane(FileDialogInternal& vFileDialogIntern
30813081 }
30823082 group_ptr->clipper .End ();
30833083 }
3084-
30853084 }
30863085 }
30873086 }
3088-
30893087 ImGui::EndChild ();
3090-
30913088 return res;
30923089}
30933090
0 commit comments