MCPcopy Create free account
hub / github.com/bluescan/tacentview / DoOverwriteMultipleFilesModal

Method DoOverwriteMultipleFilesModal

Src/OpenSaveDialogs.cpp:903–958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

901
902
903void Viewer::DoOverwriteMultipleFilesModal(const tList<tStringItem>& overwriteFiles, bool& pressedOK, bool& pressedCancel)
904{
905 tAssert(!overwriteFiles.IsEmpty());
906 Config::ProfileData& profile = Config::GetProfileData();
907 float buttonWidth = Gutil::GetUIParamScaled(76.0f, 2.5f);
908 float textWidth = Gutil::GetUIParamScaled(366.0f, 2.5f);
909 float overwriteOffset = Gutil::GetUIParamScaled(310.0f, 2.5f);
910
911 ImGui::Text("The Following Files");
912 ImGui::Indent();
913 int fnum = 0;
914 const int maxToShow = 6;
915 for (tStringItem* filename = overwriteFiles.First(); filename && (fnum < maxToShow); filename = filename->Next(), fnum++)
916 {
917 tString file = tSystem::tGetFileName(*filename);
918 tString fileCropped = Gutil::CropStringToWidth(file, textWidth, true);
919 ImGui::Text("%s", fileCropped.Chr());
920 if (fileCropped != file)
921 Gutil::ToolTip(file.Chr());
922 }
923 int remaining = overwriteFiles.GetNumItems() - fnum;
924 if (remaining > 0)
925 ImGui::Text("And %d more.", remaining);
926 ImGui::Unindent();
927 ImGui::Text("Already Exist In Folder");
928 tString dir = tSystem::tGetDir(*overwriteFiles.First());
929 tString dirCropped = Gutil::CropStringToWidth(dir, textWidth, true);
930 ImGui::Indent();
931 ImGui::Text("%s", dirCropped.Chr());
932 if (dirCropped != dir)
933 Gutil::ToolTip(dir.Chr());
934 ImGui::Unindent();
935 ImGui::Text("Overwrite Files?");
936 ImGui::Separator();
937 ImGui::Checkbox("Confirm file overwrites in the future?", &profile.ConfirmFileOverwrites);
938 ImGui::NewLine();
939
940 if (ImGui::IsWindowAppearing())
941 ImGui::SetKeyboardFocusHere();
942 if (Gutil::Button("Cancel", tVector2(buttonWidth, 0.0f)))
943 {
944 pressedCancel = true;
945 ImGui::CloseCurrentPopup();
946 }
947
948 ImGui::SameLine();
949
950 ImGui::SetCursorPosX(overwriteOffset);
951 if (Gutil::Button("Overwrite", tVector2(buttonWidth, 0.0f)))
952 {
953 pressedOK = true;
954 ImGui::CloseCurrentPopup();
955 }
956
957 ImGui::EndPopup();
958}
959
960

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected