Split AutomationTrack and AutomationTrackView into separate files (#5983)
Also fixes a newline in AutomationTrackView that codefactor complained about.
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
#define AUTOMATION_TRACK_H
|
||||
|
||||
#include "Track.h"
|
||||
#include "TrackView.h"
|
||||
|
||||
|
||||
class AutomationTrack : public Track
|
||||
@@ -59,17 +58,4 @@ private:
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
class AutomationTrackView : public TrackView
|
||||
{
|
||||
public:
|
||||
AutomationTrackView( AutomationTrack* at, TrackContainerView* tcv );
|
||||
virtual ~AutomationTrackView() = default;
|
||||
|
||||
void dragEnterEvent( QDragEnterEvent * _dee ) override;
|
||||
void dropEvent( QDropEvent * _de ) override;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
44
include/AutomationTrackView.h
Normal file
44
include/AutomationTrackView.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* AutomationTrackView.h - declaration of class AutomationTrackView
|
||||
*
|
||||
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AUTOMATION_TRACK_VIEW_H
|
||||
#define AUTOMATION_TRACK_VIEW_H
|
||||
|
||||
#include "AutomationTrack.h"
|
||||
#include "TrackView.h"
|
||||
|
||||
|
||||
class AutomationTrackView : public TrackView
|
||||
{
|
||||
public:
|
||||
AutomationTrackView( AutomationTrack* at, TrackContainerView* tcv );
|
||||
virtual ~AutomationTrackView() = default;
|
||||
|
||||
void dragEnterEvent( QDragEnterEvent * _dee ) override;
|
||||
void dropEvent( QDropEvent * _de ) override;
|
||||
} ;
|
||||
|
||||
|
||||
#endif
|
||||
88
src/gui/AutomationTrackView.cpp
Normal file
88
src/gui/AutomationTrackView.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* AutomationTrackView.cpp
|
||||
*
|
||||
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2006-2008 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of LMMS - https://lmms.io
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AutomationTrackView.h"
|
||||
|
||||
#include "AutomationPattern.h"
|
||||
#include "embed.h"
|
||||
#include "Engine.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "StringPairDrag.h"
|
||||
#include "TrackContainerView.h"
|
||||
#include "TrackLabelButton.h"
|
||||
|
||||
|
||||
AutomationTrackView::AutomationTrackView( AutomationTrack * _at, TrackContainerView* tcv ) :
|
||||
TrackView( _at, tcv )
|
||||
{
|
||||
setFixedHeight( 32 );
|
||||
TrackLabelButton * tlb = new TrackLabelButton( this,
|
||||
getTrackSettingsWidget() );
|
||||
tlb->setIcon( embed::getIconPixmap( "automation_track" ) );
|
||||
tlb->move( 3, 1 );
|
||||
tlb->show();
|
||||
setModel( _at );
|
||||
}
|
||||
|
||||
void AutomationTrackView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
StringPairDrag::processDragEnterEvent( _dee, "automatable_model" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void AutomationTrackView::dropEvent( QDropEvent * _de )
|
||||
{
|
||||
QString type = StringPairDrag::decodeKey( _de );
|
||||
QString val = StringPairDrag::decodeValue( _de );
|
||||
if( type == "automatable_model" )
|
||||
{
|
||||
AutomatableModel * mod = dynamic_cast<AutomatableModel *>(
|
||||
Engine::projectJournal()->
|
||||
journallingObject( val.toInt() ) );
|
||||
if( mod != NULL )
|
||||
{
|
||||
TimePos pos = TimePos( trackContainerView()->
|
||||
currentPosition() +
|
||||
( _de->pos().x() -
|
||||
getTrackContentWidget()->x() ) *
|
||||
TimePos::ticksPerBar() /
|
||||
static_cast<int>( trackContainerView()->pixelsPerBar() ) )
|
||||
.toAbsoluteBar();
|
||||
|
||||
if( pos.getTicks() < 0 )
|
||||
{
|
||||
pos.setTicks( 0 );
|
||||
}
|
||||
|
||||
TrackContentObject * tco = getTrack()->createTCO( pos );
|
||||
AutomationPattern * pat = dynamic_cast<AutomationPattern *>( tco );
|
||||
pat->addObject( mod );
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
@@ -6,6 +6,7 @@ SET(LMMS_SRCS
|
||||
gui/AudioDeviceSetupWidget.cpp
|
||||
gui/AutomatableModelView.cpp
|
||||
gui/AutomationPatternView.cpp
|
||||
gui/AutomationTrackView.cpp
|
||||
gui/ControllerConnectionDialog.cpp
|
||||
gui/ControllerDialog.cpp
|
||||
gui/EffectControlDialog.cpp
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <QCheckBox>
|
||||
|
||||
#include "AutomationPattern.h"
|
||||
#include "AutomationTrack.h"
|
||||
#include "AutomationTrackView.h"
|
||||
#include "ColorChooser.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "DataFile.h"
|
||||
|
||||
@@ -24,14 +24,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AutomationTrack.h"
|
||||
#include "AutomationTrackView.h"
|
||||
#include "AutomationPattern.h"
|
||||
#include "Engine.h"
|
||||
#include "embed.h"
|
||||
#include "ProjectJournal.h"
|
||||
#include "StringPairDrag.h"
|
||||
#include "TrackContainerView.h"
|
||||
#include "TrackLabelButton.h"
|
||||
|
||||
|
||||
AutomationTrack::AutomationTrack( TrackContainer* tc, bool _hidden ) :
|
||||
@@ -82,63 +76,4 @@ void AutomationTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
{
|
||||
setMuted( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AutomationTrackView::AutomationTrackView( AutomationTrack * _at, TrackContainerView* tcv ) :
|
||||
TrackView( _at, tcv )
|
||||
{
|
||||
setFixedHeight( 32 );
|
||||
TrackLabelButton * tlb = new TrackLabelButton( this,
|
||||
getTrackSettingsWidget() );
|
||||
tlb->setIcon( embed::getIconPixmap( "automation_track" ) );
|
||||
tlb->move( 3, 1 );
|
||||
tlb->show();
|
||||
setModel( _at );
|
||||
}
|
||||
|
||||
void AutomationTrackView::dragEnterEvent( QDragEnterEvent * _dee )
|
||||
{
|
||||
StringPairDrag::processDragEnterEvent( _dee, "automatable_model" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void AutomationTrackView::dropEvent( QDropEvent * _de )
|
||||
{
|
||||
QString type = StringPairDrag::decodeKey( _de );
|
||||
QString val = StringPairDrag::decodeValue( _de );
|
||||
if( type == "automatable_model" )
|
||||
{
|
||||
AutomatableModel * mod = dynamic_cast<AutomatableModel *>(
|
||||
Engine::projectJournal()->
|
||||
journallingObject( val.toInt() ) );
|
||||
if( mod != NULL )
|
||||
{
|
||||
TimePos pos = TimePos( trackContainerView()->
|
||||
currentPosition() +
|
||||
( _de->pos().x() -
|
||||
getTrackContentWidget()->x() ) *
|
||||
TimePos::ticksPerBar() /
|
||||
static_cast<int>( trackContainerView()->pixelsPerBar() ) )
|
||||
.toAbsoluteBar();
|
||||
|
||||
if( pos.getTicks() < 0 )
|
||||
{
|
||||
pos.setTicks( 0 );
|
||||
}
|
||||
|
||||
TrackContentObject * tco = getTrack()->createTCO( pos );
|
||||
AutomationPattern * pat = dynamic_cast<AutomationPattern *>( tco );
|
||||
pat->addObject( mod );
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user