72 lines
2.1 KiB
C++
72 lines
2.1 KiB
C++
#include "pch.h"
|
|
#include "log.h"
|
|
#include "node_dialog_export_ppbr.h"
|
|
#include "app.h"
|
|
#include "image.h"
|
|
|
|
Node* NodeDialogExportPPBR::clone_instantiate() const
|
|
{
|
|
return new NodeDialogExportPPBR();
|
|
}
|
|
|
|
void NodeDialogExportPPBR::clone_finalize(Node* dest) const
|
|
{
|
|
NodeDialogExportPPBR* n = static_cast<NodeDialogExportPPBR*>(dest);
|
|
n->init_controls();
|
|
}
|
|
|
|
void NodeDialogExportPPBR::init()
|
|
{
|
|
auto tpl = static_cast<const NodeBorder*>(init_template("dialog-brush-upload"));
|
|
m_color = tpl->m_color;
|
|
m_border_color = tpl->m_border_color;;
|
|
m_thinkness = tpl->m_thinkness;;
|
|
init_controls();
|
|
m_capture_children = false; // don't capture children events on mouse_capture
|
|
}
|
|
|
|
void NodeDialogExportPPBR::init_controls()
|
|
{
|
|
btn_ok = find<NodeButton>("btn-ok");
|
|
btn_cancel = find<NodeButton>("btn-cancel");
|
|
btn_cancel->on_click = [this](Node*) {
|
|
destroy();
|
|
};
|
|
btn_header_open = find<NodeButton>("header-open");
|
|
btn_header_open->on_click = [this] (Node*) {
|
|
open_header();
|
|
};
|
|
btn_header_clear = find<NodeButton>("header-clear");
|
|
btn_header_clear->on_click = [this] (Node*) {
|
|
m_header_image.destroy();
|
|
img_header->tex.destroy();
|
|
txt_header_descr->SetVisibility(true);
|
|
};
|
|
btn_header_gen = find<NodeButton>("header-gen");
|
|
btn_header_gen->on_click = [this] (Node*) {
|
|
App::I->message_box("WIP", "This feature is not yet implemented.");
|
|
};
|
|
img_header = find<NodeImageTexture>("header-tex");
|
|
txt_header_descr = find<NodeText>("header-descr");
|
|
txt_author = find<NodeText>("info-author");
|
|
txt_email = find<NodeText>("info-email");
|
|
txt_url = find<NodeText>("info-url");
|
|
txt_descr = find<NodeText>("info-descr");
|
|
}
|
|
|
|
void NodeDialogExportPPBR::open_header()
|
|
{
|
|
App::I->pick_image([this](std::string path) {
|
|
m_header_image.load(path);
|
|
m_header_image.resize(256, 128);
|
|
img_header->tex.create(m_header_image);
|
|
txt_header_descr->SetVisibility(false);
|
|
});
|
|
}
|
|
|
|
void NodeDialogExportPPBR::added(Node* parent)
|
|
{
|
|
NodeBorder::added(parent);
|
|
mouse_capture();
|
|
}
|