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
This commit is contained in:
Tobias Doerffel
2005-10-28 15:58:35 +00:00
parent da6b2e1904
commit 4952f23917
18 changed files with 164 additions and 65 deletions

View File

@@ -1,3 +1,23 @@
2005-10-28 Tobias Doerffel <tobydox@users.sourceforge.net>
* 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 <tobydox@users.sourceforge.net>
* src/widgets/led_checkbox.cpp:

1
TODO
View File

@@ -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

View File

@@ -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)

View File

@@ -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 <qmap.h>
//#include <qmap.h>
#include <qglobal.h>
//#include <qpair.h>
#include <qpair.h>
#if QT_VERSION >= 0x040000
#ifndef QT4

View File

@@ -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<QString, audioDevice::setupWidget *> aswMap;

View File

@@ -34,8 +34,8 @@
#else
#include <qmap.h>
#include <qwidget.h>
#include <qmap.h>
#include "spc_bg_hndl_widget.h"

View File

@@ -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 );

View File

@@ -34,7 +34,7 @@
#else
#include <qvector.h>
#include <qvaluevector.h>
#endif

View File

@@ -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 ) );

View File

@@ -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<QWidget *> w( pl );
w.toBack();
// now we travel through the window-list until we find a channel-track
while( w.hasPrevious() )
{
channelTrack * ct = dynamic_cast<channelTrack *>(
QListIterator<QWidget *> w( pl );
w.toBack();
// now we travel through the window-list until we find a
// channel-track
while( w.hasPrevious() )
{
channelTrack * ct = dynamic_cast<channelTrack *>(
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<channelTrack *>( 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<channelTrack *>( 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
}
}
}

View File

@@ -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

View File

@@ -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"

View File

@@ -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 );
}

View File

@@ -38,7 +38,6 @@
#include <qprogressdialog.h>
#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

View File

@@ -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();

View File

@@ -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() );
}

View File

@@ -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 <tobydox@users.sourceforge.net>
@@ -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 );
}

View File

@@ -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(