[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso resources/keymap.xml src/commands/Gain...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso resources/keymap.xml src/commands/Gain... |
Date: |
Tue, 27 Nov 2007 20:20:42 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 07/11/27 20:20:42
Modified files:
resources : keymap.xml
src/commands : Gain.cpp Gain.h
src/commands/plugins/TraversoCommands: TraversoCommands.cpp
src/traverso/songcanvas: SongView.cpp
Log message:
* call SomeCommand::jog() when the horizontal scrollbar value changes
(e.g. due a playcursor autoscroll action) so holdcursors like used for Gain
stay at the same position in the viewport during autoscroll.
Moving an AudioClip keeps the clip at the cursor position, so
effectively moving the clip by as much as the playhead scrolls the view
As far as I know these are the only 2 actions taking benefit of this.
RFC please :)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/resources/keymap.xml?cvsroot=traverso&r1=1.90&r2=1.91
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Gain.cpp?cvsroot=traverso&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/Gain.h?cvsroot=traverso&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/plugins/TraversoCommands/TraversoCommands.cpp?cvsroot=traverso&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/traverso/src/traverso/songcanvas/SongView.cpp?cvsroot=traverso&r1=1.90&r2=1.91
Patches:
Index: resources/keymap.xml
===================================================================
RCS file: /sources/traverso/traverso/resources/keymap.xml,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -b -r1.90 -r1.91
--- resources/keymap.xml 26 Nov 2007 19:16:29 -0000 1.90
+++ resources/keymap.xml 27 Nov 2007 20:20:41 -0000 1.91
@@ -341,8 +341,8 @@
</keyfact>
<keyfact type="HKEY" key1="G" >
<Objects>
- <Object objectname="AudioClip" modes="All"
sortorder="5" pluginname="TraversoCommands" commandname="Gain" />
- <Object objectname="Track" modes="All"
sortorder="7" pluginname="TraversoCommands" commandname="Gain" />
+ <Object objectname="AudioClipView" modes="All"
sortorder="5" pluginname="TraversoCommands" commandname="Gain" />
+ <Object objectname="TrackView" modes="All"
sortorder="7" pluginname="TraversoCommands" commandname="Gain" />
<Object objectname="Song" modes="All"
sortorder="7" pluginname="TraversoCommands" commandname="Gain" />
</Objects>
</keyfact>
@@ -436,7 +436,7 @@
</keyfact>
<keyfact type="HKEY2" key1="S" key2="G" >
<Objects>
- <Object objectname="Song" modes="All"
sortorder="4" pluginname="TraversoCommands" commandname="Gain" />
+ <Object objectname="SongView" modes="All"
sortorder="4" pluginname="TraversoCommands" commandname="Gain" />
</Objects>
</keyfact>
<keyfact type="HKEY2" key1="D" key2="V" >
Index: src/commands/Gain.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Gain.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- src/commands/Gain.cpp 29 Oct 2007 09:00:09 -0000 1.22
+++ src/commands/Gain.cpp 27 Nov 2007 20:20:42 -0000 1.23
@@ -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: Gain.cpp,v 1.22 2007/10/29 09:00:09 r_sijrier Exp $
+$Id: Gain.cpp,v 1.23 2007/11/27 20:20:42 r_sijrier Exp $
*/
#include "Gain.h"
@@ -28,14 +28,16 @@
#include <ViewPort.h>
#include <Track.h>
#include "Song.h"
+#include "SongView.h"
// Always put me below _all_ includes, this is needed
// in case we run with memory leak detection enabled!
#include "Debugger.h"
-Gain::Gain(ContextItem* context, QVariantList args)
+Gain::Gain(ContextItem* context, SongView* sv, QVariantList args)
: Command(context, "")
+ , m_sv(sv)
{
gainObject = context;
horiz = false;
@@ -221,6 +223,12 @@
// Update the vieport's hold cursor!
if (!horiz) {
cpointer().get_viewport()->set_holdcursor_text(QByteArray::number(dbFactor,
'f', 2).append(" dB"));
+ if (m_sv) {
+ cpointer().get_viewport()->set_holdcursor_pos(origPos +
+ QPoint(m_sv->hscrollbar_value(),
+ m_sv->vscrollbar_value()) -
+ QPoint(16, 16));
+ }
}
QCursor::setPos(mousePos);
Index: src/commands/Gain.h
===================================================================
RCS file: /sources/traverso/traverso/src/commands/Gain.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/commands/Gain.h 25 Apr 2007 05:43:36 -0000 1.12
+++ src/commands/Gain.h 27 Nov 2007 20:20:42 -0000 1.13
@@ -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: Gain.h,v 1.12 2007/04/25 05:43:36 benjie Exp $
+ $Id: Gain.h,v 1.13 2007/11/27 20:20:42 r_sijrier Exp $
*/
#ifndef GAIN_H
@@ -27,6 +27,7 @@
#include <QPoint>
class ContextItem;
+class SongView;
class Gain : public Command
@@ -36,7 +37,7 @@
Q_CLASSINFO("decrease_gain", tr("Decrease"));
public :
- Gain(ContextItem* context, QVariantList args);
+ Gain(ContextItem* context, SongView* sv, QVariantList args);
~Gain();
int begin_hold();
@@ -53,6 +54,7 @@
private :
ContextItem* gainObject;
+ SongView* m_sv;
float origGain;
float newGain;
QPoint origPos;
Index: src/commands/plugins/TraversoCommands/TraversoCommands.cpp
===================================================================
RCS file:
/sources/traverso/traverso/src/commands/plugins/TraversoCommands/TraversoCommands.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- src/commands/plugins/TraversoCommands/TraversoCommands.cpp 5 Nov 2007
15:52:26 -0000 1.15
+++ src/commands/plugins/TraversoCommands/TraversoCommands.cpp 27 Nov 2007
20:20:42 -0000 1.16
@@ -59,12 +59,21 @@
case GainCommand:
{
ContextItem* item = qobject_cast<ContextItem*>(obj);
+ SongView* songview = 0;
if (item->metaObject()->className() ==
QString("TrackPanelGain")) {
item = item->get_context();
- }
- if (item->metaObject()->className() ==
QString("SongPanelGain")) {
+ } else if (item->metaObject()->className() ==
QString("SongPanelGain")) {
item = item->get_context();
+ } else if (AudioClipView* view =
qobject_cast<AudioClipView*>(item)) {
+ songview = view->get_songview();
+ item = view->get_context();
+ } else if (TrackView* view =
qobject_cast<TrackView*>(item)) {
+ songview = view->get_songview();
+ item = view->get_context();
+ } else if (SongView* view =
qobject_cast<SongView*>(item)) {
+ songview = view;
+ item = view->get_context();
}
if (!item) {
@@ -72,7 +81,7 @@
"GainCommand only works with
ContextItem objects!!");
return 0;
}
- return new Gain(item, arguments);
+ return new Gain(item, songview, arguments);
}
case TrackPanCommand:
Index: src/traverso/songcanvas/SongView.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/traverso/songcanvas/SongView.cpp,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -b -r1.90 -r1.91
--- src/traverso/songcanvas/SongView.cpp 27 Nov 2007 18:27:31 -0000
1.90
+++ src/traverso/songcanvas/SongView.cpp 27 Nov 2007 20:20:42 -0000
1.91
@@ -272,9 +272,21 @@
void SongView::hscrollbar_value_changed(int value)
{
- if (!ie().is_holding()) {
+ // This slot is called when the hscrollbar value changes,
+ // which can be due shuttling.
+ // In that very case, we do NOT set the hscrollbar value AGAIN
+ // but in case of a non-shuttle command, we call ie().jog to give the
+ // command the opportunity to update itself for the changed
+ // viewport / mouse coordinates.
+ if (ie().is_holding()) {
+ Shuttle* s = dynamic_cast<Shuttle*>(ie().get_holding_command());
+ if (!s) {
+ ie().jog();
+ }
+ } else {
m_clipsViewPort->horizontalScrollBar()->setValue(value);
}
+
set_snap_range(m_hScrollBar->value());
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso resources/keymap.xml src/commands/Gain...,
Remon Sijrier <=