lot of changes in artwork-/theming-handling

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@103 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2006-03-09 13:35:05 +00:00
parent 6fedb4b461
commit a6d0f95bb4
54 changed files with 148 additions and 125 deletions

View File

@@ -3,6 +3,44 @@
* data/themes/blue_scene/:
updated some pixmaps
* data/themes/blue_scene/plugins/:
added pixmaps for plugins
2006-03-08 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* src/core/timeline.cpp:
more logical loop-point-handling:
middle mouse button -> left loop-point
right mouse button -> right loop-point
* plugins/audio_file_processor/audio_file_processor.cpp:
* plugins/bit_invader/bit_invader.cpp:
* plugins/organic/organic.cpp:
* plugins/plucked_string_synth/plucked_string_synth.cpp:
* plugins/triple_oscillator/triple_oscillator.cpp:
* plugins/vestige/vestige.cpp:
* include/plugin.h:
* src/core/instrument.cpp:
* src/core/plugin.cpp:
* src/lib/embed.cpp:
added support for plugin-theming
* src/lib/embed.cpp:
- first search in artwork-directories before searching for embedded data
as most artwork is not linked into binary (except plugins)
- if pixmap not found, try to load according pixmap from
default-artwork-dir
* include/embed.h:
* src/core/main.cpp:
* src/lib/embed.cpp:
as localizations are no longer embedded into binary, loadTranslation()
was moved to main.cpp and contains only some basic code for loading
appropriate translation from file
* src/core/config_mgr.cpp:
several fixes concerning artwork-path
2006-03-07 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* src/core/arp_and_chords_tab_widget.cpp:

1
TODO
View File

@@ -2,6 +2,7 @@
- message when importing unsupported MIDI-file (track-count = 0)
- volume-knobs for each sample-track
- AMS-bindings
- remove binary-embed-system
- recording-functionality
- show loading-vst-hint when cloning vestige-track
- do not hang when saving while loading VST-plugin

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.4-cvs20060307, tobydox/at/users/dot/sourceforge/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.1.4-cvs20060307)
AC_INIT(lmms, 0.1.4-cvs20060308, tobydox/at/users/dot/sourceforge/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.1.4-cvs20060308)
AM_CONFIG_HEADER(config.h)

View File

@@ -4,5 +4,9 @@ theme_default_DATA = $(wildcard default/*.png)
theme_blue_scenedir = $(lmmsdatadir)/themes/blue_scene
theme_blue_scene_DATA = $(wildcard blue_scene/*.png)
EXTRA_DIST = $(theme_default_DATA) $(theme_blue_scene_DATA)
plugin_theme_blue_scenedir = $(lmmsdatadir)/themes/blue_scene/plugins
plugin_theme_blue_scene_DATA = $(wildcard blue_scene/plugins/*.png)
EXTRA_DIST = $(theme_default_DATA) $(theme_blue_scene_DATA) $(plugin_theme_blue_scene_DATA)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -102,6 +102,11 @@ public:
return( m_workingDir + SAMPLES_PATH );
}
QString defaultArtworkDir( void ) const
{
return( m_dataDir + DEFAULT_THEME_PATH );
}
QString artworkDir( void ) const
{
return( m_artworkDir );

View File

@@ -53,7 +53,6 @@ struct descriptor
QPixmap getIconPixmap( const char * _name, int _w = -1, int _h = -1 );
QString getText( const char * _name );
void loadTranslation( const QString & _tname );
}
@@ -63,8 +62,7 @@ namespace PLUGIN_NAME
{
QPixmap getIconPixmap( const char * _name, int _w = -1, int _h = -1 );
QString getText( const char * _name );
void loadTranslation( const QString & _tname );
//QString getText( const char * _name );
}
#endif

View File

@@ -82,7 +82,7 @@ public:
const char * author;
int version;
pluginTypes type;
embed::descriptor logo;
const QPixmap * logo;
} ;
// contructor of a plugin

View File

@@ -78,7 +78,7 @@ plugin::descriptor audiofileprocessor_plugin_descriptor =
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
plugin::INSTRUMENT,
PLUGIN_NAME::findEmbeddedData( "logo.png" )
new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) )
} ;
}

View File

@@ -84,7 +84,7 @@ plugin::descriptor bitinvader_plugin_descriptor =
"Andreas Brandmaier <andreas/at/brandmaier/dot/de>",
0x0100,
plugin::INSTRUMENT,
PLUGIN_NAME::findEmbeddedData( "logo.png" )
new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) )
} ;
}

View File

@@ -85,7 +85,7 @@ plugin::descriptor organic_plugin_descriptor =
"Andreas Brandmaier <andreas/at/brandmaier.de>",
0x0100,
plugin::INSTRUMENT,
PLUGIN_NAME::findEmbeddedData( "logo.png" )
new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) )
} ;
}

View File

@@ -61,7 +61,7 @@ plugin::descriptor pluckedstringsynth_plugin_descriptor =
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
plugin::INSTRUMENT,
PLUGIN_NAME::findEmbeddedData( "logo.png" )
new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) )
} ;
}

View File

@@ -73,7 +73,7 @@ plugin::descriptor tripleoscillator_plugin_descriptor =
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
plugin::INSTRUMENT,
PLUGIN_NAME::findEmbeddedData( "logo.png" )
new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) )
} ;
}

View File

@@ -78,7 +78,7 @@ plugin::descriptor vestige_plugin_descriptor =
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
plugin::INSTRUMENT,
PLUGIN_NAME::findEmbeddedData( "logo.png" )
new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) )
} ;
}

View File

@@ -68,9 +68,6 @@
arpAndChordsTabWidget::chord arpAndChordsTabWidget::s_chords[] =
{
// thanks to the FL-team for this chords *lol* ;-) took me at least 3
// hours to get them all out of FL-arpeggiator...
{ arpAndChordsTabWidget::tr( "octave" ), { 0, -1 } },
{ arpAndChordsTabWidget::tr( "Major" ), { 0, 4, 7, -1 } },
{ arpAndChordsTabWidget::tr( "Majb5" ), { 0, 4, 6, -1 } },

View File

@@ -168,7 +168,7 @@ configManager::configManager( void ) :
// since real support for qt < 3.2 is senseless too ;-)
m_dataDir( "/usr/share/lmms/" ),
#endif
m_artworkDir( m_dataDir + DEFAULT_THEME_PATH ),
m_artworkDir( defaultArtworkDir() ),
#if QT_VERSION >= 0x030200
m_pluginDir( qApp->applicationDirPath().section( '/', 0, -2 ) +
"/lib/lmms/" ),
@@ -811,7 +811,7 @@ bool configManager::loadConfigFile( void )
m_artworkDir = value( "paths", "artwork" );
if( QDir( m_artworkDir ).exists() == FALSE )
{
m_artworkDir = m_dataDir + DEFAULT_THEME_PATH;
m_artworkDir = defaultArtworkDir();
}
if( m_artworkDir.right( 1 ) != "/" )
{

View File

@@ -38,10 +38,7 @@ instrument::instrument( channelTrack * _channel_track,
m_valid( TRUE )
{
setFixedSize( 250, 250 );
QPixmap logo;
logo.loadFromData( getDescriptor()->logo.data,
getDescriptor()->logo.size );
m_channelTrack->setWindowIcon( logo );
m_channelTrack->setWindowIcon( *getDescriptor()->logo );
}

View File

@@ -32,6 +32,7 @@
#include <QApplication>
#include <QLocale>
#include <QSplashScreen>
#include <QTranslator>
#else
@@ -40,6 +41,7 @@
#if QT_VERSION >= 0x030200
#include <qsplashscreen.h>
#endif
#include <qtranslator.h>
#endif
@@ -63,6 +65,17 @@ QString file_to_render;
int splash_alignment_flags = Qt::AlignTop | Qt::AlignLeft;
#endif
inline void loadTranslation( const QString & _tname )
{
QTranslator * t = new QTranslator( 0 );
QString name = _tname + ".qm";
t->load( name, configManager::inst()->localeDir() );
qApp->installTranslator( t );
}
int main( int argc, char * * argv )
{
@@ -160,9 +173,9 @@ int main( int argc, char * * argv )
QString( QTextCodec::locale() ).section( '_', 0, 0 );
#endif
// load translation for Qt-widgets/-dialogs
embed::loadTranslation( QString( "qt_" ) + pos );
loadTranslation( QString( "qt_" ) + pos );
// load actual translation for LMMS
embed::loadTranslation( pos );
loadTranslation( pos );
#ifdef QT4
app.setFont( pointSize<10>( app.font() ) );

View File

@@ -48,7 +48,7 @@
#include "dummy_plugin.h"
static embed::descriptor dummy_embed = { 0, NULL, "" } ;
//static embed::descriptor dummy_embed = { 0, NULL, "" } ;
static plugin::descriptor dummy_plugin_descriptor =
{
@@ -58,7 +58,7 @@ static plugin::descriptor dummy_plugin_descriptor =
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
plugin::UNDEFINED,
dummy_embed
NULL
} ;
@@ -68,6 +68,11 @@ plugin::plugin( const descriptor * _descriptor, engine * _engine ) :
engineObject( _engine ),
m_descriptor( _descriptor )
{
if( dummy_plugin_descriptor.logo == NULL )
{
dummy_plugin_descriptor.logo = new QPixmap();
}
if( m_descriptor == NULL )
{
m_descriptor = &dummy_plugin_descriptor;

View File

@@ -114,10 +114,9 @@ pluginDescWidget::pluginDescWidget( const plugin::descriptor & _pd,
QWidget( _parent ),
engineObject( _engine ),
m_pluginDescriptor( _pd ),
m_logo(),
m_logo( *_pd.logo ),
m_mouseOver( FALSE )
{
m_logo.loadFromData( _pd.logo.data, _pd.logo.size );
setFixedHeight( 60 );
setMouseTracking( TRUE );
#ifndef QT4

View File

@@ -279,49 +279,7 @@ void timeLine::mousePressEvent( QMouseEvent * _me )
{
return;
}
if( _me->button() == Qt::RightButton )
{
if( _me->x() >= markerX( loopBegin() ) &&
_me->x() <= markerX( loopBegin() ) +
s_loopPointPixmap->width() )
{
m_action = MOVE_LOOP_BEGIN;
}
else if( _me->x() >= markerX( loopEnd() ) &&
_me->x() <= markerX( loopEnd() ) +
s_loopPointPixmap->width() )
{
m_action = MOVE_LOOP_END;
}
if( m_action != NONE )
{
m_moveXOff = s_loopPointPixmap->width() / 2;
}
}
else if( _me->button() == Qt::MidButton )
{
const midiTime t = m_begin +
static_cast<Sint32>( _me->x() * 64 / m_ppt );
Uint8 pmin = 0;
Uint8 pmax = 1;
m_action = MOVE_LOOP_BEGIN;
if( m_loopPos[pmin] > m_loopPos[pmax] )
{
qSwap( pmin, pmax );
m_action = MOVE_LOOP_END;
}
if( eng()->getMainWindow()->isShiftPressed() == TRUE )
{
m_loopPos[pmax] = t;
m_action = ( m_action == MOVE_LOOP_BEGIN ) ?
MOVE_LOOP_END : MOVE_LOOP_BEGIN;
}
else
{
m_loopPos[pmin] = t;
}
}
else
if( _me->button() == Qt::LeftButton )
{
m_action = MOVE_POS_MARKER;
if( _me->x() - m_xOffset < s_posMarkerPixmap->width() )
@@ -333,6 +291,23 @@ void timeLine::mousePressEvent( QMouseEvent * _me )
m_moveXOff = s_posMarkerPixmap->width() / 2;
}
}
else
{
const midiTime t = m_begin +
static_cast<Sint32>( _me->x() * 64 / m_ppt );
Uint8 pmin = 0;
Uint8 pmax = 1;
m_action = MOVE_LOOP_BEGIN;
if( m_loopPos[0] > m_loopPos[1] )
{
qSwap( m_loopPos[0], m_loopPos[1] );
}
if( _me->button() == Qt::RightButton )
{
m_action = MOVE_LOOP_END;
}
m_loopPos[( m_action == MOVE_LOOP_BEGIN ) ? 0 : 1] = t;
}
if( m_action == MOVE_LOOP_BEGIN || m_action == MOVE_LOOP_END )
{
delete m_hint;

View File

@@ -100,8 +100,7 @@ trackContentObject::trackContentObject( track * _track ) :
if( s_textFloat == NULL )
{
s_textFloat = new textFloat( this );
s_textFloat->setPixmap( embed::getIconPixmap(
"xclock", 24, 24 ) );
s_textFloat->setPixmap( embed::getIconPixmap( "clock" ) );
}
#ifdef QT4

View File

@@ -3,7 +3,7 @@
/*
* embed.cpp - misc stuff for using embedded resources (linked into binary)
*
* Copyright (c) 2004-2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -29,14 +29,10 @@
#ifdef QT4
#include <QApplication>
#include <QTranslator>
#include <QImage>
#else
#include <qapplication.h>
#include <qtranslator.h>
#include <qimage.h>
#endif
@@ -63,25 +59,44 @@ QPixmap getIconPixmap( const char * _name, int _w, int _h )
if( _w == -1 || _h == -1 )
{
QString name = QString( _name ) + ".png";
#ifdef PLUGIN_NAME
QPixmap p( configManager::inst()->artworkDir() + "plugins/" +
STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ) + "_" + name );
if( p.isNull() )
{
p = QPixmap( configManager::inst()->artworkDir() +
name );
}
#else
// look whether icon is in artwork-dir
QPixmap p( configManager::inst()->artworkDir() + name );
#endif
if( p.isNull() )
{
// nothing found, so look in default-artwork-dir
p =
QPixmap( configManager::inst()->defaultArtworkDir() + name );
}
if( p.isNull() )
{
#ifdef QT4
const embed::descriptor & e = findEmbeddedData(
const embed::descriptor & e = findEmbeddedData(
name.toAscii().constData() );
#else
const embed::descriptor & e = findEmbeddedData( name.ascii() );
const embed::descriptor & e = findEmbeddedData(
name.ascii() );
#endif
// not found?
if( QString( e.name ) != name )
{
// then look whether icon is in data-dir
QPixmap p( configManager::inst()->artworkDir() + name );
if( p.isNull() )
// found?
if( QString( e.name ) == name )
{
p.loadFromData( e.data, e.size );
}
else
{
p = QPixmap( 1, 1 );
}
return( p );
}
QPixmap p;
p.loadFromData( e.data, e.size );
return( p );
}
#ifdef QT4
@@ -102,38 +117,6 @@ QString getText( const char * _name )
}
void loadTranslation( const QString & _tname )
{
QTranslator * t = new QTranslator( 0 );
QString name = _tname + ".qm";
#if QT_VERSION >= 0x030100
#ifdef QT4
const embed::descriptor & e = findEmbeddedData(
name.toAscii().constData() );
#else
const embed::descriptor & e = findEmbeddedData( name.ascii() );
#endif
// not found?
if( QString( e.name ) != name )
{
#endif
// then look whether translation is in data-dir
t->load( name, configManager::inst()->localeDir() );
#if QT_VERSION >= 0x030100
}
else
{
t->load( e.data, (int) e.size );
}
#endif
qApp->installTranslator( t );
}
}

View File

@@ -221,7 +221,7 @@ void groupBox::updatePixmap( void )
//p.setPen( QColor( 255, 255, 255 ) );
p.setPen( colorGroup().highlight() );
p.setPen( colorGroup().buttonText() );
p.setFont( pointSize<7>( font() ) );
p.drawText( 22, 10, m_caption );

View File

@@ -54,13 +54,22 @@ tabWidget::tabWidget( const QString & _caption, QWidget * _parent ) :
m_caption( _caption )
{
setFont( pointSize<7>( font() ) );
#ifdef QT4
/*#ifdef QT4
QPalette pal = palette();
pal.setColor( QPalette::Background, QColor( 96, 96, 96 ) );
setPalette( pal );
#else
setPaletteBackgroundColor( QColor( 96, 96, 96 ) );
setBackgroundMode( Qt::NoBackground );
#endif*/
QColor bg_color = QApplication::palette().active().background().dark(
132 );
#ifdef QT4
QPalette pal = palette();
pal.setColor( QPalette::Background, bg_color );
setPalette( pal );
#else
setPaletteBackgroundColor( bg_color );
#endif
}

View File

@@ -60,7 +60,7 @@ tempoSyncKnob::tempoSyncKnob( int _knob_num, QWidget * _parent,
knob( _knob_num, _parent, _name, _engine ),
m_tempoSyncMode( NO_SYNC ),
m_scale( _scale ),
m_tempoSyncIcon( embed::getIconPixmap( "xclock" ) ),
m_tempoSyncIcon( embed::getIconPixmap( "tempo_sync" ) ),
m_tempoSyncDescription( tr( "Tempo Sync" ) ),
m_tempoLastSyncMode( NO_SYNC )
{
@@ -301,7 +301,7 @@ void tempoSyncKnob::calculateTempoSyncTime( bpm_t _bpm )
else
{
m_tempoSyncDescription = tr( "Tempo Sync" );
m_tempoSyncIcon = embed::getIconPixmap( "xclock" );
m_tempoSyncIcon = embed::getIconPixmap( "tempo_sync" );
}
if( m_tempoSyncMode != m_tempoLastSyncMode )