@@ -1021,87 +1021,90 @@ namespace igfd
10211021#endif
10221022 int countRows = (int )m_FilteredFileList.size ();
10231023 ImGuiListClipper clipper (countRows, ImGui::GetTextLineHeightWithSpacing ());
1024- for ( int i = clipper. DisplayStart ; i < clipper.DisplayEnd ; i++ )
1024+ while ( clipper.Step () )
10251025 {
1026- const FileInfoStruct& infos = m_FilteredFileList[i];
1027-
1028- ImVec4 c;
1029- std::string icon;
1030- bool showColor = GetExtentionInfos (infos.ext , &c, &icon);
1031- if (showColor)
1032- ImGui::PushStyleColor (ImGuiCol_Text, c);
1033-
1034- std::string str = " " + infos.fileName ;
1035- if (infos.type == ' d' ) str = dirEntryString + str;
1036- if (infos.type == ' l' ) str = linkEntryString + str;
1037- if (infos.type == ' f' )
1026+ for (int i = clipper.DisplayStart ; i < clipper.DisplayEnd ; i++)
10381027 {
1039- if (showColor && !icon.empty ())
1040- str = icon + str;
1041- else
1042- str = fileEntryString + str;
1043- }
1044- bool selected = false ;
1045- if (m_SelectedFileNames.find (infos.fileName ) != m_SelectedFileNames.end ()) // found
1046- selected = true ;
1047- #ifdef USE_IMGUI_TABLES
1048- ImGui::TableNextRow ();
1049- if (ImGui::TableSetColumnIndex (0 )) // first column
1050- {
1051- #endif
1052- ImGuiSelectableFlags selectableFlags = ImGuiSelectableFlags_AllowDoubleClick;
1053- #ifdef USE_IMGUI_TABLES
1054- selectableFlags |= ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_SpanAvailWidth;
1055- #endif
1056- bool _selectablePressed = false ;
1057- #ifdef USE_EXPLORATION_BY_KEYS
1058- bool flashed = BeginFlashItem (i);
1059- _selectablePressed = FlashableSelectable (str.c_str (), selected, selectableFlags, flashed);
1060- if (flashed)
1061- EndFlashItem ();
1062- #else
1063- _selectablePressed = ImGui::Selectable (str.c_str (), selected, selectableFlags);
1064- #endif
1065- if (_selectablePressed)
1066- {
1067- if (infos.type == ' d' )
1028+ const FileInfoStruct& infos = m_FilteredFileList[i];
1029+
1030+ ImVec4 c;
1031+ std::string icon;
1032+ bool showColor = GetExtentionInfos (infos.ext , &c, &icon);
1033+ if (showColor)
1034+ ImGui::PushStyleColor (ImGuiCol_Text, c);
1035+
1036+ std::string str = " " + infos.fileName ;
1037+ if (infos.type == ' d' ) str = dirEntryString + str;
1038+ if (infos.type == ' l' ) str = linkEntryString + str;
1039+ if (infos.type == ' f' )
10681040 {
1069- if (dlg_filters || ImGui::IsMouseDoubleClicked (0 ))
1041+ if (showColor && !icon.empty ())
1042+ str = icon + str;
1043+ else
1044+ str = fileEntryString + str;
1045+ }
1046+ bool selected = false ;
1047+ if (m_SelectedFileNames.find (infos.fileName ) != m_SelectedFileNames.end ()) // found
1048+ selected = true ;
1049+ #ifdef USE_IMGUI_TABLES
1050+ ImGui::TableNextRow ();
1051+ if (ImGui::TableSetColumnIndex (0 )) // first column
1052+ {
1053+ #endif
1054+ ImGuiSelectableFlags selectableFlags = ImGuiSelectableFlags_AllowDoubleClick;
1055+ #ifdef USE_IMGUI_TABLES
1056+ selectableFlags |= ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_SpanAvailWidth;
1057+ #endif
1058+ bool _selectablePressed = false ;
1059+ #ifdef USE_EXPLORATION_BY_KEYS
1060+ bool flashed = BeginFlashItem (i);
1061+ _selectablePressed = FlashableSelectable (str.c_str (), selected, selectableFlags, flashed);
1062+ if (flashed)
1063+ EndFlashItem ();
1064+ #else
1065+ _selectablePressed = ImGui::Selectable (str.c_str (), selected, selectableFlags);
1066+ #endif
1067+ if (_selectablePressed)
1068+ {
1069+ if (infos.type == ' d' )
10701070 {
1071- pathClick = SelectDirectory (infos);
1071+ if (dlg_filters || ImGui::IsMouseDoubleClicked (0 ))
1072+ {
1073+ pathClick = SelectDirectory (infos);
1074+ }
1075+ else // directory chooser
1076+ {
1077+ SelectFileName (infos);
1078+ }
1079+
1080+ if (showColor)
1081+ ImGui::PopStyleColor ();
1082+
1083+ break ;
10721084 }
1073- else // directory chooser
1085+ else
10741086 {
10751087 SelectFileName (infos);
10761088 }
1077-
1078- if (showColor)
1079- ImGui::PopStyleColor ();
1080-
1081- break ;
10821089 }
1083- else
1084- {
1085- SelectFileName (infos);
1090+ #ifdef USE_IMGUI_TABLES
10861091 }
1087- }
1088- #ifdef USE_IMGUI_TABLES
1089- }
1090- if (ImGui::TableSetColumnIndex (1 )) // second column
1091- {
1092- if (infos.type != ' d' )
1093- {
1094- ImGui::Text (" %s " , infos.formatedFileSize .c_str ()); // -V111
1095- }
1096- }
1097- if (ImGui::TableSetColumnIndex (2 )) // third column
1098- {
1099- ImGui::Text (" %s" , infos.fileModifDate .c_str ()); // -V111
1100- }
1101- #endif
1102- if (showColor)
1103- ImGui::PopStyleColor ();
1092+ if (ImGui::TableSetColumnIndex (1 )) // second column
1093+ {
1094+ if (infos.type != ' d' )
1095+ {
1096+ ImGui::Text (" %s " , infos.formatedFileSize .c_str ()); // -V111
1097+ }
1098+ }
1099+ if (ImGui::TableSetColumnIndex (2 )) // third column
1100+ {
1101+ ImGui::Text (" %s" , infos.fileModifDate .c_str ()); // -V111
1102+ }
1103+ #endif
1104+ if (showColor)
1105+ ImGui::PopStyleColor ();
11041106
1107+ }
11051108 }
11061109 clipper.End ();
11071110#ifdef USE_EXPLORATION_BY_KEYS
0 commit comments