#include "pch.h" #include "log.h" #include "node_dialog_resize.h" #include "canvas.h" #include "node_image_texture.h" #include "app.h" #include Node* NodeDialogResize::clone_instantiate() const { return new NodeDialogResize(); } void NodeDialogResize::clone_finalize(Node* dest) const { NodeDialogResize* n = static_cast(dest); n->init_controls(); } void NodeDialogResize::init() { auto tpl = static_cast(init_template("dialog-resize")); m_color = tpl->m_color; m_border_color = tpl->m_border_color;; m_thinkness = tpl->m_thinkness;; init_controls(); } void NodeDialogResize::init_controls() { btn_ok = find("btn-ok"); btn_cancel = find("btn-cancel"); combo = find("resolution"); text = find("current-res"); resolution = Canvas::I->m_width; static char txt[128]; sprintf(txt, "Current: %s", App::I->res_to_string(resolution).c_str()); text->set_text(txt); btn_cancel->on_click = [this](Node*) { destroy(); }; } void NodeDialogResize::loaded() { // Image thumb = Canvas::I->thumbnail_read(data_path); // auto image_tex = find("thumb-tex"); // image_tex->tex.create(thumb); } int NodeDialogResize::get_resolution() { return combo ? App::I->res_from_index(combo->m_current_index) : 512; }