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

Method DoOverwriteFileModal

Src/OpenSaveDialogs.cpp:1014–1059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1012
1013
1014void Viewer::DoOverwriteFileModal(const tString& outFile, bool& pressedOK, bool& pressedCancel)
1015{
1016 Config::ProfileData& profile = Config::GetProfileData();
1017 float buttonWidth = Gutil::GetUIParamScaled(76.0f, 2.5f);
1018 float textWidth = Gutil::GetUIParamScaled(366.0f, 2.5f);
1019 float okOffset = Gutil::GetUIParamScaled(310.0f, 2.5f);
1020
1021 tString file = tSystem::tGetFileName(outFile);
1022 tString fileCropped = Gutil::CropStringToWidth(file, textWidth, true);
1023 tString dir = tSystem::tGetDir(outFile);
1024 tString dirCropped = Gutil::CropStringToWidth(dir, textWidth, true);
1025
1026 ImGui::Text("Overwrite file");
1027 ImGui::Indent();
1028 ImGui::Text("%s", fileCropped.Chr());
1029 if (fileCropped != file)
1030 Gutil::ToolTip(file.Chr());
1031 ImGui::Unindent();
1032
1033 ImGui::Text("In Folder");
1034 ImGui::Indent();
1035 ImGui::Text("%s", dirCropped.Chr());
1036 if (dirCropped != dir)
1037 Gutil::ToolTip(dir.Chr());
1038 ImGui::Unindent();
1039 ImGui::Separator();
1040
1041 ImGui::Checkbox("Confirm file overwrites in the future?", &profile.ConfirmFileOverwrites);
1042 ImGui::NewLine();
1043 if (Gutil::Button("Cancel", tVector2(buttonWidth, 0.0f)))
1044 {
1045 pressedCancel = true;
1046 ImGui::CloseCurrentPopup();
1047 }
1048
1049 ImGui::SameLine();
1050 ImGui::SetCursorPosX(okOffset);
1051 if (ImGui::IsWindowAppearing())
1052 ImGui::SetKeyboardFocusHere();
1053 if (Gutil::Button("OK", tVector2(buttonWidth, 0.0f)))
1054 {
1055 pressedOK = true;
1056 ImGui::CloseCurrentPopup();
1057 }
1058 ImGui::EndPopup();
1059}
1060
1061
1062bool Viewer::SavePictureAs(tImage::tPicture& picture, const tString& outFile, tFileType fileType, bool steal)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected