| 120 | |
| 121 | |
| 122 | void Viewer::DoSaveAsModal(bool saveAsPressed) |
| 123 | { |
| 124 | static tString label; |
| 125 | if (!CurrImage) |
| 126 | return; |
| 127 | |
| 128 | if (saveAsPressed) |
| 129 | { |
| 130 | tString baseName; |
| 131 | baseName = tSystem::tGetFileBaseName(CurrImage->Filename); |
| 132 | SaveAsDialog.OpenPopup(ImagesDir, baseName); |
| 133 | } |
| 134 | FileDialog::DialogState state = SaveAsDialog.DoPopup(); |
| 135 | if (state == FileDialog::DialogState::OK) |
| 136 | { |
| 137 | SaveAsFile = SaveAsDialog.GetResult(); |
| 138 | tString typeNameUpper(tGetFileTypeName(tGetFileType(SaveAsFile))); |
| 139 | typeNameUpper.ToUpper(); |
| 140 | tsPrintf(label, "Save As %s Options", typeNameUpper.Chr()); |
| 141 | ImGui::OpenPopup(label.Chr()); |
| 142 | } |
| 143 | |
| 144 | float nextWinWidth = Gutil::GetUIParamScaled(300.0f, 2.5f); |
| 145 | |
| 146 | // The unused isOpenSaveOptions bool is just so we get a close button in ImGui. Returns false if popup not open. |
| 147 | bool isOpenSaveOptions = true; |
| 148 | ImGui::SetNextWindowSize(tVector2(nextWinWidth, 0.0f)); |
| 149 | if (!ImGui::BeginPopupModal(label.Chr(), &isOpenSaveOptions, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar)) |
| 150 | return; |
| 151 | |
| 152 | DoSavePopup(); |
| 153 | ImGui::EndPopup(); |
| 154 | } |
| 155 | |
| 156 | |
| 157 | void Viewer::DoSavePopup() |