MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / gui_phone_toolbox

Method gui_phone_toolbox

src/DrawingProgram/Tools/GridModifyTool.cpp:193–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193void GridModifyTool::gui_phone_toolbox(PhoneDrawingProgramScreen& t) {
194 using namespace GUIStuff;
195 using namespace ElementHelpers;
196
197 auto& gui = drawP.world.main.g.gui;
198
199 gui.new_id("Grid modify tool", [&] {
200 NetworkingObjects::NetObjTemporaryPtr<WorldGrid> gLock = grid.lock();
201 if(gLock) {
202 WorldGrid& g = *gLock;
203 input_text_field(gui, "grid name", "Name", &g.name);
204 checkbox_boolean_field(gui, "Visible", "Visible", &g.visible);
205 checkbox_boolean_field(gui, "Display in Front", "Display in front of canvas", &g.displayInFront);
206 std::vector<std::string> listOfGridTypes = {
207 "Circle Points",
208 "Square Points",
209 "Square Lines",
210 "Horizontal Lines"
211 };
212 left_to_right_line_layout(gui, [&]() {
213 text_label(gui, "Type");
214 gui.element<DropDown<WorldGrid::GridType>>("filepicker select type", &g.gridType, listOfGridTypes);
215 });
216 input_scalar_field<uint32_t>(gui, "Subdivisions", "Subdivisions", &g.subdivisions, 1, 10, {
217 .onEdit = [&] { g.set_subdivisions(g.subdivisions); }
218 });
219 checkbox_boolean_field(gui, "Subdivide outwards", "Subdivide when zooming out", &g.removeDivisionsOutwards, [&] {
220 g.set_remove_divisions_outwards(g.removeDivisionsOutwards);
221 });
222 left_to_right_line_layout(gui, [&]() {
223 t.color_selector_button("Grid Color", &g.color);
224 text_label(gui, "Grid Color");
225 });
226 auto bounded = std::make_shared<bool>(g.bounds.has_value());
227 checkbox_boolean_field(gui, "Bounded", "Bounded", bounded.get(), [&, bounded] {
228 if(*bounded) {
229 SCollision::AABB<WorldScalar> newBounds;
230 newBounds.min = g.offset - drawP.world.drawData.cam.c.dir_from_space(drawP.world.main.window.size.cast<float>() * 0.3f);
231 newBounds.max = g.offset + drawP.world.drawData.cam.c.dir_from_space(drawP.world.main.window.size.cast<float>() * 0.3f);
232 g.bounds = newBounds;
233 }
234 else
235 g.bounds = std::nullopt;
236 });
237 // Very hard to not have a rotated canvas on phone
238 //checkbox_boolean_field(gui, "Show Coordinates", "Show Coordinates (visible\nwhen canvas isn't rotated)", &g.showCoordinates);
239 }
240 });
241}
242
243void GridModifyTool::right_click_popup_gui(Toolbar& t, Vector2f popupPos) {
244 t.paint_popup(popupPos);

Callers

nothing calls this directly

Calls 11

input_text_fieldFunction · 0.85
checkbox_boolean_fieldFunction · 0.85
text_labelFunction · 0.85
new_idMethod · 0.80
lockMethod · 0.80
set_subdivisionsMethod · 0.80
color_selector_buttonMethod · 0.80
dir_from_spaceMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected