From 1053696ada1f297bb52357f4fc79ab186360694e Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Thu, 29 Jan 2009 04:03:33 +0000 Subject: [PATCH] Pattern colors styleable git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1988 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 9 +++++++++ include/lmms_style.h | 2 ++ src/gui/classic_style.cpp | 4 +++- src/gui/cusis_style.cpp | 3 +++ src/tracks/pattern.cpp | 21 +++++++++++---------- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4bc9cfb2b..9d923b395 100644 --- a/ChangeLog +++ b/ChangeLog @@ -75,6 +75,15 @@ * data/themes/cusis/controller_bg.png: Add Cusis-theme artwork + * data/themes/cusis/theme.xml: + * data/themes/default/theme.xml: + * src/core/main.cpp: + - Add xml files for specifying styles and optional parameters + - However, we pick the class based on artworkDir path for now... + + * src/tracks/pattern.cpp: + More widgets customized + 2009-01-26 Paul Giblock * src/tracks/bb_track.cpp: diff --git a/include/lmms_style.h b/include/lmms_style.h index a46a5c0b0..c7eba434e 100644 --- a/include/lmms_style.h +++ b/include/lmms_style.h @@ -44,6 +44,8 @@ public: PianoRollStepNote, PianoRollSelectedNote, PianoRollDefaultNote, + PianoRollFrozenNote, + PianoRollMutedNote, PianoRollEditHandle, PianoRollVolumeLevel, PianoRollPanningLevel, diff --git a/src/gui/classic_style.cpp b/src/gui/classic_style.cpp index fbdd162e1..4b22533f0 100644 --- a/src/gui/classic_style.cpp +++ b/src/gui/classic_style.cpp @@ -48,7 +48,9 @@ ClassicStyle::ClassicStyle() : colors[AutomationBarValue] = QColor( 0xFF, 0xDF, 0x20 ); colors[AutomationSelectedBarFill] = QColor( 0x00, 0x40, 0xC0 ); colors[AutomationCrosshair] = QColor( 0xFF, 0x33, 0x33 ); - colors[PianoRollDefaultNote] = QColor( 0x00, 0xAA, 0x00 ); + colors[PianoRollDefaultNote] = QColor( 0x00, 0xAA, 0x00 ); // 0.3.x: QColor( 0x99, 0xff, 0x00 ) + colors[PianoRollFrozenNote] = QColor( 0x00, 0xE0, 0xFF ); + colors[PianoRollMutedNote] = QColor( 160, 160, 160 ); colors[PianoRollStepNote] = QColor( 0x00, 0xFF, 0x00 ); colors[PianoRollSelectedNote] = QColor( 0x00, 0x40, 0xC0 ); colors[PianoRollEditHandle] = QColor( 0xEA, 0xA1, 0x00 ); diff --git a/src/gui/cusis_style.cpp b/src/gui/cusis_style.cpp index 37ac91564..82d4634a5 100644 --- a/src/gui/cusis_style.cpp +++ b/src/gui/cusis_style.cpp @@ -144,7 +144,10 @@ CusisStyle::CusisStyle() : m_colors[AutomationBarValue] = QColor( 0xFF, 0xF7, 0x33 ); m_colors[AutomationSelectedBarFill] = QColor( 0x00, 0x99, 0xFF ); m_colors[AutomationCrosshair] = QColor( 0xFF, 0x33, 0x33 ); + m_colors[PianoRollDefaultNote] = QColor( 0x99, 0xff, 0x00 ); // or 00 ff 99 + m_colors[PianoRollFrozenNote] = QColor( 0x00, 0xE0, 0xFF ); + m_colors[PianoRollMutedNote] = QColor( 160, 160, 160 ); m_colors[PianoRollStepNote] = QColor( 0xff, 0x99, 0x00 ); m_colors[PianoRollSelectedNote] = QColor( 0x00, 0x99, 0xff ); m_colors[PianoRollEditHandle] = QColor( 0xff, 0x99, 0x33 ); diff --git a/src/tracks/pattern.cpp b/src/tracks/pattern.cpp index ddc54e109..a8f5061b3 100644 --- a/src/tracks/pattern.cpp +++ b/src/tracks/pattern.cpp @@ -5,7 +5,7 @@ * * Copyright (c) 2004-2008 Tobias Doerffel * Copyright (c) 2005-2007 Danny McRae - * + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -210,9 +210,9 @@ note * pattern::addNote( const note & _new_note, const bool _quant_pos ) } else { - // simple algorithm for inserting the note between two + // simple algorithm for inserting the note between two // notes with smaller and greater position - // maybe it could be optimized by starting in the middle and + // maybe it could be optimized by starting in the middle and // going forward or backward but note-inserting isn't that // time-critical since it is usually not done while playing... long new_note_abs_time = new_note->pos(); @@ -271,7 +271,7 @@ void pattern::removeNote( const note * _note_to_del ) note * pattern::rearrangeNote( const note * _note_to_proc, const bool _quant_pos ) { - // just rearrange the position of the note by removing it and adding + // just rearrange the position of the note by removing it and adding // a copy of it -> addNote inserts it at the correct position note copy_of_note( *_note_to_proc ); removeNote( _note_to_proc ); @@ -283,7 +283,7 @@ note * pattern::rearrangeNote( const note * _note_to_proc, void pattern::rearrangeAllNotes( void ) { - // sort notes by start time + // sort notes by start time qSort(m_notes.begin(), m_notes.end(), note::lessThan ); } @@ -1084,7 +1084,7 @@ void patternView::wheelEvent( QWheelEvent * _we ) } note * n = m_pat->m_notes[step]; int vol = n->getVolume(); - + if( n->length() == 0 && _we->delta() > 0 ) { n->setLength( -DefaultTicksPerTact ); @@ -1181,7 +1181,7 @@ void patternView::paintEvent( QPaintEvent * ) int central_key = 0; if( m_pat->m_notes.size() > 0 ) { - // first determine the central tone so that we can + // first determine the central tone so that we can // display the area where most of the m_notes are int total_notes = 0; for( noteVector::iterator it = m_pat->m_notes.begin(); @@ -1201,18 +1201,19 @@ void patternView::paintEvent( QPaintEvent * ) const int central_y = height() / 2; int y_base = central_y + TCO_BORDER_WIDTH -1; + LmmsStyle * lStyle = engine::getLmmsStyle(); if( m_pat->getTrack()->isMuted() || m_pat->isMuted() ) { - p.setPen( QColor( 160, 160, 160 ) ); + p.setPen( lStyle->color(LmmsStyle::PianoRollMutedNote) ); } else if( m_pat->m_frozenPattern != NULL ) { - p.setPen( QColor( 0x00, 0xE0, 0xFF ) ); + p.setPen( lStyle->color(LmmsStyle::PianoRollFrozenNote) ); } else { - p.setPen( QColor( 0xFF, 0xB0, 0x00 ) ); + p.setPen( lStyle->color(LmmsStyle::PianoRollDefaultNote) ); } for( noteVector::iterator it =