make popup ptr local on main menu
This commit is contained in:
19
src/abr.cpp
19
src/abr.cpp
@@ -25,6 +25,7 @@ bool ABR::section_samp()
|
|||||||
{
|
{
|
||||||
auto samp_size = ru32();
|
auto samp_size = ru32();
|
||||||
auto uid = rpascal();
|
auto uid = rpascal();
|
||||||
|
printf("sample brush %s\n", uid.c_str());
|
||||||
skip(4);
|
skip(4);
|
||||||
auto image = parse_vmem();
|
auto image = parse_vmem();
|
||||||
if (image->channels.size() >= 3)
|
if (image->channels.size() >= 3)
|
||||||
@@ -67,6 +68,7 @@ bool ABR::section_patt()
|
|||||||
auto image_mode = ru32();
|
auto image_mode = ru32();
|
||||||
if (!(image_mode == 1 || image_mode == 3))
|
if (!(image_mode == 1 || image_mode == 3))
|
||||||
{
|
{
|
||||||
|
printf("skip image mode %d\n", image_mode);
|
||||||
skip(patt_length - 8);
|
skip(patt_length - 8);
|
||||||
snap();
|
snap();
|
||||||
continue;
|
continue;
|
||||||
@@ -113,16 +115,16 @@ bool ABR::section_patt()
|
|||||||
std::shared_ptr<ABR::Image> ABR::parse_vmem()
|
std::shared_ptr<ABR::Image> ABR::parse_vmem()
|
||||||
{
|
{
|
||||||
// Virtual Memory Array List
|
// Virtual Memory Array List
|
||||||
auto version = ru32(); // = 3
|
auto vmem_version = ru32(); // = 3
|
||||||
auto length = ru32();
|
auto vmem_length = ru32();
|
||||||
auto rect = rrect();
|
auto vmem_rect = rrect();
|
||||||
auto channels = ru32();
|
auto vmem_channels = ru32();
|
||||||
// The following is a virtual memory array,
|
// The following is a virtual memory array,
|
||||||
// repeated for the number of channels
|
// repeated for the number of channels
|
||||||
// + one for a user mask + one for a sheet mask.
|
// + one for a user mask + one for a sheet mask.
|
||||||
channels += 2; // user and sheet mask
|
vmem_channels += 2; // user and sheet mask
|
||||||
auto ret = std::make_shared<Image>(version, rect);
|
auto ret = std::make_shared<Image>(vmem_version, vmem_rect);
|
||||||
for (int ch = 0; ch < channels; ch++)
|
for (int ch = 0; ch < vmem_channels; ch++)
|
||||||
{
|
{
|
||||||
auto array_written = ru32(); // skip if 0
|
auto array_written = ru32(); // skip if 0
|
||||||
if (array_written == 0)
|
if (array_written == 0)
|
||||||
@@ -147,6 +149,7 @@ std::shared_ptr<ABR::Image> ABR::parse_vmem()
|
|||||||
}
|
}
|
||||||
else if (compression == 1)
|
else if (compression == 1)
|
||||||
{
|
{
|
||||||
|
auto start = pos();
|
||||||
auto height = rect.height();
|
auto height = rect.height();
|
||||||
// contain the compressed length of each scanline
|
// contain the compressed length of each scanline
|
||||||
std::vector<uint16_t> scanlines;
|
std::vector<uint16_t> scanlines;
|
||||||
@@ -160,6 +163,7 @@ std::shared_ptr<ABR::Image> ABR::parse_vmem()
|
|||||||
raw.insert(raw.end(), decoded.begin(), decoded.end());
|
raw.insert(raw.end(), decoded.begin(), decoded.end());
|
||||||
}
|
}
|
||||||
ret->channels.emplace_back(depth, rect, compression, raw);
|
ret->channels.emplace_back(depth, rect, compression, raw);
|
||||||
|
auto len = pos() - start;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -300,6 +304,7 @@ bool ABR::open(const std::string& path)
|
|||||||
init(asset.read_all(), asset.m_len, BinaryStream::ByteOrder::BigEndian);
|
init(asset.read_all(), asset.m_len, BinaryStream::ByteOrder::BigEndian);
|
||||||
auto version_major = ru16();
|
auto version_major = ru16();
|
||||||
auto version_minor = ru16();
|
auto version_minor = ru16();
|
||||||
|
printf("ABR %d.%d\n", version_major, version_minor);
|
||||||
while (!eof())
|
while (!eof())
|
||||||
{
|
{
|
||||||
if (rstring(4) != "8BIM")
|
if (rstring(4) != "8BIM")
|
||||||
|
|||||||
15
src/abr.h
15
src/abr.h
@@ -105,8 +105,9 @@ public:
|
|||||||
n = -n + 1;
|
n = -n + 1;
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
|
auto ch = ru8();
|
||||||
for (int c = 0; c < n; c++)
|
for (int c = 0; c < n; c++)
|
||||||
data.push_back(ru8());
|
data.push_back(ch);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -213,7 +214,7 @@ class ABR : public BinaryStream
|
|||||||
Type::Vec items;
|
Type::Vec items;
|
||||||
virtual std::string str(int indent, const std::string& prefix) const override
|
virtual std::string str(int indent, const std::string& prefix) const override
|
||||||
{
|
{
|
||||||
auto ret = std::string(indent, '-') + fmt::format("list: {} props:", items.size());
|
auto ret = std::string(indent, '-') + fmt::format("list: {} items:", items.size());
|
||||||
for (int i = 0; i < items.size(); i++)
|
for (int i = 0; i < items.size(); i++)
|
||||||
ret += "\n" + items[i]->str(indent + 1, fmt::format("{}) ", i));
|
ret += "\n" + items[i]->str(indent + 1, fmt::format("{}) ", i));
|
||||||
return ret;
|
return ret;
|
||||||
@@ -371,11 +372,11 @@ private:
|
|||||||
auto& method = m_parser_table[t];
|
auto& method = m_parser_table[t];
|
||||||
return method();
|
return method();
|
||||||
}
|
}
|
||||||
else if (m_parser_table.find(pick(4)) != m_parser_table.end())
|
//else if (m_parser_table.find(pick(4)) != m_parser_table.end())
|
||||||
{
|
//{
|
||||||
auto& method = m_parser_table[rstring(4)];
|
// auto& method = m_parser_table[rstring(4)];
|
||||||
return method();
|
// return method();
|
||||||
}
|
//}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
std::map<std::string, std::function<Type::Ref()>> m_parser_table;
|
std::map<std::string, std::function<Type::Ref()>> m_parser_table;
|
||||||
|
|||||||
@@ -56,8 +56,6 @@ public:
|
|||||||
LayoutManager layout;
|
LayoutManager layout;
|
||||||
NodeMessageBox* msgbox;
|
NodeMessageBox* msgbox;
|
||||||
NodeSettings* settings;
|
NodeSettings* settings;
|
||||||
NodePopupMenu* popup = nullptr;
|
|
||||||
NodePopupMenu* subpopup = nullptr;
|
|
||||||
NodePopupMenu* menu_file = nullptr;
|
NodePopupMenu* menu_file = nullptr;
|
||||||
NodePopupMenu* menu_edit = nullptr;
|
NodePopupMenu* menu_edit = nullptr;
|
||||||
NodePopupMenu* menu_layers = nullptr;
|
NodePopupMenu* menu_layers = nullptr;
|
||||||
|
|||||||
@@ -478,9 +478,6 @@ void App::dialog_resize()
|
|||||||
ActionManager::clear();
|
ActionManager::clear();
|
||||||
dialog->destroy();
|
dialog->destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
popup->mouse_release();
|
|
||||||
popup->destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::dialog_export_cubes()
|
void App::dialog_export_cubes()
|
||||||
@@ -517,7 +514,4 @@ void App::dialog_layer_rename()
|
|||||||
dialog->destroy();
|
dialog->destroy();
|
||||||
App::I.hideKeyboard();
|
App::I.hideKeyboard();
|
||||||
};
|
};
|
||||||
|
|
||||||
popup->mouse_release();
|
|
||||||
popup->destroy();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ void App::init_menu_file()
|
|||||||
{
|
{
|
||||||
menu_file->on_click = [=](Node*) {
|
menu_file->on_click = [=](Node*) {
|
||||||
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
||||||
popup = (NodePopupMenu*)layout[const_hash("file-menu")]->m_children[0]->clone();
|
auto popup = (NodePopupMenu*)layout[const_hash("file-menu")]->m_children[0]->clone();
|
||||||
popup->update();
|
popup->update();
|
||||||
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
||||||
pos.x = pos.x - popup->m_size.x + menu_file->m_size.x;
|
pos.x = pos.x - popup->m_size.x + menu_file->m_size.x;
|
||||||
@@ -393,13 +393,13 @@ void App::init_menu_file()
|
|||||||
popup->m_capture_children = false;
|
popup->m_capture_children = false;
|
||||||
|
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-newdoc"))
|
if (auto b = popup->find<NodeButtonCustom>("file-newdoc"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
dialog_newdoc();
|
dialog_newdoc();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-import"))
|
if (auto b = popup->find<NodeButtonCustom>("file-import"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
App::I.pick_image([this](std::string path){
|
App::I.pick_image([this](std::string path){
|
||||||
Image img;
|
Image img;
|
||||||
async_start();
|
async_start();
|
||||||
@@ -422,7 +422,7 @@ void App::init_menu_file()
|
|||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-open"))
|
if (auto b = popup->find<NodeButtonCustom>("file-open"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
//dialog_open();
|
//dialog_open();
|
||||||
App::I.pick_file({"ppi","PPI"}, [this](std::string path){
|
App::I.pick_file({"ppi","PPI"}, [this](std::string path){
|
||||||
App::I.open_document(path);
|
App::I.open_document(path);
|
||||||
@@ -431,13 +431,13 @@ void App::init_menu_file()
|
|||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-browse"))
|
if (auto b = popup->find<NodeButtonCustom>("file-browse"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
dialog_browse();
|
dialog_browse();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-save"))
|
if (auto b = popup->find<NodeButtonCustom>("file-save"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
if (Canvas::I->m_newdoc)
|
if (Canvas::I->m_newdoc)
|
||||||
{
|
{
|
||||||
dialog_save();
|
dialog_save();
|
||||||
@@ -450,27 +450,27 @@ void App::init_menu_file()
|
|||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-save-as"))
|
if (auto b = popup->find<NodeButtonCustom>("file-save-as"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
dialog_save();
|
dialog_save();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-save-ver"))
|
if (auto b = popup->find<NodeButtonCustom>("file-save-ver"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
Canvas::I->m_newdoc ? dialog_save() : dialog_save_ver();
|
Canvas::I->m_newdoc ? dialog_save() : dialog_save_ver();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-export"))
|
if (auto b = popup->find<NodeButtonCustom>("file-export"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
dialog_export(".jpg");
|
dialog_export(".jpg");
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-export-tick"))
|
if (auto b = popup->find<NodeButtonCustom>("file-export-tick"))
|
||||||
b->on_click = [this,b](Node*) {
|
b->on_click = [this, b, popup](Node*) {
|
||||||
glm::vec2 pos = b->m_pos + glm::vec2(b->m_size.x, 0);
|
glm::vec2 pos = b->m_pos + glm::vec2(b->m_size.x, 0);
|
||||||
subpopup = (NodePopupMenu*)layout[const_hash("file-submenu-export")]->m_children[0]->clone();
|
auto subpopup = (NodePopupMenu*)layout[const_hash("file-submenu-export")]->m_children[0]->clone();
|
||||||
subpopup->update();
|
subpopup->update();
|
||||||
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
||||||
pos.x = pos.x - subpopup->m_size.x + b->m_size.x;
|
pos.x = pos.x - subpopup->m_size.x + b->m_size.x;
|
||||||
@@ -482,14 +482,14 @@ void App::init_menu_file()
|
|||||||
subpopup->m_mouse_ignore = false;
|
subpopup->m_mouse_ignore = false;
|
||||||
subpopup->m_flood_events = true;
|
subpopup->m_flood_events = true;
|
||||||
subpopup->m_capture_children = false;
|
subpopup->m_capture_children = false;
|
||||||
subpopup->find<NodeButtonCustom>("file-submenu-export-png")->on_click = [this](Node*) {
|
subpopup->find<NodeButtonCustom>("file-submenu-export-png")->on_click = [this, subpopup, popup](Node*) {
|
||||||
dialog_export(".png");
|
dialog_export(".png");
|
||||||
subpopup->mouse_release();
|
subpopup->mouse_release();
|
||||||
subpopup->destroy();
|
subpopup->destroy();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
subpopup->find<NodeButtonCustom>("file-submenu-export-layers")->on_click = [this](Node*) {
|
subpopup->find<NodeButtonCustom>("file-submenu-export-layers")->on_click = [this, subpopup, popup](Node*) {
|
||||||
dialog_export_layers();
|
dialog_export_layers();
|
||||||
subpopup->mouse_release();
|
subpopup->mouse_release();
|
||||||
subpopup->destroy();
|
subpopup->destroy();
|
||||||
@@ -498,31 +498,31 @@ void App::init_menu_file()
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-share"))
|
if (auto b = popup->find<NodeButtonCustom>("file-share"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
share_file(doc_path);
|
share_file(doc_path);
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-resize"))
|
if (auto b = popup->find<NodeButtonCustom>("file-resize"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
dialog_resize();
|
dialog_resize();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-export-cubes"))
|
if (auto b = popup->find<NodeButtonCustom>("file-export-cubes"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
dialog_export_cubes();
|
dialog_export_cubes();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-cloud-upload"))
|
if (auto b = popup->find<NodeButtonCustom>("file-cloud-upload"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
cloud_upload();
|
cloud_upload();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (auto b = popup->find<NodeButtonCustom>("file-cloud-browse"))
|
if (auto b = popup->find<NodeButtonCustom>("file-cloud-browse"))
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
cloud_browse();
|
cloud_browse();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
@@ -537,7 +537,7 @@ void App::init_menu_edit()
|
|||||||
{
|
{
|
||||||
menu_file->on_click = [=](Node*) {
|
menu_file->on_click = [=](Node*) {
|
||||||
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
||||||
popup = (NodePopupMenu*)layout[const_hash("edit-menu")]->m_children[0]->clone();
|
auto popup = (NodePopupMenu*)layout[const_hash("edit-menu")]->m_children[0]->clone();
|
||||||
popup->update();
|
popup->update();
|
||||||
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
||||||
pos.x = pos.x - popup->m_size.x + menu_file->m_size.x;
|
pos.x = pos.x - popup->m_size.x + menu_file->m_size.x;
|
||||||
@@ -559,7 +559,7 @@ void App::init_menu_timelapse()
|
|||||||
{
|
{
|
||||||
menu_file->on_click = [=](Node*) {
|
menu_file->on_click = [=](Node*) {
|
||||||
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
||||||
popup = (NodePopupMenu*)layout[const_hash("timelapse-menu")]->m_children[0]->clone();
|
auto popup = (NodePopupMenu*)layout[const_hash("timelapse-menu")]->m_children[0]->clone();
|
||||||
popup->update();
|
popup->update();
|
||||||
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
||||||
pos.x = pos.x - popup->m_size.x + menu_file->m_size.x;
|
pos.x = pos.x - popup->m_size.x + menu_file->m_size.x;
|
||||||
@@ -580,19 +580,19 @@ void App::init_menu_timelapse()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
popup->find<NodeButtonCustom>("timelapse-start")->on_click = [this](Node*) {
|
popup->find<NodeButtonCustom>("timelapse-start")->on_click = [this, popup](Node*) {
|
||||||
App::I.rec_running ? App::I.rec_stop() : App::I.rec_start();
|
App::I.rec_running ? App::I.rec_stop() : App::I.rec_start();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
popup->find<NodeButtonCustom>("timelapse-clear")->on_click = [this](Node*) {
|
popup->find<NodeButtonCustom>("timelapse-clear")->on_click = [this, popup](Node*) {
|
||||||
App::I.rec_clear();
|
App::I.rec_clear();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
popup->find<NodeButtonCustom>("timelapse-export")->on_click = [this](Node*) {
|
popup->find<NodeButtonCustom>("timelapse-export")->on_click = [this, popup](Node*) {
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
App::I.rec_export("");
|
App::I.rec_export("");
|
||||||
@@ -607,7 +607,7 @@ void App::init_menu_about()
|
|||||||
{
|
{
|
||||||
menu_file->on_click = [=](Node*) {
|
menu_file->on_click = [=](Node*) {
|
||||||
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
||||||
popup = (NodePopupMenu*)layout[const_hash("about-menu")]->m_children[0]->clone();
|
auto popup = (NodePopupMenu*)layout[const_hash("about-menu")]->m_children[0]->clone();
|
||||||
popup->update();
|
popup->update();
|
||||||
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
||||||
pos.x = pos.x - popup->m_size.x + menu_file->m_size.x;
|
pos.x = pos.x - popup->m_size.x + menu_file->m_size.x;
|
||||||
@@ -620,13 +620,13 @@ void App::init_menu_about()
|
|||||||
popup->m_flood_events = true;
|
popup->m_flood_events = true;
|
||||||
popup->m_capture_children = false;
|
popup->m_capture_children = false;
|
||||||
|
|
||||||
popup->find<NodeButtonCustom>("about-app")->on_click = [this](Node*) {
|
popup->find<NodeButtonCustom>("about-app")->on_click = [this, popup](Node*) {
|
||||||
dialog_about();
|
dialog_about();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
popup->find<NodeButtonCustom>("about-doc")->on_click = [this](Node*) {
|
popup->find<NodeButtonCustom>("about-doc")->on_click = [this, popup](Node*) {
|
||||||
// auto path = Asset::absolute("data/doc/test.pdf");
|
// auto path = Asset::absolute("data/doc/test.pdf");
|
||||||
// display_file(path);
|
// display_file(path);
|
||||||
dialog_usermanual();
|
dialog_usermanual();
|
||||||
@@ -642,7 +642,7 @@ void App::init_menu_about()
|
|||||||
sprintf(label, "What's new in %d.%d.%d?", g_version_major, g_version_minor, g_version_fix);
|
sprintf(label, "What's new in %d.%d.%d?", g_version_major, g_version_minor, g_version_fix);
|
||||||
text->set_text(label);
|
text->set_text(label);
|
||||||
}
|
}
|
||||||
item->on_click = [this](Node*) {
|
item->on_click = [this, popup](Node*) {
|
||||||
dialog_changelog();
|
dialog_changelog();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
@@ -651,15 +651,17 @@ void App::init_menu_about()
|
|||||||
|
|
||||||
if (auto b = popup->find<NodeButtonCustom>("about-crash"))
|
if (auto b = popup->find<NodeButtonCustom>("about-crash"))
|
||||||
{
|
{
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
LOG("crashing");
|
LOG("crashing");
|
||||||
App::I.crash_test();
|
App::I.crash_test();
|
||||||
|
popup->mouse_release();
|
||||||
|
popup->destroy();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto b = popup->find<NodeButtonCustom>("about-perf"))
|
if (auto b = popup->find<NodeButtonCustom>("about-perf"))
|
||||||
{
|
{
|
||||||
b->on_click = [this](Node*) {
|
b->on_click = [this, popup](Node*) {
|
||||||
LOG("perf");
|
LOG("perf");
|
||||||
auto start = std::chrono::high_resolution_clock::now();
|
auto start = std::chrono::high_resolution_clock::now();
|
||||||
Canvas::I->stroke_start({ 0, 0, 0 }, 0.9f, Canvas::I->m_current_brush);
|
Canvas::I->stroke_start({ 0, 0, 0 }, 0.9f, Canvas::I->m_current_brush);
|
||||||
@@ -684,6 +686,8 @@ void App::init_menu_about()
|
|||||||
static char str[256];
|
static char str[256];
|
||||||
sprintf(str, "Time %lld ms", ms);
|
sprintf(str, "Time %lld ms", ms);
|
||||||
App::I.message_box("Performance test", str);
|
App::I.message_box("Performance test", str);
|
||||||
|
popup->mouse_release();
|
||||||
|
popup->destroy();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -702,7 +706,7 @@ void App::init_menu_layer()
|
|||||||
{
|
{
|
||||||
menu_file->on_click = [=](Node*) {
|
menu_file->on_click = [=](Node*) {
|
||||||
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
||||||
popup = (NodePopupMenu*)layout[const_hash("layers-menu")]->m_children[0]->clone();
|
auto popup = (NodePopupMenu*)layout[const_hash("layers-menu")]->m_children[0]->clone();
|
||||||
popup->update();
|
popup->update();
|
||||||
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
||||||
pos.x = pos.x - popup->m_size.x + menu_file->m_size.x;
|
pos.x = pos.x - popup->m_size.x + menu_file->m_size.x;
|
||||||
@@ -714,20 +718,20 @@ void App::init_menu_layer()
|
|||||||
popup->m_mouse_ignore = false;
|
popup->m_mouse_ignore = false;
|
||||||
popup->m_flood_events = true;
|
popup->m_flood_events = true;
|
||||||
popup->m_capture_children = false;
|
popup->m_capture_children = false;
|
||||||
popup->find<NodeButtonCustom>("clear-grids")->on_click = [this](Node*) {
|
popup->find<NodeButtonCustom>("clear-grids")->on_click = [this, popup](Node*) {
|
||||||
CanvasModeGrid* mode = (CanvasModeGrid*)Canvas::modes[(int)kCanvasMode::Grid][0];
|
CanvasModeGrid* mode = (CanvasModeGrid*)Canvas::modes[(int)kCanvasMode::Grid][0];
|
||||||
mode->clear();
|
mode->clear();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
popup->find<NodeButtonCustom>("camera-reset")->on_click = [this](Node*) {
|
popup->find<NodeButtonCustom>("camera-reset")->on_click = [this, popup](Node*) {
|
||||||
canvas->reset_camera();
|
canvas->reset_camera();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
popup->find<NodeButtonCustom>("layer-clear")->on_click = [this](Node*) {
|
popup->find<NodeButtonCustom>("layer-clear")->on_click = [this, popup](Node*) {
|
||||||
canvas->m_canvas->clear();
|
canvas->m_canvas->clear();
|
||||||
popup->mouse_release();
|
popup->mouse_release();
|
||||||
popup->destroy();
|
popup->destroy();
|
||||||
@@ -737,8 +741,10 @@ void App::init_menu_layer()
|
|||||||
find<NodeText>("menu-label")->
|
find<NodeText>("menu-label")->
|
||||||
set_text(("Clear Layer " + layers->m_current_layer->m_label_text).c_str());
|
set_text(("Clear Layer " + layers->m_current_layer->m_label_text).c_str());
|
||||||
|
|
||||||
popup->find<NodeButtonCustom>("layer-rename")->on_click = [this](Node*) {
|
popup->find<NodeButtonCustom>("layer-rename")->on_click = [this, popup](Node*) {
|
||||||
dialog_layer_rename();
|
dialog_layer_rename();
|
||||||
|
popup->mouse_release();
|
||||||
|
popup->destroy();
|
||||||
};
|
};
|
||||||
if (layers->m_current_layer)
|
if (layers->m_current_layer)
|
||||||
popup->find<NodeButtonCustom>("layer-rename")->
|
popup->find<NodeButtonCustom>("layer-rename")->
|
||||||
@@ -749,7 +755,7 @@ void App::init_menu_layer()
|
|||||||
find<NodeText>("menu-label")->
|
find<NodeText>("menu-label")->
|
||||||
set_text("Rename Layer (Select a layer)");
|
set_text("Rename Layer (Select a layer)");
|
||||||
|
|
||||||
popup->find<NodeButtonCustom>("layer-merge")->on_click = [this](Node*) {
|
popup->find<NodeButtonCustom>("layer-merge")->on_click = [this, popup](Node*) {
|
||||||
const auto& order = canvas->m_canvas->m_order;
|
const auto& order = canvas->m_canvas->m_order;
|
||||||
//layers->get_child_index(layers->)
|
//layers->get_child_index(layers->)
|
||||||
int current_idx_order = std::distance(order.begin(), std::find(order.begin(), order.end(), canvas->m_canvas->m_current_layer_idx));
|
int current_idx_order = std::distance(order.begin(), std::find(order.begin(), order.end(), canvas->m_canvas->m_current_layer_idx));
|
||||||
|
|||||||
Reference in New Issue
Block a user