[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src commands/Fade.cpp commands/Fade.h ...
From: |
Ben Levitt |
Subject: |
[Traverso-commit] traverso/src commands/Fade.cpp commands/Fade.h ... |
Date: |
Thu, 28 Jun 2007 06:42:04 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Ben Levitt <benjie> 07/06/28 06:42:04
Modified files:
src/commands : Fade.cpp Fade.h
src/core : FadeCurve.cpp FadeCurve.h
Log message:
make fade mode, fade shape undoable (getting very close to keeping
complete undo history for audible sheet edits :) )
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Fade.cpp?cvsroot=traverso&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Fade.h?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/FadeCurve.cpp?cvsroot=traverso&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/FadeCurve.h?cvsroot=traverso&r1=1.10&r2=1.11
Patches:
Index: commands/Fade.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Fade.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- commands/Fade.cpp 26 Jun 2007 20:08:51 -0000 1.17
+++ commands/Fade.cpp 28 Jun 2007 06:42:03 -0000 1.18
@@ -148,6 +148,16 @@
setText( (m_fade->get_fade_type() == FadeCurve::FadeIn) ? tr("Fade In:
bend") : tr("Fade Out: bend"));
}
+FadeBend::FadeBend(FadeCurve *fade, double val)
+ : Command(fade)
+ , m_fade(fade)
+ , m_fv(0)
+{
+ setText( (m_fade->get_fade_type() == FadeCurve::FadeIn) ? tr("Fade In:
bend") : tr("Fade Out: bend"));
+ origBend = m_fade->get_bend_factor();
+ newBend = val;
+}
+
int FadeBend::begin_hold()
{
PENTER;
@@ -230,6 +240,16 @@
setText( (m_fade->get_fade_type() == FadeCurve::FadeIn) ? tr("Fade In:
strength") : tr("Fade Out: strength"));
}
+FadeStrength::FadeStrength(FadeCurve *fade, double val)
+ : Command(fade)
+ , m_fade(fade)
+ , m_fv(0)
+{
+ setText( (m_fade->get_fade_type() == FadeCurve::FadeIn) ? tr("Fade In:
strength") : tr("Fade Out: strength"));
+ origStrength = m_fade->get_strenght_factor();
+ newStrength = val;
+}
+
int FadeStrength::begin_hold()
{
PENTER;
@@ -304,5 +324,35 @@
}
+/********** FadeMode **********/
+/******************************/
+
+FadeMode::FadeMode(FadeCurve* fade, int oldMode, int newMode)
+ : Command(fade)
+ , m_fade(fade)
+{
+ setText( (m_fade->get_fade_type() == FadeCurve::FadeIn) ? tr("Fade In:
mode") : tr("Fade Out: mode"));
+
+ m_newMode = newMode;
+ m_oldMode = oldMode;
+}
+
+int FadeMode::prepare_actions()
+{
+ return 1;
+}
+
+int FadeMode::do_action()
+{
+ m_fade->private_set_mode(m_newMode);
+ return 1;
+}
+
+int FadeMode::undo_action()
+{
+ m_fade->private_set_mode(m_oldMode);
+ return 1;
+}
+
// eof
Index: commands/Fade.h
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Fade.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- commands/Fade.h 26 Jun 2007 20:08:51 -0000 1.10
+++ commands/Fade.h 28 Jun 2007 06:42:03 -0000 1.11
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: Fade.h,v 1.10 2007/06/26 20:08:51 r_sijrier Exp $
+$Id: Fade.h,v 1.11 2007/06/28 06:42:03 benjie Exp $
*/
#ifndef FADE_H
@@ -64,6 +64,7 @@
{
public :
FadeStrength(FadeView* fadeview);
+ FadeStrength(FadeCurve* fade, double val);
~FadeStrength(){};
int begin_hold();
@@ -92,6 +93,7 @@
{
public :
FadeBend(FadeView* fadeview);
+ FadeBend(FadeCurve* fade, double val);
~FadeBend(){};
int begin_hold();
@@ -116,6 +118,23 @@
};
+class FadeMode : public Command
+{
+public :
+ FadeMode(FadeCurve* fade, int oldMode, int newMode);
+ ~FadeMode(){};
+
+ int prepare_actions();
+ int do_action();
+ int undo_action();
+
+private :
+ int m_oldMode;
+ int m_newMode;
+ FadeCurve* m_fade;
+};
+
+
#endif
Index: core/FadeCurve.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/FadeCurve.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- core/FadeCurve.cpp 26 Jun 2007 20:08:51 -0000 1.20
+++ core/FadeCurve.cpp 28 Jun 2007 06:42:03 -0000 1.21
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: FadeCurve.cpp,v 1.20 2007/06/26 20:08:51 r_sijrier Exp $
+$Id: FadeCurve.cpp,v 1.21 2007/06/28 06:42:03 benjie Exp $
*/
#include "FadeCurve.h"
@@ -25,8 +25,10 @@
#include <QFile>
#include <cmath>
#include "Song.h"
+#include "Fade.h"
#include "AudioClip.h"
#include "Command.h"
+#include "CommandGroup.h"
#include <AddRemove.h>
// Always put me below _all_ includes, this is needed
@@ -227,8 +229,12 @@
return;
}
- set_bend_factor(fadeElement.attribute( "bendfactor", "0.5"
).toDouble());
- set_strength_factor(fadeElement.attribute( "strengthfactor", "0.5"
).toDouble());
+ CommandGroup* group = new CommandGroup(this, tr("Fade Shape"));
+
+ group->add_command(new FadeBend(this, fadeElement.attribute(
"bendfactor", "0.5" ).toDouble()));
+ group->add_command(new FadeStrength(this, fadeElement.attribute(
"strengthfactor", "0.5" ).toDouble()));
+
+ Command::process_command(group);
QStringList controlPointsList = fadeElement.attribute( "controlpoints",
"" ).split(";");
@@ -338,13 +344,17 @@
Command* FadeCurve::set_mode( )
{
if (m_mode < 2) {
- m_mode++;
+ return new FadeMode(this, m_mode, m_mode+1);
} else {
- m_mode = 0;
+ return new FadeMode(this, m_mode, 0);
}
+}
+
+void FadeCurve::private_set_mode(int m)
+{
+ m_mode = m;
emit modeChanged();
- return 0;
}
Command* FadeCurve::reset( )
Index: core/FadeCurve.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/FadeCurve.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- core/FadeCurve.h 30 May 2007 13:14:46 -0000 1.10
+++ core/FadeCurve.h 28 Jun 2007 06:42:03 -0000 1.11
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: FadeCurve.h,v 1.10 2007/05/30 13:14:46 r_sijrier Exp $
+$Id: FadeCurve.h,v 1.11 2007/06/28 06:42:03 benjie Exp $
*/
#ifndef FADE_CURVE_H
@@ -73,6 +73,8 @@
bool is_bypassed() const {return m_bypass;}
void set_range(double pos);
+ void private_set_mode(int m);
+
private:
AudioClip* m_clip;
float m_bendFactor;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src commands/Fade.cpp commands/Fade.h ...,
Ben Levitt <=