c00c2c71ac
* scratch adding histogram to image views Histograms should come from some sort of histogram service. This is currently just a POC. * custom logger implementation w/o spdlog * missing cmake file * fix tests * use operator<< over direct stream exposure * rm print header * add threading test + refactor towards interface libraries omits the need for =target_include_directories= calls /everywhere/ * rm print header * rm constexpr * templated thread_pool * fix doxyfile * default enable doc building * czi reader refactor * rm erroneous include expression * clang-format * single lib include with PUBLIC visibility * compile imgui stdlib * clang format * documentation update centralize `LogLevelToString` to `ILog.hpp` update docs and examples
60 lines
1.4 KiB
C++
60 lines
1.4 KiB
C++
#include "DefaultApp.hpp"
|
|
|
|
#include <cstddef>
|
|
#include <format>
|
|
|
|
#include "ILog.hpp"
|
|
#include "PixelariumImageFactory.hpp"
|
|
#include "app_resources_default.h"
|
|
#include "imgui.h"
|
|
#include "portable-file-dialogs.h"
|
|
#include "resource.hpp"
|
|
|
|
using namespace pixelarium::imaging;
|
|
using namespace pixelarium::application;
|
|
|
|
void DefaultApp::MenuBarOptionsColumn1()
|
|
{
|
|
ImGui::MenuItem(SHOWIMGUIDEMOS, NULL, &this->demop_);
|
|
ImGui::MenuItem(SHOWIMAGEGALLERY, NULL, &this->image_listp_);
|
|
}
|
|
|
|
void DefaultApp::MenuBarOptionsColumn2()
|
|
{
|
|
if (ImGui::BeginMenu(FILEMENUNAME))
|
|
{
|
|
if (ImGui::MenuItem(LOADIMAGE))
|
|
{
|
|
this->LoadImageDialogue();
|
|
}
|
|
|
|
ImGui::EndMenu();
|
|
}
|
|
}
|
|
|
|
void DefaultApp::Run()
|
|
{
|
|
if (demop_) ImGui::ShowDemoWindow(&this->demop_);
|
|
if (image_listp_) this->gallery_.RenderGallery();
|
|
|
|
this->gallery_.RenderImages();
|
|
}
|
|
|
|
void DefaultApp::LoadImageDialogue()
|
|
{
|
|
auto res{pfd::open_file("Load Inputs", pfd::path::home(), {"All Files", "*"}, pfd::opt::multiselect).result()};
|
|
for (auto& p : res)
|
|
{
|
|
this->logger_.Debug(std::format("{}: Creating image {}", __FUNCTION__, p));
|
|
|
|
try
|
|
{
|
|
pool_.SetResource(PixelariumImageFactory::CreateImage(p, logger_));
|
|
}
|
|
catch (pixelarium::resources::empty_resource_exception& e)
|
|
{
|
|
logger_.Error(std::format("{}: Failed to load file '{}' with '{}'", __PRETTY_FUNCTION__, p, e.what()));
|
|
}
|
|
}
|
|
}
|