@@ -996,87 +996,90 @@ namespace igfd
996996#endif
997997 int countRows = (int )m_FilteredFileList.size ();
998998 ImGuiListClipper clipper (countRows, ImGui::GetTextLineHeightWithSpacing ());
999- for ( int i = clipper. DisplayStart ; i < clipper.DisplayEnd ; i++ )
999+ while ( clipper.Step () )
10001000 {
1001- const FileInfoStruct& infos = m_FilteredFileList[i];
1002-
1003- ImVec4 c;
1004- std::string icon;
1005- bool showColor = GetExtentionInfos (infos.ext , &c, &icon);
1006- if (showColor)
1007- ImGui::PushStyleColor (ImGuiCol_Text, c);
1008-
1009- std::string str = " " + infos.fileName ;
1010- if (infos.type == ' d' ) str = dirEntryString + str;
1011- if (infos.type == ' l' ) str = linkEntryString + str;
1012- if (infos.type == ' f' )
1001+ for (int i = clipper.DisplayStart ; i < clipper.DisplayEnd ; i++)
10131002 {
1014- if (showColor && !icon.empty ())
1015- str = icon + str;
1016- else
1017- str = fileEntryString + str;
1018- }
1019- bool selected = false ;
1020- if (m_SelectedFileNames.find (infos.fileName ) != m_SelectedFileNames.end ()) // found
1021- selected = true ;
1022- #ifdef USE_IMGUI_TABLES
1023- ImGui::TableNextRow ();
1024- if (ImGui::TableSetColumnIndex (0 )) // first column
1025- {
1026- #endif
1027- ImGuiSelectableFlags selectableFlags = ImGuiSelectableFlags_AllowDoubleClick;
1028- #ifdef USE_IMGUI_TABLES
1029- selectableFlags |= ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_SpanAvailWidth;
1030- #endif
1031- bool _selectablePressed = false ;
1032- #ifdef USE_EXPLORATION_BY_KEYS
1033- bool flashed = BeginFlashItem (i);
1034- _selectablePressed = FlashableSelectable (str.c_str (), selected, selectableFlags, flashed);
1035- if (flashed)
1036- EndFlashItem ();
1037- #else
1038- _selectablePressed = ImGui::Selectable (str.c_str (), selected, selectableFlags);
1039- #endif
1040- if (_selectablePressed)
1041- {
1042- if (infos.type == ' d' )
1003+ const FileInfoStruct& infos = m_FilteredFileList[i];
1004+
1005+ ImVec4 c;
1006+ std::string icon;
1007+ bool showColor = GetExtentionInfos (infos.ext , &c, &icon);
1008+ if (showColor)
1009+ ImGui::PushStyleColor (ImGuiCol_Text, c);
1010+
1011+ std::string str = " " + infos.fileName ;
1012+ if (infos.type == ' d' ) str = dirEntryString + str;
1013+ if (infos.type == ' l' ) str = linkEntryString + str;
1014+ if (infos.type == ' f' )
10431015 {
1044- if (dlg_filters || ImGui::IsMouseDoubleClicked (0 ))
1016+ if (showColor && !icon.empty ())
1017+ str = icon + str;
1018+ else
1019+ str = fileEntryString + str;
1020+ }
1021+ bool selected = false ;
1022+ if (m_SelectedFileNames.find (infos.fileName ) != m_SelectedFileNames.end ()) // found
1023+ selected = true ;
1024+ #ifdef USE_IMGUI_TABLES
1025+ ImGui::TableNextRow ();
1026+ if (ImGui::TableSetColumnIndex (0 )) // first column
1027+ {
1028+ #endif
1029+ ImGuiSelectableFlags selectableFlags = ImGuiSelectableFlags_AllowDoubleClick;
1030+ #ifdef USE_IMGUI_TABLES
1031+ selectableFlags |= ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_SpanAvailWidth;
1032+ #endif
1033+ bool _selectablePressed = false ;
1034+ #ifdef USE_EXPLORATION_BY_KEYS
1035+ bool flashed = BeginFlashItem (i);
1036+ _selectablePressed = FlashableSelectable (str.c_str (), selected, selectableFlags, flashed);
1037+ if (flashed)
1038+ EndFlashItem ();
1039+ #else
1040+ _selectablePressed = ImGui::Selectable (str.c_str (), selected, selectableFlags);
1041+ #endif
1042+ if (_selectablePressed)
1043+ {
1044+ if (infos.type == ' d' )
10451045 {
1046- pathClick = SelectDirectory (infos);
1046+ if (dlg_filters || ImGui::IsMouseDoubleClicked (0 ))
1047+ {
1048+ pathClick = SelectDirectory (infos);
1049+ }
1050+ else // directory chooser
1051+ {
1052+ SelectFileName (infos);
1053+ }
1054+
1055+ if (showColor)
1056+ ImGui::PopStyleColor ();
1057+
1058+ break ;
10471059 }
1048- else // directory chooser
1060+ else
10491061 {
10501062 SelectFileName (infos);
10511063 }
1052-
1053- if (showColor)
1054- ImGui::PopStyleColor ();
1055-
1056- break ;
10571064 }
1058- else
1059- {
1060- SelectFileName (infos);
1065+ #ifdef USE_IMGUI_TABLES
10611066 }
1062- }
1063- #ifdef USE_IMGUI_TABLES
1064- }
1065- if (ImGui::TableSetColumnIndex (1 )) // second column
1066- {
1067- if (infos.type != ' d' )
1068- {
1069- ImGui::Text (" %s " , infos.formatedFileSize .c_str ()); // -V111
1070- }
1071- }
1072- if (ImGui::TableSetColumnIndex (2 )) // third column
1073- {
1074- ImGui::Text (" %s" , infos.fileModifDate .c_str ()); // -V111
1075- }
1076- #endif
1077- if (showColor)
1078- ImGui::PopStyleColor ();
1067+ if (ImGui::TableSetColumnIndex (1 )) // second column
1068+ {
1069+ if (infos.type != ' d' )
1070+ {
1071+ ImGui::Text (" %s " , infos.formatedFileSize .c_str ()); // -V111
1072+ }
1073+ }
1074+ if (ImGui::TableSetColumnIndex (2 )) // third column
1075+ {
1076+ ImGui::Text (" %s" , infos.fileModifDate .c_str ()); // -V111
1077+ }
1078+ #endif
1079+ if (showColor)
1080+ ImGui::PopStyleColor ();
10791081
1082+ }
10801083 }
10811084 clipper.End ();
10821085#ifdef USE_EXPLORATION_BY_KEYS
0 commit comments