DrumSynth relicense, MDI fixes, QPushButton inheritance, LiveTool fixes

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@604 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2007-11-20 20:29:36 +00:00
parent b61a93c5d3
commit f8c17137ad
34 changed files with 339 additions and 268 deletions

View File

@@ -74,7 +74,6 @@ QPixmap * automationEditor::s_toolMove = NULL;
automationEditor::automationEditor( void ) :
QWidget( ),
m_pattern( NULL ),
m_min_level( 0 ),
m_max_level( 0 ),
@@ -335,11 +334,14 @@ automationEditor::automationEditor( void ) :
if( engine::getMainWindow()->workspace() )
{
engine::getMainWindow()->workspace()->addSubWindow( this );
parentWidget()->resize( INITIAL_WIDTH, INITIAL_HEIGHT );
parentWidget()->hide();
}
else
{
resize( INITIAL_WIDTH, INITIAL_HEIGHT );
hide();
}
parentWidget()->resize( INITIAL_WIDTH, INITIAL_HEIGHT );
parentWidget()->hide();
}
@@ -766,8 +768,15 @@ void automationEditor::removeSelection( void )
void automationEditor::closeEvent( QCloseEvent * _ce )
{
QApplication::restoreOverrideCursor();
hide();
_ce->ignore ();
if( parentWidget() )
{
parentWidget()->hide();
}
else
{
hide();
}
_ce->ignore();
}

View File

@@ -300,8 +300,15 @@ void bbEditor::updateComboBox( void )
// instead of closing it's being hidden
void bbEditor::closeEvent( QCloseEvent * _ce )
{
if( parentWidget() )
{
parentWidget()->hide();
}
else
{
hide();
}
_ce->ignore();
hide();
}

View File

@@ -26,22 +26,22 @@
*/
#include <Qt/QtXml>
#include "effect_tab_widget.h"
#include <QtGui/QMenu>
#include <QtGui/QToolButton>
#include <QtGui/QCloseEvent>
#include "effect_tab_widget.h"
#include "instrument_track.h"
#include "sample_track.h"
#include "group_box.h"
#include "tooltip.h"
#include "embed.h"
#include "audio_port.h"
#include "effect_select_dialog.h"
#include "embed.h"
#include "group_box.h"
#include "instrument_track.h"
#include "rack_plugin.h"
#include "rack_view.h"
#include "audio_port.h"
#include "sample_track.h"
#include "tooltip.h"
@@ -155,13 +155,6 @@ void effectTabWidget::setBypass( bool _state )
void effectTabWidget::closeEvent( QCloseEvent * _ce )
{
_ce->ignore();
emit( closed() );
}
#include "effect_tab_widget.moc"
#endif

View File

@@ -73,7 +73,6 @@ extern int splash_alignment_flags;
mainWindow::mainWindow( void ) :
QMainWindow(),
m_workspace( NULL ),
m_templatesMenu( NULL ),
m_recentlyOpenedProjectsMenu( NULL ),
@@ -177,6 +176,7 @@ mainWindow::mainWindow( void ) :
mainWindow::~mainWindow()
{
// TODO: Close tools
// destroy engine which will do further cleanups etc.
engine::destroy();
}
@@ -428,8 +428,7 @@ void mainWindow::finalize( void )
if( it->type == plugin::Tool )
{
m_tools_menu->addAction( *it->logo, it->public_name );
m_tools.push_back( tool::instantiate( it->name,
this ) );
m_tools.push_back( tool::instantiate( it->name ) );
}
}
if( !m_tools_menu->isEmpty() )
@@ -540,8 +539,8 @@ void mainWindow::clearKeyModifiers( void )
void mainWindow::saveWidgetState( QWidget * _w, QDomElement & _de )
{
if( _w->parentWidget() != NULL &&
_w->parentWidget()->inherits("QMdiSubWindow"))
if( _w->parentWidget() != NULL &&
_w->parentWidget()->inherits( "QMdiSubWindow" ) )
{
_w = _w->parentWidget();
}
@@ -568,7 +567,7 @@ void mainWindow::restoreWidgetState( QWidget * _w, const QDomElement & _de )
_w->show();
if (_w->parentWidget() != NULL &&
_w->parentWidget()->inherits("QMdiSubWindow"))
_w->parentWidget()->inherits( "QMdiSubWindow" ) )
{
_w = _w->parentWidget();
}
@@ -732,37 +731,50 @@ void mainWindow::help( void )
void mainWindow::toggleBBEditorWin( void )
void mainWindow::toggleWindow( QWidget * _w )
{
if( engine::getBBEditor()->parentWidget()->isHidden() == TRUE ||
( m_workspace != NULL &&
m_workspace->activeSubWindow()->widget() != engine::getBBEditor() ) )
if( m_workspace )
{
engine::getBBEditor()->parentWidget()->show();
engine::getBBEditor()->setFocus();
if( m_workspace->activeSubWindow() != _w->parentWidget()
|| _w->parentWidget()->isHidden() )
{
_w->parentWidget()->show();
_w->show();
_w->setFocus();
}
else
{
_w->parentWidget()->hide();
}
}
else
{
engine::getBBEditor()->parentWidget()->hide();
if( _w->isHidden() )
{
_w->show();
_w->setFocus();
}
else
{
_w->hide();
}
}
}
void mainWindow::toggleBBEditorWin( void )
{
toggleWindow( engine::getBBEditor() );
}
void mainWindow::toggleSongEditorWin( void )
{
if( engine::getSongEditor()->parentWidget()->isHidden() == TRUE ||
( m_workspace != NULL && m_workspace->activeSubWindow()->widget()
!= engine::getSongEditor() ) )
{
engine::getSongEditor()->parentWidget()->show();
engine::getSongEditor()->setFocus();
}
else
{
engine::getSongEditor()->parentWidget()->hide();
}
toggleWindow( engine::getSongEditor() );
}
@@ -770,17 +782,7 @@ void mainWindow::toggleSongEditorWin( void )
void mainWindow::toggleProjectNotesWin( void )
{
if( engine::getProjectNotes()->isHidden() == TRUE ||
( m_workspace != NULL && m_workspace->activeSubWindow()->widget() !=
engine::getProjectNotes() ) )
{
engine::getProjectNotes()->show();
engine::getProjectNotes()->setFocus();
}
else
{
engine::getProjectNotes()->hide();
}
toggleWindow( engine::getProjectNotes() );
}
@@ -788,17 +790,7 @@ void mainWindow::toggleProjectNotesWin( void )
void mainWindow::togglePianoRollWin( void )
{
if( engine::getPianoRoll()->parentWidget()->isHidden() == TRUE ||
( m_workspace != NULL && m_workspace->activeSubWindow()->widget()
!= engine::getPianoRoll() ) )
{
engine::getPianoRoll()->parentWidget()->show();
engine::getPianoRoll()->setFocus();
}
else
{
engine::getPianoRoll()->parentWidget()->hide();
}
toggleWindow( engine::getPianoRoll() );
}
@@ -806,17 +798,7 @@ void mainWindow::togglePianoRollWin( void )
void mainWindow::toggleAutomationEditorWin( void )
{
if( engine::getAutomationEditor()->parentWidget()->isHidden() == TRUE ||
( m_workspace != NULL && m_workspace->activeSubWindow()->widget()
!= engine::getAutomationEditor() ) )
{
engine::getAutomationEditor()->parentWidget()->show();
engine::getAutomationEditor()->setFocus();
}
else
{
engine::getAutomationEditor()->parentWidget()->hide();
}
toggleWindow( engine::getAutomationEditor() );
}
@@ -936,6 +918,10 @@ void mainWindow::showTool( QAction * _idx )
{
tool * t = m_tools[m_tools_menu->actions().indexOf( _idx )];
t->show();
if( m_workspace )
{
t->parentWidget()->show();
}
t->setFocus();
}

View File

@@ -127,7 +127,6 @@ const int DEFAULT_PR_PPT = KEY_LINE_HEIGHT * DEFAULT_STEPS_PER_TACT;
pianoRoll::pianoRoll( void ) :
QWidget( ),
m_pattern( NULL ),
m_currentPosition(),
m_recording( FALSE ),
@@ -421,14 +420,19 @@ pianoRoll::pianoRoll( void ) :
setMouseTracking( TRUE );
// add us to workspace
// add us to workspace
if( engine::getMainWindow()->workspace() )
{
engine::getMainWindow()->workspace()->addSubWindow( this );
parentWidget()->resize( INITIAL_PIANOROLL_WIDTH,
INITIAL_PIANOROLL_HEIGHT );
parentWidget()->hide();
}
else
{
resize( INITIAL_PIANOROLL_WIDTH, INITIAL_PIANOROLL_HEIGHT );
hide();
}
parentWidget()->resize( INITIAL_PIANOROLL_WIDTH, INITIAL_PIANOROLL_HEIGHT );
parentWidget()->hide();
}
@@ -970,8 +974,15 @@ void pianoRoll::removeSelection( void )
void pianoRoll::closeEvent( QCloseEvent * _ce )
{
QApplication::restoreOverrideCursor();
parentWidget()->hide();
_ce->ignore ();
if( parentWidget() )
{
parentWidget()->hide();
}
else
{
hide();
}
_ce->ignore();
}

View File

@@ -413,8 +413,15 @@ songEditor::~songEditor()
void songEditor::closeEvent( QCloseEvent * _ce )
{
if( parentWidget() )
{
parentWidget()->hide();
}
else
{
hide();
}
_ce->ignore();
hide();
}

View File

@@ -30,17 +30,29 @@
#include <QtGui/QIcon>
#include <QtGui/QMdiArea>
#include "engine.h"
#include "main_window.h"
tool::tool( mainWindow * _window, const descriptor * _descriptor ) :
QWidget( _window->workspace() ),
tool::tool( const descriptor * _descriptor ) :
plugin( _descriptor )
{
setWindowTitle( _descriptor->public_name );
setWindowIcon( *_descriptor->logo );
QWidget * window;
if( engine::getMainWindow()->workspace() )
{
engine::getMainWindow()->workspace()->addSubWindow( this );
window = parentWidget();
window->setAttribute( Qt::WA_DeleteOnClose, FALSE );
}
else
{
window = this;
}
window->setWindowTitle( _descriptor->public_name );
window->setWindowIcon( *_descriptor->logo );
}
@@ -53,9 +65,9 @@ tool::~tool()
tool * tool::instantiate( const QString & _plugin_name, mainWindow * _window )
tool * tool::instantiate( const QString & _plugin_name )
{
plugin * p = plugin::instantiate( _plugin_name, _window );
plugin * p = plugin::instantiate( _plugin_name, NULL );
// check whether instantiated plugin is an instrument
if( dynamic_cast<tool *>( p ) != NULL )
{

View File

@@ -56,7 +56,6 @@
trackContainer::trackContainer( void ) :
QWidget( ),
m_currentPosition( 0, 0 ),
m_scrollArea( new scrollArea( this ) ),
m_ppt( DEFAULT_PIXELS_PER_TACT ),

View File

@@ -1,10 +1,28 @@
// DrumSynth DS file renderer
// Copyright (c)1998-2000 Paul Kellett (mda-vst.com)
// Licensed under the MIT License. Read drumsynth.LICENSE for details
// Version 2.0 (5/10/00)
//
// Adapted for LMMS 2007 Paul Giblock
//
/*
* drumsynth.cpp - DrumSynth DS file renderer
*
* Copyright (c) 1998-2000 Paul Kellett (mda-vst.com)
* Copyright (c) 2007 Paul Giblock <drfaygo/at/gmail.com>
*
* 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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include "drumsynth.h"

View File

@@ -485,7 +485,7 @@ f_cnt_t sampleBuffer::decodeSampleOGGVorbis( const char * _f,
f_cnt_t frames = 0;
QFile * f = new QFile( _f );
if( f->open( QFile::ReadOnly | QFile::Truncate ) == FALSE )
if( f->open( QFile::ReadOnly ) == FALSE )
{
delete f;
return( 0 );

View File

@@ -40,10 +40,9 @@
automatableButton::automatableButton( QWidget * _parent, const QString & _name,
track * _track ) :
QWidget( _parent ),
QPushButton( _parent ),
autoObj( _track, FALSE, FALSE, TRUE ),
m_group( NULL ),
m_checkable( FALSE )
m_group( NULL )
{
if( _track != NULL )
{
@@ -71,7 +70,7 @@ void automatableButton::contextMenuEvent( QContextMenuEvent * _me )
{
if( nullTrack() && ( m_group == NULL || m_group->nullTrack() ) )
{
QWidget::contextMenuEvent( _me );
QPushButton::contextMenuEvent( _me );
return;
}
@@ -109,11 +108,7 @@ void automatableButton::mousePressEvent( QMouseEvent * _me )
{
if( _me->button() == Qt::LeftButton )
{
if( m_checkable == FALSE )
{
setChecked( TRUE );
}
else
if( isCheckable() )
{
toggle();
}
@@ -121,7 +116,7 @@ void automatableButton::mousePressEvent( QMouseEvent * _me )
}
else
{
QWidget::mousePressEvent( _me );
QPushButton::mousePressEvent( _me );
}
}
@@ -130,10 +125,6 @@ void automatableButton::mousePressEvent( QMouseEvent * _me )
void automatableButton::mouseReleaseEvent( QMouseEvent * _me )
{
if( m_checkable == FALSE )
{
setChecked( FALSE );
}
emit clicked();
}
@@ -142,7 +133,7 @@ void automatableButton::mouseReleaseEvent( QMouseEvent * _me )
void automatableButton::toggle( void )
{
if( m_checkable == TRUE && m_group != NULL )
if( isCheckable() && m_group != NULL )
{
if( value() == FALSE )
{
@@ -165,6 +156,7 @@ void automatableButton::setValue( const bool _on )
{
autoObj::setValue( _on );
setFirstValue();
QPushButton::setChecked( _on );
update();
emit( toggled( value() ) );
}

View File

@@ -28,8 +28,10 @@
#include "effect_label.h"
#include <QtGui/QMouseEvent>
#include <QtGui/QLabel>
#include <QtGui/QMdiArea>
#include <QtGui/QMouseEvent>
#include <QtGui/QPushButton>
#include <QtXml/QDomElement>
#include "effect_tab_widget.h"
@@ -46,8 +48,7 @@
effectLabel::effectLabel( const QString & _initial_name, QWidget * _parent,
sampleTrack * _track ) :
QWidget( _parent ),
m_track( _track ),
m_show( TRUE )
m_track( _track )
{
m_effectBtn = new QPushButton( embed::getIconPixmap( "setup_audio" ),
"", this );
@@ -67,14 +68,21 @@ effectLabel::effectLabel( const QString & _initial_name, QWidget * _parent,
if( engine::getMainWindow()->workspace() )
{
engine::getMainWindow()->workspace()->addSubWindow( m_effWidget );
engine::getMainWindow()->workspace()->addSubWindow(
m_effWidget );
m_effWindow = m_effWidget->parentWidget();
m_effWindow->setAttribute( Qt::WA_DeleteOnClose, FALSE );
m_effWindow->layout()->setSizeConstraint(
QLayout::SetFixedSize );
}
else
{
m_effWindow = m_effWidget;
}
m_effWidget->setWindowTitle( _initial_name );
m_effWindow->setWindowTitle( _initial_name );
m_effWidget->setFixedSize( 240, 242 );
m_effWidget->hide();
connect( m_effWidget, SIGNAL( closed() ),
this, SLOT( closeEffects() ) );
m_effWindow->hide();
}
@@ -82,7 +90,7 @@ effectLabel::effectLabel( const QString & _initial_name, QWidget * _parent,
effectLabel::~effectLabel()
{
delete m_effWidget;
m_effWindow->deleteLater();
}
@@ -99,7 +107,7 @@ QString effectLabel::text( void ) const
void FASTCALL effectLabel::setText( const QString & _text )
{
m_label->setText( _text );
m_effWidget->setWindowTitle( _text );
m_effWindow->setWindowTitle( _text );
}
@@ -107,16 +115,18 @@ void FASTCALL effectLabel::setText( const QString & _text )
void effectLabel::showEffects( void )
{
if( m_show )
if( m_effWindow->isHidden() )
{
m_effWidget->show();
m_effWidget->raise();
m_show = FALSE;
if( m_effWindow != m_effWidget )
{
m_effWindow->show();
}
m_effWindow->raise();
}
else
{
m_effWidget->hide();
m_show = TRUE;
m_effWindow->hide();
}
}
@@ -154,15 +164,6 @@ void effectLabel::loadSettings( const QDomElement & _this )
void effectLabel::closeEffects( void )
{
m_effWidget->hide();
m_show = TRUE;
}
void effectLabel::rename( void )
{
QString txt = text();

View File

@@ -27,17 +27,18 @@
#include "project_notes.h"
#include <Qt/QtXml>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QCloseEvent>
#include <QtGui/QColorDialog>
#include <QtGui/QComboBox>
#include <QtGui/QFontDatabase>
#include <QtGui/QLineEdit>
#include <QtGui/QMdiArea>
#include <QtGui/QTextCursor>
#include <QtGui/QTextEdit>
#include <QtGui/QToolBar>
#include <QtGui/QMdiArea>
#include <QtXml/QDomCDATASection>
#include "embed.h"
#include "engine.h"
@@ -71,23 +72,18 @@ projectNotes::projectNotes( void ) :
setWindowTitle( tr( "Project notes" ) );
setWindowIcon( embed::getIconPixmap( "project_notes" ) );
resize( 300, 200 );
if( engine::getMainWindow()->workspace() )
{
engine::getMainWindow()->workspace()->addSubWindow( this );
}
QWidget * w = ( parentWidget() != NULL ) ? parentWidget() : this;
if( engine::getMainWindow()->workspace() != NULL )
{
w->move( 700, 10 );
parentWidget()->setAttribute( Qt::WA_DeleteOnClose, FALSE );
parentWidget()->move( 700, 10 );
parentWidget()->resize( 300, 200 );
}
else
{
w->move( 800, 10 );
move( 800, 10 );
resize( 300, 200 );
}
}