From 034828155dd0d600c59fb626dc15418d2120c518 Mon Sep 17 00:00:00 2001 From: omigamedev Date: Mon, 23 Sep 2019 01:00:12 +0200 Subject: [PATCH] remove redundant updates --- src/app.cpp | 1 - src/app_cloud.cpp | 1 - src/app_dialogs.cpp | 9 --------- src/app_events.cpp | 32 -------------------------------- src/app_layout.cpp | 17 +++-------------- 5 files changed, 3 insertions(+), 57 deletions(-) diff --git a/src/app.cpp b/src/app.cpp index 6f28b28..83f1f98 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -661,7 +661,6 @@ void App::update_rec_frames() { txt->set_text(""); } - layout[main_id]->update(); } } diff --git a/src/app_cloud.cpp b/src/app_cloud.cpp index a0b4927..fce1c61 100644 --- a/src/app_cloud.cpp +++ b/src/app_cloud.cpp @@ -85,7 +85,6 @@ void App::cloud_browse() dialog->loaded(); layout[main_id]->add_child(dialog); - layout[main_id]->update(); dialog->btn_ok->on_click = [this, dialog](Node*) { diff --git a/src/app_dialogs.cpp b/src/app_dialogs.cpp index 1ed14da..bf459fb 100644 --- a/src/app_dialogs.cpp +++ b/src/app_dialogs.cpp @@ -69,7 +69,6 @@ void App::dialog_usermanual() dialog->loaded(); layout[main_id]->add_child(dialog); - layout[main_id]->update(); } void App::dialog_changelog() @@ -81,7 +80,6 @@ void App::dialog_changelog() dialog->loaded(); layout[main_id]->add_child(dialog); - layout[main_id]->update(); } void App::dialog_about() @@ -93,7 +91,6 @@ void App::dialog_about() dialog->loaded(); layout[main_id]->add_child(dialog); - layout[main_id]->update(); } void App::dialog_newdoc() @@ -107,7 +104,6 @@ void App::dialog_newdoc() dialog->input->set_text("name"); layout[main_id]->add_child(dialog); - layout[main_id]->update(); App::I->showKeyboard(); @@ -215,7 +211,6 @@ void App::dialog_open() dialog->loaded(); layout[main_id]->add_child(dialog); - layout[main_id]->update(); dialog->btn_ok->on_click = [this, dialog](Node*) { @@ -281,7 +276,6 @@ void App::dialog_browse() dialog->loaded(); layout[main_id]->add_child(dialog); - layout[main_id]->update(); dialog->btn_ok->on_click = [this, dialog](Node*) { @@ -426,7 +420,6 @@ void App::dialog_save() }; layout[main_id]->add_child(dialog); - layout[main_id]->update(); } } @@ -518,7 +511,6 @@ void App::dialog_resize() dialog->loaded(); layout[main_id]->add_child(dialog); - layout[main_id]->update(); dialog->btn_ok->on_click = [this,dialog](Node*) { @@ -559,7 +551,6 @@ void App::dialog_layer_rename() App::I->showKeyboard(); layout[main_id]->add_child(dialog); - layout[main_id]->update(); dialog->btn_ok->on_click = [this,dialog](Node*) { diff --git a/src/app_events.cpp b/src/app_events.cpp index c8b36c3..d317baf 100644 --- a/src/app_events.cpp +++ b/src/app_events.cpp @@ -78,8 +78,6 @@ void App::resize(float w, float h) redraw = true; width = w; height = h; - if (auto* main = layout[main_id]) - main->update(w , h, zoom); } void App::show_cursor() @@ -335,10 +333,7 @@ bool App::mouse_down(int button, float x, float y, float pressure, kEventSource e.m_eraser = eraser; kEventResult ret = kEventResult::Available; if (auto* main = layout[main_id]) - { ret = main->on_event(&e); - main->update(); - } return ret == kEventResult::Consumed; } bool App::mouse_move(float x, float y, float pressure, kEventSource source, bool eraser) @@ -366,10 +361,7 @@ bool App::mouse_up(int button, float x, float y, kEventSource source, bool erase e.m_eraser = eraser; kEventResult ret = kEventResult::Available; if (auto* main = layout[main_id]) - { ret = main->on_event(&e); - main->update(); - } return ret == kEventResult::Consumed; } bool App::mouse_scroll(float x, float y, float delta) @@ -381,10 +373,7 @@ bool App::mouse_scroll(float x, float y, float delta) e.m_scroll_delta = delta; kEventResult ret = kEventResult::Available; if (auto* main = layout[main_id]) - { ret = main->on_event(&e); - main->update(); - } return ret == kEventResult::Consumed; } bool App::mouse_cancel(int button) @@ -394,10 +383,7 @@ bool App::mouse_cancel(int button) e.m_type = kEventType::MouseCancel; kEventResult ret = kEventResult::Available; if (auto* main = layout[main_id]) - { ret = main->on_event(&e); - main->update(); - } return ret == kEventResult::Consumed; } bool App::gesture_start(const glm::vec2& p0, const glm::vec2& p1) @@ -412,10 +398,7 @@ bool App::gesture_start(const glm::vec2& p0, const glm::vec2& p1) gesture_p1 = p1; kEventResult ret = kEventResult::Available; if (auto* main = layout[main_id]) - { ret = main->on_event(&e); - main->update(); - } return ret == kEventResult::Consumed; } bool App::gesture_move(const glm::vec2& p0, const glm::vec2& p1) @@ -430,10 +413,7 @@ bool App::gesture_move(const glm::vec2& p0, const glm::vec2& p1) e.m_pos_delta = p - glm::lerp(gesture_p0, gesture_p1, 0.5f); kEventResult ret = kEventResult::Available; if (auto* main = layout[main_id]) - { ret = main->on_event(&e); - main->update(); - } return ret == kEventResult::Consumed; } bool App::gesture_end() @@ -443,10 +423,7 @@ bool App::gesture_end() e.m_type = kEventType::GestureEnd; kEventResult ret = kEventResult::Available; if (auto* main = layout[main_id]) - { ret = main->on_event(&e); - main->update(); - } return ret == kEventResult::Consumed; } bool App::key_down(kKey key) @@ -460,10 +437,7 @@ bool App::key_down(kKey key) e.m_key = key; kEventResult ret = kEventResult::Available; if (auto* main = layout[main_id]) - { ret = main->on_event(&e); - main->update(); - } return ret == kEventResult::Consumed; } bool App::key_up(kKey key) @@ -475,10 +449,7 @@ bool App::key_up(kKey key) e.m_key = key; kEventResult ret = kEventResult::Available; if (auto* main = layout[main_id]) - { ret = main->on_event(&e); - main->update(); - } return ret == kEventResult::Consumed; } bool App::key_char(char key) @@ -489,10 +460,7 @@ bool App::key_char(char key) e.m_char = key; kEventResult ret = kEventResult::Available; if (auto* main = layout[main_id]) - { ret = main->on_event(&e); - main->update(); - } return ret == kEventResult::Consumed; } diff --git a/src/app_layout.cpp b/src/app_layout.cpp index 1c2e7ce..2840761 100644 --- a/src/app_layout.cpp +++ b/src/app_layout.cpp @@ -76,7 +76,6 @@ void App::init_toolbar_main() msgbox->m_manager = &layout; msgbox->init(); layout[main_id]->add_child(msgbox); - layout[main_id]->update(); }; } if (auto* button = layout[main_id]->find("btn-settings")) @@ -86,7 +85,6 @@ void App::init_toolbar_main() settings->m_manager = &layout; settings->init(); layout[main_id]->add_child(settings); - layout[main_id]->update(); }; } } @@ -267,7 +265,6 @@ void App::init_sidebar() stroke->mouse_capture(); auto scroll = stroke->find("scroller"); //scroll->SetHeight(glm::max(100.f, screen.y - pos.y - 200.f)); - layout[main_id]->update(); stroke->on_popup_close = [this, tick](Node*) { tick->destroy(); @@ -310,7 +307,6 @@ void App::init_sidebar() color->m_capture_children = false; color->m_mouse_ignore = false; color->mouse_capture(); - layout[main_id]->update(); color->on_popup_close = [this, tick](Node*) { tick->destroy(); @@ -347,7 +343,6 @@ void App::init_sidebar() layers->mouse_capture(); auto scroll = layers->find("layers-container"); scroll->SetMaxHeight(glm::max(100.f, screen.y - pos.y - 200.f)); - layout[main_id]->update(); layers->on_popup_close = [this, tick](Node*) { tick->destroy(); @@ -384,7 +379,6 @@ void App::init_sidebar() grid->mouse_capture(); auto scroll = grid->find("scroller"); scroll->SetMaxHeight(glm::max(100.f, screen.y - pos.y - 250.f)); - layout[main_id]->update(); grid->on_popup_close = [this, tick](Node*) { tick->destroy(); @@ -525,7 +519,6 @@ void App::init_menu_file() popup->SetPositioning(YGPositionTypeAbsolute); popup->SetPosition(pos.x, pos.y); layout[main_id]->add_child(popup); - layout[main_id]->update(); if (auto b = popup->find("file-newdoc")) b->on_click = [this, popup](Node*) { @@ -609,7 +602,6 @@ void App::init_menu_file() subpopup->SetPositioning(YGPositionTypeAbsolute); subpopup->SetPosition(pos.x, pos.y); layout[main_id]->add_child(subpopup); - layout[main_id]->update(); subpopup->find("file-submenu-export-png")->on_click = [this, subpopup, popup](Node*) { dialog_export(".png"); subpopup->mouse_release(); @@ -687,7 +679,6 @@ void App::init_menu_edit() popup->SetPositioning(YGPositionTypeAbsolute); popup->SetPosition(pos.x, pos.y); layout[main_id]->add_child(popup); - layout[main_id]->update(); }; } } @@ -707,7 +698,6 @@ void App::init_menu_tools() popup_exp->SetPositioning(YGPositionTypeAbsolute); popup_exp->SetPosition(pos.x, pos.y); layout[main_id]->add_child(popup_exp); - layout[main_id]->update(); if (auto tick = popup_exp->find("tools-timelapse-tick")) tick->on_click = [this, popup_exp](Node* b) { @@ -721,7 +711,6 @@ void App::init_menu_tools() popup_time->SetPositioning(YGPositionTypeAbsolute); popup_time->SetPosition(pos.x, pos.y); layout[main_id]->add_child(popup_time); - layout[main_id]->update(); if (auto item = popup_time->find("timelapse-start")) { @@ -763,7 +752,6 @@ void App::init_menu_tools() popup_time->SetPositioning(YGPositionTypeAbsolute); popup_time->SetPosition(pos.x, pos.y); layout[main_id]->add_child(popup_time); - layout[main_id]->update(); auto visible = [this](Node* panel) { if (!panel) @@ -1041,7 +1029,6 @@ void App::init_menu_about() popup->SetPositioning(YGPositionTypeAbsolute); popup->SetPosition(pos.x, pos.y); layout[main_id]->add_child(popup); - layout[main_id]->update(); popup->find("about-app")->on_click = [this, popup](Node*) { dialog_about(); @@ -1158,7 +1145,6 @@ void App::init_menu_layer() popup->SetPositioning(YGPositionTypeAbsolute); popup->SetPosition(pos.x, pos.y); layout[main_id]->add_child(popup); - layout[main_id]->update(); popup->find("layer-clear")->on_click = [this, popup](Node*) { canvas->m_canvas->clear(); @@ -1507,7 +1493,10 @@ void App::ui_restore() set_ui_rtl(Settings::value("ui-rtl")); if (!Settings::has("ui")) + { + timeline->SetVisibility(false); return; + } timeline->SetVisibility(Settings::value_or("timeline-visible", false));