singerbot proxy, fixed recently opened files, style sheet support

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@574 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Javier Serrano Polo
2007-11-03 14:41:58 +00:00
parent 175c123ce0
commit f01af6740e
87 changed files with 1710 additions and 1329 deletions

155
ChangeLog
View File

@@ -1,3 +1,158 @@
2007-11-03 Javier Serrano Polo <jasp00/at/terra/dot/es>
* plugins/singerbot/singerbot_proxy.cpp:
initial release, separate process to deal with Festival
* plugins/singerbot/file.h:
initial release, file descriptor wrapper
* plugins/singerbot/Makefile.am:
* plugins/singerbot/singerbot.cpp:
* plugins/singerbot/singerbot.h:
use external proxy
* include/main_window.h:
* src/core/main_window.cpp:
upgraded recently opened files feature
* include/main_window.h:
* src/core/main_window.cpp:
* src/core/song_editor.cpp:
fixed recently opened files segfault
* include/mmp.h:
* src/lib/mmp.cpp:
simplified save extension handling
* src/core/song_editor.cpp:
* src/lib/mmp.cpp:
fixed recently opened files bug (#1800364)
* data/themes/default/style.css:
* data/themes/Makefile.am:
* include/config_mgr.h:
* src/core/config_mgr.cpp:
* src/core/main_window.cpp:
added style sheet support
* include/caption_menu.h:
* src/widgets/caption_menu.cpp:
initial release, context menu with a caption
* plugins/vibed/impulse_editor.cpp:
* plugins/vibed/nine_button_selector.cpp:
* plugins/vibed/vibed.cpp:
* src/core/piano_widget.cpp:
* src/core/surround_area.cpp:
* src/widgets/automatable_button.cpp:
* src/widgets/automatable_slider.cpp:
* src/widgets/combobox.cpp:
* src/widgets/knob.cpp:
* src/widgets/lcd_spinbox.cpp:
* src/widgets/rack_plugin.cpp:
* src/widgets/tempo_sync_knob.cpp:
use caption menu
* src/core/main_window.cpp:
set workspace's background with its own method
* acinclude.m4:
* include/file_browser.h:
* src/core/file_browser.cpp:
* src/core/main_window.cpp:
replaced Qt3-based file browser implementation
* src/core/file_browser.cpp:
enabled match in directory content filter
* src/widgets/automatable_slider.cpp:
fixed mouse release segfault
* acinclude.m4:
* src/core/main.cpp:
assume Qt translations are properly configured
* src/core/main.cpp:
use standard return values
* src/core/config_mgr.cpp:
removed line breaks inside paragraphs, wrapping should work
* src/audio/audio_alsa.cpp:
* src/midi/midi_alsa_seq.cpp:
removed discouraged alloca calls
* include/main_window.h:
* include/rack_plugin.h:
* plugins/bass_booster/bass_booster.h:
* plugins/ladspa_effect/ladspa_effect.h:
* plugins/vst_base/lvsl_client.cpp:
* plugins/vst_effect/vst_effect.h:
* src/core/automation_editor.cpp:
* src/core/file_browser.cpp:
* src/core/main_window.cpp:
* src/core/piano_roll.cpp:
* src/core/surround_area.cpp:
* src/core/tool.cpp:
* src/core/track_container.cpp:
* src/tracks/instrument_track.cpp:
* src/widgets/combobox.cpp:
* src/widgets/effect_label.cpp:
* src/widgets/knob.cpp:
* src/widgets/project_notes.cpp:
* src/widgets/rack_plugin.cpp:
* src/widgets/tempo_sync_knob.cpp:
reduced include dependencies
* plugins/flp_import/unrtf/attr.c:
* plugins/flp_import/unrtf/attr.h:
* plugins/flp_import/unrtf/convert.c:
* plugins/flp_import/unrtf/error.c:
* plugins/flp_import/unrtf/error.h:
* plugins/flp_import/unrtf/html.c:
* plugins/flp_import/unrtf/malloc.c:
* plugins/flp_import/unrtf/malloc.h:
* plugins/flp_import/unrtf/output.c:
* plugins/flp_import/unrtf/output.h:
* src/audio/audio_file_ogg.cpp:
replaced deprecated string conversions
* plugins/lb302/lb302.cpp:
* src/widgets/kmultitabbar.cpp:
fixed different signedness comparison
* plugins/lb302/lb302.cpp:
* plugins/midi_import/midi_import.cpp:
commented out unused variables
* plugins/flp_import/unrtf/convert.c:
replaced empty conditional
* src/widgets/kmultitabbar.cpp:
added copyright notice
* src/core/automation_pattern.cpp:
* src/core/config_mgr.cpp:
* src/core/import_filter.cpp:
* src/core/ladspa_manager.cpp:
* src/core/setup_dialog.cpp:
* src/core/track.cpp:
* src/core/track_container.cpp:
* src/lib/sample_buffer.cpp:
* src/midi/midi_mapper.cpp:
* src/widgets/tab_bar.cpp:
* src/widgets/text_float.cpp:
removed old undefs
* configure.in:
readded unsafe-loop-optimizations warning
* data/locale/ca.ts:
updated translation
* data/locale/qt_*.qm:
removed old Qt3 translations
2007-10-30 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* src/core/note_play_handle.cpp:

View File

@@ -55,6 +55,7 @@ lmms_MOC = \
./automation_track.moc \
./bb_editor.moc \
./bb_track.moc \
./caption_menu.moc \
./instrument_track.moc \
./combobox.moc \
./config_mgr.moc \
@@ -217,6 +218,7 @@ lmms_SOURCES = \
$(srcdir)/src/tracks/sample_track.cpp \
$(srcdir)/src/widgets/automatable_button.cpp \
$(srcdir)/src/widgets/automatable_slider.cpp \
$(srcdir)/src/widgets/caption_menu.cpp \
$(srcdir)/src/widgets/combobox.cpp \
$(srcdir)/src/widgets/cpuload_widget.cpp \
$(srcdir)/src/widgets/effect_label.cpp \
@@ -301,6 +303,7 @@ lmms_SOURCES = \
$(srcdir)/include/track.h \
$(srcdir)/include/track_container.h \
$(srcdir)/include/bb_track.h \
$(srcdir)/include/caption_menu.h \
$(srcdir)/include/sample_track.h \
$(srcdir)/include/sample_buffer.h \
$(srcdir)/include/name_label.h \

View File

@@ -52,10 +52,9 @@ for i in $QT_TRANSLATIONS_SEARCH ; do
fi
done
if test x"$QT_TRANSLATIONS" = x ; then
AC_MSG_WARN([*** not found! You may want to install a Qt i18n package])
else
AC_DEFINE_UNQUOTED(QT_TRANSLATIONS_DIR, "$QT_TRANSLATIONS")
AC_MSG_ERROR([*** not found! Either install Qt i18n files or define QT_TRANSLATIONS.])
fi
AC_DEFINE_UNQUOTED(QT_TRANSLATIONS_DIR, "$QT_TRANSLATIONS")
AC_MSG_RESULT([$QT_TRANSLATIONS])
@@ -136,7 +135,7 @@ case "${host}" in
if test "x$QT_LIBS" = x; then
AC_MSG_ERROR([*** Couldn't find any Qt4 libraries])
fi
QT_LIB="-L$QTDIR/bin -lQtCore4 -lQtXml4 -lQtNetwork4 -lQtGui4 -lQt3Support4 -lws2_32"
QT_LIB="-L$QTDIR/bin -lQtCore4 -lQtXml4 -lQtNetwork4 -lQtGui4 -lws2_32"
# Check that windres is in path
AC_PATH_PROGS([WINDRES],[i586-mingw32-windres windres],,[${prefix}/bin:$PATH])
if test x$WINDRES = x ; then
@@ -154,7 +153,7 @@ case "${host}" in
else
QT_LIB="-L$QTDIR/lib64 -L$QTDIR/lib64/qt4"
fi
QT_LIB="$QT_LIB -lQtCore -lQtXml -lQtNetwork -lQtGui -lQt3Support"
QT_LIB="$QT_LIB -lQtCore -lQtXml -lQtNetwork -lQtGui"
;;
esac
AC_MSG_RESULT([found: $QT_LIB])

View File

@@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(lmms, 0.4.0-svn20071030, lmms-devel/at/lists/dot/sf/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.4.0-svn20071030)
AC_INIT(lmms, 0.4.0-svn20071103, lmms-devel/at/lists/dot/sf/dot/net)
AM_INIT_AUTOMAKE(lmms, 0.4.0-svn20071103)
AM_CONFIG_HEADER(config.h)
@@ -59,7 +59,7 @@ DEFAULTFLAGS="-O2 -fPIC" #"-floop-optimize2 -fgcse-sm -fgcse-las"
if test "x`$CC --version|head -1|cut -d\ -f3|cut -d. -f1`" = "x4" ; then
DEFAULTFLAGS="$DEFAULTFLAGS -ftree-vectorize -ftree-loop-linear"
# if test "x`$CC --version|head -1|cut -d\ -f3|cut -d. -f2`" != "x0" ; then
# DEFAULTFLAGS="$DEFAULTFLAGS -funsafe-loop-optimizations -Wunsafe-loop-optimizations"
# DEFAULTFLAGS="$DEFAULTFLAGS -funsafe-loop-optimizations"
# fi
fi
@@ -576,7 +576,7 @@ lmmsdatadir="$datadir/$PACKAGE"
AC_SUBST(lmmsdatadir)
EXTRA_WARNINGS="-Wextra -Wno-unused-parameter -Winline -Wdisabled-optimization"
EXTRA_WARNINGS="-Wextra -Wno-unused-parameter -Wunsafe-loop-optimizations -Winline -Wdisabled-optimization"
if test "x$CXX" == "xg++" ; then
CXXFLAGS="$CXXFLAGS -ansi -Wall $EXTRA_WARNINGS -fno-exceptions"
fi

Binary file not shown.

File diff suppressed because it is too large Load Diff

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,5 +1,5 @@
theme_defaultdir = $(lmmsdatadir)/themes/default
theme_default_DATA = default/*.png
theme_default_DATA = default/*.png default/style.css
theme_blue_scenedir = $(lmmsdatadir)/themes/blue_scene
theme_blue_scene_DATA = blue_scene/*.png

45
include/caption_menu.h Normal file
View File

@@ -0,0 +1,45 @@
/*
* caption_menu.h - context menu with a caption
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* 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 _CAPTION_MENU_H
#define _CAPTION_MENU_H
#include <QtGui/QMenu>
class captionMenu : public QMenu
{
Q_OBJECT
public:
captionMenu( const QString & _title, QWidget * _parent = 0 );
virtual ~captionMenu();
} ;
#endif

View File

@@ -203,6 +203,8 @@ private:
void FASTCALL addPage( QWidget * _w, const QString & _title );
void loadStyleSheet( void );
/* static void processFilesRecursively( const QString & _src_dir,
const QString & _dst_dir,
void( * _proc_func )( const QString & _src, const QString &

View File

@@ -28,14 +28,13 @@
#include <QtCore/QDir>
#include <QtCore/QMutex>
class QColorGroup;
#include <Qt3Support/Q3ListView>
#include <QtGui/QTreeWidget>
#include "side_bar_widget.h"
class QListViewItem;
class QColorGroup;
class QPixmap;
class fileItem;
@@ -62,24 +61,12 @@ public slots:
void reloadTree( void );
protected slots:
void contextMenuRequest( Q3ListViewItem * _i, const QPoint & _pos,
int _col );
void contextMenuRequest( QListViewItem * _i, const QPoint & _pos,
int _col );
void sendToActiveInstrumentTrack( void );
void openInNewInstrumentTrackSE( void );
void openInNewInstrumentTrackBBE( void );
private:
virtual void keyPressEvent( QKeyEvent * _ke );
void addItems( const QString & _path );
void openInNewInstrumentTrack( trackContainer * _tc );
listView * m_l;
fileItem * m_contextMenuItem;
QString m_directories;
QString m_filter;
@@ -90,7 +77,7 @@ private:
class listView : public Q3ListView
class listView : public QTreeWidget
{
Q_OBJECT
public:
@@ -99,10 +86,10 @@ public:
protected:
virtual void contentsMouseDoubleClickEvent( QMouseEvent * _me );
virtual void contentsMousePressEvent( QMouseEvent * _me );
virtual void contentsMouseMoveEvent( QMouseEvent * _me );
virtual void contentsMouseReleaseEvent( QMouseEvent * _me );
virtual void contextMenuEvent( QContextMenuEvent * _e );
virtual void mousePressEvent( QMouseEvent * _me );
virtual void mouseMoveEvent( QMouseEvent * _me );
virtual void mouseReleaseEvent( QMouseEvent * _me );
private:
@@ -112,21 +99,30 @@ private:
playHandle * m_previewPlayHandle;
QMutex m_pphMutex;
fileItem * m_contextMenuItem;
void openInNewInstrumentTrack( trackContainer * _tc );
private slots:
void activateListItem( QTreeWidgetItem * _item, int _column );
void openInNewInstrumentTrackBBE( void );
void openInNewInstrumentTrackSE( void );
void sendToActiveInstrumentTrack( void );
void updateDirectory( QTreeWidgetItem * _item );
} ;
class directory : public Q3ListViewItem
class directory : public QTreeWidgetItem
{
public:
directory( Q3ListView * _parent, const QString & _filename,
const QString & _path, const QString & _filter );
directory( directory * _parent, const QString & _filename,
const QString & _path, const QString & _filter );
directory( const QString & _filename, const QString & _path,
const QString & _filter );
void setOpen( bool );
void setup( void );
void update( void );
inline QString fullName( QString _path = QString::null )
{
@@ -139,11 +135,6 @@ public:
QDir::separator() );
}
inline const QPixmap * pixmap( int ) const
{
return( m_pix );
}
inline void addDirectory( const QString & _dir )
{
m_directories.push_back( _dir );
@@ -152,7 +143,6 @@ public:
private:
void initPixmapStuff( void );
void setPixmap( const QPixmap * _px );
bool addItems( const QString & _path );
@@ -161,8 +151,6 @@ private:
static QPixmap * s_folderOpenedPixmap;
static QPixmap * s_folderLockedPixmap;
directory * m_p;
const QPixmap * m_pix;
QStringList m_directories;
QString m_filter;
@@ -171,12 +159,12 @@ private:
class fileItem : public Q3ListViewItem
class fileItem : public QTreeWidgetItem
{
public:
fileItem( Q3ListView * _parent, const QString & _name,
fileItem( QTreeWidget * _parent, const QString & _name,
const QString & _path );
fileItem( Q3ListViewItem * _parent, const QString & _name,
fileItem( QTreeWidgetItem * _parent, const QString & _name,
const QString & _path );
inline QString fullName( void ) const
@@ -184,10 +172,6 @@ public:
return( QDir::cleanPath( m_path ) + QDir::separator() +
text( 0 ) );
}
inline const QPixmap * pixmap( int ) const
{
return( m_pix );
}
enum fileTypes
{
@@ -215,7 +199,6 @@ private:
static QPixmap * s_flpFilePixmap;
static QPixmap * s_unknownFilePixmap;
QPixmap * m_pix;
QString m_path;
fileTypes m_type;
} ;

View File

@@ -28,13 +28,13 @@
#include <QtCore/QList>
#include <QtGui/QMainWindow>
#include <QtGui/QWorkspace>
#include <QtGui/QWhatsThis>
class QAction;
class QDomElement;
class QGridLayout;
class QSplashScreen;
class QWorkspace;
class configManager;
class tool;
@@ -94,8 +94,6 @@ public slots:
void createNewProject( void );
void createNewProjectFromTemplate( QAction * _idx );
void openProject( void );
void updateRecentlyOpenedProjectsMenu( void );
void openRecentlyOpenedProject( int );
bool saveProject( void );
bool saveProjectAs( void );
void showSettingsDialog( void );
@@ -158,7 +156,9 @@ private:
private slots:
void browseHelp( void );
void fillTemplatesMenu( void );
void openRecentlyOpenedProject( QAction * _action );
void showTool( QAction * _idx );
void updateRecentlyOpenedProjectsMenu( void );
} ;

View File

@@ -57,6 +57,8 @@ public:
multimediaProject( projectTypes _project_type );
~multimediaProject();
QString nameWithExtension( const QString & _fn ) const;
bool writeFile( QString & _fn, bool _overwrite_check = TRUE );
inline QDomElement & content( void )

View File

@@ -26,13 +26,14 @@
#define _RACK_PLUGIN_H
#include <QtGui/QWidget>
#include <QtGui/QGroupBox>
#include <QtGui/QPushButton>
#include <QtGui/QLabel>
#include "journalling_object.h"
class QGroupBox;
class QLabel;
class QPushButton;
class audioPort;
class effect;
class effectControlDialog;

View File

@@ -27,6 +27,8 @@
#define _BASS_BOOSTER_H
#include <QtGui/QWorkspace>
#include "effect.h"
#include "effect_lib.h"
#include "engine.h"

View File

@@ -32,6 +32,7 @@
* 18 Sep 01, tuorfa@yahoo.com: added AttrStack (stack of stacks) paradigm
* 22 Sep 01, tuorfa@yahoo.com: added comment blocks
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
@@ -101,7 +102,7 @@ void attr_clear_all( void )
*=======================================================================*/
void
attr_express_begin (int attr, char* param) {
attr_express_begin (int attr, const char* param) {
switch(attr)
{
case ATTR_BOLD:
@@ -302,7 +303,7 @@ attr_express_end (int attr, char *param)
*=======================================================================*/
void
attr_push(int attr, char* param)
attr_push(int attr, const char* param)
{
AttrStack *stack = stack_of_stacks_top;
if (!stack) {

View File

@@ -31,6 +31,7 @@
* 06 Aug 01, tuorfa@yahoo.com: added several attributes
* 18 Sep 01, tuorfa@yahoo.com: updates for AttrStack paradigm
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
#ifndef _ATTR
@@ -73,7 +74,7 @@ extern void attr_push_core (int attr, char* param);
extern void attr_pop_core (int attr);
extern void attr_push(int attr, char* param);
extern void attr_push(int attr, const char* param);
extern void attrstack_push();
extern void attrstack_drop();

View File

@@ -59,6 +59,7 @@
and added support for accented characters in titles from
Laurent Monin
# 09 Mar 06, daved@physiol.usyd.edu.au: don't print null post_trans
* 31 Oct 07, jasp00@users.sourceforge.net: fixed several warnings
*--------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
@@ -156,7 +157,7 @@ static int picture_height;
static int picture_bits_per_pixel=1;
static int picture_type=PICT_UNKNOWN;
static int picture_wmetafile_type;
static char *picture_wmetafile_type_str;
static const char *picture_wmetafile_type_str;
static int have_printed_body=FALSE;
@@ -208,7 +209,7 @@ starting_body ()
/*-------------------------------------------------------------------*/
static char *month_strings[12]= {
static const char *month_strings[12]= {
#ifdef ENGLISH
"January","February","March","April","May","June","July","August",
"September","October","November","December"
@@ -491,7 +492,7 @@ process_info_group (Word *w)
{
int ch = h2toi (&s2[2]);
char *s3;
const char *s3;
s3 = op_translate_char (op, charset_type, ch, numchar_table);
if (!s3 || !*s3)
{
@@ -834,7 +835,7 @@ cmd_field (Word *w, int align, char has_param, int num) {
op->symbol_last_char >= char_num
)
{
char * string;
const char * string;
if ((string = op->symbol_translation_table[char_num - op->symbol_first_char]) != 0)
outstring+=QString().sprintf("%s", string);
}
@@ -1423,8 +1424,7 @@ static int cmd_ulnone (Word *w, int align, char has_param, int param) {
attr==ATTR_THICK_UL ||
attr==ATTR_DOUBLE_UL)
{
if (!attr_pop(ATTR_UNDERLINE))
;
attr_pop(ATTR_UNDERLINE);
} else
more=FALSE;
} while(more);
@@ -1681,7 +1681,7 @@ static int cmd_u (Word *w, int align, char has_param, int param) {
(uchar)param <= op->unisymbol1_last_char
)
{
char *string;
const char *string;
if ((string = op->unisymbol1_translation_table[param - op->unisymbol1_first_char]) != 0)
outstring+=QString().sprintf("%s", string);
else
@@ -1695,7 +1695,7 @@ static int cmd_u (Word *w, int align, char has_param, int param) {
(uchar)param <= op->unisymbol2_last_char
)
{
char *string;
const char *string;
if ((string = op->unisymbol2_translation_table[param - op->unisymbol2_first_char]) != 0)
outstring+=QString().sprintf("%s", string);
else
@@ -1709,7 +1709,7 @@ static int cmd_u (Word *w, int align, char has_param, int param) {
(uchar)param <= op->unisymbol3_last_char
)
{
char *string;
const char *string;
if ((string = op->unisymbol3_translation_table[param - op->unisymbol3_first_char]) != 0)
outstring+=QString().sprintf("%s", string);
else
@@ -1724,7 +1724,7 @@ static int cmd_u (Word *w, int align, char has_param, int param) {
(uchar)param <= op->unisymbol4_last_char
)
{
char *string;
const char *string;
if ((string = op->unisymbol4_translation_table[param - op->unisymbol4_first_char]) != 0)
outstring+=QString().sprintf("%s", string);
else
@@ -2291,9 +2291,9 @@ static int cmd_tcn (Word *w, int align, char has_param, int param) {
typedef struct {
char *name;
const char *name;
int (*func)(Word*, int, char, int);
char *debug_print;
const char *debug_print;
} HashItem;
@@ -2616,7 +2616,7 @@ enum { SMALL=0, BIG=1 };
}
while ((ch=*s)) {
char *post_trans = NULL;
const char *post_trans = NULL;
if (simulate_allcaps || simulate_smallcaps)
ch = toupper (ch);
@@ -2844,7 +2844,7 @@ word_print_core (Word *w)
if (within_picture) {
starting_body();
if (!pictfile && !nopict_mode) {
char *ext=NULL;
const char *ext=NULL;
switch (picture_type) {
case PICT_WB: ext="bmp"; break;
case PICT_WM: ext="wmf"; break;
@@ -2985,7 +2985,7 @@ word_print_core (Word *w)
else if (*s == '\'') {
/* \'XX is a hex char code expression */
int ch = h2toi (&s[1]);
char *s2;
const char *s2;
#if 1 /* daved - 0.19.6 */
s2 = op_translate_char (op, charset_type, ch, numchar_table);
@@ -3050,7 +3050,7 @@ word_print_core (Word *w)
match = !strcmp(s, hip[index].name);
if (match) {
char *debug;
const char *debug;
int terminate_group;
if (hip[index].func) {

View File

@@ -36,6 +36,7 @@
* 25 Sep 04, st001906@hrz1.hrz.tu-darmstadt.de: added stdlib.h for djgpp
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 22 Aug 05, ax2groin@arbornet.org: added lineno to error_handler
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
@@ -79,7 +80,7 @@ usage ()
*=======================================================================*/
void
error_handler (char* message)
error_handler (const char* message)
{
#if 1
fprintf(stderr, "Error (line %d): %s\n", lineno, message);
@@ -98,7 +99,7 @@ error_handler (char* message)
*=======================================================================*/
void
warning_handler (char* message)
warning_handler (const char* message)
{
fprintf(stderr, "Warning: %s\n", message);
}

View File

@@ -29,6 +29,7 @@
*----------------------------------------------------------------------
* Changes
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
@@ -38,7 +39,7 @@
extern void usage(void);
extern void error_handler (char*);
extern void warning_handler (char*);
extern void error_handler (const char*);
extern void warning_handler (const char*);

View File

@@ -38,6 +38,7 @@
* 21 Jul 05, daved@physiol.usyd.edu.au: added endash
* 19 Aug 05, ax2groin@arbornet.org: added more chars and changes to ANSI
* 05 Jan 06, marcossamaral@terra.com.br: fixed bugs #14982 and #14983
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
@@ -59,7 +60,7 @@
#include "output.h"
static char* ascii [96] = {
static const char* ascii [96] = {
/* 0x20 */ " ", "!", "&quot;", "#", "$", "%", "&amp;", "'",
/* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/",
/* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7",
@@ -75,7 +76,7 @@ static char* ascii [96] = {
};
static char* ansi [] = {
static const char* ansi [] = {
/* 0x78 */ "x",
/* 0x79 */ "y",
/* 0x7a */ "z",
@@ -123,7 +124,7 @@ static char* ansi [] = {
/* 0xf8 */ "&oslash;","&ugrave;","&uacute;","&ucirc;","&uuml;","&yacute;","&thorn;","&yuml;"
};
static char* mac [] = {
static const char* mac [] = {
/* 0xa4 */ "&bull;", NULL,NULL,NULL,
/* 0xa8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
/* 0xb0 */ NULL,NULL,NULL,NULL,NULL,"&mu;",NULL,NULL,
@@ -134,7 +135,7 @@ static char* mac [] = {
};
#if 1 /* daved - 0.19.4 - unicode symbol character support */
static char * unisymbol1[] = {
static const char * unisymbol1[] = {
/* 913 */ "&Alpha;",
/* 914 */ "&Beta;",
/* 915 */ "&Gamma;",
@@ -208,7 +209,7 @@ static char * unisymbol1[] = {
};
#endif
#if 1 /* daved - 0.19.4 - unicode symbol character support */
static char * unisymbol2[] = {
static const char * unisymbol2[] = {
/* 57516 */ "&Gamma;",
/* 57517 */ "&Delta;",
/* 57518 */ "&Theta;",
@@ -253,7 +254,7 @@ static char * unisymbol2[] = {
/* 57557 */ "&delta;",
};
static char * unisymbol3[] = {
static const char * unisymbol3[] = {
/* 61505 */ "&Alpha;",
/* 61506 */ "&Beta;",
/* 61507 */ "&Chi;",
@@ -316,7 +317,7 @@ static char * unisymbol3[] = {
#endif
#if 1 /* 0.19.5 more unicode characters */
static char * unisymbol4[] = {
static const char * unisymbol4[] = {
/* 61600 */ "&euro;",
/* 61601 */ "&upsih;",
/* 61602 */ "&prime;",
@@ -414,7 +415,7 @@ static char * unisymbol4[] = {
};
#endif
#if 1 /* daved - SYMBOL font characters */
static char* symbol[] = {
static const char* symbol[] = {
/* 60 */ "&lt;",
/* 61 */ "=",
/* 62 */ "&gt;",
@@ -612,7 +613,7 @@ static char* symbol[] = {
/* 254 */ 0,
};
#endif
static char* cp437 [] = {
static const char* cp437 [] = {
/* 0x80 */ "&ccedil;",
/* 0x81 */ "&uuml;",
/* 0x82 */ "&eacute;",
@@ -743,7 +744,7 @@ static char* cp437 [] = {
/* 0xff */ "&nbsp;",
};
static char* cp850 [] = {
static const char* cp850 [] = {
/* 0x80 */ "&ccedil;",
/* 0x81 */ "&uuml;",
/* 0x82 */ "&eacute;",

View File

@@ -34,6 +34,7 @@
* 28 Sep 01, tuorfa@yahoo.com: removed Turbo C support.
* 08 Oct 03, daved@physiol.usyd.edu.au: added stdlib.h for linux
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
@@ -114,7 +115,7 @@ total_malloced (void) {
*=======================================================================*/
char *
my_strdup (char *src) {
my_strdup (const char *src) {
unsigned long len;
char *ptr;

View File

@@ -28,10 +28,11 @@
*----------------------------------------------------------------------
* Changes:
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
extern char * my_malloc (unsigned long);
extern void my_free (char*);
extern unsigned long total_malloced (void);
extern char * my_strdup (char*);
extern char * my_strdup (const char*);

View File

@@ -33,6 +33,7 @@
* 25 Sep 04, st001906@hrz1.hrz.tu-darmstadt.de: added stdlib.h for djgpp
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 06 Jan 06, marcossamaral@terra.com.br: changes in STDOUT
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
@@ -111,7 +112,7 @@ op_free (OutputPersonality *op)
* Returns: String.
*=======================================================================*/
char *
const char *
#if 1 /* daved - 0.19.6 */
op_translate_char (OutputPersonality *op, int charset, int ch, int ntable)
#else
@@ -119,7 +120,7 @@ op_translate_char (OutputPersonality *op, int charset, int ch)
#endif
{
short start;
char *result=NULL;
const char *result=NULL;
CHECK_PARAM_NOT_NULL(op);

View File

@@ -28,6 +28,7 @@
*----------------------------------------------------------------------
* Changes:
* 29 Mar 05, daved@physiol.usyd.edu.au: changes requested by ZT Smith
* 31 Oct 07, jasp00@users.sourceforge.net: replaced deprecated conversions
*--------------------------------------------------------------------*/
@@ -35,92 +36,92 @@
typedef struct {
char *comment_begin;
char *comment_end;
const char *comment_begin;
const char *comment_end;
char *document_begin;
char *document_end;
const char *document_begin;
const char *document_end;
char *header_begin;
char *header_end;
const char *header_begin;
const char *header_end;
char *document_title_begin;
char *document_title_end;
const char *document_title_begin;
const char *document_title_end;
char *document_keywords_begin;
char *document_keywords_end;
char *document_author_begin;
char *document_author_end;
const char *document_author_begin;
const char *document_author_end;
char *document_changedate_begin;
char *document_changedate_end;
const char *document_changedate_begin;
const char *document_changedate_end;
char *body_begin;
char *body_end;
const char *body_begin;
const char *body_end;
char *word_begin;
char *word_end;
char *paragraph_begin;
char *paragraph_end;
const char *paragraph_begin;
const char *paragraph_end;
char *center_begin;
char *center_end;
const char *center_begin;
const char *center_end;
char *align_left_begin;
char *align_left_end;
const char *align_left_begin;
const char *align_left_end;
char *align_right_begin;
char *align_right_end;
const char *align_right_begin;
const char *align_right_end;
char *justify_begin;
char *justify_end;
const char *justify_begin;
const char *justify_end;
char *forced_space;
char *line_break;
char *page_break;
const char *forced_space;
const char *line_break;
const char *page_break;
char *hyperlink_begin;
char *hyperlink_end;
const char *hyperlink_begin;
const char *hyperlink_end;
char *imagelink_begin;
char *imagelink_end;
const char *imagelink_begin;
const char *imagelink_end;
char *table_begin;
char *table_end;
const char *table_begin;
const char *table_end;
char *table_row_begin;
char *table_row_end;
const char *table_row_begin;
const char *table_row_end;
char *table_cell_begin;
char *table_cell_end;
const char *table_cell_begin;
const char *table_cell_end;
/* Character attributes */
char *font_begin;
char *font_end;
const char *font_begin;
const char *font_end;
char *fontsize_begin;
char *fontsize_end;
const char *fontsize_begin;
const char *fontsize_end;
/* standard font sizes are optional */
char *fontsize8_begin;
char *fontsize8_end;
const char *fontsize8_begin;
const char *fontsize8_end;
char *fontsize10_begin;
char *fontsize10_end;
const char *fontsize10_begin;
const char *fontsize10_end;
char *fontsize12_begin;
char *fontsize12_end;
const char *fontsize12_begin;
const char *fontsize12_end;
char *fontsize14_begin;
char *fontsize14_end;
const char *fontsize14_begin;
const char *fontsize14_end;
char *fontsize18_begin;
char *fontsize18_end;
const char *fontsize18_begin;
const char *fontsize18_end;
char *fontsize24_begin;
char *fontsize24_end;
const char *fontsize24_begin;
const char *fontsize24_end;
char *fontsize36_begin;
char *fontsize36_end;
@@ -128,71 +129,71 @@ typedef struct {
char *fontsize48_begin;
char *fontsize48_end;
char *smaller_begin;
char *smaller_end;
const char *smaller_begin;
const char *smaller_end;
char *bigger_begin;
char *bigger_end;
const char *bigger_begin;
const char *bigger_end;
char *foreground_begin;
char *foreground_end;
const char *foreground_begin;
const char *foreground_end;
char *background_begin;
char *background_end;
const char *background_begin;
const char *background_end;
char *bold_begin;
char *bold_end;
const char *bold_begin;
const char *bold_end;
char *italic_begin;
char *italic_end;
const char *italic_begin;
const char *italic_end;
char *underline_begin;
char *underline_end;
const char *underline_begin;
const char *underline_end;
char *dbl_underline_begin;
char *dbl_underline_end;
const char *dbl_underline_begin;
const char *dbl_underline_end;
char *superscript_begin;
char *superscript_end;
const char *superscript_begin;
const char *superscript_end;
char *subscript_begin;
char *subscript_end;
const char *subscript_begin;
const char *subscript_end;
char *strikethru_begin;
char *strikethru_end;
const char *strikethru_begin;
const char *strikethru_end;
char *dbl_strikethru_begin;
char *dbl_strikethru_end;
const char *dbl_strikethru_begin;
const char *dbl_strikethru_end;
char *emboss_begin;
char *emboss_end;
const char *emboss_begin;
const char *emboss_end;
char *engrave_begin;
char *engrave_end;
const char *engrave_begin;
const char *engrave_end;
char *shadow_begin;
char *shadow_end;
const char *shadow_begin;
const char *shadow_end;
char *outline_begin;
char *outline_end;
const char *outline_begin;
const char *outline_end;
char *small_caps_begin;
char *small_caps_end;
char *pointlist_begin;
char *pointlist_end;
const char *pointlist_begin;
const char *pointlist_end;
char *pointlist_item_begin;
char *pointlist_item_end;
const char *pointlist_item_begin;
const char *pointlist_item_end;
char *numericlist_begin;
char *numericlist_end;
const char *numericlist_begin;
const char *numericlist_end;
char *numericlist_item_begin;
char *numericlist_item_end;
const char *numericlist_item_begin;
const char *numericlist_item_end;
char *expand_begin;
char *expand_end;
const char *expand_begin;
const char *expand_end;
char *toc_entry_begin;
char *toc_entry_end;
@@ -204,54 +205,54 @@ typedef struct {
* to one of the charsets.
*/
struct {
char *bullet;
char *left_quote;
char *right_quote;
char *left_dbl_quote;
char *right_dbl_quote;
char *nonbreaking_space;
char *emdash;
char *endash;
char *lessthan;
char *greaterthan;
char *amp;
char *copyright;
char *trademark;
const char *bullet;
const char *left_quote;
const char *right_quote;
const char *left_dbl_quote;
const char *right_dbl_quote;
const char *nonbreaking_space;
const char *emdash;
const char *endash;
const char *lessthan;
const char *greaterthan;
const char *amp;
const char *copyright;
const char *trademark;
char *nonbreaking_hyphen;
char *optional_hyphen;
} chars;
char **ascii_translation_table;
const char **ascii_translation_table;
int simulate_small_caps : 1;
int simulate_all_caps : 1;
int simulate_word_underline : 1;
char **ansi_translation_table;
const char **ansi_translation_table;
short ansi_first_char;
short ansi_last_char;
char **cp437_translation_table;
const char **cp437_translation_table;
short cp437_first_char;
short cp437_last_char;
char **cp850_translation_table;
const char **cp850_translation_table;
short cp850_first_char;
short cp850_last_char;
char **mac_translation_table;
const char **mac_translation_table;
short mac_first_char;
short mac_last_char;
#if 1 /* daved 0.20.0 */
unsigned int unisymbol1_first_char;
unsigned int unisymbol1_last_char;
char **unisymbol1_translation_table;
const char **unisymbol1_translation_table;
unsigned int unisymbol2_first_char;
unsigned int unisymbol2_last_char;
char **unisymbol2_translation_table;
const char **unisymbol2_translation_table;
unsigned int unisymbol3_first_char;
unsigned int unisymbol3_last_char;
char **unisymbol3_translation_table;
const char **unisymbol3_translation_table;
unsigned int unisymbol4_first_char;
unsigned int unisymbol4_last_char;
char **unisymbol4_translation_table;
const char **unisymbol4_translation_table;
#else
#if 1 /* daved 0.19.4 unicode support */
short unisymbol1_first_char;
@@ -273,7 +274,7 @@ typedef struct {
#if 1 /* daved 0.19.5 SYMBOL font support */
short symbol_first_char;
short symbol_last_char;
char **symbol_translation_table;
const char **symbol_translation_table;
#endif
void (*write_set_foreground) (int,int,int);
@@ -284,7 +285,7 @@ OutputPersonality;
extern OutputPersonality* op_create(void);
extern void op_free (OutputPersonality*);
#if 1 /* daved - 0.19.6 */
extern char* op_translate_char (OutputPersonality*,int,int, int);
extern const char* op_translate_char (OutputPersonality*,int,int, int);
#else
extern char* op_translate_char (OutputPersonality*,int,int);
#endif

View File

@@ -25,14 +25,16 @@
#ifndef _LADSPA_EFFECT_H
#define _LADSPA_EFFECT_H
#include <QtGui/QWorkspace>
#include "effect.h"
#include "engine.h"
#include "ladspa_2_lmms.h"
#include "mixer.h"
#include "ladspa_base.h"
#include "ladspa_control.h"
#include "ladspa_control_dialog.h"
#include "ladspa_base.h"
#include "main_window.h"
#include "mixer.h"
typedef QVector<port_desc_t *> multi_proc_t;

View File

@@ -662,8 +662,9 @@ int lb302Synth::process(sampleFrame *outbuf, const Uint32 size)
sample_cnt++;
vcf_envpos++;
float old_vco_k = vco_k;
bool looking;
// unused variables
//float old_vco_k = vco_k;
//bool looking;
int decay_frames = 128;
// update vco
@@ -747,7 +748,7 @@ int lb302Synth::process(sampleFrame *outbuf, const Uint32 size)
}
if(i>=release_frame) {
if((int)i>=release_frame) {
vca_mode=1;
}

View File

@@ -560,8 +560,10 @@ bool FASTCALL midiImport::readTrack( int _track_end, QString & _track_name )
{
int nominator = readByte();
int denominator = 1 << (int) readByte();
int clocks = readByte();
int notes = readByte();
// clocks
readByte();
// notes
readByte();
if( nominator == 0 )
{
nominator = 4;

View File

@@ -31,7 +31,10 @@ CLEANFILES = $(MOC_FILES) ./embedded_resources.h
pkglib_LTLIBRARIES = libsingerbot.la
libsingerbot_la_SOURCES = singerbot.cpp singerbot.h
libsingerbot_la_LDFLAGS = -lFestival -lestools -lestbase -lesd -lncurses
libsingerbot_la_SOURCES = singerbot.cpp singerbot.h file.h
$(libsingerbot_la_SOURCES): ./embedded_resources.h
pkglib_PROGRAMS = singerbot_proxy
singerbot_proxy_SOURCES = singerbot_proxy.cpp
singerbot_proxy_LDFLAGS = -lFestival -lestools -lestbase -lesd -lncurses -lrt

72
plugins/singerbot/file.h Normal file
View File

@@ -0,0 +1,72 @@
/*
* file.h - file descriptor wrapper
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* 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 _FILE_H
#define _FILE_H
#include <unistd.h>
#include <sys/types.h>
class File
{
public:
File( int _fd ) :
m_fd( _fd )
{
}
virtual ~File()
{
close( m_fd );
}
template<typename T>
ssize_t read( T * _i, int _n = 1 )
{
return( ::read( m_fd, _i, _n * sizeof( T ) ) );
}
template<typename T>
ssize_t write( const T * _i, int _n = 1 )
{
return( ::write( m_fd, _i, _n * sizeof( T ) ) );
}
off_t rewind( void )
{
return( lseek( m_fd, 0, SEEK_SET ) );
}
private:
const int m_fd;
} ;
#endif

View File

@@ -23,13 +23,20 @@
*/
#include "singerbot.h"
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <QtCore/QDir>
#include <QtGui/QLayout>
#include <QtGui/QTextEdit>
#include <QtXml/QDomElement>
#include "singerbot.h"
#include "engine.h"
#include "file.h"
#include "instrument_track.h"
#include "note_play_handle.h"
#include "pattern.h"
@@ -38,9 +45,6 @@
#undef SINGLE_SOURCE_COMPILE
#include "embed.cpp"
#undef HAVE_CONFIG_H
#include <festival.h>
@@ -72,19 +76,10 @@ plugin * lmms_plugin_main( void * _data )
singerBot::synThread * singerBot::s_thread = NULL;
singerBot::singerBot( instrumentTrack * _track ) :
instrument( _track, &singerbot_plugin_descriptor )
{
if( !s_thread )
{
s_thread = new synThread();
s_thread->start();
}
synth_init();
setAutoFillBackground( TRUE );
QPalette pal;
@@ -116,6 +111,7 @@ singerBot::singerBot( instrumentTrack * _track ) :
singerBot::~singerBot()
{
synth_destroy();
}
@@ -148,7 +144,7 @@ void singerBot::playNote( notePlayHandle * _n, bool )
void singerBot::deleteNotePluginData( notePlayHandle * _n )
{
handle_data * hdata = (handle_data *)_n->m_pluginData;
delete hdata->wave;
delete[] hdata->wave;
src_delete( hdata->resampling_state );
delete hdata;
}
@@ -228,9 +224,8 @@ void singerBot::createWave( notePlayHandle * _n )
int word_index = _n->patternIndex() % m_words.size();
hdata->text = m_words[word_index].toAscii().constData();
s_thread->set_data( hdata );
s_thread->unlock_synth();
s_thread->lock_handle();
synth_send( hdata );
synth_read( hdata );
if( !hdata->wave )
{
@@ -246,7 +241,7 @@ void singerBot::createWave( notePlayHandle * _n )
}
hdata->resampling_data.end_of_input = 0;
hdata->remaining_frames = hdata->wave->num_samples();
hdata->remaining_frames = hdata->num_samples;
}
@@ -255,11 +250,10 @@ void singerBot::createWave( notePlayHandle * _n )
void singerBot::play( sampleFrame * _ab, handle_data * _hdata,
const fpp_t _frames )
{
const f_cnt_t offset = _hdata->wave->num_samples()
- _hdata->remaining_frames;
const f_cnt_t offset = _hdata->num_samples - _hdata->remaining_frames;
const double ratio = engine::getMixer()->sampleRate()
/ (double)_hdata->wave->sample_rate();
/ (double)_hdata->sample_rate;
const f_cnt_t margin = 2;
f_cnt_t fragment_size = (f_cnt_t)( _frames / ratio ) + margin;
@@ -270,8 +264,7 @@ void singerBot::play( sampleFrame * _ab, handle_data * _hdata,
{
for( f_cnt_t frame = 0; frame < fragment_size; ++frame )
{
sample_fragment[frame] = _hdata->wave->a( offset
+ frame )
sample_fragment[frame] = _hdata->wave[offset + frame]
/ OUTPUT_SAMPLE_MULTIPLIER;
}
}
@@ -280,8 +273,7 @@ void singerBot::play( sampleFrame * _ab, handle_data * _hdata,
for( f_cnt_t frame = 0; frame < _hdata->remaining_frames;
++frame )
{
sample_fragment[frame] = _hdata->wave->a( offset
+ frame )
sample_fragment[frame] = _hdata->wave[offset + frame]
/ OUTPUT_SAMPLE_MULTIPLIER;
}
memset( sample_fragment + _hdata->remaining_frames, 0,
@@ -325,141 +317,104 @@ void singerBot::play( sampleFrame * _ab, handle_data * _hdata,
singerBot::synThread::synThread( void ) :
m_handle_semaphore( 1 ),
m_synth_semaphore( 1 )
void singerBot::synth_init( void )
{
m_handle_semaphore.acquire();
m_synth_semaphore.acquire();
static int suffix_index = 0;
m_file_suffix = '.' + QString::number( getpid() ) + '.'
+ QString::number( suffix_index++, 16 );
int fd = shm_open( addSuffix( "/lmms_singerbot" ),
O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR );
m_shm = new File( fd );
m_handle_semaphore = sem_open( addSuffix( "/lmms_singerbot_s1" ),
O_CREAT | O_EXCL, S_IRUSR | S_IWUSR, 0 );
m_synth_semaphore = sem_open( addSuffix( "/lmms_singerbot_s2" ),
O_CREAT | O_EXCL, S_IRUSR | S_IWUSR, 0 );
pid_t cpid = fork();
if( cpid == -1 )
{
perror( "fork" );
exit( EXIT_FAILURE );
}
else if( cpid == 0 )
{
sem_close( m_handle_semaphore );
sem_close( m_synth_semaphore );
QString proxy_exec = configManager::inst()->pluginDir() +
QDir::separator() +
"singerbot_proxy";
execlp( proxy_exec.toAscii().constData(),
proxy_exec.toAscii().constData(),
m_file_suffix.toAscii().constData(),
NULL );
exit( EXIT_FAILURE );
}
sem_wait( m_handle_semaphore );
}
singerBot::synThread::~synThread()
void singerBot::synth_destroy( void )
{
m_handle_semaphore.release();
m_synth_semaphore.release();
m_shm->rewind();
float stop = -1.0;
m_shm->write( &stop );
sem_post( m_synth_semaphore );
wait( NULL );
sem_close( m_handle_semaphore );
sem_close( m_synth_semaphore );
sem_unlink( addSuffix( "/lmms_singerbot_s1" ) );
sem_unlink( addSuffix( "/lmms_singerbot_s2" ) );
delete m_shm;
shm_unlink( addSuffix( "/lmms_singerbot" ) );
}
void singerBot::synThread::run( void )
void singerBot::synth_send( handle_data * _hdata )
{
const int load_init_files = 1;
festival_initialize( load_init_files, FESTIVAL_HEAP_SIZE );
m_shm->rewind();
m_shm->write( &_hdata->frequency );
m_shm->write( &_hdata->duration );
Uint8 len = strlen( _hdata->text );
m_shm->write( &len );
m_shm->write( _hdata->text, len );
festival_eval_command(
"(define get_segment"
" (lambda (utt) (begin"
" (Initialize utt)"
" (Text utt)"
" (Token_POS utt)"
" (Token utt)"
" (POS utt)"
" (Phrasify utt)"
" (Word utt)"
" ))"
")" );
festival_eval_command(
"(Parameter.set 'Int_Method 'DuffInt)" );
festival_eval_command(
"(Parameter.set 'Int_Target_Method Int_Targets_Default)" );
for( ; ; )
{
m_synth_semaphore.acquire();
text_to_wave();
if( !m_data->wave )
{
// Damaged SIOD environment? Retrying...
text_to_wave();
if( !m_data->wave )
{
printf( "Unsupported frequency?\n" );
}
}
m_handle_semaphore.release();
}
sem_post( m_synth_semaphore );
}
void singerBot::synThread::text_to_wave( void )
void singerBot::synth_read( handle_data * _hdata )
{
//TODO: Heap corruption too -> move to separate process?
char command[80];
sprintf( command,
"(set! duffint_params '((start %f) (end %f)))",
m_data->frequency, m_data->frequency );
festival_eval_command( command );
festival_eval_command(
"(Parameter.set 'Duration_Stretch 1)" );
sem_wait( m_handle_semaphore );
sprintf( command,
"(set! total_time (parse-number %f))", m_data->duration );
festival_eval_command( command );
festival_eval_command(
"(set! word " + quote_string( m_data->text, "\"", "\\", 1 )
+ ")" );
if( festival_eval_command(
"(begin"
" (set! my_utt (eval (list 'Utterance 'Text word)))"
" (get_segment my_utt)"
" (if (equal? (length (utt.relation.leafs my_utt 'Segment)) 1)"
" (begin (set! my_utt (eval "
" (list 'Utterance 'Text (string-append word \" \" word))))"
" (get_segment my_utt)"
" ))"
" (Pauses my_utt)"
" (item.delete (utt.relation.first my_utt 'Segment))"
" (item.delete (utt.relation.last my_utt 'Segment))"
" (Intonation my_utt)"
" (PostLex my_utt)"
" (Duration my_utt)"
" (if (not (equal? total_time 0)) (begin"
" (set! utt_time"
" (item.feat (utt.relation.last my_utt 'Segment) 'end))"
" (Parameter.set 'Duration_Stretch (/ total_time utt_time))"
" (Duration my_utt)"
" ))"
" (Int_Targets my_utt)"
")" )
&& festival_eval_command(
" (Wave_Synth my_utt)" ) )
m_shm->rewind();
m_shm->read( &_hdata->num_samples );
if( !_hdata->num_samples )
{
m_data->wave = get_wave( "my_utt" );
return;
}
m_shm->read( &_hdata->sample_rate );
_hdata->wave = new short[_hdata->num_samples];
m_shm->read( _hdata->wave, _hdata->num_samples );
}
EST_Wave * singerBot::synThread::get_wave( const char * _name )
const char * singerBot::addSuffix( const char * _s )
{
LISP lutt = siod_get_lval( _name, NULL );
if( !utterance_p( lutt ) )
{
return( NULL );
}
EST_Relation * r = utterance( lutt )->relation( "Wave" );
//TODO: This check is useless. The error is fatal.
if ( !r || !r->head() )
{
return( NULL );
}
return( new EST_Wave( *wave( r->head()->f( "wave" ) ) ) );
return( QString( _s + m_file_suffix ).toAscii().constData() );
}

View File

@@ -26,8 +26,6 @@
#ifndef _SINGERBOT_H
#define _SINGERBOT_H
#include <QtCore/QThread>
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -38,11 +36,13 @@
#include "src/3rdparty/samplerate/samplerate.h"
#endif
#include <semaphore.h>
#include "instrument.h"
#include "mixer.h"
class EST_Wave;
class File;
class QTextEdit;
class sampleBuffer;
@@ -73,7 +73,9 @@ public slots:
private:
typedef struct
{
EST_Wave * wave;
short * wave;
int num_samples;
int sample_rate;
f_cnt_t remaining_frames;
float frequency;
float duration;
@@ -83,44 +85,11 @@ private:
} handle_data;
class synThread : public QThread
{
public:
synThread( void );
virtual ~synThread();
QString m_file_suffix;
void set_data( handle_data * _hdata )
{
m_data = _hdata;
}
void unlock_synth( void )
{
m_synth_semaphore.release();
}
void lock_handle( void )
{
m_handle_semaphore.acquire();
}
protected:
virtual void run( void );
private:
QSemaphore m_handle_semaphore;
QSemaphore m_synth_semaphore;
handle_data * m_data;
void text_to_wave( void );
EST_Wave * get_wave( const char * _name );
} ;
static synThread * s_thread;
File * m_shm;
sem_t * m_handle_semaphore;
sem_t * m_synth_semaphore;
QTextEdit * m_lyrics;
QStringList m_words;
@@ -131,6 +100,14 @@ private:
const fpp_t _frames );
void updateWords( void );
void synth_init( void );
void synth_destroy( void );
void synth_send( handle_data * _hdata );
void synth_read( handle_data * _hdata );
const char * addSuffix( const char * _s );
} ;

View File

@@ -0,0 +1,225 @@
/*
* singerbot_proxy.cpp - separate process to deal with Festival
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* 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 <fcntl.h>
#include <semaphore.h>
#include <sys/mman.h>
#include <sys/types.h>
#include "file.h"
#undef HAVE_CONFIG_H
#include <festival.h>
static File * s_shm;
static sem_t * s_handle_semaphore;
static sem_t * s_synth_semaphore;
static void run( void );
static EST_Wave * text_to_wave( float _frequency, float _duration,
const char * _text );
static EST_Wave * get_wave( const char * _name );
int main( int argc, char * * argv )
{
string resource = "/lmms_singerbot";
resource += argv[1];
int fd = shm_open( resource.c_str(), O_RDWR, S_IRUSR | S_IWUSR );
s_shm = new File( fd );
resource = "/lmms_singerbot_s1";
resource += argv[1];
s_handle_semaphore = sem_open( resource.c_str(), 0 );
resource = "/lmms_singerbot_s2";
resource += argv[1];
s_synth_semaphore = sem_open( resource.c_str(), 0 );
sem_post( s_handle_semaphore );
run();
sem_close( s_handle_semaphore );
sem_close( s_synth_semaphore );
delete s_shm;
return( EXIT_SUCCESS );
}
void run( void )
{
const int load_init_files = 1;
festival_initialize( load_init_files, FESTIVAL_HEAP_SIZE );
festival_eval_command(
"(define get_segment"
" (lambda (utt) (begin"
" (Initialize utt)"
" (Text utt)"
" (Token_POS utt)"
" (Token utt)"
" (POS utt)"
" (Phrasify utt)"
" (Word utt)"
" ))"
")" );
festival_eval_command(
"(Parameter.set 'Int_Method 'DuffInt)" );
festival_eval_command(
"(Parameter.set 'Int_Target_Method Int_Targets_Default)" );
for( ; ; )
{
sem_wait( s_synth_semaphore );
float frequency;
float duration;
s_shm->rewind();
s_shm->read( &frequency );
if( frequency == -1.0f )
{
break;
}
s_shm->read( &duration );
unsigned char len;
s_shm->read( &len );
char * text = new char[len + 1];
s_shm->read( text, len );
text[len] = '\0';
EST_Wave * wave = text_to_wave( frequency, duration, text );
if( !wave )
{
// Damaged SIOD environment? Retrying...
wave = text_to_wave( frequency, duration, text );
if( !wave )
{
printf( "Unsupported frequency?\n" );
}
}
s_shm->rewind();
int num_samples = wave ? wave->num_samples() : 0;
s_shm->write( &num_samples );
if( num_samples )
{
int sample_rate = wave->sample_rate();
s_shm->write( &sample_rate );
}
for( int i = 0; i < num_samples; ++i )
{
short sample = wave->a( i );
s_shm->write( &sample );
}
delete wave;
sem_post( s_handle_semaphore );
}
}
EST_Wave * text_to_wave( float _frequency, float _duration, const char * _text )
{
char command[80];
sprintf( command,
"(set! duffint_params '((start %f) (end %f)))", _frequency,
_frequency );
festival_eval_command( command );
festival_eval_command(
"(Parameter.set 'Duration_Stretch 1)" );
sprintf( command,
"(set! total_time (parse-number %f))", _duration );
festival_eval_command( command );
festival_eval_command(
"(set! word " + quote_string( _text, "\"", "\\", 1 ) + ")" );
if( festival_eval_command(
"(begin"
" (set! my_utt (eval (list 'Utterance 'Text word)))"
" (get_segment my_utt)"
" (if (equal? (length (utt.relation.leafs my_utt 'Segment)) 1)"
" (begin (set! my_utt (eval "
" (list 'Utterance 'Text (string-append word \" \" word))))"
" (get_segment my_utt)"
" ))"
" (Pauses my_utt)"
" (item.delete (utt.relation.first my_utt 'Segment))"
" (item.delete (utt.relation.last my_utt 'Segment))"
" (Intonation my_utt)"
" (PostLex my_utt)"
" (Duration my_utt)"
" (if (not (equal? total_time 0)) (begin"
" (set! utt_time"
" (item.feat (utt.relation.last my_utt 'Segment) 'end))"
" (Parameter.set 'Duration_Stretch (/ total_time utt_time))"
" (Duration my_utt)"
" ))"
" (Int_Targets my_utt)"
")" )
&& festival_eval_command(
" (Wave_Synth my_utt)" ) )
{
return( get_wave( "my_utt" ) );
}
return( NULL );
}
EST_Wave * get_wave( const char * _name )
{
LISP lutt = siod_get_lval( _name, NULL );
if( !utterance_p( lutt ) )
{
return( NULL );
}
EST_Relation * r = utterance( lutt )->relation( "Wave" );
//TODO: This check is useless. The error is fatal.
if ( !r || !r->head() )
{
return( NULL );
}
return( new EST_Wave( *wave( r->head()->f( "wave" ) ) ) );
}

View File

@@ -23,14 +23,14 @@
*/
#include <QtCore/QPoint>
#include "impulse_editor.h"
#include <Qt/QtXml>
#include <QtCore/QMap>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtCore/QPoint>
#include <QtGui/QWhatsThis>
#include "impulse_editor.h"
#include "caption_menu.h"
#include "embed.h"
#include "engine.h"
#include "oscillator.h"
@@ -41,7 +41,7 @@
impulseEditor::impulseEditor( QWidget * _parent, int _x, int _y, track * _track,
Uint32 _len ) :
QWidget( _parent/*, "impulseEditor"*/ ),
QWidget( _parent ),
m_sampleLength( _len ),
m_normalizeFactor( 1.0f ),
m_forward( TRUE )
@@ -438,16 +438,7 @@ void impulseEditor::setOn( bool _on )
void impulseEditor::contextMenuEvent( QContextMenuEvent * )
{
QMenu contextMenu( this );
contextMenu.setTitle( accessibleName() );
#warning TODO: css-formatting
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( "Impulse Editor" ) + "</b></font>", this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ),
this, SLOT( displayHelp() ) );
contextMenu.exec( QCursor::pos() );

View File

@@ -23,11 +23,11 @@
*/
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include "nine_button_selector.h"
#include <QtGui/QWhatsThis>
#include "nine_button_selector.h"
#include "caption_menu.h"
#include "embed.h"
@@ -53,7 +53,7 @@ nineButtonSelector::nineButtonSelector( QPixmap _button0_on,
Uint32 _x, Uint32 _y,
QWidget * _parent,
track * _track ):
QWidget( _parent/*, "nineButtonSelector"*/ ),
QWidget( _parent ),
m_selected( _default )
{
setFixedSize( 50, 50 );
@@ -250,16 +250,7 @@ void FASTCALL nineButtonSelector::setSelected( Uint8 _new_button )
void nineButtonSelector::contextMenuEvent( QContextMenuEvent * )
{
QMenu contextMenu( this );
contextMenu.setTitle( accessibleName() );
#warning TODO: CSS-formatting
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( "Selector" ) + "</b></font>", this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ),
this, SLOT( displayHelp() ) );
contextMenu.exec( QCursor::pos() );

View File

@@ -23,14 +23,14 @@
*/
#include "vibed.h"
#include <Qt/QtXml>
#include <QtCore/QMap>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QWhatsThis>
#include "vibed.h"
#include "base64.h"
#include "caption_menu.h"
#include "engine.h"
#include "instrument_track.h"
#include "knob.h"
@@ -78,6 +78,7 @@ vibed::vibed( instrumentTrack * instrument_track ) :
for( Uint8 harm = 0; harm < 9; harm++ )
{
m_editor = new impulseEditor( this, 76, 21, instrument_track );
m_editor->setAccessibleName( tr( "Impulse Editor" ) );
m_editor->setOn( FALSE );
m_editor->hide();
m_editors.append( m_editor );
@@ -238,6 +239,7 @@ vibed::vibed( instrumentTrack * instrument_track ) :
21, 127,
this,
NULL );
m_harmonic->setAccessibleName( tr( "Octave" ) );
m_harmonic->hide();
m_harmonics.append( m_harmonic );
m_harmonic->setWhatsThis( tr(
@@ -271,6 +273,7 @@ vibed::vibed( instrumentTrack * instrument_track ) :
21, 39,
this,
NULL );
m_stringSelector->setAccessibleName( tr( "String" ) );
connect( m_stringSelector, SIGNAL( nineButtonSelection( Uint8 ) ),
this, SLOT( showString( Uint8 ) ) );
m_stringSelector->setWhatsThis( tr(
@@ -588,16 +591,7 @@ void vibed::showString( Uint8 _string )
void vibed::contextMenuEvent( QContextMenuEvent * )
{
QMenu contextMenu( this );
contextMenu.setTitle( accessibleName() );
#warning TODO: CSS-formatting
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( "Vibed" ) + "</b></font>", this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( publicName() );
contextMenu.addAction( embed::getIconPixmap( "help" ), tr( "&Help" ),
this, SLOT( displayHelp() ) );
contextMenu.exec( QCursor::pos() );

View File

@@ -23,9 +23,12 @@
*/
#include "lvsl_client.h"
#include <QtCore/QLocale>
#include <QtCore/QTime>
#include <QtCore/QDir>
#include <QtGui/QWorkspace>
#include <QtGui/QX11EmbedContainer>
#include <QtGui/QX11Info>
@@ -60,11 +63,10 @@
#endif
#include "templates.h"
#include "config_mgr.h"
#include "engine.h"
#include "main_window.h"
#include "lvsl_client.h"
#include "templates.h"

View File

@@ -27,6 +27,7 @@
#define _VST_EFFECT_H
#include <QtCore/QMutex>
#include <QtGui/QWorkspace>
#include "effect.h"
#include "engine.h"

View File

@@ -67,8 +67,8 @@ audioALSA::audioALSA( const sample_rate_t _sample_rate, bool & _success_ful,
return;
}
snd_pcm_hw_params_alloca( &m_hwParams );
snd_pcm_sw_params_alloca( &m_swParams );
snd_pcm_hw_params_malloc( &m_hwParams );
snd_pcm_sw_params_malloc( &m_swParams );
if( ( err = setHWParams( _sample_rate, channels(),
SND_PCM_ACCESS_RW_INTERLEAVED ) ) < 0 )
@@ -97,8 +97,8 @@ audioALSA::~audioALSA()
{
snd_pcm_close( m_handle );
}
// the following code doesn't work and leads to a crash...
/* if( m_hwParams != NULL )
if( m_hwParams != NULL )
{
snd_pcm_hw_params_free( m_hwParams );
}
@@ -106,7 +106,7 @@ audioALSA::~audioALSA()
if( m_swParams != NULL )
{
snd_pcm_sw_params_free( m_swParams );
}*/
}
}

View File

@@ -80,11 +80,13 @@ inline Sint32 audioFileOgg::writePage( void )
bool audioFileOgg::startEncoding( void )
{
vorbis_comment vc;
char * comments = "Cool=This song has been made using Linux "
const char * comments = "Cool=This song has been made using Linux "
"MultiMedia Studio";
Sint32 comment_length = strlen( comments );
char * user_comments = new char[comment_length + 1];
strcpy( user_comments, comments );
vc.user_comments = &comments;
vc.user_comments = &user_comments;
vc.comment_lengths = &comment_length;
vc.comments = 1;
vc.vendor = NULL;

View File

@@ -26,15 +26,19 @@
*/
#include "automation_editor.h"
#include <Qt/QtXml>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QPainter>
#include <QtGui/QKeyEvent>
#include <QtGui/QWheelEvent>
#include <QtGui/QLayout>
#include <QtGui/QLabel>
#include <QtGui/QLayout>
#include <QtGui/QPainter>
#include <QtGui/QScrollBar>
#include <QtGui/QWheelEvent>
#include <QtGui/QWorkspace>
#ifndef __USE_XOPEN
@@ -44,7 +48,6 @@
#include <math.h>
#include "automation_editor.h"
#include "song_editor.h"
#include "main_window.h"
#include "embed.h"

View File

@@ -283,7 +283,7 @@ void automationPattern::processMidiTime( const midiTime & _time )
}
#undef value
#include "automation_pattern.moc"

View File

@@ -820,15 +820,15 @@ bool configManager::loadConfigFile( void )
( 0, tr( "Version mismatches" ),
tr( "Accordingly to the information in "
"your LMMS-configuration-file "
"you seem\nto have run a "
"you seem to have run a "
"different (probably older) "
"version of LMMS before.\n"
"It is recommended to run the "
"setup-wizard again to ensure "
"that\nthe latest samples, "
"that the latest samples, "
"presets, demo-projects etc. "
"are installed in your\n"
"LMMS-working-directory. "
"are installed in your "
"LMMS-working-directory.\n"
"Run the setup-wizard now?" ),
QMessageBox::Yes, QMessageBox::No )
== QMessageBox::Yes )
@@ -840,6 +840,11 @@ bool configManager::loadConfigFile( void )
}
}
QDir::setSearchPaths( "resources", QStringList() << artworkDir()
<< defaultArtworkDir() );
loadStyleSheet();
return( TRUE );
}
@@ -911,6 +916,16 @@ void configManager::saveConfigFile( void )
void configManager::loadStyleSheet( void )
{
QFile file( "resources:style.css" );
file.open( QIODevice::ReadOnly );
qApp->setStyleSheet( file.readAll() );
}
/*
void configManager::processFilesRecursively( const QString & _src_dir,
const QString & _dst_dir,
@@ -941,7 +956,5 @@ void configManager::processFilesRecursively( const QString & _src_dir,
#include "config_mgr.moc"
#undef absolutePath
#undef addButton
#endif

View File

@@ -26,15 +26,15 @@
*/
#include <QtGui/QPushButton>
#include "file_browser.h"
#include <QtGui/QKeyEvent>
#include <QtGui/QMenu>
#include <QtGui/QCursor>
class QColorGroup;
#include <Qt3Support/Q3Header>
#include <QtGui/QPushButton>
#include <QtGui/QWorkspace>
#include "file_browser.h"
#include "bb_editor.h"
#include "config_mgr.h"
#include "debug.h"
@@ -57,7 +57,6 @@ fileBrowser::fileBrowser( const QString & _directories, const QString & _filter,
const QString & _title, const QPixmap & _pm,
QWidget * _parent ) :
sideBarWidget( _title, _pm, _parent ),
m_contextMenuItem( NULL ),
m_directories( _directories ),
m_filter( _filter )
{
@@ -65,12 +64,6 @@ fileBrowser::fileBrowser( const QString & _directories, const QString & _filter,
m_l = new listView( contentParent() );
addContentWidget( m_l );
connect( m_l, SIGNAL( contextMenuRequested( Q3ListViewItem *,
const QPoint &, int ) ),
this, SLOT( contextMenuRequest( Q3ListViewItem *,
const QPoint &, int ) ) );
QPushButton * reload_btn = new QPushButton( embed::getIconPixmap(
"reload" ), tr( "Reload (F5)" ), contentParent() );
addContentWidget( reload_btn );
@@ -98,36 +91,6 @@ void fileBrowser::reloadTree( void )
{
addItems( *it );
}
Q3ListViewItem * item = m_l->firstChild();
bool resort = FALSE;
// sort merged directories
while( item != NULL )
{
directory * d = dynamic_cast<directory *>( item );
if( d == NULL )
{
resort = TRUE;
}
else if( resort == TRUE )
{
Q3ListViewItem * i2 = m_l->firstChild();
d->moveItem( i2 );
i2->moveItem( d );
directory * d2 = NULL;
while( ( d2 = dynamic_cast<directory *>( i2 ) ) !=
NULL )
{
if( d->text( 0 ) > d2->text( 0 ) )
{
d->moveItem( d2 );
}
i2 = i2->nextSibling();
}
}
item = item->nextSibling();
}
}
@@ -136,15 +99,48 @@ void fileBrowser::reloadTree( void )
void fileBrowser::addItems( const QString & _path )
{
QDir cdir( _path );
QStringList files = cdir.entryList( QDir::Files, QDir::Name );
// TODO: after dropping qt3-support we can use QStringList's iterator
// which makes it possible to travel through the list in reverse
// direction
for( int i = 0; i < files.size(); ++i )
QStringList files = cdir.entryList( QDir::Dirs, QDir::Name );
for( QStringList::const_iterator it = files.constBegin();
it != files.constEnd(); ++it )
{
QString cur_file = files[files.size() - i - 1];
QString cur_file = *it;
if( cur_file[0] != '.' &&
isDirWithContent( _path + QDir::separator() + cur_file,
m_filter ) )
{
bool orphan = TRUE;
for( int i = 0; i < m_l->topLevelItemCount(); ++i )
{
directory * d = dynamic_cast<directory *>(
m_l->topLevelItem( i ) );
if( d == NULL || cur_file < d->text( 0 ) )
{
m_l->insertTopLevelItem( i,
new directory( cur_file, _path,
m_filter ) );
orphan = FALSE;
break;
}
else if( cur_file == d->text( 0 ) )
{
d->addDirectory( _path );
orphan = FALSE;
break;
}
}
if( orphan )
{
m_l->addTopLevelItem( new directory( cur_file,
_path, m_filter ) );
}
}
}
files = cdir.entryList( QDir::Files, QDir::Name );
for( QStringList::const_iterator it = files.constBegin();
it != files.constEnd(); ++it )
{
QString cur_file = *it;
if( cur_file[0] != '.'
#warning TODO: add match here
#ifdef QT4
@@ -154,33 +150,17 @@ void fileBrowser::addItems( const QString & _path )
#endif
)
{
// TODO: don't insert instead of removing, order changed
// remove existing file-items
delete m_l->findItem( cur_file, 0 );
QList<QTreeWidgetItem *> existing = m_l->findItems(
cur_file, Qt::MatchFixedString );
if( !existing.empty() )
{
delete existing.front();
}
(void) new fileItem( m_l, cur_file, _path );
}
}
files = cdir.entryList( QDir::Dirs, QDir::Name );
for( int i = 0; i < files.size(); ++i )
{
QString cur_file = files[files.size() - i - 1];
if( cur_file[0] != '.' &&
isDirWithContent( _path + QDir::separator() + cur_file,
m_filter ) )
{
Q3ListViewItem * item = m_l->findItem( cur_file, 0 );
if( item == NULL )
{
(void) new directory( m_l, cur_file, _path,
m_filter );
}
else if( dynamic_cast<directory *>( item ) != NULL )
{
dynamic_cast<directory *>( item )->
addDirectory( _path );
}
}
}
}
@@ -196,11 +176,7 @@ bool fileBrowser::isDirWithContent( const QString & _path,
QString cur_file = *it;
if( cur_file[0] != '.'
#warning TODO: add match here
#ifdef QT4
// TBD
#else
// && QDir::match( _filter, cur_file.lower() )
#endif
&& QDir::match( _filter, cur_file.toLower() )
)
{
return( TRUE );
@@ -240,169 +216,30 @@ void fileBrowser::keyPressEvent( QKeyEvent * _ke )
void fileBrowser::contextMenuRequest( Q3ListViewItem * i, const QPoint &, int )
{
fileItem * f = dynamic_cast<fileItem *>( i );
if( f != NULL && ( f->type() == fileItem::SAMPLE_FILE ||
f->type() == fileItem::PRESET_FILE ) )
{
m_contextMenuItem = f;
QMenu * contextMenu = new QMenu( this );
contextMenu->addAction( tr( "Send to active instrument-track" ),
this,
SLOT( sendToActiveInstrumentTrack() ) );
contextMenu->addAction( tr( "Open in new instrument-track/"
"Song-Editor" ),
this,
SLOT( openInNewInstrumentTrackSE() ) );
contextMenu->addAction( tr( "Open in new instrument-track/"
"B+B Editor" ),
this,
SLOT( openInNewInstrumentTrackBBE() ) );
contextMenu->exec( QCursor::pos() );
m_contextMenuItem = NULL;
delete contextMenu;
}
}
void fileBrowser::contextMenuRequest( QListViewItem * i, const QPoint &, int )
{
}
void fileBrowser::sendToActiveInstrumentTrack( void )
{
if( engine::getMainWindow()->workspace() == NULL )
{
return;
}
// get all windows opened in the workspace
QWidgetList pl = engine::getMainWindow()->workspace()->windowList(
QWorkspace::StackingOrder );
QListIterator<QWidget *> w( pl );
w.toBack();
// now we travel through the window-list until we find an
// instrument-track
while( w.hasPrevious() )
{
instrumentTrack * ct = dynamic_cast<instrumentTrack *>(
w.previous() );
if( ct != NULL && ct->isHidden() == FALSE )
{
// ok, it's an instrument-track, so we can apply the
// sample or the preset
engine::getMixer()->lock();
if( m_contextMenuItem->type() == fileItem::SAMPLE_FILE )
{
instrument * afp = ct->loadInstrument(
engine::sampleExtensions()
[m_contextMenuItem
->extension()] );
if( afp != NULL )
{
afp->setParameter( "samplefile",
m_contextMenuItem->fullName() );
}
}
else if( m_contextMenuItem->type() ==
fileItem::PRESET_FILE )
{
multimediaProject mmp(
m_contextMenuItem->fullName() );
ct->loadTrackSpecificSettings( mmp.content().
firstChild().
toElement() );
}
ct->toggledInstrumentTrackButton( TRUE );
engine::getMixer()->unlock();
break;
}
}
}
void fileBrowser::openInNewInstrumentTrack( trackContainer * _tc )
{
engine::getMixer()->lock();
if( m_contextMenuItem->type() == fileItem::SAMPLE_FILE )
{
instrumentTrack * ct = dynamic_cast<instrumentTrack *>(
track::create( track::INSTRUMENT_TRACK, _tc ) );
#ifdef LMMS_DEBUG
assert( ct != NULL );
#endif
instrument * afp = ct->loadInstrument(
engine::sampleExtensions()
[m_contextMenuItem
->extension()] );
if( afp != NULL )
{
afp->setParameter( "samplefile",
m_contextMenuItem->fullName() );
}
ct->toggledInstrumentTrackButton( TRUE );
}
else if( m_contextMenuItem->type() == fileItem::PRESET_FILE )
{
multimediaProject mmp( m_contextMenuItem->fullName() );
track * t = track::create( track::INSTRUMENT_TRACK, _tc );
instrumentTrack * ct = dynamic_cast<instrumentTrack *>( t );
if( ct != NULL )
{
ct->loadTrackSpecificSettings( mmp.content().
firstChild().
toElement() );
ct->toggledInstrumentTrackButton( TRUE );
}
}
engine::getMixer()->unlock();
}
void fileBrowser::openInNewInstrumentTrackSE( void )
{
openInNewInstrumentTrack( engine::getSongEditor() );
}
void fileBrowser::openInNewInstrumentTrackBBE( void )
{
openInNewInstrumentTrack( engine::getBBEditor() );
}
listView::listView( QWidget * _parent ) :
Q3ListView( _parent ),
QTreeWidget( _parent ),
m_mousePressed( FALSE ),
m_pressPos(),
m_previewPlayHandle( NULL ),
m_pphMutex()
m_pphMutex(),
m_contextMenuItem( NULL )
{
addColumn( tr( "Files" ) );
setTreeStepSize( 12 );
setSorting( -1 );
setShowToolTips( TRUE );
setColumnCount( 1 );
setHeaderLabel( tr( "Files" ) );
setSortingEnabled( FALSE );
setFont( pointSizeF( font(), 7.5f ) );
connect( this, SIGNAL( itemDoubleClicked( QTreeWidgetItem *, int ) ),
SLOT( activateListItem( QTreeWidgetItem *, int ) ) );
connect( this, SIGNAL( itemCollapsed( QTreeWidgetItem * ) ),
SLOT( updateDirectory( QTreeWidgetItem * ) ) );
connect( this, SIGNAL( itemExpanded( QTreeWidgetItem * ) ),
SLOT( updateDirectory( QTreeWidgetItem * ) ) );
}
@@ -415,11 +252,9 @@ listView::~listView()
void listView::contentsMouseDoubleClickEvent( QMouseEvent * _me )
void listView::activateListItem( QTreeWidgetItem * _item, int _column )
{
Q3ListView::contentsMouseDoubleClickEvent( _me );
fileItem * f = dynamic_cast<fileItem *>( itemAt(
contentsToViewport( _me->pos() ) ) );
fileItem * f = dynamic_cast<fileItem *>( _item );
if( f == NULL )
{
return;
@@ -474,27 +309,176 @@ void listView::contentsMouseDoubleClickEvent( QMouseEvent * _me )
void listView::contentsMousePressEvent( QMouseEvent * _me )
void listView::sendToActiveInstrumentTrack( void )
{
Q3ListView::contentsMousePressEvent( _me );
if( engine::getMainWindow()->workspace() == NULL )
{
return;
}
// get all windows opened in the workspace
QWidgetList pl = engine::getMainWindow()->workspace()->windowList(
QWorkspace::StackingOrder );
QListIterator<QWidget *> w( pl );
w.toBack();
// now we travel through the window-list until we find an
// instrument-track
while( w.hasPrevious() )
{
instrumentTrack * ct = dynamic_cast<instrumentTrack *>(
w.previous() );
if( ct != NULL && ct->isHidden() == FALSE )
{
// ok, it's an instrument-track, so we can apply the
// sample or the preset
engine::getMixer()->lock();
if( m_contextMenuItem->type() == fileItem::SAMPLE_FILE )
{
instrument * afp = ct->loadInstrument(
engine::sampleExtensions()
[m_contextMenuItem
->extension()] );
if( afp != NULL )
{
afp->setParameter( "samplefile",
m_contextMenuItem->fullName() );
}
}
else if( m_contextMenuItem->type() ==
fileItem::PRESET_FILE )
{
multimediaProject mmp(
m_contextMenuItem->fullName() );
ct->loadTrackSpecificSettings( mmp.content().
firstChild().
toElement() );
}
ct->toggledInstrumentTrackButton( TRUE );
engine::getMixer()->unlock();
break;
}
}
}
void listView::openInNewInstrumentTrack( trackContainer * _tc )
{
engine::getMixer()->lock();
if( m_contextMenuItem->type() == fileItem::SAMPLE_FILE )
{
instrumentTrack * ct = dynamic_cast<instrumentTrack *>(
track::create( track::INSTRUMENT_TRACK, _tc ) );
#ifdef LMMS_DEBUG
assert( ct != NULL );
#endif
instrument * afp = ct->loadInstrument(
engine::sampleExtensions()
[m_contextMenuItem
->extension()] );
if( afp != NULL )
{
afp->setParameter( "samplefile",
m_contextMenuItem->fullName() );
}
ct->toggledInstrumentTrackButton( TRUE );
}
else if( m_contextMenuItem->type() == fileItem::PRESET_FILE )
{
multimediaProject mmp( m_contextMenuItem->fullName() );
track * t = track::create( track::INSTRUMENT_TRACK, _tc );
instrumentTrack * ct = dynamic_cast<instrumentTrack *>( t );
if( ct != NULL )
{
ct->loadTrackSpecificSettings( mmp.content().
firstChild().
toElement() );
ct->toggledInstrumentTrackButton( TRUE );
}
}
engine::getMixer()->unlock();
}
void listView::openInNewInstrumentTrackBBE( void )
{
openInNewInstrumentTrack( engine::getBBEditor() );
}
void listView::openInNewInstrumentTrackSE( void )
{
openInNewInstrumentTrack( engine::getSongEditor() );
}
void listView::updateDirectory( QTreeWidgetItem * _item )
{
directory * dir = dynamic_cast<directory *>( _item );
if( dir != NULL )
{
dir->update();
}
}
void listView::contextMenuEvent( QContextMenuEvent * _e )
{
fileItem * f = dynamic_cast<fileItem *>( itemAt( _e->pos() ) );
if( f != NULL && ( f->type() == fileItem::SAMPLE_FILE ||
f->type() == fileItem::PRESET_FILE ) )
{
m_contextMenuItem = f;
QMenu contextMenu( this );
contextMenu.addAction( tr( "Send to active instrument-track" ),
this,
SLOT( sendToActiveInstrumentTrack() ) );
contextMenu.addAction( tr( "Open in new instrument-track/"
"Song-Editor" ),
this,
SLOT( openInNewInstrumentTrackSE() ) );
contextMenu.addAction( tr( "Open in new instrument-track/"
"B+B Editor" ),
this,
SLOT( openInNewInstrumentTrackBBE() ) );
contextMenu.exec( _e->globalPos() );
m_contextMenuItem = NULL;
}
}
void listView::mousePressEvent( QMouseEvent * _me )
{
QTreeWidget::mousePressEvent( _me );
if( _me->button() != Qt::LeftButton )
{
return;
}
QPoint p( contentsToViewport( _me->pos() ) );
Q3ListViewItem * i = itemAt( p );
QTreeWidgetItem * i = itemAt( _me->pos() );
if ( i )
{
if ( p.x() > header()->cellPos( header()->mapToActual( 0 ) ) +
treeStepSize() * ( i->depth() + ( rootIsDecorated() ?
1 : 0 ) ) + itemMargin() ||
p.x() < header()->cellPos(
header()->mapToActual( 0 ) ) )
{
// TODO: Restrict to visible selection
// if ( _me->x() > header()->cellPos( header()->mapToActual( 0 ) )
// + treeStepSize() * ( i->depth() + ( rootIsDecorated() ?
// 1 : 0 ) ) + itemMargin() ||
// _me->x() < header()->cellPos(
// header()->mapToActual( 0 ) ) )
// {
m_pressPos = _me->pos();
m_mousePressed = TRUE;
}
// }
}
fileItem * f = dynamic_cast<fileItem *>( i );
@@ -542,15 +526,14 @@ void listView::contentsMousePressEvent( QMouseEvent * _me )
void listView::contentsMouseMoveEvent( QMouseEvent * _me )
void listView::mouseMoveEvent( QMouseEvent * _me )
{
if( m_mousePressed == TRUE &&
( m_pressPos - _me->pos() ).manhattanLength() >
QApplication::startDragDistance() )
{
contentsMouseReleaseEvent( NULL );
fileItem * f = dynamic_cast<fileItem *>( itemAt(
contentsToViewport( m_pressPos ) ) );
mouseReleaseEvent( NULL );
fileItem * f = dynamic_cast<fileItem *>( itemAt( m_pressPos ) );
if( f != NULL )
{
switch( f->type() )
@@ -589,7 +572,7 @@ void listView::contentsMouseMoveEvent( QMouseEvent * _me )
void listView::contentsMouseReleaseEvent( QMouseEvent * _me )
void listView::mouseReleaseEvent( QMouseEvent * _me )
{
if( !m_pphMutex.tryLock() )
{
@@ -632,35 +615,29 @@ QPixmap * directory::s_folderOpenedPixmap = NULL;
QPixmap * directory::s_folderLockedPixmap = NULL;
directory::directory( directory * _parent, const QString & _name,
const QString & _path, const QString & _filter ) :
Q3ListViewItem( _parent, _name ),
m_p( _parent ),
m_pix( NULL ),
directory::directory( const QString & _name, const QString & _path,
const QString & _filter ) :
m_directories( _path ),
m_filter( _filter )
{
initPixmapStuff();
setText( 0, _name );
setChildIndicatorPolicy( QTreeWidgetItem::ShowIndicator );
if( !QDir( fullName() ).isReadable() )
{
setIcon( 0, *s_folderLockedPixmap );
}
else
{
setIcon( 0, *s_folderPixmap );
}
}
directory::directory( Q3ListView * _parent, const QString & _name,
const QString & _path, const QString & _filter ) :
Q3ListViewItem( _parent, _name ),
m_p( NULL ),
m_pix( NULL ),
m_directories( _path ),
m_filter( _filter )
{
initPixmapStuff();
}
void directory::initPixmapStuff( void )
{
if( s_folderPixmap == NULL )
@@ -680,68 +657,39 @@ void directory::initPixmapStuff( void )
s_folderLockedPixmap = new QPixmap(
embed::getIconPixmap( "folder_locked" ) );
}
if( !QDir( fullName() ).isReadable() )
{
setPixmap( s_folderLockedPixmap );
}
else
{
setPixmap( s_folderPixmap );
}
}
void directory::setPixmap( const QPixmap * _px )
void directory::update( void )
{
m_pix = _px;
setup();
widthChanged( 0 );
invalidateHeight();
repaint();
}
void directory::setOpen( bool _o )
{
if( _o )
if( !isExpanded() )
{
setPixmap( s_folderOpenedPixmap );
}
else
{
setPixmap( s_folderPixmap );
setIcon( 0, *s_folderPixmap );
return;
}
if( _o && !childCount() )
setIcon( 0, *s_folderOpenedPixmap );
if( !childCount() )
{
for( QStringList::iterator it = m_directories.begin();
it != m_directories.end(); ++it )
{
int top_index = childCount();
if( addItems( fullName( *it ) ) &&
( *it ).contains(
configManager::inst()->dataDir() ) )
{
( new Q3ListViewItem( this,
listView::tr( "--- Factory files ---" ) ) )->setPixmap( 0,
embed::getIconPixmap( "factory_files" ) );
QTreeWidgetItem * sep = new QTreeWidgetItem;
sep->setText( 0, listView::tr(
"--- Factory files ---" ) );
sep->setIcon( 0, embed::getIconPixmap(
"factory_files" ) );
insertChild( top_index, sep );
}
}
}
Q3ListViewItem::setOpen( _o );
}
void directory::setup( void )
{
setExpandable( TRUE );
Q3ListViewItem::setup();
}
@@ -752,19 +700,56 @@ bool directory::addItems( const QString & _path )
QDir thisDir( _path );
if( !thisDir.isReadable() )
{
//readable = FALSE;
setExpandable( FALSE );
return( FALSE );
}
listView()->setUpdatesEnabled( FALSE );
treeWidget()->setUpdatesEnabled( FALSE );
bool added_something = FALSE;
QStringList files = thisDir.entryList( QDir::Files, QDir::Name );
for( int i = 0; i < files.size(); ++i )
QStringList files = thisDir.entryList( QDir::Dirs, QDir::Name );
for( QStringList::const_iterator it = files.constBegin();
it != files.constEnd(); ++it )
{
QString cur_file = files[files.size() - i - 1];
QString cur_file = *it;
if( cur_file[0] != '.' && fileBrowser::isDirWithContent(
thisDir.absolutePath() + QDir::separator() +
cur_file, m_filter ) )
{
bool orphan = TRUE;
for( int i = 0; i < childCount(); ++i )
{
directory * d = dynamic_cast<directory *>(
child( i ) );
if( d == NULL || cur_file < d->text( 0 ) )
{
insertChild( i, new directory( cur_file,
_path, m_filter ) );
orphan = FALSE;
break;
}
else if( cur_file == d->text( 0 ) )
{
d->addDirectory( _path );
orphan = FALSE;
break;
}
}
if( orphan )
{
addChild( new directory( cur_file, _path,
m_filter ) );
}
added_something = TRUE;
}
}
files = thisDir.entryList( QDir::Files, QDir::Name );
for( QStringList::const_iterator it = files.constBegin();
it != files.constEnd(); ++it )
{
QString cur_file = *it;
if( cur_file[0] != '.'
&& thisDir.match( m_filter, cur_file.toLower() )
/*QDir::match( FILE_FILTER, cur_file )*/ )
@@ -774,44 +759,7 @@ bool directory::addItems( const QString & _path )
}
}
files = thisDir.entryList( QDir::Dirs, QDir::Name );
for( int i = 0; i < files.size(); ++i )
{
QString cur_file = files[files.size() - i - 1];
if( cur_file[0] != '.' && fileBrowser::isDirWithContent(
thisDir.absolutePath() + QDir::separator() +
cur_file, m_filter ) )
{
new directory( this, cur_file, _path, m_filter );
added_something = TRUE;
#if 0
if( firstChild() == NULL )
{
continue;
}
bool moved = FALSE;
QListViewItem * item = firstChild();
while( item != NULL )
{
directory * cd =
dynamic_cast<directory *>( item );
if( cd != NULL )
{
/* if( moved == FALSE ||
cd->text( 0 ) < cur_file )
{*/
printf( "move item %s after %s\n", d->text(0).ascii(), cd->text(0).ascii());
d->moveItem( cd );
moved = TRUE;
//}
}
item = item->nextSibling();
}
#endif
}
}
listView()->setUpdatesEnabled( TRUE );
treeWidget()->setUpdatesEnabled( TRUE );
return( added_something );
}
@@ -827,29 +775,27 @@ QPixmap * fileItem::s_flpFilePixmap = NULL;
QPixmap * fileItem::s_unknownFilePixmap = NULL;
fileItem::fileItem( Q3ListView * _parent, const QString & _name,
fileItem::fileItem( QTreeWidget * _parent, const QString & _name,
const QString & _path ) :
Q3ListViewItem( _parent, _name ),
m_pix( NULL ),
QTreeWidgetItem( _parent ),
m_path( _path )
{
setText( 0, _name );
determineFileType();
initPixmapStuff();
setDragEnabled( TRUE );
}
fileItem::fileItem( Q3ListViewItem * _parent, const QString & _name,
fileItem::fileItem( QTreeWidgetItem * _parent, const QString & _name,
const QString & _path ) :
Q3ListViewItem( _parent, _name ),
m_pix( NULL ),
QTreeWidgetItem( _parent ),
m_path( _path )
{
setText( 0, _name );
determineFileType();
initPixmapStuff();
setDragEnabled( TRUE );
}
@@ -895,14 +841,24 @@ void fileItem::initPixmapStuff( void )
switch( m_type )
{
case PROJECT_FILE: m_pix = s_projectFilePixmap; break;
case PRESET_FILE: m_pix = s_presetFilePixmap; break;
case SAMPLE_FILE: m_pix = s_sampleFilePixmap; break;
case MIDI_FILE: m_pix = s_midiFilePixmap; break;
case FLP_FILE: m_pix = s_flpFilePixmap; break;
case PROJECT_FILE:
setIcon( 0, *s_projectFilePixmap );
break;
case PRESET_FILE:
setIcon( 0, *s_presetFilePixmap );
break;
case SAMPLE_FILE:
setIcon( 0, *s_sampleFilePixmap );
break;
case MIDI_FILE:
setIcon( 0, *s_midiFilePixmap );
break;
case FLP_FILE:
setIcon( 0, *s_flpFilePixmap );
break;
case UNKNOWN:
default:
m_pix = s_unknownFilePixmap;
setIcon( 0, *s_unknownFilePixmap );
break;
}
}

View File

@@ -126,7 +126,6 @@ bool importFilter::openFile( void )
}
#undef fileName
#endif

View File

@@ -978,7 +978,3 @@ bool FASTCALL ladspaManager::cleanup( const ladspa_key_t & _plugin,
}
return( FALSE );
}
#undef value

View File

@@ -99,7 +99,7 @@ int main( int argc, char * * argv )
"version 2 of the License, or (at your option) any later version.\n\n"
"Try \"%s --help\" for more information.\n\n", PACKAGE_VERSION,
argv[0] );
return( 0 );
return( EXIT_SUCCESS );
}
else if( argc > i && ( QString( argv[i] ) == "--help" ||
QString( argv[i] ) == "-h" ) )
@@ -114,7 +114,7 @@ int main( int argc, char * * argv )
"-v, --version show version information and exit.\n"
"-h, --help show this usage message and exit.\n\n",
PACKAGE_VERSION );
return( 0 );
return( EXIT_SUCCESS );
}
else if( argc > i && ( QString( argv[i] ) == "--render" ||
QString( argv[i] ) == "-r" ) )
@@ -132,7 +132,7 @@ int main( int argc, char * * argv )
{
printf( "\nInvalid output format %s.\n\n"
"Try \"%s --help\" for more information.\n\n", argv[i + 1], argv[0] );
return( -1 );
return( EXIT_FAILURE );
}
++i;
}
@@ -142,7 +142,7 @@ int main( int argc, char * * argv )
{
printf( "\nInvalid option %s.\n\n"
"Try \"%s --help\" for more information.\n\n", argv[i], argv[0] );
return( -1 );
return( EXIT_FAILURE );
}
file_to_load = argv[i];
}
@@ -156,12 +156,8 @@ int main( int argc, char * * argv )
QString pos = QLocale::system().name().left( 2 );
// load translation for Qt-widgets/-dialogs
#ifdef QT_TRANSLATIONS_DIR
loadTranslation( QString( "qt_" ) + pos,
QString( QT_TRANSLATIONS_DIR ) );
#else
loadTranslation( QString( "qt_" ) + pos );
#endif
// load actual translation for LMMS
loadTranslation( pos );
@@ -170,7 +166,7 @@ int main( int argc, char * * argv )
if( !configManager::inst()->loadConfigFile() )
{
return( -1 );
return( EXIT_FAILURE );
}
QPalette pal = app.palette();

View File

@@ -28,15 +28,16 @@
#include "main_window.h"
#include <Qt/QtXml>
#include <QtGui/QApplication>
#include <QtGui/QCloseEvent>
#include <QtGui/QDesktopServices>
#include <QtGui/QFileDialog>
#include <QtGui/QCloseEvent>
#include <QtGui/QSplitter>
#include <QtGui/QSplashScreen>
#include <QtGui/QMessageBox>
#include <QtGui/QMenuBar>
#include <Qt/QtXml>
#include <QtGui/QMessageBox>
#include <QtGui/QSplashScreen>
#include <QtGui/QSplitter>
#include <QtGui/QWorkspace>
#ifdef HAVE_CONFIG_H
@@ -112,21 +113,21 @@ mainWindow::mainWindow( void ) :
QString wdir = configManager::inst()->workingDir();
side_bar->appendTab( new pluginBrowser( splitter ), ++id );
side_bar->appendTab( new fileBrowser(
configManager::inst()->factoryProjectsDir() + "*" +
configManager::inst()->userProjectsDir(),
configManager::inst()->userProjectsDir() + "*" +
configManager::inst()->factoryProjectsDir(),
"*.mmp *.mmpz *.xml *.mid *.flp",
tr( "My projects" ),
embed::getIconPixmap( "project_file" ),
splitter ), ++id );
side_bar->appendTab( new fileBrowser(
configManager::inst()->factorySamplesDir() + "*" +
configManager::inst()->userSamplesDir(),
configManager::inst()->userSamplesDir() + "*" +
configManager::inst()->factorySamplesDir(),
sample_filter, tr( "My samples" ),
embed::getIconPixmap( "sound_file" ),
splitter ), ++id );
side_bar->appendTab( new fileBrowser(
configManager::inst()->factoryPresetsDir() + "*" +
configManager::inst()->userPresetsDir(),
configManager::inst()->userPresetsDir() + "*" +
configManager::inst()->factoryPresetsDir(),
"*.cs.xml", tr( "My presets" ),
embed::getIconPixmap( "preset_file" ),
splitter ), ++id );
@@ -143,13 +144,8 @@ mainWindow::mainWindow( void ) :
{
m_workspace = new QWorkspace( splitter );
m_workspace->setScrollBarsEnabled( TRUE );
#warning TODO
m_workspace->setAutoFillBackground( TRUE );
QPalette pal;
pal.setBrush( m_workspace->backgroundRole(),
embed::getIconPixmap( "background_artwork" ) );
m_workspace->setPalette( pal );
m_workspace->setBackground( embed::getIconPixmap(
"background_artwork" ) );
}
hbox->addWidget( side_bar );
@@ -158,13 +154,9 @@ mainWindow::mainWindow( void ) :
// create global-toolbar at the top of our window
m_toolBar = new QWidget( main_widget );
m_toolBar->setObjectName( "mainToolbar" );
m_toolBar->setFixedHeight( 64 );
m_toolBar->move( 0, 0 );
m_toolBar->setAutoFillBackground( TRUE );
QPalette pal;
pal.setBrush( m_toolBar->backgroundRole(),
embed::getIconPixmap( "main_toolbar_bg" ) );
m_toolBar->setPalette( pal );
// add layout for organizing quite complex toolbar-layouting
m_toolBarLayout = new QGridLayout( m_toolBar/*, 2, 1*/ );
@@ -221,8 +213,8 @@ void mainWindow::finalize( void )
m_toolBar );
m_templatesMenu = new QMenu( project_new );
connect( m_templatesMenu, SIGNAL( aboutToShow( void ) ),
this, SLOT( fillTemplatesMenu( void ) ) );
connect( m_templatesMenu, SIGNAL( aboutToShow() ),
this, SLOT( fillTemplatesMenu() ) );
connect( m_templatesMenu, SIGNAL( triggered( QAction * ) ),
this, SLOT( createNewProjectFromTemplate( QAction * ) ) );
project_new->setMenu( m_templatesMenu );
@@ -357,11 +349,6 @@ void mainWindow::finalize( void )
m_toolBarLayout->setColumnStretch( 100, 1 );
m_recentlyOpenedProjectsMenu = new QMenu( NULL );
connect( m_recentlyOpenedProjectsMenu, SIGNAL( activated( int ) ),
this, SLOT( openRecentlyOpenedProject( int ) ) );
updateRecentlyOpenedProjectsMenu();
// project-popup-menu
QMenu * project_menu = new QMenu( this );
menuBar()->addMenu( project_menu )->setText( tr( "&Project" ) );
@@ -374,10 +361,14 @@ void mainWindow::finalize( void )
tr( "&Open..." ),
this, SLOT( openProject() ),
Qt::CTRL + Qt::Key_O );
/*
project_menu->addAction( embed::getIconPixmap( "project_open" ),
tr( "Recently opened projects" ),
m_recentlyOpenedProjectsMenu );*/
m_recentlyOpenedProjectsMenu = project_menu->addMenu(
embed::getIconPixmap( "project_open" ),
tr( "Recently opened projects" ) );
connect( m_recentlyOpenedProjectsMenu, SIGNAL( aboutToShow() ),
this, SLOT( updateRecentlyOpenedProjectsMenu() ) );
connect( m_recentlyOpenedProjectsMenu, SIGNAL( triggered( QAction * ) ),
this, SLOT( openRecentlyOpenedProject( QAction * ) ) );
project_menu->addAction( embed::getIconPixmap( "project_save" ),
tr( "&Save" ),
@@ -649,13 +640,11 @@ void mainWindow::updateRecentlyOpenedProjectsMenu( void )
void mainWindow::openRecentlyOpenedProject( int _id )
void mainWindow::openRecentlyOpenedProject( QAction * _action )
{
#warning TODO
/* const QString & f = m_recentlyOpenedProjectsMenu->text( _id );
const QString & f = _action->text();
engine::getSongEditor()->loadProject( f );
configManager::inst()->addRecentlyOpenedProject( f );
updateRecentlyOpenedProjectsMenu();*/
}

View File

@@ -26,15 +26,19 @@
*/
#include "piano_roll.h"
#include <Qt/QtXml>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QClipboard>
#include <QtGui/QPainter>
#include <QtGui/QKeyEvent>
#include <QtGui/QWheelEvent>
#include <QtGui/QLayout>
#include <QtGui/QLabel>
#include <QtGui/QLayout>
#include <QtGui/QPainter>
#include <QtGui/QWheelEvent>
#include <QtGui/QWorkspace>
#ifndef __USE_XOPEN
@@ -44,7 +48,6 @@
#include <math.h>
#include "piano_roll.h"
#include "automatable_object_templates.h"
#include "clipboard.h"
#include "combobox.h"

View File

@@ -26,16 +26,17 @@
*/
#include "piano_widget.h"
#include <QtGui/QCursor>
#include <QtGui/QKeyEvent>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMouseEvent>
#include <QtGui/QPainter>
#include "piano_widget.h"
#include "automatable_object_templates.h"
#include "caption_menu.h"
#include "embed.h"
#include "gui_templates.h"
#include "instrument_track.h"
@@ -217,17 +218,7 @@ void pianoWidget::contextMenuEvent( QContextMenuEvent * _me )
return;
}
QMenu contextMenu( this );
#warning TODO: use CSS-formatting
contextMenu.setTitle( m_noteKnob->accessibleName() );
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( m_noteKnob->accessibleName() ) + "</b></font>",
this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( m_noteKnob->accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "automation" ),
tr( "&Open in automation editor" ),
m_noteKnob->getAutomationPattern(),

View File

@@ -639,7 +639,6 @@ setupDialog::setupDialog( configTabs _tab_to_open ) :
m_tabBar->addTab( midi, tr( "MIDI settings" ), 4, TRUE, TRUE
)->setIcon( embed::getIconPixmap( "setup_midi" ) );
#undef setIcon
m_tabBar->setActiveTab( _tab_to_open );

View File

@@ -1499,7 +1499,6 @@ void FASTCALL songEditor::loadProject( const QString & _file_name )
configManager::inst()->addRecentlyOpenedProject( _file_name );
engine::getMainWindow()->resetWindowTitle( "" );
engine::getMainWindow()->updateRecentlyOpenedProjectsMenu();
engine::getProjectJournal()->setJournalling( TRUE );
}
@@ -1525,6 +1524,7 @@ bool songEditor::saveProject( void )
mmp.content() );
m_playPos[PLAY_SONG].m_timeLine->saveState( mmp, mmp.content() );
m_fileName = mmp.nameWithExtension( m_fileName );
if( mmp.writeFile( m_fileName, m_oldFileName == "" ||
m_fileName != m_oldFileName ) == TRUE )
{
@@ -1537,7 +1537,6 @@ bool songEditor::saveProject( void )
2000 );
configManager::inst()->addRecentlyOpenedProject( m_fileName );
engine::getMainWindow()->resetWindowTitle( "" );
engine::getMainWindow()->updateRecentlyOpenedProjectsMenu();
}
else
{

View File

@@ -26,18 +26,16 @@
*/
#include "surround_area.h"
#include <QtGui/QApplication>
#include <QtGui/QCursor>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMouseEvent>
#include <QtGui/QPainter>
#include <math.h>
#include "surround_area.h"
#include "automatable_object_templates.h"
#include "caption_menu.h"
#include "embed.h"
#include "knob.h"
#include "templates.h"
@@ -164,8 +162,7 @@ void surroundArea::contextMenuEvent( QContextMenuEvent * )
// an QApplication::restoreOverrideCursor()-call...
mouseReleaseEvent( NULL );
QMenu contextMenu( this );
contextMenu.setTitle( accessibleName() );
captionMenu contextMenu( accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "automation" ),
tr( "Open &X in automation editor" ),
m_position_x->getAutomationPattern(),

View File

@@ -26,9 +26,12 @@
#include "tool.h"
#include "main_window.h"
#include <QtGui/QIcon>
#include <QtGui/QWorkspace>
#include "main_window.h"

View File

@@ -450,7 +450,6 @@ void trackContentObject::contextMenuEvent( QContextMenuEvent * _cme )
contextMenu.exec( QCursor::pos() );
}
#undef addSeparator

View File

@@ -26,13 +26,16 @@
*/
#include "track_container.h"
#include <Qt/QtXml>
#include <QtGui/QApplication>
#include <QtGui/QProgressDialog>
#include <QtGui/QWheelEvent>
#include <QtGui/QWorkspace>
#include "track_container.h"
#include "bb_track.h"
#include "config_mgr.h"
#include "debug.h"
@@ -591,7 +594,5 @@ void trackContainer::scrollArea::wheelEvent( QWheelEvent * _we )
#include "track_container.moc"
#undef setValue
#undef maximum
#endif

View File

@@ -188,57 +188,53 @@ multimediaProject::~multimediaProject()
QString multimediaProject::nameWithExtension( const QString & _fn ) const
{
switch( type() )
{
case SONG_PROJECT:
if( _fn.section( '.', -1 ) != "mmp" &&
_fn.section( '.', -1 ) != "mpt" &&
_fn.section( '.', -1 ) != "mmpz" )
{
if( configManager::inst()->value( "app",
"nommpz" ).toInt() == 0 )
{
return( _fn + ".mmpz" );
}
return( _fn + ".mmp" );
}
break;
case SONG_PROJECT_TEMPLATE:
if( _fn.section( '.',-1 ) != "mpt" )
{
return( _fn + ".mpt" );
}
break;
case INSTRUMENT_TRACK_SETTINGS:
if( _fn.section( '.', -2, -1 ) != "cs.xml" )
{
return( _fn + ".cs.xml" );
}
break;
default: ;
}
return( _fn );
}
bool multimediaProject::writeFile( QString & _fn, bool _overwrite_check )
{
bool clean_meta_nodes = FALSE;
QString fn = _fn;
bool compress = FALSE;
if( type() == INSTRUMENT_TRACK_SETTINGS )
{
if( fn.section( '.', -2, -1 ) != "cs.xml" )
{
fn += ".cs.xml";
}
clean_meta_nodes = TRUE;
}
else if( type() == SONG_PROJECT )
{
if( fn.section( '.', -1 ) != "mmp" &&
fn.section( '.', -1 ) != "mpt" &&
fn.section( '.', -1 ) != "mmpz" )
{
compress = configManager::inst()->value( "app",
"nommpz" ).toInt() == 0;
if( compress )
{
fn += ".mmpz";
}
else
{
fn += ".mmp";
}
}
else
{
compress = ( fn.section( '.', -1 ) == "mmpz" );
}
clean_meta_nodes = TRUE;
}
else if( type() == SONG_PROJECT_TEMPLATE )
{
if( fn.section( '.',-1 ) != "mpt" )
{
fn += ".mpt";
}
clean_meta_nodes = TRUE;
}
if( clean_meta_nodes == TRUE )
if( type() == SONG_PROJECT || type() == SONG_PROJECT_TEMPLATE
|| type() == INSTRUMENT_TRACK_SETTINGS )
{
cleanMetaNodes( documentElement() );
}
QString fn = nameWithExtension( _fn );
QFile outfile( fn );
if( _overwrite_check == TRUE &&
outfile.exists() == TRUE &&
@@ -271,7 +267,7 @@ bool multimediaProject::writeFile( QString & _fn, bool _overwrite_check )
return( FALSE );
}
QString xml = "<?xml version=\"1.0\"?>\n" + toString( 1 );
if( compress )
if( fn.section( '.', -1 ) == "mmpz" )
{
outfile.write( qCompress( xml.toAscii() ) );
}

View File

@@ -1268,11 +1268,6 @@ sampleBuffer::handleState::~handleState()
#undef write
#undef read
#undef pos
#include "sample_buffer.moc"

View File

@@ -60,11 +60,12 @@ midiALSASeq::midiALSASeq( void ) :
m_queueID = snd_seq_alloc_queue( m_seqHandle );
snd_seq_queue_tempo_t * tempo;
snd_seq_queue_tempo_alloca( &tempo );
snd_seq_queue_tempo_malloc( &tempo );
snd_seq_queue_tempo_set_tempo( tempo, 6000000 /
engine::getSongEditor()->getTempo() );
snd_seq_queue_tempo_set_ppq( tempo, 16 );
snd_seq_set_queue_tempo( m_seqHandle, m_queueID, tempo );
snd_seq_queue_tempo_free( tempo );
snd_seq_start_queue( m_seqHandle, m_queueID, NULL );
changeQueueTempo( engine::getSongEditor()->getTempo() );
@@ -341,8 +342,9 @@ void midiALSASeq::subscribeReadablePort( midiPort * _port,
snd_seq_port_info_malloc( &port_info );
snd_seq_get_port_info( m_seqHandle, m_portIDs[_port][0], port_info );
const snd_seq_addr_t * dest = snd_seq_port_info_get_addr( port_info );
snd_seq_port_info_free( port_info );
snd_seq_port_subscribe_t * subs;
snd_seq_port_subscribe_alloca( &subs );
snd_seq_port_subscribe_malloc( &subs );
snd_seq_port_subscribe_set_sender( subs, &sender );
snd_seq_port_subscribe_set_dest( subs, dest );
if( _unsubscribe )
@@ -353,7 +355,7 @@ void midiALSASeq::subscribeReadablePort( midiPort * _port,
{
snd_seq_subscribe_port( m_seqHandle, subs );
}
snd_seq_port_info_free( port_info );
snd_seq_port_subscribe_free( subs );
}
@@ -383,8 +385,9 @@ void midiALSASeq::subscribeWriteablePort( midiPort * _port,
m_portIDs[_port][1],
port_info );
const snd_seq_addr_t * sender = snd_seq_port_info_get_addr( port_info );
snd_seq_port_info_free( port_info );
snd_seq_port_subscribe_t * subs;
snd_seq_port_subscribe_alloca( &subs );
snd_seq_port_subscribe_malloc( &subs );
snd_seq_port_subscribe_set_sender( subs, sender );
snd_seq_port_subscribe_set_dest( subs, &dest );
if( _unsubscribe )
@@ -395,7 +398,7 @@ void midiALSASeq::subscribeWriteablePort( midiPort * _port,
{
snd_seq_subscribe_port( m_seqHandle, subs );
}
snd_seq_port_info_free( port_info );
snd_seq_port_subscribe_free( subs );
}
@@ -547,8 +550,8 @@ void midiALSASeq::updatePortList( void )
snd_seq_client_info_t * cinfo;
snd_seq_port_info_t * pinfo;
snd_seq_client_info_alloca( &cinfo );
snd_seq_port_info_alloca( &pinfo );
snd_seq_client_info_malloc( &cinfo );
snd_seq_port_info_malloc( &pinfo );
snd_seq_client_info_set_client( cinfo, -1 );
while( snd_seq_query_next_client( m_seqHandle, cinfo ) >= 0 )
@@ -597,8 +600,8 @@ void midiALSASeq::updatePortList( void )
}
}
/* snd_seq_client_info_free( cinfo );
snd_seq_port_info_free( pinfo );*/
snd_seq_client_info_free( cinfo );
snd_seq_port_info_free( pinfo );
if( m_readablePorts != readable_ports )
{

View File

@@ -3,7 +3,7 @@
/*
* midi_mapper.cpp - MIDI-mapper for any midiDevice
*
* Copyright (c) 2005 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -213,7 +213,5 @@ void midiMapper::readChannelMap( QFile & _f )
#undef indexOf
#endif

View File

@@ -26,6 +26,9 @@
*/
#include "instrument_track.h"
#include <Qt/QtXml>
#include <QtCore/QDir>
#include <QtCore/QFile>
@@ -37,9 +40,9 @@
#include <QtGui/QLineEdit>
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
#include <QtGui/QWorkspace>
#include "instrument_track.h"
#include "arp_and_chords_tab_widget.h"
#include "audio_port.h"
#include "automation_pattern.h"

View File

@@ -26,17 +26,18 @@
*/
#include "automatable_button.h"
#include <QtGui/QCursor>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMouseEvent>
#include "automatable_button.h"
#include "automatable_object_templates.h"
#include "caption_menu.h"
#include "embed.h"
automatableButton::automatableButton( QWidget * _parent, const QString & _name,
track * _track ) :
QWidget( _parent ),
@@ -93,17 +94,7 @@ void automatableButton::contextMenuEvent( QContextMenuEvent * _me )
pattern = getAutomationPattern();
}
QMenu contextMenu( target );
#warning TODO: set according CSS-formatting
contextMenu.setTitle( target->accessibleName() );
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( target->accessibleName() ) + "</b></font>",
this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( target->accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "automation" ),
tr( "&Open in automation editor" ),
pattern,

View File

@@ -25,14 +25,13 @@
*/
#include "automatable_slider.h"
#include <QtGui/QCursor>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMouseEvent>
#include "automatable_slider.h"
#include "automatable_object_templates.h"
#include "caption_menu.h"
#include "embed.h"
#include "knob.h"
@@ -96,22 +95,7 @@ void automatableSlider::setInitValue( int _value )
void automatableSlider::contextMenuEvent( QContextMenuEvent * _me )
{
// for the case, the user clicked right while pressing left mouse-
// button, the context-menu appears while mouse-cursor is still hidden
// and it isn't shown again until user does something which causes
// an QApplication::restoreOverrideCursor()-call...
mouseReleaseEvent( NULL );
QMenu contextMenu( this );
#warning TODO: use according CSS formatting
contextMenu.setTitle( accessibleName() );
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( accessibleName() ) + "</b></font>", this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "automation" ),
tr( "&Open in automation editor" ),
m_knob->getAutomationPattern(),

View File

@@ -0,0 +1,53 @@
#ifndef SINGLE_SOURCE_COMPILE
/*
* caption_menu.cpp - context menu with a caption
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
* 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 "caption_menu.h"
captionMenu::captionMenu( const QString & _title, QWidget * _parent ) :
QMenu( _title, _parent )
{
QAction * caption = addAction( _title );
caption->setEnabled( FALSE );
}
captionMenu::~captionMenu()
{
}
#include "caption_menu.moc"
#endif

View File

@@ -25,17 +25,17 @@
*/
#include "combobox.h"
#include <QtGui/QApplication>
#include <QtGui/QCursor>
#include <QtGui/QDesktopWidget>
#include <QtGui/QLabel>
#include <QtGui/QMouseEvent>
#include <QtGui/QPainter>
#include <QtGui/QPixmap>
#include "combobox.h"
#include "automatable_object_templates.h"
#include "templates.h"
#include "caption_menu.h"
#include "embed.h"
#include "gui_templates.h"
@@ -146,17 +146,7 @@ void comboBox::contextMenuEvent( QContextMenuEvent * _me )
return;
}
QMenu contextMenu( this );
contextMenu.setTitle( accessibleName() );
#warning TODO: add css-formatting
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( accessibleName() ) + "</b></font>",
this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "automation" ),
tr( "&Open in automation editor" ),
getAutomationPattern(),

View File

@@ -26,17 +26,20 @@
*/
#include <QtXml/QDomElement>
#include <QtGui/QMouseEvent>
#include "effect_label.h"
#include <QtGui/QMouseEvent>
#include <QtGui/QWorkspace>
#include <QtXml/QDomElement>
#include "effect_tab_widget.h"
#include "sample_track.h"
#include "embed.h"
#include "engine.h"
#include "gui_templates.h"
#include "rename_dialog.h"
#include "main_window.h"
#include "rename_dialog.h"
#include "sample_track.h"

View File

@@ -1,7 +1,30 @@
#ifndef SINGLE_SOURCE_COMPILE
#include "templates.h"
#include "tooltip.h"
/*
* kmultitabbar.cpp - widget for horizontal and vertical tabs
*
* Copyright (c) 2001-2003 Joseph Wenninger <jowenn@kde.org>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 "kmultitabbar.h"
@@ -16,6 +39,9 @@
#include <math.h>
#include "templates.h"
#include "tooltip.h"
#define NEARBYINT(i) ((int(float(i) + 0.5)))
class KMultiTabBarTabPrivate {
@@ -87,7 +113,7 @@ void KMultiTabBarInternal::setStyle(enum KMultiTabBar::KMultiTabBarStyle style)
diff=0; \
for (int i2=i;i2<tabCount;i2++) {\
int l1=m_tabs.at(i2)->neededSize();\
if ((ulen+l1)>space){\
if ((ulen+l1)>(int)space){\
if (ulen==0) diff=0;\
else diff=((float)(space-ulen))/(i2-i);\
break;\

View File

@@ -28,12 +28,12 @@
*/
#include "knob.h"
#include <QtGui/QApplication>
#include <QtGui/QBitmap>
#include <QtGui/QFontMetrics>
#include <QtGui/QInputDialog>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMouseEvent>
#include <QtGui/QPainter>
#include <QtGui/QPalette>
@@ -44,17 +44,17 @@
#endif
#include <math.h>
#include "knob.h"
#include "automatable_object_templates.h"
#include "embed.h"
#include "spc_bg_hndl_widget.h"
#include "caption_menu.h"
#include "config_mgr.h"
#include "text_float.h"
#include "mixer.h"
#include "embed.h"
#include "engine.h"
#include "gui_templates.h"
#include "templates.h"
#include "string_pair_drag.h"
#include "main_window.h"
#include "spc_bg_hndl_widget.h"
#include "string_pair_drag.h"
#include "templates.h"
#include "text_float.h"
@@ -321,16 +321,7 @@ void knob::contextMenuEvent( QContextMenuEvent * )
// an QApplication::restoreOverrideCursor()-call...
mouseReleaseEvent( NULL );
QMenu contextMenu( this );
contextMenu.setTitle( accessibleName() );
#warning TODO: css-formatting
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( accessibleName() ) + "</b></font>", this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "reload" ),
tr( "&Reset (%1%2)" ).arg( m_initValue ).arg(
m_hintTextAfterValue ),

View File

@@ -25,14 +25,14 @@
*/
#include "lcd_spinbox.h"
#include <QtGui/QApplication>
#include <QtGui/QCursor>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMouseEvent>
#include "lcd_spinbox.h"
#include "automatable_object_templates.h"
#include "caption_menu.h"
#include "embed.h"
#include "gui_templates.h"
#include "templates.h"
@@ -171,16 +171,7 @@ void lcdSpinBox::contextMenuEvent( QContextMenuEvent * _me )
// an QApplication::restoreOverrideCursor()-call...
mouseReleaseEvent( NULL );
QMenu contextMenu( this );
contextMenu.setTitle( accessibleName() );
#warning TODO: CSS-formatting
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( accessibleName() ) + "</b></font>", this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "automation" ),
tr( "&Open in automation editor" ),
getAutomationPattern(),

View File

@@ -25,6 +25,8 @@
*/
#include "project_notes.h"
#include <Qt/QtXml>
#include <QtGui/QAction>
#include <QtGui/QApplication>
@@ -35,8 +37,8 @@
#include <QtGui/QTextCursor>
#include <QtGui/QTextEdit>
#include <QtGui/QToolBar>
#include <QtGui/QWorkspace>
#include "project_notes.h"
#include "embed.h"
#include "engine.h"
#include "main_window.h"

View File

@@ -26,24 +26,23 @@
*/
#include <Qt/QtXml>
#include <QtCore/QMap>
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QWhatsThis>
#include <QtGui/QColor>
#include "rack_plugin.h"
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QtGui/QWorkspace>
#include "audio_port.h"
#include "knob.h"
#include "led_checkbox.h"
#include "tempo_sync_knob.h"
#include "tooltip.h"
#include "caption_menu.h"
#include "effect_control_dialog.h"
#include "embed.h"
#include "engine.h"
#include "gui_templates.h"
#include "knob.h"
#include "led_checkbox.h"
#include "main_window.h"
#include "tempo_sync_knob.h"
#include "tooltip.h"
rackPlugin::rackPlugin( QWidget * _parent,
@@ -239,31 +238,21 @@ void rackPlugin::setGate( float _value )
void rackPlugin::contextMenuEvent( QContextMenuEvent * )
{
QPointer<QMenu> contextMenu = new QMenu( this );
contextMenu->setTitle( m_effect->publicName() );
#warning TODO: CSS-formatting
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( m_effect->publicName() ) +
"</b></font>",
this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu->addAction( caption );
#endif
contextMenu->addAction( embed::getIconPixmap( "arp_up_on" ),
tr( "Move &up" ),
QPointer<captionMenu> contextMenu = new captionMenu(
m_effect->publicName() );
contextMenu->addAction( embed::getIconPixmap( "arp_up_on" ),
tr( "Move &up" ),
this, SLOT( moveUp() ) );
contextMenu->addAction( embed::getIconPixmap( "arp_down_on" ),
contextMenu->addAction( embed::getIconPixmap( "arp_down_on" ),
tr( "Move &down" ),
this, SLOT( moveDown() ) );
contextMenu->addSeparator();
contextMenu->addAction( embed::getIconPixmap( "cancel" ),
contextMenu->addAction( embed::getIconPixmap( "cancel" ),
tr( "&Remove this plugin" ),
this, SLOT( deletePlugin() ) );
contextMenu->addSeparator();
contextMenu->addAction( embed::getIconPixmap( "help" ),
tr( "&Help" ),
contextMenu->addAction( embed::getIconPixmap( "help" ),
tr( "&Help" ),
this, SLOT( displayHelp() ) );
contextMenu->exec( QCursor::pos() );
delete contextMenu;

View File

@@ -3,7 +3,7 @@
/*
* tab_bar.cpp - implementation of tab-bar
*
* Copyright (c) 2004-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -241,9 +241,6 @@ bool tabBar::allHidden( void )
#undef value
#undef removeWidget
#include "tab_bar.moc"
#include "tab_button.moc"

View File

@@ -26,12 +26,13 @@
*/
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMouseEvent>
#include "tempo_sync_knob.h"
#include <QtGui/QMouseEvent>
#include <QtGui/QWorkspace>
#include "automatable_object_templates.h"
#include "caption_menu.h"
#include "embed.h"
#include "main_window.h"
#include "meter_dialog.h"
@@ -73,16 +74,7 @@ tempoSyncKnob::~tempoSyncKnob()
void tempoSyncKnob::contextMenuEvent( QContextMenuEvent * )
{
QMenu contextMenu( this );
contextMenu.setTitle( accessibleName() );
#warning TODO: CSS-formatting
#if 0
QLabel * caption = new QLabel( "<font color=white><b>" +
QString( accessibleName() ) + "</b></font>", this );
caption->setPaletteBackgroundColor( QColor( 0, 0, 192 ) );
caption->setAlignment( Qt::AlignCenter );
contextMenu.addAction( caption );
#endif
captionMenu contextMenu( accessibleName() );
contextMenu.addAction( embed::getIconPixmap( "reload" ),
tr( "&Reset (%1%2)" ).arg( m_initValue ).arg(
m_hintTextAfterValue ),

View File

@@ -242,7 +242,5 @@ void textFloat::updateSize( void )
#undef setParent
#endif