Various SongEditor fixes and updated file headers

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@2060 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Paul Giblock
2009-02-20 06:17:01 +00:00
parent c5571651df
commit 0bdeca5b54
13 changed files with 424 additions and 177 deletions

View File

@@ -1,3 +1,21 @@
2009-02-20 Paul Giblock <drfaygo/at/gmail/dot/com>
* include/gui/tracks/pattern_item.h:
* include/gui/tracks/track_content_object_item.h:
* include/gui/tracks/track_item.h:
* include/gui/tracks/track_container_scene.h:
* include/gui/tracks/bb_tco_item.h:
* src/gui/classic_style.cpp:
* src/gui/tracks/track_content_object_item.cpp:
* src/gui/tracks/track_item.cpp:
* src/gui/tracks/track_container_scene.cpp:
* src/gui/tracks/bb_tco_item.cpp:
* src/gui/tracks/pattern_item.cpp:
Fix File headers
* src/gui/cusis_style.cpp:
Fix cache collision bug
2009-02-19 Paul Giblock <drfaygo/at/gmail/dot/com>
* include/track.h:

View File

@@ -1,3 +1,28 @@
/*
* bb_tco_item.h - Beat & Bassline QGraphicsItem used in the song editor
*
* 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 _BB_TCO_ITEM_H_
#define _BB_TCO_ITEM_H_

View File

@@ -1,3 +1,28 @@
/*
* pattern_item.h - Pattern QGraphicsItem used in the song editor
*
* 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 _PATTERN_ITEM_H_
#define _PATTERN_ITEM_H_

View File

@@ -1,5 +1,6 @@
/*
* track_container_scene.h - view-component for trackContainer
* track_container_scene.cpp - A TrackContainer is represented in the
* SongEditor as the GraphicsScene. This is it.
*
* Copyright (c) 2009 Paul Giblock <pgib/at/users.sourceforge.net>
*

View File

@@ -1,3 +1,28 @@
/*
* track_content_object_item.h - the base-class for TCOs on the song Editor.
*
* 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_CONTENT_OBJECT_ITEM_H_
#define TRACK_CONTENT_OBJECT_ITEM_H_

View File

@@ -1,3 +1,28 @@
/*
* track_content_object_item.cpp - the base-class for TCOs on the song Editor.
* Despite the name, it really isn't a GraphicsItem at all.
*
* 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_ITEM_H_

View File

@@ -1,8 +1,7 @@
/*
* lmms_style.cpp - the graphical style used by LMMS to create a consistent
* interface
* classic_style.cpp - the graphical style used by LMMS for original look&feel
*
* Copyright (c) 2007-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2009 Paul Giblock <pgib/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -399,7 +398,7 @@ void ClassicStyle::drawTrackContentObject( QPainter * _painter,
}
else if( const pattern * pat = dynamic_cast<const pattern *>( _model ) )
else
{
QPainter * p = _painter;
QLinearGradient lingrad( 0, 0, 0, rc.height() );
@@ -420,197 +419,201 @@ void ClassicStyle::drawTrackContentObject( QPainter * _painter,
const float ppt = TrackContainerScene::DEFAULT_CELL_WIDTH;
const float TCO_BORDER_WIDTH = 1.0f;
/*
const float ppt;
if( fixedTCOs() )
{
ppt = ( parentWidget()->width() - 2 * TCO_BORDER_WIDTH )
/ (float) m_pat->length().getTact();
}
else
{
pixelsPerTact();
}
*/
const float x_base = TCO_BORDER_WIDTH + rc.top();
p->setPen( QColor( 0, 0, 0 ) );
for( tact t = 1; t < pat->length().getTact(); ++t )
if( const pattern * pat = dynamic_cast<const pattern *>( _model ) )
{
p->drawLine( x_base + static_cast<int>( ppt * t ) - 1,
TCO_BORDER_WIDTH, x_base + static_cast<int>(
ppt * t ) - 1, 5 );
p->drawLine( x_base + static_cast<int>( ppt * t ) - 1,
rc.height() - ( 4 + 2 * TCO_BORDER_WIDTH ),
x_base + static_cast<int>( ppt * t ) - 1,
rc.height() - 2 * TCO_BORDER_WIDTH );
}
if( pat->type() == pattern::MelodyPattern )
{
int central_key = 0;
p->setClipRect( rc.adjusted( 1, 1, -1, -1 ) );
if( pat->notes().size() > 0 )
/*
const float ppt;
if( fixedTCOs() )
{
// first determine the central tone so that we can
// display the area where most of the notes are
int total_notes = 0;
for( noteVector::const_iterator it = pat->notes().begin();
it != pat->notes().end(); ++it )
ppt = ( parentWidget()->width() - 2 * TCO_BORDER_WIDTH )
/ (float) m_pat->length().getTact();
}
else
{
pixelsPerTact();
}
*/
const float x_base = TCO_BORDER_WIDTH + rc.top();
p->setPen( QColor( 0, 0, 0 ) );
for( tact t = 1; t < pat->length().getTact(); ++t )
{
p->drawLine( x_base + static_cast<int>( ppt * t ) - 1,
TCO_BORDER_WIDTH, x_base + static_cast<int>(
ppt * t ) - 1, 5 );
p->drawLine( x_base + static_cast<int>( ppt * t ) - 1,
rc.height() - ( 4 + 2 * TCO_BORDER_WIDTH ),
x_base + static_cast<int>( ppt * t ) - 1,
rc.height() - 2 * TCO_BORDER_WIDTH );
}
if( pat->type() == pattern::MelodyPattern )
{
int central_key = 0;
p->setClipRect( rc.adjusted( 1, 1, -1, -1 ) );
if( pat->notes().size() > 0 )
{
if( ( *it )->length() > 0 )
// first determine the central tone so that we can
// display the area where most of the notes are
int total_notes = 0;
for( noteVector::const_iterator it = pat->notes().begin();
it != pat->notes().end(); ++it )
{
central_key += ( *it )->key();
++total_notes;
}
}
if( total_notes > 0 )
{
p->setRenderHint( QPainter::Antialiasing, false );
central_key = central_key / total_notes;
const float central_y = rc.height() / 2.0f;
float y_base = central_y + TCO_BORDER_WIDTH - 1.0f;
if( pat->getTrack()->isMuted() ||
pat->isMuted() )
{
p->setPen( color( LmmsStyle::PianoRollMutedNote ) );
}
else if( pat->frozen() )
{
p->setPen( color( LmmsStyle::PianoRollFrozenNote ) );
}
else
{
p->setPen( color( LmmsStyle::PianoRollDefaultNote ) );
}
for( noteVector::const_iterator it =
pat->notes().begin();
it != pat->notes().end(); ++it )
{
const float y_pos = central_key -
( *it )->key();
if( ( *it )->length() > 0 &&
y_pos > -central_y &&
y_pos < central_y )
if( ( *it )->length() > 0 )
{
const float x1 = 2 * x_base +
( *it )->pos() * ppt /
midiTime::ticksPerTact();
const float x2 =
( ( *it )->pos() + ( *it )->length() ) *
ppt / midiTime::ticksPerTact();
p->drawLine( x1, y_base + y_pos,
x2, y_base + y_pos );
central_key += ( *it )->key();
++total_notes;
}
}
p->setRenderHint( QPainter::Antialiasing, true );
if( total_notes > 0 )
{
p->setRenderHint( QPainter::Antialiasing, false );
central_key = central_key / total_notes;
const float central_y = rc.height() / 2.0f;
float y_base = central_y + TCO_BORDER_WIDTH - 1.0f;
if( pat->getTrack()->isMuted() ||
pat->isMuted() )
{
p->setPen( color( LmmsStyle::PianoRollMutedNote ) );
}
else if( pat->frozen() )
{
p->setPen( color( LmmsStyle::PianoRollFrozenNote ) );
}
else
{
p->setPen( color( LmmsStyle::PianoRollDefaultNote ) );
}
for( noteVector::const_iterator it =
pat->notes().begin();
it != pat->notes().end(); ++it )
{
const float y_pos = central_key -
( *it )->key();
if( ( *it )->length() > 0 &&
y_pos > -central_y &&
y_pos < central_y )
{
const float x1 = 2 * x_base +
( *it )->pos() * ppt /
midiTime::ticksPerTact();
const float x2 =
( ( *it )->pos() + ( *it )->length() ) *
ppt / midiTime::ticksPerTact();
p->drawLine( x1, y_base + y_pos,
x2, y_base + y_pos );
}
}
p->setRenderHint( QPainter::Antialiasing, true );
}
}
p->setClipping( false );
}
}
/*
else if( pat->type() == pattern::BeatPattern &&
( fixedTCOs() ||
ppt >= 96 ||
pat->m_steps != midiTime::stepsPerTact() ) )
{
QPixmap stepon;
QPixmap stepoverlay;
QPixmap stepoff;
QPixmap stepoffl;
const int steps = m_pat->length() / DefaultBeatsPerTact;
const int w = width() - 2 * TCO_BORDER_WIDTH;
stepon = s_stepBtnOn->scaled( w / steps,
s_stepBtnOn->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
stepoverlay = s_stepBtnOverlay->scaled( w / steps,
s_stepBtnOn->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
stepoff = s_stepBtnOff->scaled( w / steps,
s_stepBtnOff->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
stepoffl = s_stepBtnOffLight->scaled( w / steps,
s_stepBtnOffLight->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
for( noteVector::iterator it = m_pat->m_notes.begin();
it != m_pat->m_notes.end(); ++it )
/*
else if( pat->type() == pattern::BeatPattern &&
( fixedTCOs() ||
ppt >= 96 ||
pat->m_steps != midiTime::stepsPerTact() ) )
{
const int no = ( *it )->pos() / DefaultBeatsPerTact;
const int x = TCO_BORDER_WIDTH + static_cast<int>( no *
w / steps );
const int y = height() - s_stepBtnOff->height() - 1;
QPixmap stepon;
QPixmap stepoverlay;
QPixmap stepoff;
QPixmap stepoffl;
const int steps = m_pat->length() / DefaultBeatsPerTact;
const int w = width() - 2 * TCO_BORDER_WIDTH;
stepon = s_stepBtnOn->scaled( w / steps,
s_stepBtnOn->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
stepoverlay = s_stepBtnOverlay->scaled( w / steps,
s_stepBtnOn->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
stepoff = s_stepBtnOff->scaled( w / steps,
s_stepBtnOff->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
stepoffl = s_stepBtnOffLight->scaled( w / steps,
s_stepBtnOffLight->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
for( noteVector::iterator it = m_pat->m_notes.begin();
it != m_pat->m_notes.end(); ++it )
{
const int no = ( *it )->pos() / DefaultBeatsPerTact;
const int x = TCO_BORDER_WIDTH + static_cast<int>( no *
w / steps );
const int y = height() - s_stepBtnOff->height() - 1;
const int vol = ( *it )->getVolume();
const int vol = ( *it )->getVolume();
if( ( *it )->length() < 0 )
{
p.drawPixmap( x, y, stepoff );
for( int i = 0; i < vol / 5 + 1; ++i )
if( ( *it )->length() < 0 )
{
p.drawPixmap( x, y, stepon );
p.drawPixmap( x, y, stepoff );
for( int i = 0; i < vol / 5 + 1; ++i )
{
p.drawPixmap( x, y, stepon );
}
for( int i = 0; i < ( 25 + ( vol - 75 ) ) / 5;
++i )
{
p.drawPixmap( x, y, stepoverlay );
}
}
for( int i = 0; i < ( 25 + ( vol - 75 ) ) / 5;
++i )
else if( ( no / 4 ) % 2 )
{
p.drawPixmap( x, y, stepoverlay );
p.drawPixmap( x, y, stepoff );
}
else
{
p.drawPixmap( x, y, stepoffl );
}
}
else if( ( no / 4 ) % 2 )
{
p.drawPixmap( x, y, stepoff );
}
else
{
p.drawPixmap( x, y, stepoffl );
}
}
}
END BEAT TRACK */
END BEAT TRACK */
p->setFont( pointSize<7>( p->font() ) );
if( pat->isMuted() || pat->getTrack()->isMuted() )
{
p->setPen( QColor( 192, 192, 192 ) );
}
else
{
p->setPen( QColor( 32, 240, 32 ) );
}
p->setFont( pointSize<7>( p->font() ) );
if( pat->isMuted() || pat->getTrack()->isMuted() )
{
p->setPen( QColor( 192, 192, 192 ) );
}
else
{
p->setPen( QColor( 32, 240, 32 ) );
}
if( pat->name() != pat->getInstrumentTrack()->name() )
{
p->drawText( 2, p->fontMetrics().height() - 1, pat->name() );
}
if( pat->name() != pat->getInstrumentTrack()->name() )
{
p->drawText( 2, p->fontMetrics().height() - 1, pat->name() );
}
if( pat->isMuted() )
{
p->drawPixmap( 3, p->fontMetrics().height() + 1,
embed::getIconPixmap( "muted", 16, 16 ) );
}
else if( pat->frozen() )
{
p->setBrush( QBrush() );
p->setPen( QColor( 0, 224, 255 ) );
p->drawRect( rc );
/* TODO:
p->drawPixmap( rc.left() + 3,
rc.top() + height() - s_frozen->height() - 4,
*s_frozen );
*/
}
if( pat->isMuted() )
{
p->drawPixmap( 3, p->fontMetrics().height() + 1,
embed::getIconPixmap( "muted", 16, 16 ) );
}
else if( pat->frozen() )
{
p->setBrush( QBrush() );
p->setPen( QColor( 0, 224, 255 ) );
p->drawRect( rc );
/* TODO:
p->drawPixmap( rc.left() + 3,
rc.top() + height() - s_frozen->height() - 4,
*s_frozen );
*/
}
p->setClipping( false );
}
}
}

View File

@@ -224,14 +224,13 @@ static QString getTcoCacheKey( const QString & _key,
const LmmsStyleOptionTCO * _option )
{
QString tmp;
tmp.sprintf( "%s,%d,%d,%d,%s,%.3fx%.3f",
tmp.sprintf( "%s,%d,%d,%s,%.2fx%.2f",
_key.toLatin1().constData(),
_option->type,
_option->selected,
_option->hovered,
_option->type | ( _option->selected << 4 ) | ( _option->hovered << 5 ),
_option->duration,
_option->userColor.name().constData(),
_option->rect.width(),
_option->rect.height() );
_option->rect.height());
return tmp;
}

View File

@@ -1,3 +1,28 @@
/*
* bb_tco_item.h - Beat-and-bassline QGraphicsItem used in the song editor
*
* 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.
*
*/
#include <QObject>
#include <QGraphicsItem>
#include <QTimeLine>

View File

@@ -1,3 +1,28 @@
/*
* pattern_item.cpp - Pattern QGraphicsItem used in the song editor
*
* 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.
*
*/
#include <QObject>
#include <QGraphicsItem>
#include <QTimeLine>

View File

@@ -1,3 +1,29 @@
/*
* track_container_scene.cpp - A TrackContainer is represented in the
* SongEditor as the GraphicsScene. This is the implementation.
*
* 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.
*
*/
#include <QGraphicsScene>
#include <QKeyEvent>
#include <QTimeLine>

View File

@@ -1,3 +1,28 @@
/*
* track_content_object_item.cpp - the base-class for TCOs on the song Editor.
*
* 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.
*
*/
#include <QObject>
#include <QGraphicsItem>
#include <QTimeLine>

View File

@@ -1,3 +1,28 @@
/*
* track_content_object_item.cpp - the base-class for TCOs on the song Editor.
* Despite the name, it really isn't a GraphicsItem at all.
*
* 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.
*
*/
#include "track.h"
#include "gui/tracks/track_item.h"