renamed time* classes to automation* ones

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@183 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2006-06-29 01:01:13 +00:00
parent 7147229b2a
commit fdeef1e0d0
16 changed files with 2757 additions and 54 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -25,6 +25,7 @@
*/
#include "automation_editor.h"
#include "bb_editor.h"
#include "project_journal.h"
#include "engine.h"
@@ -34,7 +35,6 @@
#include "preset_preview_play_handle.h"
#include "project_notes.h"
#include "song_editor.h"
#include "time_roll.h"
engine::engine( const bool _has_gui ) :
@@ -42,10 +42,10 @@ engine::engine( const bool _has_gui ) :
m_mixer( NULL ),
m_mainWindow( NULL ),
m_songEditor( NULL ),
m_automationEditor( NULL ),
m_bbEditor( NULL ),
m_pianoRoll( NULL ),
m_projectJournal( NULL ),
m_timeRoll( NULL )
m_projectJournal( NULL )
{
m_projectJournal = new projectJournal( this );
m_mainWindow = new mainWindow( this );
@@ -54,7 +54,7 @@ engine::engine( const bool _has_gui ) :
m_projectNotes = new projectNotes( this );
m_bbEditor = new bbEditor( this );
m_pianoRoll = new pianoRoll( this );
m_timeRoll = new timeRoll( this );
m_automationEditor = new automationEditor( this );
m_mixer->initDevices();
@@ -74,7 +74,7 @@ engine::~engine()
delete m_songEditor;
delete m_bbEditor;
delete m_pianoRoll;
delete m_timeRoll;
delete m_automationEditor;
presetPreviewPlayHandle::cleanUp( this );

View File

@@ -77,7 +77,7 @@
#include "audio_dummy.h"
#include "tool_button.h"
#include "project_journal.h"
#include "time_roll.h"
#include "automation_editor.h"
#if QT_VERSION >= 0x030100
@@ -383,21 +383,23 @@ void mainWindow::finalize( void )
//TODO: Change icon
toolButton * time_roll_window = new toolButton(
embed::getIconPixmap( "piano" ),
tr( "Show/hide Time-Roll" ) +
toolButton * automation_editor_window = new toolButton(
embed::getIconPixmap( "piano" ),
tr( "Show/hide Automation Editor" ) +
" (F9)",
this, SLOT( toggleTimeRollWin() ),
m_toolBar );
time_roll_window->setShortcut( Qt::Key_F9 );
this,
SLOT( toggleAutomationEditorWin() ),
m_toolBar );
automation_editor_window->setShortcut( Qt::Key_F9 );
#ifdef QT4
time_roll_window->setWhatsThis(
automation_editor_window->setWhatsThis(
#else
QWhatsThis::add( time_roll_window,
QWhatsThis::add( automation_editor_window,
#endif
tr( "By pressing this button, you can show or hide the "
"Time-Roll. With the help of the Time-Roll "
"you can edit dynamic values in an easy way."
"Automation Editor. With the help of the "
"Automation Editor you can edit dynamic values "
"in an easy way."
) );
//TODO: Relocate effect board button
@@ -435,7 +437,7 @@ void mainWindow::finalize( void )
m_toolBarLayout->addWidget( bb_editor_window, 1, 1 );
m_toolBarLayout->addWidget( piano_roll_window, 1, 2 );
m_toolBarLayout->addWidget( song_editor_window, 1, 3 );
m_toolBarLayout->addWidget( time_roll_window, 1, 4 );
m_toolBarLayout->addWidget( automation_editor_window, 1, 4 );
//TODO: Relocate effect board
//m_toolBarLayout->addWidget( effect_board_window, 1, 4 );
m_toolBarLayout->addWidget( project_notes_window, 1, 5 );
@@ -897,18 +899,18 @@ void mainWindow::togglePianoRollWin( void )
void mainWindow::toggleTimeRollWin( void )
void mainWindow::toggleAutomationEditorWin( void )
{
if( eng()->getTimeRoll()->isHidden() == TRUE ||
( m_workspace != NULL &&
m_workspace->activeWindow() != eng()->getTimeRoll() ) )
if( eng()->getAutomationEditor()->isHidden() == TRUE ||
( m_workspace != NULL && m_workspace->activeWindow()
!= eng()->getAutomationEditor() ) )
{
eng()->getTimeRoll()->show();
eng()->getTimeRoll()->setFocus();
eng()->getAutomationEditor()->show();
eng()->getAutomationEditor()->setFocus();
}
else
{
eng()->getTimeRoll()->hide();
eng()->getAutomationEditor()->hide();
}
}

View File

@@ -1730,17 +1730,17 @@ void track::swapPositionOfTCOs( csize _tco_num1, csize _tco_num2 )
void track::addTimePattern( timePattern * _pattern )
void track::addAutomationPattern( automationPattern * _pattern )
{
m_time_patterns.append( _pattern );
m_automation_patterns.append( _pattern );
}
void track::removeTimePattern( timePattern * _pattern )
void track::removeAutomationPattern( automationPattern * _pattern )
{
m_time_patterns.remove( _pattern );
m_automation_patterns.remove( _pattern );
}
@@ -1748,8 +1748,8 @@ void track::removeTimePattern( timePattern * _pattern )
void track::sendMidiTime( const midiTime & _time )
{
QPtrListIterator<timePattern> it( m_time_patterns );
timePattern * pattern ;
QPtrListIterator<automationPattern> it( m_automation_patterns );
automationPattern * pattern ;
while( ( pattern = it.current() ) )
{
++it;

View File

@@ -21,6 +21,7 @@
#include "src/core/sample_play_handle.cpp"
#include "src/core/piano_roll.cpp"
#include "src/core/arp_and_chords_tab_widget.cpp"
#include "src/core/automation_editor.cpp"
#include "src/core/about_dialog.cpp"
#include "src/core/instrument.cpp"
#include "src/core/main.cpp"
@@ -38,7 +39,6 @@
#include "src/core/piano_widget.cpp"
#include "src/core/name_label.cpp"
#include "src/core/preset_preview_play_handle.cpp"
#include "src/core/time_roll.cpp"
#include "src/core/track_container.cpp"
#include "src/core/track.cpp"
#include "src/core/file_browser.cpp"
@@ -60,10 +60,10 @@
#include "src/audio/audio_sample_recorder.cpp"
#include "src/audio/audio_file_wave.cpp"
#include "src/lmms_single_source.cpp"
#include "src/tracks/automation_pattern.cpp"
#include "src/tracks/pattern.cpp"
#include "src/tracks/bb_track.cpp"
#include "src/tracks/sample_track.cpp"
#include "src/tracks/time_pattern.cpp"
#include "src/widgets/project_notes.cpp"
#include "src/widgets/led_checkbox.cpp"
#include "src/widgets/knob.cpp"

View File

@@ -0,0 +1,249 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* automation_pattern.cpp - implementation of class automationPattern which
* holds dynamic values
*
* Copyright (c) 2006 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#include "qt3support.h"
#ifdef QT4
#include <Qt/QtXml>
#else
#include <qdom.h>
#endif
#include "automation_pattern.h"
#include "templates.h"
#include "automation_editor.h"
automationPattern::automationPattern ( track * _track, levelObject * _object ) :
journallingObject( _track->eng() ),
m_track( _track ),
m_object( _object )
{
init();
}
automationPattern::automationPattern( const automationPattern & _pat_to_copy ) :
journallingObject( _pat_to_copy.m_track->eng() ),
m_track( _pat_to_copy.m_track ),
m_object( _pat_to_copy.m_object )
{
for( timeMap::const_iterator it = _pat_to_copy.m_time_map.begin();
it != _pat_to_copy.m_time_map.end(); ++it )
{
m_time_map[it.key()] = it.data();
}
init();
}
automationPattern::~automationPattern()
{
m_track->removeAutomationPattern( this );
if( eng()->getAutomationEditor()->currentPattern() == this )
{
eng()->getAutomationEditor()->setCurrentPattern( NULL );
}
m_time_map.clear();
}
void automationPattern::init( void )
{
m_track->addAutomationPattern( this );
}
midiTime automationPattern::length( void ) const
{
Sint32 max_length = 0;
for( timeMap::const_iterator it = m_time_map.begin();
it != m_time_map.end();
++it )
{
max_length = tMax<Sint32>( max_length, it.key() );
}
if( max_length % 64 == 0 )
{
return( midiTime( tMax<Sint32>( max_length, 64 ) ) );
}
return( midiTime( tMax( midiTime( max_length ).getTact() + 1, 1 ),
0 ) );
}
midiTime automationPattern::putValue( const midiTime & _time, const int _value,
const bool _quant_pos )
{
midiTime new_time = _quant_pos ?
note::quantized( _time,
eng()->getAutomationEditor()->quantization() ) :
_time;
m_time_map[new_time] = _value;
return( new_time );
}
void automationPattern::removeValue( const midiTime & _time )
{
m_time_map.remove( _time );
}
void automationPattern::clearValues( void )
{
m_time_map.clear();
if( eng()->getAutomationEditor()->currentPattern() == this )
{
eng()->getAutomationEditor()->update();
}
}
int automationPattern::valueAt( const midiTime & _time )
{
if( m_time_map.contains( _time ) )
{
return( m_time_map[_time] );
}
//TODO: Return a better value!!
return( 0 );
}
void automationPattern::saveSettings( QDomDocument & _doc, QDomElement & _this )
{
for( timeMap::iterator it = m_time_map.begin(); it != m_time_map.end();
++it )
{
QDomElement element = _doc.createElement( "time" );
element.setAttribute( "pos", static_cast<Sint32>( it.key() ) );
element.setAttribute( "value", m_object->levelToLabel(
it.data() ) );
_this.appendChild( element );
}
}
void automationPattern::loadSettings( const QDomElement & _this )
{
clearValues();
for( QDomNode node = _this.firstChild(); !node.isNull();
node = node.nextSibling() )
{
QDomElement element = node.toElement();
if( element.isNull() || element.tagName() != "time" )
{
continue;
}
m_time_map[midiTime( element.attribute( "pos" ).toInt() )]
= m_object->labelToLevel(
element.attribute( "value" ) );
}
}
void automationPattern::openInAutomationEditor( void )
{
eng()->getAutomationEditor()->setCurrentPattern( this );
eng()->getAutomationEditor()->show();
eng()->getAutomationEditor()->setFocus();
}
void automationPattern::clear( void )
{
clearValues();
}
const QString automationPattern::name( void )
{
return( m_track->name() + " - " + dynamic_cast<QWidget *>( m_object )
->accessibleName() );
}
void automationPattern::processMidiTime( const midiTime & _time )
{
timeMap::iterator it = m_time_map.find( _time );
if( it != m_time_map.end() )
{
m_object->setLevel( it.data() );
}
}
#include "automation_pattern.moc"
#endif

View File

@@ -1106,7 +1106,7 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
{
m_midiWidget->restoreState( node.toElement() );
}
else if( timePattern::classNodeName()
else if( automationPattern::classNodeName()
!= node.nodeName() )
{
// if node-name doesn't match any known one,

View File

@@ -522,7 +522,8 @@ void sampleTrack::loadTrackSpecificSettings( const QDomElement & _this )
}
else
{
QDomNode node = _this.namedItem( timePattern::classNodeName() );
QDomNode node = _this.namedItem(
automationPattern::classNodeName() );
if( node.isElement() && node.namedItem( "vol" ).isElement() )
{
m_volumeKnob->loadSettings( _this, "vol" );

View File

@@ -118,7 +118,7 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name,
m_knobPixmap = new QPixmap( embed::getIconPixmap( "knob0" +
QString::number( m_knobNum + 1 ) ) );
#endif
getTimePattern();
getAutomationPattern();
setRange( 0.0f, 100.0f, 1.0f );
@@ -374,9 +374,9 @@ void knob::contextMenuEvent( QContextMenuEvent * )
contextMenu.addSeparator();
//TODO: Change icon
contextMenu.addAction( embed::getIconPixmap( "piano" ),
tr( "&Open in time-roll" ),
getTimePattern(),
SLOT( openInTimeRoll() ) );
tr( "&Open in automation editor" ),
getAutomationPattern(),
SLOT( openInAutomationEditor() ) );
contextMenu.addSeparator();
contextMenu.addAction( tr( "Connect to MIDI-device" ), this,
SLOT( connectToMidiDevice() ) );