diff --git a/ChangeLog b/ChangeLog index 482899f97b..47133afa88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,71 @@ +2007-11-20 Javier Serrano Polo + + * include/drumsynth.h: + * licenses/drumsynth.LICENSE: + * src/lib/drumsynth.cpp: + relicensed under GPL, thanks to Paul Kellett. + + * src/lib/sample_buffer.cpp: + fixed Vorbis loading + + * include/effect_label.h: + * plugins/live_tool/live_tool.cpp: + * src/core/automation_editor.cpp: + * src/core/bb_editor.cpp: + * src/core/effect_tab_widget.cpp: + * src/core/main_window.cpp: + * src/core/song_editor.cpp: + * src/core/tool.cpp: + * src/widgets/effect_label.cpp: + * src/widgets/project_notes.cpp: + fixed MDI windows + + * include/main_window.h: + * src/core/automation_editor.cpp: + * src/core/main_window.cpp: + * src/core/piano_roll.cpp: + * src/core/song_editor.cpp: + fixed non-MDI mode + + * include/automatable_button.h: + * src/widgets/automatable_button.cpp: + inherit from QPushButton + + * include/tool.h: + * plugins/live_tool/live_tool.cpp: + * plugins/live_tool/live_tool.h: + * src/core/main_window.cpp: + * src/core/tool.cpp: + simplified tool interface + + * plugins/live_tool/live_tool.cpp: + fixed instrument toggling + + * plugins/live_tool/live_tool.cpp: + * plugins/live_tool/live_tool.h: + fixed focus bug + + * include/effect_label.h: + * src/widgets/effect_label.cpp: + simplified window management + + * include/effect_label.h: + * include/main_window.h: + * plugins/vst_base/lvsl_client.cpp: + * plugins/vst_effect/vst_effect.h: + * src/core/track_container.cpp: + reduced dependencies + + * data/samples/drumsynth/misc_bass/Makefile.am: + * data/samples/drumsynth/misc_claps/Makefile.am: + * data/samples/drumsynth/misc_electro/Makefile.am: + * data/samples/drumsynth/misc_fx/Makefile.am: + * data/samples/drumsynth/misc_hats/Makefile.am: + * data/samples/drumsynth/misc_perc/Makefile.am: + * data/samples/drumsynth/misc_synth/Makefile.am: + * data/samples/drumsynth/r_b/Makefile.am: + replaced more filenames with underscores, thanks to Vik. + 2007-11-20 Paul Giblock * src/core/main_window: diff --git a/configure.in b/configure.in index 2e54e83408..5c99ff6365 100644 --- a/configure.in +++ b/configure.in @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) -AC_INIT(lmms, 0.4.0-svn20071114, lmms-devel/at/lists/dot/sf/dot/net) -AM_INIT_AUTOMAKE(lmms, 0.4.0-svn20071114) +AC_INIT(lmms, 0.4.0-svn20071120, lmms-devel/at/lists/dot/sf/dot/net) +AM_INIT_AUTOMAKE(lmms, 0.4.0-svn20071120) AM_CONFIG_HEADER(config.h) diff --git a/data/samples/drumsynth/misc_bass/Makefile.am b/data/samples/drumsynth/misc_bass/Makefile.am index d7357d3eb3..1727468fc6 100644 --- a/data/samples/drumsynth/misc_bass/Makefile.am +++ b/data/samples/drumsynth/misc_bass/Makefile.am @@ -1,4 +1,4 @@ -miscbassdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc bass +miscbassdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc_bass miscbassdrumsynthsamples_DATA = *.ds diff --git a/data/samples/drumsynth/misc_claps/Makefile.am b/data/samples/drumsynth/misc_claps/Makefile.am index e21057adac..81dd109bbc 100644 --- a/data/samples/drumsynth/misc_claps/Makefile.am +++ b/data/samples/drumsynth/misc_claps/Makefile.am @@ -1,4 +1,4 @@ -miscclapsdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc claps +miscclapsdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc_claps miscclapsdrumsynthsamples_DATA = *.ds diff --git a/data/samples/drumsynth/misc_electro/Makefile.am b/data/samples/drumsynth/misc_electro/Makefile.am index 4dce594765..efff0d3e62 100644 --- a/data/samples/drumsynth/misc_electro/Makefile.am +++ b/data/samples/drumsynth/misc_electro/Makefile.am @@ -1,4 +1,4 @@ -miscelectrodrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc electro +miscelectrodrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc_electro miscelectrodrumsynthsamples_DATA = *.ds diff --git a/data/samples/drumsynth/misc_fx/Makefile.am b/data/samples/drumsynth/misc_fx/Makefile.am index eb35abafdb..14dd367353 100644 --- a/data/samples/drumsynth/misc_fx/Makefile.am +++ b/data/samples/drumsynth/misc_fx/Makefile.am @@ -1,4 +1,4 @@ -miscfxdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc fx +miscfxdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc_fx miscfxdrumsynthsamples_DATA = *.ds diff --git a/data/samples/drumsynth/misc_hats/Makefile.am b/data/samples/drumsynth/misc_hats/Makefile.am index 5d5a1d49e6..7f34b9660f 100644 --- a/data/samples/drumsynth/misc_hats/Makefile.am +++ b/data/samples/drumsynth/misc_hats/Makefile.am @@ -1,4 +1,4 @@ -mischatsdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc hats +mischatsdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc_hats mischatsdrumsynthsamples_DATA = *.ds diff --git a/data/samples/drumsynth/misc_perc/Makefile.am b/data/samples/drumsynth/misc_perc/Makefile.am index be19e93a6e..6d3862ef4a 100644 --- a/data/samples/drumsynth/misc_perc/Makefile.am +++ b/data/samples/drumsynth/misc_perc/Makefile.am @@ -1,4 +1,4 @@ -miscpercdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc perc +miscpercdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc_perc miscpercdrumsynthsamples_DATA = *.ds diff --git a/data/samples/drumsynth/misc_synth/Makefile.am b/data/samples/drumsynth/misc_synth/Makefile.am index df38631e88..483b9b9fc6 100644 --- a/data/samples/drumsynth/misc_synth/Makefile.am +++ b/data/samples/drumsynth/misc_synth/Makefile.am @@ -1,4 +1,4 @@ -miscsynthdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc synth +miscsynthdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/misc_synth miscsynthdrumsynthsamples_DATA = *.ds diff --git a/data/samples/drumsynth/r_b/Makefile.am b/data/samples/drumsynth/r_b/Makefile.am index a5444c503a..6d1e0798c0 100644 --- a/data/samples/drumsynth/r_b/Makefile.am +++ b/data/samples/drumsynth/r_b/Makefile.am @@ -1,4 +1,4 @@ -rbdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/r&b +rbdrumsynthsamplesdir = $(lmmsdatadir)/samples/drumsynth/r_b rbdrumsynthsamples_DATA = *.ds diff --git a/include/automatable_button.h b/include/automatable_button.h index a3d78d06c9..117d4b13b6 100644 --- a/include/automatable_button.h +++ b/include/automatable_button.h @@ -26,7 +26,7 @@ #ifndef _AUTOMATABLE_BUTTON_H #define _AUTOMATABLE_BUTTON_H -#include +#include #include "automatable_object.h" @@ -34,7 +34,7 @@ class automatableButtonGroup; -class automatableButton : public QWidget, public automatableObject { Q_OBJECT @@ -44,22 +44,12 @@ public: virtual ~automatableButton(); - inline virtual bool isChecked( void ) const - { - return( value() ); - } - virtual void setValue( const bool _on ); inline void setCheckable( bool _on ) { - m_checkable = _on; - setJournalling( m_checkable ); - } - - inline bool isCheckable( void ) const - { - return( m_checkable ); + QPushButton::setCheckable( _on ); + setJournalling( _on ); } @@ -67,6 +57,7 @@ public slots: virtual void toggle( void ); virtual void setChecked( bool _on ) { + // QPushButton::setChecked is called in setValue() setValue( _on ); } @@ -79,16 +70,10 @@ protected: private: automatableButtonGroup * m_group; - bool m_checkable; friend class automatableButtonGroup; - -signals: - void clicked( void ); - void toggled( bool ); - } ; diff --git a/include/drumsynth.h b/include/drumsynth.h index 9c5642aa56..8e566d35cc 100644 --- a/include/drumsynth.h +++ b/include/drumsynth.h @@ -1,30 +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 -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. +/* + * drumsynth.h - DrumSynth DS file renderer + * + * Copyright (c) 1998-2000 Paul Kellett (mda-vst.com) + * Copyright (c) 2007 Paul Giblock + * + * 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. + * + */ + #ifndef _DRUMSYNTH_H__ #define _DRUMSYNTH_H__ diff --git a/include/effect_label.h b/include/effect_label.h index bdf16d6702..1403e9e165 100644 --- a/include/effect_label.h +++ b/include/effect_label.h @@ -27,12 +27,13 @@ #define _EFFECT_LABEL_H #include -#include -#include #include "journalling_object.h" +class QLabel; +class QPushButton; + class effectTabWidget; class sampleTrack; class tabWidget; @@ -56,11 +57,12 @@ public: { return( "sample_track" ); } + public slots: void showEffects( void ); - void closeEffects( void ); void rename( void ); + signals: void clicked( void ); @@ -68,18 +70,21 @@ signals: void nameChanged( const QString & _new_name ); void pixmapChanged( void ); + protected: virtual void mousePressEvent( QMouseEvent * _me ); virtual void mouseDoubleClickEvent( QMouseEvent * _me ); + private: sampleTrack * m_track; - bool m_show; QLabel * m_label; QPushButton * m_effectBtn; tabWidget * m_tabWidget; effectTabWidget * m_effWidget; + QWidget * m_effWindow; + }; #endif diff --git a/include/effect_tab_widget.h b/include/effect_tab_widget.h index 1739418e28..f2198bcd3c 100644 --- a/include/effect_tab_widget.h +++ b/include/effect_tab_widget.h @@ -28,13 +28,13 @@ #define _EFFECT_TAB_WIDGET_H #include -#include -#include #include "journalling_object.h" #include "rack_view.h" +class QPushButton; + class audioPort; class groupBox; class instrumentTrack; @@ -68,19 +68,11 @@ public: } -signals: - void closed( void ); - - private slots: void addEffect( void ); void setBypass( bool _state ); -protected: - virtual void closeEvent( QCloseEvent * _ce ); - - private: track * m_track; audioPort * m_port; diff --git a/include/main_window.h b/include/main_window.h index 4a0016b969..6e309098f7 100644 --- a/include/main_window.h +++ b/include/main_window.h @@ -28,12 +28,12 @@ #include #include -#include #include class QAction; class QDomElement; class QGridLayout; +class QMdiArea; class QSplashScreen; class configManager; @@ -123,6 +123,8 @@ private: void finalize( void ); + void toggleWindow( QWidget * _w ); + QMdiArea * m_workspace; diff --git a/include/tool.h b/include/tool.h index 4c26f2690f..7baa2cfab3 100644 --- a/include/tool.h +++ b/include/tool.h @@ -31,19 +31,15 @@ #include "plugin.h" -class mainWindow; - - class tool : public QWidget, public plugin { public: - tool( mainWindow * _window, const descriptor * _descriptor ); + tool( const descriptor * _descriptor ); virtual ~tool(); // instantiate tool-plugin with given name or return NULL // on failure - static tool * FASTCALL instantiate( const QString & _plugin_name, - mainWindow * _window ); + static tool * FASTCALL instantiate( const QString & _plugin_name ); } ; diff --git a/licenses/drumsynth.LICENSE b/licenses/drumsynth.LICENSE deleted file mode 100644 index 398303119a..0000000000 --- a/licenses/drumsynth.LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -DrumSynth Original License (MIT): ----------------------------------------------------------------- - -Copyright (c) 1998-2000 Paul Kellett (mda-vst.com) - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/live_tool/live_tool.cpp b/plugins/live_tool/live_tool.cpp index 84217a6198..75c291ebfe 100644 --- a/plugins/live_tool/live_tool.cpp +++ b/plugins/live_tool/live_tool.cpp @@ -23,9 +23,11 @@ */ -#include - #include "live_tool.h" + +#include +#include + #include "bb_editor.h" #include "engine.h" #include "song_editor.h" @@ -63,8 +65,8 @@ plugin::descriptor live_tool_plugin_descriptor = -liveTool::liveTool( mainWindow * _window ) : - tool( _window, &live_tool_plugin_descriptor ) +liveTool::liveTool( void ) : + tool( &live_tool_plugin_descriptor ) { const QPixmap background = PLUGIN_NAME::getIconPixmap( "artwork" ); @@ -83,6 +85,12 @@ liveTool::liveTool( mainWindow * _window ) : "Beat+Baseline Editor." ) ); hide(); + if( parentWidget() ) + { + parentWidget()->hide(); + parentWidget()->layout()->setSizeConstraint( + QLayout::SetFixedSize ); + } } @@ -133,6 +141,16 @@ void liveTool::keyPressEvent( QKeyEvent * _ke ) +void liveTool::mousePressEvent( QMouseEvent * _me ) +{ + // MDI window gets focus otherwise + setFocus(); + _me->accept(); +} + + + + #ifdef Q_WS_X11 bool liveTool::x11Event( XEvent * _xe ) { @@ -155,7 +173,7 @@ bool liveTool::x11Event( XEvent * _xe ) void liveTool::toggleInstrument( int _n ) { - if( _n > 0 && _n < engine::getBBEditor()->tracks().count() ) + if( _n < engine::getBBEditor()->tracks().count() ) { track * t = engine::getBBEditor()->tracks().at( _n ); t->setMuted( !t->muted() ); @@ -171,7 +189,7 @@ extern "C" // neccessary for getting instance out of shared lib plugin * lmms_plugin_main( void * _data ) { - return( new liveTool( static_cast( _data ) ) ); + return( new liveTool() ); } } diff --git a/plugins/live_tool/live_tool.h b/plugins/live_tool/live_tool.h index 39eacceaa9..876378ce6a 100644 --- a/plugins/live_tool/live_tool.h +++ b/plugins/live_tool/live_tool.h @@ -1,7 +1,7 @@ /* * live_tool.h - declaration of class liveTool, for live performance * - * Copyright (c) 2006 Javier Serrano Polo + * Copyright (c) 2006-2007 Javier Serrano Polo * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -35,7 +35,7 @@ class liveTool : public tool { public: - liveTool( mainWindow * _window ); + liveTool( void ); virtual ~liveTool(); virtual QString nodeName( void ) const; @@ -43,6 +43,7 @@ public: protected: virtual void keyPressEvent( QKeyEvent * _ke ); + virtual void mousePressEvent( QMouseEvent * _me ); #ifdef Q_WS_X11 virtual bool x11Event( XEvent * _xe ); #endif diff --git a/plugins/vst_base/lvsl_client.cpp b/plugins/vst_base/lvsl_client.cpp index c1e9bb6baf..419b5cf677 100644 --- a/plugins/vst_base/lvsl_client.cpp +++ b/plugins/vst_base/lvsl_client.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include diff --git a/plugins/vst_effect/vst_effect.h b/plugins/vst_effect/vst_effect.h index f3a528e84f..404d47a23a 100644 --- a/plugins/vst_effect/vst_effect.h +++ b/plugins/vst_effect/vst_effect.h @@ -27,7 +27,7 @@ #define _VST_EFFECT_H #include -#include +#include #include "effect.h" #include "engine.h" diff --git a/src/core/automation_editor.cpp b/src/core/automation_editor.cpp index 99e07ede1c..bb3a62c1f2 100644 --- a/src/core/automation_editor.cpp +++ b/src/core/automation_editor.cpp @@ -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(); } diff --git a/src/core/bb_editor.cpp b/src/core/bb_editor.cpp index 59ff2f4189..81ad4eb35e 100644 --- a/src/core/bb_editor.cpp +++ b/src/core/bb_editor.cpp @@ -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(); } diff --git a/src/core/effect_tab_widget.cpp b/src/core/effect_tab_widget.cpp index 2fb3498d30..776a8911d7 100644 --- a/src/core/effect_tab_widget.cpp +++ b/src/core/effect_tab_widget.cpp @@ -26,22 +26,22 @@ */ -#include +#include "effect_tab_widget.h" + + #include #include -#include -#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 diff --git a/src/core/main_window.cpp b/src/core/main_window.cpp index ba90395bae..bc2cd093af 100644 --- a/src/core/main_window.cpp +++ b/src/core/main_window.cpp @@ -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(); } diff --git a/src/core/piano_roll.cpp b/src/core/piano_roll.cpp index d7ccbfea30..06bcab0856 100644 --- a/src/core/piano_roll.cpp +++ b/src/core/piano_roll.cpp @@ -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(); } diff --git a/src/core/song_editor.cpp b/src/core/song_editor.cpp index e5bb5ea264..0b2a81edf3 100644 --- a/src/core/song_editor.cpp +++ b/src/core/song_editor.cpp @@ -413,8 +413,15 @@ songEditor::~songEditor() void songEditor::closeEvent( QCloseEvent * _ce ) { + if( parentWidget() ) + { + parentWidget()->hide(); + } + else + { + hide(); + } _ce->ignore(); - hide(); } diff --git a/src/core/tool.cpp b/src/core/tool.cpp index e87a9f77a7..c755a75f60 100644 --- a/src/core/tool.cpp +++ b/src/core/tool.cpp @@ -30,17 +30,29 @@ #include #include +#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( p ) != NULL ) { diff --git a/src/core/track_container.cpp b/src/core/track_container.cpp index 08200714b2..21149f6b28 100644 --- a/src/core/track_container.cpp +++ b/src/core/track_container.cpp @@ -56,7 +56,6 @@ trackContainer::trackContainer( void ) : - QWidget( ), m_currentPosition( 0, 0 ), m_scrollArea( new scrollArea( this ) ), m_ppt( DEFAULT_PIXELS_PER_TACT ), diff --git a/src/lib/drumsynth.cpp b/src/lib/drumsynth.cpp index e33e2a1bbc..509cd9d0fd 100644 --- a/src/lib/drumsynth.cpp +++ b/src/lib/drumsynth.cpp @@ -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 + * + * 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" diff --git a/src/lib/sample_buffer.cpp b/src/lib/sample_buffer.cpp index 4403ed34d6..71d5cfcc6f 100644 --- a/src/lib/sample_buffer.cpp +++ b/src/lib/sample_buffer.cpp @@ -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 ); diff --git a/src/widgets/automatable_button.cpp b/src/widgets/automatable_button.cpp index 6d49b1ef95..a8181ae511 100644 --- a/src/widgets/automatable_button.cpp +++ b/src/widgets/automatable_button.cpp @@ -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() ) ); } diff --git a/src/widgets/effect_label.cpp b/src/widgets/effect_label.cpp index ce4013fb04..ce7a19e032 100644 --- a/src/widgets/effect_label.cpp +++ b/src/widgets/effect_label.cpp @@ -28,8 +28,10 @@ #include "effect_label.h" -#include +#include #include +#include +#include #include #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(); diff --git a/src/widgets/project_notes.cpp b/src/widgets/project_notes.cpp index dc9edef51c..ec6a615a1f 100644 --- a/src/widgets/project_notes.cpp +++ b/src/widgets/project_notes.cpp @@ -27,17 +27,18 @@ #include "project_notes.h" -#include #include #include +#include #include #include #include #include +#include #include #include #include -#include +#include #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 ); } - }