Action manager follows View of restored action (user settings)

This commit is contained in:
brunoherbelin
2020-10-11 16:02:41 +02:00
parent 34b508a8dd
commit 1390eff646
4 changed files with 18 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
#include "tinyxml2Toolkit.h"
#include "SessionVisitor.h"
#include "SessionCreator.h"
#include "Settings.h"
#include "ActionManager.h"
@@ -57,6 +58,8 @@ void Action::store(const std::string &label, uint64_t id)
sessionNode->SetAttribute("label", label.c_str());
// id indicates which object was modified
sessionNode->SetAttribute("id", id);
// view indicates the view when this action occured
sessionNode->SetAttribute("view", (int) Mixer::manager().view()->mode());
// get session to operate on
Session *se = Mixer::manager().session();
@@ -150,6 +153,12 @@ void Action::restore(uint target, uint64_t id)
std::string nodename = "H" + std::to_string(step_);
XMLElement *sessionNode = xmlDoc_.FirstChildElement( nodename.c_str() );
// ask view to refresh, and switch to action view if user prefers
int view = Settings::application.current_view ;
if (Settings::application.action_history_follow_view)
sessionNode->QueryIntAttribute("view", &view);
Mixer::manager().setView( (View::Mode) view);
#ifdef ACTION_DEBUG
Log::Info("Restore %s '%s' ", nodename.c_str(), sessionNode->Attribute("label"));
#endif

View File

@@ -375,6 +375,10 @@ void MediaPlayer::close()
glDeleteBuffers(2, pbo_);
pbo_size_ = 0;
#ifdef MEDIA_PLAYER_DEBUG
Log::Info("MediaPlayer %s closed", std::to_string(id_).c_str());
#endif
// unregister media player
MediaPlayer::registered_.remove(this);
}
@@ -871,7 +875,7 @@ void MediaPlayer::execute_seek_command(GstClockTime target)
else {
seeking_ = true;
#ifdef MEDIA_PLAYER_DEBUG
Log::Info("MediaPlayer %s Seek %ld %f", std::to_string(id_).c_str(), seek_pos, rate_);
Log::Info("MediaPlayer %s Seek %ld %.1f", std::to_string(id_).c_str(), seek_pos, rate_);
#endif
}

View File

@@ -171,6 +171,7 @@ struct Application
bool pannel_stick;
bool smooth_transition;
bool smooth_cursor;
bool action_history_follow_view;
// Settings of widgets
WidgetsConfig widget;
@@ -205,6 +206,7 @@ struct Application
pannel_stick = false;
smooth_transition = true;
smooth_cursor = false;
action_history_follow_view = false;
current_view = 1;
windows = std::vector<WindowConfig>(3);
windows[0].name = APP_NAME APP_TITLE;

View File

@@ -991,6 +991,8 @@ void UserInterface::RenderHistory()
if ( ImGui::MenuItem( ICON_FA_REDO " Redo", CTRL_MOD "+Shift Z") )
Action::manager().redo();
ImGui::MenuItem( ICON_FA_DIRECTIONS " Follow view", nullptr, &Settings::application.action_history_follow_view);
if ( ImGui::MenuItem( ICON_FA_TIMES " Close") )
Settings::application.widget.history = false;