From: Till Theato Date: Sat, 12 Jun 2010 17:40:50 +0000 (+0000) Subject: - Fix resize start allowing to go further than duration = 0 (inverted the clip) X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8a14e93ad75ed21559b1b7be75439fb3270c4e43;p=kdenlive - Fix resize start allowing to go further than duration = 0 (inverted the clip) - cleanup svn path=/trunk/kdenlive/; revision=4510 --- diff --git a/src/abstractclipitem.cpp b/src/abstractclipitem.cpp index 25839622..cf9c60c3 100644 --- a/src/abstractclipitem.cpp +++ b/src/abstractclipitem.cpp @@ -131,8 +131,7 @@ void AbstractClipItem::resizeStart(int posx, bool hasSizeLimit) if (durationDiff == GenTime()) return; //kDebug() << "-- RESCALE DIFF=" << durationDiff.frames(25) << ", CLIP: " << startPos().frames(25) << "-" << endPos().frames(25); - if (type() == AVWIDGET) { - if (hasSizeLimit && cropStart() + durationDiff < GenTime()) + if (type() == AVWIDGET && hasSizeLimit && cropStart() + durationDiff < GenTime()) { durationDiff = GenTime() - cropStart(); } else if (durationDiff >= cropDuration()) { return; @@ -142,22 +141,21 @@ void AbstractClipItem::resizeStart(int posx, bool hasSizeLimit) //kDebug()<<"// DURATION DIFF: "< -/**Encapsulates a time, which can be set in various forms and outputted in various forms. - *@author Jason Wood - */ +/** + * @class GenTime + * @brief Encapsulates a time, which can be set in various forms and outputted in various forms. + * @author Jason Wood + */ class GenTime { public: - /** Creates a time object, with a time of 0 seconds. */ + /** @brief Creates a GenTime object, with a time of 0 seconds. */ GenTime(); - /** Creates a time object, with time given in seconds. */ + /** @brief Creates a GenTime object, with time given in seconds. */ explicit GenTime(double seconds); - /** Creates a time object, by passing number of frames and how many frames per second */ + /** @brief Creates a GenTime object, by passing number of frames and how many frames per second. */ GenTime(int frames, double framesPerSecond); - /** returns the time, in seconds */ - double seconds() const { - return m_time; - } - /** Returns the time, in milliseconds */ double ms() const; + /** @brief Gets the time, in seconds. */ + double seconds() const; + + /** @brief Gets the time, in milliseconds */ + double ms() const; - /** Returns the time in frames, after being given the number of frames per second */ + /** @brief Gets the time in frames. + * @param framesPerSecond Number of frames per second */ double frames(double framesPerSecond) const; + /** @brief Rounds the GenTime's value to the nearest frame. + * @param framesPerSecond Number of frames per second */ + GenTime & roundNearestFrame(double framesPerSecond); + + + /* + * Operators. + */ + GenTime & operator+=(GenTime op) { m_time += op.m_time; return *this; } - /** Adds two GenTimes */ GenTime operator+(GenTime op) const { + + GenTime & operator-=(GenTime op) { + m_time -= op.m_time; + return *this; + } + + /** @brief Adds two GenTimes. */ + GenTime operator+(GenTime op) const { return GenTime(m_time + op.m_time); } - /** Subtracts one genTime from another */ GenTime operator-(GenTime op) const { + + /** @brief Subtracts one genTime from another. */ + GenTime operator-(GenTime op) const { return GenTime(m_time - op.m_time); } - /** Multiplies one GenTime by a double value, returning a GenTime */ + + /** @brief Multiplies one GenTime by a double value, returning a GenTime. */ GenTime operator*(double op) const { return GenTime(m_time * op); } - /** Divides one GenTime by a double value, returning a GenTime */ + + /** @brief Divides one GenTime by a double value, returning a GenTime. */ GenTime operator/(double op) const { return GenTime(m_time / op); } - /* Implementation of < operator; Works identically as with basic types. */ + bool operator<(GenTime op) const { return m_time + s_delta < op.m_time; } - /* Implementation of > operator; Works identically as with basic types. */ + bool operator>(GenTime op) const { return m_time > op.m_time + s_delta; } - /* Implementation of >= operator; Works identically as with basic types. */ + bool operator>=(GenTime op) const { return m_time + s_delta >= op.m_time; } - /* Implementation of <= operator; Works identically as with basic types. */ + bool operator<=(GenTime op) const { return m_time <= op.m_time + s_delta; } - /* Implementation of == operator; Works identically as with basic types. */ + bool operator==(GenTime op) const { return fabs(m_time - op.m_time) < s_delta; } - /* Implementation of != operator; Works identically as with basic types. */ + bool operator!=(GenTime op) const { return fabs(m_time - op.m_time) >= s_delta; } - /* Rounds the GenTIme's value to the nearest frame */ - GenTime & roundNearestFrame(double framesPerSecond) { - m_time = floor((m_time * framesPerSecond) + 0.5) / framesPerSecond; - return *this; - } - ~GenTime(); -private: // Private attributes +private: /** Holds the time for this object. */ double m_time;