From 4952f2391763840d902d1e525456ad1cd950d634 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Fri, 28 Oct 2005 15:58:35 +0000 Subject: [PATCH] made LMMS capable of managing its windows like GIMP (no MDI) and fixed some small bugs git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@22 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 20 ++++++++++ TODO | 1 + configure.in | 4 +- include/qt3support.h | 4 +- include/setup_dialog.h | 3 ++ include/tab_widget.h | 2 +- plugins/vestige/vestige.cpp | 1 + plugins/vestige/vestige.h | 2 +- src/core/bb_editor.cpp | 23 +++++++---- src/core/file_browser.cpp | 68 ++++++++++++++++++--------------- src/core/main.cpp | 14 ++++++- src/core/setup_dialog.cpp | 26 ++++++++++++- src/core/song_editor.cpp | 29 +++++++++++--- src/core/track_container.cpp | 16 +++++--- src/widgets/knob.cpp | 4 +- src/widgets/lcd_spinbox.cpp | 2 +- src/widgets/project_notes.cpp | 6 ++- src/widgets/side_bar_widget.cpp | 4 +- 18 files changed, 164 insertions(+), 65 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c17326ff..939f98192 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2005-10-28 Tobias Doerffel + + * src/widgets/project_notes.cpp: + set initial text to bright gray, since black text on a very dark back- + ground isn't very readable... + + * include/lmms_main_win.h: + * include/setup_dialog.h: + * src/core/bb_editor.cpp: + * src/core/lmms_main_win.cpp: + * src/core/setup_dialog.cpp: + * src/core/song_editor.cpp: + * src/widgets/project_notes.cpp: + added support for GIMP-like usability, i.e. no MDI + + * src/core/song_editor.cpp: + * src/core/bb_editor.cpp: + reorder some code in constructor for not crashing if window is + shown while constructor is still running + 2005-10-23 Tobias Doerffel * src/widgets/led_checkbox.cpp: diff --git a/TODO b/TODO index 731d05632..678f902c0 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ +- check ladspa-header - arpeggio: send midi-out-events via channel-track - tooltips for controls in MIDI-tab - sample-track: sane bg and wave-color diff --git a/configure.in b/configure.in index 4b1dd307c..fb5a76d4c 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.1.1-cvs20051023, tobydox@users.sourceforge.net) -AM_INIT_AUTOMAKE(lmms, 0.1.1-cvs20051023) +AC_INIT(lmms, 0.1.1-cvs20051027, tobydox@users.sourceforge.net) +AM_INIT_AUTOMAKE(lmms, 0.1.1-cvs20051027) AM_CONFIG_HEADER(config.h) diff --git a/include/qt3support.h b/include/qt3support.h index f5f4c0666..1730353fa 100644 --- a/include/qt3support.h +++ b/include/qt3support.h @@ -27,10 +27,10 @@ // don't know why following line is neccessary, it's a bug in qt-headers - // otherwise LMMS sometimes fails to compile -#include +//#include #include -//#include +#include #if QT_VERSION >= 0x040000 #ifndef QT4 diff --git a/include/setup_dialog.h b/include/setup_dialog.h index 4a428029e..1fe0b67c9 100644 --- a/include/setup_dialog.h +++ b/include/setup_dialog.h @@ -39,6 +39,7 @@ #endif + #include "audio_device.h" #include "midi_client.h" @@ -84,6 +85,7 @@ private slots: void toggleToolTips( bool _disabled ); void toggleKnobUsability( bool _classical ); + void toggleGIMPLikeWindows( bool _enabled ); private: @@ -95,6 +97,7 @@ private: bool m_disableToolTips; bool m_classicalKnobUsability; + bool m_gimpLikeWindows; typedef QMap aswMap; diff --git a/include/tab_widget.h b/include/tab_widget.h index 54cc97c5c..32576c3cc 100644 --- a/include/tab_widget.h +++ b/include/tab_widget.h @@ -34,8 +34,8 @@ #else -#include #include +#include #include "spc_bg_hndl_widget.h" diff --git a/plugins/vestige/vestige.cpp b/plugins/vestige/vestige.cpp index 1b8101a91..dab683577 100644 --- a/plugins/vestige/vestige.cpp +++ b/plugins/vestige/vestige.cpp @@ -286,6 +286,7 @@ void vestigeInstrument::play( void ) events.events[i] = (VstEvent *) &cur_events[i]; } events.numEvents = cur_events.size(); + printf( "VeSTige: posting %d events\n", cur_events.size()); events.reserved = 0; m_fst->plugin->dispatcher( m_fst->plugin, effProcessEvents, 0, 0, &events, 0.0f ); diff --git a/plugins/vestige/vestige.h b/plugins/vestige/vestige.h index 4560c9b00..60ac56de5 100644 --- a/plugins/vestige/vestige.h +++ b/plugins/vestige/vestige.h @@ -34,7 +34,7 @@ #else -#include +#include #endif diff --git a/src/core/bb_editor.cpp b/src/core/bb_editor.cpp index 24264ebcc..4d909e834 100644 --- a/src/core/bb_editor.cpp +++ b/src/core/bb_editor.cpp @@ -63,19 +63,25 @@ QPixmap * bbEditor::s_titleArtwork = NULL; bbEditor::bbEditor() : trackContainer() { - setWindowIcon( embed::getIconPixmap( "bb_track" ) ); - setWindowTitle( tr( "Beat+Bassline Editor" ) ); - setMinimumWidth( TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH + - BBE_PPT + 2 * TCO_BORDER_WIDTH ); - setGeometry( 10, 340, minimumWidth(), 300 ); - show(); - if( s_titleArtwork == NULL ) { s_titleArtwork = new QPixmap( embed::getIconPixmap( "bb_editor_title_artwork" ) ); } + setWindowIcon( embed::getIconPixmap( "bb_track" ) ); + setWindowTitle( tr( "Beat+Bassline Editor" ) ); + setMinimumWidth( TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH + + BBE_PPT + 2 * TCO_BORDER_WIDTH ); + if( lmmsMainWin::inst()->workspace() != NULL ) + { + setGeometry( 10, 340, minimumWidth(), 300 ); + } + else + { + setGeometry( 210, 340, minimumWidth(), 300 ); + } + containerWidget()->move( 0, 47 ); setPixelsPerTact( BBE_PPT ); updateBackground(); @@ -122,6 +128,8 @@ bbEditor::bbEditor() : #ifndef QT4 setBackgroundMode( Qt::NoBackground ); #endif + + show(); } @@ -321,6 +329,7 @@ void bbEditor::updateBackground( void ) p.fillRect( 0, 0, width(), s_titleArtwork->height(), QColor( 74, 125, 213 ) ); p.drawPixmap( 0, 0, *s_titleArtwork ); + #ifdef QT4 QPalette pal = palette(); pal.setBrush( backgroundRole(), QBrush( draw_pm ) ); diff --git a/src/core/file_browser.cpp b/src/core/file_browser.cpp index 72434e4c1..882b902ca 100644 --- a/src/core/file_browser.cpp +++ b/src/core/file_browser.cpp @@ -358,57 +358,63 @@ void fileBrowser::contextMenuRequest( QListViewItem * i, const QPoint &, int ) void fileBrowser::sendToActiveChannel( void ) { - // get all windows opened in the workspace - QWidgetList pl = lmmsMainWin::inst()->workspace()->windowList( + if( lmmsMainWin::inst()->workspace() != NULL ) + { + // get all windows opened in the workspace + QWidgetList pl = lmmsMainWin::inst()->workspace()->windowList( #if QT_VERSION >= 0x030200 QWorkspace::StackingOrder #endif ); #ifdef QT4 - QListIterator w( pl ); - w.toBack(); - // now we travel through the window-list until we find a channel-track - while( w.hasPrevious() ) - { - channelTrack * ct = dynamic_cast( + QListIterator w( pl ); + w.toBack(); + // now we travel through the window-list until we find a + // channel-track + while( w.hasPrevious() ) + { + channelTrack * ct = dynamic_cast( w.previous() ); #else - QWidget * w = pl.last(); - // now we travel through the window-list until we find a channel-track - while( w != NULL ) - { - channelTrack * ct = dynamic_cast( w ); -#endif - if( ct != NULL && ct->isHidden() == FALSE ) + QWidget * w = pl.last(); + // now we travel through the window-list until we find a + // channel-track + while( w != NULL ) { - // ok, it's a channel-track, so we can apply the - // sample or the preset - if( m_contextMenuItem->type() == fileItem::SAMPLE_FILE ) + channelTrack * ct = dynamic_cast( w ); +#endif + if( ct != NULL && ct->isHidden() == FALSE ) { - instrument * afp = ct->loadInstrument( - "audiofileprocessor" ); - if( afp != NULL ) + // ok, it's a channel-track, so we can apply the + // sample or the preset + if( m_contextMenuItem->type() == + fileItem::SAMPLE_FILE ) { - afp->setParameter( "audiofile", + instrument * afp = ct->loadInstrument( + "audiofileprocessor" ); + if( afp != NULL ) + { + afp->setParameter( "audiofile", m_contextMenuItem->fullName() ); + } } - } - else if( m_contextMenuItem->type() == + else if( m_contextMenuItem->type() == fileItem::PRESET_FILE ) - { - multimediaProject mmp( + { + multimediaProject mmp( m_contextMenuItem->fullName() ); - ct->loadTrackSpecificSettings( + ct->loadTrackSpecificSettings( mmp.content(). firstChild(). toElement() ); + } + ct->toggledChannelButton( TRUE ); + break; } - ct->toggledChannelButton( TRUE ); - break; - } #ifndef QT4 - w = pl.prev(); + w = pl.prev(); #endif + } } } diff --git a/src/core/main.cpp b/src/core/main.cpp index 2431adcbf..f66380442 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -147,7 +147,19 @@ int main( int argc, char * * argv ) #ifndef QT4 app.setMainWidget( lmmsMainWin::inst() ); #endif - lmmsMainWin::inst()->showMaximized(); + // MDI-mode? + if( lmmsMainWin::inst()->workspace() != NULL ) + { + // then maximize + lmmsMainWin::inst()->showMaximized(); + } + else + { + // otherwise arrange at top-left edge of screen + lmmsMainWin::inst()->show(); + lmmsMainWin::inst()->move( 0, 0 ); + lmmsMainWin::inst()->resize( 200, 500 ); + } #if QT_VERSION >= 0x030200 diff --git a/src/core/setup_dialog.cpp b/src/core/setup_dialog.cpp index f39a33686..a6c8a75fc 100644 --- a/src/core/setup_dialog.cpp +++ b/src/core/setup_dialog.cpp @@ -89,13 +89,16 @@ inline void labelWidget( QWidget * _w, const QString & _txt ) + setupDialog::setupDialog( configTabs _tab_to_open ) : QDialog(), m_bufferSize( mixer::inst()->framesPerAudioBuffer() ), m_disableToolTips( configManager::inst()->value( "tooltips", "disabled" ).toInt() ), m_classicalKnobUsability( configManager::inst()->value( "knobs", - "classicalusability" ).toInt() ) + "classicalusability" ).toInt() ), + m_gimpLikeWindows( configManager::inst()->value( "app", + "gimplikewindows" ).toInt() ) { setWindowIcon( embed::getIconPixmap( "setup_general" ) ); setWindowTitle( tr( "Setup LMMS" ) ); @@ -156,7 +159,7 @@ setupDialog::setupDialog( configTabs _tab_to_open ) : tabWidget * misc_tw = new tabWidget( tr( "MISC" ), general ); - misc_tw->setFixedHeight( 60 ); + misc_tw->setFixedHeight( 76 ); ledCheckBox * disable_tooltips = new ledCheckBox( tr( "Disable tooltips (no spurious " @@ -167,6 +170,7 @@ setupDialog::setupDialog( configTabs _tab_to_open ) : connect( disable_tooltips, SIGNAL( toggled( bool ) ), this, SLOT( toggleToolTips( bool ) ) ); + ledCheckBox * classical_knob_usability = new ledCheckBox( tr( "Classical knob usability (move " "cursor around knob to change " @@ -178,6 +182,15 @@ setupDialog::setupDialog( configTabs _tab_to_open ) : this, SLOT( toggleKnobUsability( bool ) ) ); + ledCheckBox * gimp_like_windows = new ledCheckBox( + tr( "GIMP-like windows (no MDI)" ), + misc_tw ); + gimp_like_windows->move( 10, 54 ); + gimp_like_windows->setChecked( m_gimpLikeWindows ); + connect( gimp_like_windows, SIGNAL( toggled( bool ) ), + this, SLOT( toggleGIMPLikeWindows( bool ) ) ); + + gen_layout->addWidget( bufsize_tw ); gen_layout->addSpacing( 10 ); gen_layout->addWidget( misc_tw ); @@ -417,6 +430,8 @@ void setupDialog::accept( void ) QString::number( m_disableToolTips ) ); configManager::inst()->setValue( "knobs", "classicalusability", QString::number( m_classicalKnobUsability ) ); + configManager::inst()->setValue( "app", "gimplikewindows", + QString::number( m_gimpLikeWindows ) ); // tell all audio-settings-widget to save their settings for( aswMap::iterator it = m_audioIfaceSetupWidgets.begin(); it != m_audioIfaceSetupWidgets.end(); ++it ) @@ -588,5 +603,12 @@ void setupDialog::toggleKnobUsability( bool _classical ) +void setupDialog::toggleGIMPLikeWindows( bool _enabled ) +{ + m_gimpLikeWindows = _enabled; +} + + + #include "setup_dialog.moc" diff --git a/src/core/song_editor.cpp b/src/core/song_editor.cpp index 60a2cc444..1ae07ff24 100644 --- a/src/core/song_editor.cpp +++ b/src/core/song_editor.cpp @@ -124,8 +124,14 @@ songEditor::songEditor() : setWindowTitle( tr( "Song-Editor" ) ); setWindowIcon( embed::getIconPixmap( "songeditor" ) ); - setGeometry( 10, 10, 680, 300 ); - show(); + if( lmmsMainWin::inst()->workspace() != NULL ) + { + setGeometry( 10, 10, 680, 300 ); + } + else + { + setGeometry( 210, 10, 580, 300 ); + } #ifdef QT4 setFocusPolicy( Qt::StrongFocus ); @@ -134,10 +140,10 @@ songEditor::songEditor() : #endif setFocus(); - QWidget * cw = new QWidget( this ); setCentralWidget( cw ); + // create time-line timeLine * tl = new timeLine( TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH, 0, @@ -449,10 +455,18 @@ songEditor::songEditor() : this, SLOT( zoomingChanged( const QString & ) ) ); + show(); m_projectNotes = new projectNotes(); m_projectNotes->resize( 300, 200 ); - m_projectNotes->move( 700, 10 ); + if( lmmsMainWin::inst()->workspace() != NULL ) + { + m_projectNotes->move( 700, 10 ); + } + else + { + m_projectNotes->move( 800, 10 ); + } m_projectNotes->show(); @@ -498,15 +512,18 @@ void songEditor::paintEvent( QPaintEvent * _pe ) // responsible for moving scrollbars after resizing void songEditor::resizeEvent( QResizeEvent * _re ) { - m_leftRightScroll->setGeometry( 0, + if( centralWidget() != NULL ) + { + m_leftRightScroll->setGeometry( 0, centralWidget()->height() - 2 - SCROLLBAR_SIZE, centralWidget()->width() - SCROLLBAR_SIZE, SCROLLBAR_SIZE ); - m_playPos[PLAY_SONG].m_timeLine->setFixedWidth( + m_playPos[PLAY_SONG].m_timeLine->setFixedWidth( centralWidget()->width() ); + } trackContainer::resizeEvent( _re ); } diff --git a/src/core/track_container.cpp b/src/core/track_container.cpp index 34d1a69c6..700614e1d 100644 --- a/src/core/track_container.cpp +++ b/src/core/track_container.cpp @@ -38,7 +38,6 @@ #include #define setValue setProgress -#define value progress #define maximum totalSteps #endif @@ -54,6 +53,7 @@ #include "string_pair_drag.h" #include "channel_track.h" #include "mmp.h" +#include "config_mgr.h" @@ -68,16 +68,21 @@ trackContainer::trackContainer() : m_ppt( DEFAULT_PIXELS_PER_TACT ) { #ifdef QT4 - lmmsMainWin::inst()->workspace()->addWindow( this ); + if( lmmsMainWin::inst()->workspace() != NULL ) + { + lmmsMainWin::inst()->workspace()->addWindow( this ); + } #endif m_scrollArea = new scrollArea( this ); + m_scrollArea->show(); setAcceptDrops( TRUE ); } + trackContainer::~trackContainer() { while( m_trackWidgets.size() ) @@ -128,10 +133,11 @@ void trackContainer::loadSettings( const QDomElement & _this ) } else { - start_val = pd->value(); #ifdef QT4 + start_val = pd->value(); pd->setMaximum( pd->maximum() + _this.childNodes().count() ); #else + start_val = pd->progress(); pd->setTotalSteps( pd->maximum() + _this.childNodes().count() ); #endif } @@ -139,10 +145,11 @@ void trackContainer::loadSettings( const QDomElement & _this ) QDomNode node = _this.firstChild(); while( !node.isNull() ) { - pd->setValue( pd->value() + 1 ); #ifdef QT4 + pd->setValue( pd->value() + 1 ); qApp->processEvents( QEventLoop::AllEvents, 100 ); #else + pd->setValue( pd->progress() + 1 ); qApp->processEvents( 100 ); #endif @@ -458,5 +465,4 @@ void trackContainer::scrollArea::wheelEvent( QWheelEvent * _we ) #include "track_container.moc" #undef setValue -#undef value #undef maximum diff --git a/src/widgets/knob.cpp b/src/widgets/knob.cpp index 60abce2bb..61fa50de7 100644 --- a/src/widgets/knob.cpp +++ b/src/widgets/knob.cpp @@ -74,8 +74,6 @@ #include "templates.h" -const int WHEEL_DELTA = 120; - static double MinRelStep = 1.0e-10; static double DefaultRelStep = 1.0e-2; @@ -468,7 +466,7 @@ void knob::mouseDoubleClickEvent( QMouseEvent * ) void knob::wheelEvent( QWheelEvent * _we ) { _we->accept(); - const int inc = _we->delta() / WHEEL_DELTA; + const int inc = ( _we->delta() > 0 ) ? 1 : -1; incValue( inc ); songEditor::inst()->setModified(); diff --git a/src/widgets/lcd_spinbox.cpp b/src/widgets/lcd_spinbox.cpp index 8e626631f..c897705e5 100644 --- a/src/widgets/lcd_spinbox.cpp +++ b/src/widgets/lcd_spinbox.cpp @@ -186,7 +186,7 @@ void lcdSpinBox::mouseReleaseEvent( QMouseEvent * _me ) void lcdSpinBox::wheelEvent( QWheelEvent * _we ) { _we->accept(); - setValue( value() + _we->delta() / 120 * m_step ); + setValue( value() + ( ( _we->delta() > 0 ) ? 1 : -1 ) * m_step ); emit valueChanged( value() ); } diff --git a/src/widgets/project_notes.cpp b/src/widgets/project_notes.cpp index 6f85e8759..805104d81 100644 --- a/src/widgets/project_notes.cpp +++ b/src/widgets/project_notes.cpp @@ -1,5 +1,5 @@ /* - * project_notes.h - header for project-notes-editor + * project_notes.cpp - implementation of project-notes-editor * * Linux MultiMedia Studio * Copyright (c) 2004-2005 Tobias Doerffel @@ -21,6 +21,7 @@ * */ + #include "qt3support.h" #ifdef QT4 @@ -113,6 +114,9 @@ projectNotes::projectNotes() : void projectNotes::clear( void ) { m_edit->setHtml( tr( "Put down your project notes here." ) ); + m_edit->selectAll( TRUE ); + m_edit->setTextColor( QColor( 224, 224, 224 ) ); + m_edit->selectAll( FALSE ); } diff --git a/src/widgets/side_bar_widget.cpp b/src/widgets/side_bar_widget.cpp index e890cb6ad..862a8c45a 100644 --- a/src/widgets/side_bar_widget.cpp +++ b/src/widgets/side_bar_widget.cpp @@ -68,7 +68,7 @@ sideBarWidget::~sideBarWidget() void sideBarWidget::paintEvent( QPaintEvent * ) { - const Uint16 TITLE_FONT_HEIGHT = 16; + const Uint16 TITLE_FONT_HEIGHT = 13; #ifdef QT4 QPainter p( this ); @@ -76,7 +76,7 @@ void sideBarWidget::paintEvent( QPaintEvent * ) #else QPixmap draw_pm( rect().size() ); draw_pm.fill( QApplication::palette().color( QPalette::Normal, - QColorGroup::Background ) ); + QColorGroup::Background ) ); QPainter p( &draw_pm, this ); p.fillRect( 0, 0, width(), 27, QApplication::palette().color(