global clipboard, groupbox automation, volume vector, several segfaults
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@486 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -648,11 +648,11 @@ void arpAndChordsTabWidget::processNote( notePlayHandle * _n )
|
||||
void arpAndChordsTabWidget::saveSettings( QDomDocument & _doc,
|
||||
QDomElement & _this )
|
||||
{
|
||||
_this.setAttribute( "chorddisabled", !m_chordsGroupBox->isActive() );
|
||||
m_chordsGroupBox->saveSettings( _doc, _this, "chord-enabled" );
|
||||
m_chordsComboBox->saveSettings( _doc, _this, "chord" );
|
||||
m_chordRangeKnob->saveSettings( _doc, _this, "chordrange" );
|
||||
|
||||
_this.setAttribute( "arpdisabled", !m_arpGroupBox->isActive() );
|
||||
m_arpGroupBox->saveSettings( _doc, _this, "arp-enabled" );
|
||||
m_arpComboBox->saveSettings( _doc, _this, "arp" );
|
||||
m_arpRangeKnob->saveSettings( _doc, _this, "arprange" );
|
||||
m_arpTimeKnob->saveSettings( _doc, _this, "arptime" );
|
||||
@@ -667,16 +667,16 @@ void arpAndChordsTabWidget::saveSettings( QDomDocument & _doc,
|
||||
|
||||
void arpAndChordsTabWidget::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
m_chordsGroupBox->setState( !_this.attribute
|
||||
( "chorddisabled" ).toInt() );
|
||||
m_chordsGroupBox->loadSettings( _this, "chord-enabled" );
|
||||
m_chordsComboBox->loadSettings( _this, "chord" );
|
||||
m_chordRangeKnob->loadSettings( _this, "chordrange" );
|
||||
|
||||
m_arpGroupBox->loadSettings( _this, "arp-enabled" );
|
||||
m_arpComboBox->loadSettings( _this, "arp" );
|
||||
m_arpRangeKnob->loadSettings( _this, "arprange" );
|
||||
m_arpTimeKnob->loadSettings( _this, "arptime" );
|
||||
m_arpGateKnob->loadSettings( _this, "arpgate" );
|
||||
m_arpDirectionBtnGrp->loadSettings( _this, "arpdir" );
|
||||
m_arpGroupBox->setState( !_this.attribute( "arpdisabled" ).toInt() );
|
||||
|
||||
// Keep compatibility with version 2.1 file format
|
||||
if( _this.hasAttribute( "arpsyncmode" ) )
|
||||
|
||||
@@ -83,6 +83,8 @@ void engine::init( const bool _has_gui )
|
||||
|
||||
s_mainWindow->finalize();
|
||||
|
||||
presetPreviewPlayHandle::init();
|
||||
|
||||
s_mixer->startProcessing();
|
||||
}
|
||||
|
||||
@@ -110,10 +112,6 @@ void engine::destroy( void )
|
||||
|
||||
presetPreviewPlayHandle::cleanUp();
|
||||
|
||||
// now we can clean up all allocated buffer
|
||||
//bufferAllocator::cleanUp( 0 );
|
||||
|
||||
|
||||
delete s_mixer;
|
||||
s_mixer = NULL;
|
||||
//delete configManager::inst();
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include "instrument_track.h"
|
||||
#include "knob.h"
|
||||
#include "note_play_handle.h"
|
||||
#include "pixmap_button.h"
|
||||
#include "tab_widget.h"
|
||||
|
||||
|
||||
@@ -468,7 +467,7 @@ void envelopeTabWidget::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
m_filterComboBox->saveSettings( _doc, _this, "ftype" );
|
||||
m_filterCutKnob->saveSettings( _doc, _this, "fcut" );
|
||||
m_filterResKnob->saveSettings( _doc, _this, "fres" );
|
||||
_this.setAttribute( "fwet", m_filterGroupBox->isActive() );
|
||||
m_filterGroupBox->saveSettings( _doc, _this, "fwet" );
|
||||
|
||||
for( int i = 0; i < TARGET_COUNT; ++i )
|
||||
{
|
||||
@@ -486,8 +485,7 @@ void envelopeTabWidget::loadSettings( const QDomElement & _this )
|
||||
m_filterComboBox->loadSettings( _this, "ftype" );
|
||||
m_filterCutKnob->loadSettings( _this, "fcut" );
|
||||
m_filterResKnob->loadSettings( _this, "fres" );
|
||||
/* m_filterState->setChecked( _this.attribute( "fwet" ).toInt() );*/
|
||||
m_filterGroupBox->setState( _this.attribute( "fwet" ).toInt() );
|
||||
m_filterGroupBox->loadSettings( _this, "fwet" );
|
||||
|
||||
QDomNode node = _this.firstChild();
|
||||
while( !node.isNull() )
|
||||
|
||||
@@ -123,7 +123,11 @@ void fileBrowser::reloadTree( void )
|
||||
addItems( *it );
|
||||
}
|
||||
|
||||
#ifndef QT3
|
||||
Q3ListViewItem * item = m_l->firstChild();
|
||||
#else
|
||||
QListViewItem * item = m_l->firstChild();
|
||||
#endif
|
||||
bool resort = FALSE;
|
||||
|
||||
// sort merged directories
|
||||
@@ -136,7 +140,11 @@ void fileBrowser::reloadTree( void )
|
||||
}
|
||||
else if( resort == TRUE )
|
||||
{
|
||||
#ifndef QT3
|
||||
Q3ListViewItem * i2 = m_l->firstChild();
|
||||
#else
|
||||
QListViewItem * i2 = m_l->firstChild();
|
||||
#endif
|
||||
d->moveItem( i2 );
|
||||
i2->moveItem( d );
|
||||
directory * d2 = NULL;
|
||||
@@ -191,7 +199,11 @@ void fileBrowser::addItems( const QString & _path )
|
||||
isDirWithContent( _path + QDir::separator() + cur_file,
|
||||
m_filter ) )
|
||||
{
|
||||
#ifdef QT4
|
||||
Q3ListViewItem * item = m_l->findItem( cur_file, 0 );
|
||||
#else
|
||||
QListViewItem * item = m_l->findItem( cur_file, 0 );
|
||||
#endif
|
||||
if( item == NULL )
|
||||
{
|
||||
(void) new directory( m_l, cur_file, _path,
|
||||
@@ -262,7 +274,6 @@ void fileBrowser::keyPressEvent( QKeyEvent * _ke )
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef QT4
|
||||
void fileBrowser::contextMenuRequest( Q3ListViewItem * i, const QPoint &, int )
|
||||
#else
|
||||
@@ -296,6 +307,17 @@ void fileBrowser::contextMenuRequest( QListViewItem * i, const QPoint &, int )
|
||||
|
||||
|
||||
|
||||
#ifdef QT4
|
||||
void fileBrowser::contextMenuRequest( QListViewItem * i, const QPoint &, int )
|
||||
#else
|
||||
void fileBrowser::contextMenuRequest( Q3ListViewItem * i, const QPoint &, int )
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void fileBrowser::sendToActiveInstrumentTrack( void )
|
||||
{
|
||||
if( engine::getMainWindow()->workspace() == NULL )
|
||||
@@ -517,7 +539,11 @@ void listView::contentsMousePressEvent( QMouseEvent * _me )
|
||||
}
|
||||
|
||||
QPoint p( contentsToViewport( _me->pos() ) );
|
||||
#ifndef QT3
|
||||
Q3ListViewItem * i = itemAt( p );
|
||||
#else
|
||||
QListViewItem * i = itemAt( p );
|
||||
#endif
|
||||
if ( i )
|
||||
{
|
||||
if ( p.x() > header()->cellPos( header()->mapToActual( 0 ) ) +
|
||||
@@ -660,7 +686,11 @@ QPixmap * directory::s_folderLockedPixmap = NULL;
|
||||
|
||||
directory::directory( directory * _parent, const QString & _name,
|
||||
const QString & _path, const QString & _filter ) :
|
||||
#ifndef QT3
|
||||
Q3ListViewItem( _parent, _name ),
|
||||
#else
|
||||
QListViewItem( _parent, _name ),
|
||||
#endif
|
||||
m_p( _parent ),
|
||||
m_pix( NULL ),
|
||||
m_directories( _path ),
|
||||
@@ -674,7 +704,11 @@ directory::directory( directory * _parent, const QString & _name,
|
||||
|
||||
directory::directory( Q3ListView * _parent, const QString & _name,
|
||||
const QString & _path, const QString & _filter ) :
|
||||
#ifndef QT3
|
||||
Q3ListViewItem( _parent, _name ),
|
||||
#else
|
||||
QListViewItem( _parent, _name ),
|
||||
#endif
|
||||
m_p( NULL ),
|
||||
m_pix( NULL ),
|
||||
m_directories( _path ),
|
||||
@@ -752,13 +786,21 @@ void directory::setOpen( bool _o )
|
||||
( *it ).contains(
|
||||
configManager::inst()->dataDir() ) )
|
||||
{
|
||||
#ifndef QT3
|
||||
( new Q3ListViewItem( this,
|
||||
#else
|
||||
( new QListViewItem( this,
|
||||
#endif
|
||||
listView::tr( "--- Factory files ---" ) ) )->setPixmap( 0,
|
||||
embed::getIconPixmap( "factory_files" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef QT3
|
||||
Q3ListViewItem::setOpen( _o );
|
||||
#else
|
||||
QListViewItem::setOpen( _o );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -767,7 +809,11 @@ void directory::setOpen( bool _o )
|
||||
void directory::setup( void )
|
||||
{
|
||||
setExpandable( TRUE );
|
||||
#ifndef QT3
|
||||
Q3ListViewItem::setup();
|
||||
#else
|
||||
QListViewItem::setup();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -863,7 +909,11 @@ QPixmap * fileItem::s_unknownFilePixmap = NULL;
|
||||
|
||||
fileItem::fileItem( Q3ListView * _parent, const QString & _name,
|
||||
const QString & _path ) :
|
||||
#ifndef QT3
|
||||
Q3ListViewItem( _parent, _name ),
|
||||
#else
|
||||
QListViewItem( _parent, _name ),
|
||||
#endif
|
||||
m_pix( NULL ),
|
||||
m_path( _path )
|
||||
{
|
||||
@@ -875,9 +925,15 @@ fileItem::fileItem( Q3ListView * _parent, const QString & _name,
|
||||
|
||||
|
||||
|
||||
#ifndef QT3
|
||||
fileItem::fileItem( Q3ListViewItem * _parent, const QString & _name,
|
||||
const QString & _path ) :
|
||||
Q3ListViewItem( _parent, _name ),
|
||||
#else
|
||||
fileItem::fileItem( QListViewItem * _parent, const QString & _name,
|
||||
const QString & _path ) :
|
||||
QListViewItem( _parent, _name ),
|
||||
#endif
|
||||
m_pix( NULL ),
|
||||
m_path( _path )
|
||||
{
|
||||
|
||||
@@ -273,8 +273,13 @@ void mainWindow::finalize( void )
|
||||
m_templatesMenu = new QMenu( project_new );
|
||||
connect( m_templatesMenu, SIGNAL( aboutToShow( void ) ),
|
||||
this, SLOT( fillTemplatesMenu( void ) ) );
|
||||
#ifdef QT4
|
||||
connect( m_templatesMenu, SIGNAL( triggered( QAction * ) ),
|
||||
this, SLOT( createNewProjectFromTemplate( QAction * ) ) );
|
||||
#else
|
||||
connect( m_templatesMenu, SIGNAL( activated( int ) ),
|
||||
this, SLOT( createNewProjectFromTemplate( int ) ) );
|
||||
#endif
|
||||
project_new->setMenu( m_templatesMenu );
|
||||
#ifdef QT4
|
||||
project_new->setPopupMode( toolButton::MenuButtonPopup );
|
||||
@@ -539,11 +544,13 @@ void mainWindow::finalize( void )
|
||||
{
|
||||
#ifdef QT4
|
||||
menuBar()->addMenu( m_tools_menu )->setText( tr( "&Tools" ) );
|
||||
connect( m_tools_menu, SIGNAL( triggered( QAction * ) ),
|
||||
this, SLOT( showTool( QAction * ) ) );
|
||||
#else
|
||||
menuBar()->insertItem( tr( "&Tools" ), m_tools_menu );
|
||||
#endif
|
||||
connect( m_tools_menu, SIGNAL( activated( int ) ),
|
||||
this, SLOT( showTool( int ) ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -724,23 +731,42 @@ void mainWindow::createNewProject( void )
|
||||
|
||||
|
||||
|
||||
void mainWindow::createNewProjectFromTemplate( int _idx )
|
||||
{
|
||||
#ifdef QT4
|
||||
// TODO!!!
|
||||
void mainWindow::createNewProjectFromTemplate( QAction * _idx )
|
||||
#else
|
||||
void mainWindow::createNewProjectFromTemplate( int _idx )
|
||||
#endif
|
||||
{
|
||||
if( m_templatesMenu != NULL &&
|
||||
engine::getSongEditor()->mayChangeProject() == TRUE )
|
||||
{
|
||||
#ifdef QT4
|
||||
QString dir_base = m_templatesMenu->actions().indexOf( _idx )
|
||||
#else
|
||||
QString dir_base = m_templatesMenu->indexOf( _idx )
|
||||
#endif
|
||||
>= m_custom_templates_count ?
|
||||
configManager::inst()->factoryProjectsDir() :
|
||||
configManager::inst()->userProjectsDir();
|
||||
engine::getSongEditor()->createNewProjectFromTemplate(
|
||||
dir_base + "templates/" +
|
||||
#ifdef QT4
|
||||
_idx->text() + ".mpt" );
|
||||
#else
|
||||
m_templatesMenu->text( _idx ) + ".mpt" );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef QT4
|
||||
void mainWindow::createNewProjectFromTemplate( int _idx )
|
||||
#else
|
||||
void mainWindow::createNewProjectFromTemplate( QAction * _idx )
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1094,15 +1120,30 @@ void mainWindow::fillTemplatesMenu( void )
|
||||
|
||||
|
||||
|
||||
#ifndef QT3
|
||||
void mainWindow::showTool( QAction * _idx )
|
||||
#else
|
||||
void mainWindow::showTool( int _idx )
|
||||
#endif
|
||||
{
|
||||
#ifndef QT3
|
||||
#warning TODO: Qt4-implementation
|
||||
tool * t = m_tools[m_tools_menu->actions().indexOf( _idx )];
|
||||
#else
|
||||
tool * t = m_tools[m_tools_menu->indexOf( _idx )];
|
||||
#endif
|
||||
t->show();
|
||||
t->setFocus();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef QT3
|
||||
void mainWindow::showTool( int _idx )
|
||||
#else
|
||||
void mainWindow::showTool( QAction * _idx )
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -299,19 +299,6 @@ void note::createDetuning( void )
|
||||
|
||||
|
||||
|
||||
void note::detachCurrentDetuning( void )
|
||||
{
|
||||
QDomDocument doc;
|
||||
QDomElement parent = doc.createElement( "clone" );
|
||||
m_detuning->saveSettings( doc, parent );
|
||||
sharedObject::unref( m_detuning );
|
||||
createDetuning();
|
||||
m_detuning->loadSettings( parent );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool note::hasDetuningInfo( void )
|
||||
{
|
||||
automationPattern::timeMap map =
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <Qt/QtXml>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include <QtGui/QClipboard>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtGui/QWheelEvent>
|
||||
@@ -43,10 +44,12 @@
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qbuttongroup.h>
|
||||
#include <qpainter.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlabel.h>
|
||||
#include <qclipboard.h>
|
||||
#include <qdom.h>
|
||||
#include <qdragobject.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpainter.h>
|
||||
|
||||
#define addButton insert
|
||||
#define setCheckable setToggleButton
|
||||
@@ -63,6 +66,7 @@
|
||||
|
||||
#include "piano_roll.h"
|
||||
#include "automatable_object_templates.h"
|
||||
#include "clipboard.h"
|
||||
#include "combobox.h"
|
||||
#include "debug.h"
|
||||
#include "detuning_helper.h"
|
||||
@@ -71,6 +75,7 @@
|
||||
#include "instrument_track.h"
|
||||
#include "main_window.h"
|
||||
#include "midi.h"
|
||||
#include "mmp.h"
|
||||
#include "pattern.h"
|
||||
#include "piano_widget.h"
|
||||
#include "pixmap_button.h"
|
||||
@@ -2159,7 +2164,7 @@ void pianoRoll::wheelEvent( QWheelEvent * _we )
|
||||
|
||||
|
||||
|
||||
int pianoRoll::getKey( int _y )
|
||||
int pianoRoll::getKey( int _y ) const
|
||||
{
|
||||
int key_line_y = height() - PR_BOTTOM_MARGIN - m_notesEditHeight - 1;
|
||||
// pressed key on piano
|
||||
@@ -2437,31 +2442,46 @@ void pianoRoll::getSelectedNotes( noteVector & _selected_notes )
|
||||
|
||||
|
||||
|
||||
void pianoRoll::copySelectedNotes( void )
|
||||
void pianoRoll::copy_to_clipboard( const noteVector & _notes ) const
|
||||
{
|
||||
for( noteVector::iterator it = m_notesToCopy.begin();
|
||||
it != m_notesToCopy.end(); ++it )
|
||||
multimediaProject mmp( multimediaProject::CLIPBOARD_DATA );
|
||||
QDomElement note_list = mmp.createElement( "note-list" );
|
||||
mmp.content().appendChild( note_list );
|
||||
|
||||
midiTime start_pos( _notes.front()->pos().getTact(), 0 );
|
||||
for( noteVector::const_iterator it = _notes.begin(); it != _notes.end();
|
||||
++it )
|
||||
{
|
||||
delete *it;
|
||||
note clip_note( **it );
|
||||
clip_note.setPos( clip_note.pos( start_pos ) );
|
||||
clip_note.saveState( mmp, note_list );
|
||||
}
|
||||
|
||||
m_notesToCopy.clear();
|
||||
#ifdef QT4
|
||||
QMimeData * clip_content = new QMimeData;
|
||||
clip_content->setData( clipboard::mimeType(), mmp.toString().toUtf8() );
|
||||
QApplication::clipboard()->setMimeData( clip_content,
|
||||
QClipboard::Clipboard );
|
||||
#else
|
||||
QStoredDrag * clip_content = new QStoredDrag( clipboard::mimeType() );
|
||||
clip_content->setEncodedData( mmp.toString().utf8() );
|
||||
QApplication::clipboard()->setData( clip_content,
|
||||
QClipboard::Clipboard );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void pianoRoll::copySelectedNotes( void )
|
||||
{
|
||||
noteVector selected_notes;
|
||||
getSelectedNotes( selected_notes );
|
||||
|
||||
if( selected_notes.empty() == FALSE )
|
||||
{
|
||||
midiTime start_pos( selected_notes.front()->pos().getTact(),
|
||||
0 );
|
||||
for( noteVector::iterator it = selected_notes.begin();
|
||||
it != selected_notes.end(); ++it )
|
||||
{
|
||||
m_notesToCopy.push_back( new note( **it ) );
|
||||
m_notesToCopy.back()->setPos( m_notesToCopy.back()->pos(
|
||||
start_pos ) );
|
||||
m_notesToCopy.back()->detachCurrentDetuning();
|
||||
}
|
||||
copy_to_clipboard( selected_notes );
|
||||
|
||||
textFloat::displayMessage( tr( "Notes copied" ),
|
||||
tr( "All selected notes were copied to the "
|
||||
"clipboard." ),
|
||||
@@ -2479,34 +2499,21 @@ void pianoRoll::cutSelectedNotes( void )
|
||||
return;
|
||||
}
|
||||
|
||||
for( noteVector::iterator it = m_notesToCopy.begin();
|
||||
it != m_notesToCopy.end(); ++it )
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
|
||||
m_notesToCopy.clear();
|
||||
|
||||
noteVector selected_notes;
|
||||
getSelectedNotes( selected_notes );
|
||||
|
||||
if( selected_notes.empty() == FALSE )
|
||||
{
|
||||
copy_to_clipboard( selected_notes );
|
||||
|
||||
engine::getSongEditor()->setModified();
|
||||
|
||||
midiTime start_pos( selected_notes.front()->pos().getTact(),
|
||||
0 );
|
||||
|
||||
while( selected_notes.empty() == FALSE )
|
||||
for( noteVector::iterator it = selected_notes.begin();
|
||||
it != selected_notes.end(); ++it )
|
||||
{
|
||||
note * new_note = new note( *selected_notes.front() );
|
||||
new_note->setPos( new_note->pos( start_pos ) );
|
||||
m_notesToCopy.push_back( new_note );
|
||||
|
||||
// note (the memory of it) is also deleted by
|
||||
// pattern::removeNote(...) so we don't have to do that
|
||||
m_pattern->removeNote( selected_notes.front() );
|
||||
selected_notes.erase( selected_notes.begin() );
|
||||
m_pattern->removeNote( *it );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2524,14 +2531,26 @@ void pianoRoll::pasteNotes( void )
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_notesToCopy.empty() == FALSE )
|
||||
#ifdef QT4
|
||||
QString value = QApplication::clipboard()
|
||||
->mimeData( QClipboard::Clipboard )
|
||||
->data( clipboard::mimeType() );
|
||||
#else
|
||||
QString value = QApplication::clipboard()->data( QClipboard::Clipboard )
|
||||
->encodedData( clipboard::mimeType() );
|
||||
#endif
|
||||
|
||||
if( !value.isEmpty() )
|
||||
{
|
||||
for( noteVector::iterator it = m_notesToCopy.begin();
|
||||
it != m_notesToCopy.end(); ++it )
|
||||
multimediaProject mmp( value, FALSE );
|
||||
|
||||
QDomNodeList list = mmp.elementsByTagName(
|
||||
note::classNodeName() );
|
||||
for( int i = 0; !list.item( i ).isNull(); ++i )
|
||||
{
|
||||
note cur_note( **it );
|
||||
note cur_note;
|
||||
cur_note.restoreState( list.item( i ).toElement() );
|
||||
cur_note.setPos( cur_note.pos() + m_currentPosition );
|
||||
cur_note.detachCurrentDetuning();
|
||||
m_pattern->addNote( cur_note );
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ pianoWidget::~pianoWidget()
|
||||
|
||||
|
||||
// gets the key from the given mouse-position
|
||||
int pianoWidget::getKeyFromMouse( const QPoint & _p )
|
||||
int pianoWidget::getKeyFromMouse( const QPoint & _p ) const
|
||||
{
|
||||
|
||||
int key_num = (int)( (float) _p.x() / (float) PW_WHITE_KEY_WIDTH );
|
||||
@@ -220,9 +220,7 @@ int pianoWidget::getKeyFromMouse( const QPoint & _p )
|
||||
}
|
||||
|
||||
// some range-checking-stuff
|
||||
key_num = tLimit( key_num, 0, NOTES_PER_OCTAVE * OCTAVES - 1 );
|
||||
|
||||
return( m_lastKey = key_num );
|
||||
return( tLimit( key_num, 0, NOTES_PER_OCTAVE * OCTAVES - 1 ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -301,6 +299,7 @@ void pianoWidget::mousePressEvent( QMouseEvent * _me )
|
||||
vol * 127 / 100 ),
|
||||
midiTime() );
|
||||
m_pressedKeys[key_num] = TRUE;
|
||||
m_lastKey = key_num;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -319,14 +318,17 @@ void pianoWidget::mousePressEvent( QMouseEvent * _me )
|
||||
// handler for mouse-release-event
|
||||
void pianoWidget::mouseReleaseEvent( QMouseEvent * _me )
|
||||
{
|
||||
int released_key = getKeyFromMouse( _me->pos() );
|
||||
if( m_lastKey != -1 )
|
||||
{
|
||||
m_instrumentTrack->processInEvent(
|
||||
midiEvent( NOTE_OFF, 0, m_lastKey, 0 ), midiTime() );
|
||||
m_pressedKeys[m_lastKey] = FALSE;
|
||||
|
||||
m_instrumentTrack->processInEvent(
|
||||
midiEvent( NOTE_OFF, 0, released_key, 0 ), midiTime() );
|
||||
m_pressedKeys[released_key] = FALSE;
|
||||
// and let the user see that he released a key... :)
|
||||
update();
|
||||
|
||||
// and let the user see that he released a key... :)
|
||||
update();
|
||||
m_lastKey = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -335,8 +337,6 @@ void pianoWidget::mouseReleaseEvent( QMouseEvent * _me )
|
||||
// handler for mouse-move-event
|
||||
void pianoWidget::mouseMoveEvent( QMouseEvent * _me )
|
||||
{
|
||||
// save current last-key-var
|
||||
int released_key = m_lastKey;
|
||||
int key_num = getKeyFromMouse( _me->pos() );
|
||||
int y_diff = _me->pos().y() - PIANO_BASE;
|
||||
volume vol = (volume)( (float) y_diff /
|
||||
@@ -359,14 +359,15 @@ void pianoWidget::mouseMoveEvent( QMouseEvent * _me )
|
||||
|
||||
// is the calculated key different from current key? (could be the
|
||||
// user just moved the cursor one pixel left but on the same key)
|
||||
if( key_num != released_key )
|
||||
if( key_num != m_lastKey )
|
||||
{
|
||||
m_instrumentTrack->processInEvent(
|
||||
midiEvent( NOTE_OFF, 0, released_key, 0 ),
|
||||
midiTime() );
|
||||
if( released_key >= 0 )
|
||||
if( m_lastKey != -1 )
|
||||
{
|
||||
m_pressedKeys[released_key] = FALSE;
|
||||
m_instrumentTrack->processInEvent(
|
||||
midiEvent( NOTE_OFF, 0, m_lastKey, 0 ),
|
||||
midiTime() );
|
||||
m_pressedKeys[m_lastKey] = FALSE;
|
||||
m_lastKey = -1;
|
||||
}
|
||||
#ifdef QT4
|
||||
if( _me->buttons() & Qt::LeftButton )
|
||||
@@ -380,6 +381,7 @@ void pianoWidget::mouseMoveEvent( QMouseEvent * _me )
|
||||
midiEvent( NOTE_ON, 0, key_num, vol ),
|
||||
midiTime() );
|
||||
m_pressedKeys[key_num] = TRUE;
|
||||
m_lastKey = key_num;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -529,7 +531,7 @@ void pianoWidget::focusOutEvent( QFocusEvent * )
|
||||
|
||||
|
||||
|
||||
int pianoWidget::getKeyX( int _key_num )
|
||||
int pianoWidget::getKeyX( int _key_num ) const
|
||||
{
|
||||
int k = m_startOctave*NOTES_PER_OCTAVE + m_startTone;
|
||||
if( _key_num < k )
|
||||
|
||||
@@ -128,11 +128,6 @@ presetPreviewPlayHandle::presetPreviewPlayHandle(
|
||||
playHandle( PresetPreviewHandle ),
|
||||
m_previewNote( NULL )
|
||||
{
|
||||
if( !s_previewTC )
|
||||
{
|
||||
s_previewTC = new previewTrackContainer;
|
||||
}
|
||||
|
||||
s_previewTC->lockData();
|
||||
|
||||
if( s_previewTC->previewNote() != NULL )
|
||||
@@ -213,6 +208,17 @@ bool presetPreviewPlayHandle::isFromTrack( const track * _track ) const
|
||||
|
||||
|
||||
|
||||
void presetPreviewPlayHandle::init( void )
|
||||
{
|
||||
if( !s_previewTC )
|
||||
{
|
||||
s_previewTC = new previewTrackContainer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void presetPreviewPlayHandle::cleanUp( void )
|
||||
{
|
||||
delete s_previewTC;
|
||||
|
||||
@@ -60,16 +60,6 @@
|
||||
|
||||
|
||||
|
||||
const QPoint surroundArea::s_defaultSpeakerPositions[SURROUND_CHANNELS] =
|
||||
{
|
||||
QPoint( -SURROUND_AREA_SIZE, -SURROUND_AREA_SIZE ),
|
||||
QPoint( SURROUND_AREA_SIZE, -SURROUND_AREA_SIZE)
|
||||
#ifndef DISABLE_SURROUND
|
||||
,
|
||||
QPoint( -SURROUND_AREA_SIZE, SURROUND_AREA_SIZE ),
|
||||
QPoint( SURROUND_AREA_SIZE, SURROUND_AREA_SIZE )
|
||||
#endif
|
||||
} ;
|
||||
|
||||
QPixmap * surroundArea::s_backgroundArtwork = NULL;
|
||||
|
||||
@@ -131,12 +121,39 @@ surroundArea::~surroundArea()
|
||||
|
||||
volumeVector surroundArea::getVolumeVector( float _v_scale ) const
|
||||
{
|
||||
volumeVector v;
|
||||
for( Uint8 chnl = 0; chnl < SURROUND_CHANNELS; ++chnl )
|
||||
volumeVector v = { { _v_scale, _v_scale
|
||||
#ifndef DISABLE_SURROUND
|
||||
, _v_scale, _v_scale
|
||||
#endif
|
||||
} } ;
|
||||
|
||||
if( m_sndSrcPos.x() >= 0 )
|
||||
{
|
||||
v.vol[chnl] = getVolume( s_defaultSpeakerPositions[chnl],
|
||||
_v_scale );
|
||||
v.vol[0] *= 1.0f - m_sndSrcPos.x() / (float)SURROUND_AREA_SIZE;
|
||||
#ifndef DISABLE_SURROUND
|
||||
v.vol[2] *= 1.0f - m_sndSrcPos.x() / (float)SURROUND_AREA_SIZE;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
v.vol[1] *= 1.0f + m_sndSrcPos.x() / (float)SURROUND_AREA_SIZE;
|
||||
#ifndef DISABLE_SURROUND
|
||||
v.vol[3] *= 1.0f + m_sndSrcPos.x() / (float)SURROUND_AREA_SIZE;
|
||||
#endif
|
||||
}
|
||||
|
||||
if( m_sndSrcPos.y() >= 0 )
|
||||
{
|
||||
v.vol[0] *= 1.0f - m_sndSrcPos.y() / (float)SURROUND_AREA_SIZE;
|
||||
v.vol[1] *= 1.0f - m_sndSrcPos.y() / (float)SURROUND_AREA_SIZE;
|
||||
}
|
||||
#ifndef DISABLE_SURROUND
|
||||
else
|
||||
{
|
||||
v.vol[2] *= 1.0f + m_sndSrcPos.y() / (float)SURROUND_AREA_SIZE;
|
||||
v.vol[3] *= 1.0f + m_sndSrcPos.y() / (float)SURROUND_AREA_SIZE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return( v );
|
||||
}
|
||||
@@ -162,20 +179,6 @@ void surroundArea::setValue( const QPoint & _p )
|
||||
|
||||
|
||||
|
||||
FASTCALL float surroundArea::getVolume( const QPoint & _speaker_pos,
|
||||
float _v_scale ) const
|
||||
{
|
||||
const int x = _speaker_pos.x() - m_sndSrcPos.x();
|
||||
const int y = _speaker_pos.y() - m_sndSrcPos.y();
|
||||
const float new_vol = 2.0f - sqrt( x*x + y*y ) *
|
||||
( 1.0f / SURROUND_AREA_SIZE );
|
||||
|
||||
return( tLimit( new_vol, 0.0f, 1.0f ) * _v_scale );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void surroundArea::contextMenuEvent( QContextMenuEvent * )
|
||||
{
|
||||
// for the case, the user clicked right while pressing left mouse-
|
||||
|
||||
@@ -1424,7 +1424,9 @@ void trackWidget::dropEvent( QDropEvent * _de )
|
||||
// value contains our XML-data so simply create a
|
||||
// multimediaProject which does the rest for us...
|
||||
multimediaProject mmp( value, FALSE );
|
||||
engine::getMixer()->lock();
|
||||
m_track->restoreState( mmp.content().firstChild().toElement() );
|
||||
engine::getMixer()->unlock();
|
||||
_de->accept();
|
||||
}
|
||||
}
|
||||
@@ -1734,11 +1736,7 @@ void track::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
if( node.isElement() )
|
||||
{
|
||||
if( node.nodeName() == nodeName() ||
|
||||
#warning compat-code, remove in 0.3.0
|
||||
( node.nodeName() == "channeltrack" &&
|
||||
nodeName() == "instrumenttrack" )
|
||||
)
|
||||
if( node.nodeName() == nodeName() )
|
||||
{
|
||||
loadTrackSpecificSettings( node.toElement() );
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* clipboard.cpp - the clipboard for patterns, notes etc.
|
||||
*
|
||||
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
@@ -29,34 +29,34 @@
|
||||
#include "journalling_object.h"
|
||||
|
||||
|
||||
namespace clipboard
|
||||
|
||||
|
||||
clipboard::map clipboard::content;
|
||||
|
||||
|
||||
|
||||
|
||||
void clipboard::copy( journallingObject * _obj )
|
||||
{
|
||||
|
||||
map content;
|
||||
QDomDocument doc;
|
||||
QDomElement parent = doc.createElement( "clipboard" );
|
||||
_obj->saveState( doc, parent );
|
||||
content[_obj->nodeName()] = parent.firstChild().toElement();
|
||||
}
|
||||
|
||||
|
||||
void copy( journallingObject * _obj )
|
||||
|
||||
|
||||
const QDomElement * clipboard::getContent( const QString & _node_name )
|
||||
{
|
||||
if( content.find( _node_name ) != content.end() )
|
||||
{
|
||||
QDomDocument doc;
|
||||
QDomElement parent = doc.createElement( "clipboard" );
|
||||
_obj->saveState( doc, parent );
|
||||
content[_obj->nodeName()] = parent.firstChild().toElement();
|
||||
return( &content[_node_name] );
|
||||
}
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const QDomElement * getContent( const QString & _node_name )
|
||||
{
|
||||
if( content.find( _node_name ) != content.end() )
|
||||
{
|
||||
return( &content[_node_name] );
|
||||
}
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "qt3support.h"
|
||||
#include "mmp.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifdef QT4
|
||||
|
||||
@@ -39,12 +41,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "mmp.h"
|
||||
#include "config_mgr.h"
|
||||
#include "project_version.h"
|
||||
#include "song_editor.h"
|
||||
@@ -56,10 +53,11 @@ multimediaProject::typeDescStruct
|
||||
{ multimediaProject::UNKNOWN, "unknown" },
|
||||
{ multimediaProject::SONG_PROJECT, "song" },
|
||||
{ multimediaProject::SONG_PROJECT_TEMPLATE, "songtemplate" },
|
||||
#warning compat-code, remove in 0.3.0
|
||||
#warning compat-code, use upgrade feature
|
||||
{ multimediaProject::INSTRUMENT_TRACK_SETTINGS,
|
||||
"instrumenttracksettings,channelsettings" },
|
||||
{ multimediaProject::DRAG_N_DROP_DATA, "dnddata" },
|
||||
{ multimediaProject::CLIPBOARD_DATA, "clipboard-data" },
|
||||
{ multimediaProject::JOURNAL_DATA, "journaldata" },
|
||||
{ multimediaProject::EFFECT_SETTINGS, "effectsettings" },
|
||||
{ multimediaProject::VIDEO_PROJECT, "videoproject" },
|
||||
@@ -177,7 +175,7 @@ multimediaProject::multimediaProject( const QString & _in_file_name,
|
||||
m_head = node.toElement();
|
||||
}
|
||||
else if( node.nodeName() == typeName( m_type ) ||
|
||||
#warning compat-code, remove in 0.3.0
|
||||
#warning compat-code, use upgrade feature
|
||||
node.nodeName() == "channelsettings" )
|
||||
{
|
||||
m_content = node.toElement();
|
||||
@@ -363,7 +361,7 @@ QString multimediaProject::typeName( projectTypes _project_type )
|
||||
if( _project_type >= UNKNOWN && _project_type < PROJ_TYPE_COUNT )
|
||||
{
|
||||
return( s_types[_project_type].m_name
|
||||
#warning compat-code, remove in 0.3.0
|
||||
#warning compat-code, use upgrade feature
|
||||
.section( ',', 0, 0 )
|
||||
);
|
||||
}
|
||||
@@ -519,6 +517,61 @@ void multimediaProject::upgrade( void )
|
||||
node = node.nextSibling();
|
||||
}
|
||||
}
|
||||
|
||||
if( version < "0.2.1-svn20070508" )
|
||||
{
|
||||
QDomNodeList list = elementsByTagName( "arpandchords" );
|
||||
for( int i = 0; !list.item( i ).isNull(); ++i )
|
||||
{
|
||||
QDomElement el = list.item( i ).toElement();
|
||||
if( el.hasAttribute( "chorddisabled" ) )
|
||||
{
|
||||
el.setAttribute( "chord-enabled",
|
||||
!el.attribute( "chorddisabled" )
|
||||
.toInt() );
|
||||
el.setAttribute( "arp-enabled",
|
||||
!el.attribute( "arpdisabled" )
|
||||
.toInt() );
|
||||
}
|
||||
}
|
||||
|
||||
list = elementsByTagName( "channeltrack" );
|
||||
for( int i = 0; !list.item( i ).isNull(); ++i )
|
||||
{
|
||||
QDomElement el = list.item( i ).toElement();
|
||||
el.setTagName( "instrumenttrack" );
|
||||
}
|
||||
|
||||
list = elementsByTagName( "instrumenttrack" );
|
||||
for( int i = 0; !list.item( i ).isNull(); ++i )
|
||||
{
|
||||
QDomElement el = list.item( i ).toElement();
|
||||
if( el.hasAttribute( "vol" ) )
|
||||
{
|
||||
float value = el.attribute( "vol" ).toFloat();
|
||||
value = roundf( value * 0.585786438f );
|
||||
el.setAttribute( "vol", value );
|
||||
}
|
||||
else
|
||||
{
|
||||
QDomNodeList vol_list = el.namedItem(
|
||||
"automation-pattern" )
|
||||
.namedItem( "vol" ).toElement()
|
||||
.elementsByTagName( "time" );
|
||||
for( int j = 0; !vol_list.item( j ).isNull();
|
||||
++j )
|
||||
{
|
||||
QDomElement timeEl = list.item( j )
|
||||
.toElement();
|
||||
int value = timeEl.attribute( "value" )
|
||||
.toInt();
|
||||
value = (int)roundf( value *
|
||||
0.585786438f );
|
||||
timeEl.setAttribute( "value", value );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -960,7 +960,7 @@ bool FASTCALL instrumentTrack::play( const midiTime & _start,
|
||||
trackContentObject * tco = getTCO( _tco_num );
|
||||
tcos.push_back( tco );
|
||||
bb_track = bbTrack::findBBTrack( _tco_num );
|
||||
if( !( bb_track->automationDisabled( this )
|
||||
if( !( ( bb_track && bb_track->automationDisabled( this ) )
|
||||
|| dynamic_cast<pattern *>( tco )->empty() ) )
|
||||
{
|
||||
sendMidiTime( _start );
|
||||
|
||||
@@ -527,33 +527,6 @@ void pattern::freeze( void )
|
||||
QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
if( m_instrumentTrack->muted() || muted() )
|
||||
{
|
||||
if( QMessageBox::
|
||||
#if QT_VERSION >= 0x030200
|
||||
question
|
||||
#else
|
||||
information
|
||||
#endif
|
||||
|
||||
( 0, tr( "Pattern muted" ),
|
||||
tr( "The track this pattern "
|
||||
"belongs to or the "
|
||||
"pattern itself is "
|
||||
"currently muted "
|
||||
"therefore "
|
||||
"freezing makes no "
|
||||
"sense! Do you still "
|
||||
"want to continue?" ),
|
||||
QMessageBox::Yes,
|
||||
QMessageBox::No |
|
||||
QMessageBox::Default |
|
||||
QMessageBox::Escape ) ==
|
||||
QMessageBox::No )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// already frozen?
|
||||
if( m_frozenPattern != NULL )
|
||||
@@ -683,13 +656,24 @@ void pattern::constructContextMenu( QMenu * _cm )
|
||||
this, SLOT( changeName() ) );
|
||||
_cm->addSeparator();
|
||||
|
||||
_cm->addAction( embed::getIconPixmap( "freeze" ),
|
||||
( m_frozenPattern != NULL )? tr( "Refreeze" ) : tr( "Freeze" ),
|
||||
bool freeze_separator = FALSE;
|
||||
if( !( m_instrumentTrack->muted() || muted() ) )
|
||||
{
|
||||
_cm->addAction( embed::getIconPixmap( "freeze" ),
|
||||
m_frozenPattern ? tr( "Refreeze" ) : tr( "Freeze" ),
|
||||
this, SLOT( freeze() ) );
|
||||
_cm->addAction( embed::getIconPixmap( "unfreeze" ), tr( "Unfreeze" ),
|
||||
this, SLOT( unfreeze() ) );
|
||||
|
||||
_cm->addSeparator();
|
||||
freeze_separator = TRUE;
|
||||
}
|
||||
if( m_frozenPattern )
|
||||
{
|
||||
_cm->addAction( embed::getIconPixmap( "unfreeze" ),
|
||||
tr( "Unfreeze" ), this, SLOT( unfreeze() ) );
|
||||
freeze_separator = TRUE;
|
||||
}
|
||||
if( freeze_separator )
|
||||
{
|
||||
_cm->addSeparator();
|
||||
}
|
||||
|
||||
#ifdef QT4
|
||||
QMenu * add_step_menu = _cm->addMenu(
|
||||
|
||||
@@ -253,6 +253,24 @@ void groupBox::updatePixmap( void )
|
||||
|
||||
|
||||
|
||||
|
||||
void groupBox::saveSettings( QDomDocument & _doc, QDomElement & _this,
|
||||
const QString & _name )
|
||||
{
|
||||
m_led->saveSettings( _doc, _this, _name );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void groupBox::loadSettings( const QDomElement & _this, const QString & _name )
|
||||
{
|
||||
m_led->loadSettings( _this, _name );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "group_box.moc"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user