add newline feature to the text node, add about window with credits, add about menu with submenus
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "node_text.h"
|
||||
#include "node_progress_bar.h"
|
||||
#include "node_dialog_picker.h"
|
||||
#include "node_about.h"
|
||||
|
||||
using namespace ui;
|
||||
|
||||
@@ -520,6 +521,53 @@ void App::init_menu_timelapse()
|
||||
}
|
||||
}
|
||||
|
||||
void App::init_menu_about()
|
||||
{
|
||||
if (auto* menu_file = layout[main_id]->find<NodeButtonCustom>("menu-about"))
|
||||
{
|
||||
menu_file->on_click = [=](Node*) {
|
||||
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();
|
||||
popup->update();
|
||||
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
||||
pos.x = pos.x - popup->m_size.x + menu_file->m_size.x;
|
||||
popup->SetPositioning(YGPositionTypeAbsolute);
|
||||
popup->SetPosition(pos.x, pos.y);
|
||||
layout[main_id]->add_child(popup);
|
||||
layout[main_id]->update();
|
||||
popup->mouse_capture();
|
||||
popup->m_mouse_ignore = false;
|
||||
popup->m_flood_events = true;
|
||||
popup->m_capture_children = false;
|
||||
|
||||
popup->find<NodeButtonCustom>("about-app")->on_click = [this](Node*) {
|
||||
dialog_about();
|
||||
popup->mouse_release();
|
||||
popup->destroy();
|
||||
};
|
||||
|
||||
popup->find<NodeButtonCustom>("about-doc")->on_click = [this](Node*) {
|
||||
popup->mouse_release();
|
||||
popup->destroy();
|
||||
};
|
||||
|
||||
if (auto item = popup->find<NodeButtonCustom>("about-news"))
|
||||
{
|
||||
if (auto text = item->find<NodeText>("menu-label"))
|
||||
{
|
||||
static char label[128];
|
||||
sprintf(label, "What's new in %d.%d.%d?", g_version_major, g_version_minor, g_version_fix);
|
||||
text->set_text(label);
|
||||
}
|
||||
item->on_click = [this](Node*) {
|
||||
popup->mouse_release();
|
||||
popup->destroy();
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void App::brush_update()
|
||||
{
|
||||
// brushes->select_brush(canvas->m_brush.id);
|
||||
@@ -643,6 +691,7 @@ void App::initLayout()
|
||||
init_menu_edit();
|
||||
init_menu_layer();
|
||||
init_menu_timelapse();
|
||||
init_menu_about();
|
||||
|
||||
// set version string
|
||||
if (auto* version_label = layout[main_id]->find<NodeText>("version"))
|
||||
@@ -650,15 +699,6 @@ void App::initLayout()
|
||||
version_label->set_text(g_version);
|
||||
}
|
||||
|
||||
|
||||
if (auto* menu_entry = layout[main_id]->find<NodeButtonCustom>("menu-about"))
|
||||
{
|
||||
menu_entry->on_click = [=](Node*) {
|
||||
// int x = 0;
|
||||
// sin(time(0) / x);
|
||||
};
|
||||
}
|
||||
|
||||
Brush b;
|
||||
int br_idx = brushes->find_brush("Round-Hard");
|
||||
b.m_tex_id = brushes->get_texture_id(br_idx);
|
||||
|
||||
Reference in New Issue
Block a user