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

Method DoSaveAllModal

Src/OpenSaveDialogs.cpp:739–886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

737
738
739void Viewer::DoSaveAllModal(bool saveAllPressed)
740{
741 if (saveAllPressed)
742 ImGui::OpenPopup("Save All");
743
744 // The unused isOpenSaveAll bool is just so we get a close button in ImGui. Returns false if popup not open.
745 bool isOpenSaveAll = true;
746 if (!ImGui::BeginPopupModal("Save All", &isOpenSaveAll, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar))
747 return;
748
749 ImGui::Text("Save all %d images to the image type you select.", Images.GetNumItems());
750
751 ImGui::Separator();
752
753 float buttonWidth = Gutil::GetUIParamScaled(76.0f, 2.5f);
754 float itemWidth = Gutil::GetUIParamScaled(160.0f, 2.5f);
755
756 ImGui::PushItemWidth(itemWidth);
757 static int width = 512;
758 static int height = 512;
759 static float percent = 100.0f;
760 const char* sizeModeNames[] = { "Percent of Original", "Set Width and Height", "Set Width - Keep Aspect", "Set Height - Keep Aspect" };
761 Config::ProfileData& profile = Config::GetProfileData();
762 ImGui::Combo("Size Mode", &profile.SaveAllSizeMode, sizeModeNames, tNumElements(sizeModeNames));
763 ImGui::SameLine();
764 Gutil::HelpMark
765 (
766 "Images may be resized based on the Size Mode:\n"
767 "\n"
768 " Percent of Original\n"
769 " Use 100% for no scaling/resampling. Less\n"
770 " than 100% downscales. Greater than upscales.\n"
771 "\n"
772 " Set Width and Height\n"
773 " Scales all images to specified width and\n"
774 " height, possibly non-uniformly.\n"
775 "\n"
776 " Set Width - Keep Aspect\n"
777 " All images will have specified width. Always\n"
778 " uniform scale. Varying height.\n"
779 "\n"
780 " Set Height - Keep Aspect\n"
781 " All images will have specified height. Always\n"
782 " uniform scale. Varying width.\n"
783 );
784 switch (profile.GetSaveAllSizeMode())
785 {
786 case Config::ProfileData::SizeModeEnum::Percent:
787 ImGui::InputFloat("Percent", &percent, 1.0f, 10.0f, "%.1f"); ImGui::SameLine(); Gutil::HelpMark("Percent of original size.");
788 break;
789
790 case Config::ProfileData::SizeModeEnum::SetWidthAndHeight:
791 ImGui::InputInt("Width", &width); ImGui::SameLine(); Gutil::HelpMark("Output width in pixels for all images.");
792 ImGui::InputInt("Height", &height); ImGui::SameLine(); Gutil::HelpMark("Output height in pixels for all images.");
793 break;
794
795 case Config::ProfileData::SizeModeEnum::SetWidthRetainAspect:
796 ImGui::InputInt("Width", &width); ImGui::SameLine(); Gutil::HelpMark("Output width in pixels for all images.");

Callers

nothing calls this directly

Calls 1

GetSaveAllSizeModeMethod · 0.80

Tested by

no test coverage detected