#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(dest); n->init_controls(); } void NodeDialogExportPPBR::init() { auto tpl = static_cast(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("btn-ok"); btn_cancel = find("btn-cancel"); btn_cancel->on_click = [this](Node*) { destroy(); }; btn_header_open = find("header-open"); btn_header_open->on_click = [this] (Node*) { open_header(); }; btn_header_clear = find("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("header-gen"); btn_header_gen->on_click = [this] (Node*) { App::I->message_box("WIP", "This feature is not yet implemented."); }; img_header = find("header-tex"); txt_header_descr = find("header-descr"); txt_author = find("info-author"); txt_email = find("info-email"); txt_url = find("info-url"); txt_descr = find("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(); }