fix floating panels and iOS export picking
This commit is contained in:
@@ -45,7 +45,7 @@
|
|||||||
<layout id="dialog-brush-upload">
|
<layout id="dialog-brush-upload">
|
||||||
<border id="background" positioning="absolute" position="0 0" color=".4 .4 .4 .8" width="100%" height="100%" align="center" justify="center" mouse-capture="true">
|
<border id="background" positioning="absolute" position="0 0" color=".4 .4 .4 .8" width="100%" height="100%" align="center" justify="center" mouse-capture="true">
|
||||||
<border id="form" thickness="1" border-color=".2" pad="3" width="650" dir="col">
|
<border id="form" thickness="1" border-color=".2" pad="3" width="650" dir="col">
|
||||||
<border id="title-bar" width="100%" height="30" color=".2 .2 .2 .9" dir="row" align="center" justify="center">
|
<border id="title" width="100%" height="30" color=".2 .2 .2 .9" dir="row" align="center" justify="center">
|
||||||
<text text="Save Brushes"></text>
|
<text text="Save Brushes"></text>
|
||||||
</border>
|
</border>
|
||||||
<border width="100%" color="0 0 0 .9" pad="10" dir="row" grow="1">
|
<border width="100%" color="0 0 0 .9" pad="10" dir="row" grow="1">
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
<!-- PANEL LAYERS -->
|
<!-- PANEL LAYERS -->
|
||||||
<layout id="tpl-panel-layers">
|
<layout id="tpl-panel-layers">
|
||||||
<node width="300" margin="0 0 10 0" rtl="ltr">
|
<node width="300" margin="0 0 10 0" rtl="ltr">
|
||||||
<border height="30" color=".4" align="center" justify="center" margin="0 0 0 0">
|
<border id="title" height="30" color=".4" align="center" justify="center" margin="0 0 0 0">
|
||||||
<text text="Layers" color="1 1 1 1"/>
|
<text text="Layers" color="1 1 1 1"/>
|
||||||
</border>
|
</border>
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
<!-- PANEL STROKE -->
|
<!-- PANEL STROKE -->
|
||||||
<layout id="tpl-panel-stroke">
|
<layout id="tpl-panel-stroke">
|
||||||
<node width="350" margin="0 0 10 0">
|
<node width="350" margin="0 0 10 0">
|
||||||
<border height="30" pad="5 0 0 0" color=".4" align="center" justify="center" dir="row">
|
<border id="title" height="30" pad="5 0 0 0" color=".4" align="center" justify="center" dir="row">
|
||||||
<node align="center" pad="0 0 0 30" justify="center" height="100%" width="1" grow="1">
|
<node align="center" pad="0 0 0 30" justify="center" height="100%" width="1" grow="1">
|
||||||
<text text="Brush Settings"/>
|
<text text="Brush Settings"/>
|
||||||
</node>
|
</node>
|
||||||
@@ -760,7 +760,7 @@
|
|||||||
<!-- PANEL GRIDS -->
|
<!-- PANEL GRIDS -->
|
||||||
<layout id="tpl-panel-grid">
|
<layout id="tpl-panel-grid">
|
||||||
<node width="350" margin="0 0 10 0" rtl="ltr">
|
<node width="350" margin="0 0 10 0" rtl="ltr">
|
||||||
<border height="30" color=".4" align="center" justify="center">
|
<border id="title" height="30" color=".4" align="center" justify="center">
|
||||||
<text text="Grids" color="1 1 1 1"/>
|
<text text="Grids" color="1 1 1 1"/>
|
||||||
</border>
|
</border>
|
||||||
<border color=".4" pad="5" dir="col" width="100%" grow="1">
|
<border color=".4" pad="5" dir="col" width="100%" grow="1">
|
||||||
@@ -1477,7 +1477,7 @@ Here's a list of what's available in this release.
|
|||||||
<button id="button-close" width="30" height="20" text="X" margin="0 0 0 5"/>
|
<button id="button-close" width="30" height="20" text="X" margin="0 0 0 5"/>
|
||||||
<button id="button-minimize" width="30" height="20" text="--" margin="0 0 0 5"/>
|
<button id="button-minimize" width="30" height="20" text="--" margin="0 0 0 5"/>
|
||||||
<node align="center" pad="0 30 0 30" justify="center" height="100%" grow="1">
|
<node align="center" pad="0 30 0 30" justify="center" height="100%" grow="1">
|
||||||
<text text="Floating Panel"/>
|
<text id="title" text="Floating Panel"/>
|
||||||
</node>
|
</node>
|
||||||
</border>
|
</border>
|
||||||
<border id="container" color="0 0 0 .9" dir="col" height="10" grow="1"/>
|
<border id="container" color="0 0 0 .9" dir="col" height="10" grow="1"/>
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ public:
|
|||||||
void pick_image(std::function<void(std::string path)> callback);
|
void pick_image(std::function<void(std::string path)> callback);
|
||||||
void pick_file(std::vector<std::string> types, std::function<void(std::string path)> callback);
|
void pick_file(std::vector<std::string> types, std::function<void(std::string path)> callback);
|
||||||
#if __IOS__
|
#if __IOS__
|
||||||
void pick_file_save(const std::string& type, std::function<void(std::string path)> writer);
|
void pick_file_save(const std::string& type, std::function<void(std::string path)> writer,
|
||||||
|
std::function<void(bool saved)> callback);
|
||||||
#else
|
#else
|
||||||
void pick_file_save(std::vector<std::string> types, std::function<void(std::string path)> callback);
|
void pick_file_save(std::vector<std::string> types, std::function<void(std::string path)> callback);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -609,9 +609,15 @@ void App::dialog_ppbr_export()
|
|||||||
info.descr = dialog->txt_descr->m_text;
|
info.descr = dialog->txt_descr->m_text;
|
||||||
info.header_image = dialog->m_header_image;
|
info.header_image = dialog->m_header_image;
|
||||||
#if __IOS__
|
#if __IOS__
|
||||||
App::I->pick_file_save("ppbr", [this, dialog, info] (std::string path) {
|
App::I->pick_file_save("ppbr",
|
||||||
presets->export_ppbr(path, info);
|
[this, dialog, info] (std::string path) {
|
||||||
});
|
presets->export_ppbr(path, info);
|
||||||
|
},
|
||||||
|
[dialog] (bool saved) {
|
||||||
|
if (saved)
|
||||||
|
dialog->destroy();
|
||||||
|
}
|
||||||
|
);
|
||||||
#else
|
#else
|
||||||
App::I->pick_file_save({ "ppbr" }, [this, dialog, info] (std::string path) {
|
App::I->pick_file_save({ "ppbr" }, [this, dialog, info] (std::string path) {
|
||||||
std::thread([this, path, dialog, info] {
|
std::thread([this, path, dialog, info] {
|
||||||
|
|||||||
@@ -194,25 +194,31 @@ void App::pick_file(std::vector<std::string> types, std::function<void (std::str
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if __IOS__
|
#if __IOS__
|
||||||
void App::pick_file_save(const std::string& type, std::function<void(std::string)> writer)
|
void App::pick_file_save(const std::string& type, std::function<void(std::string)> writer,
|
||||||
|
std::function<void(bool saved)> callback)
|
||||||
{
|
{
|
||||||
redraw = true;
|
redraw = true;
|
||||||
std::thread([=]{
|
auto mb = input_box("Insert", "File name");
|
||||||
auto mb = input_box("Insert", "File name");
|
std::string placeholder = "name." + type;
|
||||||
std::string placeholder = "name." + type;
|
mb->m_field_text->set_text(placeholder.c_str());
|
||||||
mb->m_field_text->set_text(placeholder.c_str());
|
mb->on_submit = [this, writer, type, callback] (Node* target, std::string name) {
|
||||||
mb->on_submit = [this, writer, type] (Node* target, std::string name) {
|
std::string ext = "." + type;
|
||||||
std::string ext = "." + type;
|
std::string path = data_path + "/" + name;
|
||||||
std::string path = data_path + "/" + name;
|
if (name.find(ext) == std::string::npos)
|
||||||
if (name.find(ext) == std::string::npos)
|
path += ext;
|
||||||
path += ext;
|
std::thread([=]{
|
||||||
writer(path);
|
writer(path);
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[ios_view pick_file_save:path];
|
[ios_view pick_file_save:path];
|
||||||
});
|
});
|
||||||
target->destroy();
|
target->destroy();
|
||||||
};
|
callback(true);
|
||||||
}).detach();
|
}).detach();
|
||||||
|
};
|
||||||
|
mb->btn_cancel->on_click = [=] (Node* target) {
|
||||||
|
callback(false);
|
||||||
|
target->destroy();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void App::pick_file_save(std::vector<std::string> types, std::function<void (std::string)> callback)
|
void App::pick_file_save(std::vector<std::string> types, std::function<void (std::string)> callback)
|
||||||
|
|||||||
@@ -252,6 +252,7 @@ void App::init_sidebar()
|
|||||||
}
|
}
|
||||||
layout[main_id]->add_child(stroke);
|
layout[main_id]->add_child(stroke);
|
||||||
stroke->SetSize(350, glm::max(100.f, screen.y - pos.y - 50.f));
|
stroke->SetSize(350, glm::max(100.f, screen.y - pos.y - 50.f));
|
||||||
|
stroke->find("title")->SetVisibility(true);
|
||||||
auto tick = layout[main_id]->add_child<NodeImage>();
|
auto tick = layout[main_id]->add_child<NodeImage>();
|
||||||
tick->SetPositioning(YGPositionTypeAbsolute);
|
tick->SetPositioning(YGPositionTypeAbsolute);
|
||||||
tick->SetSize(32, 16);
|
tick->SetSize(32, 16);
|
||||||
@@ -295,6 +296,7 @@ void App::init_sidebar()
|
|||||||
auto screen = layout[main_id]->m_size;
|
auto screen = layout[main_id]->m_size;
|
||||||
glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y);
|
glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y);
|
||||||
layout[main_id]->add_child(color);
|
layout[main_id]->add_child(color);
|
||||||
|
color->find("title")->SetVisibility(true);
|
||||||
color->SetSize(350, 350);
|
color->SetSize(350, 350);
|
||||||
auto tick = layout[main_id]->add_child<NodeImage>();
|
auto tick = layout[main_id]->add_child<NodeImage>();
|
||||||
tick->SetPositioning(YGPositionTypeAbsolute);
|
tick->SetPositioning(YGPositionTypeAbsolute);
|
||||||
@@ -320,6 +322,7 @@ void App::init_sidebar()
|
|||||||
button->on_click = [this, button](Node*) {
|
button->on_click = [this, button](Node*) {
|
||||||
auto screen = layout[main_id]->m_size;
|
auto screen = layout[main_id]->m_size;
|
||||||
glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y);
|
glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y);
|
||||||
|
layers->find("title")->SetVisibility(true);
|
||||||
layers->SetSize(350, YGUndefined);
|
layers->SetSize(350, YGUndefined);
|
||||||
if (layers->m_parent)
|
if (layers->m_parent)
|
||||||
{
|
{
|
||||||
@@ -356,6 +359,7 @@ void App::init_sidebar()
|
|||||||
button->on_click = [this, button](Node*) {
|
button->on_click = [this, button](Node*) {
|
||||||
auto screen = layout[main_id]->m_size;
|
auto screen = layout[main_id]->m_size;
|
||||||
glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y);
|
glm::vec2 pos = button->m_pos + glm::vec2(button->m_size.x * 0.5f, button->m_size.y);
|
||||||
|
grid->find("title")->SetVisibility(true);
|
||||||
grid->SetSize(350, YGUndefined);
|
grid->SetSize(350, YGUndefined);
|
||||||
if (grid->m_parent)
|
if (grid->m_parent)
|
||||||
{
|
{
|
||||||
@@ -776,6 +780,7 @@ void App::init_menu_tools()
|
|||||||
fpanel->SetHeight(300);
|
fpanel->SetHeight(300);
|
||||||
fpanel->SetMinHeight(300);
|
fpanel->SetMinHeight(300);
|
||||||
fpanel->SetMinWidth(100);
|
fpanel->SetMinWidth(100);
|
||||||
|
fpanel->m_title->set_text("Brushes");
|
||||||
if (!floating_presets)
|
if (!floating_presets)
|
||||||
{
|
{
|
||||||
floating_presets = fpanel->m_container->add_child_ref<NodePanelBrushPreset>();
|
floating_presets = fpanel->m_container->add_child_ref<NodePanelBrushPreset>();
|
||||||
@@ -805,12 +810,13 @@ void App::init_menu_tools()
|
|||||||
fpanel->m_class = NodePanelFloating::kClass::Color;
|
fpanel->m_class = NodePanelFloating::kClass::Color;
|
||||||
fpanel->SetHeight(300);
|
fpanel->SetHeight(300);
|
||||||
fpanel->SetMinHeight(300);
|
fpanel->SetMinHeight(300);
|
||||||
|
fpanel->m_title->set_text("Color Picker");
|
||||||
if (!floating_color)
|
if (!floating_color)
|
||||||
{
|
{
|
||||||
floating_color = fpanel->m_container->add_child_ref<NodePanelColor>();
|
floating_color = fpanel->m_container->add_child_ref<NodePanelColor>();
|
||||||
floating_color->SetHeightP(100);
|
floating_color->SetHeightP(100);
|
||||||
//floating_color->SetMinHeight(300);
|
//floating_color->SetMinHeight(300);
|
||||||
floating_color->find("title")->destroy();
|
floating_color->find("title")->SetVisibility(false);
|
||||||
floating_color->on_color_changed = [this](Node* target, glm::vec4 color) {
|
floating_color->on_color_changed = [this](Node* target, glm::vec4 color) {
|
||||||
Canvas::I->m_current_brush->m_tip_color = color;
|
Canvas::I->m_current_brush->m_tip_color = color;
|
||||||
brush_update(true, false);
|
brush_update(true, false);
|
||||||
@@ -830,9 +836,11 @@ void App::init_menu_tools()
|
|||||||
fpanel->m_class = NodePanelFloating::kClass::ColorAdv;
|
fpanel->m_class = NodePanelFloating::kClass::ColorAdv;
|
||||||
fpanel->SetHeight(300);
|
fpanel->SetHeight(300);
|
||||||
fpanel->SetWidth(300);
|
fpanel->SetWidth(300);
|
||||||
|
fpanel->m_title->set_text("Color Picker");
|
||||||
if (!floating_picker)
|
if (!floating_picker)
|
||||||
{
|
{
|
||||||
floating_picker = fpanel->m_container->add_child_ref<NodeColorPicker>();
|
floating_picker = fpanel->m_container->add_child_ref<NodeColorPicker>();
|
||||||
|
//floating_picker->find("title")->SetVisibility(false);
|
||||||
//floating_picker->SetHeightP(100);
|
//floating_picker->SetHeightP(100);
|
||||||
//floating_picker->SetWidth(250);
|
//floating_picker->SetWidth(250);
|
||||||
floating_picker->m_autohide = false;
|
floating_picker->m_autohide = false;
|
||||||
@@ -856,11 +864,13 @@ void App::init_menu_tools()
|
|||||||
fpanel->SetMinHeight(100);
|
fpanel->SetMinHeight(100);
|
||||||
fpanel->SetHeight(300);
|
fpanel->SetHeight(300);
|
||||||
fpanel->m_container->add_child(layers);
|
fpanel->m_container->add_child(layers);
|
||||||
|
fpanel->m_title->set_text("Layers");
|
||||||
layers->SetPositioning(YGPositionTypeRelative);
|
layers->SetPositioning(YGPositionTypeRelative);
|
||||||
layers->SetPosition(0, 0);
|
layers->SetPosition(0, 0);
|
||||||
layers->SetWidthP(100);
|
layers->SetWidthP(100);
|
||||||
layers->SetHeightP(100);
|
layers->SetHeightP(100);
|
||||||
layers->SetFlexShrink(0);
|
layers->SetFlexShrink(0);
|
||||||
|
layers->find("title")->SetVisibility(false);
|
||||||
|
|
||||||
popup_exp->destroy();
|
popup_exp->destroy();
|
||||||
popup_time->destroy();
|
popup_time->destroy();
|
||||||
@@ -872,10 +882,12 @@ void App::init_menu_tools()
|
|||||||
fpanel->m_class = NodePanelFloating::kClass::Brush;
|
fpanel->m_class = NodePanelFloating::kClass::Brush;
|
||||||
fpanel->m_container->add_child(stroke);
|
fpanel->m_container->add_child(stroke);
|
||||||
fpanel->SetHeight(300);
|
fpanel->SetHeight(300);
|
||||||
|
fpanel->m_title->set_text("Brush Settings");
|
||||||
stroke->SetPositioning(YGPositionTypeRelative);
|
stroke->SetPositioning(YGPositionTypeRelative);
|
||||||
stroke->SetPosition(0, 0);
|
stroke->SetPosition(0, 0);
|
||||||
stroke->SetWidthP(100);
|
stroke->SetWidthP(100);
|
||||||
stroke->SetHeightP(100);
|
stroke->SetHeightP(100);
|
||||||
|
stroke->find("title")->SetVisibility(false);
|
||||||
|
|
||||||
popup_exp->destroy();
|
popup_exp->destroy();
|
||||||
popup_time->destroy();
|
popup_time->destroy();
|
||||||
@@ -887,10 +899,12 @@ void App::init_menu_tools()
|
|||||||
fpanel->m_class = NodePanelFloating::kClass::Grids;
|
fpanel->m_class = NodePanelFloating::kClass::Grids;
|
||||||
fpanel->m_container->add_child(grid);
|
fpanel->m_container->add_child(grid);
|
||||||
fpanel->SetHeight(300);
|
fpanel->SetHeight(300);
|
||||||
|
fpanel->m_title->set_text("Grid");
|
||||||
grid->SetPositioning(YGPositionTypeRelative);
|
grid->SetPositioning(YGPositionTypeRelative);
|
||||||
grid->SetPosition(0, 0);
|
grid->SetPosition(0, 0);
|
||||||
grid->SetWidthP(100);
|
grid->SetWidthP(100);
|
||||||
grid->SetHeightP(100);
|
grid->SetHeightP(100);
|
||||||
|
grid->find("title")->SetVisibility(false);
|
||||||
|
|
||||||
popup_exp->destroy();
|
popup_exp->destroy();
|
||||||
popup_time->destroy();
|
popup_time->destroy();
|
||||||
@@ -1410,6 +1424,7 @@ void App::ui_save()
|
|||||||
fd->set("pos", Serializer::Vec2(f->GetPosition()));
|
fd->set("pos", Serializer::Vec2(f->GetPosition()));
|
||||||
fd->set("size", Serializer::Vec2(f->m_size));
|
fd->set("size", Serializer::Vec2(f->m_size));
|
||||||
fd->set("class", Serializer::Integer((int)f->m_class));
|
fd->set("class", Serializer::Integer((int)f->m_class));
|
||||||
|
fd->set("title", Serializer::CString(f->m_title->m_text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d.set("floatings", list_floatings);
|
d.set("floatings", list_floatings);
|
||||||
@@ -1423,6 +1438,7 @@ void App::ui_save()
|
|||||||
fd->class_id = "ui-dpl";
|
fd->class_id = "ui-dpl";
|
||||||
fd->set("size", Serializer::Vec2(f->m_size));
|
fd->set("size", Serializer::Vec2(f->m_size));
|
||||||
fd->set("class", Serializer::Integer((int)f->m_class));
|
fd->set("class", Serializer::Integer((int)f->m_class));
|
||||||
|
fd->set("title", Serializer::CString(f->m_title->m_text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d.set("drop-left", list_drop_left);
|
d.set("drop-left", list_drop_left);
|
||||||
@@ -1436,6 +1452,7 @@ void App::ui_save()
|
|||||||
fd->class_id = "ui-dpr";
|
fd->class_id = "ui-dpr";
|
||||||
fd->set("size", Serializer::Vec2(f->m_size));
|
fd->set("size", Serializer::Vec2(f->m_size));
|
||||||
fd->set("class", Serializer::Integer((int)f->m_class));
|
fd->set("class", Serializer::Integer((int)f->m_class));
|
||||||
|
fd->set("title", Serializer::CString(f->m_title->m_text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d.set("drop-right", list_drop_right);
|
d.set("drop-right", list_drop_right);
|
||||||
@@ -1471,6 +1488,9 @@ void App::ui_restore()
|
|||||||
auto size = ld->value<Serializer::Vec2>("size");
|
auto size = ld->value<Serializer::Vec2>("size");
|
||||||
auto cls = static_cast<NodePanelFloating::kClass>(ld->value<Serializer::Integer>("class"));
|
auto cls = static_cast<NodePanelFloating::kClass>(ld->value<Serializer::Integer>("class"));
|
||||||
auto f = floatings->add_child<NodePanelFloating>();
|
auto f = floatings->add_child<NodePanelFloating>();
|
||||||
|
std::string title = "Floating Panel";
|
||||||
|
ld->value<Serializer::CString>("title", title);
|
||||||
|
f->m_title->set_text(title.c_str());
|
||||||
switch (cls)
|
switch (cls)
|
||||||
{
|
{
|
||||||
case NodePanelFloating::kClass::Presets:
|
case NodePanelFloating::kClass::Presets:
|
||||||
@@ -1491,7 +1511,7 @@ void App::ui_restore()
|
|||||||
{
|
{
|
||||||
floating_color = f->m_container->add_child_ref<NodePanelColor>();
|
floating_color = f->m_container->add_child_ref<NodePanelColor>();
|
||||||
floating_color->SetHeightP(100);
|
floating_color->SetHeightP(100);
|
||||||
floating_color->find("title")->destroy();
|
floating_color->find("title")->SetVisibility(false);
|
||||||
floating_color->on_color_changed = [this](Node* target, glm::vec4 color) {
|
floating_color->on_color_changed = [this](Node* target, glm::vec4 color) {
|
||||||
Canvas::I->m_current_brush->m_tip_color = color;
|
Canvas::I->m_current_brush->m_tip_color = color;
|
||||||
brush_update(true, false);
|
brush_update(true, false);
|
||||||
@@ -1512,6 +1532,7 @@ void App::ui_restore()
|
|||||||
f->m_container->add_child(layers);
|
f->m_container->add_child(layers);
|
||||||
f->SetMinHeight(100);
|
f->SetMinHeight(100);
|
||||||
f->SetHeight(300);
|
f->SetHeight(300);
|
||||||
|
layers->find("title")->SetVisibility(false);
|
||||||
layers->SetPositioning(YGPositionTypeRelative);
|
layers->SetPositioning(YGPositionTypeRelative);
|
||||||
layers->SetPosition(0, 0);
|
layers->SetPosition(0, 0);
|
||||||
layers->SetWidthP(100);
|
layers->SetWidthP(100);
|
||||||
@@ -1520,6 +1541,7 @@ void App::ui_restore()
|
|||||||
break;
|
break;
|
||||||
case NodePanelFloating::kClass::Brush:
|
case NodePanelFloating::kClass::Brush:
|
||||||
f->m_container->add_child(stroke);
|
f->m_container->add_child(stroke);
|
||||||
|
stroke->find("title")->SetVisibility(false);
|
||||||
stroke->SetPositioning(YGPositionTypeRelative);
|
stroke->SetPositioning(YGPositionTypeRelative);
|
||||||
stroke->SetPosition(0, 0);
|
stroke->SetPosition(0, 0);
|
||||||
stroke->SetWidthP(100);
|
stroke->SetWidthP(100);
|
||||||
@@ -1527,6 +1549,7 @@ void App::ui_restore()
|
|||||||
break;
|
break;
|
||||||
case NodePanelFloating::kClass::Grids:
|
case NodePanelFloating::kClass::Grids:
|
||||||
f->m_container->add_child(grid);
|
f->m_container->add_child(grid);
|
||||||
|
grid->find("title")->SetVisibility(false);
|
||||||
grid->SetPositioning(YGPositionTypeRelative);
|
grid->SetPositioning(YGPositionTypeRelative);
|
||||||
grid->SetPosition(0, 0);
|
grid->SetPosition(0, 0);
|
||||||
grid->SetWidthP(100);
|
grid->SetWidthP(100);
|
||||||
@@ -1549,6 +1572,9 @@ void App::ui_restore()
|
|||||||
auto size = ld->value<Serializer::Vec2>("size");
|
auto size = ld->value<Serializer::Vec2>("size");
|
||||||
auto cls = static_cast<NodePanelFloating::kClass>(ld->value<Serializer::Integer>("class"));
|
auto cls = static_cast<NodePanelFloating::kClass>(ld->value<Serializer::Integer>("class"));
|
||||||
auto f = drop_left->add_child<NodePanelFloating>();
|
auto f = drop_left->add_child<NodePanelFloating>();
|
||||||
|
std::string title = "Floating Panel";
|
||||||
|
ld->value<Serializer::CString>("title", title);
|
||||||
|
f->m_title->set_text(title.c_str());
|
||||||
switch (cls)
|
switch (cls)
|
||||||
{
|
{
|
||||||
case NodePanelFloating::kClass::Presets:
|
case NodePanelFloating::kClass::Presets:
|
||||||
@@ -1626,6 +1652,9 @@ void App::ui_restore()
|
|||||||
auto size = ld->value<Serializer::Vec2>("size");
|
auto size = ld->value<Serializer::Vec2>("size");
|
||||||
auto cls = static_cast<NodePanelFloating::kClass>(ld->value<Serializer::Integer>("class"));
|
auto cls = static_cast<NodePanelFloating::kClass>(ld->value<Serializer::Integer>("class"));
|
||||||
auto f = drop_right->add_child<NodePanelFloating>();
|
auto f = drop_right->add_child<NodePanelFloating>();
|
||||||
|
std::string title = "Floating Panel";
|
||||||
|
ld->value<Serializer::CString>("title", title);
|
||||||
|
f->m_title->set_text(title.c_str());
|
||||||
switch (cls)
|
switch (cls)
|
||||||
{
|
{
|
||||||
case NodePanelFloating::kClass::Presets:
|
case NodePanelFloating::kClass::Presets:
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ void NodeDialogExportPPBR::init()
|
|||||||
|
|
||||||
void NodeDialogExportPPBR::init_controls()
|
void NodeDialogExportPPBR::init_controls()
|
||||||
{
|
{
|
||||||
|
m_title = find<NodeText>("title");
|
||||||
btn_ok = find<NodeButton>("btn-ok");
|
btn_ok = find<NodeButton>("btn-ok");
|
||||||
btn_cancel = find<NodeButton>("btn-cancel");
|
btn_cancel = find<NodeButton>("btn-cancel");
|
||||||
btn_cancel->on_click = [this](Node*) {
|
btn_cancel->on_click = [this](Node*) {
|
||||||
@@ -48,10 +49,10 @@ void NodeDialogExportPPBR::init_controls()
|
|||||||
};
|
};
|
||||||
img_header = find<NodeImageTexture>("header-tex");
|
img_header = find<NodeImageTexture>("header-tex");
|
||||||
txt_header_descr = find<NodeText>("header-descr");
|
txt_header_descr = find<NodeText>("header-descr");
|
||||||
txt_author = find<NodeText>("info-author");
|
txt_author = find<NodeTextInput>("info-author");
|
||||||
txt_email = find<NodeText>("info-email");
|
txt_email = find<NodeTextInput>("info-email");
|
||||||
txt_url = find<NodeText>("info-url");
|
txt_url = find<NodeTextInput>("info-url");
|
||||||
txt_descr = find<NodeText>("info-descr");
|
txt_descr = find<NodeTextInput>("info-descr");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeDialogExportPPBR::open_header()
|
void NodeDialogExportPPBR::open_header()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "node_button.h"
|
#include "node_button.h"
|
||||||
#include "node_combobox.h"
|
#include "node_combobox.h"
|
||||||
#include "node_text.h"
|
#include "node_text.h"
|
||||||
|
#include "node_text_input.h"
|
||||||
#include "node_image_texture.h"
|
#include "node_image_texture.h"
|
||||||
|
|
||||||
class NodeDialogExportPPBR : public NodeBorder
|
class NodeDialogExportPPBR : public NodeBorder
|
||||||
@@ -13,13 +14,14 @@ public:
|
|||||||
NodeButton* btn_header_open;
|
NodeButton* btn_header_open;
|
||||||
NodeButton* btn_header_clear;
|
NodeButton* btn_header_clear;
|
||||||
NodeButton* btn_header_gen;
|
NodeButton* btn_header_gen;
|
||||||
|
NodeText* m_title;
|
||||||
NodeImageTexture* img_header;
|
NodeImageTexture* img_header;
|
||||||
std::shared_ptr<Image> m_header_image;
|
std::shared_ptr<Image> m_header_image;
|
||||||
NodeText* txt_header_descr;
|
NodeText* txt_header_descr;
|
||||||
NodeText* txt_author;
|
NodeTextInput* txt_author;
|
||||||
NodeText* txt_descr;
|
NodeTextInput* txt_descr;
|
||||||
NodeText* txt_url;
|
NodeTextInput* txt_url;
|
||||||
NodeText* txt_email;
|
NodeTextInput* txt_email;
|
||||||
virtual Node* clone_instantiate() const override;
|
virtual Node* clone_instantiate() const override;
|
||||||
virtual void clone_finalize(Node* dest) const override;
|
virtual void clone_finalize(Node* dest) const override;
|
||||||
virtual void init() override;
|
virtual void init() override;
|
||||||
|
|||||||
@@ -54,4 +54,5 @@ void NodeInputBox::added(Node* parent)
|
|||||||
{
|
{
|
||||||
Node::added(parent);
|
Node::added(parent);
|
||||||
mouse_capture();
|
mouse_capture();
|
||||||
|
m_field_text->key_capture();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -693,9 +693,9 @@ bool NodePanelBrushPreset::export_ppbr(const std::string& path, const PPBRInfo&
|
|||||||
auto base = m[1].str();
|
auto base = m[1].str();
|
||||||
auto name = m[2].str();
|
auto name = m[2].str();
|
||||||
auto ext = m[3].str();
|
auto ext = m[3].str();
|
||||||
std::string out_path = base + "/" + name;
|
std::string out_path = base + "/" + name + "_data";
|
||||||
|
|
||||||
Asset::create_dir(out_path);
|
bool path_created = Asset::create_dir(out_path);
|
||||||
|
|
||||||
std::ofstream f(path, std::ios::binary);
|
std::ofstream f(path, std::ios::binary);
|
||||||
if (f.good())
|
if (f.good())
|
||||||
@@ -744,7 +744,8 @@ bool NodePanelBrushPreset::export_ppbr(const std::string& path, const PPBRInfo&
|
|||||||
if (has_header_image)
|
if (has_header_image)
|
||||||
{
|
{
|
||||||
sw << *info_data.header_image;
|
sw << *info_data.header_image;
|
||||||
info_data.header_image->save_jpg(out_path + "/header.jpg", 75);
|
if (path_created)
|
||||||
|
info_data.header_image->save_jpg(out_path + "/header.jpg", 75);
|
||||||
}
|
}
|
||||||
|
|
||||||
pb->increment();
|
pb->increment();
|
||||||
@@ -762,7 +763,8 @@ bool NodePanelBrushPreset::export_ppbr(const std::string& path, const PPBRInfo&
|
|||||||
Image img = pr->render_to_image();
|
Image img = pr->render_to_image();
|
||||||
img.file_name = pr->m_brush->m_name;
|
img.file_name = pr->m_brush->m_name;
|
||||||
sw << img;
|
sw << img;
|
||||||
img.save_jpg(fmt::format(out_path + "/thumb-{:04d}.jpg", thumb_counter), 75);
|
if (path_created)
|
||||||
|
img.save_jpg(fmt::format(out_path + "/thumb-{:04d}.jpg", thumb_counter), 75);
|
||||||
thumb_counter++;
|
thumb_counter++;
|
||||||
pb->increment();
|
pb->increment();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ void NodePanelFloating::init_controls()
|
|||||||
m_flood_events = true;
|
m_flood_events = true;
|
||||||
m_capture_children = true;
|
m_capture_children = true;
|
||||||
m_container = find("container");
|
m_container = find("container");
|
||||||
|
m_title = find<NodeText>("title");
|
||||||
m_button_minimize = find<NodeButton>("button-minimize");
|
m_button_minimize = find<NodeButton>("button-minimize");
|
||||||
m_button_minimize->on_click = [this](Node*) {
|
m_button_minimize->on_click = [this](Node*) {
|
||||||
m_container->ToggleVisibility();
|
m_container->ToggleVisibility();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "node_border.h"
|
#include "node_border.h"
|
||||||
#include "node_button.h"
|
#include "node_button.h"
|
||||||
|
#include "node_text.h"
|
||||||
|
|
||||||
class NodePanelFloating : public NodeBorder
|
class NodePanelFloating : public NodeBorder
|
||||||
{
|
{
|
||||||
@@ -15,6 +16,7 @@ class NodePanelFloating : public NodeBorder
|
|||||||
std::shared_ptr<NodeBorder> m_drop_placeholder;
|
std::shared_ptr<NodeBorder> m_drop_placeholder;
|
||||||
public:
|
public:
|
||||||
Node* m_container;
|
Node* m_container;
|
||||||
|
NodeText* m_title;
|
||||||
std::weak_ptr<Node> m_dock;
|
std::weak_ptr<Node> m_dock;
|
||||||
using this_class = NodePanelFloating;
|
using this_class = NodePanelFloating;
|
||||||
using parent = NodeBorder;
|
using parent = NodeBorder;
|
||||||
|
|||||||
@@ -577,6 +577,8 @@ std::wstring str2wstr(const std::string& str)
|
|||||||
//const char* ptr = str.c_str();
|
//const char* ptr = str.c_str();
|
||||||
//std::mbsrtowcs((wchar_t*)converted.data(), &ptr, converted.capacity(), &st);
|
//std::mbsrtowcs((wchar_t*)converted.data(), &ptr, converted.capacity(), &st);
|
||||||
//return converted;
|
//return converted;
|
||||||
|
if (str.empty())
|
||||||
|
return {};
|
||||||
using convert_typeX = std::codecvt_utf8<wchar_t>;
|
using convert_typeX = std::codecvt_utf8<wchar_t>;
|
||||||
std::wstring_convert<convert_typeX, wchar_t> converterX;
|
std::wstring_convert<convert_typeX, wchar_t> converterX;
|
||||||
return converterX.from_bytes(str);
|
return converterX.from_bytes(str);
|
||||||
@@ -590,6 +592,8 @@ std::string wstr2str(const std::wstring & wstr)
|
|||||||
//const wchar_t * wptr = wstr.c_str();
|
//const wchar_t * wptr = wstr.c_str();
|
||||||
//std::wcsrtombs((char*)converted.data(), &wptr, converted.capacity(), &st);
|
//std::wcsrtombs((char*)converted.data(), &wptr, converted.capacity(), &st);
|
||||||
//return converted;
|
//return converted;
|
||||||
|
if (wstr.empty())
|
||||||
|
return {};
|
||||||
using convert_typeX = std::codecvt_utf8<wchar_t>;
|
using convert_typeX = std::codecvt_utf8<wchar_t>;
|
||||||
std::wstring_convert<convert_typeX, wchar_t> converterX;
|
std::wstring_convert<convert_typeX, wchar_t> converterX;
|
||||||
return converterX.to_bytes(wstr);
|
return converterX.to_bytes(wstr);
|
||||||
|
|||||||
Reference in New Issue
Block a user