Merge branch 'stable-0.4' into stable-0.4-new-fx-mixer

Conflicts:
	src/gui/FxMixerView.cpp
This commit is contained in:
Tobias Doerffel
2014-01-15 22:59:49 +01:00
22 changed files with 447 additions and 322 deletions

View File

@@ -282,27 +282,13 @@ ENDIF(LMMS_BUILD_LINUX OR LMMS_BUILD_APPLE)
# check for WINE
IF(WANT_VST)
INCLUDE(CheckLibraryExists)
INCLUDE(CheckIncludeFileCXX)
SET(CMAKE_REQUIRED_FLAGS_ORIG ${CMAKE_REQUIRED_FLAGS})
SET(CMAKE_REQUIRED_INCLUDES_ORIG ${CMAKE_REQUIRED_INCLUDES})
SET(CMAKE_CXX_COMPILER_ORIG ${CMAKE_CXX_COMPILER})
IF(LMMS_HOST_X86_64)
SET(CMAKE_REQUIRED_FLAGS -m32 ${CMAKE_REQUIRED_FLAGS})
ENDIF(LMMS_HOST_X86_64)
CHECK_LIBRARY_EXISTS(wine wine_init "" HAVE_LIBWINE)
SET(CMAKE_CXX_COMPILER /usr/bin/wineg++)
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${CMAKE_INSTALL_PREFIX}/include/wine/windows /usr/include/wine/windows)
CHECK_INCLUDE_FILE_CXX(windows.h HAVE_WINDOWS_H)
SET(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_ORIG})
SET(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_ORIG})
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_ORIG})
IF(HAVE_LIBWINE AND HAVE_WINDOWS_H)
FIND_PACKAGE(Wine)
IF(WINE_FOUND)
SET(LMMS_SUPPORT_VST TRUE)
SET(STATUS_VST "OK")
ELSE(HAVE_LIBWINE AND HAVE_WINDOWS_H)
ELSE(WINE_FOUND)
SET(STATUS_VST "not found, please install (lib)wine-dev (or similiar) - 64 bit systems additionally need gcc-multilib and g++-multilib")
ENDIF(HAVE_LIBWINE AND HAVE_WINDOWS_H)
ENDIF(WINE_FOUND)
ENDIF(WANT_VST)
IF(LMMS_BUILD_WIN32)
SET(LMMS_SUPPORT_VST TRUE)

View File

@@ -0,0 +1,19 @@
# - Try to find the wine libraries
# Once done this will define
#
# WINE_FOUND - System has wine
# WINE_INCLUDE_DIRS - The wine include directories
# WINE_LIBRARIES - The libraries needed to use wine
# WINE_DEFINITIONS - Compiler switches required for using wine
#
FIND_PATH(WINE_INCLUDE_DIR windows/windows.h PATH_SUFFIXES wine)
FIND_LIBRARY(WINE_LIBRARY NAMES wine)
set(WINE_INCLUDE_DIRS ${WINE_INCLUDE_DIR} )
set(WINE_LIBRARIES ${WINE_LIBRARY} )
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Wine DEFAULT_MSG WINE_LIBRARIES WINE_INCLUDE_DIRS)
mark_as_advanced(WINE_INCLUDE_DIR WINE_LIBRARY)

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 845 B

After

Width:  |  Height:  |  Size: 642 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 910 B

After

Width:  |  Height:  |  Size: 353 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 995 B

After

Width:  |  Height:  |  Size: 576 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 914 B

After

Width:  |  Height:  |  Size: 564 B

View File

@@ -18,20 +18,20 @@ QToolTip {
border-radius: 4px;
background: qlineargradient(spread:reflect, x1:0.5, y1:0.5, x2:0.5, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(50, 50, 50, 220));
opacity: 175;
border: 1.5px solid rgba(0,0,0,255);
color: #00ff00;
border: 1.0px solid rgba(0,0,0,255);
color: #4afd85;
}
QMenu {
border:1px solid black;
background-color: rgb( 192, 192, 192 );
border:1px solid #747474;
background-color: #c9c9c9;
font-size:11px;
}
QMenu::separator {
height: 1px;
background: rgb(128,128,128);
background: #c9c9c9;
margin-left: 5px;
margin-right: 5px;
}
@@ -45,16 +45,16 @@ QMenu::item {
QMenu::item:selected {
color: white;
font-weight:bold;
background-color: rgb(54,57,66);
background-color: #747474;
margin:3px;
}
QMenu::item:disabled {
color: white;
color: #747474;
background-color: #c9c9c9;
margin:0px;
background-color: rgba(0,0,0,192);
font-size:12px;
font-weight:bold;
font-weight: normal;
padding: 4px 32px 4px 20px;
}
@@ -62,7 +62,7 @@ QMenu::indicator {
width: 16;
height: 16;
opacity: 0;
background-color: rgb( 192, 192, 192 );
background-color: #c9c9c9;
}
QMenu::indicator:checked {
@@ -70,18 +70,48 @@ QMenu::indicator:checked {
}
QMenu::indicator:selected {
background-color: rgb(54,57,66);
image: url("resources:apply-selected.png");
background-color: #747474;
}
pianoRoll {
background-color: rgb(0, 0, 0);
}
/*TrackContainerView QWidget{
background-color: #5b6571;
}*/
TrackContainerView QFrame{
background-color: #49515b;
}
trackOperationsWidget > QPushButton {
max-height: 26px;
max-width: 26px;
min-height: 26px;
min-width: 26px;
background-color: #c9c9c9;
border-radius: 2px;
border: 1px solid rgba(0,0,0,64);
}
trackOperationsWidget > QPushButton:hover {
background: qlineargradient(spread:reflect, x1:0.5, y1:0.5, x2:0.5, y2:0, stop:0 rgba(224, 224, 224, 255), stop:1 rgba(201, 201, 201, 255));
border: 1px solid rgba(0,0,0,255);
color: black;
}
trackOperationsWidget > QPushButton:pressed {
background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #747474, stop:0.5 #c9c9c9, stop:1 #c0c0c0 );
border: 1px solid rgba(0,0,0,255);
color: black;
}
trackOperationsWidget > QPushButton:flat {
background-color: #c9c9c9;
border-radius: 2px;
border: none;
}
trackOperationsWidget#automationDisabled > QPushButton::menu-indicator {
@@ -92,6 +122,16 @@ trackOperationsWidget#automationEnabled > QPushButton::menu-indicator {
image: url(resources:track_op_menu.png);
}
trackOperationsWidget > QPushButton::menu-indicator {
subcontrol-origin: padding;
subcontrol-position: center;
}
trackOperationsWidget > QPushButton::menu-indicator:pressed {
position: relative;
top: 1px;
}
trackWidget {
/* border-bottom: 1px solid rgb(0, 0, 0);*/
background-color: rgb(0, 0, 0);
@@ -102,45 +142,91 @@ nameLabel, effectLabel, sf2InstrumentView > QLabel {
QWidget#mainToolbar {
background-image: url(resources:main_toolbar_bg.png);
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #98a2a7, stop:1 #5b646f);
}
QToolBar {
background: url(resources:toolbar_bg.png);
background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #98a2a7, stop:1 #5b646f);
}
QToolButton, toolButton {
padding: 2px 1px 1px 2px;
border-radius: 2px;
border: 1px solid rgba(0,0,0,64);
background: rgba(172,176,188,32);
background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #c9c9c9, stop:0.5 #c0c0c0, stop:1 #747474 );
font-size:10px;
color: black;
}
QToolButton:hover, toolButton:hover {
background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #e0e0e0, stop:0.5 #c9c9c9, stop:1 #747474 );
border: 1px solid rgba(0,0,0,255);
color: white;
}
QToolButton:hover {
background: rgba(255,255,255,96);
QToolButton:pressed, ToolButton:pressed {
background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #c9c9c9, stop:0.5 #c0c0c0, stop:1 #747474 );
padding: 3px 1px 0px 2px;
border: 1px solid rgba(0,0,0,255);
color: white;
}
QToolButton:checked, ToolButton:checked {
background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #e0e0e0, stop:0.8 #c9c9c9, stop:1 #c0c0c0 );
border-radius: 3px;
padding: 3px 1px 0px 2px;
border: 1px solid rgba(0,0,0,255);
color: black;
}
QToolButton:pressed {
background: rgba(192,192,192,96);
padding: 3px 0px 0px 3px;
border-radius: 3px;
border: 1px solid rgba(255,255,255,64);
trackLabelButton {
background-color: #5b6571;
color: #c9c9c9;
font-size: 10px;
font-weight: normal;
border-radius: 1px;
border: 1px solid rgba(0,0,0,64);
}
QToolButton:checked {
background: rgba(233,239,255,96);
border-radius: 3px;
border: 1px solid black;
padding: 3px 0px 0px 3px;
trackLabelButton:hover {
background-color: #7b838d;
color: white;
border: 1px solid black;
}
trackLabelButton:pressed {
background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.5 #5b6571, stop:1 #6b7581 );
color: white;
border: 1px solid black;
font-weight: bold;
}
trackLabelButton:checked {
background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.5 #5b6571, stop:1 #6b7581 );
color: #c9c9c9;
border: 1px solid rgba(0,0,0,64);
font-weight: bold;
}
trackLabelButton:checked:hover {
background-color: #7b838d;
color: white;
border: 1px solid black;
font-weight: bold;
}
trackLabelButton:checked:pressed {
background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.5 #5b6571, stop:1 #6b7581 );
color: white;
border: 1px solid black;
font-weight: bold;
}
SideBar {
background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop: 0 #66728c, stop: 1.0 #38404e);
background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop: 0 #98a2a7, stop: 1.0 #5b646f);
}
SideBar QToolButton {
@@ -156,7 +242,7 @@ timeLine {
}
QTreeView {
alternate-background-color: rgb(108,108,108);
alternate-background-color: #747474;
}
/* Plugins */
@@ -215,8 +301,8 @@ organicInstrumentView knob#volKnob {
}
sf2InstrumentView knob {
color: #ff0066;
qproperty-outerColor: rgb(30, 35, 37);
color: #ff00ea;
qproperty-outerColor: rgb(20, 5, 18);
qproperty-innerRadius: 2;
qproperty-outerRadius: 9.2;
qproperty-centerPointX: 15.5;
@@ -230,9 +316,24 @@ opl2instrumentView knob {
qproperty-innerRadius: 2;
qproperty-outerRadius: 9;
qproperty-lineWidth: 2;
}
/* Notes:
}
/* palette information - each colour definition must be on a single line, and the line must begin with "palette:", with no leading whitespace
* colour codes MUST be of the form #RRGGBB */
palette:background {color: #5b6571}
palette:windowtext {color: #f0f0f0}
palette:base {color: #808080}
palette:text {color: #e0e0e0}
palette:button {color: #c9c9c9}
palette:shadow {color: #000000}
palette:buttontext {color: #000000}
palette:brighttext {color: #4afd85}
palette:highlight {color: #303030}
palette:highlightedtext {color: #ffffff}
/* Notes:
lcd-spinbox colors: (12, 250, 150), (37, 57, 42)

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 160 B

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 789 B

View File

@@ -1,7 +1,7 @@
/*
* Piano.h - declaration of class Piano
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -40,23 +40,40 @@ public:
BlackKey
} ;
Piano( InstrumentTrack * _it );
Piano( InstrumentTrack* track );
virtual ~Piano();
void setKeyState( int _key, bool _on = false );
void setKeyState( int key, bool state );
void handleKeyPress( int _key );
void handleKeyRelease( int _key );
bool isKeyPressed( int key ) const
{
return m_pressedKeys[key];
}
void handleKeyPress( int key, int midiVelocity = MidiMaxVelocity );
void handleKeyRelease( int key );
InstrumentTrack* instrumentTrack() const
{
return m_instrumentTrack;
}
MidiEventProcessor* midiEventProcessor() const
{
return m_midiEvProc;
}
private:
InstrumentTrack * m_instrumentTrack;
MidiEventProcessor * m_midiEvProc;
static bool isValidKey( int key )
{
return key >= 0 && key < NumKeys;
}
InstrumentTrack* m_instrumentTrack;
MidiEventProcessor* m_midiEvProc;
bool m_pressedKeys[NumKeys];
friend class PianoView;
} ;
#endif

View File

@@ -2,7 +2,7 @@
* piano_roll.h - declaration of class pianoRoll which is a window where you
* can set and edit notes in an easy way
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008 Andrew Kelley <superjoe30/at/gmail/dot/com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
@@ -50,7 +50,6 @@ class pattern;
class timeLine;
class toolButton;
class pianoRoll : public QWidget, public SerializingObject
{
Q_OBJECT
@@ -154,7 +153,6 @@ signals:
private:
enum editModes
{
ModeDraw,
@@ -230,8 +228,11 @@ private:
static const int cm_scrollAmtVert = 1;
static QPixmap * s_whiteKeyBigPm;
static QPixmap * s_whiteKeyBigPressedPm;
static QPixmap * s_whiteKeySmallPm;
static QPixmap * s_whiteKeySmallPressedPm;
static QPixmap * s_blackKeyPm;
static QPixmap * s_blackKeyPressedPm;
static QPixmap * s_toolDraw;
static QPixmap * s_toolErase;
static QPixmap * s_toolSelect;

View File

@@ -29,6 +29,7 @@
#include "lmmsconfig.h"
#include "lmms_basics.h"
#include "midi.h"
const volume_t MinVolume = 0;
const volume_t MaxVolume = 200;
@@ -50,4 +51,9 @@ typedef struct
} surroundVolumeVector;
inline int volumeToMidi( volume_t vol )
{
return vol * MidiMaxVelocity / DefaultVolume;
}
#endif

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 82 KiB

View File

@@ -863,7 +863,7 @@ sf2InstrumentView::sf2InstrumentView( Instrument * _instrument,
m_reverbButton = new pixmapButton( this );
m_reverbButton->setCheckable( true );
m_reverbButton->move( 24, 176 );
m_reverbButton->move( 14, 180 );
m_reverbButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"reverb_on" ) );
m_reverbButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
@@ -905,7 +905,7 @@ sf2InstrumentView::sf2InstrumentView( Instrument * _instrument,
m_chorusButton = new pixmapButton( this );
m_chorusButton->setCheckable( true );
m_chorusButton->move( 24, 222 );
m_chorusButton->move( 14, 226 );
m_chorusButton->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
"chorus_on" ) );
m_chorusButton->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(

View File

@@ -125,6 +125,6 @@ IF(LMMS_BUILD_WIN64)
ELSEIF(LMMS_BUILD_WIN32)
SET(FLTK_EXTRA_FLAGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/modules/Win32Toolchain.cmake")
ENDIF(LMMS_BUILD_WIN64)
ADD_CUSTOM_TARGET(libfltk COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/fltk && cd ${CMAKE_CURRENT_BINARY_DIR}/fltk && ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/fltk ${FLTK_EXTRA_FLAGS} -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/cmake/modules/ -DFLTK_USE_SYSTEM_ZLIB:BOOL=ON -DFLTK_USE_SYSTEM_JPEG:BOOL=ON -DFLTK_USE_SYSTEM_PNG:BOOL=ON -DOPTION_BUILD_EXAMPLES:BOOL=OFF -DCMAKE_BUILD_TYPE=release && ${CMAKE_BUILD_TOOL})
ADD_CUSTOM_TARGET(libfltk COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/fltk && cd ${CMAKE_CURRENT_BINARY_DIR}/fltk && ${CMAKE_COMMAND} ${CMAKE_CURRENT_SOURCE_DIR}/fltk ${FLTK_EXTRA_FLAGS} -DCMAKE_MODULE_PATH=${CMAKE_SOURCE_DIR}/cmake/modules/ -DFLTK_USE_SYSTEM_ZLIB:BOOL=ON -DFLTK_USE_SYSTEM_JPEG:BOOL=ON -DFLTK_USE_SYSTEM_PNG:BOOL=ON -DOPTION_BUILD_EXAMPLES:BOOL=OFF -DCMAKE_BUILD_TYPE=release -DFREETYPE_PATH=${FREETYPE_INCLUDE_DIR_ft2build} && ${CMAKE_BUILD_TOOL})
ADD_DEPENDENCIES(RemoteZynAddSubFx libfltk)

View File

@@ -2,7 +2,7 @@
* Piano.cpp - implementation of piano-widget used in instrument-track-window
* for testing + according model class
*
* Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -45,10 +45,10 @@
*
* \param _it the InstrumentTrack window to attach to
*/
Piano::Piano( InstrumentTrack * _it ) :
Piano::Piano( InstrumentTrack* track ) :
Model( NULL ), /*!< base class ctor */
m_instrumentTrack( _it ),
m_midiEvProc( _it ) /*!< the InstrumentTrack Model */
m_instrumentTrack( track ),
m_midiEvProc( track ) /*!< the InstrumentTrack Model */
{
for( int i = 0; i < NumKeys; ++i )
{
@@ -72,13 +72,17 @@ Piano::~Piano()
/*! \brief Turn a key on or off
*
* \param _key the key number to change
* \param _on the state to set the key to
* \param key the key number to change
* \param state the state to set the key to
*/
void Piano::setKeyState( int _key, bool _on )
void Piano::setKeyState( int key, bool state )
{
m_pressedKeys[tLimit( _key, 0, NumKeys-1 )] = _on;
emit dataChanged();
if( isValidKey( key ) )
{
m_pressedKeys[key] = state;
emit dataChanged();
}
}
@@ -86,13 +90,15 @@ void Piano::setKeyState( int _key, bool _on )
/*! \brief Handle a note being pressed on our keyboard display
*
* \param _key the key being pressed
* \param key the key being pressed
*/
void Piano::handleKeyPress( int _key )
void Piano::handleKeyPress( int key, int midiVelocity )
{
m_midiEvProc->processInEvent( midiEvent( MidiNoteOn, 0, _key,
MidiMaxVelocity ), midiTime() );
m_pressedKeys[_key] = true;
if( isValidKey( key ) )
{
m_midiEvProc->processInEvent( midiEvent( MidiNoteOn, 0, key, midiVelocity ), midiTime() );
m_pressedKeys[key] = true;
}
}
@@ -101,13 +107,15 @@ void Piano::handleKeyPress( int _key )
/*! \brief Handle a note being released on our keyboard display
*
* \param _key the key being releassed
* \param key the key being releassed
*/
void Piano::handleKeyRelease( int _key )
void Piano::handleKeyRelease( int key )
{
m_midiEvProc->processInEvent( midiEvent( MidiNoteOff, 0, _key, 0 ),
midiTime() );
m_pressedKeys[_key] = false;
if( isValidKey( key ) )
{
m_midiEvProc->processInEvent( midiEvent( MidiNoteOff, 0, key, 0 ), midiTime() );
m_pressedKeys[key] = false;
}
}

View File

@@ -48,6 +48,7 @@
#include "song.h"
#include "bb_track_container.h"
FxMixerView::FxMixerView() :
QWidget(),
ModelView( NULL, this ),
@@ -59,6 +60,7 @@ FxMixerView::FxMixerView() :
//QPalette pal = palette();
//pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) );
//setPalette( pal );
setAutoFillBackground( true );
setWindowTitle( tr( "FX-Mixer" ) );
@@ -137,7 +139,7 @@ FxMixerView::FxMixerView() :
// add ourself to workspace
QMdiSubWindow * subWin =
QMdiSubWindow * subWin =
engine::mainWindow()->workspace()->addSubWindow( this );
Qt::WindowFlags flags = subWin->windowFlags();
flags &= ~Qt::WindowMaximizeButtonHint;

View File

@@ -2,7 +2,7 @@
* Piano.cpp - implementation of piano-widget used in instrument-track-window
* for testing + according model class
*
* Copyright (c) 2004-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -306,8 +306,8 @@ void PianoView::modelChanged()
m_piano = castModel<Piano>();
if( m_piano != NULL )
{
connect( m_piano->m_instrumentTrack->baseNoteModel(),
SIGNAL( dataChanged() ), this, SLOT( update() ) );
connect( m_piano->instrumentTrack()->baseNoteModel(), SIGNAL( dataChanged() ),
this, SLOT( update() ) );
}
}
@@ -413,8 +413,7 @@ void PianoView::contextMenuEvent( QContextMenuEvent * _me )
}
captionMenu contextMenu( tr( "Base note" ) );
AutomatableModelView amv( m_piano->m_instrumentTrack->baseNoteModel(),
&contextMenu );
AutomatableModelView amv( m_piano->instrumentTrack()->baseNoteModel(), &contextMenu );
amv.addDefaultActions( &contextMenu );
contextMenu.exec( QCursor::pos() );
}
@@ -466,11 +465,8 @@ void PianoView::mousePressEvent( QMouseEvent * _me )
velocity = MidiMaxVelocity;
}
// set note on
m_piano->m_instrumentTrack->processInEvent(
midiEvent( MidiNoteOn, 0, key_num,
velocity ),
midiTime() );
m_piano->m_pressedKeys[key_num] = true;
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiNoteOn, 0, key_num, velocity ), midiTime() );
m_piano->setKeyState( key_num, true );
m_lastKey = key_num;
emit keyPressed( key_num );
@@ -480,17 +476,13 @@ void PianoView::mousePressEvent( QMouseEvent * _me )
if( _me->modifiers() & Qt::ControlModifier )
{
new stringPairDrag( "automatable_model",
QString::number( m_piano->
m_instrumentTrack->
baseNoteModel()->id() ),
QString::number( m_piano->instrumentTrack()->baseNoteModel()->id() ),
QPixmap(), this );
_me->accept();
}
else
{
m_piano->m_instrumentTrack->
baseNoteModel()->
setInitValue( (float) key_num );
m_piano->instrumentTrack()->baseNoteModel()->setInitValue( (float) key_num );
emit baseNoteChanged();
}
@@ -518,10 +510,8 @@ void PianoView::mouseReleaseEvent( QMouseEvent * )
{
if( m_piano != NULL )
{
m_piano->m_midiEvProc->processInEvent(
midiEvent( MidiNoteOff, 0, m_lastKey, 0 ),
midiTime() );
m_piano->m_pressedKeys[m_lastKey] = false;
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiNoteOff, 0, m_lastKey, 0 ), midiTime() );
m_piano->setKeyState( m_lastKey, false );
}
// and let the user see that he released a key... :)
@@ -581,39 +571,29 @@ void PianoView::mouseMoveEvent( QMouseEvent * _me )
{
if( m_lastKey != -1 )
{
m_piano->m_midiEvProc->processInEvent(
midiEvent( MidiNoteOff, 0, m_lastKey, 0 ),
midiTime() );
m_piano->m_pressedKeys[m_lastKey] = false;
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiNoteOff, 0, m_lastKey, 0 ), midiTime() );
m_piano->setKeyState( m_lastKey, false );
m_lastKey = -1;
}
if( _me->buttons() & Qt::LeftButton )
{
if( _me->pos().y() > PIANO_BASE )
{
m_piano->m_midiEvProc->processInEvent(
midiEvent( MidiNoteOn, 0, key_num,
velocity ),
midiTime() );
m_piano->m_pressedKeys[key_num] = true;
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiNoteOn, 0, key_num, velocity ), midiTime() );
m_piano->setKeyState( key_num, true );
m_lastKey = key_num;
}
else
{
m_piano->m_instrumentTrack->
baseNoteModel()->
setInitValue( (float) key_num );
m_piano->instrumentTrack()->baseNoteModel()->setInitValue( (float) key_num );
}
}
// and let the user see that he pressed a key... :)
update();
}
else if( m_piano->m_pressedKeys[key_num] == true )
else if( m_piano->isKeyPressed( key_num ) )
{
m_piano->m_midiEvProc->processInEvent(
midiEvent( MidiKeyPressure, 0, key_num,
velocity ),
midiTime() );
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiKeyPressure, 0, key_num, velocity ), midiTime() );
}
}
@@ -710,10 +690,8 @@ void PianoView::focusOutEvent( QFocusEvent * )
// hang otherwise
for( int i = 0; i < NumKeys; ++i )
{
m_piano->m_midiEvProc->processInEvent(
midiEvent( MidiNoteOff, 0, i, 0 ),
midiTime() );
m_piano->m_pressedKeys[i] = false;
m_piano->midiEventProcessor()->processInEvent( midiEvent( MidiNoteOff, 0, i, 0 ), midiTime() );
m_piano->setKeyState( i, false );
}
update();
}
@@ -826,7 +804,7 @@ void PianoView::paintEvent( QPaintEvent * )
p.setPen( Qt::white );
const int base_key = ( m_piano != NULL ) ?
m_piano->m_instrumentTrack->baseNoteModel()->value() : 0;
m_piano->instrumentTrack()->baseNoteModel()->value() : 0;
g.setColorAt( 0, QColor( 0, 96, 0 ) );
g.setColorAt( 0.1, QColor( 64, 255, 64 ) );
g.setColorAt( 1, QColor( 0, 96, 0 ) );
@@ -854,7 +832,7 @@ void PianoView::paintEvent( QPaintEvent * )
// draw pressed or not pressed key, depending on state of
// current key
if( m_piano && m_piano->m_pressedKeys[cur_key] == true )
if( m_piano && m_piano->isKeyPressed( cur_key ) )
{
p.drawPixmap( x, PIANO_BASE, *s_whiteKeyPressedPm );
}
@@ -881,19 +859,17 @@ void PianoView::paintEvent( QPaintEvent * )
cur_key = m_startKey;
int white_cnt = 0;
int s_key = m_startKey;
if( s_key > 0 &&
KEY_ORDER[(Keys)(--s_key) % KeysPerOctave] == Piano::BlackKey )
int startKey = m_startKey;
if( startKey > 0 &&
KEY_ORDER[(Keys)(--startKey) % KeysPerOctave] == Piano::BlackKey )
{
if( m_piano && m_piano->m_pressedKeys[s_key] == true )
if( m_piano && m_piano->isKeyPressed( startKey ) )
{
p.drawPixmap( 0 - PW_WHITE_KEY_WIDTH / 2, PIANO_BASE,
*s_blackKeyPressedPm );
p.drawPixmap( 0 - PW_WHITE_KEY_WIDTH / 2, PIANO_BASE, *s_blackKeyPressedPm );
}
else
{
p.drawPixmap( 0 - PW_WHITE_KEY_WIDTH / 2, PIANO_BASE,
*s_blackKeyPm );
p.drawPixmap( 0 - PW_WHITE_KEY_WIDTH / 2, PIANO_BASE, *s_blackKeyPm );
}
}
@@ -904,16 +880,13 @@ void PianoView::paintEvent( QPaintEvent * )
{
// draw pressed or not pressed key, depending on
// state of current key
if( m_piano && m_piano->m_pressedKeys[cur_key] == true )
if( m_piano && m_piano->isKeyPressed( cur_key ) )
{
p.drawPixmap( x + PW_WHITE_KEY_WIDTH / 2,
PIANO_BASE,
*s_blackKeyPressedPm );
p.drawPixmap( x + PW_WHITE_KEY_WIDTH / 2, PIANO_BASE, *s_blackKeyPressedPm );
}
else
{
p.drawPixmap( x + PW_WHITE_KEY_WIDTH / 2,
PIANO_BASE, *s_blackKeyPm );
p.drawPixmap( x + PW_WHITE_KEY_WIDTH / 2, PIANO_BASE, *s_blackKeyPm );
}
x += PW_WHITE_KEY_WIDTH;
white_cnt = 0;

View File

@@ -3,7 +3,7 @@
* interface
*
* Copyright (c) 2007-2008 Tobias Doerffel <tobydox/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
@@ -33,9 +33,8 @@
#include "lmms_style.h"
lmmsStyle::lmmsStyle() :
QPlastiqueStyle()
lmmsStyle::lmmsStyle() :
QPlastiqueStyle()
{
QFile file( "resources:style.css" );
file.open( QIODevice::ReadOnly );
@@ -50,16 +49,32 @@ lmmsStyle::lmmsStyle() :
QPalette lmmsStyle::standardPalette( void ) const
{
QPalette pal = QPlastiqueStyle::standardPalette();
pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) );
/* pal.setColor( QPalette::Background, QColor( 91, 101, 113 ) );
pal.setColor( QPalette::WindowText, QColor( 240, 240, 240 ) );
pal.setColor( QPalette::Base, QColor( 128, 128, 128 ) );
pal.setColor( QPalette::Text, QColor( 224, 224, 224 ) );
pal.setColor( QPalette::Button, QColor( 172, 176, 188 ) );
pal.setColor( QPalette::Button, QColor( 201, 201, 201 ) );
pal.setColor( QPalette::Shadow, QColor( 0, 0, 0 ) );
pal.setColor( QPalette::ButtonText, QColor( 255, 255, 255 ) );
pal.setColor( QPalette::BrightText, QColor( 0, 255, 0 ) );
pal.setColor( QPalette::Highlight, QColor( 224, 224, 224 ) );
pal.setColor( QPalette::HighlightedText, QColor( 0, 0, 0 ) );
pal.setColor( QPalette::ButtonText, QColor( 0, 0, 0 ) );
pal.setColor( QPalette::BrightText, QColor( 74, 253, 133 ) );
pal.setColor( QPalette::Highlight, QColor( 100, 100, 100 ) );
pal.setColor( QPalette::HighlightedText, QColor( 255, 255, 255 ) );*/
QStringList paletteData = qApp->styleSheet().split( '\n' ).filter( QRegExp( "^palette:*" ) );
foreach( QString s, paletteData )
{
if (s.contains("background")) { pal.setColor( QPalette::Background, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("windowtext")) { pal.setColor( QPalette::WindowText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("base")) { pal.setColor( QPalette::Base, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("buttontext")) { pal.setColor( QPalette::ButtonText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("brighttext")) { pal.setColor( QPalette::BrightText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("text")) { pal.setColor( QPalette::Text, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("button")) { pal.setColor( QPalette::Button, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("shadow")) { pal.setColor( QPalette::Shadow, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("highlightedtext")) { pal.setColor( QPalette::HighlightedText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("highlight")) { pal.setColor( QPalette::Highlight, QColor( s.mid( s.indexOf("#"), 7 ) ) ); };
}
return( pal );
}
@@ -97,8 +112,8 @@ void lmmsStyle::drawComplexControl( ComplexControl control,
void lmmsStyle::drawPrimitive( PrimitiveElement element,
const QStyleOption *option, QPainter *painter,
void lmmsStyle::drawPrimitive( PrimitiveElement element,
const QStyleOption *option, QPainter *painter,
const QWidget *widget) const
{
if( element == QStyle::PE_Frame ||
@@ -152,7 +167,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
lines[1] = QLine(rect.left(), rect.top() + 2,
rect.left(), rect.bottom() - 2);
painter->drawLines(lines, 2);
// outside corner dots - shadow
// 75%
shadow.setAlpha(a50);
@@ -160,7 +175,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
points[0] = QPoint(rect.left() + 1, rect.top() + 1);
points[1] = QPoint(rect.right() - 1, rect.top() + 1);
painter->drawPoints(points, 2);
// outside end dots - shadow
// 50%
shadow.setAlpha(a25);
@@ -170,7 +185,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
points[2] = QPoint(rect.right() - 1, rect.top());
points[3] = QPoint(rect.left(), rect.bottom() - 1);
painter->drawPoints(points, 4);
// outside lines - highlight
// 100%
@@ -181,7 +196,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
lines[1] = QLine(rect.right(), rect.top() + 2,
rect.right(), rect.bottom() - 2);
painter->drawLines(lines, 2);
// outside corner dots - highlight
// 75%
highlight.setAlpha(a50);
@@ -189,7 +204,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
points[0] = QPoint(rect.left() + 1, rect.bottom() - 1);
points[1] = QPoint(rect.right() - 1, rect.bottom() - 1);
painter->drawPoints(points, 2);
// outside end dots - highlight
// 50%
highlight.setAlpha(a25);
@@ -200,7 +215,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
points[3] = QPoint(rect.right(), rect.top() + 1);
painter->drawPoints(points, 4);
}
else
else
{
QPlastiqueStyle::drawPrimitive( element, option, painter,
widget );

View File

@@ -2,7 +2,7 @@
* piano_roll.cpp - implementation of piano-roll which is used for actual
* writing of melodies
*
* Copyright (c) 2004-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008 Andrew Kelley <superjoe30/at/gmail/dot/com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
@@ -115,8 +115,11 @@ const int NUM_TRIPLET_LENGTHS = 5;
QPixmap * pianoRoll::s_whiteKeySmallPm = NULL;
QPixmap * pianoRoll::s_whiteKeySmallPressedPm = NULL;
QPixmap * pianoRoll::s_whiteKeyBigPm = NULL;
QPixmap * pianoRoll::s_whiteKeyBigPressedPm = NULL;
QPixmap * pianoRoll::s_blackKeyPm = NULL;
QPixmap * pianoRoll::s_blackKeyPressedPm = NULL;
QPixmap * pianoRoll::s_toolDraw = NULL;
QPixmap * pianoRoll::s_toolErase = NULL;
QPixmap * pianoRoll::s_toolSelect = NULL;
@@ -222,16 +225,31 @@ pianoRoll::pianoRoll() :
s_whiteKeySmallPm = new QPixmap( embed::getIconPixmap(
"pr_white_key_small" ) );
}
if( s_whiteKeySmallPressedPm == NULL )
{
s_whiteKeySmallPressedPm = new QPixmap( embed::getIconPixmap(
"pr_white_key_small_pressed" ) );
}
if( s_whiteKeyBigPm == NULL )
{
s_whiteKeyBigPm = new QPixmap( embed::getIconPixmap(
"pr_white_key_big" ) );
}
if( s_whiteKeyBigPressedPm == NULL )
{
s_whiteKeyBigPressedPm = new QPixmap( embed::getIconPixmap(
"pr_white_key_big_pressed" ) );
}
if( s_blackKeyPm == NULL )
{
s_blackKeyPm = new QPixmap( embed::getIconPixmap(
"pr_black_key" ) );
}
if( s_blackKeyPressedPm == NULL )
{
s_blackKeyPressedPm = new QPixmap( embed::getIconPixmap(
"pr_black_key_pressed" ) );
}
if( s_toolDraw == NULL )
{
s_toolDraw = new QPixmap( embed::getIconPixmap(
@@ -753,6 +771,9 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern )
connect( m_pattern->instrumentTrack(),
SIGNAL( noteOff( const note & ) ),
this, SLOT( finishRecordNote( const note & ) ) );
connect( m_pattern->instrumentTrack()->pianoModel(),
SIGNAL( dataChanged() ),
this, SLOT( update() ) );
setWindowTitle( tr( "Piano-Roll - %1" ).arg( m_pattern->name() ) );
@@ -1031,8 +1052,7 @@ void pianoRoll::shiftPos( int amount ) //shift notes pos by amount
bool pianoRoll::isSelection() const // are any notes selected?
{
const NoteVector & notes = m_pattern->notes();
for( NoteVector::ConstIterator it = notes.begin(); it != notes.end();
++it )
for( NoteVector::ConstIterator it = notes.begin(); it != notes.end(); ++it )
{
if( ( *it )->selected() )
{
@@ -1050,8 +1070,7 @@ int pianoRoll::selectionCount() const // how many notes are selected?
int sum = 0;
const NoteVector & notes = m_pattern->notes();
for( NoteVector::ConstIterator it = notes.begin(); it != notes.end();
++it )
for( NoteVector::ConstIterator it = notes.begin(); it != notes.end(); ++it )
{
if( ( *it )->selected() )
{
@@ -1064,26 +1083,23 @@ int pianoRoll::selectionCount() const // how many notes are selected?
void pianoRoll::keyPressEvent( QKeyEvent * _ke )
void pianoRoll::keyPressEvent( QKeyEvent* event )
{
if( validPattern() && _ke->modifiers() == Qt::NoModifier )
if( validPattern() && event->modifiers() == Qt::NoModifier )
{
const int key_num = PianoView::getKeyFromKeyEvent( _ke ) +
( DefaultOctave - 1 ) * KeysPerOctave;
const int key_num = PianoView::getKeyFromKeyEvent( event ) + ( DefaultOctave - 1 ) * KeysPerOctave;
if( _ke->isAutoRepeat() == false && key_num > -1 )
if( event->isAutoRepeat() == false && key_num > -1 )
{
m_pattern->instrumentTrack()->pianoModel()->
handleKeyPress( key_num );
_ke->accept();
m_pattern->instrumentTrack()->pianoModel()->handleKeyPress( key_num );
event->accept();
}
}
switch( _ke->key() )
switch( event->key() )
{
case Qt::Key_Up:
if( ( _ke->modifiers() & Qt::ControlModifier )
&& m_action == ActionNone )
if( ( event->modifiers() & Qt::ControlModifier ) && m_action == ActionNone )
{
// shift selection up an octave
// if nothing selected, shift _everything_
@@ -1102,16 +1118,15 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
m_action == ActionResizeNote )
{
dragNotes( m_lastMouseX, m_lastMouseY,
_ke->modifiers() & Qt::AltModifier,
_ke->modifiers() & Qt::ShiftModifier );
event->modifiers() & Qt::AltModifier,
event->modifiers() & Qt::ShiftModifier );
}
}
_ke->accept();
event->accept();
break;
case Qt::Key_Down:
if( _ke->modifiers() & Qt::ControlModifier
&& m_action == ActionNone )
if( event->modifiers() & Qt::ControlModifier && m_action == ActionNone )
{
// shift selection down an octave
// if nothing selected, shift _everything_
@@ -1130,16 +1145,15 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
m_action == ActionResizeNote )
{
dragNotes( m_lastMouseX, m_lastMouseY,
_ke->modifiers() & Qt::AltModifier,
_ke->modifiers() & Qt::ShiftModifier );
event->modifiers() & Qt::AltModifier,
event->modifiers() & Qt::ShiftModifier );
}
}
_ke->accept();
event->accept();
break;
case Qt::Key_Left:
if( _ke->modifiers() & Qt::ControlModifier &&
m_action == ActionNone )
if( event->modifiers() & Qt::ControlModifier && m_action == ActionNone )
{
// move time ticker
if( ( m_timeLine->pos() -= 16 ) < 0 )
@@ -1148,12 +1162,10 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
}
m_timeLine->updatePosition();
}
else if( _ke->modifiers() & Qt::ShiftModifier
&& m_action == ActionNone)
else if( event->modifiers() & Qt::ShiftModifier && m_action == ActionNone)
{
// move notes
bool quantized = ! ( _ke->modifiers() &
Qt::AltModifier );
bool quantized = ! ( event->modifiers() & Qt::AltModifier );
int amt = quantized ? quantization() : 1;
shiftPos( -amt );
}
@@ -1170,28 +1182,25 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
m_action == ActionResizeNote )
{
dragNotes( m_lastMouseX, m_lastMouseY,
_ke->modifiers() & Qt::AltModifier,
_ke->modifiers() & Qt::ShiftModifier );
event->modifiers() & Qt::AltModifier,
event->modifiers() & Qt::ShiftModifier );
}
}
_ke->accept();
event->accept();
break;
case Qt::Key_Right:
if( _ke->modifiers() & Qt::ControlModifier
&& m_action == ActionNone)
if( event->modifiers() & Qt::ControlModifier && m_action == ActionNone)
{
// move time ticker
m_timeLine->pos() += 16;
m_timeLine->updatePosition();
}
else if( _ke->modifiers() & Qt::ShiftModifier
&& m_action == ActionNone)
else if( event->modifiers() & Qt::ShiftModifier && m_action == ActionNone)
{
// move notes
bool quantized = !( _ke->modifiers() &
Qt::AltModifier );
bool quantized = !( event->modifiers() & Qt::AltModifier );
int amt = quantized ? quantization() : 1;
shiftPos( +amt );
}
@@ -1208,42 +1217,42 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
m_action == ActionResizeNote )
{
dragNotes( m_lastMouseX, m_lastMouseY,
_ke->modifiers() & Qt::AltModifier,
_ke->modifiers() & Qt::ShiftModifier );
event->modifiers() & Qt::AltModifier,
event->modifiers() & Qt::ShiftModifier );
}
}
_ke->accept();
event->accept();
break;
case Qt::Key_C:
if( _ke->modifiers() & Qt::ControlModifier )
if( event->modifiers() & Qt::ControlModifier )
{
_ke->accept();
event->accept();
copySelectedNotes();
}
break;
case Qt::Key_X:
if( _ke->modifiers() & Qt::ControlModifier )
if( event->modifiers() & Qt::ControlModifier )
{
_ke->accept();
event->accept();
cutSelectedNotes();
}
break;
case Qt::Key_V:
if( _ke->modifiers() & Qt::ControlModifier )
if( event->modifiers() & Qt::ControlModifier )
{
_ke->accept();
event->accept();
pasteNotes();
}
break;
case Qt::Key_A:
if( _ke->modifiers() & Qt::ControlModifier )
if( event->modifiers() & Qt::ControlModifier )
{
_ke->accept();
event->accept();
m_selectButton->setChecked( true );
selectAll();
update();
@@ -1251,40 +1260,40 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
break;
case Qt::Key_D:
if( _ke->modifiers() & Qt::ShiftModifier )
if( event->modifiers() & Qt::ShiftModifier )
{
_ke->accept();
event->accept();
m_drawButton->setChecked( true );
}
break;
case Qt::Key_E:
if( _ke->modifiers() & Qt::ShiftModifier )
if( event->modifiers() & Qt::ShiftModifier )
{
_ke->accept();
event->accept();
m_eraseButton->setChecked( true );
}
break;
case Qt::Key_S:
if( _ke->modifiers() & Qt::ShiftModifier )
if( event->modifiers() & Qt::ShiftModifier )
{
_ke->accept();
event->accept();
m_selectButton->setChecked( true );
}
break;
case Qt::Key_T:
if( _ke->modifiers() & Qt::ShiftModifier )
if( event->modifiers() & Qt::ShiftModifier )
{
_ke->accept();
event->accept();
m_detuneButton->setChecked( true );
}
break;
case Qt::Key_Delete:
deleteSelectedNotes();
_ke->accept();
event->accept();
break;
case Qt::Key_Space:
@@ -1296,13 +1305,13 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
{
play();
}
_ke->accept();
event->accept();
break;
case Qt::Key_Home:
m_timeLine->pos().setTicks( 0 );
m_timeLine->updatePosition();
_ke->accept();
event->accept();
break;
case Qt::Key_0:
@@ -1316,19 +1325,20 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
case Qt::Key_8:
case Qt::Key_9:
{
int len = 1 + _ke->key() - Qt::Key_0;
if( len == 10 )
int len = 1 + event->key() - Qt::Key_0;
if( len == 10 )
{
len = 0;
if( _ke->modifiers() &
( Qt::ControlModifier | Qt::KeypadModifier ) )
}
if( event->modifiers() & ( Qt::ControlModifier | Qt::KeypadModifier ) )
{
m_noteLenModel.setValue( len );
_ke->accept();
event->accept();
}
else if( _ke->modifiers() & Qt::AltModifier )
else if( event->modifiers() & Qt::AltModifier )
{
m_quantizeModel.setValue( len );
_ke->accept();
event->accept();
}
break;
}
@@ -1337,40 +1347,41 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
m_ctrlMode = m_editMode;
m_editMode = ModeSelect;
QApplication::changeOverrideCursor( Qt::ArrowCursor );
update();
_ke->accept();
event->accept();
break;
default:
break;
}
update();
}
void pianoRoll::keyReleaseEvent( QKeyEvent * _ke )
void pianoRoll::keyReleaseEvent( QKeyEvent* event )
{
if( validPattern() && _ke->modifiers() == Qt::NoModifier )
if( validPattern() && event->modifiers() == Qt::NoModifier )
{
const int key_num = PianoView::getKeyFromKeyEvent( _ke ) +
( DefaultOctave - 1 ) * KeysPerOctave;
const int key_num = PianoView::getKeyFromKeyEvent( event ) + ( DefaultOctave - 1 ) * KeysPerOctave;
if( _ke->isAutoRepeat() == false && key_num > -1 )
if( event->isAutoRepeat() == false && key_num > -1 )
{
m_pattern->instrumentTrack()->pianoModel()->
handleKeyRelease( key_num );
_ke->accept();
m_pattern->instrumentTrack()->pianoModel()->handleKeyRelease( key_num );
event->accept();
}
}
switch( _ke->key() )
switch( event->key() )
{
case Qt::Key_Control:
computeSelectedNotes( _ke->modifiers() &
Qt::ShiftModifier);
computeSelectedNotes( event->modifiers() & Qt::ShiftModifier);
m_editMode = m_ctrlMode;
update();
break;
}
update();
}
@@ -1456,8 +1467,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
{
m_ctrlMode = m_editMode;
m_editMode = ModeSelect;
QApplication::changeOverrideCursor(
QCursor( Qt::ArrowCursor ) );
QApplication::changeOverrideCursor( QCursor( Qt::ArrowCursor ) );
update();
}
@@ -1672,10 +1682,7 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
// clicked at the "tail" of the note?
if( pos_ticks*m_ppt/midiTime::ticksPerTact() >
( m_currentNote->pos() +
m_currentNote->length() )*m_ppt/
midiTime::ticksPerTact() -
RESIZE_AREA_WIDTH &&
( m_currentNote->pos() + m_currentNote->length() )*m_ppt/ midiTime::ticksPerTact() - RESIZE_AREA_WIDTH &&
m_currentNote->length() > 0 )
{
// then resize the note
@@ -1787,10 +1794,8 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
m_lastKey = key_num;
if( ! m_recording && ! engine::getSong()->isPlaying() )
{
int v = ( (float) x ) / ( (float) WHITE_KEY_WIDTH ) * 127;
m_pattern->instrumentTrack()->processInEvent(
midiEvent( MidiNoteOn, 0, key_num, v ),
midiTime() );
int v = ( (float) x ) / ( (float) WHITE_KEY_WIDTH ) * MidiMaxVelocity;
m_pattern->instrumentTrack()->pianoModel()->handleKeyPress( key_num, v );
}
}
}
@@ -1844,12 +1849,9 @@ void pianoRoll::testPlayNote( note * n )
! engine::getSong()->isPlaying() )
{
n->setIsPlaying( true );
m_pattern->instrumentTrack()->processInEvent(
midiEvent( MidiNoteOn, 0, n->key(),
n->getVolume() * 127 / 100 ), midiTime() );
midiEvent evt( MidiMetaEvent, 0, n->key(),
panningToMidi( n->getPanning() ) );
m_pattern->instrumentTrack()->pianoModel()->handleKeyPress( n->key(), volumeToMidi( n->getVolume() ) );
midiEvent evt( MidiMetaEvent, 0, n->key(), panningToMidi( n->getPanning() ) );
evt.m_metaEvent = MidiNotePanning;
m_pattern->instrumentTrack()->processInEvent( evt, midiTime() );
@@ -1870,11 +1872,7 @@ void pianoRoll::pauseTestNotes( bool _pause )
if( _pause )
{
// stop note
m_pattern->instrumentTrack()->
processInEvent(
midiEvent( MidiNoteOff, 0,
( *it )->key(), 0 ),
midiTime() );
m_pattern->instrumentTrack()->pianoModel()->handleKeyRelease( ( *it )->key() );
}
else
{
@@ -1891,23 +1889,19 @@ void pianoRoll::pauseTestNotes( bool _pause )
void pianoRoll::testPlayKey( int _key, int _vol, int _pan )
void pianoRoll::testPlayKey( int key, int velocity, int pan )
{
// turn off old key
m_pattern->instrumentTrack()->processInEvent(
midiEvent( MidiNoteOff, 0, m_lastKey, 0 ),
midiTime() );
m_pattern->instrumentTrack()->pianoModel()->handleKeyRelease( m_lastKey );
// remember which one we're playing
m_lastKey = _key;
m_lastKey = key;
// play new key
m_pattern->instrumentTrack()->processInEvent(
midiEvent( MidiNoteOn, 0, _key, _vol ),
midiTime() );
m_pattern->instrumentTrack()->pianoModel()->handleKeyPress( key, velocity );
// set panning of newly played key
midiEvent evt( MidiMetaEvent, 0, _key, _pan );
midiEvent evt( MidiMetaEvent, 0, key, pan );
evt.m_metaEvent = MidiNotePanning;
}
@@ -2052,11 +2046,7 @@ void pianoRoll::mouseReleaseEvent( QMouseEvent * _me )
{
if( ( *it )->isPlaying() )
{
m_pattern->instrumentTrack()->
processInEvent(
midiEvent( MidiNoteOff, 0,
( *it )->key(), 0 ),
midiTime() );
m_pattern->instrumentTrack()->pianoModel()->handleKeyRelease( ( *it )->key() );
( *it )->setIsPlaying( false );
}
@@ -2064,10 +2054,7 @@ void pianoRoll::mouseReleaseEvent( QMouseEvent * _me )
}
// stop playing keys that we let go of
m_pattern->instrumentTrack()->processInEvent(
midiEvent( MidiNoteOff, 0, m_lastKey, 0 ),
midiTime() );
m_pattern->instrumentTrack()->pianoModel()->handleKeyRelease( m_lastKey );
}
m_currentNote = NULL;
@@ -2132,9 +2119,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
&& _me->buttons() & Qt::LeftButton )
{
// clicked on a key, play the note
testPlayKey( key_num,
( (float) x ) / ( (float) WHITE_KEY_WIDTH ) * 127,
0 );
testPlayKey( key_num, ( (float) x ) / ( (float) WHITE_KEY_WIDTH ) * MidiMaxVelocity, 0 );
update();
return;
}
@@ -2224,26 +2209,19 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
// play the note so that the user can tell how loud it is
// and where it is panned
testPlayNote( n );
if( m_noteEditMode == NoteEditVolume )
{
n->setVolume( vol );
m_pattern->instrumentTrack()->processInEvent(
midiEvent(
MidiKeyPressure,
0,
n->key(),
vol * 127 / 100),
midiTime() );
midiEvent( MidiKeyPressure, 0, n->key(), volumeToMidi( vol ) ), midiTime() );
}
else if( m_noteEditMode == NoteEditPanning )
{
n->setPanning( pan );
midiEvent evt( MidiMetaEvent, 0,
n->key(), panningToMidi( pan ) );
midiEvent evt( MidiMetaEvent, 0, n->key(), panningToMidi( pan ) );
evt.m_metaEvent = MidiNotePanning;
m_pattern->instrumentTrack()->processInEvent(
evt, midiTime() );
m_pattern->instrumentTrack()->processInEvent( evt, midiTime() );
}
}
else
@@ -2251,10 +2229,8 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
if( n->isPlaying() )
{
// mouse not over this note, stop playing it.
m_pattern->instrumentTrack()->processInEvent(
midiEvent( MidiNoteOff, 0,
n->key(), 0 ), midiTime() );
m_pattern->instrumentTrack()->pianoModel()->handleKeyRelease( n->key() );
n->setIsPlaying( false );
}
}
@@ -2739,7 +2715,6 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
}
break;
}
// start drawing at the bottom
int key_line_y = keyAreaBottom() - 1;
// used for aligning black-keys later
@@ -2793,9 +2768,15 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
// check whether to draw a big or a small white key
if( prKeyOrder[key % KeysPerOctave] == PR_WHITE_KEY_SMALL )
{
// draw a small one...
p.drawPixmap( PIANO_X, y - WHITE_KEY_SMALL_HEIGHT,
*s_whiteKeySmallPm );
// draw a small one while checking if it is pressed or not
if( m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
{
p.drawPixmap( PIANO_X, y - WHITE_KEY_SMALL_HEIGHT, *s_whiteKeySmallPressedPm );
}
else
{
p.drawPixmap( PIANO_X, y - WHITE_KEY_SMALL_HEIGHT, *s_whiteKeySmallPm );
}
// update y-pos
y -= WHITE_KEY_SMALL_HEIGHT;
@@ -2803,9 +2784,15 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
else if( prKeyOrder[key % KeysPerOctave] ==
PR_WHITE_KEY_BIG )
{
// draw a big one...
p.drawPixmap( PIANO_X, y-WHITE_KEY_BIG_HEIGHT,
*s_whiteKeyBigPm );
// draw a big one while checking if it is pressed or not
if(m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
{
p.drawPixmap( PIANO_X, y - WHITE_KEY_BIG_HEIGHT, *s_whiteKeyBigPressedPm );
}
else
{
p.drawPixmap( PIANO_X, y-WHITE_KEY_BIG_HEIGHT, *s_whiteKeyBigPm );
}
// if a big white key has been the first key,
// black keys needs to be lifted up
if( keys_processed == 0 )
@@ -2868,15 +2855,25 @@ void pianoRoll::paintEvent( QPaintEvent * _pe )
}
}
// current key black?
if( prKeyOrder[key % KeysPerOctave] == PR_BLACK_KEY )
if( prKeyOrder[key % KeysPerOctave] == PR_BLACK_KEY)
{
// then draw it (calculation of y very complicated,
// but that's the only working solution, sorry...)
p.drawPixmap( PIANO_X, y - ( first_white_key_height -
WHITE_KEY_SMALL_HEIGHT ) -
WHITE_KEY_SMALL_HEIGHT/2 - 1 -
BLACK_KEY_HEIGHT, *s_blackKeyPm );
// check if the key is pressed or not
if( m_pattern->instrumentTrack()->pianoModel()->isKeyPressed( key ) )
{
p.drawPixmap( PIANO_X, y - ( first_white_key_height -
WHITE_KEY_SMALL_HEIGHT ) -
WHITE_KEY_SMALL_HEIGHT/2 - 1 -
BLACK_KEY_HEIGHT, *s_blackKeyPressedPm );
}
else
{
p.drawPixmap( PIANO_X, y - ( first_white_key_height -
WHITE_KEY_SMALL_HEIGHT ) -
WHITE_KEY_SMALL_HEIGHT/2 - 1 -
BLACK_KEY_HEIGHT, *s_blackKeyPm );
}
// update y-pos
y -= WHITE_KEY_BIG_HEIGHT;
// reset white-counter

View File

@@ -70,7 +70,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
m_autoQuit->setLabel( tr( "DECAY" ) );
m_autoQuit->move( 60, 5 );
m_autoQuit->setHintText( tr( "Time:" ) + " ", "ms" );
m_autoQuit->setWhatsThis( tr(
m_autoQuit->setWhatsThis( tr(
"The Decay knob controls how many buffers of silence must pass before the "
"plugin stops processing. Smaller values will reduce the CPU overhead but "
"run the risk of clipping the tail on delay and reverb effects." ) );
@@ -80,7 +80,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
m_gate->setLabel( tr( "GATE" ) );
m_gate->move( 93, 5 );
m_gate->setHintText( tr( "Gate:" ) + " ", "" );
m_gate->setWhatsThis( tr(
m_gate->setWhatsThis( tr(
"The Gate knob controls the signal level that is considered to be 'silence' "
"while deciding when to stop processing signals." ) );
@@ -94,7 +94,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
QFont f = ctls_btn->font();
ctls_btn->setFont( pointSize<7>( f ) );
ctls_btn->setGeometry( 140, 14, 50, 20 );
connect( ctls_btn, SIGNAL( clicked() ),
connect( ctls_btn, SIGNAL( clicked() ),
this, SLOT( editControls() ) );
m_controlView = effect()->controls()->createView();
@@ -115,7 +115,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
}
setWhatsThis( tr(
setWhatsThis( tr(
"Effect plugins function as a chained series of effects where the signal will "
"be processed from top to bottom.\n\n"
@@ -264,7 +264,7 @@ void EffectView::paintEvent( QPaintEvent * )
f.setBold( true );
p.setFont( f );
p.setPen( QColor( 64, 64, 64 ) );
p.setPen( palette().shadow().color() );
p.drawText( 6, 55, model()->displayName() );
p.setPen( palette().text().color() );
p.drawText( 5, 54, model()->displayName() );

View File

@@ -46,7 +46,7 @@ groupBox::groupBox( const QString & _caption, QWidget * _parent ) :
m_led = new pixmapButton( this, _caption );
m_led->setCheckable( true );
m_led->move( 3, 3 );
m_led->move( 3, 0 );
m_led->setActiveGraphic( embed::getIconPixmap( "led_green" ) );
m_led->setInactiveGraphic( embed::getIconPixmap( "led_off" ) );
@@ -127,7 +127,7 @@ void groupBox::updatePixmap()
//p.setPen( QColor( 255, 255, 255 ) );
p.setPen( palette().color( QPalette::Active, QPalette::ButtonText ) );
p.setPen( palette().color( QPalette::Active, QPalette::Text ) );
p.setFont( pointSize<7>( font() ) );
p.drawText( 22, 10, m_caption );