rename Experimental menu to Tools and merge with Edit

This commit is contained in:
2019-05-20 15:42:36 +02:00
parent fe618bfef1
commit f7b1ab6843
3 changed files with 72 additions and 70 deletions

View File

@@ -173,7 +173,7 @@ public:
void init_menu_file();
void init_menu_edit();
void init_menu_layer();
void init_menu_experimental();
void init_menu_tools();
void init_menu_about();
void dialog_usermanual();
void dialog_changelog();

View File

@@ -697,45 +697,19 @@ void App::init_menu_edit()
popup->m_mouse_ignore = false;
popup->m_flood_events = true;
popup->m_capture_children = false;
popup->find<NodeButtonCustom>("clear-grids")->on_click = [this, popup](Node*) {
CanvasModeGrid* mode = (CanvasModeGrid*)Canvas::modes[(int)kCanvasMode::Grid][0];
mode->clear();
popup->mouse_release();
popup->destroy();
};
popup->find<NodeButtonCustom>("camera-reset")->on_click = [this, popup](Node*) {
canvas->reset_camera();
popup->mouse_release();
popup->destroy();
};
popup->find<NodeButtonCustom>("clear-presets")->on_click = [this, popup](Node*) {
auto mb = message_box("Clear Presets", "Do you want to remove all the Brush Presets?", true);
mb->btn_ok->m_text->set_text("Yes");
mb->btn_cancel->m_text->set_text("No");
mb->btn_ok->on_click = mb->on_submit = [this,mb](Node*) {
presets->clear_brushes();
presets->save();
mb->destroy();
};
popup->mouse_release();
popup->destroy();
};
};
}
}
void App::init_menu_experimental()
void App::init_menu_tools()
{
auto main = layout[main_id];
if (auto menu_exp = main->find<NodeButtonCustom>("menu-experimental"))
if (auto menu_exp = main->find<NodeButtonCustom>("menu-tools"))
{
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();
auto popup_exp = (NodePopupMenu*)layout[const_hash("tools-menu")]->m_children[0]->clone();
popup_exp->update();
if (YGNodeStyleGetDirection(layout[main_id]->y_node) == YGDirectionRTL)
pos.x = pos.x - popup_exp->m_size.x + menu_exp->m_size.x;
@@ -748,9 +722,9 @@ void App::init_menu_experimental()
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 tick = popup_exp->find<NodeButtonCustom>("tools-timelapse-tick")) tick->on_click = [this, popup_exp](Node* b)
{
if (auto menu_time = popup_exp->find<NodePopupMenu>("experimental-timelapse"))
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 = (NodePopupMenu*)layout[const_hash("timelapse-menu")]->m_children[0]->clone();
@@ -794,9 +768,9 @@ void App::init_menu_experimental()
}
};
if (auto tick = popup_exp->find<NodeButtonCustom>("experimental-panels-tick")) tick->on_click = [this, popup_exp](Node* b)
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>("experimental-panels"))
if (auto menu_time = popup_exp->find<NodePopupMenu>("tools-panels"))
{
glm::vec2 pos = b->m_pos + glm::vec2(b->m_size.x, 0);
auto popup_time = (NodePopupMenu*)layout[const_hash("panels-menu")]->m_children[0]->clone();
@@ -955,37 +929,37 @@ void App::init_menu_experimental()
}
};
if (auto rtl_btn = popup_exp->find<NodeButtonCustom>("experimental-rtl"))
if (auto rtl_btn = popup_exp->find<NodeButtonCustom>("tools-rtl"))
{
auto ui = main->find("central-row");
NodeCheckBox* cb = rtl_btn->find<NodeCheckBox>("experimental-rtl-check");
NodeCheckBox* cb = rtl_btn->find<NodeCheckBox>("tools-rtl-check");
cb->set_value(ui->GetRTL() == YGDirectionRTL, false);
rtl_btn->on_click = [this, popup_exp, rtl_btn](Node* b)
{
NodeCheckBox* cb = rtl_btn->find<NodeCheckBox>("experimental-rtl-check");
NodeCheckBox* cb = rtl_btn->find<NodeCheckBox>("tools-rtl-check");
cb->set_value(!cb->checked, true);
};
rtl_btn->find<NodeCheckBox>("experimental-rtl-check")->on_value_changed = [this, main](Node*, bool checked)
rtl_btn->find<NodeCheckBox>("tools-rtl-check")->on_value_changed = [this, main](Node*, bool checked)
{
auto ui = main->find("central-row");
ui->SetRTL(checked ? YGDirectionRTL : YGDirectionLTR);
};
}
if (auto vr_btn = popup_exp->find<NodeButtonCustom>("experimental-vr"))
if (auto vr_btn = popup_exp->find<NodeButtonCustom>("tools-vr"))
{
NodeCheckBox* cb = vr_btn->find<NodeCheckBox>("experimental-vr-check");
NodeCheckBox* cb = vr_btn->find<NodeCheckBox>("tools-vr-check");
cb->set_value(has_vr);
vr_btn->on_click = [this, popup_exp, vr_btn](Node* b)
{
NodeCheckBox* cb = vr_btn->find<NodeCheckBox>("experimental-vr-check");
NodeCheckBox* cb = vr_btn->find<NodeCheckBox>("tools-vr-check");
cb->set_value(!cb->checked, true);
};
vr_btn->find<NodeCheckBox>("experimental-vr-check")->on_value_changed = [this, main](Node* target, bool checked)
vr_btn->find<NodeCheckBox>("tools-vr-check")->on_value_changed = [this, main](Node* target, bool checked)
{
if (checked)
{
@@ -1002,7 +976,33 @@ void App::init_menu_experimental()
}
};
}
};
popup_exp->find<NodeButtonCustom>("clear-grids")->on_click = [this, popup_exp](Node*) {
CanvasModeGrid* mode = (CanvasModeGrid*)Canvas::modes[(int)kCanvasMode::Grid][0];
mode->clear();
popup_exp->mouse_release();
popup_exp->destroy();
};
popup_exp->find<NodeButtonCustom>("camera-reset")->on_click = [this, popup_exp](Node*) {
canvas->reset_camera();
popup_exp->mouse_release();
popup_exp->destroy();
};
popup_exp->find<NodeButtonCustom>("clear-presets")->on_click = [this, popup_exp](Node*) {
auto mb = message_box("Clear Presets", "Do you want to remove all the Brush Presets?", true);
mb->btn_ok->m_text->set_text("Yes");
mb->btn_cancel->m_text->set_text("No");
mb->btn_ok->on_click = mb->on_submit = [this, mb](Node*) {
presets->clear_brushes();
presets->save();
mb->destroy();
};
popup_exp->mouse_release();
popup_exp->destroy();
};
};
}
}
@@ -1234,7 +1234,7 @@ void App::initLayout()
init_menu_file();
init_menu_edit();
init_menu_layer();
init_menu_experimental();
init_menu_tools();
init_menu_about();
// set version string