#include "pch.h" #include "log.h" #include "node_dialog_layer_rename.h" #include "canvas.h" #include "node_image_texture.h" Node* NodeDialogLayerRename::clone_instantiate() const { return new NodeDialogLayerRename(); } void NodeDialogLayerRename::clone_finalize(Node* dest) const { NodeDialogLayerRename* n = static_cast(dest); n->init_controls(); } void NodeDialogLayerRename::init() { init_template_file("data/dialogs/layer-rename.xml", "dialog-layer-rename"); init_controls(); } void NodeDialogLayerRename::init_controls() { btn_ok = find("btn-ok"); btn_cancel = find("btn-cancel"); input = find("txt-input"); btn_cancel->on_click = [this](Node*) { destroy(); }; } void NodeDialogLayerRename::loaded() { // Image thumb = Canvas::I->thumbnail_read(data_path); // auto image_tex = find("thumb-tex"); // image_tex->tex.create(thumb); } std::string NodeDialogLayerRename::get_name() { return input ? input->m_text : ""; } void NodeDialogLayerRename::added(Node* parent) { Node::added(parent); if (added_to_root()) input->key_capture(); }