From 32a3b7cf23456016e6ae15d599e7ae44f449d8af Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 25 Feb 2008 11:37:21 +0000 Subject: [PATCH] made live-tool work after M/V-split git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/branches/lmms-mv@704 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 13 ++++++ include/tool.h | 2 +- plugins/live_tool/live_tool.cpp | 73 +++++++++++++++++++++------------ plugins/live_tool/live_tool.h | 27 ++++++++---- src/core/tool.cpp | 6 +-- 5 files changed, 83 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 30ce8c117..5684a63f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-02-25 Tobias Doerffel + + * include/tool.h: + * src/core/tool.cpp: + * plugins/live_tool/live_tool.h: + * plugins/live_tool/live_tool.cpp: + made live-tool work after M/V-split + + * include/track.h: + * src/core/track.cpp: + - connect track's m_mutedModel to m_muteBtn of trackOperationsWidget + - set track for m_mutedModel + 2008-02-24 Paul Giblock * plugins/bit_invader/bit_invader.cpp: diff --git a/include/tool.h b/include/tool.h index e4c0d5e9b..350994d12 100644 --- a/include/tool.h +++ b/include/tool.h @@ -49,7 +49,7 @@ public: class toolView : public pluginView { public: - toolView( tool * _tool, QWidget * _parent ); + toolView( tool * _tool ); } ; diff --git a/plugins/live_tool/live_tool.cpp b/plugins/live_tool/live_tool.cpp index 23118948d..ec2c771e1 100644 --- a/plugins/live_tool/live_tool.cpp +++ b/plugins/live_tool/live_tool.cpp @@ -30,7 +30,7 @@ #include "bb_editor.h" #include "engine.h" -#include "song_editor.h" +#include "song.h" #ifdef Q_WS_X11 @@ -62,9 +62,9 @@ plugin::descriptor live_tool_plugin_descriptor = // neccessary for getting instance out of shared lib -plugin * lmms_plugin_main( void * _data ) +plugin * lmms_plugin_main( model * _parent, void * _data ) { - return( new liveTool ); + return( new liveTool( _parent ) ); } } @@ -72,8 +72,34 @@ plugin * lmms_plugin_main( void * _data ) -liveTool::liveTool( void ) : - tool( &live_tool_plugin_descriptor ) +liveTool::liveTool( model * _parent ) : + tool( &live_tool_plugin_descriptor, _parent ) +{ +} + + + + +liveTool::~liveTool() +{ +} + + + + +QString liveTool::nodeName( void ) const +{ + return( live_tool_plugin_descriptor.name ); +} + + + + + + + +liveToolView::liveToolView( tool * _tool ) : + toolView( _tool ) { const QPixmap background = PLUGIN_NAME::getIconPixmap( "artwork" ); @@ -103,39 +129,31 @@ liveTool::liveTool( void ) : -liveTool::~liveTool() +liveToolView::~liveToolView() { } -QString liveTool::nodeName( void ) const -{ - return( live_tool_plugin_descriptor.name ); -} - - - - -void liveTool::keyPressEvent( QKeyEvent * _ke ) +void liveToolView::keyPressEvent( QKeyEvent * _ke ) { switch( _ke->key() ) { case Qt::Key_Space: - if( engine::getSongEditor()->playing() ) + if( engine::getSong()->playing() ) { - engine::getSongEditor()->pause(); + engine::getSong()->pause(); } - else if( engine::getSongEditor()->paused() && - engine::getSongEditor()->playMode() == - songEditor::PLAY_SONG ) + else if( engine::getSong()->paused() && + engine::getSong()->playMode() == + song::Mode_PlaySong ) { - engine::getSongEditor()->resumeFromPause(); + engine::getSong()->resumeFromPause(); } else { - engine::getSongEditor()->play(); + engine::getSong()->play(); } break; @@ -148,7 +166,7 @@ void liveTool::keyPressEvent( QKeyEvent * _ke ) -void liveTool::mousePressEvent( QMouseEvent * _me ) +void liveToolView::mousePressEvent( QMouseEvent * _me ) { // MDI window gets focus otherwise setFocus(); @@ -159,7 +177,7 @@ void liveTool::mousePressEvent( QMouseEvent * _me ) #ifdef Q_WS_X11 -bool liveTool::x11Event( XEvent * _xe ) +bool liveToolView::x11Event( XEvent * _xe ) { if( _xe->type == KeyPress ) { @@ -178,11 +196,11 @@ bool liveTool::x11Event( XEvent * _xe ) -void liveTool::toggleInstrument( int _n ) +void liveToolView::toggleInstrument( int _n ) { - if( _n < engine::getBBEditor()->tracks().count() ) + if( _n < engine::getBBTrackContainer()->tracks().count() ) { - track * t = engine::getBBEditor()->tracks().at( _n ); + track * t = engine::getBBTrackContainer()->tracks().at( _n ); t->setMuted( !t->muted() ); } } @@ -190,4 +208,5 @@ void liveTool::toggleInstrument( int _n ) + #include "live_tool.moc" diff --git a/plugins/live_tool/live_tool.h b/plugins/live_tool/live_tool.h index 2331c9983..b2296193e 100644 --- a/plugins/live_tool/live_tool.h +++ b/plugins/live_tool/live_tool.h @@ -31,15 +31,11 @@ - -class liveTool : public tool +class liveToolView : public toolView { - Q_OBJECT public: - liveTool( void ); - virtual ~liveTool(); - - virtual QString nodeName( void ) const; + liveToolView( tool * _tool ); + virtual ~liveToolView(); protected: @@ -58,4 +54,21 @@ private: +class liveTool : public tool +{ +public: + liveTool( model * _parent ); + virtual ~liveTool(); + + virtual QString nodeName( void ) const; + virtual pluginView * instantiateView( QWidget * ) + { + return( new liveToolView( this ) ); + } + +} ; + + + + #endif diff --git a/src/core/tool.cpp b/src/core/tool.cpp index eaf6ce80a..5b8fd8aae 100644 --- a/src/core/tool.cpp +++ b/src/core/tool.cpp @@ -3,7 +3,7 @@ /* * tool.cpp - base class for all tool plugins (graphs, extensions, etc) * - * Copyright (c) 2006-2007 Javier Serrano Polo + * Copyright (c) 2006-2008 Javier Serrano Polo * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -70,8 +70,8 @@ tool * tool::instantiate( const QString & _plugin_name, model * _parent ) -toolView::toolView( tool * _tool, QWidget * _parent ) : - pluginView( _tool, _parent ) +toolView::toolView( tool * _tool ) : + pluginView( _tool, engine::getMainWindow()->workspace() ) { QWidget * window; if( engine::getMainWindow()->workspace() )