diff --git a/data/layout.xml b/data/layout.xml
index 407e0bd..bed7903 100644
--- a/data/layout.xml
+++ b/data/layout.xml
@@ -61,6 +61,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -72,9 +84,9 @@
-
+
@@ -99,14 +111,17 @@
diff --git a/src/app.h b/src/app.h
index c06dd70..5ec9e37 100644
--- a/src/app.h
+++ b/src/app.h
@@ -235,6 +235,7 @@ public:
void dialog_export_cube_faces();
void dialog_layer_rename();
void dialog_resize();
+ void dialog_preset_download();
void cloud_upload();
void cloud_upload_all();
diff --git a/src/app_dialogs.cpp b/src/app_dialogs.cpp
index acb70f9..320d11c 100644
--- a/src/app_dialogs.cpp
+++ b/src/app_dialogs.cpp
@@ -575,3 +575,8 @@ void App::dialog_layer_rename()
App::I->hideKeyboard();
};
}
+
+void App::dialog_preset_download()
+{
+
+}
diff --git a/src/app_layout.cpp b/src/app_layout.cpp
index 50718ca..2db2db9 100644
--- a/src/app_layout.cpp
+++ b/src/app_layout.cpp
@@ -804,8 +804,8 @@ void App::init_menu_tools()
{
fpanel->m_container->add_child(floating_presets);
}
- popup_time->destroy();
popup_exp->destroy();
+ popup_time->destroy();
};
popup_time->find("panel-color")->on_click = [this, popup_time, popup_exp, visible](Node*) {
@@ -830,8 +830,8 @@ void App::init_menu_tools()
{
fpanel->m_container->add_child(floating_color);
}
- popup_time->destroy();
popup_exp->destroy();
+ popup_time->destroy();
};
popup_time->find("panel-color-adv")->on_click = [this, popup_time, popup_exp, visible](Node*) {
if (visible(floating_picker.get()))
@@ -855,8 +855,8 @@ void App::init_menu_tools()
{
fpanel->m_container->add_child(floating_picker);
}
- popup_time->destroy();
popup_exp->destroy();
+ popup_time->destroy();
};
popup_time->find("panel-layers")->on_click = [this, popup_time, popup_exp, visible](Node*) {
if (visible(layers.get()))
@@ -872,8 +872,8 @@ void App::init_menu_tools()
layers->SetHeightP(100);
layers->SetFlexShrink(0);
- popup_time->destroy();
popup_exp->destroy();
+ popup_time->destroy();
};
popup_time->find("panel-brush")->on_click = [this, popup_time, popup_exp, visible](Node*) {
if (visible(stroke.get()))
@@ -887,8 +887,8 @@ void App::init_menu_tools()
stroke->SetWidthP(100);
stroke->SetHeightP(100);
- popup_time->destroy();
popup_exp->destroy();
+ popup_time->destroy();
};
popup_time->find("panel-grids")->on_click = [this, popup_time, popup_exp, visible](Node*) {
if (visible(grid.get()))
@@ -902,8 +902,8 @@ void App::init_menu_tools()
grid->SetWidthP(100);
grid->SetHeightP(100);
- popup_time->destroy();
popup_exp->destroy();
+ popup_time->destroy();
};
}
};
@@ -1499,7 +1499,7 @@ void App::ui_restore()
{
floating_presets = f->m_container->add_child_ref();
floating_presets->SetHeightP(100);
- floating_presets->find("toolbar")->destroy();
+ //floating_presets->find("toolbar")->destroy();
floating_presets->on_brush_changed = [this](Node* target, std::shared_ptr& b) {
auto c = Canvas::I->m_current_brush->m_tip_color;
*Canvas::I->m_current_brush = *b;
diff --git a/src/node_panel_brush.cpp b/src/node_panel_brush.cpp
index aa592b1..a76c40b 100644
--- a/src/node_panel_brush.cpp
+++ b/src/node_panel_brush.cpp
@@ -427,6 +427,7 @@ void NodePanelBrushPreset::init()
save();
}
};
+/*
m_btn_save = find("btn-save");
m_btn_save->on_click = [this](Node*) {
if (m_current)
@@ -437,6 +438,7 @@ void NodePanelBrushPreset::init()
save();
}
};
+*/
m_btn_delete = find("btn-remove");
m_btn_delete->on_click = [this](Node*) {
if (!m_current)
@@ -454,6 +456,7 @@ void NodePanelBrushPreset::init()
m_current->m_selected = true;
}
save();
+ m_notification->SetVisibility(m_container->m_children.size() == 0);
};
m_btn_menu = find("btn-menu");
m_btn_menu->on_click = [this](Node* b) {
@@ -469,10 +472,11 @@ void NodePanelBrushPreset::init()
case 0: // download
break;
case 1: // import
- App::I->pick_file({"abr", "ppbr"}, [] (std::string path) {
- std::thread([path] {
+ App::I->pick_file({"abr", "ppbr"}, [this] (std::string path) {
+ std::thread([this, path] {
BT_SetTerminate();
App::I->stroke->import_abr(path);
+ m_notification->SetVisibility(m_container->m_children.size() == 0);
}).detach();
});
break;
@@ -482,6 +486,21 @@ void NodePanelBrushPreset::init()
popup->destroy();
};
};
+ m_btn_import = find("import");
+ m_btn_import->on_click = [this] (Node*) {
+ App::I->pick_file({ "abr", "ppbr" }, [this](std::string path) {
+ std::thread([this, path] {
+ BT_SetTerminate();
+ App::I->stroke->import_abr(path);
+ m_notification->SetVisibility(m_container->m_children.size() == 0);
+ }).detach();
+ });
+ };
+ m_btn_download = find("download");
+ m_btn_download->on_click = [] (Node*) {
+ App::I->dialog_preset_download();
+ };
+ m_notification = find("notification");
if (Asset::exist(App::I->data_path + "/settings/presets.bin") && !restore())
{
@@ -494,6 +513,7 @@ void NodePanelBrushPreset::init()
mb->destroy();
};
}
+ m_notification->SetVisibility(m_container->m_children.size() == 0);
}
kEventResult NodePanelBrushPreset::handle_event(Event* e)
@@ -608,6 +628,7 @@ bool NodePanelBrushPreset::restore()
brush->on_click = std::bind(&NodePanelBrushPreset::handle_click, this, std::placeholders::_1);
}
}
+ m_notification->SetVisibility(m_container->m_children.size() == 0);
return true;
}
return false;
@@ -630,14 +651,17 @@ void NodePanelBrushPreset::add_brush(std::shared_ptr brush)
b->m_thumb->set_image(brush->m_brush_thumb_path);
b->m_caption_size->set_text_format("%d", (int)brush->m_tip_size);
b->on_click = std::bind(&NodePanelBrushPreset::handle_click, this, std::placeholders::_1);
+ m_notification->SetVisibility(m_container->m_children.size() == 0);
}
void NodePanelBrushPreset::clear_brushes()
{
m_container->remove_all_children();
+ m_notification->SetVisibility(m_container->m_children.size() == 0);
}
void NodePanelBrushPreset::added(Node* parent)
{
m_interacted = false;
+ m_notification->SetVisibility(m_container->m_children.size() == 0);
}
diff --git a/src/node_panel_brush.h b/src/node_panel_brush.h
index c0f4766..9204c6d 100644
--- a/src/node_panel_brush.h
+++ b/src/node_panel_brush.h
@@ -7,6 +7,7 @@
#include "node_scroll.h"
#include "node_text.h"
#include "serializer.h"
+#include "node_button.h"
class NodeButtonBrush : public NodeButtonCustom, public Serializer::Type
{
@@ -82,6 +83,9 @@ class NodePanelBrushPreset : public Node
NodeButtonCustom* m_btn_delete;
NodeButtonCustom* m_btn_save;
NodeButtonCustom* m_btn_menu;
+ NodeButton* m_btn_import;
+ NodeButton* m_btn_download;
+ Node* m_notification;
public:
Node* m_container;
std::function& brush)> on_brush_changed;