Intial version of new song-editor, more of a viewer right now
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@2013 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
122
include/gui/tracks/track_container_scene.h
Normal file
122
include/gui/tracks/track_container_scene.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* track_container_scene.h - view-component for trackContainer
|
||||
*
|
||||
* Copyright (c) 2009 Paul Giblock <pgib/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* 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 _TRACK_CONTAINER_SCENE_H
|
||||
#define _TRACK_CONTAINER_SCENE_H
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QGraphicsScene>
|
||||
|
||||
#include "track.h"
|
||||
|
||||
class trackContainer;
|
||||
class TrackContentObjectItem;
|
||||
class TrackItem;
|
||||
|
||||
class TrackContainerScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
const static float DEFAULT_CELL_HEIGHT = 32;
|
||||
const static float DEFAULT_CELL_WIDTH = 16;
|
||||
|
||||
TrackContainerScene( QObject * parent, trackContainer * _tc );
|
||||
virtual ~TrackContainerScene();
|
||||
|
||||
|
||||
inline const midiTime & currentPosition( void ) const
|
||||
{
|
||||
return( m_currentPosition );
|
||||
}
|
||||
|
||||
inline float pixelsPerTact( void ) const
|
||||
{
|
||||
return( m_ppt );
|
||||
}
|
||||
|
||||
|
||||
void setPixelsPerTact( float _ppt );
|
||||
|
||||
trackContainer * model( void )
|
||||
{
|
||||
return( m_trackContainer );
|
||||
}
|
||||
|
||||
const trackContainer * model( void ) const
|
||||
{
|
||||
return( m_trackContainer );
|
||||
}
|
||||
|
||||
|
||||
virtual QString nodeName( void ) const
|
||||
{
|
||||
return( "trackcontainerscene" );
|
||||
}
|
||||
|
||||
private slots:
|
||||
|
||||
void addTrack( track * _t );
|
||||
void removeTrack( track * _t );
|
||||
|
||||
/*
|
||||
virtual void dragEnterEvent( QDragEnterEvent * _dee );
|
||||
virtual void dropEvent( QDropEvent * _de );
|
||||
virtual void mousePressEvent( QMouseEvent * _me );
|
||||
virtual void mouseMoveEvent( QMouseEvent * _me );
|
||||
virtual void mouseReleaseEvent( QMouseEvent * _me );
|
||||
virtual void resizeEvent( QResizeEvent * );
|
||||
virtual void undoStep( journalEntry & _je );
|
||||
virtual void redoStep( journalEntry & _je );
|
||||
*/
|
||||
|
||||
protected:
|
||||
midiTime m_currentPosition;
|
||||
trackContainer * m_trackContainer;
|
||||
float m_ppt;
|
||||
|
||||
//QVector<TrackContentItem*> m_trackItems;
|
||||
QMap<track*, TrackItem*> m_trackItems;
|
||||
|
||||
virtual void keyPressEvent( QKeyEvent * event );
|
||||
|
||||
private:
|
||||
/*
|
||||
enum Actions
|
||||
{
|
||||
AddTrack,
|
||||
RemoveTrack
|
||||
} ;*/
|
||||
|
||||
|
||||
//signals:
|
||||
//void positionChanged( const midiTime & _pos );
|
||||
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
64
include/gui/tracks/track_content_object_item.h
Normal file
64
include/gui/tracks/track_content_object_item.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#ifndef TRACK_CONTENT_OBJECT_ITEM_H_
|
||||
#define TRACK_CONTENT_OBJECT_ITEM_H_
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsItem>
|
||||
#include <QTimeLine>
|
||||
#include <QGraphicsItemAnimation>
|
||||
#include <QPainter>
|
||||
#include <math.h>
|
||||
|
||||
class trackContentObject;
|
||||
class TrackItem;
|
||||
|
||||
class TrackContentObjectItem : public QObject, public QGraphicsItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class TrackContainerScene;
|
||||
|
||||
public:
|
||||
TrackContentObjectItem( TrackItem * _track, trackContentObject * _object );
|
||||
|
||||
virtual ~TrackContentObjectItem()
|
||||
{
|
||||
if( m_snapBackAnimation != NULL )
|
||||
{
|
||||
delete m_snapBackAnimation;
|
||||
}
|
||||
};
|
||||
|
||||
QRectF boundingRect() const;
|
||||
|
||||
void paint( QPainter * _painter, const QStyleOptionGraphicsItem * _option,
|
||||
QWidget * _widget );
|
||||
|
||||
QVariant itemChange( GraphicsItemChange _change, const QVariant & _value );
|
||||
|
||||
|
||||
virtual qreal zValue() const;
|
||||
|
||||
// For TrackItem to call
|
||||
void updateGeometry();
|
||||
|
||||
protected:
|
||||
void prepareSnapBackAnimation( QTimeLine * timeLine );
|
||||
void prepareSnapBackAnimation( QTimeLine * timeLine, int newX );
|
||||
|
||||
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event );
|
||||
virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent * event );
|
||||
virtual void hoverEnterEvent( QGraphicsSceneHoverEvent * event );
|
||||
virtual void hoverLeaveEvent( QGraphicsSceneHoverEvent * event );
|
||||
|
||||
protected:
|
||||
QPointF m_lastPos;
|
||||
QPointF m_lastDest;
|
||||
QGraphicsItemAnimation * m_snapBackAnimation;
|
||||
static QTimeLine s_snapBackTimeLine;
|
||||
|
||||
TrackItem * m_trackItem;
|
||||
trackContentObject * m_tco;
|
||||
};
|
||||
|
||||
#endif
|
||||
47
include/gui/tracks/track_item.h
Normal file
47
include/gui/tracks/track_item.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* track_item.h
|
||||
*
|
||||
* Created on: Jan 27, 2009
|
||||
* Author: llama
|
||||
*/
|
||||
|
||||
#ifndef TRACK_ITEM_H_
|
||||
#define TRACK_ITEM_H_
|
||||
|
||||
#include <QObject>
|
||||
#include <QRectF>
|
||||
#include <QMap>
|
||||
|
||||
class TrackContainerScene;
|
||||
class track;
|
||||
class trackContentObject;
|
||||
class TrackContentObjectItem;
|
||||
|
||||
class TrackItem : public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
TrackItem( TrackContainerScene * _scene, track * _track );
|
||||
virtual ~TrackItem( );
|
||||
|
||||
float height();
|
||||
void setHeight( float _height );
|
||||
|
||||
float y();
|
||||
void setY( float _x );
|
||||
|
||||
private slots:
|
||||
void addTCO( trackContentObject * _tco );
|
||||
void removeTCO( trackContentObject * _tco );
|
||||
|
||||
private:
|
||||
QRectF m_rect;
|
||||
|
||||
TrackContainerScene * m_scene;
|
||||
track * m_track;
|
||||
QMap<trackContentObject*, TrackContentObjectItem *> m_tcoItems;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /* TRACK_ITEM_H_ */
|
||||
@@ -63,7 +63,7 @@ const int TCO_BORDER_WIDTH = 1;
|
||||
class trackContentObject : public model, public journallingObject
|
||||
{
|
||||
Q_OBJECT
|
||||
mapPropertyFromModel(bool,isMuted,setMuted,m_mutedModel);
|
||||
mapPropertyFromModel( bool, isMuted, setMuted, m_mutedModel);
|
||||
public:
|
||||
trackContentObject( track * _track );
|
||||
virtual ~trackContentObject();
|
||||
@@ -463,6 +463,7 @@ signals:
|
||||
void destroyedTrack( void );
|
||||
void nameChanged( void );
|
||||
void trackContentObjectAdded( trackContentObject * );
|
||||
void trackContentObjectRemoved( trackContentObject * );
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ public:
|
||||
|
||||
signals:
|
||||
void trackAdded( track * _track );
|
||||
void trackRemoved( track * _track );
|
||||
|
||||
protected:
|
||||
mutable QReadWriteLock m_tracksMutex;
|
||||
|
||||
Reference in New Issue
Block a user