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

Method DoSaveMultiFrameModal

Src/MultiFrame.cpp:87–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85
86
87void Viewer::DoSaveMultiFrameModal(bool saveMultiFramePressed)
88{
89 if (saveMultiFramePressed)
90 ImGui::OpenPopup("Multi Frame");
91
92 // The unused isOpenMultiFrame bool is just so we get a close button in ImGui. Returns false if popup not open.
93 bool isOpenMultiFrame = true;
94 if (!ImGui::BeginPopupModal("Multi Frame", &isOpenMultiFrame, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoScrollbar))
95 return;
96
97 static int outWidth = 256;
98 static int outHeight = 256;
99 static char lo[32];
100 static char hi[32];
101
102 float itemWidth = Gutil::GetUIParamScaled(160.0f, 2.5f);
103 float powButWidth = Gutil::GetUIParamScaled(60.0f, 2.5f);
104 float powButOffset = Gutil::GetUIParamScaled(220.0f, 2.5f);
105 float buttonWidth = Gutil::GetUIParamScaled(76.0f, 2.5f);
106 float comboWidth = Gutil::GetUIParamScaled(160.0f, 2.5f);
107 tVector2 powSize(powButWidth, 0.0f);
108
109 // If just opened, loop through all the images and choose the largest width and height.
110 if (saveMultiFramePressed)
111 ComputeMaxWidthHeight(outWidth, outHeight);
112
113 ImGui::SetNextItemWidth(itemWidth);
114 ImGui::InputInt("Width", &outWidth);
115 tiClampMin(outWidth, 4);
116 int loP2W = tNextLowerPower2(outWidth);
117 tiClampMin(loP2W, 4);
118 tsPrintf(lo, "%d##outwidthlo", loP2W);
119 ImGui::SameLine();
120 ImGui::SetCursorPosX(powButOffset);
121 if (ImGui::Button(lo, powSize))
122 outWidth = loP2W;
123 int hiP2W = tNextHigherPower2(outWidth);
124 tsPrintf(hi, "%d##outwidthhi", hiP2W);
125 ImGui::SameLine();
126 if (ImGui::Button(hi, powSize))
127 outWidth = hiP2W;
128 ImGui::SameLine();
129 Gutil::HelpMark("Output width in pixels.");
130
131 ImGui::SetNextItemWidth(itemWidth);
132 ImGui::InputInt("Height", &outHeight);
133 tiClampMin(outHeight, 4);
134 int loP2H = tNextLowerPower2(outHeight);
135 tiClampMin(loP2H, 4);
136 tsPrintf(lo, "%d##outheightlo", loP2H);
137 ImGui::SameLine();
138 ImGui::SetCursorPosX(powButOffset);
139 if (ImGui::Button(lo, powSize))
140 outHeight = loP2H;
141 int hiP2H = tNextHigherPower2(outHeight);
142 tsPrintf(hi, "%d##outheighthi", hiP2H);
143 ImGui::SameLine();
144 if (ImGui::Button(hi, powSize))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected