| 87 | |
| 88 | |
| 89 | void Viewer::DoSaveCurrentModal(bool savePressed) |
| 90 | { |
| 91 | static tString label; |
| 92 | if (!CurrImage) |
| 93 | return; |
| 94 | |
| 95 | if (savePressed) |
| 96 | { |
| 97 | SaveAsFile = CurrImage->Filename; |
| 98 | tString typeNameUpper(tGetFileTypeName(tGetFileType(SaveAsFile))); |
| 99 | typeNameUpper.ToUpper(); |
| 100 | tsPrintf(label, "Save %s Options", typeNameUpper.Chr()); |
| 101 | ImGui::OpenPopup(label.Chr()); |
| 102 | } |
| 103 | |
| 104 | float nextWinWidth = Gutil::GetUIParamScaled(300.0f, 2.5f); |
| 105 | |
| 106 | // The unused isOpenSaveOptions bool is just so we get a close button in ImGui. Returns false if popup not open. |
| 107 | bool isOpenSaveOptions = true; |
| 108 | ImGui::SetNextWindowSize(tVector2(nextWinWidth, 0.0f)); |
| 109 | if (!ImGui::BeginPopupModal(label.Chr(), &isOpenSaveOptions, ImGuiWindowFlags_NoScrollbar)) |
| 110 | return; |
| 111 | |
| 112 | tFileType saveType = tGetFileType(SaveAsFile); |
| 113 | if (FileTypes_Save.Contains(saveType)) |
| 114 | DoSavePopup(); |
| 115 | else |
| 116 | DoSaveUnsupportedTypePopup(); |
| 117 | |
| 118 | ImGui::EndPopup(); |
| 119 | } |
| 120 | |
| 121 | |
| 122 | void Viewer::DoSaveAsModal(bool saveAsPressed) |