refactor tools menu
This commit is contained in:
@@ -215,29 +215,17 @@
|
|||||||
</border>
|
</border>
|
||||||
-->
|
-->
|
||||||
<border dir="row" flood-events="1" >
|
<border dir="row" flood-events="1" >
|
||||||
<button-custom id="tools-panels" height="40" align="center" color=".2" pad="0 0 0 10" dir="row" grow="1">
|
<button-custom id="tools-panels" pad="0 10 0 10" height="40" width="40" align="center" justify="center" color=".2" dir="row" grow="1">
|
||||||
<text text="Panels" grow="1" margin="0 0 0 5"/>
|
<text text="Panels" grow="1" margin="0 0 0 5"/>
|
||||||
</button-custom>
|
|
||||||
<button-custom id="tools-panels-tick" height="40" width="40" align="center" justify="center" color=".2" dir="row">
|
|
||||||
<icon icon="resultset_next" width="20"/>
|
<icon icon="resultset_next" width="20"/>
|
||||||
</button-custom>
|
</button-custom>
|
||||||
</border>
|
</border>
|
||||||
<button-custom height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
<border dir="row" flood-events="1" >
|
||||||
<text text="UI Scale" margin="0 10 0 5" grow="1"/>
|
<button-custom id="tools-options" pad="0 10 0 10" height="40" width="40" align="center" justify="center" color=".2" dir="row" grow="1">
|
||||||
<combobox id="tools-ui-scale" height="30" width="50" margin="0 10 0 0" combo-list="0.50,0.75,0.80,0.90,1.00,1.25,1.50,2.00,2.50"/>
|
<text text="Options" grow="1" margin="0 0 0 5"/>
|
||||||
</button-custom>
|
<icon icon="resultset_next" width="20"/>
|
||||||
<button-custom height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
|
||||||
<text text="VP Scale" margin="0 10 0 5" grow="1"/>
|
|
||||||
<combobox id="tools-vp-scale" height="30" width="50" margin="0 10 0 0" combo-list="0.25,0.33,0.50,0.66,1.00"/>
|
|
||||||
</button-custom>
|
|
||||||
<button-custom id="tools-rtl" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
|
||||||
<checkbox id="tools-rtl-check" width="20" height="20"/>
|
|
||||||
<text text="Left-handed UI" margin="0 0 0 5"/>
|
|
||||||
</button-custom>
|
|
||||||
<button-custom id="tools-vr" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
|
||||||
<checkbox id="tools-vr-check" width="20" height="20"/>
|
|
||||||
<text text="Enable VR" margin="0 0 0 5"/>
|
|
||||||
</button-custom>
|
</button-custom>
|
||||||
|
</border>
|
||||||
<button-custom id="clear-grids" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
<button-custom id="clear-grids" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
||||||
<icon icon="bin" width="20"/>
|
<icon icon="bin" width="20"/>
|
||||||
<text text="Clear Guides" margin="0 0 0 5"/>
|
<text text="Clear Guides" margin="0 0 0 5"/>
|
||||||
@@ -259,20 +247,24 @@
|
|||||||
</popup-menu>
|
</popup-menu>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
||||||
<!-- MENU TOOLS > TIMELAPSE -->
|
<!-- MENU TOOLS > OPTIONS -->
|
||||||
<layout id="timelapse-menu">
|
<layout id="options-menu">
|
||||||
<popup-menu positioning="absolute" position="100 100" width="150" thickness="1" border-color=".1" color=".4 .4 .4 .8" dir="col">
|
<popup-menu positioning="absolute" position="100 100" width="150" thickness="1" border-color=".1" color=".4 .4 .4 .8" dir="col">
|
||||||
<button-custom id="timelapse-start" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
<button-custom height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
||||||
<icon icon="camera" width="20"/>
|
<text text="UI Scale" margin="0 10 0 5" grow="1"/>
|
||||||
<text id="menu-label" text="Start Recording" margin="0 0 0 5"/>
|
<combobox id="tools-ui-scale" height="30" width="50" margin="0 10 0 0" combo-list="0.50,0.75,0.80,0.90,1.00,1.25,1.50,2.00,2.50"/>
|
||||||
</button-custom>
|
</button-custom>
|
||||||
<button-custom id="timelapse-clear" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
<button-custom height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
||||||
<icon icon="bin" width="20"/>
|
<text text="VP Scale" margin="0 10 0 5" grow="1"/>
|
||||||
<text id="menu-label" text="Clear Frames" margin="0 0 0 5"/>
|
<combobox id="tools-vp-scale" height="30" width="50" margin="0 10 0 0" combo-list="0.25,0.33,0.50,0.66,1.00"/>
|
||||||
</button-custom>
|
</button-custom>
|
||||||
<button-custom id="timelapse-export" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
<button-custom id="tools-rtl" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
||||||
<icon icon="film_save" width="20"/>
|
<checkbox id="tools-rtl-check" width="20" height="20"/>
|
||||||
<text id="menu-label" text="Export MP4" margin="0 0 0 5"/>
|
<text text="Left-handed UI" margin="0 0 0 5"/>
|
||||||
|
</button-custom>
|
||||||
|
<button-custom id="tools-vr" height="40" align="center" color=".2" pad="0 0 0 10" dir="row">
|
||||||
|
<checkbox id="tools-vr-check" width="20" height="20"/>
|
||||||
|
<text text="Enable VR" margin="0 0 0 5"/>
|
||||||
</button-custom>
|
</button-custom>
|
||||||
</popup-menu>
|
</popup-menu>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -727,50 +727,7 @@ void App::init_menu_tools()
|
|||||||
popup_exp->SetPosition(pos.x, pos.y);
|
popup_exp->SetPosition(pos.x, pos.y);
|
||||||
layout[main_id]->add_child(popup_exp);
|
layout[main_id]->add_child(popup_exp);
|
||||||
|
|
||||||
if (auto tick = popup_exp->find<NodeButtonCustom>("tools-timelapse-tick")) tick->on_click = [this, popup_exp](Node* b)
|
if (auto tick = popup_exp->find<NodeButtonCustom>("tools-panels")) tick->on_click = [this, popup_exp](Node* b)
|
||||||
{
|
|
||||||
if (auto menu_time = popup_exp->find<NodePopupMenu>("tools-timelapse"))
|
|
||||||
{
|
|
||||||
glm::vec2 pos = b->m_pos + glm::vec2(b->m_size.x, 0);
|
|
||||||
auto popup_time = layout[const_hash("timelapse-menu")]->m_children[0]->clone<NodePopupMenu>();
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (auto item = popup_time->find<NodeButtonCustom>("timelapse-start"))
|
|
||||||
{
|
|
||||||
if (auto text = popup_time->find<NodeText>("menu-label"))
|
|
||||||
{
|
|
||||||
text->set_text(rec_running ? "Stop Recording" : "Start Recording");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
popup_time->find<NodeButtonCustom>("timelapse-start")->on_click = [this, popup_time, popup_exp](Node*) {
|
|
||||||
rec_running ? rec_stop() : rec_start();
|
|
||||||
popup_exp->destroy();
|
|
||||||
popup_time->destroy();
|
|
||||||
};
|
|
||||||
|
|
||||||
popup_time->find<NodeButtonCustom>("timelapse-clear")->on_click = [this, popup_time, popup_exp](Node*) {
|
|
||||||
rec_clear();
|
|
||||||
popup_exp->destroy();
|
|
||||||
popup_time->destroy();
|
|
||||||
};
|
|
||||||
|
|
||||||
popup_time->find<NodeButtonCustom>("timelapse-export")->on_click = [this, popup_time, popup_exp](Node*) {
|
|
||||||
rec_export("");
|
|
||||||
popup_exp->destroy();
|
|
||||||
popup_time->destroy();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (auto tick = popup_exp->find<NodeButtonCustom>("tools-panels-tick")) tick->on_click = [this, popup_exp](Node* b)
|
|
||||||
{
|
|
||||||
if (auto menu_time = popup_exp->find<NodePopupMenu>("tools-panels"))
|
|
||||||
{
|
{
|
||||||
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);
|
||||||
auto popup_time = layout[const_hash("panels-menu")]->m_children[0]->clone<NodePopupMenu>();
|
auto popup_time = layout[const_hash("panels-menu")]->m_children[0]->clone<NodePopupMenu>();
|
||||||
@@ -950,10 +907,20 @@ void App::init_menu_tools()
|
|||||||
popup_exp->destroy();
|
popup_exp->destroy();
|
||||||
popup_time->destroy();
|
popup_time->destroy();
|
||||||
};
|
};
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (auto ui_scale = popup_exp->find<NodeComboBox>("tools-ui-scale"))
|
if (auto options = popup_exp->find<NodeButtonCustom>("tools-options")) options->on_click = [this, options, main](Node* b)
|
||||||
|
{
|
||||||
|
glm::vec2 pos = b->m_pos + glm::vec2(b->m_size.x, 0);
|
||||||
|
auto popup_time = layout[const_hash("options-menu")]->m_children[0]->clone<NodePopupMenu>();
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (auto ui_scale = popup_time->find<NodeComboBox>("tools-ui-scale"))
|
||||||
{
|
{
|
||||||
// set index to current zoom level (or at least the closest in list)
|
// set index to current zoom level (or at least the closest in list)
|
||||||
for (int i = 0; i < ui_scale->m_data.size(); i++)
|
for (int i = 0; i < ui_scale->m_data.size(); i++)
|
||||||
@@ -966,7 +933,7 @@ void App::init_menu_tools()
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto vp_scale = popup_exp->find<NodeComboBox>("tools-vp-scale"))
|
if (auto vp_scale = popup_time->find<NodeComboBox>("tools-vp-scale"))
|
||||||
{
|
{
|
||||||
// set index to current zoom level (or at least the closest in list)
|
// set index to current zoom level (or at least the closest in list)
|
||||||
for (int i = 0; i < vp_scale->m_data.size(); i++)
|
for (int i = 0; i < vp_scale->m_data.size(); i++)
|
||||||
@@ -982,12 +949,12 @@ void App::init_menu_tools()
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto rtl_btn = popup_exp->find<NodeButtonCustom>("tools-rtl"))
|
if (auto rtl_btn = popup_time->find<NodeButtonCustom>("tools-rtl"))
|
||||||
{
|
{
|
||||||
NodeCheckBox* cb = rtl_btn->find<NodeCheckBox>("tools-rtl-check");
|
NodeCheckBox* cb = rtl_btn->find<NodeCheckBox>("tools-rtl-check");
|
||||||
cb->set_value(ui_rtl, false);
|
cb->set_value(ui_rtl, false);
|
||||||
|
|
||||||
rtl_btn->on_click = [this, popup_exp, rtl_btn](Node* b)
|
rtl_btn->on_click = [this, rtl_btn](Node* b)
|
||||||
{
|
{
|
||||||
NodeCheckBox* cb = rtl_btn->find<NodeCheckBox>("tools-rtl-check");
|
NodeCheckBox* cb = rtl_btn->find<NodeCheckBox>("tools-rtl-check");
|
||||||
cb->set_value(!cb->checked, true);
|
cb->set_value(!cb->checked, true);
|
||||||
@@ -999,12 +966,12 @@ void App::init_menu_tools()
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto vr_btn = popup_exp->find<NodeButtonCustom>("tools-vr"))
|
if (auto vr_btn = popup_time->find<NodeButtonCustom>("tools-vr"))
|
||||||
{
|
{
|
||||||
NodeCheckBox* cb = vr_btn->find<NodeCheckBox>("tools-vr-check");
|
NodeCheckBox* cb = vr_btn->find<NodeCheckBox>("tools-vr-check");
|
||||||
cb->set_value(has_vr);
|
cb->set_value(has_vr);
|
||||||
|
|
||||||
vr_btn->on_click = [this, popup_exp, vr_btn](Node* b)
|
vr_btn->on_click = [this, vr_btn](Node* b)
|
||||||
{
|
{
|
||||||
NodeCheckBox* cb = vr_btn->find<NodeCheckBox>("tools-vr-check");
|
NodeCheckBox* cb = vr_btn->find<NodeCheckBox>("tools-vr-check");
|
||||||
cb->set_value(!cb->checked, true);
|
cb->set_value(!cb->checked, true);
|
||||||
@@ -1027,6 +994,7 @@ void App::init_menu_tools()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
popup_exp->find<NodeButtonCustom>("clear-grids")->on_click = [this, popup_exp](Node*) {
|
popup_exp->find<NodeButtonCustom>("clear-grids")->on_click = [this, popup_exp](Node*) {
|
||||||
CanvasModeGrid* mode = (CanvasModeGrid*)Canvas::modes[(int)kCanvasMode::Grid][0];
|
CanvasModeGrid* mode = (CanvasModeGrid*)Canvas::modes[(int)kCanvasMode::Grid][0];
|
||||||
|
|||||||
Reference in New Issue
Block a user