add experimental menu
This commit is contained in:
@@ -660,50 +660,111 @@ void App::init_menu_edit()
|
||||
}
|
||||
}
|
||||
|
||||
void App::init_menu_timelapse()
|
||||
void App::init_menu_experimental()
|
||||
{
|
||||
if (auto* menu_file = layout[main_id]->find<NodeButtonCustom>("menu-timelapse"))
|
||||
auto main = layout[main_id];
|
||||
|
||||
if (auto menu_exp = main->find<NodeButtonCustom>("menu-experimental"))
|
||||
{
|
||||
menu_file->on_click = [=](Node*) {
|
||||
glm::vec2 pos = menu_file->m_pos + glm::vec2(0, menu_file->m_size.y);
|
||||
auto popup = (NodePopupMenu*)layout[const_hash("timelapse-menu")]->m_children[0]->clone();
|
||||
popup->update();
|
||||
menu_exp->on_click = [this, menu_exp, main](Node*) {
|
||||
glm::vec2 pos = menu_exp->m_pos + glm::vec2(0, menu_exp->m_size.y);
|
||||
auto popup_exp = (NodePopupMenu*)layout[const_hash("experimental-menu")]->m_children[0]->clone();
|
||||
popup_exp->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);
|
||||
pos.x = pos.x - popup_exp->m_size.x + menu_exp->m_size.x;
|
||||
popup_exp->SetPositioning(YGPositionTypeAbsolute);
|
||||
popup_exp->SetPosition(pos.x, pos.y);
|
||||
layout[main_id]->add_child(popup_exp);
|
||||
layout[main_id]->update();
|
||||
popup->mouse_capture();
|
||||
popup->m_mouse_ignore = false;
|
||||
popup->m_flood_events = true;
|
||||
popup->m_capture_children = false;
|
||||
|
||||
if (auto item = popup->find<NodeButtonCustom>("timelapse-start"))
|
||||
popup_exp->mouse_capture();
|
||||
popup_exp->m_mouse_ignore = false;
|
||||
popup_exp->m_flood_events = true;
|
||||
popup_exp->m_capture_children = false;
|
||||
|
||||
if (auto tick = popup_exp->find<NodeButtonCustom>("experimental-timelapse-tick")) tick->on_click = [this, popup_exp](Node* b)
|
||||
{
|
||||
if (auto text = popup->find<NodeText>("menu-label"))
|
||||
if (auto menu_time = popup_exp->find<NodePopupMenu>("experimental-timelapse"))
|
||||
{
|
||||
text->set_text(App::I.rec_running ? "Stop Recording" : "Start Recording");
|
||||
glm::vec2 pos = b->m_pos + glm::vec2(b->m_size.x, 0);
|
||||
auto popup_time = (NodePopupMenu*)layout[const_hash("timelapse-menu")]->m_children[0]->clone();
|
||||
popup_time->update();
|
||||
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
|
||||
pos.x = pos.x - popup_time->m_size.x + b->m_size.x;
|
||||
popup_time->SetPositioning(YGPositionTypeAbsolute);
|
||||
popup_time->SetPosition(pos.x, pos.y);
|
||||
layout[main_id]->add_child(popup_time);
|
||||
layout[main_id]->update();
|
||||
popup_time->mouse_capture();
|
||||
popup_time->m_mouse_ignore = false;
|
||||
popup_time->m_flood_events = true;
|
||||
popup_time->m_capture_children = false;
|
||||
|
||||
if (auto item = popup_time->find<NodeButtonCustom>("timelapse-start"))
|
||||
{
|
||||
if (auto text = popup_time->find<NodeText>("menu-label"))
|
||||
{
|
||||
text->set_text(App::I.rec_running ? "Stop Recording" : "Start Recording");
|
||||
}
|
||||
}
|
||||
|
||||
popup_time->find<NodeButtonCustom>("timelapse-start")->on_click = [this, popup_time, popup_exp](Node*) {
|
||||
App::I.rec_running ? App::I.rec_stop() : App::I.rec_start();
|
||||
popup_time->destroy();
|
||||
popup_exp->destroy();
|
||||
};
|
||||
|
||||
popup_time->find<NodeButtonCustom>("timelapse-clear")->on_click = [this, popup_time, popup_exp](Node*) {
|
||||
App::I.rec_clear();
|
||||
popup_time->destroy();
|
||||
popup_exp->destroy();
|
||||
};
|
||||
|
||||
popup_time->find<NodeButtonCustom>("timelapse-export")->on_click = [this, popup_time, popup_exp](Node*) {
|
||||
popup_time->destroy();
|
||||
popup_exp->destroy();
|
||||
App::I.rec_export("");
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
if (auto rtl_btn = popup_exp->find<NodeButtonCustom>("experimental-rtl"))
|
||||
{
|
||||
rtl_btn->on_click = [this, popup_exp, rtl_btn](Node* b)
|
||||
{
|
||||
NodeCheckBox* cb = rtl_btn->find<NodeCheckBox>("experimental-rtl-check");
|
||||
cb->set_value(!cb->checked, true);
|
||||
};
|
||||
rtl_btn->find<NodeCheckBox>("experimental-rtl-check")->on_value_changed = [this, main](Node*, bool checked)
|
||||
{
|
||||
auto ui = main->find("ui-root");
|
||||
ui->SetRTL(checked ? YGDirectionRTL : YGDirectionLTR);
|
||||
};
|
||||
}
|
||||
|
||||
popup->find<NodeButtonCustom>("timelapse-start")->on_click = [this, popup](Node*) {
|
||||
App::I.rec_running ? App::I.rec_stop() : App::I.rec_start();
|
||||
popup->mouse_release();
|
||||
popup->destroy();
|
||||
};
|
||||
|
||||
popup->find<NodeButtonCustom>("timelapse-clear")->on_click = [this, popup](Node*) {
|
||||
App::I.rec_clear();
|
||||
popup->mouse_release();
|
||||
popup->destroy();
|
||||
};
|
||||
|
||||
popup->find<NodeButtonCustom>("timelapse-export")->on_click = [this, popup](Node*) {
|
||||
popup->mouse_release();
|
||||
popup->destroy();
|
||||
App::I.rec_export("");
|
||||
};
|
||||
if (auto vr_btn = popup_exp->find<NodeButtonCustom>("experimental-vr"))
|
||||
{
|
||||
vr_btn->on_click = [this, popup_exp, vr_btn](Node* b)
|
||||
{
|
||||
NodeCheckBox* cb = vr_btn->find<NodeCheckBox>("experimental-vr-check");
|
||||
cb->set_value(!cb->checked, true);
|
||||
};
|
||||
vr_btn->find<NodeCheckBox>("experimental-vr-check")->on_value_changed = [this, main](Node* target, bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
if (!App::I.vr_start())
|
||||
{
|
||||
auto cb = static_cast<NodeCheckBox*>(target);
|
||||
cb->set_value(false);
|
||||
App::I.message_box("VR Failed", "Couldn't start Virtual Reality mode");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
App::I.vr_stop();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -939,7 +1000,7 @@ void App::initLayout()
|
||||
init_menu_file();
|
||||
init_menu_edit();
|
||||
init_menu_layer();
|
||||
init_menu_timelapse();
|
||||
init_menu_experimental();
|
||||
init_menu_about();
|
||||
|
||||
// set version string
|
||||
|
||||
Reference in New Issue
Block a user