mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 02:40:00 +01:00
Optimizing iteration
prefix ++i is faster than post i++
This commit is contained in:
@@ -90,7 +90,7 @@ void Action::store(const std::string &label)
|
||||
|
||||
// save all sources using source visitor
|
||||
SessionVisitor sv(&history_doc_, sessionNode);
|
||||
for (auto iter = se->begin(); iter != se->end(); iter++, sv.setRoot(sessionNode) )
|
||||
for (auto iter = se->begin(); iter != se->end(); ++iter, sv.setRoot(sessionNode) )
|
||||
(*iter)->accept(sv);
|
||||
|
||||
// debug
|
||||
@@ -189,7 +189,7 @@ void Action::snapshot(const std::string &label)
|
||||
|
||||
// save all sources using source visitor
|
||||
SessionVisitor sv(&snapshots_doc_, sessionNode);
|
||||
for (auto iter = se->begin(); iter != se->end(); iter++, sv.setRoot(sessionNode) )
|
||||
for (auto iter = se->begin(); iter != se->end(); ++iter, sv.setRoot(sessionNode) )
|
||||
(*iter)->accept(sv);
|
||||
|
||||
// TODO: copy action history instead?
|
||||
|
||||
@@ -72,7 +72,7 @@ GlmToolkit::AxisAlignedBoundingBox BoundingBoxVisitor::AABB(SourceList l, View *
|
||||
{
|
||||
// calculate bbox on selection
|
||||
BoundingBoxVisitor selection_visitor_bbox;
|
||||
for (auto it = l.begin(); it != l.end(); it++) {
|
||||
for (auto it = l.begin(); it != l.end(); ++it) {
|
||||
// calculate bounding box of area covered by selection
|
||||
selection_visitor_bbox.setModelview( view->scene.ws()->transform_ );
|
||||
(*it)->group( view->mode() )->accept(selection_visitor_bbox);
|
||||
@@ -86,7 +86,7 @@ GlmToolkit::OrientedBoundingBox BoundingBoxVisitor::OBB(SourceList l, View *view
|
||||
GlmToolkit::OrientedBoundingBox obb_;
|
||||
|
||||
// try the orientation of each source in the list
|
||||
for (auto source_it = l.begin(); source_it != l.end(); source_it++) {
|
||||
for (auto source_it = l.begin(); source_it != l.end(); ++source_it) {
|
||||
|
||||
float angle = (*source_it)->group( view->mode() )->rotation_.z;
|
||||
glm::mat4 transform = view->scene.ws()->transform_;
|
||||
@@ -94,7 +94,7 @@ GlmToolkit::OrientedBoundingBox BoundingBoxVisitor::OBB(SourceList l, View *view
|
||||
|
||||
// calculate bbox of the list in this orientation
|
||||
BoundingBoxVisitor selection_visitor_bbox;
|
||||
for (auto it = l.begin(); it != l.end(); it++) {
|
||||
for (auto it = l.begin(); it != l.end(); ++it) {
|
||||
// calculate bounding box of area covered by sources' nodes
|
||||
selection_visitor_bbox.setModelview( transform );
|
||||
(*it)->group( view->mode() )->accept(selection_visitor_bbox);
|
||||
|
||||
@@ -197,7 +197,7 @@ void GeometryView::draw()
|
||||
std::vector<Node *> surfaces;
|
||||
std::vector<Node *> overlays;
|
||||
for (auto source_iter = Mixer::manager().session()->begin();
|
||||
source_iter != Mixer::manager().session()->end(); source_iter++) {
|
||||
source_iter != Mixer::manager().session()->end(); ++source_iter) {
|
||||
// if it is in the current workspace
|
||||
if ((*source_iter)->workspace() == Settings::application.current_workspace) {
|
||||
// will draw its surface
|
||||
@@ -320,7 +320,7 @@ void GeometryView::draw()
|
||||
|
||||
// batch manipulation of sources in Geometry view
|
||||
if (ImGui::Selectable( ICON_FA_EXPAND " Fit all" )){
|
||||
for (auto sit = Mixer::selection().begin(); sit != Mixer::selection().end(); sit++){
|
||||
for (auto sit = Mixer::selection().begin(); sit != Mixer::selection().end(); ++sit){
|
||||
(*sit)->group(mode_)->scale_ = glm::vec3(output_surface_->scale_.x/ (*sit)->frame()->aspectRatio(), 1.f, 1.f);
|
||||
(*sit)->group(mode_)->rotation_.z = 0;
|
||||
(*sit)->group(mode_)->translation_ = glm::vec3(0.f);
|
||||
@@ -330,7 +330,7 @@ void GeometryView::draw()
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_VECTOR_SQUARE " Reset all" )){
|
||||
// apply to every sources in selection
|
||||
for (auto sit = Mixer::selection().begin(); sit != Mixer::selection().end(); sit++){
|
||||
for (auto sit = Mixer::selection().begin(); sit != Mixer::selection().end(); ++sit){
|
||||
(*sit)->group(mode_)->scale_ = glm::vec3(1.f);
|
||||
(*sit)->group(mode_)->rotation_.z = 0;
|
||||
(*sit)->group(mode_)->crop_ = glm::vec3(1.f);
|
||||
@@ -352,7 +352,7 @@ void GeometryView::draw()
|
||||
}
|
||||
if (ImGui::Selectable( ICON_FA_COMPASS " Align" )){
|
||||
// apply to every sources in selection
|
||||
for (auto sit = Mixer::selection().begin(); sit != Mixer::selection().end(); sit++){
|
||||
for (auto sit = Mixer::selection().begin(); sit != Mixer::selection().end(); ++sit){
|
||||
(*sit)->group(mode_)->rotation_.z = overlay_selection_->rotation_.z;
|
||||
(*sit)->touch();
|
||||
}
|
||||
@@ -414,7 +414,7 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec2 P)
|
||||
|
||||
// find if the current source was picked
|
||||
auto itp = pv.rbegin();
|
||||
for (; itp != pv.rend(); itp++){
|
||||
for (; itp != pv.rend(); ++itp){
|
||||
// test if source contains this node
|
||||
Source::hasNode is_in_source((*itp).first );
|
||||
if ( is_in_source( current ) ){
|
||||
@@ -452,7 +452,7 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec2 P)
|
||||
pick = { nullptr, glm::vec2(0.f) };
|
||||
|
||||
// loop over all nodes picked to detect clic on locks
|
||||
for (auto itp = pv.rbegin(); itp != pv.rend(); itp++){
|
||||
for (auto itp = pv.rbegin(); itp != pv.rend(); ++itp){
|
||||
// get if a source was picked
|
||||
Source *s = Mixer::manager().findSource((*itp).first);
|
||||
// lock icon of a source (not current) is picked : unlock
|
||||
@@ -466,7 +466,7 @@ std::pair<Node *, glm::vec2> GeometryView::pick(glm::vec2 P)
|
||||
if ( pick.first == nullptr) {
|
||||
|
||||
// loop over all nodes picked
|
||||
for (auto itp = pv.rbegin(); itp != pv.rend(); itp++){
|
||||
for (auto itp = pv.rbegin(); itp != pv.rend(); ++itp){
|
||||
// get if a source was picked
|
||||
Source *s = Mixer::manager().findSource((*itp).first);
|
||||
// accept picked sources in current workspaces
|
||||
@@ -518,7 +518,7 @@ bool GeometryView::canSelect(Source *s) {
|
||||
|
||||
void GeometryView::applySelectionTransform(glm::mat4 M)
|
||||
{
|
||||
for (auto sit = Mixer::selection().begin(); sit != Mixer::selection().end(); sit++){
|
||||
for (auto sit = Mixer::selection().begin(); sit != Mixer::selection().end(); ++sit){
|
||||
// recompute all from matrix transform
|
||||
glm::mat4 transform = M * (*sit)->stored_status_->transform_;
|
||||
glm::vec3 tra, rot, sca;
|
||||
@@ -1010,7 +1010,7 @@ void GeometryView::terminate()
|
||||
// restore of all handles overlays
|
||||
glm::vec2 c(0.f, 0.f);
|
||||
for (auto sit = Mixer::manager().session()->begin();
|
||||
sit != Mixer::manager().session()->end(); sit++){
|
||||
sit != Mixer::manager().session()->end(); ++sit){
|
||||
|
||||
(*sit)->handles_[mode_][Handles::RESIZE]->overlayActiveCorner(c);
|
||||
(*sit)->handles_[mode_][Handles::RESIZE_H]->overlayActiveCorner(c);
|
||||
@@ -1038,7 +1038,7 @@ void GeometryView::arrow (glm::vec2 movement)
|
||||
|
||||
bool first = true;
|
||||
glm::vec3 delta_translation(0.f);
|
||||
for (auto it = Mixer::selection().begin(); it != Mixer::selection().end(); it++) {
|
||||
for (auto it = Mixer::selection().begin(); it != Mixer::selection().end(); ++it) {
|
||||
|
||||
// individual move with SHIFT
|
||||
if ( !Source::isCurrent(*it) && UserInterface::manager().shiftModifier() )
|
||||
|
||||
@@ -79,7 +79,7 @@ void GlmToolkit::AxisAlignedBoundingBox::extend(const glm::vec3& point)
|
||||
|
||||
void GlmToolkit::AxisAlignedBoundingBox::extend(std::vector<glm::vec3> points)
|
||||
{
|
||||
for (auto p = points.begin(); p != points.end(); p++)
|
||||
for (auto p = points.begin(); p != points.end(); ++p)
|
||||
extend(*p);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include "Interpolator.h"
|
||||
|
||||
Interpolator::Interpolator()
|
||||
Interpolator::Interpolator(Source *subject, const SourceCore &target) :
|
||||
subject_(subject), cursor_(0.f)
|
||||
{
|
||||
from_ = static_cast<SourceCore> (*subject);
|
||||
to_ = target;
|
||||
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
class Interpolator
|
||||
{
|
||||
public:
|
||||
Interpolator();
|
||||
Interpolator(Source *subject, const SourceCore &target);
|
||||
|
||||
Source *target_;
|
||||
Source *subject_;
|
||||
|
||||
SourceCore from_;
|
||||
SourceCore to_;
|
||||
|
||||
@@ -19,7 +19,7 @@ MixingGroup::MixingGroup (SourceList sources) : parent_(nullptr), root_(nullptr)
|
||||
id_ = GlmToolkit::uniqueId();
|
||||
|
||||
// fill the vector of sources with the given list
|
||||
for (auto it = sources.begin(); it != sources.end(); it++){
|
||||
for (auto it = sources.begin(); it != sources.end(); ++it){
|
||||
// add only if not linked already
|
||||
if ((*it)->mixinggroup_ == nullptr) {
|
||||
(*it)->mixinggroup_ = this;
|
||||
@@ -43,7 +43,7 @@ MixingGroup::MixingGroup (SourceList sources) : parent_(nullptr), root_(nullptr)
|
||||
|
||||
MixingGroup::~MixingGroup ()
|
||||
{
|
||||
for (auto it = sources_.begin(); it != sources_.end(); it++)
|
||||
for (auto it = sources_.begin(); it != sources_.end(); ++it)
|
||||
(*it)->clearMixingGroup();
|
||||
|
||||
if (parent_)
|
||||
@@ -71,7 +71,7 @@ void MixingGroup::recenter()
|
||||
{
|
||||
// compute barycenter (0)
|
||||
center_pos_ = glm::vec2(0.f, 0.f);
|
||||
for (auto it = sources_.begin(); it != sources_.end(); it++){
|
||||
for (auto it = sources_.begin(); it != sources_.end(); ++it){
|
||||
// compute barycenter (1)
|
||||
center_pos_ += glm::vec2((*it)->group(View::MIXING)->translation_);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ void MixingGroup::update (float)
|
||||
// compute barycenter (0)
|
||||
center_pos_ = glm::vec2(0.f, 0.f);
|
||||
auto it = sources_.begin();
|
||||
for (; it != sources_.end(); it++){
|
||||
for (; it != sources_.end(); ++it){
|
||||
// update point
|
||||
p[ index_points_[*it] ] = glm::vec2((*it)->group(View::MIXING)->translation_);
|
||||
|
||||
@@ -160,7 +160,7 @@ void MixingGroup::update (float)
|
||||
// compute barycenter (0)
|
||||
center_pos_ = glm::vec2(0.f, 0.f);
|
||||
auto it = sources_.begin();
|
||||
for (; it != sources_.end(); it++){
|
||||
for (; it != sources_.end(); ++it){
|
||||
|
||||
// modify all but the already updated source
|
||||
if ( *it != updated_source_ && !(*it)->locked() ) {
|
||||
@@ -196,7 +196,7 @@ void MixingGroup::update (float)
|
||||
|
||||
int numactions = 0;
|
||||
auto it = sources_.begin();
|
||||
for (; it != sources_.end(); it++){
|
||||
for (; it != sources_.end(); ++it){
|
||||
|
||||
// modify all but the already updated source
|
||||
if ( *it != updated_source_ && !(*it)->locked() ) {
|
||||
@@ -256,7 +256,7 @@ void MixingGroup::detach (Source *s)
|
||||
|
||||
void MixingGroup::detach (SourceList l)
|
||||
{
|
||||
for (auto sit = l.begin(); sit != l.end(); sit++) {
|
||||
for (auto sit = l.begin(); sit != l.end(); ++sit) {
|
||||
// find the source
|
||||
SourceList::iterator its = std::find(sources_.begin(), sources_.end(), *sit);
|
||||
// ok, its in the list !
|
||||
@@ -291,7 +291,7 @@ void MixingGroup::attach (Source *s)
|
||||
|
||||
void MixingGroup::attach (SourceList l)
|
||||
{
|
||||
for (auto sit = l.begin(); sit != l.end(); sit++) {
|
||||
for (auto sit = l.begin(); sit != l.end(); ++sit) {
|
||||
if ( (*sit)->mixinggroup_ == nullptr) {
|
||||
// tell the source
|
||||
(*sit)->mixinggroup_ = this;
|
||||
@@ -359,7 +359,7 @@ void MixingGroup::createLineStrip()
|
||||
|
||||
// path linking all sources
|
||||
std::vector<glm::vec2> path;
|
||||
for (auto it = sources_.begin(); it != sources_.end(); it++){
|
||||
for (auto it = sources_.begin(); it != sources_.end(); ++it){
|
||||
index_points_[*it] = path.size();
|
||||
path.push_back(glm::vec2((*it)->group(View::MIXING)->translation_));
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ void MixingView::terminate()
|
||||
|
||||
// terminate all mixing group actions
|
||||
for (auto g = Mixer::manager().session()->beginMixingGroup();
|
||||
g != Mixer::manager().session()->endMixingGroup(); g++)
|
||||
g != Mixer::manager().session()->endMixingGroup(); ++g)
|
||||
(*g)->setAction( MixingGroup::ACTION_FINISH );
|
||||
|
||||
}
|
||||
@@ -528,7 +528,7 @@ void MixingView::arrow (glm::vec2 movement)
|
||||
|
||||
bool first = true;
|
||||
glm::vec3 delta_translation(0.f);
|
||||
for (auto it = Mixer::selection().begin(); it != Mixer::selection().end(); it++) {
|
||||
for (auto it = Mixer::selection().begin(); it != Mixer::selection().end(); ++it) {
|
||||
|
||||
// individual move with SHIFT
|
||||
if ( !Source::isCurrent(*it) && UserInterface::manager().shiftModifier() )
|
||||
|
||||
@@ -61,7 +61,7 @@ void Selection::set(SourceList l)
|
||||
{
|
||||
clear();
|
||||
|
||||
for(auto it = l.begin(); it != l.end(); it++)
|
||||
for(auto it = l.begin(); it != l.end(); ++it)
|
||||
(*it)->setMode(Source::SELECTED);
|
||||
|
||||
l.sort();
|
||||
@@ -71,7 +71,7 @@ void Selection::set(SourceList l)
|
||||
|
||||
void Selection::add(SourceList l)
|
||||
{
|
||||
for(auto it = l.begin(); it != l.end(); it++)
|
||||
for(auto it = l.begin(); it != l.end(); ++it)
|
||||
(*it)->setMode(Source::SELECTED);
|
||||
|
||||
// generate new set as union of current selection and give list
|
||||
@@ -86,7 +86,7 @@ void Selection::add(SourceList l)
|
||||
|
||||
void Selection::remove(SourceList l)
|
||||
{
|
||||
for(auto it = l.begin(); it != l.end(); it++)
|
||||
for(auto it = l.begin(); it != l.end(); ++it)
|
||||
(*it)->setMode(Source::VISIBLE);
|
||||
|
||||
// generate new set as difference of current selection and give list
|
||||
@@ -98,7 +98,7 @@ void Selection::remove(SourceList l)
|
||||
|
||||
void Selection::clear()
|
||||
{
|
||||
for(auto it = selection_.begin(); it != selection_.end(); it++)
|
||||
for(auto it = selection_.begin(); it != selection_.end(); ++it)
|
||||
(*it)->setMode(Source::VISIBLE);
|
||||
|
||||
selection_.clear();
|
||||
|
||||
10
Session.cpp
10
Session.cpp
@@ -66,7 +66,7 @@ void Session::setActive (bool on)
|
||||
{
|
||||
if (active_ != on) {
|
||||
active_ = on;
|
||||
for(auto it = sources_.begin(); it != sources_.end(); it++) {
|
||||
for(auto it = sources_.begin(); it != sources_.end(); ++it) {
|
||||
(*it)->setActive(active_);
|
||||
}
|
||||
}
|
||||
@@ -308,7 +308,7 @@ int Session::index(SourceList::iterator it) const
|
||||
{
|
||||
int index = -1;
|
||||
int count = 0;
|
||||
for(auto i = sources_.begin(); i != sources_.end(); i++, count++) {
|
||||
for(auto i = sources_.begin(); i != sources_.end(); ++i, ++count) {
|
||||
if ( i == it ) {
|
||||
index = count;
|
||||
break;
|
||||
@@ -341,7 +341,7 @@ bool Session::canlink (SourceList sources)
|
||||
// verify that all sources given are valid in the sesion
|
||||
validate(sources);
|
||||
|
||||
for (auto it = sources.begin(); it != sources.end(); it++) {
|
||||
for (auto it = sources.begin(); it != sources.end(); ++it) {
|
||||
// this source is linked
|
||||
if ( (*it)->mixingGroup() != nullptr ) {
|
||||
// askt its group to detach it
|
||||
@@ -376,7 +376,7 @@ void Session::unlink (SourceList sources)
|
||||
validate(sources);
|
||||
|
||||
// brute force : detach all given sources
|
||||
for (auto it = sources.begin(); it != sources.end(); it++) {
|
||||
for (auto it = sources.begin(); it != sources.end(); ++it) {
|
||||
// this source is linked
|
||||
if ( (*it)->mixingGroup() != nullptr ) {
|
||||
// askt its group to detach it
|
||||
@@ -413,7 +413,7 @@ std::list<SourceList> Session::getMixingGroups () const
|
||||
{
|
||||
std::list<SourceList> lmg;
|
||||
|
||||
for (auto group_it = mixing_groups_.begin(); group_it!= mixing_groups_.end(); group_it++)
|
||||
for (auto group_it = mixing_groups_.begin(); group_it!= mixing_groups_.end(); ++group_it)
|
||||
lmg.push_back( (*group_it)->getCopy() );
|
||||
|
||||
return lmg;
|
||||
|
||||
@@ -97,7 +97,7 @@ void SessionCreator::load(const std::string& filename)
|
||||
|
||||
// create groups
|
||||
std::list< SourceList > groups = getMixingGroups();
|
||||
for (auto group_it = groups.begin(); group_it != groups.end(); group_it++)
|
||||
for (auto group_it = groups.begin(); group_it != groups.end(); ++group_it)
|
||||
session_->link( *group_it );
|
||||
|
||||
// load snapshots
|
||||
@@ -185,10 +185,10 @@ std::list< SourceList > SessionLoader::getMixingGroups() const
|
||||
std::list< SourceList > groups_new_sources_id;
|
||||
|
||||
// perform conversion from xml id to new id
|
||||
for (auto git = groups_sources_id_.begin(); git != groups_sources_id_.end(); git++)
|
||||
for (auto git = groups_sources_id_.begin(); git != groups_sources_id_.end(); ++git)
|
||||
{
|
||||
SourceList new_sources;
|
||||
for (auto sit = (*git).begin(); sit != (*git).end(); sit++ ) {
|
||||
for (auto sit = (*git).begin(); sit != (*git).end(); ++sit ) {
|
||||
if (sources_id_.count(*sit) > 0)
|
||||
new_sources.push_back( sources_id_.at(*sit) );
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ bool SessionVisitor::saveSession(const std::string& filename, Session *session)
|
||||
XMLElement *sessionNode = xmlDoc.NewElement("Session");
|
||||
xmlDoc.InsertEndChild(sessionNode);
|
||||
SessionVisitor sv(&xmlDoc, sessionNode);
|
||||
for (auto iter = session->begin(); iter != session->end(); iter++, sv.setRoot(sessionNode) )
|
||||
for (auto iter = session->begin(); iter != session->end(); ++iter, sv.setRoot(sessionNode) )
|
||||
// source visitor
|
||||
(*iter)->accept(sv);
|
||||
|
||||
@@ -184,7 +184,7 @@ void SessionVisitor::visit(Switch &n)
|
||||
if (recursive_) {
|
||||
// loop over members of the group
|
||||
XMLElement *group = xmlCurrent_;
|
||||
for(uint i = 0; i < n.numChildren(); i++) {
|
||||
for(uint i = 0; i < n.numChildren(); ++i) {
|
||||
n.child(i)->accept(*this);
|
||||
// revert to group as current
|
||||
xmlCurrent_ = group;
|
||||
@@ -258,7 +258,7 @@ void SessionVisitor::visit(MediaPlayer &n)
|
||||
// gaps in timeline
|
||||
XMLElement *gapselement = xmlDoc_->NewElement("Gaps");
|
||||
TimeIntervalSet gaps = n.timeline()->gaps();
|
||||
for( auto it = gaps.begin(); it!= gaps.end(); it++) {
|
||||
for( auto it = gaps.begin(); it!= gaps.end(); ++it) {
|
||||
XMLElement *g = xmlDoc_->NewElement("Interval");
|
||||
g->SetAttribute("begin", (*it).begin);
|
||||
g->SetAttribute("end", (*it).end);
|
||||
@@ -520,7 +520,7 @@ void SessionVisitor::visit (SessionGroupSource& s)
|
||||
XMLElement *sessionNode = xmlDoc_->NewElement("Session");
|
||||
xmlCurrent_->InsertEndChild(sessionNode);
|
||||
|
||||
for (auto iter = se->begin(); iter != se->end(); iter++){
|
||||
for (auto iter = se->begin(); iter != se->end(); ++iter){
|
||||
setRoot(sessionNode);
|
||||
(*iter)->accept(*this);
|
||||
}
|
||||
@@ -569,7 +569,7 @@ void SessionVisitor::visit (MixingGroup& g)
|
||||
{
|
||||
xmlCurrent_->SetAttribute("size", g.size());
|
||||
|
||||
for (auto it = g.begin(); it != g.end(); it++) {
|
||||
for (auto it = g.begin(); it != g.end(); ++it) {
|
||||
XMLElement *sour = xmlDoc_->NewElement("source");
|
||||
sour->SetAttribute("id", (*it)->id());
|
||||
xmlCurrent_->InsertEndChild(sour);
|
||||
@@ -591,7 +591,7 @@ std::string SessionVisitor::getClipboard(SourceList list)
|
||||
// fill doc by visiting sources
|
||||
SourceList selection_clones_;
|
||||
SessionVisitor sv(&xmlDoc, selectionNode);
|
||||
for (auto iter = list.begin(); iter != list.end(); iter++, sv.setRoot(selectionNode) ){
|
||||
for (auto iter = list.begin(); iter != list.end(); ++iter, sv.setRoot(selectionNode) ){
|
||||
// start with clones
|
||||
CloneSource *clone = dynamic_cast<CloneSource *>(*iter);
|
||||
if (clone)
|
||||
@@ -600,7 +600,7 @@ std::string SessionVisitor::getClipboard(SourceList list)
|
||||
selection_clones_.push_back(*iter);
|
||||
}
|
||||
// add others in front
|
||||
for (auto iter = selection_clones_.begin(); iter != selection_clones_.end(); iter++, sv.setRoot(selectionNode) ){
|
||||
for (auto iter = selection_clones_.begin(); iter != selection_clones_.end(); ++iter, sv.setRoot(selectionNode) ){
|
||||
(*iter)->accept(sv);
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ void Settings::Save()
|
||||
recentsession->SetAttribute("autosave", application.recentSessions.save_on_exit);
|
||||
recentsession->SetAttribute("valid", application.recentSessions.front_is_valid);
|
||||
for(auto it = application.recentSessions.filenames.begin();
|
||||
it != application.recentSessions.filenames.end(); it++) {
|
||||
it != application.recentSessions.filenames.end(); ++it) {
|
||||
XMLElement *fileNode = xmlDoc.NewElement("path");
|
||||
XMLText *text = xmlDoc.NewText( (*it).c_str() );
|
||||
fileNode->InsertEndChild( text );
|
||||
@@ -185,7 +185,7 @@ void Settings::Save()
|
||||
|
||||
XMLElement *recentfolder = xmlDoc.NewElement( "Folder" );
|
||||
for(auto it = application.recentFolders.filenames.begin();
|
||||
it != application.recentFolders.filenames.end(); it++) {
|
||||
it != application.recentFolders.filenames.end(); ++it) {
|
||||
XMLElement *fileNode = xmlDoc.NewElement("path");
|
||||
XMLText *text = xmlDoc.NewText( (*it).c_str() );
|
||||
fileNode->InsertEndChild( text );
|
||||
@@ -196,7 +196,7 @@ void Settings::Save()
|
||||
XMLElement *recentmedia = xmlDoc.NewElement( "Import" );
|
||||
recentmedia->SetAttribute("path", application.recentImport.path.c_str());
|
||||
for(auto it = application.recentImport.filenames.begin();
|
||||
it != application.recentImport.filenames.end(); it++) {
|
||||
it != application.recentImport.filenames.end(); ++it) {
|
||||
XMLElement *fileNode = xmlDoc.NewElement("path");
|
||||
XMLText *text = xmlDoc.NewText( (*it).c_str() );
|
||||
fileNode->InsertEndChild( text );
|
||||
|
||||
20
Source.cpp
20
Source.cpp
@@ -61,6 +61,11 @@ SourceCore::~SourceCore()
|
||||
groups_.clear();
|
||||
}
|
||||
|
||||
void SourceCore::store (View::Mode m)
|
||||
{
|
||||
stored_status_->copyTransform(groups_[m]);
|
||||
}
|
||||
|
||||
SourceCore& SourceCore::operator= (SourceCore const& other)
|
||||
{
|
||||
if (this != &other) { // no self assignment
|
||||
@@ -70,6 +75,7 @@ SourceCore& SourceCore::operator= (SourceCore const& other)
|
||||
groups_[View::GEOMETRY]->copyTransform( other.group(View::GEOMETRY) );
|
||||
groups_[View::LAYER]->copyTransform( other.group(View::LAYER) );
|
||||
groups_[View::TEXTURE]->copyTransform( other.group(View::TEXTURE) );
|
||||
groups_[View::TRANSITION]->copyTransform( other.group(View::TRANSITION) );
|
||||
stored_status_->copyTransform( other.stored_status_ );
|
||||
|
||||
// copy shader properties
|
||||
@@ -277,7 +283,7 @@ Source::~Source()
|
||||
links_.front()->disconnect();
|
||||
|
||||
// inform clones that they lost their origin
|
||||
for (auto it = clones_.begin(); it != clones_.end(); it++)
|
||||
for (auto it = clones_.begin(); it != clones_.end(); ++it)
|
||||
(*it)->detach();
|
||||
clones_.clear();
|
||||
|
||||
@@ -320,18 +326,18 @@ void Source::setMode(Source::Mode m)
|
||||
{
|
||||
// make visible on first time
|
||||
if ( mode_ == Source::UNINITIALIZED ) {
|
||||
for (auto g = groups_.begin(); g != groups_.end(); g++)
|
||||
for (auto g = groups_.begin(); g != groups_.end(); ++g)
|
||||
(*g).second->visible_ = true;
|
||||
}
|
||||
|
||||
// choose frame 0 if visible, 1 if selected
|
||||
uint index_frame = m == Source::VISIBLE ? 0 : 1;
|
||||
for (auto f = frames_.begin(); f != frames_.end(); f++)
|
||||
for (auto f = frames_.begin(); f != frames_.end(); ++f)
|
||||
(*f).second->setActive(index_frame);
|
||||
|
||||
// show overlay if current
|
||||
bool current = m >= Source::CURRENT;
|
||||
for (auto o = overlays_.begin(); o != overlays_.end(); o++)
|
||||
for (auto o = overlays_.begin(); o != overlays_.end(); ++o)
|
||||
(*o).second->visible_ = (current && !locked_);
|
||||
|
||||
// the lock icon
|
||||
@@ -483,7 +489,7 @@ void Source::setActive (bool on)
|
||||
active_ = on;
|
||||
|
||||
// do not disactivate if a clone depends on it
|
||||
for(auto clone = clones_.begin(); clone != clones_.end(); clone++) {
|
||||
for(auto clone = clones_.begin(); clone != clones_.end(); ++clone) {
|
||||
if ( (*clone)->active() )
|
||||
active_ = true;
|
||||
}
|
||||
@@ -762,13 +768,13 @@ bool Source::hasNode::operator()(const Source* elem) const
|
||||
// general case: traverse tree of all Groups recursively using a SearchVisitor
|
||||
SearchVisitor sv(_n);
|
||||
// search in groups for all views
|
||||
for (auto g = elem->groups_.begin(); g != elem->groups_.end(); g++) {
|
||||
for (auto g = elem->groups_.begin(); g != elem->groups_.end(); ++g) {
|
||||
(*g).second->accept(sv);
|
||||
if (sv.found())
|
||||
return true;
|
||||
}
|
||||
// search in overlays for all views
|
||||
for (auto g = elem->overlays_.begin(); g != elem->overlays_.end(); g++) {
|
||||
for (auto g = elem->overlays_.begin(); g != elem->overlays_.end(); ++g) {
|
||||
(*g).second->accept(sv);
|
||||
if (sv.found())
|
||||
return true;
|
||||
|
||||
1
Source.h
1
Source.h
@@ -32,6 +32,7 @@ public:
|
||||
// get handle on the nodes used to manipulate the source in a view
|
||||
inline Group *group (View::Mode m) const { return groups_.at(m); }
|
||||
inline Node *groupNode (View::Mode m) const { return static_cast<Node*>(groups_.at(m)); }
|
||||
void store (View::Mode m);
|
||||
|
||||
// a Source has a shader used to render in fbo
|
||||
inline Shader *renderingShader () const { return renderingshader_; }
|
||||
|
||||
@@ -49,7 +49,7 @@ SourceIdList ids (const SourceList &list)
|
||||
{
|
||||
SourceIdList idlist;
|
||||
|
||||
for( auto sit = list.begin(); sit != list.end(); sit++)
|
||||
for( auto sit = list.begin(); sit != list.end(); ++sit)
|
||||
idlist.push_back( (*sit)->id() );
|
||||
|
||||
// make sure no duplicate
|
||||
@@ -67,7 +67,7 @@ SourceListCompare compare (const SourceList &first, const SourceList &second)
|
||||
|
||||
// a new test list: start with the second list and remove all commons with first list
|
||||
SourceList test = second;
|
||||
for (auto it = first.begin(); it != first.end(); it++){
|
||||
for (auto it = first.begin(); it != first.end(); ++it){
|
||||
test.remove(*it);
|
||||
}
|
||||
|
||||
@@ -100,12 +100,12 @@ SourceList intersect (const SourceList &first, const SourceList &second)
|
||||
// take second list and remove all elements also in first list
|
||||
// -> builds the list of what remains in second list
|
||||
SourceList l1 = second;
|
||||
for (auto it = first.begin(); it != first.end(); it++)
|
||||
for (auto it = first.begin(); it != first.end(); ++it)
|
||||
l1.remove(*it);
|
||||
// take second list and remove all elements in the remainer list
|
||||
// -> builds the list of what is in second list and was part of the first list
|
||||
SourceList l2 = second;
|
||||
for (auto it = l1.begin(); it != l1.end(); it++)
|
||||
for (auto it = l1.begin(); it != l1.end(); ++it)
|
||||
l2.remove(*it);
|
||||
return l2;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ SourceList intersect (const SourceList &first, const SourceList &second)
|
||||
SourceList join (const SourceList &first, const SourceList &second)
|
||||
{
|
||||
SourceList l = second;
|
||||
for (auto it = first.begin(); it != first.end(); it++)
|
||||
for (auto it = first.begin(); it != first.end(); ++it)
|
||||
l.push_back(*it);
|
||||
l.unique();
|
||||
return l;
|
||||
|
||||
@@ -232,7 +232,7 @@ void Stream::close()
|
||||
desired_state_ = GST_STATE_PAUSED;
|
||||
|
||||
// cleanup eventual remaining frame memory
|
||||
for(guint i = 0; i < N_FRAME; i++){
|
||||
for(guint i = 0; i < N_FRAME; ++i){
|
||||
frame_[i].access.lock();
|
||||
frame_[i].unmap();
|
||||
frame_[i].access.unlock();
|
||||
@@ -710,7 +710,7 @@ void Stream::TimeCounter::tic ()
|
||||
GstClockTime dt = t - last_time;
|
||||
|
||||
// one more frame since last time
|
||||
nbFrames++;
|
||||
++nbFrames;
|
||||
|
||||
// calculate instantaneous framerate
|
||||
// Exponential moving averate with previous framerate to filter jitter (50/50)
|
||||
|
||||
@@ -561,7 +561,7 @@ void UserInterface::handleMouse()
|
||||
{
|
||||
if (!shift_modifier_active) {
|
||||
// grab others from selection
|
||||
for (auto it = Mixer::selection().begin(); it != Mixer::selection().end(); it++) {
|
||||
for (auto it = Mixer::selection().begin(); it != Mixer::selection().end(); ++it) {
|
||||
if ( *it != current )
|
||||
Mixer::manager().view()->grab(*it, mouseclic[ImGuiMouseButton_Left], mouse_smooth, picked);
|
||||
}
|
||||
@@ -1152,7 +1152,7 @@ void UserInterface::RenderPreview()
|
||||
if (ls.size()>0) {
|
||||
ImGui::Separator();
|
||||
ImGui::MenuItem("Active streams", nullptr, false, false);
|
||||
for (auto it = ls.begin(); it != ls.end(); it++)
|
||||
for (auto it = ls.begin(); it != ls.end(); ++it)
|
||||
ImGui::Text(" %s", (*it).c_str() );
|
||||
}
|
||||
|
||||
@@ -2037,7 +2037,7 @@ void MediaController::Render()
|
||||
setMediaPlayer();
|
||||
|
||||
// display list of available media
|
||||
for (auto mpit = MediaPlayer::begin(); mpit != MediaPlayer::end(); mpit++ )
|
||||
for (auto mpit = MediaPlayer::begin(); mpit != MediaPlayer::end(); ++mpit )
|
||||
{
|
||||
std::string label = (*mpit)->filename();
|
||||
if (ImGui::MenuItem( label.c_str() ))
|
||||
@@ -2185,7 +2185,7 @@ void MediaController::Render()
|
||||
if (ImGui::BeginMenu("Smooth curve"))
|
||||
{
|
||||
const char* names[] = { "Just a little", "A bit more", "Quite a lot"};
|
||||
for (int i = 0; i < IM_ARRAYSIZE(names); i++) {
|
||||
for (int i = 0; i < IM_ARRAYSIZE(names); ++i) {
|
||||
if (ImGui::MenuItem(names[i])) {
|
||||
mp_->timeline()->smoothFading( 10 * (int) pow(4, i) );
|
||||
Action::manager().store("Timeline Smooth curve");
|
||||
@@ -2196,7 +2196,7 @@ void MediaController::Render()
|
||||
if (ImGui::BeginMenu("Auto fading"))
|
||||
{
|
||||
const char* names[] = { "250 ms", "500 ms", "1 second", "2 seconds"};
|
||||
for (int i = 0; i < IM_ARRAYSIZE(names); i++) {
|
||||
for (int i = 0; i < IM_ARRAYSIZE(names); ++i) {
|
||||
if (ImGui::MenuItem(names[i])) {
|
||||
mp_->timeline()->autoFading( 250 * (int ) pow(2, i) );
|
||||
mp_->timeline()->smoothFading( 10 * (i + 1) );
|
||||
|
||||
9
View.cpp
9
View.cpp
@@ -114,11 +114,8 @@ void View::initiate()
|
||||
{
|
||||
current_action_ = "";
|
||||
for (auto sit = Mixer::manager().session()->begin();
|
||||
sit != Mixer::manager().session()->end(); sit++){
|
||||
|
||||
(*sit)->stored_status_->copyTransform((*sit)->group(mode_));
|
||||
}
|
||||
|
||||
sit != Mixer::manager().session()->end(); ++sit)
|
||||
(*sit)->store(mode_);
|
||||
}
|
||||
|
||||
void View::terminate()
|
||||
@@ -190,7 +187,7 @@ void View::selectAll()
|
||||
{
|
||||
Mixer::selection().clear();
|
||||
for(auto sit = Mixer::manager().session()->begin();
|
||||
sit != Mixer::manager().session()->end(); sit++) {
|
||||
sit != Mixer::manager().session()->end(); ++sit) {
|
||||
if (canSelect(*sit))
|
||||
Mixer::selection().add(*sit);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user