2025-03-13 12:00:14 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <GLFW/glfw3.h>
|
2025-03-14 19:32:40 +01:00
|
|
|
|
2025-03-13 12:00:14 +01:00
|
|
|
#include <cstdio>
|
2025-06-13 22:23:20 +00:00
|
|
|
#include <format>
|
2025-03-17 18:50:31 +01:00
|
|
|
#include <memory>
|
2025-03-13 12:00:14 +01:00
|
|
|
|
2025-06-13 22:23:20 +00:00
|
|
|
#include "PixelariumImage.hpp"
|
2025-03-13 12:00:14 +01:00
|
|
|
#include "imgui.h"
|
2025-03-17 10:44:56 +01:00
|
|
|
#include "rendering/CvMatRender.hpp"
|
2025-06-13 22:23:20 +00:00
|
|
|
#include "resources/resource.hpp"
|
2025-03-17 18:50:31 +01:00
|
|
|
#include "utilities/ILog.hpp"
|
2025-06-16 13:19:28 +02:00
|
|
|
#include "viewmodels/ImageViewFactory.hpp"
|
2025-06-15 01:11:08 +02:00
|
|
|
#include "views/PixelariumImageView.hpp"
|
2025-03-13 12:00:14 +01:00
|
|
|
|
2025-03-14 19:32:40 +01:00
|
|
|
namespace pixelarium::ui
|
2025-03-13 12:00:14 +01:00
|
|
|
{
|
|
|
|
|
class AppGLFW
|
|
|
|
|
{
|
|
|
|
|
public:
|
2025-06-16 13:19:28 +02:00
|
|
|
AppGLFW(std::unique_ptr<utils::log::ILog>& log, std::unique_ptr<pixelarium::resources::ImageResourcePool>& pool)
|
|
|
|
|
: logger_(*log), pool_(*pool)
|
2025-06-13 22:23:20 +00:00
|
|
|
{
|
2025-06-16 13:19:28 +02:00
|
|
|
image_view_model_ = std::make_unique<ImageViewFactory>(pool_);
|
2025-06-14 16:39:39 +02:00
|
|
|
|
|
|
|
|
this->InitMainWindow();
|
2025-06-13 22:23:20 +00:00
|
|
|
}
|
2025-03-13 12:00:14 +01:00
|
|
|
int Run();
|
|
|
|
|
|
2025-03-14 19:32:40 +01:00
|
|
|
private:
|
2025-03-18 21:22:41 +01:00
|
|
|
void InitMainWindow();
|
2025-03-14 19:32:40 +01:00
|
|
|
void MenuBar();
|
|
|
|
|
void LoadImageProt();
|
|
|
|
|
|
2025-03-13 12:00:14 +01:00
|
|
|
private:
|
2025-06-14 16:39:39 +02:00
|
|
|
utils::log::ILog& logger_;
|
2025-06-16 13:19:28 +02:00
|
|
|
resources::ImageResourcePool& pool_;
|
2025-03-13 12:00:14 +01:00
|
|
|
GLFWwindow* window = nullptr;
|
2025-06-13 22:23:20 +00:00
|
|
|
ImGuiWindowFlags window_flags_ = 0;
|
2025-06-15 01:11:08 +02:00
|
|
|
// std::shared_ptr<pixelarium::imaging::PixelariumImage> img_;
|
2025-06-16 13:19:28 +02:00
|
|
|
// std::shared_ptr<pixelarium::ui::PixelariumImageView> image_view_;
|
|
|
|
|
std::unique_ptr<ImageViewFactory> image_view_model_;
|
|
|
|
|
// pixelarium::render::CvMatRender render_;
|
2025-06-13 22:23:20 +00:00
|
|
|
bool imagep_{false};
|
2025-06-14 16:39:39 +02:00
|
|
|
bool demop_{false};
|
|
|
|
|
int log_level_{0};
|
2025-06-13 22:23:20 +00:00
|
|
|
ImVec2 curr_dim_;
|
2025-03-13 12:00:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void glfw_error_callback(int error, const char* description)
|
|
|
|
|
{
|
|
|
|
|
fprintf(stderr, "GLFW Error %d: %s\n", error, description);
|
|
|
|
|
}
|
2025-06-13 22:23:20 +00:00
|
|
|
} // namespace pixelarium::ui
|