Cosmetics: improved naming and actions on SessionSources (Groups and

File)
This commit is contained in:
brunoherbelin
2021-03-20 11:45:22 +01:00
parent 10ac384e7e
commit 71891292b4
5 changed files with 27 additions and 14 deletions

View File

@@ -445,11 +445,11 @@ void ImGuiVisitor::visit (Source& s)
s.setLocked(l);
if (l) {
Mixer::selection().clear();
Action::manager().store(s.name() + std::string(" lock."));
Action::manager().store(s.name() + std::string(": lock."));
}
else {
Mixer::selection().set(&s);
Action::manager().store(s.name() + std::string(" unlock."));
Action::manager().store(s.name() + std::string(": unlock."));
}
}
@@ -511,13 +511,14 @@ void ImGuiVisitor::visit (SessionFileSource& s)
oss << s.name() << ": Fading " << std::setprecision(2) << f;
Action::manager().store(oss.str());
}
if ( ImGui::Button( ICON_FA_FILE_UPLOAD " Open File", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
if ( ImGui::Button( ICON_FA_FILE_UPLOAD " Open Session", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
Mixer::manager().set( s.detach() );
if ( ImGui::Button( ICON_FA_FILE_EXPORT " Import sources", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
Mixer::manager().import( &s );
ImGuiToolkit::ButtonOpenUrl( SystemToolkit::path_filename(s.path()).c_str(), ImVec2(IMGUI_RIGHT_ALIGN, 0) );
ImGui::Text("Contains %d sources.", s.session()->numSource());
if ( ImGui::Button( ICON_FA_FILE_EXPORT " Import", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
Mixer::manager().import( &s );
}
void ImGuiVisitor::visit (SessionGroupSource& s)
@@ -527,9 +528,10 @@ void ImGuiVisitor::visit (SessionGroupSource& s)
ImGuiToolkit::Icon(s.icon().x, s.icon().y);
ImGui::SameLine(0, 10);
ImGui::Text("Sub-Session");
ImGui::Text("Flat Sesion group");
ImGui::Text("Contains %d sources.", s.session()->numSource());
if ( ImGui::Button( ICON_FA_UPLOAD " Expand sources", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ){
if ( ImGui::Button( ICON_FA_UPLOAD " Expand", ImVec2(IMGUI_RIGHT_ALIGN, 0)) ){
Mixer::manager().import( &s );
}

View File

@@ -603,8 +603,11 @@ void Mixer::groupSelection()
SessionGroupSource *sessiongroup = new SessionGroupSource;
sessiongroup->setResolution( session_->frame()->resolution() );
// empty the selection
// prepare for new session group attributes
std::string name;
float d = selection().front()->depth();
// empty the selection
while ( !selection().empty() ) {
Source *s = selection().front();
@@ -612,6 +615,7 @@ void Mixer::groupSelection()
// import source into group
if ( sessiongroup->import(s) ) {
name += s->initials();
// detach & remove element from selection()
detach (s);
// remove source from session
@@ -635,15 +639,15 @@ void Mixer::groupSelection()
// Attach source to Mixer
attach(sessiongroup);
// avoid name duplicates
renameSource(sessiongroup, "group");
// rename and avoid name duplicates
renameSource(sessiongroup, name);
// store in action manager
std::ostringstream info;
info << sessiongroup->name() << " source inserted, " << sessiongroup->session()->numSource() << " sources flatten.";
Action::manager().store(info.str());
// give hand to the user
// give the hand to the user
Mixer::manager().setCurrentSource(sessiongroup);
Log::Notify(info.str().c_str());
}

View File

@@ -594,6 +594,10 @@ void SessionLoader::visit (MediaSource& s)
void SessionLoader::visit (SessionFileSource& s)
{
// set fading
float f = 0.f;
xmlCurrent_->QueryFloatAttribute("fading", &f);
s.session()->setFading(f);
// set uri
XMLElement* pathNode = xmlCurrent_->FirstChildElement("path");
if (pathNode) {
@@ -602,6 +606,7 @@ void SessionLoader::visit (SessionFileSource& s)
if ( path != s.path() )
s.load(path, recursion_ + 1);
}
}
void SessionLoader::visit (SessionGroupSource& s)

View File

@@ -460,6 +460,8 @@ void SessionVisitor::visit (MediaSource& s)
void SessionVisitor::visit (SessionFileSource& s)
{
xmlCurrent_->SetAttribute("type", "SessionSource");
if (s.session() != nullptr)
xmlCurrent_->SetAttribute("fading", s.session()->fading());
XMLElement *path = xmlDoc_->NewElement("path");
xmlCurrent_->InsertEndChild(path);

View File

@@ -266,8 +266,8 @@ void View::lock(Source *s, bool on)
{
s->setLocked(on);
if (on)
Action::manager().store(s->name() + std::string(" lock."));
Action::manager().store(s->name() + std::string(": lock."));
else
Action::manager().store(s->name() + std::string(" unlock."));
Action::manager().store(s->name() + std::string(": unlock."));
}