Skip to content

Commit c812707

Browse files
committed
[RFR] : refactor
1 parent 2e2ac8f commit c812707

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

ImGuiFileDialog.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,6 @@ namespace IGFD
183183
#ifndef tableHeaderFileDateString
184184
#define tableHeaderFileDateString "Date"
185185
#endif // tableHeaderFileDateString
186-
#ifdef USE_THUMBNAILS
187-
#ifndef tableHeaderFileThumbnailsString
188-
#define tableHeaderFileThumbnailsString "Thumbnails"
189-
#endif // tableHeaderFileThumbnailsString
190-
#endif // USE_THUMBNAILS
191186
#ifndef OverWriteDialogTitleString
192187
#define OverWriteDialogTitleString "The file Already Exist !"
193188
#endif // OverWriteDialogTitleString
@@ -206,6 +201,9 @@ namespace IGFD
206201
#endif // DateTimeFormat
207202

208203
#ifdef USE_THUMBNAILS
204+
#ifndef tableHeaderFileThumbnailsString
205+
#define tableHeaderFileThumbnailsString "Thumbnails"
206+
#endif // tableHeaderFileThumbnailsString
209207
#ifndef DisplayMode_FilesList_ButtonString
210208
#define DisplayMode_FilesList_ButtonString "FL"
211209
#endif // DisplayMode_FilesList_ButtonString
@@ -224,6 +222,9 @@ namespace IGFD
224222
#ifndef DisplayMode_ThumbailsGrid_ButtonHelp
225223
#define DisplayMode_ThumbailsGrid_ButtonHelp "Thumbnails Grid"
226224
#endif // DisplayMode_ThumbailsGrid_ButtonHelp
225+
#ifndef DisplayMode_ThumbailsList_ImageHeight
226+
#define DisplayMode_ThumbailsList_ImageHeight 32.0f
227+
#endif // DisplayMode_ThumbailsList_ImageHeight
227228
#ifndef IMGUI_RADIO_BUTTON
228229
inline bool inRadioButton(const char* vLabel, bool vToggled)
229230
{
@@ -250,11 +251,6 @@ namespace IGFD
250251
}
251252
#define IMGUI_RADIO_BUTTON inRadioButton
252253
#endif // IMGUI_RADIO_BUTTON
253-
#ifndef DisplayMode_ThumbailsList_ImageHeight
254-
#define DisplayMode_ThumbailsList_ImageHeight 32.0f
255-
#endif // DisplayMode_ThumbailsList_ImageHeight
256-
static IGFD::CreateThumbnailFun sCreateThumbnailFun = nullptr;
257-
static IGFD::DestroyThumbnailFun sDestroyThumbnailFun = nullptr;
258254
#endif // USE_THUMBNAILS
259255

260256
#ifdef USE_BOOKMARK
@@ -404,12 +400,12 @@ namespace IGFD
404400
#ifdef WIN32
405401
const DWORD mydrives = 2048;
406402
char lpBuffer[2048];
407-
const DWORD countChars = GetLogicalDriveStringsA(mydrives, lpBuffer);
408-
if (countChars > 0)
409-
{
410403
#define mini(a,b) (((a) < (b)) ? (a) : (b))
411-
std::string var = std::string(lpBuffer, (size_t)mini(countChars, 2047));
404+
const DWORD countChars = mini(GetLogicalDriveStringsA(mydrives, lpBuffer), 2047);
412405
#undef mini
406+
if (countChars > 0)
407+
{
408+
std::string var = std::string(lpBuffer, (size_t)countChars);
413409
inReplaceString(var, "\\", "");
414410
res = inSplitStringToVector(var, '\0', false);
415411
}

ImGuiFileDialogConfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//#define DONT_DEFINE_AGAIN__STB_IMAGE_RESIZE_IMPLEMENTATION
1414
//#define IMGUI_RADIO_BUTTON RadioButton
1515
//#define DisplayMode_ThumbailsList_ImageHeight 32.0f
16+
//#define tableHeaderFileThumbnailsString "Thumbnails"
1617
//#define DisplayMode_FilesList_ButtonString "FL"
1718
//#define DisplayMode_FilesList_ButtonHelp "File List"
1819
//#define DisplayMode_ThumbailsList_ButtonString "TL"
@@ -21,6 +22,7 @@
2122
//#define DisplayMode_ThumbailsGrid_ButtonString "TG"
2223
//#define DisplayMode_ThumbailsGrid_ButtonHelp "Thumbnails Grid"
2324

25+
2426
//#define USE_EXPLORATION_BY_KEYS
2527
// this mapping by default is for GLFW but you can use another
2628
//#include <GLFW/glfw3.h>

0 commit comments

Comments
 (0)