expand ppbr export dialog

This commit is contained in:
2019-09-13 14:15:40 +02:00
parent c3a34d28c1
commit 53787409cb
4 changed files with 57 additions and 12 deletions

View File

@@ -366,11 +366,11 @@
<ClCompile Include="libs\glad\src\glad_wgl.c">
<Filter>libs\glad</Filter>
</ClCompile>
<ClCompile Include="src\node_input_box.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\node_dialog_export_ppbr.cpp">
<Filter>Source Files</Filter>
<Filter>Source Files\ui</Filter>
</ClCompile>
<ClCompile Include="src\node_input_box.cpp">
<Filter>Source Files\ui</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
@@ -614,11 +614,11 @@
<ClInclude Include="src\node_tool_bucket.h">
<Filter>Header Files\ui</Filter>
</ClInclude>
<ClInclude Include="src\node_input_box.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\node_dialog_export_ppbr.h">
<Filter>Header Files</Filter>
<Filter>Header Files\ui</Filter>
</ClInclude>
<ClInclude Include="src\node_input_box.h">
<Filter>Header Files\ui</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>

View File

@@ -48,10 +48,13 @@
<border width="100%" color="0 0 0 .9" pad="10" dir="row" grow="1">
<border id="files-list" dir="row" wrap="1" flood-events="1" grow="1" height="100%" margin="0 0 0 0" pad="10" color=".2 .2 .2 1">
<node dir="col" margin="0 20 0 0">
<image width="200" height="100"/>
<node dir="row" width="200" height="30" justify="center" margin="10 0 0 0">
<button text="Generate" grow="1" height="100%"/>
<button text="Open..." grow="1" height="100%"/>
<image-texture id="header-tex" width="256" height="128" pad="10">
<text text="Header image.\nSelect a 256x128 pixels image that will be displayed as a preview for this brushes collection." text-wrap-width="230" color=".5"/>
</image-texture>
<node dir="row" width="256" height="30" justify="center" margin="10 0 0 0">
<button id="header-gen" text="Generate" grow="1" height="100%"/>
<button id="header-open" text="Open" grow="1" height="100%"/>
<button id="header-clear" text="Clear" grow="1" height="100%"/>
</node>
</node>
<node grow="1">

View File

@@ -1,6 +1,8 @@
#include "pch.h"
#include "log.h"
#include "node_dialog_export_ppbr.h"
#include "app.h"
#include "image.h"
Node* NodeDialogExportPPBR::clone_instantiate() const
{
@@ -26,10 +28,42 @@ void NodeDialogExportPPBR::init()
void NodeDialogExportPPBR::init_controls()
{
btn_ok = find<NodeButton>("btn-ok");
btn_ok->on_click = [this] (Node*) {
start_exporting();
};
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();
};
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");
}
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);
});
}
void NodeDialogExportPPBR::start_exporting()
{
}
void NodeDialogExportPPBR::added(Node* parent)

View File

@@ -3,15 +3,23 @@
#include "node_button.h"
#include "node_combobox.h"
#include "node_text.h"
#include "node_image_texture.h"
class NodeDialogExportPPBR : public NodeBorder
{
public:
NodeButton* btn_cancel;
NodeButton* btn_ok;
NodeButton* btn_header_open;
NodeButton* btn_header_clear;
NodeButton* btn_header_gen;
NodeImageTexture* img_header;
Image m_header_image;
virtual Node* clone_instantiate() const override;
virtual void clone_finalize(Node* dest) const override;
virtual void init() override;
virtual void added(Node* parent) override;
void init_controls();
void open_header();
void start_exporting();
};