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

Method create_new_tab

src/MainProgram.cpp:340–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340void MainProgram::create_new_tab(const CustomEvents::OpenInfiniPaintFileEvent& openFile) {
341 std::shared_ptr<World> newWorld;
342 try {
343 newWorld = std::make_shared<World>(*this, openFile);
344 }
345 catch(const std::runtime_error& e) {
346#ifdef __ANDROID__
347 Logger::get().log(Logger::LogType::WORLDFATAL, std::string("Failed to open canvas: ") + e.what());
348#else
349 Logger::get().log(Logger::LogType::WORLDFATAL, "Failed to open canvas: " + (openFile.filePathSource.has_value() ? openFile.filePathSource.value().string() : "NO PATH") + " with error: " + e.what());
350#endif
351 return;
352 }
353 worlds.emplace_back(newWorld);
354 switch_to_tab(worlds.size() - 1);
355 g.gui.set_to_layout();
356}
357
358void MainProgram::set_tab_to_close(World* world) {
359 tabsToClose.emplace(world);

Callers 4

SDL_AppInitFunction · 0.80
on_tab_closeMethod · 0.80

Calls 6

logMethod · 0.80
set_to_layoutMethod · 0.80
getFunction · 0.50
stringMethod · 0.45
valueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected