bugfixes and some small new features

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@45 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-01-09 10:31:28 +00:00
parent 052224c8e2
commit 4804108a1d
26 changed files with 896 additions and 143 deletions

View File

@@ -2,7 +2,7 @@
* arp_and_chords_tab_widget.cpp - widget for use in arp/chord-tab of
* channel-window
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -41,8 +41,6 @@
#include <qcombobox.h>
#include <qwhatsthis.h>
#define setChecked setOn
#endif
@@ -62,6 +60,7 @@
#include "gui_templates.h"
#include "tempo_sync_knob.h"
#include "channel_track.h"
#include "led_checkbox.h"
@@ -153,9 +152,9 @@ arpAndChordsTabWidget::chord arpAndChordsTabWidget::s_chords[] =
{ arpAndChordsTabWidget::tr( "Diminished" ), { 0, 2, 3, 5, 6, 8, 9,
11, -1 } },
{ arpAndChordsTabWidget::tr( "Major pentatonic" ), { 0, 2, 4, 7, 10,
-1 } },
-1 } },
{ arpAndChordsTabWidget::tr( "Minor pentatonic" ), { 0, 3, 5, 7, 10,
-1 } },
-1 } },
{ arpAndChordsTabWidget::tr( "Jap in sen" ), { 0, 1, 5, 7, 10, -1 } },
{ arpAndChordsTabWidget::tr( "Major bebop" ), { 0, 2, 4, 5, 7, 8, 9,
11, -1 } },
@@ -164,7 +163,7 @@ arpAndChordsTabWidget::chord arpAndChordsTabWidget::s_chords[] =
{ arpAndChordsTabWidget::tr( "Blues" ), { 0, 3, 5, 6, 7, 10, -1 } },
{ arpAndChordsTabWidget::tr( "Arabic" ), { 0, 1, 4, 5, 7, 8, 11, -1 } },
{ arpAndChordsTabWidget::tr( "Enigmatic" ), { 0, 1, 4, 6, 8, 10, 11,
-1 } },
-1 } },
{ arpAndChordsTabWidget::tr( "Neopolitan" ), { 0, 1, 3, 5, 7, 9, 11,
-1 } },
{ arpAndChordsTabWidget::tr( "Neopolitan minor" ), { 0, 1, 3, 5, 7, 9,
@@ -173,14 +172,14 @@ arpAndChordsTabWidget::chord arpAndChordsTabWidget::s_chords[] =
11, -1 } },
{ arpAndChordsTabWidget::tr( "Dorian" ), { 0, 2, 3, 5, 7, 9, 10, -1 } },
{ arpAndChordsTabWidget::tr( "Phrygolydian" ), { 0, 1, 3, 5, 7, 8, 10,
-1 } },
-1 } },
{ arpAndChordsTabWidget::tr( "Lydian" ), { 0, 2, 4, 6, 7, 9, 11, -1 } },
{ arpAndChordsTabWidget::tr( "Mixolydian" ), { 0, 2, 4, 5, 7, 9, 10,
-1 } },
-1 } },
{ arpAndChordsTabWidget::tr( "Aeolian" ), { 0, 2, 3, 5, 7, 8, 10,
-1 } },
-1 } },
{ arpAndChordsTabWidget::tr( "Locrian" ), { 0, 1, 3, 5, 6, 8, 10,
-1 } },
-1 } },
{ "", { -1, -1 } }
@@ -323,13 +322,13 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track ) :
"can make cool staccato-arpeggios." ) );
m_arpDirectionLbl = new QLabel( tr( "DIRECTION:" ), m_arpGroupBox );
m_arpDirectionLbl->setGeometry( 10, 70, 64, 8 );
m_arpDirectionLbl->setFont( pointSize<6>( m_arpDirectionLbl->font() ) );
m_arpDirectionLbl->setGeometry( 10, 60, 64, 8 );
m_arpDirectionLbl->setFont( pointSize<7>( m_arpDirectionLbl->font() ) );
m_arpUpBtn = new pixmapButton( m_arpGroupBox );
m_arpUpBtn->move( 70, 70 );
m_arpUpBtn->move( 70, 60 );
m_arpUpBtn->setActiveGraphic( embed::getIconPixmap( "arp_up_on" ) );
m_arpUpBtn->setInactiveGraphic( embed::getIconPixmap( "arp_up_off" ) );
#ifdef QT4
@@ -345,7 +344,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track ) :
SLOT( arpUpToggled( bool ) ) );
m_arpDownBtn = new pixmapButton( m_arpGroupBox );
m_arpDownBtn->move( 90, 70 );
m_arpDownBtn->move( 90, 60 );
m_arpDownBtn->setActiveGraphic( embed::getIconPixmap( "arp_down_on" ) );
m_arpDownBtn->setInactiveGraphic( embed::getIconPixmap(
"arp_down_off" ) );
@@ -357,7 +356,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track ) :
SLOT( arpDownToggled( bool ) ) );
m_arpUpAndDownBtn = new pixmapButton( m_arpGroupBox );
m_arpUpAndDownBtn->move( 110, 70 );
m_arpUpAndDownBtn->move( 110, 60 );
m_arpUpAndDownBtn->setActiveGraphic( embed::getIconPixmap(
"arp_up_and_down_on" ) );
m_arpUpAndDownBtn->setInactiveGraphic( embed::getIconPixmap(
@@ -371,7 +370,7 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track ) :
SLOT( arpUpAndDownToggled( bool ) ) );
m_arpRandomBtn = new pixmapButton( m_arpGroupBox );
m_arpRandomBtn->move( 130, 70 );
m_arpRandomBtn->move( 130, 60 );
m_arpRandomBtn->setActiveGraphic( embed::getIconPixmap(
"arp_random_on" ) );
m_arpRandomBtn->setInactiveGraphic( embed::getIconPixmap(
@@ -392,6 +391,10 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( channelTrack * _channel_track ) :
#ifndef QT4
m_arpDirections_group->hide();
#endif
m_sortMode = new ledCheckBox( tr( "SORT-MODE" ), m_arpGroupBox );
m_sortMode->move( 10, 90 );
}
@@ -485,28 +488,40 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
const int selected_arp = m_arpComboBox->currentItem();
#endif
constNotePlayHandleVector cnphv = notePlayHandle::nphsOfChannelTrack(
_n->getChannelTrack() );
// VERY unlikely, but better check this before ending in a crash
if( cnphv.size() == 0 )
{
return;
}
const int cur_chord_size = getChordSize( s_chords[selected_arp] );
const int total_range = (int)( cur_chord_size *
m_arpRangeKnob->value() );
const int range = (int)( cur_chord_size * m_arpRangeKnob->value() );
const int total_range = range * cnphv.size();
// number of frames that every note should be played
const Uint32 arp_frames = (Uint32)( m_arpTimeKnob->value() / 1000.0f *
mixer::inst()->sampleRate() );
const Uint32 gated_frames = (Uint32)( m_arpGateKnob->value() *
arp_frames / 100.0f );
// used for calculating remaining frames for arp-note, we have to add
// arp_frames-1, otherwise the first arp-note will not be setup
// correctly... -> arp_frames frames silence at the start of every note!
int cur_frame = _n->totalFramesPlayed() + arp_frames - 1;
int cur_frame = ( ( m_sortMode->isChecked() == TRUE ) ?
cnphv.first()->totalFramesPlayed() :
_n->totalFramesPlayed() )
+ arp_frames - 1;
// used for loop
Uint32 frames_processed = 0;
// len for all arp-notes (depending on arp-time)
while( frames_processed < mixer::inst()->framesPerAudioBuffer() )
{
const Uint32 remaining_frames_for_cur_arp = arp_frames -
( cur_frame % arp_frames );
// does current arp-note fill whole audio-buffer?
if( remaining_frames_for_cur_arp >=
if( remaining_frames_for_cur_arp >
mixer::inst()->framesPerAudioBuffer() )
{
// then we don't have to do something!
@@ -518,36 +533,46 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
// init with zero
int cur_arp_idx = 0;
if( m_sortMode->isChecked() == TRUE &&
( ( cur_frame / arp_frames ) % total_range ) /
range != (csize) _n->index() )
{
// update counters
frames_processed += arp_frames;
cur_frame += arp_frames;
break;
}
// process according to arpeggio-direction...
if( m_arpDirection == UP )
{
cur_arp_idx = ( cur_frame / arp_frames ) % total_range;
cur_arp_idx = ( cur_frame / arp_frames ) % range;
}
else if( m_arpDirection == DOWN )
{
cur_arp_idx = total_range - ( cur_frame / arp_frames ) %
total_range - 1;
cur_arp_idx = range - ( cur_frame / arp_frames ) %
range - 1;
}
else if( m_arpDirection == UP_AND_DOWN && total_range > 1 )
else if( m_arpDirection == UP_AND_DOWN && range > 1 )
{
// imagine, we had to play the arp once up and then
// once down -> makes 2 * total_range possible notes...
// once down -> makes 2 * range possible notes...
// because we don't play the lower and upper notes
// twice, we have to subtract 2
cur_arp_idx = ( cur_frame / arp_frames ) %
( total_range * 2 - 2 );
// if greater than total_range, we have to play down...
( range * 2 - 2 );
// if greater than range, we have to play down...
// looks like the code for arp_dir==DOWN... :)
if( cur_arp_idx >= total_range )
if( cur_arp_idx >= range )
{
cur_arp_idx = total_range - cur_arp_idx %
( total_range - 1 ) - 1;
cur_arp_idx = range - cur_arp_idx %
( range - 1 ) - 1;
}
}
else if( m_arpDirection == RANDOM )
{
// just pick a random chord-index
cur_arp_idx = (int)( total_range * ( (float) rand() /
cur_arp_idx = (int)( range * ( (float) rand() /
(float) RAND_MAX ) );
}
@@ -584,20 +609,27 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
// and is_arp_note=TRUE
notePlayHandle * note_play_handle = new notePlayHandle(
_n->getChannelTrack(),
_n->framesAhead() +
( ( m_sortMode->isChecked() == TRUE ) ?
cnphv.first()->framesAhead() :
_n->framesAhead() ) +
frames_processed,
gated_frames,
&new_note,
TRUE );
// add sub-note to base-note, now all stuff is done by
// notePlayHandle::play_note()
// add sub-note to base-note - now all stuff is done by
// notePlayHandle::playNote()
_n->addSubNote( note_play_handle );
// update counters
frames_processed += arp_frames;
cur_frame += arp_frames;
}
// make sure, note is handled as arp-base-note, even if we didn't add a
// sub-note so far
_n->setArpNote( TRUE );
}
@@ -607,6 +639,9 @@ void arpAndChordsTabWidget::saveSettings( QDomDocument & _doc,
QDomElement & _parent )
{
QDomElement act_de = _doc.createElement( nodeName() );
<<<<<<< arp_and_chords_tab_widget.cpp
act_de.setAttribute( "chorddisabled", !m_chordsGroupBox->isActive() );
=======
act_de.setAttribute( "chorddisabled", !m_chordsGroupBox->isActive() );
#ifdef QT4
act_de.setAttribute( "chord", m_chordsComboBox->currentIndex() );
@@ -615,6 +650,32 @@ void arpAndChordsTabWidget::saveSettings( QDomDocument & _doc,
#endif
act_de.setAttribute( "chordrange", m_chordRangeKnob->value() );
act_de.setAttribute( "arpdisabled", !m_arpGroupBox->isActive() );
>>>>>>> 1.11
#ifdef QT4
<<<<<<< arp_and_chords_tab_widget.cpp
act_de.setAttribute( "chord", m_chordsComboBox->currentIndex() );
=======
act_de.setAttribute( "arp", m_arpComboBox->currentIndex() );
>>>>>>> 1.11
#else
<<<<<<< arp_and_chords_tab_widget.cpp
act_de.setAttribute( "chord", m_chordsComboBox->currentItem() );
=======
act_de.setAttribute( "arp", m_arpComboBox->currentItem() );
>>>>>>> 1.11
#endif
<<<<<<< arp_and_chords_tab_widget.cpp
act_de.setAttribute( "chordrange", m_chordRangeKnob->value() );
=======
act_de.setAttribute( "arprange", m_arpRangeKnob->value() );
act_de.setAttribute( "arptime", m_arpTimeKnob->value() );
act_de.setAttribute( "arpgate", m_arpGateKnob->value() );
act_de.setAttribute( "arpdir", m_arpDirection );
act_de.setAttribute( "arpsyncmode",
( int ) m_arpTimeKnob->getSyncMode() );
>>>>>>> 1.11
act_de.setAttribute( "arpdisabled", !m_arpGroupBox->isActive() );
#ifdef QT4
act_de.setAttribute( "arp", m_arpComboBox->currentIndex() );
@@ -628,7 +689,7 @@ void arpAndChordsTabWidget::saveSettings( QDomDocument & _doc,
act_de.setAttribute( "arpsyncmode",
( int ) m_arpTimeKnob->getSyncMode() );
act_de.setAttribute( "sortmode", m_sortMode->isChecked() );
_parent.appendChild( act_de );
}
@@ -659,6 +720,8 @@ void arpAndChordsTabWidget::loadSettings( const QDomElement & _this )
( tempoSyncKnob::tempoSyncMode ) _this.attribute(
"arpsyncmode" ).toInt() );
m_sortMode->setChecked( _this.attribute( "sortmode" ).toInt() );
m_arpGroupBox->setState( m_arpDirection != OFF &&
!_this.attribute( "arpdisabled" ).toInt() );
switch( m_arpDirection )

View File

@@ -1,7 +1,7 @@
/*
* config_mgr.cpp - implementation of class configManager
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -59,6 +59,8 @@
#include <qradiobutton.h>
#include <qapplication.h>
#define absolutePath absPath
#ifndef __USE_XOPEN_EXTENDED
#define __USE_XOPEN_EXTENDED
#endif
@@ -153,31 +155,27 @@ configManager * configManager::s_instanceOfMe = NULL;
configManager::configManager( void ) :
QDialog(),
#ifdef QT4
m_lmmsRcFile( QDir::home().absolutePath() + "/.lmmsrc.xml" ),
m_lmmsWorkingDir( QDir::home().absolutePath() + "/lmms" ),
#else
m_lmmsRcFile( QDir::home().absPath() + "/.lmmsrc.xml" ),
m_lmmsWorkingDir( QDir::home().absPath() + "/lmms" ),
#endif
m_workingDir( QDir::home().absolutePath() + "/lmms" ),
#if QT_VERSION >= 0x030200
m_lmmsDataDir( qApp->applicationDirPath().section( '/', 0, -2 ) +
m_dataDir( qApp->applicationDirPath().section( '/', 0, -2 ) +
"/share/lmms/" ),
#else
// hardcode since qt < 3.2 doesn't know something like
// applicationDirPath and implementing own function would be senseless
// since real support for qt < 3.2 is senseless too ;-)
m_lmmsDataDir( "/usr/share/lmms" ),
m_dataDir( "/usr/share/lmms" ),
#endif
#if QT_VERSION >= 0x030200
m_lmmsPluginDir( qApp->applicationDirPath().section( '/', 0, -2 ) +
m_pluginDir( qApp->applicationDirPath().section( '/', 0, -2 ) +
"/lib/lmms/" ),
#else
// hardcode since qt < 3.2 doesn't know something like
// applicationDirPath and implementing own function would be senseless
// since real support for qt < 3.2 is senseless too ;-)
m_lmmsPluginDir( "/usr/lib/lmms" ),
m_pluginDir( "/usr/lib/lmms" ),
#endif
m_vstDir( QDir::home().absolutePath() ),
m_currentPage( 0 )
{
}
@@ -335,8 +333,7 @@ void configManager::createWidgets( void )
workingdir_input_fields_layout->setSpacing( 10 );
workingdir_input_fields_layout->setMargin( 0 );
m_wdLineEdit = new QLineEdit( m_lmmsWorkingDir,
workingdir_input_fields );
m_wdLineEdit = new QLineEdit( m_workingDir, workingdir_input_fields );
connect( m_wdLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setWorkingDir( const QString & ) ) );
@@ -516,12 +513,11 @@ void configManager::openWorkingDir( void )
{
#ifdef QT4
QString new_dir = QFileDialog::getExistingDirectory( this,
tr( "Choose LMMS-working-directory" ),
m_lmmsWorkingDir );
tr( "Choose LMMS working directory" ),
m_workingDir );
#else
QString new_dir = QFileDialog::getExistingDirectory( m_lmmsWorkingDir,
0, 0,
tr( "Choose LMMS-working-directory" ),
QString new_dir = QFileDialog::getExistingDirectory( m_workingDir, 0, 0,
tr( "Choose LMMS working directory" ),
TRUE );
#endif
if( new_dir != QString::null )
@@ -535,7 +531,15 @@ void configManager::openWorkingDir( void )
void configManager::setWorkingDir( const QString & _wd )
{
m_lmmsWorkingDir = _wd;
m_workingDir = _wd;
}
void configManager::setVSTDir( const QString & _vd )
{
m_vstDir = _vd;
}
@@ -543,11 +547,11 @@ void configManager::setWorkingDir( const QString & _wd )
void configManager::accept( void )
{
if( m_lmmsWorkingDir.right( 1 ) != "/" )
if( m_workingDir.right( 1 ) != "/" )
{
m_lmmsWorkingDir += '/';
m_workingDir += '/';
}
if( !QDir( m_lmmsWorkingDir ).exists() )
if( !QDir( m_workingDir ).exists() )
{
if( QMessageBox::
#if QT_VERSION >= 0x030200
@@ -562,7 +566,7 @@ void configManager::accept( void )
QMessageBox::Yes, QMessageBox::No )
== QMessageBox::Yes )
{
mkPath( m_lmmsWorkingDir );
mkPath( m_workingDir );
}
else
{
@@ -570,23 +574,21 @@ void configManager::accept( void )
return;
}
}
processFilesRecursively( m_lmmsDataDir + "samples/", m_lmmsWorkingDir +
processFilesRecursively( m_dataDir + "samples/", m_workingDir +
"samples/",
m_samplesCopyRB->isChecked() ?
&copyFile :
&linkFile );
processFilesRecursively( m_lmmsDataDir + "presets/", m_lmmsWorkingDir +
processFilesRecursively( m_dataDir + "presets/", m_workingDir +
"presets/",
m_presetsCopyRB->isChecked() ?
&copyFile :
&linkFile );
processFilesRecursively( m_lmmsDataDir + "projects/", m_lmmsWorkingDir +
processFilesRecursively( m_dataDir + "projects/", m_workingDir +
"projects/",
m_projectsCopyRB->isChecked() ?
&copyFile :
&linkFile );
setValue( "paths", "workingdir", m_lmmsWorkingDir );
saveConfigFile();
QDialog::accept();
@@ -825,7 +827,13 @@ bool configManager::loadConfigFile( void )
node = node.nextSibling();
}
m_lmmsWorkingDir = value( "paths", "workingdir" );
m_workingDir = value( "paths", "workingdir" );
m_vstDir = value( "paths", "vstdir" );
if( m_vstDir == "" )
{
m_vstDir = QDir::home().absolutePath();
}
return( TRUE );
}
@@ -835,6 +843,9 @@ bool configManager::loadConfigFile( void )
void configManager::saveConfigFile( void )
{
setValue( "paths", "workingdir", m_workingDir );
setValue( "paths", "vstdir", m_vstDir );
QDomDocument doc( "lmms-config-file" );
QDomElement lmms_config = doc.createElement( "lmms" );

View File

@@ -32,6 +32,7 @@
#include "midi.h"
#include "midi_port.h"
#include "song_editor.h"
#include "piano_widget.h"
@@ -57,6 +58,7 @@ notePlayHandle::notePlayHandle( channelTrack * _chnl_trk,
m_muted( FALSE )
{
setFrames( _frames );
m_channelTrack->m_pianoWidget->setKeyState( key(), TRUE );
// send MIDI-note-on-event
m_channelTrack->processOutEvent( midiEvent( NOTE_ON,
m_channelTrack->m_midiPort->outputChannel(),
@@ -241,6 +243,7 @@ void notePlayHandle::noteOff( Uint32 _s )
{
m_releaseFramesToDo =
m_channelTrack->m_envWidget->releaseFrames();
m_channelTrack->m_pianoWidget->setKeyState( key(), FALSE );
// send MIDI-note-off-event
m_channelTrack->processOutEvent( midiEvent( NOTE_OFF,
m_channelTrack->m_midiPort->outputChannel(),
@@ -301,3 +304,72 @@ void notePlayHandle::mute( void )
m_muted = TRUE;
}
int notePlayHandle::index( void ) const
{
const playHandleVector & phv = mixer::inst()->playHandles();
int idx = 0;
for( constPlayHandleVector::const_iterator it = phv.begin();
it != phv.end(); ++it )
{
const notePlayHandle * nph =
dynamic_cast<const notePlayHandle *>( *it );
if( nph == NULL || nph->m_channelTrack != m_channelTrack ||
nph->released() == TRUE )
{
continue;
}
if( nph == this )
{
break;
}
++idx;
}
return( idx );
}
constNotePlayHandleVector notePlayHandle::nphsOfChannelTrack(
const channelTrack * _ct )
{
const playHandleVector & phv = mixer::inst()->playHandles();
constNotePlayHandleVector cnphv;
for( constPlayHandleVector::const_iterator it = phv.begin();
it != phv.end(); ++it )
{
const notePlayHandle * nph =
dynamic_cast<const notePlayHandle *>( *it );
if( nph != NULL && nph->m_channelTrack == _ct &&
nph->released() == FALSE )
{
cnphv.push_back( nph );
}
}
return( cnphv );
}
bool notePlayHandle::operator==( const notePlayHandle & _nph ) const
{
return( length() == _nph.length() &&
pos() == _nph.pos() &&
key() == _nph.key() &&
getVolume() == _nph.getVolume() &&
getPanning() == _nph.getPanning() &&
m_channelTrack == _nph.m_channelTrack &&
m_frames == _nph.m_frames &&
m_framesAhead == _nph.m_framesAhead &&
m_totalFramesPlayed == _nph.m_totalFramesPlayed &&
m_released == _nph.m_released &&
m_baseNote == _nph.m_baseNote &&
m_arpNote == _nph.m_arpNote &&
m_muted == _nph.m_muted );
}

View File

@@ -524,7 +524,12 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern )
inline void pianoRoll::drawNoteRect( QPainter & _p, Uint16 _x, Uint16 _y,
<<<<<<< piano_roll.cpp
Sint16 _width, const bool _is_selected,
const bool _is_step_note )
=======
Sint16 _width, const bool _is_selected )
>>>>>>> 1.14
{
++_x;
++_y;
@@ -536,7 +541,11 @@ inline void pianoRoll::drawNoteRect( QPainter & _p, Uint16 _x, Uint16 _y,
}
QColor current_color( 0xFF, 0xB0, 0x00 );
if( _is_selected )
if( _is_step_note == TRUE )
{
current_color.setRgb( 0, 255, 0 );
}
else if( _is_selected == TRUE )
{
current_color.setRgb( 0x00, 0x40, 0xC0 );
}
@@ -815,10 +824,15 @@ void pianoRoll::update( void )
{
Sint32 len_tact_64th = ( *it )->length();
if( len_tact_64th <= 0 )
if( len_tact_64th == 0 )
{
continue;
}
else if( len_tact_64th < 0 )
{
len_tact_64th = 4;
}
const int key = ( *it )->key() - m_startKey + 1;
Sint32 pos_tact_64th = ( *it )->pos();
@@ -865,7 +879,8 @@ void pianoRoll::update( void )
drawNoteRect( p, x + WHITE_KEY_WIDTH,
y_base - key * KEY_LINE_HEIGHT,
note_width,
is_selected );
is_selected,
( *it )->length() < 0 );
}
// draw volume-line of note
p.setPen( QPen( QColor( 0, 255, 0 ), NE_LINE_WIDTH ) );
@@ -919,6 +934,7 @@ void pianoRoll::update( void )
void pianoRoll::removeSelection( void )
{
<<<<<<< piano_roll.cpp
m_selectStartTact64th = 0;
m_selectedTact64th = 0;
m_selectStartKey = 0;
@@ -926,8 +942,29 @@ void pianoRoll::removeSelection( void )
}
=======
m_selectStartTact64th = 0;
m_selectedTact64th = 0;
m_selectStartKey = 0;
m_selectedKeys = 0;
}
>>>>>>> 1.14
<<<<<<< piano_roll.cpp
void pianoRoll::closeEvent( QCloseEvent * _ce )
{
QApplication::restoreOverrideCursor();
hide();
_ce->ignore ();
}
=======
>>>>>>> 1.14
<<<<<<< piano_roll.cpp
=======
void pianoRoll::closeEvent( QCloseEvent * _ce )
{
QApplication::restoreOverrideCursor();
@@ -936,6 +973,7 @@ void pianoRoll::closeEvent( QCloseEvent * _ce )
}
>>>>>>> 1.14
void pianoRoll::enterEvent( QEvent * _e )
@@ -1065,14 +1103,27 @@ void pianoRoll::keyPressEvent( QKeyEvent * _ke )
_ke->ignore();
break;
}
<<<<<<< piano_roll.cpp
}
=======
}
>>>>>>> 1.14
<<<<<<< piano_roll.cpp
void pianoRoll::leaveEvent( QEvent * _e )
{
while( QApplication::overrideCursor() != NULL )
=======
void pianoRoll::leaveEvent( QEvent * _e )
{
while( QApplication::overrideCursor() != NULL )
>>>>>>> 1.14
{
QApplication::restoreOverrideCursor();
}
@@ -1122,14 +1173,18 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
// loop through whole note-vector...
while( it != notes.end() )
{
midiTime len = ( *it )->length();
if( len < 0 )
{
len = 4;
}
// and check whether the user clicked on an
// existing note or an edit-line
if( pos_tact_64th >= ( *it )->pos() &&
( *it )->length() > 0 &&
len > 0 &&
(
( edit_note == FALSE &&
pos_tact_64th <= ( *it )->pos() +
( *it )->length() &&
pos_tact_64th <= ( *it )->pos() + len &&
( *it )->key() == key_num )
||
( edit_note == TRUE &&
@@ -1202,7 +1257,8 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
// clicked at the "tail" of the note?
if( pos_tact_64th > m_currentNote->pos() +
m_currentNote->length() -
RESIZE_AREA_WIDTH )
RESIZE_AREA_WIDTH &&
m_currentNote->length() > 0 )
{
// then resize the note
m_action = RESIZE_NOTE;
@@ -1237,10 +1293,17 @@ void pianoRoll::mousePressEvent( QMouseEvent * _me )
play_note = FALSE;
if( it != notes.end() )
{
m_pattern->removeNote( *it );
if( ( *it )->length() > 0 )
{
m_pattern->removeNote( *it );
}
else
{
( *it )->setLength( 0 );
m_pattern->update();
}
songEditor::inst()->setModified();
}
songEditor::inst()->setModified();
}
else if( _me->button() == Qt::LeftButton &&
m_editMode == SELECT )
@@ -1497,7 +1560,7 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
pos_tact_64th <= ( *it )->pos() +
( *it )->length() &&
( *it )->key() == key_num &&
(*it )->length() > 0 )
( *it )->length() > 0 )
{
break;
}
@@ -1509,7 +1572,8 @@ void pianoRoll::mouseMoveEvent( QMouseEvent * _me )
if( it != notes.end() )
{
// cursor at the "tail" of the note?
if( pos_tact_64th > ( *it )->pos() +
if( ( *it )->length() > 0 &&
pos_tact_64th > ( *it )->pos() +
( *it )->length() -
RESIZE_AREA_WIDTH )
{

View File

@@ -2,7 +2,7 @@
* piano_widget.cpp - implementation of piano-widget used in channel-window
* for testing channel
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -119,7 +119,7 @@ pianoWidget::pianoWidget (channelTrack * _parent ) :
4 );
m_pianoScroll->setSingleStep( 1 );
m_pianoScroll->setPageStep( 20 );
m_pianoScroll->setValue( OCTAVE_3*WHITE_KEYS_PER_OCTAVE );
m_pianoScroll->setValue( OCTAVE_3 * WHITE_KEYS_PER_OCTAVE );
#else
// create scrollbar below piano-widget...
m_pianoScroll = new QScrollBar( 0, WHITE_KEYS_PER_OCTAVE *

View File

@@ -1,7 +1,7 @@
/*
* setup_dialog.cpp - dialog for setting up LMMS
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -33,6 +33,8 @@
#include <QWhatsThis>
#include <QComboBox>
#include <QMessageBox>
#include <QLineEdit>
#include <QFileDialog>
#else
@@ -42,6 +44,8 @@
#include <qwhatsthis.h>
#include <qcombobox.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qfiledialog.h>
#endif
@@ -100,10 +104,13 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
m_classicalKnobUsability( configManager::inst()->value( "knobs",
"classicalusability" ).toInt() ),
m_gimpLikeWindows( configManager::inst()->value( "app",
"gimplikewindows" ).toInt() )
"gimplikewindows" ).toInt() ),
m_workingDir( configManager::inst()->workingDir() ),
m_vstDir( configManager::inst()->vstDir() )
{
setWindowIcon( embed::getIconPixmap( "setup_general" ) );
setWindowTitle( tr( "Setup LMMS" ) );
setModal( TRUE );
QVBoxLayout * vlayout = new QVBoxLayout( this );
vlayout->setSpacing( 0 );
@@ -206,6 +213,59 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
QWidget * directories = new QWidget( ws );
directories->setFixedSize( 360, 200 );
QVBoxLayout * dir_layout = new QVBoxLayout( directories );
dir_layout->setSpacing( 0 );
dir_layout->setMargin( 0 );
labelWidget( directories, tr( "Directories" ) );
// working-dir
tabWidget * lmms_wd_tw = new tabWidget( tr(
"LMMS working directory" ).toUpper(),
directories );
lmms_wd_tw->setFixedHeight( 56 );
m_wdLineEdit = new QLineEdit( m_workingDir, lmms_wd_tw );
m_wdLineEdit->setGeometry( 10, 20, 300, 16 );
connect( m_wdLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setWorkingDir( const QString & ) ) );
QPushButton * workingdir_select_btn = new QPushButton(
embed::getIconPixmap( "project_open", 16, 16 ),
"", lmms_wd_tw );
workingdir_select_btn->setFixedSize( 24, 24 );
workingdir_select_btn->move( 320, 20 );
connect( workingdir_select_btn, SIGNAL( clicked() ), this,
SLOT( openWorkingDir() ) );
// vst-dir
tabWidget * vst_tw = new tabWidget( tr(
"VST-plugin directory" ).toUpper(),
directories );
vst_tw->setFixedHeight( 56 );
m_vdLineEdit = new QLineEdit( m_vstDir, vst_tw );
m_vdLineEdit->setGeometry( 10, 20, 300, 16 );
connect( m_vdLineEdit, SIGNAL( textChanged( const QString & ) ), this,
SLOT( setVSTDir( const QString & ) ) );
QPushButton * vstdir_select_btn = new QPushButton(
embed::getIconPixmap( "project_open", 16, 16 ),
"", vst_tw );
vstdir_select_btn->setFixedSize( 24, 24 );
vstdir_select_btn->move( 320, 20 );
connect( vstdir_select_btn, SIGNAL( clicked() ), this,
SLOT( openVSTDir() ) );
dir_layout->addWidget( lmms_wd_tw );
dir_layout->addSpacing( 10 );
dir_layout->addWidget( vst_tw );
dir_layout->addStretch();
QWidget * audio = new QWidget( ws );
audio->setFixedSize( 360, 200 );
@@ -381,9 +441,12 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
m_tabBar->addTab( general, tr( "General settings" ), 0, FALSE, TRUE
)->setIcon( embed::getIconPixmap( "setup_general" ) );
m_tabBar->addTab( audio, tr( "Audio settings" ), 1, FALSE, TRUE
m_tabBar->addTab( directories, tr( "Directories" ), 1, FALSE, TRUE
)->setIcon( embed::getIconPixmap(
"setup_directories" ) );
m_tabBar->addTab( audio, tr( "Audio settings" ), 2, FALSE, TRUE
)->setIcon( embed::getIconPixmap( "setup_audio" ) );
m_tabBar->addTab( midi, tr( "MIDI settings" ), 2, TRUE, TRUE
m_tabBar->addTab( midi, tr( "MIDI settings" ), 3, TRUE, TRUE
)->setIcon( embed::getIconPixmap( "setup_midi" ) );
#undef setIcon
@@ -452,6 +515,10 @@ void setupDialog::accept( void )
QString::number( m_classicalKnobUsability ) );
configManager::inst()->setValue( "app", "gimplikewindows",
QString::number( m_gimpLikeWindows ) );
configManager::inst()->setWorkingDir( m_workingDir );
configManager::inst()->setVSTDir( m_vstDir );
// tell all audio-settings-widget to save their settings
for( aswMap::iterator it = m_audioIfaceSetupWidgets.begin();
it != m_audioIfaceSetupWidgets.end(); ++it )
@@ -531,6 +598,64 @@ void setupDialog::displayBufSizeHelp( void )
void setupDialog::openWorkingDir( void )
{
#ifdef QT4
QString new_dir = QFileDialog::getExistingDirectory( this,
tr( "Choose LMMS working directory" ),
m_workingDir );
#else
QString new_dir = QFileDialog::getExistingDirectory( m_workingDir,
0, 0,
tr( "Choose LMMS working directory" ),
TRUE );
#endif
if( new_dir != QString::null )
{
m_wdLineEdit->setText( new_dir );
}
}
void setupDialog::setWorkingDir( const QString & _wd )
{
m_workingDir = _wd;
}
void setupDialog::openVSTDir( void )
{
#ifdef QT4
QString new_dir = QFileDialog::getExistingDirectory( this,
tr( "Choose your VST-plugin directory" ),
m_vstDir );
#else
QString new_dir = QFileDialog::getExistingDirectory( m_vstDir,
0, 0,
tr( "Choose your VST-plugin directory" ),
TRUE );
#endif
if( new_dir != QString::null )
{
m_vdLineEdit->setText( new_dir );
}
}
void setupDialog::setVSTDir( const QString & _vd )
{
m_vstDir = _vd;
}
void setupDialog::audioInterfaceChanged( const QString & _iface )
{
for( aswMap::iterator it = m_audioIfaceSetupWidgets.begin();

View File

@@ -1,7 +1,7 @@
/*
* pattern.cpp - implementation of class pattern which holds notes
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005 Danny McRae <khjklujn@yahoo.com>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
@@ -790,6 +790,10 @@ void pattern::mousePressEvent( QMouseEvent * _me )
}
songEditor::inst()->setModified();
update();
if( pianoRoll::inst()->currentPattern() == this )
{
pianoRoll::inst()->update();
}
}
else if( m_frozenPattern != NULL && _me->button() == Qt::LeftButton &&
lmmsMainWin::isShiftPressed() == TRUE )
@@ -849,11 +853,23 @@ void pattern::wheelEvent( QWheelEvent * _we )
}
songEditor::inst()->setModified();
update();
<<<<<<< pattern.cpp
if( pianoRoll::inst()->currentPattern() == this )
{
pianoRoll::inst()->update();
}
_we->accept();
}
else
{
trackContentObject::wheelEvent( _we );
=======
_we->accept();
}
else
{
trackContentObject::wheelEvent( _we );
>>>>>>> 1.12
}
}

View File

@@ -1,7 +1,7 @@
/*
* led_checkbox.cpp - class ledCheckBox, an improved QCheckBox
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -148,7 +148,7 @@ void ledCheckBox::paintEvent( QPaintEvent * )
p.drawPixmap( 0, 0, *m_ledOffPixmap );
}
p.drawText( m_ledOffPixmap->width() + 2, 10, text() );
p.drawText( m_ledOffPixmap->width() + 2, 8, text() );
#ifndef QT4
// and blit all the drawn stuff on the screen...

View File

@@ -1,7 +1,8 @@
/*
* tempo_sync_knob.h - adds bpm to ms conversion for knob class
* tempo_sync_knob.cpp - adds bpm to ms conversion for knob class
*
* Copyright (c) 2005 Danny McRae <khjklujn@yahoo.com>
* Copyright (c) 2005 Danny McRae <khjklujn/at/yahoo.com>
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -27,21 +28,15 @@
#ifdef QT4
#include <QPainter>
#include <QPalette>
#include <QBitmap>
#include <QLabel>
#include <QStatusBar>
#include <QMouseEvent>
#include <QMenu>
#include <QStatusBar>
#include <QFontMetrics>
#include <QApplication>
#else
#include <qlabel.h>
#include <qpopupmenu.h>
#include <qcursor.h>
#define addSeparator insertSeparator
#define addMenu insertItem
@@ -52,9 +47,6 @@
#include "tempo_sync_knob.h"
#include "song_editor.h"
#include "embed.h"
#include "tooltip.h"
#include "config_mgr.h"
#include "text_float.h"