diff --git a/ChangeLog b/ChangeLog index 7bd2dabbac..bbef10232c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,158 @@ +2007-11-03 Javier Serrano Polo + + * 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 * src/core/note_play_handle.cpp: diff --git a/Makefile.am b/Makefile.am index ab62ae92c1..a6c38e1a2a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ diff --git a/acinclude.m4 b/acinclude.m4 index dcfa12c194..7ed31f99fc 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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]) diff --git a/configure.in b/configure.in index c72217b408..892893e6c1 100644 --- a/configure.in +++ b/configure.in @@ -2,8 +2,8 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.50) -AC_INIT(lmms, 0.4.0-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 diff --git a/data/locale/ca.qm b/data/locale/ca.qm index b31fb3a6f7..d018b29e9a 100644 Binary files a/data/locale/ca.qm and b/data/locale/ca.qm differ diff --git a/data/locale/ca.ts b/data/locale/ca.ts index 2ec3feef2e..70dfb9fe08 100644 --- a/data/locale/ca.ts +++ b/data/locale/ca.ts @@ -860,7 +860,7 @@ http://lmms.sourceforge.net automatableButton - + &Open in automation editor &Obre a l'editor d'automatització @@ -868,7 +868,7 @@ http://lmms.sourceforge.net automatableSlider - + &Open in automation editor &Obre a l'editor d'automatització @@ -1209,7 +1209,7 @@ http://lmms.sourceforge.net comboBox - + &Open in automation editor &Obre a l'editor d'automatització @@ -1291,12 +1291,12 @@ Es mostrarà l'assistent per a reconfigurar LMMS. &Finalitza - + Could not save config-file No s'ha pogut desar el fitxer de configuració - + Could not save configuration file %1. You probably are not permitted to write to this file. Please make sure you have write-access to the file and try again. No s'ha pogut desar el fitxer de configuració %1. @@ -1307,19 +1307,6 @@ Per favor, comprova que tens permís d'escriptura per a aquest fitxer i tor Version mismatches La versió no coincideix - - - Accordingly to the information in your LMMS-configuration-file you seem -to have run a different (probably older) version of LMMS before. -It is recommended to run the setup-wizard again to ensure that -the latest samples, presets, demo-projects etc. are installed in your -LMMS-working-directory. Run the setup-wizard now? - Segons la informació del fitxer de configuració de LMMS, sembla que abans -has executat una versió diferent (probablement més antiga) de LMMS. -Es recomana executar l'assistent de configuració un altre cop per a assegurar -que les darreres mostres, plantilles, projectes demo, etc. s'instal·lin al teu -directori de treball de LMMS. Executar ara l'assistent? - &Cancel @@ -1335,6 +1322,15 @@ directori de treball de LMMS. Executar ara l'assistent? Choose LMMS working directory Escull el directori de treball de LMMS + + + Accordingly to the information in your LMMS-configuration-file you seem to have run a different (probably older) version of LMMS before. +It is recommended to run the setup-wizard again to ensure that the latest samples, presets, demo-projects etc. are installed in your LMMS-working-directory. +Run the setup-wizard now? + Segons la informació del fitxer de configuració de LMMS, sembla que abans has executat una versió diferent (probablement més antiga) de LMMS. +Es recomana executar l'assistent de configuració un altre cop per a assegurar que les darreres mostres, plantilles, projectes demo, etc. s'instal·lin al teu directori de treball de LMMS. +Executar ara l'assistent? + effectList @@ -1866,30 +1862,15 @@ Assegura't que tens permís d'escriptura per al fitxer/dispositiu sele fileBrowser - + Browser Navegador - + Reload (F5) Recarrega (F5) - - - Send to active instrument-track - Envia a la pista d'instrument activa - - - - Open in new instrument-track/Song-Editor - Obre en una nova pista d'instrument/Editor de Cançó - - - - Open in new instrument-track/B+B Editor - Obre en una nova pista d'instrument/Editor R+B - impulseEditor @@ -1944,7 +1925,7 @@ Assegura't que tens permís d'escriptura per al fitxer/dispositiu sele Pica aquí per a activar/desactivar la forma d'ona. - + &Help &Ajuda @@ -2198,37 +2179,37 @@ Assegura't que tens permís d'escriptura per al fitxer/dispositiu sele knob - + &Help &Ajuda - + &Reset (%1%2) &Restaura (%1%2) - + &Copy value (%1%2) &Copia valor (%1%2) - + &Paste value (%1%2) &Enganxa valor (%1%2) - + Connect to MIDI-device Connecta a dispositiu MIDI - + Please enter a new value between %1 and %2: Per favor, introdueix un nou valor entre %1 i %2: - + &Open in automation editor &Obre a l'editor d'automatització @@ -2518,7 +2499,7 @@ Assegura't que tens permís d'escriptura per al fitxer/dispositiu sele lcdSpinBox - + &Open in automation editor &Obre a l'editor d'automatització @@ -2526,25 +2507,40 @@ Assegura't que tens permís d'escriptura per al fitxer/dispositiu sele listView - + Files Fitxers - + Loading sample Carregant mostra - + Please wait, loading sample for preview... Per favor espera, carregant mostra per a previsualitzar... - + --- Factory files --- --- Fitxers de fàbrica --- + + + Send to active instrument-track + Envia a la pista d'instrument activa + + + + Open in new instrument-track/Song-Editor + Obre en una nova pista d'instrument/Editor de Cançó + + + + Open in new instrument-track/B+B Editor + Obre en una nova pista d'instrument/Editor R+B + liveTool @@ -2563,137 +2559,137 @@ Les tecles F1-F10 apaguen els 10 primers instruments a l'Editor de Ritme Ba mainWindow - + Setting up main-window and workspace... Preparant finestra principal i espai de treball... - + Creating new song... Creant nova cançó... - + Creating GUI... Creant interfície... - + &New &Nou - + &Open... &Obre... - + &Save &Desa - + Save &As... &Anomena i desa... - + &Quit &Surt - + Help Ajuda - + About Quant a - + &Help &Ajuda - + What's this? Què és això? - + My samples Les meves mostres - + My presets Les meves plantilles - + My projects Els meus projectes - + Loading song... Carregant cançó... - + &Settings &Configuració - + Show setup wizard Mostra l'assistent de configuració - + By pressing this button, you can show or hide the project notes window. In this window you can put down your project notes. Pitjant aquest botó, pots mostrar o amagar la finestra de notes del projecte. En aquesta finestra pots escriure les teves notes del projecte. - + LMMS %1 LMMS %1 - + Create new project Crea nou projecte - + Open existing project Obre projecte existent - + Save current project Desa projecte actual - + Export current project Exporta projecte actual - + By pressing this button, you can show or hide the Piano-Roll. With the help of the Piano-Roll you can edit melody-patterns in an easy way. Pitjant aquest botó pots mostrar o amagar el Rotlle de Piano. Amb l'ajuda del Rotlle de Piano pots editar patrons de melodia fàcilment. - + &Project &Projecte - + Open project Obre projecte @@ -2703,62 +2699,62 @@ Les tecles F1-F10 apaguen els 10 primers instruments a l'Editor de Ritme Ba Desa projecte - + My home El meu cau - + Root directory Directori arrel - + Show/hide Beat+Baseline Editor Mostra/amaga Editor de Ritme Base - + By pressing this button, you can show or hide the Beat+Baseline Editor. The Beat+Baseline Editor is needed for creating beats, opening, adding and removing channels, cutting, copying and pasting beat- and baseline-patterns and other things like that. Pitjant aquest botó pots mostrar o amagar l'Editor de Ritme Base. L'Editor de Ritme Base és necessari per a crear ritmes; obrir, afegir i eliminar canals; tallar, copiar i enganxar patrons de ritme; i altres funcions similars. - + Show/hide Piano-Roll Mostra/amaga Rotlle de Piano - + Show/hide Song-Editor Mostra/amaga Editor de Cançó - + By pressing this button, you can show or hide the Song-Editor. With the help of the Song-Editor you can edit song-playlist and specify when which track should be played. You can also insert and move samples (e.g. rap-samples) directly into the playlist. Pitjant aquest botó pots mostrar o amagar l'Editor de Cançó. Amb l'ajuda de l'Editor de Cançó pots editar la llista de reproducció de la cançó i especificar quan ha de tocar-se cada pista. També pots inserir i moure mostres (p.e. mostres de rap) directament a la llista de reproducció. - + Show/hide project notes Mostra/amaga les notes del projecte - + &Edit &Edita - + Undo Desfés - + Redo Refés - + Show settings dialog Mostra el diàleg de configuració @@ -2768,22 +2764,22 @@ Les tecles F1-F10 apaguen els 10 primers instruments a l'Editor de Ritme Ba Ajuda no disponible - + Show/hide Automation Editor Mostra/amaga Editor d'Automatització - + By pressing this button, you can show or hide the Automation Editor. With the help of the Automation Editor you can edit dynamic values in an easy way. Pitjant aquest botó pots mostrar o amagar l'Editor d'Automatització. Amb l'ajuda de l'Editor d'Automatització pots editar valors dinàmics fàcilment. - + &Tools E&ines - + MultiMedia Project (*.mmp *.mmpz *.xml) Projecte MultiMèdia (*.mmp *.mmpz *.xml) @@ -2793,17 +2789,17 @@ Les tecles F1-F10 apaguen els 10 primers instruments a l'Editor de Ritme Ba Projecte MultiMèdia (*.mmp *.mmpz);;Plantilla de Projecte MultiMèdia (*.mpt) - + Online help Ajuda en línia - + Import... Importa... - + E&xport... E&xporta... @@ -2814,6 +2810,11 @@ Please visit http://lmms.sf.net/wiki for documentation on LMMS. Actualment no hi ha ajuda disponible a LMMS. Per favor, visita http://lmms.sf.net/wiki per a documentació sobre LMMS. + + + Recently opened projects + Projectes oberts recentment + mallets @@ -3084,7 +3085,7 @@ Per favor, visita http://lmms.sf.net/wiki per a documentació sobre LMMS. midiClient - + DEVICE DISPOSITIU @@ -3199,7 +3200,7 @@ Per favor, visita http://lmms.sf.net/wiki per a documentació sobre LMMS. nineButtonSelector - + &Help &Ajuda @@ -3544,12 +3545,12 @@ usa la roda del ratolí per a ajustar el volum d'un pas pianoWidget - + Base note Nota base - + &Open in automation editor &Obre a l'editor d'automatització @@ -3670,7 +3671,7 @@ usa la roda del ratolí per a ajustar el volum d'un pas sintetitzador versàtil de guitza & bombo - + Singer bot to add some basic vocals Bot cantant per a afegir veus bàsiques @@ -3999,77 +4000,77 @@ usa la roda del ratolí per a ajustar el volum d'un pas rackPlugin - + Turn the effect off Apaga l'efecte - + On/Off Encès/Apagat - + Toggles the effect on or off. Encén o apaga l'efecte. - + Wet/Dry mix Mescla Moll/Sec - + W/D M/S - + Wet Level: Nivell de Moll: - + The Wet/Dry knob sets the ratio between the input signal and the effect that shows up in the output. La roda Moll/Sec indica la proporció entre el senyal d'entrada i l'efecte que es mostra a la sortida. - + Decay Decaïment - + Time: Temps: - + The Decay knob controls how many buffers of silence must pass before the plugin stops processing. Smaller values will reduce the CPU overhead but run the risk of clipping the tail on delay effects. La roda Decaïment controla quants períodes de silenci han de passar abans de que el connector aturi el processament. Valors més petits reduiran la càrrega de CPU, però augmenten el risc de tallar la cua als efectes de retard. - + Gate Porta - + Gate: Porta: - + The Gate knob controls the signal level that is considered to be 'silence' while deciding when to stop processing signals. La roda Porta controla el nivell de senyal que és considerat 'silenci' mentre decideix quan aturar de processar senyals. - + Controls Controls - + Effect plugins function as a chained series of effects where the signal will be processed from top to bottom. The On/Off switch allows you to bypass a given plugin at any point in time. @@ -4092,22 +4093,22 @@ El botó Controls obre un diàleg per a editar els paràmetres de l'efecte. Un clic dret mostrarà un menú contextual on podràs canviar l'ordre en el qual els efectes són processats o esborrar un efecte. - + Move &up Mou a&munt - + Move &down Mou a&vall - + &Remove this plugin &Treu aquest connector - + &Help &Ajuda @@ -4357,64 +4358,64 @@ Si funciona amb altre programari VST sota Linux, per favor contacta amb un desen INTERFÍCIE MIDI - + OK D'acord - + Cancel Cancel·la - + Restart LMMS Reinicia LMMS - + Please note that most changes won't take effect until you restart LMMS! Per favor, tingues en compte que la majoria de canvis no s'aplicaran fins que reiniciïs LMMS! - + Frames: %1 Latency: %2 ms Marcs: %1 Latència: %2 ms - + Here you can setup the internal buffer-size used by LMMS. Smaller values result in a lower latency but also may cause unusable sound or bad performance, especially on older computers or systems with a non-realtime kernel. Aquí pots configurar la mida de la memòria intermèdia interna usada per LMMS. Els valors més petits donen menor latència però també poden causar so inservible o baix rendiment, especialment a ordinadors antics o sistemes amb un nucli sense temps real. - + Choose LMMS working directory Escull el directori de treball de LMMS - + Choose your VST-plugin directory Escull el teu directori de connectors VST - + Choose artwork-theme directory Escull el directori de material gràfic - + Choose FL Studio installation directory Escull el directori d'instal·lació de FL Studio - + Here you can select your preferred audio-interface. Depending on the configuration of your system during compilation time you can choose between ALSA, JACK, OSS and more. Below you see a box which offers controls to setup the selected audio-interface. Aquí pots seleccionar la teva interfície d'àudio preferida. Depenent de la configuració del teu sistema durant el temps de compilació, pots escollir entre ALSA, JACK, OSS i altres. Abaix pots veure una caixa amb controls per a configurar la interfície d'àudio seleccionada. - + Here you can select your preferred MIDI-interface. Depending on the configuration of your system during compilation time you can choose between ALSA, OSS and more. Below you see a box which offers controls to setup the selected MIDI-interface. Aquí pots seleccionar la teva interfície MIDI preferida. Depenent de la configuració del teu sistema durant el temps de compilació, pots escollir entre ALSA, OSS i més. Abaix pots veure una caixa amb controls per a configurar la interfície MIDI seleccionada. @@ -4451,12 +4452,12 @@ Please note that in some cases parallelizing won't work with small buffer-s Fixa't que en alguns casos la paral·lelització no funcionarà amb memòries intermèdies de mida petita. Si experimentes problemes (p.e. molts xruns), prova d'augmentar la mida de la memòria intermèdia. - + Choose LADSPA plugin directory Escull un directori de connectors LADSPA - + Choose STK rawwave directory Escull el directori d'ones crues STK @@ -4517,12 +4518,12 @@ Fixa't que en alguns casos la paral·lelització no funcionarà amb memòri Pica aquí si vols aturar la reproducció de la cançó. El marcador de posició de cançó serà col·locat a l'inici de la cançó. - + untitled sense títol - + File already exists El fitxer ja existeix @@ -4542,7 +4543,7 @@ Fixa't que en alguns casos la paral·lelització no funcionarà amb memòri El projecte multimèdia %1 sembla contenir errors. LMMS farà el que pot per a recuperar el màxim possible de dades d'aquest fitxer. - + Could not write file No es pot escriure el fitxer @@ -4552,7 +4553,7 @@ Fixa't que en alguns casos la paral·lelització no funcionarà amb memòri Editor de Cançó - + The file "%1" already exists. Do you want to overwrite it? El fitxer "%1" ja existeix. Vols sobreescriure'l? @@ -4597,19 +4598,19 @@ Fixa't que en alguns casos la paral·lelització no funcionarà amb memòri Afegeix pista de mostra - + Project NOT saved. Projecte NO desat. - + The file %1 already exists. Do you want to overwrite it? El fitxer %1 ja existeix. Vols sobreescriure'l? - + Select file for project-export... Selecciona fitxer per a exportar projecte... @@ -4624,7 +4625,7 @@ Vols sobreescriure'l? El projecte actual ha estat modificat des del darrer desament. Vols desar-lo ara? - + Import file Importa fitxer @@ -4696,12 +4697,12 @@ Per favor, assegura't que tens permís de lectura per al fitxer i torna-ho El projecte %1 està desat. - + The project %1 was not saved! El projecte %1 no està desat! - + Could not write file %1. You probably are not permitted to write to this file. Please make sure you have write-access to the file and try again. No es pot escriure el fitxer %1. Probablement no tens permís per a escriure aquest fitxer. @@ -4716,27 +4717,27 @@ Per favor, assegura't que tens permís d'escriptura per a aquest fitxe surroundArea - + click to where this channel should be audible pica a on aquest canal ha de ser audible - + Surround area X Àrea envoltant X - + Surround area Y Àrea envoltant Y - + Open &X in automation editor Obre &X a l'editor d'automatització - + Open &Y in automation editor Obre &Y a l'editor d'automatització @@ -4752,122 +4753,122 @@ Per favor, assegura't que tens permís d'escriptura per a aquest fitxe tempoSyncKnob - + Tempo Sync Sinc Tempo - + &Reset (%1%2) &Restaura (%1%2) - + &Copy value (%1%2) &Copia valor (%1%2) - + &Paste value (%1%2) &Enganxa valor (%1%2) - + No Sync Sense Sinc - + Eight beats Vuit batecs - + Whole note Nota sencera - + Half note Mitja nota - + Quarter note Quart de nota - + 8th note 8è de nota - + 16th note 16è de nota - + 32nd note 32è de nota - + Connect to MIDI-device Connecta a dispositiu MIDI - + &Help &Ajuda - + Synced to Eight Beats Sincronitzat a Vuit Batecs - + Synced to Whole Note Sincronitzat a Nota Sencera - + Synced to Half Note Sincronitzat a Mitja Nota - + Synced to Quarter Note Sincronitzat a Quart de Nota - + Synced to 8th Note Sincronitzat a 8è de Nota - + Synced to 16th Note Sincronitzat a 16è de Nota - + Synced to 32nd Note Sincronitzat a 32è de Nota - + &Open in automation editor &Obre a l'editor d'automatització - + Custom... Personalitzat... - + Custom Personalitzat @@ -5023,27 +5024,27 @@ Per favor, assegura't que tens permís de lectura per al fitxer i el direct trackOperationsWidget - + Press <Ctrl> while clicking on move-grip to begin a new drag'n'drop-action. Pitja <Ctrl> quan piquis el control de moviment per a iniciar una nova acció d'arrossegar i amollar. - + Clone this track Clona aquesta pista - + Remove this track Elimina aquesta pista - + Actions for this track Accions per a aquesta pista - + With this switch you can either mute this track or mute all other tracks. By clicking left, this track is muted. This is useful, if you only want to listen to the other tracks without changing this track and loosing information. When you click right on this switch, all other tracks will be muted. This is useful, if you only want to listen to this track. @@ -5052,24 +5053,24 @@ Amb un clic esquerre, aquesta pista s'apaga. Això és útil si només vols Amb un clic dret a l'interruptor, totes les altres pistes s'apagaran. Això és útil si només vols escoltar aquesta pista. - + left click = mute this track right click = mute all other tracks (solo) clic esquerre = apaga aquesta pista clic dret = apaga totes les altres pistes (solo) - + Mute Apaga - + Enable automation Habilita automatització - + Disable automation Inhabilita automatització @@ -5380,7 +5381,7 @@ Si funciona amb altre programari VST sota Linux, per favor contacta amb un desen vibed - + The waveform editor provides control over the initial state or impulse that is used to start the string vibrating. The buttons to the right of the graph will initialize the waveform to the selected type. The '?' button will load a waveform from a file--only the first 128 samples will be loaded. The waveform can also be drawn in the graph. @@ -5397,147 +5398,147 @@ El botó 'S' suavitzarà la forma d'ona. El botó 'N' normalitzarà la forma d'ona. - + Volume Volum - + Volume: Volum: - + The 'V' knob sets the volume of the selected string. La roda 'V' ajusta el volum de la corda seleccionada. - + String stiffness Rigidesa de corda - + String stiffness: Rigidesa de corda: - + The 'S' knob sets the stiffness of the selected string. The stiffness of the string affects how long the string will ring out. The lower the setting, the longer the string will ring. La roda 'S' ajusta la rigidesa de la corda seleccionada. La rigidesa de la corda afecta el temps que la corda ressonarà. Quan més baix el valor, més temps sonarà la corda. - + Pick position Posició per a tocar - + Pick position: Posició per a tocar: - + The 'P' knob sets the position where the selected string will be 'picked'. The lower the setting the closer the pick is to the bridge. La roda 'P' ajusta la posició on serà tocada la corda seleccionada. Quan més baix el valor, es toca més a prop del pont. - + Pickup position Posició per a recollir - + Pickup position: Posició per a recollir: - + The 'PU' knob sets the position where the vibrations will be monitored for the selected string. The lower the setting, the closer the pickup is to the bridge. La roda 'PU' ajusta la posició on les vibracions seran monitoritzades per a la corda seleccionada. Quan més baix aquest valor, la recollida és més a prop del pont. - + Pan Panorama - + Pan: Panorama: - + The Pan knob determines the location of the selected string in the stereo field. La roda Pan determina la localització de la corda seleccionada al camp estèreo. - + Detune Desafinament - + Detune: Desafinament: - + The Detune knob modifies the pitch of the selected string. Settings less than zero will cause the string to sound flat. Settings greater than zero will cause the string to sound sharp. La roda Detune modifica el to de la corda seleccionada. Valors menors que zero faran que la corda soni amb bemoll. Valors majors que zero faran que la corda soni amb sostingut. - + Fuzziness Arrissada - + Fuzziness: Arrissada: - + The Slap knob adds a bit of fuzz to the selected string which is most apparent during the attack, though it can also be used to make the string sound more 'metallic'. La roda Slap afegeix una mica d'arrissada a la corda seleccionada que és més notable durant l'atac, encara que també pot usar-se per a que la corda soni més 'metàl·lica'. - + Length Longitud - + Length: Longitud: - + The Length knob sets the length of the selected string. Longer strings will both ring longer and sound brighter, however, they will also eat up more CPU cycles. La roda Length ajusta la longitud de la corda seleccionada. Les cordes més llargues sonaran a la vegada més temps i més brillants, emperò també es menjaran més cicles de CPU. - + Impulse or initial state Impuls o estat inicial - + The 'Imp' selector determines whether the waveform in the graph is to be treated as an impulse imparted to the string by the pick or the initial state of the string. El selector 'Imp' determina si la forma d'ona del gràfic s'ha de tractar com un impuls impartit a la corda quan es toca o l'estat inicial de la corda. - + The Octave selector is used to choose which harmonic of the note the string will ring at. For example, '-2' means the string will ring two octaves below the fundamental, 'F' means the string will ring at the fundamental, and '6' means the string will ring six octaves above the fundamental. - El selector Octave s'usa per a escollir a quin harmònic de la nota la corda sonarà. Per exemple, '-2' significa que la corda sonarà dues octaves per sota de la fonamental, 'F' significa que la corda sonarà a la fonamental, i '6' significa que la corda sonarà sis octaves per sobre de la fonamental. + El selector Octava s'usa per a escollir a quin harmònic de la nota la corda sonarà. Per exemple, '-2' significa que la corda sonarà dues octaves per sota de la fonamental, 'F' significa que la corda sonarà a la fonamental, i '6' significa que la corda sonarà sis octaves per sobre de la fonamental. - + The String selector is used to choose which string the controls are editting. A Vibed instrument can contain up to nine independently vibrating strings. The LED in the lower right corner of the waveform editor indicates whether the selected string is active. - El selector String s'usa per a escollir quina corda estan editant els controls. Un instrument Vibed pot tenir fins a nou cordes vibrants independents. El LED a la cantonada dreta baixa de l'editor de forma d'ona indica si la corda seleccionada està activa. + El selector Corda s'usa per a escollir quina corda estan editant els controls. Un instrument Vibed pot tenir fins a nou cordes vibrants independents. El LED a la cantonada dreta baixa de l'editor de forma d'ona indica si la corda seleccionada està activa. - + Vibed models up to nine independently vibrating strings. The 'String' selector allows you to choose which string is being edited. The 'Imp' selector chooses whether the graph represents an impulse or the initial state of the string. The 'Octave' selector chooses which harmonic the string should vibrate at. The graph allows you to control the initial state or impulse used to set the string in motion. @@ -5562,15 +5563,30 @@ La roda 'Length' controla la longitud de la corda. El LED a la cantonada dreta baixa de l'editor de forma d'ona determina si la corda està activa a l'instrument actual. - + &Help &Ajuda - + Impulse Impuls + + + Impulse Editor + Editor d'Impuls + + + + Octave + Octava + + + + String + Corda + visualizationWidget diff --git a/data/locale/qt_ar.qm b/data/locale/qt_ar.qm deleted file mode 100644 index 11e52310e3..0000000000 Binary files a/data/locale/qt_ar.qm and /dev/null differ diff --git a/data/locale/qt_cs.qm b/data/locale/qt_cs.qm deleted file mode 100644 index 4532f4b40c..0000000000 Binary files a/data/locale/qt_cs.qm and /dev/null differ diff --git a/data/locale/qt_de.qm b/data/locale/qt_de.qm deleted file mode 100644 index 93ca500b85..0000000000 Binary files a/data/locale/qt_de.qm and /dev/null differ diff --git a/data/locale/qt_es.qm b/data/locale/qt_es.qm deleted file mode 100644 index 53d64faa41..0000000000 Binary files a/data/locale/qt_es.qm and /dev/null differ diff --git a/data/locale/qt_fr.qm b/data/locale/qt_fr.qm deleted file mode 100644 index f1e5a9d787..0000000000 Binary files a/data/locale/qt_fr.qm and /dev/null differ diff --git a/data/locale/qt_he.qm b/data/locale/qt_he.qm deleted file mode 100644 index 0fd539e12d..0000000000 Binary files a/data/locale/qt_he.qm and /dev/null differ diff --git a/data/locale/qt_it.qm b/data/locale/qt_it.qm deleted file mode 100644 index da95fdae0b..0000000000 Binary files a/data/locale/qt_it.qm and /dev/null differ diff --git a/data/locale/qt_ja.qm b/data/locale/qt_ja.qm deleted file mode 100644 index 2e847b5dc7..0000000000 Binary files a/data/locale/qt_ja.qm and /dev/null differ diff --git a/data/locale/qt_nb.qm b/data/locale/qt_nb.qm deleted file mode 100644 index 8ce91fa6b9..0000000000 Binary files a/data/locale/qt_nb.qm and /dev/null differ diff --git a/data/locale/qt_pt-br.qm b/data/locale/qt_pt-br.qm deleted file mode 100644 index 6aefed5c85..0000000000 Binary files a/data/locale/qt_pt-br.qm and /dev/null differ diff --git a/data/locale/qt_ru.qm b/data/locale/qt_ru.qm deleted file mode 100644 index 43190bcf10..0000000000 Binary files a/data/locale/qt_ru.qm and /dev/null differ diff --git a/data/locale/qt_sk.qm b/data/locale/qt_sk.qm deleted file mode 100644 index c68e89be5c..0000000000 Binary files a/data/locale/qt_sk.qm and /dev/null differ diff --git a/data/locale/qt_zh-cn.qm b/data/locale/qt_zh-cn.qm deleted file mode 100644 index 6342df1890..0000000000 Binary files a/data/locale/qt_zh-cn.qm and /dev/null differ diff --git a/data/locale/qt_zh-tw.qm b/data/locale/qt_zh-tw.qm deleted file mode 100644 index 603e9ff3c8..0000000000 Binary files a/data/locale/qt_zh-tw.qm and /dev/null differ diff --git a/data/themes/Makefile.am b/data/themes/Makefile.am index 273661acff..b00175d881 100644 --- a/data/themes/Makefile.am +++ b/data/themes/Makefile.am @@ -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 diff --git a/include/caption_menu.h b/include/caption_menu.h new file mode 100644 index 0000000000..83fb0f7f96 --- /dev/null +++ b/include/caption_menu.h @@ -0,0 +1,45 @@ +/* + * caption_menu.h - context menu with a caption + * + * Copyright (c) 2007 Javier Serrano Polo + * + * 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 + + +class captionMenu : public QMenu +{ + Q_OBJECT +public: + captionMenu( const QString & _title, QWidget * _parent = 0 ); + virtual ~captionMenu(); + +} ; + + + + +#endif diff --git a/include/config_mgr.h b/include/config_mgr.h index 619c1bd410..dc73d553ee 100644 --- a/include/config_mgr.h +++ b/include/config_mgr.h @@ -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 & diff --git a/include/file_browser.h b/include/file_browser.h index 55913e9cbe..4ed9abeed8 100644 --- a/include/file_browser.h +++ b/include/file_browser.h @@ -28,14 +28,13 @@ #include #include -class QColorGroup; -#include +#include #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; } ; diff --git a/include/main_window.h b/include/main_window.h index f2aa9b4e80..b3fb89da6f 100644 --- a/include/main_window.h +++ b/include/main_window.h @@ -28,13 +28,13 @@ #include #include -#include #include 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 ); } ; diff --git a/include/mmp.h b/include/mmp.h index 9df0db683c..97d1eb1de4 100644 --- a/include/mmp.h +++ b/include/mmp.h @@ -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 ) diff --git a/include/rack_plugin.h b/include/rack_plugin.h index 6606e44522..bc21e94a43 100644 --- a/include/rack_plugin.h +++ b/include/rack_plugin.h @@ -26,13 +26,14 @@ #define _RACK_PLUGIN_H #include -#include -#include -#include #include "journalling_object.h" +class QGroupBox; +class QLabel; +class QPushButton; + class audioPort; class effect; class effectControlDialog; diff --git a/plugins/bass_booster/bass_booster.h b/plugins/bass_booster/bass_booster.h index 7f506fbc81..f5205e3c8c 100644 --- a/plugins/bass_booster/bass_booster.h +++ b/plugins/bass_booster/bass_booster.h @@ -27,6 +27,8 @@ #define _BASS_BOOSTER_H +#include + #include "effect.h" #include "effect_lib.h" #include "engine.h" diff --git a/plugins/flp_import/unrtf/attr.c b/plugins/flp_import/unrtf/attr.c index 663197959e..850f960e98 100644 --- a/plugins/flp_import/unrtf/attr.c +++ b/plugins/flp_import/unrtf/attr.c @@ -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) { diff --git a/plugins/flp_import/unrtf/attr.h b/plugins/flp_import/unrtf/attr.h index 6273a10b50..04a1bba3c8 100644 --- a/plugins/flp_import/unrtf/attr.h +++ b/plugins/flp_import/unrtf/attr.h @@ -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(); diff --git a/plugins/flp_import/unrtf/convert.c b/plugins/flp_import/unrtf/convert.c index 433514b3c8..690311fe75 100644 --- a/plugins/flp_import/unrtf/convert.c +++ b/plugins/flp_import/unrtf/convert.c @@ -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) { diff --git a/plugins/flp_import/unrtf/error.c b/plugins/flp_import/unrtf/error.c index 2cea4fdf8a..cd4e650ea6 100644 --- a/plugins/flp_import/unrtf/error.c +++ b/plugins/flp_import/unrtf/error.c @@ -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); } diff --git a/plugins/flp_import/unrtf/error.h b/plugins/flp_import/unrtf/error.h index 9a4bf80e02..6ade02a4c5 100644 --- a/plugins/flp_import/unrtf/error.h +++ b/plugins/flp_import/unrtf/error.h @@ -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*); diff --git a/plugins/flp_import/unrtf/html.c b/plugins/flp_import/unrtf/html.c index 3b982a98b2..f97e683df8 100644 --- a/plugins/flp_import/unrtf/html.c +++ b/plugins/flp_import/unrtf/html.c @@ -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 */ " ", "!", """, "#", "$", "%", "&", "'", /* 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 */ "ø","ù","ú","û","ü","ý","þ","ÿ" }; -static char* mac [] = { +static const char* mac [] = { /* 0xa4 */ "•", NULL,NULL,NULL, /* 0xa8 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, /* 0xb0 */ NULL,NULL,NULL,NULL,NULL,"μ",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 */ "Α", /* 914 */ "Β", /* 915 */ "Γ", @@ -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 */ "Γ", /* 57517 */ "Δ", /* 57518 */ "Θ", @@ -253,7 +254,7 @@ static char * unisymbol2[] = { /* 57557 */ "δ", }; -static char * unisymbol3[] = { +static const char * unisymbol3[] = { /* 61505 */ "Α", /* 61506 */ "Β", /* 61507 */ "Χ", @@ -316,7 +317,7 @@ static char * unisymbol3[] = { #endif #if 1 /* 0.19.5 more unicode characters */ -static char * unisymbol4[] = { +static const char * unisymbol4[] = { /* 61600 */ "€", /* 61601 */ "ϒ", /* 61602 */ "′", @@ -414,7 +415,7 @@ static char * unisymbol4[] = { }; #endif #if 1 /* daved - SYMBOL font characters */ -static char* symbol[] = { +static const char* symbol[] = { /* 60 */ "<", /* 61 */ "=", /* 62 */ ">", @@ -612,7 +613,7 @@ static char* symbol[] = { /* 254 */ 0, }; #endif -static char* cp437 [] = { +static const char* cp437 [] = { /* 0x80 */ "ç", /* 0x81 */ "ü", /* 0x82 */ "é", @@ -743,7 +744,7 @@ static char* cp437 [] = { /* 0xff */ " ", }; -static char* cp850 [] = { +static const char* cp850 [] = { /* 0x80 */ "ç", /* 0x81 */ "ü", /* 0x82 */ "é", diff --git a/plugins/flp_import/unrtf/malloc.c b/plugins/flp_import/unrtf/malloc.c index ced9c693ec..0cdff5b1ba 100644 --- a/plugins/flp_import/unrtf/malloc.c +++ b/plugins/flp_import/unrtf/malloc.c @@ -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; diff --git a/plugins/flp_import/unrtf/malloc.h b/plugins/flp_import/unrtf/malloc.h index 991bd17a0f..524f217aea 100644 --- a/plugins/flp_import/unrtf/malloc.h +++ b/plugins/flp_import/unrtf/malloc.h @@ -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*); diff --git a/plugins/flp_import/unrtf/output.c b/plugins/flp_import/unrtf/output.c index 97057e1f65..b2efb6fdad 100644 --- a/plugins/flp_import/unrtf/output.c +++ b/plugins/flp_import/unrtf/output.c @@ -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); diff --git a/plugins/flp_import/unrtf/output.h b/plugins/flp_import/unrtf/output.h index ae1a5a0b51..dcb30ea49a 100644 --- a/plugins/flp_import/unrtf/output.h +++ b/plugins/flp_import/unrtf/output.h @@ -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 diff --git a/plugins/ladspa_effect/ladspa_effect.h b/plugins/ladspa_effect/ladspa_effect.h index 4ddd5030e1..020995a59d 100644 --- a/plugins/ladspa_effect/ladspa_effect.h +++ b/plugins/ladspa_effect/ladspa_effect.h @@ -25,14 +25,16 @@ #ifndef _LADSPA_EFFECT_H #define _LADSPA_EFFECT_H +#include + #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 multi_proc_t; diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index 42f1c4d1d5..787e624bce 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -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; } diff --git a/plugins/midi_import/midi_import.cpp b/plugins/midi_import/midi_import.cpp index c100580405..a982bc837d 100644 --- a/plugins/midi_import/midi_import.cpp +++ b/plugins/midi_import/midi_import.cpp @@ -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; diff --git a/plugins/singerbot/Makefile.am b/plugins/singerbot/Makefile.am index 85c01546c0..2fe42b81f1 100644 --- a/plugins/singerbot/Makefile.am +++ b/plugins/singerbot/Makefile.am @@ -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 diff --git a/plugins/singerbot/file.h b/plugins/singerbot/file.h new file mode 100644 index 0000000000..17b0e53124 --- /dev/null +++ b/plugins/singerbot/file.h @@ -0,0 +1,72 @@ +/* + * file.h - file descriptor wrapper + * + * Copyright (c) 2007 Javier Serrano Polo + * + * 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 +#include + + +class File +{ +public: + File( int _fd ) : + m_fd( _fd ) + { + } + virtual ~File() + { + close( m_fd ); + } + + template + ssize_t read( T * _i, int _n = 1 ) + { + return( ::read( m_fd, _i, _n * sizeof( T ) ) ); + } + + template + 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 diff --git a/plugins/singerbot/singerbot.cpp b/plugins/singerbot/singerbot.cpp index b522edf6cd..e1ab469e73 100644 --- a/plugins/singerbot/singerbot.cpp +++ b/plugins/singerbot/singerbot.cpp @@ -23,13 +23,20 @@ */ +#include "singerbot.h" + +#include +#include +#include +#include + #include #include #include #include -#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 - @@ -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() ); } diff --git a/plugins/singerbot/singerbot.h b/plugins/singerbot/singerbot.h index 513d2b4c91..8f40cf05e6 100644 --- a/plugins/singerbot/singerbot.h +++ b/plugins/singerbot/singerbot.h @@ -26,8 +26,6 @@ #ifndef _SINGERBOT_H #define _SINGERBOT_H -#include - #ifdef HAVE_CONFIG_H #include #endif @@ -38,11 +36,13 @@ #include "src/3rdparty/samplerate/samplerate.h" #endif +#include + #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 ); + } ; diff --git a/plugins/singerbot/singerbot_proxy.cpp b/plugins/singerbot/singerbot_proxy.cpp new file mode 100644 index 0000000000..791f10243f --- /dev/null +++ b/plugins/singerbot/singerbot_proxy.cpp @@ -0,0 +1,225 @@ +/* + * singerbot_proxy.cpp - separate process to deal with Festival + * + * Copyright (c) 2007 Javier Serrano Polo + * + * 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 +#include +#include +#include + +#include "file.h" + +#undef HAVE_CONFIG_H +#include + + +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" ) ) ) ); +} diff --git a/plugins/vibed/impulse_editor.cpp b/plugins/vibed/impulse_editor.cpp index 804393c131..1d0b7c989d 100644 --- a/plugins/vibed/impulse_editor.cpp +++ b/plugins/vibed/impulse_editor.cpp @@ -23,14 +23,14 @@ */ -#include +#include "impulse_editor.h" + #include #include -#include -#include +#include #include -#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( "" + - QString( "Impulse Editor" ) + "", 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() ); diff --git a/plugins/vibed/nine_button_selector.cpp b/plugins/vibed/nine_button_selector.cpp index a97a8eef32..b7c5f9a522 100644 --- a/plugins/vibed/nine_button_selector.cpp +++ b/plugins/vibed/nine_button_selector.cpp @@ -23,11 +23,11 @@ */ -#include -#include +#include "nine_button_selector.h" + #include -#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( "" + - QString( "Selector" ) + "", 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() ); diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index fa305b65f1..3f1d5526c9 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -23,14 +23,14 @@ */ +#include "vibed.h" + #include #include -#include -#include #include -#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( "" + - QString( "Vibed" ) + "", 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() ); diff --git a/plugins/vst_base/lvsl_client.cpp b/plugins/vst_base/lvsl_client.cpp index ba8d7dea2e..26f2c1b7e8 100644 --- a/plugins/vst_base/lvsl_client.cpp +++ b/plugins/vst_base/lvsl_client.cpp @@ -23,9 +23,12 @@ */ +#include "lvsl_client.h" + #include #include #include +#include #include #include @@ -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" diff --git a/plugins/vst_effect/vst_effect.h b/plugins/vst_effect/vst_effect.h index ec35feb0ce..f3a528e84f 100644 --- a/plugins/vst_effect/vst_effect.h +++ b/plugins/vst_effect/vst_effect.h @@ -27,6 +27,7 @@ #define _VST_EFFECT_H #include +#include #include "effect.h" #include "engine.h" diff --git a/src/audio/audio_alsa.cpp b/src/audio/audio_alsa.cpp index 009d6cac7d..0189e4199e 100644 --- a/src/audio/audio_alsa.cpp +++ b/src/audio/audio_alsa.cpp @@ -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 ); - }*/ + } } diff --git a/src/audio/audio_file_ogg.cpp b/src/audio/audio_file_ogg.cpp index a3637211ca..95e3ce4367 100644 --- a/src/audio/audio_file_ogg.cpp +++ b/src/audio/audio_file_ogg.cpp @@ -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; diff --git a/src/core/automation_editor.cpp b/src/core/automation_editor.cpp index f2f3987b6e..14fe81cedc 100644 --- a/src/core/automation_editor.cpp +++ b/src/core/automation_editor.cpp @@ -26,15 +26,19 @@ */ +#include "automation_editor.h" + + #include #include #include -#include #include -#include -#include #include +#include +#include #include +#include +#include #ifndef __USE_XOPEN @@ -44,7 +48,6 @@ #include -#include "automation_editor.h" #include "song_editor.h" #include "main_window.h" #include "embed.h" diff --git a/src/core/automation_pattern.cpp b/src/core/automation_pattern.cpp index 950e9e8ca9..ffc3555491 100644 --- a/src/core/automation_pattern.cpp +++ b/src/core/automation_pattern.cpp @@ -283,7 +283,7 @@ void automationPattern::processMidiTime( const midiTime & _time ) } -#undef value + #include "automation_pattern.moc" diff --git a/src/core/config_mgr.cpp b/src/core/config_mgr.cpp index 13aad1c16a..9029c641ab 100644 --- a/src/core/config_mgr.cpp +++ b/src/core/config_mgr.cpp @@ -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 diff --git a/src/core/file_browser.cpp b/src/core/file_browser.cpp index 9b49a5ff99..4d1ed4e473 100644 --- a/src/core/file_browser.cpp +++ b/src/core/file_browser.cpp @@ -26,15 +26,15 @@ */ -#include +#include "file_browser.h" + + #include #include -#include -class QColorGroup; -#include +#include +#include -#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( 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( 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( + 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 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( item ) != NULL ) - { - dynamic_cast( 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( 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 w( pl ); - w.toBack(); - // now we travel through the window-list until we find an - // instrument-track - while( w.hasPrevious() ) - { - instrumentTrack * ct = dynamic_cast( - 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( - 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( 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( itemAt( - contentsToViewport( _me->pos() ) ) ); + fileItem * f = dynamic_cast( _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 w( pl ); + w.toBack(); + // now we travel through the window-list until we find an + // instrument-track + while( w.hasPrevious() ) + { + instrumentTrack * ct = dynamic_cast( + 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( + 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( 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( _item ); + if( dir != NULL ) + { + dir->update(); + } +} + + + + +void listView::contextMenuEvent( QContextMenuEvent * _e ) +{ + fileItem * f = dynamic_cast( 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( 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( itemAt( - contentsToViewport( m_pressPos ) ) ); + mouseReleaseEvent( NULL ); + fileItem * f = dynamic_cast( 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( + 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( 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; } } diff --git a/src/core/import_filter.cpp b/src/core/import_filter.cpp index d0eb3b64e4..c97c9b853b 100644 --- a/src/core/import_filter.cpp +++ b/src/core/import_filter.cpp @@ -126,7 +126,6 @@ bool importFilter::openFile( void ) } -#undef fileName #endif diff --git a/src/core/ladspa_manager.cpp b/src/core/ladspa_manager.cpp index 2e3b3eb5e0..6b288cd5cf 100644 --- a/src/core/ladspa_manager.cpp +++ b/src/core/ladspa_manager.cpp @@ -978,7 +978,3 @@ bool FASTCALL ladspaManager::cleanup( const ladspa_key_t & _plugin, } return( FALSE ); } - - -#undef value - diff --git a/src/core/main.cpp b/src/core/main.cpp index 4fa5e3ec22..91ed3a3af4 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -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(); diff --git a/src/core/main_window.cpp b/src/core/main_window.cpp index f301830b62..1e0f7110fb 100644 --- a/src/core/main_window.cpp +++ b/src/core/main_window.cpp @@ -28,15 +28,16 @@ #include "main_window.h" +#include #include +#include #include #include -#include -#include -#include -#include #include -#include +#include +#include +#include +#include #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();*/ } diff --git a/src/core/piano_roll.cpp b/src/core/piano_roll.cpp index eee59a5bbd..82dd53d9a4 100644 --- a/src/core/piano_roll.cpp +++ b/src/core/piano_roll.cpp @@ -26,15 +26,19 @@ */ +#include "piano_roll.h" + + #include #include #include #include -#include #include -#include -#include #include +#include +#include +#include +#include #ifndef __USE_XOPEN @@ -44,7 +48,6 @@ #include -#include "piano_roll.h" #include "automatable_object_templates.h" #include "clipboard.h" #include "combobox.h" diff --git a/src/core/piano_widget.cpp b/src/core/piano_widget.cpp index 479c98356f..683e8dd133 100644 --- a/src/core/piano_widget.cpp +++ b/src/core/piano_widget.cpp @@ -26,16 +26,17 @@ */ +#include "piano_widget.h" + + #include #include -#include -#include #include #include -#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( "" + - QString( m_noteKnob->accessibleName() ) + "", - 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(), diff --git a/src/core/setup_dialog.cpp b/src/core/setup_dialog.cpp index fe47d335e7..b3445c5824 100644 --- a/src/core/setup_dialog.cpp +++ b/src/core/setup_dialog.cpp @@ -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 ); diff --git a/src/core/song_editor.cpp b/src/core/song_editor.cpp index d7f74e6e39..e7839a0710 100644 --- a/src/core/song_editor.cpp +++ b/src/core/song_editor.cpp @@ -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 { diff --git a/src/core/surround_area.cpp b/src/core/surround_area.cpp index 44ca28dfbd..2314821e3d 100644 --- a/src/core/surround_area.cpp +++ b/src/core/surround_area.cpp @@ -26,18 +26,16 @@ */ +#include "surround_area.h" + + #include -#include -#include -#include #include #include -#include - -#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(), diff --git a/src/core/tool.cpp b/src/core/tool.cpp index 9b232ee955..c046a8df15 100644 --- a/src/core/tool.cpp +++ b/src/core/tool.cpp @@ -26,9 +26,12 @@ #include "tool.h" -#include "main_window.h" #include +#include + +#include "main_window.h" + diff --git a/src/core/track.cpp b/src/core/track.cpp index 8646f79e9e..4fda1f5ca4 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -450,7 +450,6 @@ void trackContentObject::contextMenuEvent( QContextMenuEvent * _cme ) contextMenu.exec( QCursor::pos() ); } -#undef addSeparator diff --git a/src/core/track_container.cpp b/src/core/track_container.cpp index a157494722..60d6612186 100644 --- a/src/core/track_container.cpp +++ b/src/core/track_container.cpp @@ -26,13 +26,16 @@ */ +#include "track_container.h" + + #include #include #include #include +#include -#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 diff --git a/src/lib/mmp.cpp b/src/lib/mmp.cpp index 5fae0428c0..0b764b7d56 100644 --- a/src/lib/mmp.cpp +++ b/src/lib/mmp.cpp @@ -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 = "\n" + toString( 1 ); - if( compress ) + if( fn.section( '.', -1 ) == "mmpz" ) { outfile.write( qCompress( xml.toAscii() ) ); } diff --git a/src/lib/sample_buffer.cpp b/src/lib/sample_buffer.cpp index 47bfcdfe47..999c34d0a8 100644 --- a/src/lib/sample_buffer.cpp +++ b/src/lib/sample_buffer.cpp @@ -1268,11 +1268,6 @@ sampleBuffer::handleState::~handleState() -#undef write -#undef read -#undef pos - - #include "sample_buffer.moc" diff --git a/src/midi/midi_alsa_seq.cpp b/src/midi/midi_alsa_seq.cpp index bd146ae8a4..5dfabd59e8 100644 --- a/src/midi/midi_alsa_seq.cpp +++ b/src/midi/midi_alsa_seq.cpp @@ -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 ) { diff --git a/src/midi/midi_mapper.cpp b/src/midi/midi_mapper.cpp index dd809f2d85..849dea5584 100644 --- a/src/midi/midi_mapper.cpp +++ b/src/midi/midi_mapper.cpp @@ -3,7 +3,7 @@ /* * midi_mapper.cpp - MIDI-mapper for any midiDevice * - * Copyright (c) 2005 Tobias Doerffel + * Copyright (c) 2005-2007 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -213,7 +213,5 @@ void midiMapper::readChannelMap( QFile & _f ) -#undef indexOf - #endif diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index 748af16a4b..958ebe2bd9 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -26,6 +26,9 @@ */ +#include "instrument_track.h" + + #include #include #include @@ -37,9 +40,9 @@ #include #include #include +#include -#include "instrument_track.h" #include "arp_and_chords_tab_widget.h" #include "audio_port.h" #include "automation_pattern.h" diff --git a/src/widgets/automatable_button.cpp b/src/widgets/automatable_button.cpp index 40421194c0..6d49b1ef95 100644 --- a/src/widgets/automatable_button.cpp +++ b/src/widgets/automatable_button.cpp @@ -26,17 +26,18 @@ */ +#include "automatable_button.h" + #include -#include -#include #include -#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( "" + - QString( target->accessibleName() ) + "", - 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, diff --git a/src/widgets/automatable_slider.cpp b/src/widgets/automatable_slider.cpp index 4d05889d20..4aa8046796 100644 --- a/src/widgets/automatable_slider.cpp +++ b/src/widgets/automatable_slider.cpp @@ -25,14 +25,13 @@ */ +#include "automatable_slider.h" #include -#include -#include #include -#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( "" + - QString( accessibleName() ) + "", 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(), diff --git a/src/widgets/caption_menu.cpp b/src/widgets/caption_menu.cpp new file mode 100644 index 0000000000..41a9b0e4d2 --- /dev/null +++ b/src/widgets/caption_menu.cpp @@ -0,0 +1,53 @@ +#ifndef SINGLE_SOURCE_COMPILE + +/* + * caption_menu.cpp - context menu with a caption + * + * Copyright (c) 2007 Javier Serrano Polo + * + * 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 diff --git a/src/widgets/combobox.cpp b/src/widgets/combobox.cpp index f1f7e5cae9..0e30135e35 100644 --- a/src/widgets/combobox.cpp +++ b/src/widgets/combobox.cpp @@ -25,17 +25,17 @@ */ +#include "combobox.h" + #include #include #include -#include #include #include #include -#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( "" + - QString( accessibleName() ) + "", - 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(), diff --git a/src/widgets/effect_label.cpp b/src/widgets/effect_label.cpp index bd224d1e2a..41d4f696a0 100644 --- a/src/widgets/effect_label.cpp +++ b/src/widgets/effect_label.cpp @@ -26,17 +26,20 @@ */ -#include -#include - #include "effect_label.h" + +#include +#include +#include + #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" + diff --git a/src/widgets/kmultitabbar.cpp b/src/widgets/kmultitabbar.cpp index 39bfba030b..1a404cbb8e 100644 --- a/src/widgets/kmultitabbar.cpp +++ b/src/widgets/kmultitabbar.cpp @@ -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 + * Copyright (c) 2004-2007 Tobias Doerffel + * + * 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 +#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;i2neededSize();\ - if ((ulen+l1)>space){\ + if ((ulen+l1)>(int)space){\ if (ulen==0) diff=0;\ else diff=((float)(space-ulen))/(i2-i);\ break;\ diff --git a/src/widgets/knob.cpp b/src/widgets/knob.cpp index 7bddd84c14..10370ce361 100644 --- a/src/widgets/knob.cpp +++ b/src/widgets/knob.cpp @@ -28,12 +28,12 @@ */ +#include "knob.h" + #include #include #include #include -#include -#include #include #include #include @@ -44,17 +44,17 @@ #endif #include -#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( "" + - QString( accessibleName() ) + "", 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 ), diff --git a/src/widgets/lcd_spinbox.cpp b/src/widgets/lcd_spinbox.cpp index d682058350..0167469fc8 100644 --- a/src/widgets/lcd_spinbox.cpp +++ b/src/widgets/lcd_spinbox.cpp @@ -25,14 +25,14 @@ */ +#include "lcd_spinbox.h" + #include -#include #include -#include #include -#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( "" + - QString( accessibleName() ) + "", 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(), diff --git a/src/widgets/project_notes.cpp b/src/widgets/project_notes.cpp index 1a34f1497d..716bd36679 100644 --- a/src/widgets/project_notes.cpp +++ b/src/widgets/project_notes.cpp @@ -25,6 +25,8 @@ */ +#include "project_notes.h" + #include #include #include @@ -35,8 +37,8 @@ #include #include #include +#include -#include "project_notes.h" #include "embed.h" #include "engine.h" #include "main_window.h" diff --git a/src/widgets/rack_plugin.cpp b/src/widgets/rack_plugin.cpp index 3b1da70b46..8030048f6a 100644 --- a/src/widgets/rack_plugin.cpp +++ b/src/widgets/rack_plugin.cpp @@ -26,24 +26,23 @@ */ -#include -#include -#include -#include -#include -#include - #include "rack_plugin.h" + +#include +#include +#include + #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 contextMenu = new QMenu( this ); - contextMenu->setTitle( m_effect->publicName() ); -#warning TODO: CSS-formatting -#if 0 - QLabel * caption = new QLabel( "" + - QString( m_effect->publicName() ) + - "", - 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 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; diff --git a/src/widgets/tab_bar.cpp b/src/widgets/tab_bar.cpp index 3345ece401..58b2e1d7ae 100644 --- a/src/widgets/tab_bar.cpp +++ b/src/widgets/tab_bar.cpp @@ -3,7 +3,7 @@ /* * tab_bar.cpp - implementation of tab-bar * - * Copyright (c) 2004-2006 Tobias Doerffel + * Copyright (c) 2004-2007 Tobias Doerffel * * 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" diff --git a/src/widgets/tempo_sync_knob.cpp b/src/widgets/tempo_sync_knob.cpp index d88f79e09a..233fd4e709 100644 --- a/src/widgets/tempo_sync_knob.cpp +++ b/src/widgets/tempo_sync_knob.cpp @@ -26,12 +26,13 @@ */ -#include -#include -#include - #include "tempo_sync_knob.h" + +#include +#include + #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( "" + - QString( accessibleName() ) + "", 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 ), diff --git a/src/widgets/text_float.cpp b/src/widgets/text_float.cpp index ee05228cf8..4462574eb5 100644 --- a/src/widgets/text_float.cpp +++ b/src/widgets/text_float.cpp @@ -242,7 +242,5 @@ void textFloat::updateSize( void ) -#undef setParent - #endif