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

Method edit_gui

src/DrawingProgram/Tools/EditTools/ImageEditTool.cpp:64–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64void ImageEditTool::edit_gui(Toolbar& t) {
65 using namespace GUIStuff;
66 using namespace ElementHelpers;
67
68 ImageCanvasComponent& a = static_cast<ImageCanvasComponent&>(comp->obj->get_comp());
69 auto& gui = drawP.world.main.g.gui;
70 gui.new_id("edit tool image", [&] {
71 text_label_centered(gui, "File Properties");
72 auto resourceData = drawP.world.netObjMan.get_obj_temporary_ref_from_id<ResourceData>(a.d.imageID);
73
74 if(resourceData) {
75 text_label(gui, "Name: " + resourceData->name);
76 text_button(gui, "file download", "Download file", {
77 .wide = true,
78 .onClick = [&, resourceData] {
79 #ifdef __EMSCRIPTEN__
80 emscripten_browser_file::download(
81 resourceData->name,
82 "application/octet-binary",
83 *resourceData->data
84 );
85 #endif
86 t.open_file_selector("Download File", {{"Any File", "*"}}, [resourceData](const std::filesystem::path& p, const auto& e) {
87 SDL_SaveFile(p.string().c_str(), resourceData->data->c_str(), resourceData->data->size());
88 }, resourceData->name, true);
89 }
90 });
91 }
92 else
93 text_label_centered(gui, "Loading resource...");
94 });
95}
96
97void ImageEditTool::gui_phone_toolbox(PhoneDrawingProgramScreen& t) {
98 using namespace GUIStuff;

Callers

nothing calls this directly

Calls 9

text_label_centeredFunction · 0.85
text_labelFunction · 0.85
text_buttonFunction · 0.85
downloadFunction · 0.85
new_idMethod · 0.80
c_strMethod · 0.80
open_file_selectorMethod · 0.45
stringMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected