diff options
| -rw-r--r-- | .gitmodules | 2 | ||||
| -rw-r--r-- | ChangeLog | 79 | ||||
| -rw-r--r-- | Makefile.am | 6 | ||||
| -rw-r--r-- | RELEASE-CHECKLIST | 2 | ||||
| -rw-r--r-- | configure.ac | 40 | ||||
| -rw-r--r-- | dggui/Makefile.am | 184 | ||||
| -rw-r--r-- | dggui/button.cc (renamed from plugingui/button.cc) | 4 | ||||
| -rw-r--r-- | dggui/button.h (renamed from plugingui/button.h) | 5 | ||||
| -rw-r--r-- | dggui/button_base.cc (renamed from plugingui/button_base.cc) | 5 | ||||
| -rw-r--r-- | dggui/button_base.h (renamed from plugingui/button_base.h) | 5 | ||||
| -rw-r--r-- | dggui/canvas.h (renamed from plugingui/canvas.h) | 4 | ||||
| -rw-r--r-- | dggui/checkbox.cc (renamed from plugingui/checkbox.cc) | 4 | ||||
| -rw-r--r-- | dggui/checkbox.h (renamed from plugingui/checkbox.h) | 5 | ||||
| -rw-r--r-- | dggui/colour.cc (renamed from plugingui/colour.cc) | 4 | ||||
| -rw-r--r-- | dggui/colour.h (renamed from plugingui/colour.h) | 4 | ||||
| -rw-r--r-- | dggui/combobox.cc (renamed from plugingui/combobox.cc) | 4 | ||||
| -rw-r--r-- | dggui/combobox.h (renamed from plugingui/combobox.h) | 4 | ||||
| -rw-r--r-- | dggui/dialog.cc (renamed from plugingui/dialog.cc) | 4 | ||||
| -rw-r--r-- | dggui/dialog.h (renamed from plugingui/dialog.h) | 4 | ||||
| -rw-r--r-- | dggui/drawable.h (renamed from plugingui/drawable.h) | 4 | ||||
| -rw-r--r-- | dggui/eventhandler.cc (renamed from plugingui/eventhandler.cc) | 4 | ||||
| -rw-r--r-- | dggui/eventhandler.h (renamed from plugingui/eventhandler.h) | 4 | ||||
| -rw-r--r-- | dggui/font.cc (renamed from plugingui/font.cc) | 4 | ||||
| -rw-r--r-- | dggui/font.h (renamed from plugingui/font.h) | 5 | ||||
| -rw-r--r-- | dggui/frame.cc (renamed from plugingui/frame.cc) | 4 | ||||
| -rw-r--r-- | dggui/frame.h (renamed from plugingui/frame.h) | 20 | ||||
| -rw-r--r-- | dggui/guievent.h (renamed from plugingui/guievent.h) | 4 | ||||
| -rw-r--r-- | dggui/helpbutton.cc (renamed from plugingui/helpbutton.cc) | 4 | ||||
| -rw-r--r-- | dggui/helpbutton.h (renamed from plugingui/helpbutton.h) | 4 | ||||
| -rw-r--r-- | dggui/image.cc (renamed from plugingui/image.cc) | 4 | ||||
| -rw-r--r-- | dggui/image.h (renamed from plugingui/image.h) | 5 | ||||
| -rw-r--r-- | dggui/imagecache.cc (renamed from plugingui/imagecache.cc) | 4 | ||||
| -rw-r--r-- | dggui/imagecache.h (renamed from plugingui/imagecache.h) | 4 | ||||
| -rw-r--r-- | dggui/knob.cc (renamed from plugingui/knob.cc) | 4 | ||||
| -rw-r--r-- | dggui/knob.h (renamed from plugingui/knob.h) | 5 | ||||
| -rw-r--r-- | dggui/label.cc (renamed from plugingui/label.cc) | 5 | ||||
| -rw-r--r-- | dggui/label.h (renamed from plugingui/label.h) | 5 | ||||
| -rw-r--r-- | dggui/layout.cc (renamed from plugingui/layout.cc) | 4 | ||||
| -rw-r--r-- | dggui/layout.h (renamed from plugingui/layout.h) | 4 | ||||
| -rw-r--r-- | dggui/led.cc (renamed from plugingui/led.cc) | 5 | ||||
| -rw-r--r-- | dggui/led.h (renamed from plugingui/led.h) | 5 | ||||
| -rw-r--r-- | dggui/lineedit.cc (renamed from plugingui/lineedit.cc) | 5 | ||||
| -rw-r--r-- | dggui/lineedit.h (renamed from plugingui/lineedit.h) | 4 | ||||
| -rw-r--r-- | dggui/listbox.cc (renamed from plugingui/listbox.cc) | 5 | ||||
| -rw-r--r-- | dggui/listbox.h (renamed from plugingui/listbox.h) | 4 | ||||
| -rw-r--r-- | dggui/listboxbasic.cc (renamed from plugingui/listboxbasic.cc) | 5 | ||||
| -rw-r--r-- | dggui/listboxbasic.h (renamed from plugingui/listboxbasic.h) | 9 | ||||
| -rw-r--r-- | dggui/listboxthin.cc (renamed from plugingui/listboxthin.cc) | 4 | ||||
| -rw-r--r-- | dggui/listboxthin.h (renamed from plugingui/listboxthin.h) | 6 | ||||
| m--------- | dggui/lodepng (renamed from plugingui/lodepng) | 0 | ||||
| -rw-r--r-- | dggui/nativewindow.h (renamed from plugingui/nativewindow.h) | 4 | ||||
| -rw-r--r-- | dggui/nativewindow_cocoa.h (renamed from plugingui/nativewindow_cocoa.h) | 4 | ||||
| -rw-r--r-- | dggui/nativewindow_cocoa.mm (renamed from plugingui/nativewindow_cocoa.mm) | 113 | ||||
| -rw-r--r-- | dggui/nativewindow_pugl.cc (renamed from plugingui/nativewindow_pugl.cc) | 4 | ||||
| -rw-r--r-- | dggui/nativewindow_pugl.h (renamed from plugingui/nativewindow_pugl.h) | 4 | ||||
| -rw-r--r-- | dggui/nativewindow_win32.cc (renamed from plugingui/nativewindow_win32.cc) | 4 | ||||
| -rw-r--r-- | dggui/nativewindow_win32.h (renamed from plugingui/nativewindow_win32.h) | 5 | ||||
| -rw-r--r-- | dggui/nativewindow_x11.cc (renamed from plugingui/nativewindow_x11.cc) | 4 | ||||
| -rw-r--r-- | dggui/nativewindow_x11.h (renamed from plugingui/nativewindow_x11.h) | 4 | ||||
| -rw-r--r-- | dggui/painter.cc (renamed from plugingui/painter.cc) | 4 | ||||
| -rw-r--r-- | dggui/painter.h (renamed from plugingui/painter.h) | 4 | ||||
| -rw-r--r-- | dggui/pixelbuffer.cc (renamed from plugingui/pixelbuffer.cc) | 4 | ||||
| -rw-r--r-- | dggui/pixelbuffer.h (renamed from plugingui/pixelbuffer.h) | 4 | ||||
| -rw-r--r-- | dggui/powerbutton.cc (renamed from plugingui/powerbutton.cc) | 4 | ||||
| -rw-r--r-- | dggui/powerbutton.h (renamed from plugingui/powerbutton.h) | 4 | ||||
| -rw-r--r-- | dggui/progressbar.cc (renamed from plugingui/progressbar.cc) | 4 | ||||
| -rw-r--r-- | dggui/progressbar.h (renamed from plugingui/progressbar.h) | 4 | ||||
| -rw-r--r-- | dggui/rc_data.cc | 29 | ||||
| -rw-r--r-- | dggui/rcgentool.cc (renamed from plugingui/rcgen.cc) | 6 | ||||
| -rw-r--r-- | dggui/resource.cc (renamed from plugingui/resource.cc) | 8 | ||||
| -rw-r--r-- | dggui/resource.h (renamed from plugingui/resource.h) | 8 | ||||
| -rw-r--r-- | dggui/resource_data.h (renamed from plugingui/resource_data.h) | 7 | ||||
| -rw-r--r-- | dggui/scrollbar.cc (renamed from plugingui/scrollbar.cc) | 5 | ||||
| -rw-r--r-- | dggui/scrollbar.h (renamed from plugingui/scrollbar.h) | 9 | ||||
| -rw-r--r-- | dggui/slider.cc (renamed from plugingui/slider.cc) | 4 | ||||
| -rw-r--r-- | dggui/slider.h (renamed from plugingui/slider.h) | 4 | ||||
| -rw-r--r-- | dggui/stackedwidget.cc (renamed from plugingui/stackedwidget.cc) | 4 | ||||
| -rw-r--r-- | dggui/stackedwidget.h (renamed from plugingui/stackedwidget.h) | 4 | ||||
| -rw-r--r-- | dggui/tabbutton.cc (renamed from plugingui/tabbutton.cc) | 4 | ||||
| -rw-r--r-- | dggui/tabbutton.h (renamed from plugingui/tabbutton.h) | 4 | ||||
| -rw-r--r-- | dggui/tabwidget.cc (renamed from plugingui/tabwidget.cc) | 4 | ||||
| -rw-r--r-- | dggui/tabwidget.h (renamed from plugingui/tabwidget.h) | 4 | ||||
| -rw-r--r-- | dggui/textedit.cc (renamed from plugingui/textedit.cc) | 4 | ||||
| -rw-r--r-- | dggui/textedit.h (renamed from plugingui/textedit.h) | 4 | ||||
| -rw-r--r-- | dggui/texture.cc (renamed from plugingui/texture.cc) | 4 | ||||
| -rw-r--r-- | dggui/texture.h (renamed from plugingui/texture.h) | 4 | ||||
| -rw-r--r-- | dggui/texturedbox.cc (renamed from plugingui/texturedbox.cc) | 4 | ||||
| -rw-r--r-- | dggui/texturedbox.h (renamed from plugingui/texturedbox.h) | 4 | ||||
| -rw-r--r-- | dggui/toggle.cc (renamed from plugingui/toggle.cc) | 4 | ||||
| -rw-r--r-- | dggui/toggle.h (renamed from plugingui/toggle.h) | 4 | ||||
| -rw-r--r-- | dggui/tooltip.cc (renamed from plugingui/tooltip.cc) | 4 | ||||
| -rw-r--r-- | dggui/tooltip.h (renamed from plugingui/tooltip.h) | 4 | ||||
| -rw-r--r-- | dggui/uitranslation.cc (renamed from plugingui/uitranslation.cc) | 6 | ||||
| -rw-r--r-- | dggui/uitranslation.h (renamed from plugingui/uitranslation.h) | 5 | ||||
| -rw-r--r-- | dggui/utf8.cc (renamed from plugingui/utf8.cc) | 5 | ||||
| -rw-r--r-- | dggui/utf8.h (renamed from plugingui/utf8.h) | 5 | ||||
| -rw-r--r-- | dggui/verticalline.cc (renamed from plugingui/verticalline.cc) | 5 | ||||
| -rw-r--r-- | dggui/verticalline.h (renamed from plugingui/verticalline.h) | 9 | ||||
| -rw-r--r-- | dggui/widget.cc (renamed from plugingui/widget.cc) | 4 | ||||
| -rw-r--r-- | dggui/widget.h (renamed from plugingui/widget.h) | 4 | ||||
| -rw-r--r-- | dggui/window.cc (renamed from plugingui/window.cc) | 4 | ||||
| -rw-r--r-- | dggui/window.h (renamed from plugingui/window.h) | 4 | ||||
| -rw-r--r-- | drumgizmo/Makefile.am | 15 | ||||
| -rw-r--r-- | drumgizmo/dgvalidator.cc | 18 | ||||
| -rw-r--r-- | drumgizmo/drumgizmoc.cc | 113 | ||||
| -rw-r--r-- | drumgizmo/enginefactory.cc | 9 | ||||
| -rw-r--r-- | drumgizmo/enginefactory.h | 9 | ||||
| -rw-r--r-- | drumgizmo/input/alsamidi.cc | 196 | ||||
| -rw-r--r-- | drumgizmo/input/alsamidi.h | 57 | ||||
| -rw-r--r-- | drumgizmo/jackclient.cc | 48 | ||||
| -rw-r--r-- | drumgizmo/jackclient.h | 12 | ||||
| -rw-r--r-- | drumgizmo/output/alsa.cc | 40 | ||||
| -rw-r--r-- | drumgizmo/output/alsa.h | 2 | ||||
| -rw-r--r-- | man/drumgizmo.1 | 17 | ||||
| -rw-r--r-- | man/drumgizmo.fr.1 | 48 | ||||
| -rw-r--r-- | plugin/Makefile.am | 6 | ||||
| -rw-r--r-- | plugin/Makefile.mingw32.in | 98 | ||||
| -rw-r--r-- | plugin/drumgizmo_plugin.cc | 22 | ||||
| -rw-r--r-- | plugin/drumgizmo_plugin.h | 22 | ||||
| -rw-r--r-- | plugingui/Makefile.am | 178 | ||||
| -rw-r--r-- | plugingui/abouttab.cc | 22 | ||||
| -rw-r--r-- | plugingui/abouttab.h | 12 | ||||
| -rw-r--r-- | plugingui/bleedcontrolframecontent.cc | 18 | ||||
| -rw-r--r-- | plugingui/bleedcontrolframecontent.h | 17 | ||||
| -rw-r--r-- | plugingui/diskstreamingframecontent.cc | 20 | ||||
| -rw-r--r-- | plugingui/diskstreamingframecontent.h | 21 | ||||
| -rw-r--r-- | plugingui/drumkitframecontent.cc | 55 | ||||
| -rw-r--r-- | plugingui/drumkitframecontent.h | 39 | ||||
| -rw-r--r-- | plugingui/drumkittab.cc | 66 | ||||
| -rw-r--r-- | plugingui/drumkittab.h | 40 | ||||
| -rw-r--r-- | plugingui/filebrowser.cc | 20 | ||||
| -rw-r--r-- | plugingui/filebrowser.h | 32 | ||||
| -rw-r--r-- | plugingui/humaniservisualiser.cc | 35 | ||||
| -rw-r--r-- | plugingui/humaniservisualiser.h | 33 | ||||
| -rw-r--r-- | plugingui/humanizerframecontent.cc | 16 | ||||
| -rw-r--r-- | plugingui/humanizerframecontent.h | 19 | ||||
| -rw-r--r-- | plugingui/labeledcontrol.h | 24 | ||||
| -rw-r--r-- | plugingui/locale/da.po | 60 | ||||
| -rw-r--r-- | plugingui/locale/drumgizmo.pot | 60 | ||||
| -rw-r--r-- | plugingui/locale/fr.po | 71 | ||||
| -rw-r--r-- | plugingui/maintab.cc | 30 | ||||
| -rw-r--r-- | plugingui/maintab.h | 41 | ||||
| -rw-r--r-- | plugingui/mainwindow.cc | 8 | ||||
| -rw-r--r-- | plugingui/mainwindow.h | 25 | ||||
| -rw-r--r-- | plugingui/powerwidget.cc | 57 | ||||
| -rw-r--r-- | plugingui/powerwidget.h | 44 | ||||
| -rw-r--r-- | plugingui/resamplingframecontent.cc | 6 | ||||
| -rw-r--r-- | plugingui/resamplingframecontent.h | 18 | ||||
| -rw-r--r-- | plugingui/sampleselectionframecontent.cc | 12 | ||||
| -rw-r--r-- | plugingui/sampleselectionframecontent.h | 19 | ||||
| -rw-r--r-- | plugingui/statusframecontent.cc | 9 | ||||
| -rw-r--r-- | plugingui/statusframecontent.h | 13 | ||||
| -rw-r--r-- | plugingui/testmain.cc | 14 | ||||
| -rw-r--r-- | plugingui/timingframecontent.cc | 12 | ||||
| -rw-r--r-- | plugingui/timingframecontent.h | 21 | ||||
| -rw-r--r-- | plugingui/visualizerframecontent.cc | 8 | ||||
| -rw-r--r-- | plugingui/visualizerframecontent.h | 10 | ||||
| -rw-r--r-- | plugingui/voicelimitframecontent.cc | 12 | ||||
| -rw-r--r-- | plugingui/voicelimitframecontent.h | 19 | ||||
| -rw-r--r-- | src/Makefile.am | 2 | ||||
| -rw-r--r-- | src/audiofile.h | 2 | ||||
| -rw-r--r-- | src/audioinputenginemidi.cc | 51 | ||||
| -rw-r--r-- | src/drumgizmo.cc | 37 | ||||
| -rw-r--r-- | src/drumgizmo.h | 2 | ||||
| -rw-r--r-- | src/drumkitloader.cc | 5 | ||||
| -rw-r--r-- | src/events_ds.cc | 19 | ||||
| -rw-r--r-- | src/events_ds.h | 9 | ||||
| -rw-r--r-- | src/inputprocessor.cc | 29 | ||||
| -rw-r--r-- | src/memory_heap.h | 8 | ||||
| -rw-r--r-- | src/midimapparser.cc | 3 | ||||
| -rw-r--r-- | src/midimapper.cc | 24 | ||||
| -rw-r--r-- | src/midimapper.h | 16 | ||||
| -rw-r--r-- | src/sample_selection.cc | 3 | ||||
| -rw-r--r-- | src/settings.h | 1 | ||||
| -rw-r--r-- | src/translation.h | 2 | ||||
| -rw-r--r-- | test/Makefile.am | 172 | ||||
| -rw-r--r-- | test/dgreftest/midiinputengine.cc | 17 | ||||
| -rw-r--r-- | test/eventsdstest.cc | 57 | ||||
| -rw-r--r-- | test/imagecachetest.cc | 8 | ||||
| -rw-r--r-- | test/midimapparsertest.cc | 44 | ||||
| -rw-r--r-- | test/midimappertest.cc | 140 | ||||
| -rw-r--r-- | test/paintertest.cc | 54 | ||||
| -rw-r--r-- | test/resource_test.cc | 6 | ||||
| -rw-r--r-- | test/scopedfile.cc | 7 | ||||
| -rw-r--r-- | test/translationtest.cc | 8 | ||||
| -rw-r--r-- | test/uitests/Makefile.am | 31 | ||||
| -rw-r--r-- | test/uitests/benchmarktest.cc | 32 | ||||
| -rw-r--r-- | test/uitests/filebrowsertest.cc | 21 | ||||
| -rw-r--r-- | test/uitests/framewidgettest.cc | 75 | ||||
| -rw-r--r-- | test/uitests/powerwidgettest.cc | 29 | ||||
| -rw-r--r-- | test/uitests/resizetest.cc | 23 | ||||
| -rw-r--r-- | test/uitests/tabwidgettest.cc | 61 | ||||
| -rwxr-xr-x | tools/macos/build-dg.sh | 264 | ||||
| -rw-r--r-- | tools/macos/drumgizmo.vst.tar.gz | bin | 0 -> 626 bytes | |||
| -rw-r--r-- | tools/macos/zita-resampler-static-build.patch | 28 | ||||
| -rw-r--r-- | version.h | 2 | 
196 files changed, 2806 insertions, 1349 deletions
| diff --git a/.gitmodules b/.gitmodules index 77580d8..feb5114 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,7 +5,7 @@  	path = plugin/plugingizmo  	url = git://git.drumgizmo.org/plugingizmo.git  [submodule "plugingui/lodepng"] -	path = plugingui/lodepng +	path = dggui/lodepng  	url = git://git.drumgizmo.org/lodepng.git  	branch = a71964ed5fe4f82a32ac7f8201338900f66e855d  [submodule "getoptpp"] @@ -1,3 +1,82 @@ +Version 0.9.20 +============== +Release date: September 8th 2022 +Contributors: chaot4, corrados, trebmuh, deva + +This release was originally intended as a bugfix release, but quite a few +features also managed to find their way in. + +Noteworthy bugs that has been fixed: + - Software regression error in cymbal choke code has been fixed. So now +   choking of cymbals using both directed chokes and after-touch midi +   events work again as expected. + - A compilation error due to an update in LV2 API (we used an +   obsolete LV2 type) has been fixed, so now compilation should work for +   everybody again. + - Code can now properly be compiled with NSL support disabled at +   configure time. + - Compilation with the modern gcc-11 compiler has been fixed. + +On top of this a lot of crash-bugs has been fixed. + +Thanks to corrados, this version adds support for midi input through +the alsa seq driver for the command line version of drumgizmo. So now +drumgizmo can be run from the commandline entirely without the need +for jack. + +Compilation Bugs: + - Fix compilation with gcc-11 + - Fix compilation issue when compiling without nls enabled. + - Remove sndfile.h from audiofile header + - Fix missing backslash in libdg includepaths + - Fix compiler warning. + - Add missing include + - Make configure fail if nls is enabled but gettext tools not found. + +Crash Bugs: +  - Fix crash when loading a kit with more channels than the engine +    was compiled for. +  - Fix crash when loading Crocell kit in ardour (stack allocation +    issue) - see Ardour bug report. +    - Get rid of big stack allocation during resampler (re-)configuration. +  - Prevent processing jack clients that are being deleted. +  - Fix crash when pressing play while loading a drumkit. +    - Skip events whose audio-files has not yet been loaded. +  - Fix crash when doing async-load in cli. + +Other Bugs: + - Fixed directed-chokes regression error. + - Fix after-touch chokes regression error. + - Fix wrong sample selection with instruments having only two samples. + - Make aftertouch choke if velocities > 0 instead of == 0 as this +   seem to be the vdrum vendor concensus. + - Clear all active events (ie. stop playing samples) when loading a new kit. + - Fix ALSA output frame size change. +   - added getBufferSize function for alsa out + +Features: + - Record and measure real cymbal choke-time and use this value +   instead of the current 68ms. +   - Adjust choke ramp-down time to better reflect the actual +     dampening time of a hand-dampened cymbal. + - Add support for triggering multiple instruments with one midi note. + - Add voice-limit parameters to cli + - Add setting for controlling ALSA periods to output module. + - Add ALSA MIDI seq input support + +Other: + - Add unit-test for EventsDS::clear() method. + - Add clear member function to EventsDS. + - Add assert to break infinite loop in case of a bug. + - Add -Wextra to debug compilation flags. + - Make it possible to (only) build unit-test in parrallel. + - Add dggui namespace to libdggui components. + - Split UI code into application/plugin UI and UI library. + - Run and fix unit-tests on windows. + - Make rcgen compile and work on windows again through autotools. + - Improve cocoa/macOS rendering speed by removing redraw on all events. + - Reduce UI window height to fit on low-res displays. +  Version 0.9.19  ==============  Release date: November 22nd 2020 diff --git a/Makefile.am b/Makefile.am index 4196db7..3ac094f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@  AUTOMAKE_OPTIONS = gnu -SUBDIRS = tools src plugingui plugin drumgizmo man test -DISTDIRS = tools src plugingui plugin drumgizmo man test +SUBDIRS = tools src dggui plugingui plugin drumgizmo man test +DISTDIRS = tools src dggui plugingui plugin drumgizmo man test  EXTRA_DIST = \  	version.h \ @@ -16,7 +16,7 @@ EXTRA_DIST = \  \  	getoptpp/getoptpp.hpp \  \ -	plugingui/lodepng/lodepng.h \ +	dggui/lodepng/lodepng.h \  \  	pugixml/src/pugixml.hpp \  	pugixml/src/pugiconfig.hpp \ diff --git a/RELEASE-CHECKLIST b/RELEASE-CHECKLIST index eb51141..a46ffc7 100644 --- a/RELEASE-CHECKLIST +++ b/RELEASE-CHECKLIST @@ -4,7 +4,7 @@ Check list for releasing:   [ ]  Update man page - [ ]  Bump version in version.h + [ ]  Bump version in version.h and in man pages and po/pot files.   [ ]  Update ChangeLog diff --git a/configure.ac b/configure.ac index 1151ad1..28c492d 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,7 @@ AC_SYS_LARGEFILE  AM_SILENT_RULES([yes])  need_jack=no +need_alsa=no  dnl ===========================  dnl Compile with C++11 support. @@ -71,7 +72,7 @@ dnl Check for -ffloat-store support  dnl ===========================  AC_LANG_PUSH([C++])  TMP_CXXFLAGS="$CXXFLAGS" -CXXFLAGS="-Wall -Werror -ffloat-store" +CXXFLAGS="-Wall -Werror -Wextra -ffloat-store"  AC_MSG_CHECKING([whether CXX supports -ffloat-store])  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],  	[AC_MSG_RESULT([yes]) @@ -148,8 +149,14 @@ AC_ARG_WITH([nls],              AS_IF([test "x$with_nls" == "xyes"],                    [AC_MSG_RESULT([*** Building with nls support!])                     AC_CHECK_PROGS([XGETTEXT], [xgettext]) +                   AS_IF([test "x$XGETTEXT" = "x"], +                         AC_MSG_ERROR([Missing xgettext tool.]))                     AC_CHECK_PROGS([MSGMERGE], [msgmerge]) +                   AS_IF([test "x$MSGMERGE" = "x"], +                         AC_MSG_ERROR([Missing msgmerge tool.]))                     AC_CHECK_PROGS([MSGFMT], [msgfmt]) +                   AS_IF([test "x$MSGFMT" = "x"], +                         AC_MSG_ERROR([Missing msgfmt tool.]))                     AC_DEFINE_UNQUOTED([WITH_NLS], , [Build with nls support])],                    [AC_MSG_WARN([*** Building without nls support!])]  ) @@ -362,6 +369,11 @@ AS_IF(    dnl ======================    AC_CHECK_HEADERS(getopt.h) +  dnl ====================== +  dnl Check for wordexp +  dnl ====================== +  AC_CHECK_FUNCS([wordexp]) +    dnl ***    dnl *** Input plugins    dnl *** @@ -406,6 +418,20 @@ AS_IF(      have_input_jackmidi=no]    ) +  dnl *** alsamidi +  AC_ARG_ENABLE([input_alsamidi], +    AS_HELP_STRING([--disable-input-alsamidi], [Disable input alsamidi plugin [default=enabled]]),, +           [enable_input_alsamidi="yes"]) + +  AS_IF( +    [test "x$enable_input_alsamidi" = "xyes"], +    [have_input_alsamidi=yes +     need_alsa=yes], + +    [AC_MSG_RESULT([*** input alsamidi plugin disabled per user request ***]) +    have_input_alsamidi=no] +  ) +    dnl *** Midifile    AC_ARG_ENABLE([input_midifile],  		AS_HELP_STRING([--disable-input-midifile], [Disable input midifile plugin [default=enabled]]),, @@ -502,10 +528,7 @@ AS_IF(    AS_IF(      [test "x$enable_output_alsa" = "xyes"],      [have_output_alsa=yes -     dnl ====================== -     dnl Check for alsa library -     dnl ====================== -     PKG_CHECK_MODULES(ALSA, alsa >= 1.0.18)], +     need_alsa=yes],      [AC_MSG_RESULT([*** output alsa plugin disabled per user request ***])       have_output_alsa=no] @@ -582,6 +605,7 @@ AM_CONDITIONAL([ENABLE_CLI], [test "x$enable_cli" == "xyes"])  AM_CONDITIONAL([HAVE_INPUT_DUMMY], [test "x$have_input_dummy" = "xyes"])  AM_CONDITIONAL([HAVE_INPUT_TEST], [test "x$have_input_test" = "xyes"])  AM_CONDITIONAL([HAVE_INPUT_JACKMIDI], [test "x$have_input_jackmidi" = "xyes"]) +AM_CONDITIONAL([HAVE_INPUT_ALSAMIDI], [test "x$have_input_alsamidi" = "xyes"])  AM_CONDITIONAL([HAVE_INPUT_OSSMIDI], [test "x$have_input_ossmidi" = "xyes"])  AM_CONDITIONAL([HAVE_INPUT_MIDIFILE], [test "x$have_input_midifile" = "xyes"])  AM_CONDITIONAL([HAVE_OUTPUT_DUMMY], [test "x$have_output_dummy" = "xyes"]) @@ -697,6 +721,11 @@ dnl Check for jack  dnl ======================  AS_IF([test "x$need_jack" = "xyes"], [PKG_CHECK_MODULES(JACK, jack >= 0.120.1)]) +dnl ====================== +dnl Check for alsa library +dnl ====================== +AS_IF([test "x$need_alsa" = "xyes"], [PKG_CHECK_MODULES(ALSA, alsa >= 1.0.18)]) +  AC_SUBST(CFLAGS)  AC_SUBST(CPPFLAGS)  AC_SUBST(CXXFLAGS) @@ -709,6 +738,7 @@ AC_CONFIG_FILES(  	src/Makefile  	plugin/Makefile  	plugin/vst/Makefile +	dggui/Makefile  	plugingui/Makefile  	plugingui/locale/Makefile  	man/Makefile diff --git a/dggui/Makefile.am b/dggui/Makefile.am new file mode 100644 index 0000000..e55fe12 --- /dev/null +++ b/dggui/Makefile.am @@ -0,0 +1,184 @@ +noinst_PROGRAMS = rcgen +noinst_LTLIBRARIES = libdggui.la + +libdggui_la_CPPFLAGS = \ +	$(DEBUG_FLAGS) \ +	-I$(top_srcdir) \ +	$(GUI_CPPFLAGS) \ +	-I$(top_srcdir)/hugin \ +	-I$(top_srcdir)/src \ +	-DWITH_HUG_MUTEX $(PTHREAD_CFLAGS) \ +	-DLODEPNG_NO_COMPILE_ENCODER \ +	-DLODEPNG_NO_COMPILE_DISK \ +	-DLODEPNG_NO_COMPILE_ANCILLARY_CHUNKS \ +	-DLODEPNG_NO_COMPILE_ERROR_TEXT \ +	-DLODEPNG_NO_COMPILE_CPP + +libdggui_la_CFLAGS = + +libdggui_la_LIBTOOLFLAGS=--tag=CC + +libdggui_la_LIBADD = \ +	$(GUI_LIBS) $(PTHREAD_LIBS) + +# If you add a file here, remember to add it to plugin/Makefile.mingw32.in +GUI_SRC = \ +	button.cc \ +	button_base.cc \ +	checkbox.cc \ +	colour.cc \ +	combobox.cc \ +	dialog.cc \ +	eventhandler.cc \ +	font.cc \ +	frame.cc \ +	helpbutton.cc \ +	image.cc \ +	imagecache.cc \ +	knob.cc \ +	label.cc \ +	layout.cc \ +	led.cc \ +	lineedit.cc \ +	listbox.cc \ +	listboxbasic.cc \ +	listboxthin.cc \ +	painter.cc \ +	pixelbuffer.cc \ +	powerbutton.cc \ +	progressbar.cc \ +	rc_data.cc \ +	resource.cc \ +	scrollbar.cc \ +	slider.cc \ +	stackedwidget.cc \ +	tabbutton.cc \ +	tabwidget.cc \ +	textedit.cc \ +	texture.cc \ +	texturedbox.cc \ +	toggle.cc \ +	tooltip.cc \ +	uitranslation.cc \ +	utf8.cc \ +	verticalline.cc \ +	widget.cc \ +	window.cc + +GUI_HDR = \ +	button.h \ +	button_base.h \ +	canvas.h \ +	checkbox.h \ +	colour.h \ +	combobox.h \ +	dialog.h \ +	drawable.h \ +	eventhandler.h \ +	font.h \ +	frame.h \ +	guievent.h \ +	helpbutton.h \ +	image.h \ +	imagecache.h \ +	knob.h \ +	label.h \ +	layout.h \ +	led.h \ +	lineedit.h \ +	listbox.h \ +	listboxbasic.h \ +	listboxthin.h \ +	nativewindow.h \ +	nativewindow_cocoa.h \ +	nativewindow_cocoa.mm \ +	nativewindow_pugl.h \ +	nativewindow_pugl.cc \ +	nativewindow_win32.h \ +	nativewindow_win32.cc \ +	nativewindow_x11.h \ +	nativewindow_x11.cc \ +	painter.h \ +	pixelbuffer.h \ +	powerbutton.h \ +	progressbar.h \ +	resource.h \ +	resource_data.h \ +	scrollbar.h \ +	slider.h \ +	stackedwidget.h \ +	tabbutton.h \ +	tabwidget.h \ +	textedit.h \ +	texture.h \ +	texturedbox.h \ +	toggle.h \ +	tooltip.h \ +	uitranslation.h \ +	utf8.h \ +	verticalline.h \ +	widget.h \ +	window.h + +libdggui_la_SOURCES = \ +	$(GUI_SRC) \ +	lodepng/lodepng.cpp + +nodist_libdggui_la_SOURCES = + +if ENABLE_X11 +nodist_libdggui_la_SOURCES += \ +	nativewindow_x11.cc +endif + +if ENABLE_WIN32 +nodist_libdggui_la_SOURCES += \ +	nativewindow_win32.cc +endif + +if ENABLE_COCOA +nodist_libdggui_la_SOURCES += \ +	nativewindow_cocoa.mm + +libdggui_la_OBJCXXFLAGS = \ +	-fblocks +endif + +if ENABLE_PUGL_X11 +nodist_libdggui_la_SOURCES += \ +	nativewindow_pugl.cc \ +	$(top_srcdir)/pugl/pugl/pugl_x11.c + +libdggui_la_CPPFLAGS += \ +	-I$(top_srcdir)/pugl + +libdggui_la_CFLAGS += \ +	-std=c99 +endif + +if ENABLE_PUGL_WIN32 +nodist_libdggui_la_SOURCES += \ +	nativewindow_pugl.cc \ +	$(top_srcdir)/pugl/pugl/pugl_win.cpp + +libdggui_la_CPPFLAGS += \ +	-I$(top_srcdir)/pugl +endif + +if ENABLE_PUGL_COCOA +nodist_libdggui_la_SOURCES += \ +	nativewindow_pugl.cc \ +	$(top_srcdir)/pugl/pugl/pugl_osx.m + +libdggui_la_CPPFLAGS += \ +	-I$(top_srcdir)/pugl +endif + +rcgen_LDFLAGS = -static +rcgen_CXXFLAGS = -I$(top_srcdir)/getoptpp +rcgen_SOURCES = \ +	rcgentool.cc + +EXTRA_DIST = \ +	$(RES) \ +	$(GUI_HDR) diff --git a/plugingui/button.cc b/dggui/button.cc index 30bda82..39e9eaa 100644 --- a/plugingui/button.cc +++ b/dggui/button.cc @@ -31,7 +31,7 @@  #include <hugin.hpp>  #include <stdio.h> -namespace GUI +namespace dggui  {  Button::Button(Widget* parent) @@ -85,4 +85,4 @@ void Button::repaintEvent(RepaintEvent* repaintEvent)  	p.drawText(x, y, font, text, enabled);  } -} // GUI:: +} // dggui:: diff --git a/plugingui/button.h b/dggui/button.h index 52f22e2..f1b6584 100644 --- a/plugingui/button.h +++ b/dggui/button.h @@ -30,7 +30,8 @@  #include "font.h"  #include "texturedbox.h" -namespace GUI { +namespace dggui +{  class Button  	: public ButtonBase { @@ -61,4 +62,4 @@ private:  	Font font{":resources/fontemboss.png"};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/button_base.cc b/dggui/button_base.cc index bf441f5..4625b55 100644 --- a/plugingui/button_base.cc +++ b/dggui/button_base.cc @@ -26,7 +26,8 @@   */  #include "button_base.h" -namespace GUI { +namespace dggui +{  ButtonBase::ButtonBase(Widget *parent)  	: Widget(parent) @@ -113,4 +114,4 @@ void ButtonBase::mouseEnterEvent()  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/button_base.h b/dggui/button_base.h index c872d9b..72f693b 100644 --- a/plugingui/button_base.h +++ b/dggui/button_base.h @@ -32,7 +32,8 @@  #include "widget.h" -namespace GUI { +namespace dggui +{  class ButtonBase  	: public Widget @@ -75,4 +76,4 @@ protected:  	State button_state{State::Up};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/canvas.h b/dggui/canvas.h index d6e8f99..1b0b5b2 100644 --- a/plugingui/canvas.h +++ b/dggui/canvas.h @@ -28,7 +28,7 @@  #include "pixelbuffer.h" -namespace GUI +namespace dggui  {  //! Abstract class that can be used by the Painter to draw on. @@ -41,4 +41,4 @@ public:  	virtual PixelBufferAlpha& getPixelBuffer() = 0;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/checkbox.cc b/dggui/checkbox.cc index f3601bd..8911862 100644 --- a/plugingui/checkbox.cc +++ b/dggui/checkbox.cc @@ -28,7 +28,7 @@  #include "painter.h" -namespace GUI +namespace dggui  {  CheckBox::CheckBox(Widget* parent) @@ -61,4 +61,4 @@ void CheckBox::repaintEvent(RepaintEvent* repaintEvent)  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/checkbox.h b/dggui/checkbox.h index 6627304..1a323b6 100644 --- a/plugingui/checkbox.h +++ b/dggui/checkbox.h @@ -29,7 +29,8 @@  #include "toggle.h"  #include "texture.h" -namespace GUI { +namespace dggui +{  class CheckBox : public Toggle {  public: @@ -46,4 +47,4 @@ private:  	Texture knob;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/colour.cc b/dggui/colour.cc index 7fd649c..6d510f9 100644 --- a/plugingui/colour.cc +++ b/dggui/colour.cc @@ -28,7 +28,7 @@  #include <cstring> -namespace GUI +namespace dggui  {  Colour::Colour() @@ -79,4 +79,4 @@ bool Colour::operator!=(const Colour& other) const  	return !(*this == other);  } -} // GUI:: +} // dggui:: diff --git a/plugingui/colour.h b/dggui/colour.h index 0bc8659..aea286c 100644 --- a/plugingui/colour.h +++ b/dggui/colour.h @@ -29,7 +29,7 @@  #include <array>  #include <cstdint> -namespace GUI +namespace dggui  {  class Colour @@ -58,4 +58,4 @@ private:  	std::array<std::uint8_t, 4> pixel{{255, 255, 255, 255}};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/combobox.cc b/dggui/combobox.cc index aa2058e..33765e2 100644 --- a/plugingui/combobox.cc +++ b/dggui/combobox.cc @@ -33,7 +33,7 @@  #define BORDER 10 -namespace GUI +namespace dggui  {  void ComboBox::listboxSelectHandler() @@ -231,4 +231,4 @@ void ComboBox::buttonEvent(ButtonEvent* buttonEvent)  	listbox.setVisible(!listbox.visible());  } -} // GUI:: +} // dggui:: diff --git a/plugingui/combobox.h b/dggui/combobox.h index 778d54c..a3ef8ac 100644 --- a/plugingui/combobox.h +++ b/dggui/combobox.h @@ -35,7 +35,7 @@  #include "painter.h"  #include "texturedbox.h" -namespace GUI +namespace dggui  {  class ComboBox @@ -73,4 +73,4 @@ private:  	ListBoxThin listbox;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/dialog.cc b/dggui/dialog.cc index 9ba579d..74d9200 100644 --- a/plugingui/dialog.cc +++ b/dggui/dialog.cc @@ -26,7 +26,7 @@   */  #include "dialog.h" -namespace GUI +namespace dggui  {  Dialog::Dialog(Widget* parent, bool modal) @@ -51,4 +51,4 @@ bool Dialog::isModal() const  	return is_modal;  } -} // GUI:: +} // dggui:: diff --git a/plugingui/dialog.h b/dggui/dialog.h index 1b0c6da..a9911c5 100644 --- a/plugingui/dialog.h +++ b/dggui/dialog.h @@ -28,7 +28,7 @@  #include "window.h" -namespace GUI +namespace dggui  {  //! This class is used the base window for pop-up dialogs, such as a file @@ -60,4 +60,4 @@ private:  	Widget* parent{nullptr};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/drawable.h b/dggui/drawable.h index 95492d6..84e33db 100644 --- a/plugingui/drawable.h +++ b/dggui/drawable.h @@ -29,7 +29,7 @@  #include <cstdlib>  #include <cstdint> -namespace GUI +namespace dggui  {  class Colour; @@ -49,4 +49,4 @@ public:  	virtual bool hasAlpha() const = 0;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/eventhandler.cc b/dggui/eventhandler.cc index fd333b8..b2cf616 100644 --- a/plugingui/eventhandler.cc +++ b/dggui/eventhandler.cc @@ -30,7 +30,7 @@  #include "painter.h"  #include "dialog.h" -namespace GUI +namespace dggui  {  EventHandler::EventHandler(NativeWindow& nativeWindow, Window& window) @@ -294,4 +294,4 @@ void EventHandler::unregisterDialog(Dialog* dialog)  } -} // GUI:: +} // dggui:: diff --git a/plugingui/eventhandler.h b/dggui/eventhandler.h index 8d6f492..6a2b48f 100644 --- a/plugingui/eventhandler.h +++ b/dggui/eventhandler.h @@ -34,7 +34,7 @@  #include "guievent.h"  #include "nativewindow.h" -namespace GUI +namespace dggui  {  class Window; @@ -75,4 +75,4 @@ private:  	std::list<Dialog*> dialogs;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/font.cc b/dggui/font.cc index 0500e81..e59cb41 100644 --- a/plugingui/font.cc +++ b/dggui/font.cc @@ -28,7 +28,7 @@  #include <cassert> -namespace GUI +namespace dggui  {  Font::Font(const std::string& fontfile) @@ -133,4 +133,4 @@ PixelBufferAlpha *Font::render(const std::string& text) const  	return pb;  } -} // GUI:: +} // dggui:: diff --git a/plugingui/font.h b/dggui/font.h index 2e3f87a..6ce1f5c 100644 --- a/plugingui/font.h +++ b/dggui/font.h @@ -32,7 +32,8 @@  #include "pixelbuffer.h"  #include "image.h" -namespace GUI { +namespace dggui +{  class Font {  public: @@ -61,4 +62,4 @@ private:  	int spacing{1};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/frame.cc b/dggui/frame.cc index d375b6d..3a163f1 100644 --- a/plugingui/frame.cc +++ b/dggui/frame.cc @@ -28,7 +28,7 @@  #include "painter.h" -namespace GUI +namespace dggui  {  FrameWidget::FrameWidget(Widget* parent, bool has_switch, bool has_help_text) @@ -143,4 +143,4 @@ void FrameWidget::sizeChanged(int width, int height)  	help_button.move(width - 4 - 16, help_button.y());  } -} // GUI:: +} // dggui:: diff --git a/plugingui/frame.h b/dggui/frame.h index db26ea9..dc8e17a 100644 --- a/plugingui/frame.h +++ b/dggui/frame.h @@ -33,7 +33,7 @@  #include "helpbutton.h"  #include "widget.h" -namespace GUI +namespace dggui  {  class FrameWidget @@ -76,8 +76,8 @@ private:  	// label  	Font font;  	std::string title; -	GUI::Colour label_colour{0.1}; -	GUI::Colour label_colour_disabled{0.5}; +	dggui::Colour label_colour{0.1}; +	dggui::Colour label_colour_disabled{0.5};  	std::size_t label_width;  	// switch @@ -89,18 +89,18 @@ private:  	// grey box  	int bar_height; -	GUI::Colour grey_box_colour{0.7}; -	GUI::Colour grey_box_colour_disabled{0.7}; -	GUI::Colour background_colour{0.85, 0.8}; +	dggui::Colour grey_box_colour{0.7}; +	dggui::Colour grey_box_colour_disabled{0.7}; +	dggui::Colour background_colour{0.85, 0.8};  	//  	// content  	//  	// content frame -	GUI::Colour frame_colour_top{0.95}; -	GUI::Colour frame_colour_bottom{0.4}; -	GUI::Colour frame_colour_side{0.6}; +	dggui::Colour frame_colour_top{0.95}; +	dggui::Colour frame_colour_bottom{0.4}; +	dggui::Colour frame_colour_side{0.6};  	// content box  	Widget* content{nullptr}; @@ -112,4 +112,4 @@ private:  	int content_height;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/guievent.h b/dggui/guievent.h index 4ad0798..aae0ae1 100644 --- a/plugingui/guievent.h +++ b/dggui/guievent.h @@ -30,7 +30,7 @@  #include <list>  #include <memory> -namespace GUI +namespace dggui  {  enum class EventType @@ -209,4 +209,4 @@ struct Rect  	}  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/helpbutton.cc b/dggui/helpbutton.cc index fa061a6..cc03112 100644 --- a/plugingui/helpbutton.cc +++ b/dggui/helpbutton.cc @@ -30,7 +30,7 @@  #include <iostream> -namespace GUI +namespace dggui  {  HelpButton::HelpButton(Widget* parent) @@ -72,4 +72,4 @@ void HelpButton::showHelpText()  	tip.show();  } -} // GUI:: +} // dggui:: diff --git a/plugingui/helpbutton.h b/dggui/helpbutton.h index 6e97eca..639799a 100644 --- a/plugingui/helpbutton.h +++ b/dggui/helpbutton.h @@ -30,7 +30,7 @@  #include "button_base.h"  #include "tooltip.h" -namespace GUI +namespace dggui  {  class HelpButton @@ -55,4 +55,4 @@ private:  	Tooltip tip;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/image.cc b/dggui/image.cc index 118203e..d821bee 100644 --- a/plugingui/image.cc +++ b/dggui/image.cc @@ -36,7 +36,7 @@  #include "resource.h"  #include "lodepng/lodepng.h" -namespace GUI +namespace dggui  {  Image::Image(const char* data, size_t size) @@ -213,4 +213,4 @@ bool Image::isValid() const  	return valid;  } -} // GUI:: +} // dggui:: diff --git a/plugingui/image.h b/dggui/image.h index d162a75..a6bf43e 100644 --- a/plugingui/image.h +++ b/dggui/image.h @@ -33,7 +33,8 @@  #include "colour.h"  #include "resource.h" -namespace GUI { +namespace dggui +{  class Image  	: public Drawable @@ -72,4 +73,4 @@ protected:  	bool has_alpha{false};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/imagecache.cc b/dggui/imagecache.cc index d3130fe..fa2197b 100644 --- a/plugingui/imagecache.cc +++ b/dggui/imagecache.cc @@ -30,7 +30,7 @@  #include "image.h" -namespace GUI +namespace dggui  {  ScopedImageBorrower::ScopedImageBorrower(ImageCache& imageCache, @@ -100,4 +100,4 @@ void ImageCache::giveBack(const std::string& filename)  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/imagecache.h b/dggui/imagecache.h index d31a844..15ecaf3 100644 --- a/plugingui/imagecache.h +++ b/dggui/imagecache.h @@ -30,7 +30,7 @@  #include <map>  #include <utility> -namespace GUI +namespace dggui  {  class Image; @@ -69,4 +69,4 @@ protected:  	std::map<std::string, std::pair<std::size_t, Image>> imageCache;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/knob.cc b/dggui/knob.cc index 25200a7..4f8ead0 100644 --- a/plugingui/knob.cc +++ b/dggui/knob.cc @@ -36,7 +36,7 @@ namespace  const double pi = std::atan(1.0) * 4.0;  } -namespace GUI +namespace dggui  {  Knob::Knob(Widget *parent) @@ -252,4 +252,4 @@ void Knob::internalSetValue(float new_value)  	redraw();  } -} // GUI:: +} // dggui:: diff --git a/plugingui/knob.h b/dggui/knob.h index fc71511..851c9c6 100644 --- a/plugingui/knob.h +++ b/dggui/knob.h @@ -32,7 +32,8 @@  #include "texture.h"  #include "font.h" -namespace GUI { +namespace dggui +{  class Knob : public Widget {  public: @@ -85,4 +86,4 @@ private:  	Font font;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/label.cc b/dggui/label.cc index b5239ec..fc3f60e 100644 --- a/plugingui/label.cc +++ b/dggui/label.cc @@ -31,7 +31,8 @@  #include <cpp11fix.h> -namespace GUI { +namespace dggui +{  Label::Label(Widget *parent)  	: Widget(parent) @@ -93,4 +94,4 @@ void Label::repaintEvent(RepaintEvent* repaintEvent)  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/label.h b/dggui/label.h index 45b4176..453bc4f 100644 --- a/plugingui/label.h +++ b/dggui/label.h @@ -33,7 +33,8 @@  #include <string>  #include <memory> -namespace GUI { +namespace dggui +{  enum class TextAlignment {  	left, @@ -66,4 +67,4 @@ private:  	std::unique_ptr<Colour> colour;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/layout.cc b/dggui/layout.cc index 61e4f77..3b99456 100644 --- a/plugingui/layout.cc +++ b/dggui/layout.cc @@ -30,7 +30,7 @@  #include <algorithm> -namespace GUI +namespace dggui  {  LayoutItem::LayoutItem() @@ -383,4 +383,4 @@ void GridLayout::moveAndResize(  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/layout.h b/dggui/layout.h index 210c86e..860ecc2 100644 --- a/plugingui/layout.h +++ b/dggui/layout.h @@ -32,7 +32,7 @@  #include <notifier.h> -namespace GUI +namespace dggui  {  class Layout; @@ -192,4 +192,4 @@ private:  	    LayoutItem& item, GridRange const& range, CellSize cell_size) const;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/led.cc b/dggui/led.cc index f77e31a..6e1059c 100644 --- a/plugingui/led.cc +++ b/dggui/led.cc @@ -28,7 +28,8 @@  #include "painter.h" -namespace GUI { +namespace dggui +{  LED::LED(Widget *parent)  	: Widget(parent) @@ -94,4 +95,4 @@ void LED::repaintEvent(RepaintEvent* repaintEvent)  	p.drawFilledCircle(w / 3, h / 3, size / 6);  } -} // GUI:: +} // dggui:: diff --git a/plugingui/led.h b/dggui/led.h index 14ab6ef..7a1f55f 100644 --- a/plugingui/led.h +++ b/dggui/led.h @@ -28,7 +28,8 @@  #include "widget.h" -namespace GUI { +namespace dggui +{  class LED : public Widget {  public: @@ -51,4 +52,4 @@ private:  	state_t state;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/lineedit.cc b/dggui/lineedit.cc index 14cc234..7e8bf86 100644 --- a/plugingui/lineedit.cc +++ b/dggui/lineedit.cc @@ -31,7 +31,8 @@  #define BORDER 10 -namespace GUI { +namespace dggui +{  LineEdit::LineEdit(Widget *parent)  	: Widget(parent) @@ -282,4 +283,4 @@ void LineEdit::repaintEvent(RepaintEvent *repaintEvent)  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/lineedit.h b/dggui/lineedit.h index 86ad986..c702c47 100644 --- a/plugingui/lineedit.h +++ b/dggui/lineedit.h @@ -33,7 +33,7 @@  #include "painter.h"  #include "texturedbox.h" -namespace GUI +namespace dggui  {  class LineEdit @@ -84,4 +84,4 @@ private:  	bool readonly;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/listbox.cc b/dggui/listbox.cc index 28c074e..4513895 100644 --- a/plugingui/listbox.cc +++ b/dggui/listbox.cc @@ -29,7 +29,8 @@  #include "painter.h"  #include "font.h" -namespace GUI { +namespace dggui +{  ListBox::ListBox(Widget *parent)  	: Widget(parent) @@ -102,4 +103,4 @@ void ListBox::resize(std::size_t width, std::size_t height)  	             height - (7 + 7));  } -} // GUI:: +} // dggui:: diff --git a/plugingui/listbox.h b/dggui/listbox.h index 0d9ad4d..75a4ea0 100644 --- a/plugingui/listbox.h +++ b/dggui/listbox.h @@ -34,7 +34,7 @@  #include "listboxbasic.h"  #include "texturedbox.h" -namespace GUI +namespace dggui  {  class ListBox @@ -71,4 +71,4 @@ private:  			7, 63, 7}; // dy1, dy2, dy3  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/listboxbasic.cc b/dggui/listboxbasic.cc index b2637eb..dd58944 100644 --- a/plugingui/listboxbasic.cc +++ b/dggui/listboxbasic.cc @@ -29,7 +29,8 @@  #include "painter.h"  #include "font.h" -namespace GUI { +namespace dggui +{  ListBoxBasic::ListBoxBasic(Widget *parent)  	: Widget(parent) @@ -359,4 +360,4 @@ void ListBoxBasic::resize(std::size_t width, std::size_t height)  	scroll.resize(scroll.width(), height);  } -} // GUI:: +} // dggui:: diff --git a/plugingui/listboxbasic.h b/dggui/listboxbasic.h index 27822e6..3d6515d 100644 --- a/plugingui/listboxbasic.h +++ b/dggui/listboxbasic.h @@ -36,9 +36,12 @@  #include "painter.h"  #include "scrollbar.h" -namespace GUI { +namespace dggui +{ -class ListBoxBasic : public Widget { +class ListBoxBasic +	: public Widget +{  public:  	class Item {  	public: @@ -91,4 +94,4 @@ protected:  	int btn_size;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/listboxthin.cc b/dggui/listboxthin.cc index d224f11..b92def3 100644 --- a/plugingui/listboxthin.cc +++ b/dggui/listboxthin.cc @@ -29,7 +29,7 @@  #include "painter.h"  #include "font.h" -namespace GUI +namespace dggui  {  ListBoxThin::ListBoxThin(Widget *parent) @@ -98,4 +98,4 @@ void ListBoxThin::resize(std::size_t height, std::size_t width)  	             height - (1 + 1));  } -} // GUI:: +} // dggui:: diff --git a/plugingui/listboxthin.h b/dggui/listboxthin.h index e861745..0305a04 100644 --- a/plugingui/listboxthin.h +++ b/dggui/listboxthin.h @@ -36,7 +36,7 @@  #include "listboxbasic.h"  #include "texturedbox.h" -namespace GUI +namespace dggui  {  class ListBoxThin @@ -55,7 +55,7 @@ public:  	std::string selectedValue();  	// From Widget: -	virtual void repaintEvent(GUI::RepaintEvent* repaintEvent) override; +	virtual void repaintEvent(RepaintEvent* repaintEvent) override;  	virtual void resize(std::size_t height, std::size_t width) override;  	// Forwarded notifier from ListBoxBasic::basic @@ -72,4 +72,4 @@ private:  			1, 1, 1}; // dy1, dy2, dy3  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/lodepng b/dggui/lodepng -Subproject a71964ed5fe4f82a32ac7f8201338900f66e855 +Subproject a71964ed5fe4f82a32ac7f8201338900f66e855 diff --git a/plugingui/nativewindow.h b/dggui/nativewindow.h index 400ff57..07c3559 100644 --- a/plugingui/nativewindow.h +++ b/dggui/nativewindow.h @@ -34,7 +34,7 @@  #include "guievent.h" -namespace GUI +namespace dggui  {  struct Point; @@ -97,4 +97,4 @@ public:  	virtual Point translateToScreen(const Point& point) = 0;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/nativewindow_cocoa.h b/dggui/nativewindow_cocoa.h index 8dc73e6..e17d4af 100644 --- a/plugingui/nativewindow_cocoa.h +++ b/dggui/nativewindow_cocoa.h @@ -30,7 +30,7 @@  #include "nativewindow.h" -namespace GUI +namespace dggui  {  class Window; @@ -75,4 +75,4 @@ private:  	float scale{1.0};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/nativewindow_cocoa.mm b/dggui/nativewindow_cocoa.mm index 37fae88..3214f57 100644 --- a/plugingui/nativewindow_cocoa.mm +++ b/dggui/nativewindow_cocoa.mm @@ -69,11 +69,11 @@  {  @public  	NSWindow* window; -	GUI::NativeWindowCocoa* native; +	dggui::NativeWindowCocoa* native;  }  - (id) initWithWindow:(NSWindow*)ref -               native:(GUI::NativeWindowCocoa*)_native; +               native:(dggui::NativeWindowCocoa*)_native;  - (void) dealloc;  - (void) windowDidResize;  - (void) windowWillResize; @@ -83,7 +83,7 @@  @implementation DGListener  - (id) initWithWindow:(NSWindow*)ref -               native:(GUI::NativeWindowCocoa*)_native +               native:(dggui::NativeWindowCocoa*)_native  {  	[super init]; @@ -146,7 +146,7 @@  		return;  	} -	auto closeEvent = std::make_shared<GUI::CloseEvent>(); +	auto closeEvent = std::make_shared<dggui::CloseEvent>();  	native->pushBackEvent(closeEvent);  } @@ -162,7 +162,7 @@  	int depthBits;  @private -	GUI::NativeWindowCocoa* native; +	dggui::NativeWindowCocoa* native;  	NSTrackingArea* trackingArea;  } @@ -188,7 +188,7 @@  - (void) keyUp:(NSEvent*)event;  - (void) dealloc; -- (void) bindNative:(GUI::NativeWindowCocoa*)native; +- (void) bindNative:(dggui::NativeWindowCocoa*)native;  - (void) unbindNative;  @end @@ -228,7 +228,7 @@  	[super mouseEntered:event];  	auto frame = [self frame];  	NSPoint loc = [event locationInWindow]; -	auto mouseEnterEvent = std::make_shared<GUI::MouseEnterEvent>(); +	auto mouseEnterEvent = std::make_shared<dggui::MouseEnterEvent>();  	mouseEnterEvent->x = loc.x - frame.origin.x;  	mouseEnterEvent->y = frame.size.height - loc.y - frame.origin.y;  	native->pushBackEvent(mouseEnterEvent); @@ -240,7 +240,7 @@  	[super mouseExited:event];  	auto frame = [self frame];  	NSPoint loc = [event locationInWindow]; -	auto mouseLeaveEvent = std::make_shared<GUI::MouseLeaveEvent>(); +	auto mouseLeaveEvent = std::make_shared<dggui::MouseLeaveEvent>();  	mouseLeaveEvent->x = loc.x - frame.origin.x;  	mouseLeaveEvent->y = frame.size.height - loc.y - frame.origin.y;  	native->pushBackEvent(mouseLeaveEvent); @@ -251,7 +251,7 @@  {  	auto frame = [self frame];  	NSPoint loc = [event locationInWindow]; -	auto mouseMoveEvent = std::make_shared<GUI::MouseMoveEvent>(); +	auto mouseMoveEvent = std::make_shared<dggui::MouseMoveEvent>();  	mouseMoveEvent->x = loc.x - frame.origin.x;  	mouseMoveEvent->y = frame.size.height - loc.y - frame.origin.y;  	native->pushBackEvent(mouseMoveEvent); @@ -262,24 +262,24 @@  	auto frame = [self frame];  	NSPoint loc = [event locationInWindow]; -	auto buttonEvent = std::make_shared<GUI::ButtonEvent>(); +	auto buttonEvent = std::make_shared<dggui::ButtonEvent>();  	buttonEvent->x = loc.x - frame.origin.x;  	buttonEvent->y = frame.size.height - loc.y - frame.origin.y;  	switch((int)[event buttonNumber])  	{  	case 0: -		buttonEvent->button = GUI::MouseButton::left; +		buttonEvent->button = dggui::MouseButton::left;  		break;  	case 1: -		buttonEvent->button = GUI::MouseButton::right; +		buttonEvent->button = dggui::MouseButton::right;  		break;  	case 2: -		buttonEvent->button = GUI::MouseButton::middle; +		buttonEvent->button = dggui::MouseButton::middle;  		break;  	default:  		return;  	} -	buttonEvent->direction = GUI::Direction::down; +	buttonEvent->direction = dggui::Direction::down;  	buttonEvent->doubleClick = [event clickCount] == 2;  	native->pushBackEvent(buttonEvent); @@ -291,24 +291,24 @@  	auto frame = [self frame];  	NSPoint loc = [event locationInWindow]; -	auto buttonEvent = std::make_shared<GUI::ButtonEvent>(); +	auto buttonEvent = std::make_shared<dggui::ButtonEvent>();  	buttonEvent->x = loc.x - frame.origin.x;  	buttonEvent->y = frame.size.height - loc.y - frame.origin.y;  	switch((int)[event buttonNumber])  	{  	case 0: -		buttonEvent->button = GUI::MouseButton::left; +		buttonEvent->button = dggui::MouseButton::left;  		break;  	case 1: -		buttonEvent->button = GUI::MouseButton::right; +		buttonEvent->button = dggui::MouseButton::right;  		break;  	case 2: -		buttonEvent->button = GUI::MouseButton::middle; +		buttonEvent->button = dggui::MouseButton::middle;  		break;  	default:  		return;  	} -	buttonEvent->direction = GUI::Direction::up; +	buttonEvent->direction = dggui::Direction::up;  	buttonEvent->doubleClick = false;  	native->pushBackEvent(buttonEvent); @@ -362,7 +362,7 @@  	auto frame = [self frame];  	NSPoint loc = [event locationInWindow]; -	auto scrollEvent = std::make_shared<GUI::ScrollEvent>(); +	auto scrollEvent = std::make_shared<dggui::ScrollEvent>();  	scrollEvent->x = loc.x - frame.origin.x;  	scrollEvent->y = frame.size.height - loc.y - frame.origin.y;  	scrollEvent->delta = [event deltaY] * -1.0f; @@ -376,31 +376,31 @@  	const NSString* chars = [event characters];  	const char* str = [chars UTF8String]; -	auto keyEvent = std::make_shared<GUI::KeyEvent>(); +	auto keyEvent = std::make_shared<dggui::KeyEvent>();  	switch([event keyCode])  	{ -	case 123: keyEvent->keycode = GUI::Key::left; break; -	case 124: keyEvent->keycode = GUI::Key::right; break; -	case 126: keyEvent->keycode = GUI::Key::up; break; -	case 125: keyEvent->keycode = GUI::Key::down; break; -	case 117: keyEvent->keycode = GUI::Key::deleteKey; break; -	case 51:  keyEvent->keycode = GUI::Key::backspace; break; -	case 115: keyEvent->keycode = GUI::Key::home; break; -	case 119: keyEvent->keycode = GUI::Key::end; break; -	case 121: keyEvent->keycode = GUI::Key::pageDown; break; -	case 116: keyEvent->keycode = GUI::Key::pageUp; break; -	case 36:  keyEvent->keycode = GUI::Key::enter; break; -	default:  keyEvent->keycode = GUI::Key::unknown; break; +	case 123: keyEvent->keycode = dggui::Key::left; break; +	case 124: keyEvent->keycode = dggui::Key::right; break; +	case 126: keyEvent->keycode = dggui::Key::up; break; +	case 125: keyEvent->keycode = dggui::Key::down; break; +	case 117: keyEvent->keycode = dggui::Key::deleteKey; break; +	case 51:  keyEvent->keycode = dggui::Key::backspace; break; +	case 115: keyEvent->keycode = dggui::Key::home; break; +	case 119: keyEvent->keycode = dggui::Key::end; break; +	case 121: keyEvent->keycode = dggui::Key::pageDown; break; +	case 116: keyEvent->keycode = dggui::Key::pageUp; break; +	case 36:  keyEvent->keycode = dggui::Key::enter; break; +	default:  keyEvent->keycode = dggui::Key::unknown; break;  	} -	if(strlen(str) && keyEvent->keycode == GUI::Key::unknown) +	if(strlen(str) && keyEvent->keycode == dggui::Key::unknown)  	{ -		keyEvent->keycode = GUI::Key::character; +		keyEvent->keycode = dggui::Key::character;  	}  	keyEvent->text = str; // TODO: UTF8 decode -	keyEvent->direction = GUI::Direction::down; +	keyEvent->direction = dggui::Direction::down;  	native->pushBackEvent(keyEvent);  	[super keyDown: event]; @@ -410,31 +410,31 @@  {  	const NSString* chars = [event characters];  	const char* str = [chars UTF8String]; -	auto keyEvent = std::make_shared<GUI::KeyEvent>(); +	auto keyEvent = std::make_shared<dggui::KeyEvent>();  	switch([event keyCode])  	{ -	case 123: keyEvent->keycode = GUI::Key::left; break; -	case 124: keyEvent->keycode = GUI::Key::right; break; -	case 126: keyEvent->keycode = GUI::Key::up; break; -	case 125: keyEvent->keycode = GUI::Key::down; break; -	case 117: keyEvent->keycode = GUI::Key::deleteKey; break; -	case 51:  keyEvent->keycode = GUI::Key::backspace; break; -	case 115: keyEvent->keycode = GUI::Key::home; break; -	case 119: keyEvent->keycode = GUI::Key::end; break; -	case 121: keyEvent->keycode = GUI::Key::pageDown; break; -	case 116: keyEvent->keycode = GUI::Key::pageUp; break; -	case 36:  keyEvent->keycode = GUI::Key::enter; break; -	default:  keyEvent->keycode = GUI::Key::unknown; break; +	case 123: keyEvent->keycode = dggui::Key::left; break; +	case 124: keyEvent->keycode = dggui::Key::right; break; +	case 126: keyEvent->keycode = dggui::Key::up; break; +	case 125: keyEvent->keycode = dggui::Key::down; break; +	case 117: keyEvent->keycode = dggui::Key::deleteKey; break; +	case 51:  keyEvent->keycode = dggui::Key::backspace; break; +	case 115: keyEvent->keycode = dggui::Key::home; break; +	case 119: keyEvent->keycode = dggui::Key::end; break; +	case 121: keyEvent->keycode = dggui::Key::pageDown; break; +	case 116: keyEvent->keycode = dggui::Key::pageUp; break; +	case 36:  keyEvent->keycode = dggui::Key::enter; break; +	default:  keyEvent->keycode = dggui::Key::unknown; break;  	} -	if(strlen(str) && keyEvent->keycode == GUI::Key::unknown) +	if(strlen(str) && keyEvent->keycode == dggui::Key::unknown)  	{ -		keyEvent->keycode = GUI::Key::character; +		keyEvent->keycode = dggui::Key::character;  	}  	keyEvent->text = str; // TODO: UTF8 decode -	keyEvent->direction = GUI::Direction::up; +	keyEvent->direction = dggui::Direction::up;  	native->pushBackEvent(keyEvent);  	[super keyUp: event]; @@ -445,7 +445,7 @@  	[super dealloc];  } -- (void)bindNative:(GUI::NativeWindowCocoa*)_native +- (void)bindNative:(dggui::NativeWindowCocoa*)_native  {  	native = _native;  } @@ -457,7 +457,7 @@  @end -namespace GUI +namespace dggui  {  struct priv @@ -818,7 +818,7 @@ void NativeWindowCocoa::resized()  		updateLayerOffset();  	} -	auto resizeEvent = std::make_shared<GUI::ResizeEvent>(); +	auto resizeEvent = std::make_shared<dggui::ResizeEvent>();  	resizeEvent->width = 42; // size is not actually used  	resizeEvent->height = 42; // size is not actually used  	pushBackEvent(resizeEvent); @@ -827,7 +827,6 @@ void NativeWindowCocoa::resized()  void NativeWindowCocoa::pushBackEvent(std::shared_ptr<Event> event)  {  	event_queue.push_back(event); -	redraw({});  } -} // GUI:: +} // dggui:: diff --git a/plugingui/nativewindow_pugl.cc b/dggui/nativewindow_pugl.cc index f94b82b..68b1ea9 100644 --- a/plugingui/nativewindow_pugl.cc +++ b/dggui/nativewindow_pugl.cc @@ -42,7 +42,7 @@  #include <hugin.hpp> -namespace GUI +namespace dggui  {  NativeWindowPugl::NativeWindowPugl(void* native_window, Window& window) @@ -379,4 +379,4 @@ void NativeWindowPugl::onKeyboard(PuglView* view, bool press, uint32_t key)  	native->eventq.push_back(e);  } -} // GUI:: +} // dggui:: diff --git a/plugingui/nativewindow_pugl.h b/dggui/nativewindow_pugl.h index 6a667f4..c76b157 100644 --- a/plugingui/nativewindow_pugl.h +++ b/dggui/nativewindow_pugl.h @@ -34,7 +34,7 @@ extern "C"  #include <list> -namespace GUI +namespace dggui  {  class Event; @@ -80,4 +80,4 @@ private:  	std::uint32_t last_click{0};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/nativewindow_win32.cc b/dggui/nativewindow_win32.cc index 4b31130..db785e9 100644 --- a/plugingui/nativewindow_win32.cc +++ b/dggui/nativewindow_win32.cc @@ -32,7 +32,7 @@  #include "window.h" -namespace GUI +namespace dggui  {  static BOOL trackMouse(HWND hwnd) @@ -581,4 +581,4 @@ Point NativeWindowWin32::translateToScreen(const Point& point)  	return { p.x, p.y };  } -} // GUI:: +} // dggui:: diff --git a/plugingui/nativewindow_win32.h b/dggui/nativewindow_win32.h index 046b38a..f4748fe 100644 --- a/plugingui/nativewindow_win32.h +++ b/dggui/nativewindow_win32.h @@ -34,7 +34,8 @@  #include <windows.h>  typedef HWND WNDID; -namespace GUI { +namespace dggui +{  class Window;  class Event; @@ -75,4 +76,4 @@ private:  	bool always_on_top{false};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/nativewindow_x11.cc b/dggui/nativewindow_x11.cc index 33dde7b..04f1b35 100644 --- a/plugingui/nativewindow_x11.cc +++ b/dggui/nativewindow_x11.cc @@ -41,7 +41,7 @@  #include "window.h" -namespace GUI +namespace dggui  {  #define _NET_WM_STATE_REMOVE        0    // remove/unset property @@ -712,4 +712,4 @@ void NativeWindowX11::updateImageFromBuffer(std::size_t x1, std::size_t y1,  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/nativewindow_x11.h b/dggui/nativewindow_x11.h index cb56fbc..bed86bd 100644 --- a/plugingui/nativewindow_x11.h +++ b/dggui/nativewindow_x11.h @@ -33,7 +33,7 @@  #include "nativewindow.h" -namespace GUI +namespace dggui  {  class Window; @@ -96,4 +96,4 @@ private:  	EventQueue event_queue;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/painter.cc b/dggui/painter.cc index f746f83..c326601 100644 --- a/plugingui/painter.cc +++ b/dggui/painter.cc @@ -35,7 +35,7 @@  #include "image.h"  #include "canvas.h" -namespace GUI +namespace dggui  {  Painter::Painter(Canvas& canvas) @@ -641,4 +641,4 @@ void Painter::drawBar(int x, int y, const Bar& bar, int width, int height)  	                   bar.right->width(), height);  } -} // GUI:: +} // dggui:: diff --git a/plugingui/painter.h b/dggui/painter.h index 9bf7fbf..09c490d 100644 --- a/plugingui/painter.h +++ b/dggui/painter.h @@ -31,7 +31,7 @@  #include "colour.h"  #include "pixelbuffer.h" -namespace GUI +namespace dggui  {  class Font; @@ -100,4 +100,4 @@ void Painter::draw(Iterator begin, Iterator end, int x_offset, int y_offset, Col  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/pixelbuffer.cc b/dggui/pixelbuffer.cc index 3c666cd..531ac22 100644 --- a/plugingui/pixelbuffer.cc +++ b/dggui/pixelbuffer.cc @@ -32,7 +32,7 @@  #include <cstring>  #include <algorithm> -namespace GUI +namespace dggui  {  PixelBuffer::PixelBuffer(std::size_t width, std::size_t height) @@ -366,4 +366,4 @@ const std::uint8_t* PixelBufferAlpha::getLine(std::size_t x, std::size_t y) cons  	return buf + (x + y * width) * 4;  } -} // GUI:: +} // dggui:: diff --git a/plugingui/pixelbuffer.h b/dggui/pixelbuffer.h index 5c11d14..58fec00 100644 --- a/plugingui/pixelbuffer.h +++ b/dggui/pixelbuffer.h @@ -34,7 +34,7 @@  #include "guievent.h" -namespace GUI +namespace dggui  {  class PixelBuffer @@ -98,4 +98,4 @@ public:  	bool has_last{false};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/powerbutton.cc b/dggui/powerbutton.cc index 5bf2a2c..8a204f2 100644 --- a/plugingui/powerbutton.cc +++ b/dggui/powerbutton.cc @@ -28,7 +28,7 @@  #include "painter.h" -namespace GUI +namespace dggui  {  PowerButton::PowerButton(Widget* parent) : Toggle(parent) @@ -85,4 +85,4 @@ void PowerButton::repaintEvent(RepaintEvent* repaintEvent)  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/powerbutton.h b/dggui/powerbutton.h index 14dbeca..a752c53 100644 --- a/plugingui/powerbutton.h +++ b/dggui/powerbutton.h @@ -29,7 +29,7 @@  #include "texture.h"  #include "toggle.h" -namespace GUI +namespace dggui  {  class PowerButton : public Toggle @@ -55,4 +55,4 @@ private:  	Texture disabled_clicked{getImageCache(), ":resources/bypass_button.png", 80, 0, 16, 16};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/progressbar.cc b/dggui/progressbar.cc index dd3e130..1f833f9 100644 --- a/plugingui/progressbar.cc +++ b/dggui/progressbar.cc @@ -26,7 +26,7 @@   */  #include "progressbar.h" -namespace GUI +namespace dggui  {  ProgressBar::ProgressBar(Widget *parent) @@ -101,4 +101,4 @@ void ProgressBar::repaintEvent(RepaintEvent* repaintEvent)  } -} // GUI:: +} // dggui:: diff --git a/plugingui/progressbar.h b/dggui/progressbar.h index 76cc6fd..a67687b 100644 --- a/plugingui/progressbar.h +++ b/dggui/progressbar.h @@ -32,7 +32,7 @@  #include "painter.h"  #include "texturedbox.h" -namespace GUI +namespace dggui  {  enum class ProgressBarState @@ -86,4 +86,4 @@ private:  	std::size_t value{0};  }; -} // GUI:: +} // dggui:: diff --git a/dggui/rc_data.cc b/dggui/rc_data.cc new file mode 100644 index 0000000..18e3cd5 --- /dev/null +++ b/dggui/rc_data.cc @@ -0,0 +1,29 @@ +/* -*- Mode: c++ -*- */ +/*************************************************************************** + *            rc_data.cc + * + *  Wed Dec 23 09:51:20 CET 2020 + *  Copyright 2020 Bent Bisballe Nyeng + *  deva@aasimon.org + ****************************************************************************/ + +/* + *  This file is part of DrumGizmo. + * + *  DrumGizmo is free software; you can redistribute it and/or modify + *  it under the terms of the GNU Lesser General Public License as published by + *  the Free Software Foundation; either version 3 of the License, or + *  (at your option) any later version. + * + *  DrumGizmo 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 Lesser General Public License for more details. + * + *  You should have received a copy of the GNU Lesser General Public License + *  along with DrumGizmo; if not, write to the Free Software + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. + */ +#include "resource_data.h" + +const rc_data_t* rc_data __attribute__((__weak__)) = nullptr; diff --git a/plugingui/rcgen.cc b/dggui/rcgentool.cc index f7b5590..c0ba0db 100644 --- a/plugingui/rcgen.cc +++ b/dggui/rcgentool.cc @@ -117,9 +117,9 @@ int main(int argc, char *argv[])  	}  	fprintf(out, "/* This file is autogenerated by rcgen. Do not modify! */\n"); -	fprintf(out, "#include \"resource_data.h\"\n"); +	fprintf(out, "#include <dggui/resource_data.h>\n");  	fprintf(out, "\n"); -	fprintf(out, "const rc_data_t rc_data[] =\n"); +	fprintf(out, "const rc_data_t rc_dataX[] =\n");  	fprintf(out, "{\n");  	if(!dirRoot.empty()) @@ -186,5 +186,7 @@ int main(int argc, char *argv[])  	fprintf(out, "	{ \"\", 0, 0 }\n");  	fprintf(out, "};\n"); +	fprintf(out, "\nconst rc_data_t* rc_data = rc_dataX;\n"); +  	return 0;  } diff --git a/plugingui/resource.cc b/dggui/resource.cc index 44f5540..1e4d95e 100644 --- a/plugingui/resource.cc +++ b/dggui/resource.cc @@ -41,7 +41,9 @@  // rcgen generated file containing rc_data declaration.  #include "resource_data.h" -namespace GUI +extern const rc_data_t* rc_data; + +namespace dggui  {  // TODO: Replace with std::filesystem::is_regular_file once we update the @@ -77,7 +79,7 @@ Resource::Resource(const std::string& name)  		// Find internal resource in rc_data.  		const rc_data_t* p = rc_data; -		while(*p->name) // last entry in rc_data has the name := "" +		while(p && *p->name) // last entry in rc_data has the name := ""  		{  			if(name == p->name)  			{ @@ -189,4 +191,4 @@ bool Resource::valid()  	return isValid;  } -} // GUI:: +} // dggui:: diff --git a/plugingui/resource.h b/dggui/resource.h index 5f7b3b4..f298287 100644 --- a/plugingui/resource.h +++ b/dggui/resource.h @@ -28,9 +28,11 @@  #include <string> -namespace GUI { +namespace dggui +{ -class Resource { +class Resource +{  public:  	Resource(const std::string& name); @@ -47,4 +49,4 @@ protected:  	size_t internalSize{0};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/resource_data.h b/dggui/resource_data.h index 337caf6..0da3720 100644 --- a/plugingui/resource_data.h +++ b/dggui/resource_data.h @@ -26,10 +26,9 @@   */  #pragma once -typedef struct { +struct rc_data_t +{  	const char *name;  	unsigned int size;  	const char *data; -} rc_data_t; - -extern const rc_data_t rc_data[]; +}; diff --git a/plugingui/scrollbar.cc b/dggui/scrollbar.cc index 9a17d1d..e78aab3 100644 --- a/plugingui/scrollbar.cc +++ b/dggui/scrollbar.cc @@ -30,7 +30,8 @@  #include "painter.h" -namespace GUI { +namespace dggui +{  ScrollBar::ScrollBar(Widget *parent)  	: Widget(parent) @@ -211,4 +212,4 @@ void ScrollBar::buttonEvent(ButtonEvent* buttonEvent)  	dragging = (buttonEvent->direction == Direction::down);  } -} // GUI:: +} // dggui:: diff --git a/plugingui/scrollbar.h b/dggui/scrollbar.h index 5e60673..9bc4de8 100644 --- a/plugingui/scrollbar.h +++ b/dggui/scrollbar.h @@ -32,9 +32,12 @@  #include "texture.h"  #include "notifier.h" -namespace GUI { +namespace dggui +{ -class ScrollBar : public Widget { +class ScrollBar +	: public Widget +{  	friend class ListBoxBasic;  public:  	ScrollBar(Widget *parent); @@ -71,4 +74,4 @@ private:  	Texture bg_img{getImageCache(), ":resources/widget.png", 7, 7, 1, 63};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/slider.cc b/dggui/slider.cc index 15a82b3..bb42f34 100644 --- a/plugingui/slider.cc +++ b/dggui/slider.cc @@ -31,7 +31,7 @@  #include <hugin.hpp>  #include <stdio.h> -namespace GUI +namespace dggui  {  Slider::Slider(Widget* parent) : Widget(parent) @@ -214,4 +214,4 @@ void Slider::recomputeCurrentValue(float x)  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/slider.h b/dggui/slider.h index 90905fd..b249c91 100644 --- a/plugingui/slider.h +++ b/dggui/slider.h @@ -30,7 +30,7 @@  #include "texturedbox.h"  #include "widget.h" -namespace GUI +namespace dggui  {  class Slider @@ -150,4 +150,4 @@ private:  	void recomputeCurrentValue(float x);  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/stackedwidget.cc b/dggui/stackedwidget.cc index 05f8f3c..a89dc04 100644 --- a/plugingui/stackedwidget.cc +++ b/dggui/stackedwidget.cc @@ -26,7 +26,7 @@   */  #include "stackedwidget.h" -namespace GUI +namespace dggui  {  StackedWidget::StackedWidget(Widget *parent) @@ -148,4 +148,4 @@ void StackedWidget::sizeChanged(int width, int height)  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/stackedwidget.h b/dggui/stackedwidget.h index 24213f7..a08065b 100644 --- a/plugingui/stackedwidget.h +++ b/dggui/stackedwidget.h @@ -31,7 +31,7 @@  #include "widget.h"  #include "notifier.h" -namespace GUI +namespace dggui  {  //! A StackedWidget is a widget containing a list of widgets but only showing @@ -78,4 +78,4 @@ private:  	std::list<Widget*> widgets;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/tabbutton.cc b/dggui/tabbutton.cc index 6a27f61..a2b0549 100644 --- a/plugingui/tabbutton.cc +++ b/dggui/tabbutton.cc @@ -28,7 +28,7 @@  #include "painter.h" -namespace GUI +namespace dggui  {  static TabID getNextTabID() @@ -129,4 +129,4 @@ void TabButton::clickHandler()  	switchTabNotifier(tab_widget);  } -} // GUI:: +} // dggui:: diff --git a/plugingui/tabbutton.h b/dggui/tabbutton.h index 1e9371a..ac9a37c 100644 --- a/plugingui/tabbutton.h +++ b/dggui/tabbutton.h @@ -32,7 +32,7 @@  #include "font.h"  #include "texturedbox.h" -namespace GUI +namespace dggui  {  class ScrollEvent; @@ -82,4 +82,4 @@ private:  	Font font{":resources/fontemboss.png"};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/tabwidget.cc b/dggui/tabwidget.cc index 635f1bd..1714472 100644 --- a/plugingui/tabwidget.cc +++ b/dggui/tabwidget.cc @@ -28,7 +28,7 @@  #include "painter.h" -namespace GUI +namespace dggui  {  TabWidget::TabWidget(Widget *parent) @@ -211,4 +211,4 @@ const TabButton* TabWidget::getButtonFromWidget(const Widget* tab_widget)  	return nullptr;  } -} // GUI:: +} // dggui:: diff --git a/plugingui/tabwidget.h b/dggui/tabwidget.h index 129826a..750ed59 100644 --- a/plugingui/tabwidget.h +++ b/dggui/tabwidget.h @@ -31,7 +31,7 @@  #include "stackedwidget.h"  #include "texture.h" -namespace GUI +namespace dggui  {  class TabWidget @@ -81,4 +81,4 @@ private:  	std::size_t tab_width{64};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/textedit.cc b/dggui/textedit.cc index 9688b82..f8aeab7 100644 --- a/plugingui/textedit.cc +++ b/dggui/textedit.cc @@ -28,7 +28,7 @@  #include "painter.h" -namespace GUI +namespace dggui  {  TextEdit::TextEdit(Widget* parent) : Widget(parent), scroll(this) @@ -198,4 +198,4 @@ void TextEdit::scrolled(int value)  	redraw();  } -} // GUI:: +} // dggui:: diff --git a/plugingui/textedit.h b/dggui/textedit.h index 17a04ff..c07774b 100644 --- a/plugingui/textedit.h +++ b/dggui/textedit.h @@ -35,7 +35,7 @@  #include "texturedbox.h"  #include "widget.h" -namespace GUI +namespace dggui  {  class TextEdit @@ -89,4 +89,4 @@ private:  	std::vector<std::string> preprocessed_text;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/texture.cc b/dggui/texture.cc index 8cd7040..788835f 100644 --- a/plugingui/texture.cc +++ b/dggui/texture.cc @@ -26,7 +26,7 @@   */  #include "texture.h" -namespace GUI +namespace dggui  {  Texture::Texture(ImageCache& image_cache, const std::string& filename, @@ -69,4 +69,4 @@ bool Texture::hasAlpha() const  	return true;  } -} // GUI:: +} // dggui:: diff --git a/plugingui/texture.h b/dggui/texture.h index c751ed4..d75b47a 100644 --- a/plugingui/texture.h +++ b/dggui/texture.h @@ -32,7 +32,7 @@  #include "imagecache.h"  #include "image.h" -namespace GUI +namespace dggui  {  class Texture @@ -61,4 +61,4 @@ private:  	Colour outOfRange{0.0f, 0.0f, 0.0f, 0.0f};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/texturedbox.cc b/dggui/texturedbox.cc index e48353a..c19b8d6 100644 --- a/plugingui/texturedbox.cc +++ b/dggui/texturedbox.cc @@ -28,7 +28,7 @@  #include <cassert> -namespace GUI +namespace dggui  {  TexturedBox::TexturedBox(ImageCache& image_cache, const std::string& filename, @@ -144,4 +144,4 @@ bool TexturedBox::hasAlpha() const  	return true;  } -} // GUI:: +} // dggui:: diff --git a/plugingui/texturedbox.h b/dggui/texturedbox.h index 7aa3967..48febba 100644 --- a/plugingui/texturedbox.h +++ b/dggui/texturedbox.h @@ -30,7 +30,7 @@  #include "imagecache.h"  #include "texture.h" -namespace GUI +namespace dggui  {  class TexturedBox @@ -116,4 +116,4 @@ private:  	Colour outOfRange{0.0f, 0.0f, 0.0f, 0.0f};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/toggle.cc b/dggui/toggle.cc index 39587de..e655a65 100644 --- a/plugingui/toggle.cc +++ b/dggui/toggle.cc @@ -26,7 +26,7 @@   */  #include "toggle.h" -namespace GUI +namespace dggui  {  Toggle::Toggle(Widget* parent) : Widget(parent) @@ -107,4 +107,4 @@ void Toggle::internalSetChecked(bool checked)  	redraw();  } -} // GUI:: +} // dggui:: diff --git a/plugingui/toggle.h b/dggui/toggle.h index 3466459..0fa844b 100644 --- a/plugingui/toggle.h +++ b/dggui/toggle.h @@ -30,7 +30,7 @@  #include <notifier.h> -namespace GUI +namespace dggui  {  class Toggle : public Widget @@ -67,4 +67,4 @@ private:  	void internalSetChecked(bool checked);  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/tooltip.cc b/dggui/tooltip.cc index e251ed5..b55b45e 100644 --- a/plugingui/tooltip.cc +++ b/dggui/tooltip.cc @@ -31,7 +31,7 @@  #include "window.h"  #include <iostream> -namespace GUI +namespace dggui  {  Tooltip::Tooltip(Widget *parent) @@ -197,4 +197,4 @@ void Tooltip::buttonEvent(ButtonEvent* buttonEvent)  	}  } -} // GUI:: +} // dggui:: diff --git a/plugingui/tooltip.h b/dggui/tooltip.h index 9d1619d..1ba1cd8 100644 --- a/plugingui/tooltip.h +++ b/dggui/tooltip.h @@ -36,7 +36,7 @@  #include "texturedbox.h"  #include "font.h" -namespace GUI +namespace dggui  {  class Tooltip @@ -75,4 +75,4 @@ private:  	Widget* activating_widget;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/uitranslation.cc b/dggui/uitranslation.cc index 0546be8..c12d646 100644 --- a/plugingui/uitranslation.cc +++ b/dggui/uitranslation.cc @@ -30,6 +30,9 @@  #include "resource.h" +namespace dggui +{ +  UITranslation::UITranslation()  {  	auto lang = Translation::getISO639LanguageName(); @@ -37,7 +40,7 @@ UITranslation::UITranslation()  	std::string res = ":locale/";  	res += lang + ".mo"; -	GUI::Resource mo(res); +	Resource mo(res);  	if(!mo.valid())  	{  		printf("Locale not in resources - use default\n"); @@ -48,4 +51,5 @@ UITranslation::UITranslation()  	load(mo.data(), mo.size());  } +} // ::dggui  #endif // WITH_NLS diff --git a/plugingui/uitranslation.h b/dggui/uitranslation.h index 5341255..3258e21 100644 --- a/plugingui/uitranslation.h +++ b/dggui/uitranslation.h @@ -31,6 +31,9 @@  #include <translation.h>  #ifdef WITH_NLS +namespace dggui +{ +  class UITranslation  	: public Translation  { @@ -38,4 +41,6 @@ public:  	UITranslation();  	~UITranslation() = default;  }; + +} // ::dggui  #endif diff --git a/plugingui/utf8.cc b/dggui/utf8.cc index 747e726..c516f52 100644 --- a/plugingui/utf8.cc +++ b/dggui/utf8.cc @@ -26,6 +26,9 @@   */  #include "utf8.h" +namespace dggui +{ +  UTF8::UTF8()  {  	// Encode Map @@ -359,3 +362,5 @@ std::string UTF8::toLatin1(std::string const& s)  	return ret;  } + +} // ::dggui diff --git a/plugingui/utf8.h b/dggui/utf8.h index 04c26b1..c7cf2ac 100644 --- a/plugingui/utf8.h +++ b/dggui/utf8.h @@ -29,6 +29,9 @@  #include <string>  #include <unordered_map> +namespace dggui +{ +  // Class to convert utf8 to latin1 and the other way around.  class UTF8  { @@ -45,3 +48,5 @@ private:  	std::unordered_map<std::string, std::string> map_encode;  	std::unordered_map<std::string, std::string> map_decode;  }; + +} // ::dggui diff --git a/plugingui/verticalline.cc b/dggui/verticalline.cc index 6a3a98a..d068b82 100644 --- a/plugingui/verticalline.cc +++ b/dggui/verticalline.cc @@ -28,7 +28,8 @@  #include "painter.h" -namespace GUI { +namespace dggui +{  VerticalLine::VerticalLine(Widget *parent)  	: Widget(parent) @@ -48,4 +49,4 @@ void VerticalLine::repaintEvent(RepaintEvent* repaintEvent)  	                     vline, width(), vline.height());  } -} // GUI:: +} // dggui:: diff --git a/plugingui/verticalline.h b/dggui/verticalline.h index 3403244..2479d0d 100644 --- a/plugingui/verticalline.h +++ b/dggui/verticalline.h @@ -29,9 +29,12 @@  #include "widget.h"  #include "image.h" -namespace GUI { +namespace dggui +{ -class VerticalLine : public Widget { +class VerticalLine +	: public Widget +{  public:  	VerticalLine(Widget* parent);  	virtual ~VerticalLine() = default; @@ -44,4 +47,4 @@ private:  	Image vline;  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/widget.cc b/dggui/widget.cc index da6b1e2..077fa72 100644 --- a/plugingui/widget.cc +++ b/dggui/widget.cc @@ -31,7 +31,7 @@  #include "painter.h"  #include "window.h" -namespace GUI +namespace dggui  {  Widget::Widget(Widget* parent) @@ -294,4 +294,4 @@ std::size_t Widget::translateToWindowY()  	return window_y;  } -} // GUI:: +} // dggui:: diff --git a/plugingui/widget.h b/dggui/widget.h index b9436b7..bf391c5 100644 --- a/plugingui/widget.h +++ b/dggui/widget.h @@ -34,7 +34,7 @@  #include <vector> -namespace GUI +namespace dggui  {  struct Point @@ -136,4 +136,4 @@ protected:  	bool dirty{true};  }; -} // GUI:: +} // dggui:: diff --git a/plugingui/window.cc b/dggui/window.cc index 5e0ad31..19af2ad 100644 --- a/plugingui/window.cc +++ b/dggui/window.cc @@ -44,7 +44,7 @@  #include "nativewindow_pugl.h"  #endif // !UI_PUGL -namespace GUI +namespace dggui  {  Window::Window(void* native_window) @@ -263,4 +263,4 @@ bool Window::updateBuffer()  	return true;  } -} // GUI:: +} // dggui:: diff --git a/plugingui/window.h b/dggui/window.h index 6031500..5f6952f 100644 --- a/plugingui/window.h +++ b/dggui/window.h @@ -34,7 +34,7 @@  #include "eventhandler.h"  #include "imagecache.h" -namespace GUI +namespace dggui  {  class Window @@ -116,4 +116,4 @@ protected:  	ImageCache image_cache;  }; -} // GUI:: +} // dggui:: diff --git a/drumgizmo/Makefile.am b/drumgizmo/Makefile.am index 2cb46bf..7702b2e 100644 --- a/drumgizmo/Makefile.am +++ b/drumgizmo/Makefile.am @@ -77,6 +77,10 @@ drumgizmo_SOURCES += input/ossmidi.cc  drumgizmo_CXXFLAGS += -DHAVE_INPUT_OSSMIDI  endif # HAVE_INPUT_OSSMIDI +if HAVE_INPUT_ALSAMIDI +drumgizmo_SOURCES += input/alsamidi.cc +drumgizmo_CXXFLAGS += -DHAVE_INPUT_ALSAMIDI +endif # HAVE_INPUT_ALSAMIDI  # Only compile jackclient.cc if at least one of the jack modules are included.  if HAVE_OUTPUT_JACKAUDIO @@ -93,6 +97,7 @@ EXTRA_DIST = \  	input/inputdummy.h \  	input/test.h \  	input/jackmidi.h \ +	input/alsamidi.h \  	input/midifile.h \  	input/ossmidi.h \  	output/alsa.h \ @@ -109,7 +114,7 @@ dgvalidator_CXXFLAGS = \  	-I$(top_srcdir)/src -I$(top_srcdir)/getoptpp \  	-I$(top_srcdir)/hugin -DWITH_HUG_MUTEX -DWITH_HUG_FILTER \  	$(SSEFLAGS) \ -	-I$(top_srcdir)/plugingui \ +	-I$(top_srcdir)/ \  	-DLODEPNG_NO_COMPILE_ENCODER \  	-DLODEPNG_NO_COMPILE_DISK \  	-DLODEPNG_NO_COMPILE_ANCILLARY_CHUNKS \ @@ -122,9 +127,9 @@ dgvalidator_SOURCES = \  	dgvalidator.cc \  	$(top_srcdir)/hugin/hugin.c \  	$(top_srcdir)/hugin/hugin_filter.c \ -	$(top_srcdir)/plugingui/lodepng/lodepng.cpp \ -	$(top_srcdir)/plugingui/image.cc \ -	$(top_srcdir)/plugingui/resource.cc \ -	$(top_srcdir)/plugingui/colour.cc +	$(top_srcdir)/dggui/lodepng/lodepng.cpp \ +	$(top_srcdir)/dggui/image.cc \ +	$(top_srcdir)/dggui/resource.cc \ +	$(top_srcdir)/dggui/colour.cc  endif # ENABLE_CLI diff --git a/drumgizmo/dgvalidator.cc b/drumgizmo/dgvalidator.cc index 6a7c546..c4d4d46 100644 --- a/drumgizmo/dgvalidator.cc +++ b/drumgizmo/dgvalidator.cc @@ -37,8 +37,6 @@  #include <sstream>  #include <climits> -#include <lodepng/lodepng.h> -  #include <config.h>  #include <platform.h> @@ -48,11 +46,13 @@  #include <unistd.h>  #endif -#include <image.h> +#include <dggui/image.h>  // Needed for Resource class -#include <resource_data.h> -const rc_data_t rc_data[] = {}; +#include <dggui/resource_data.h> + +const rc_data_t rc_dataX[] = {}; +const rc_data_t* rc_data = rc_dataX;  namespace  { @@ -360,7 +360,7 @@ int main(int argc, char* argv[])  			else  			{  				// Check if the image_map can be loaded (is a valid png file) -				GUI::Image img(image); +				dggui::Image img(image);  				if(!img.isValid())  				{  					logger(LogLevel::Error, "Drumkit image, '" + image + @@ -392,7 +392,7 @@ int main(int argc, char* argv[])  			else  			{  				// Check if the image_map can be loaded (is a valid png file) -				GUI::Image image(image_map); +				dggui::Image image(image_map);  				if(!image.isValid())  				{  					logger(LogLevel::Error, "Drumkit image_map, '" + image_map + @@ -423,7 +423,7 @@ int main(int argc, char* argv[])  							float red   = (hex_colour >> 16 & 0xff) / 255.0f;  							float green = (hex_colour >>  8 & 0xff) / 255.0f;  							float blue  = (hex_colour >>  0 & 0xff) / 255.0f; -							GUI::Colour colour(red, green, blue); +							dggui::Colour colour(red, green, blue);  							bool found{false};  							for(int y = 0; y < image.height() && !found; ++y) @@ -548,7 +548,7 @@ int main(int argc, char* argv[])  			else  			{  				// Check if the logo can be loaded (is a valid png file) -				GUI::Image img(image); +				dggui::Image img(image);  				if(!img.isValid())  				{  					logger(LogLevel::Error, "Drumkit logo, '" + image + diff --git a/drumgizmo/drumgizmoc.cc b/drumgizmo/drumgizmoc.cc index 4853641..8eba4c9 100644 --- a/drumgizmo/drumgizmoc.cc +++ b/drumgizmo/drumgizmoc.cc @@ -34,7 +34,11 @@  #include <sstream>  #include <chrono>  #include <thread> +#ifdef HAVE_WORDEXP  #include <wordexp.h> +#else +#include <glob.h> +#endif  #include <hugin.hpp> @@ -90,6 +94,7 @@ static std::string arguments()  	output <<  		"Input engine parameters:\n"  		"  jackmidi:  midimap=<midimapfile>\n" +		"  alsamidi:  midimap=<midimapfile>\n"  		"  midifile:  file=<midifile>, speed=<tempo> (default 1.0),\n"  		"             track=<miditrack> (default -1, all tracks)\n"  		"             midimap=<midimapfile>, loop=<true|false>\n" @@ -101,7 +106,8 @@ static std::string arguments()  		"\n"  		"Output engine parameters:\n"  		"  alsa:      dev=<device> (default 'default'), frames=<frames> (default " -		"32)\n" +		"32),\n" +		"             periods=<periods> (default 3)\n"  		"             srate=<samplerate> (default 441000)\n"  		"  oss:       dev=<device> (default '/dev/dsp'), srate=<samplerate>,\n"  		"             max_fragments=<number> (default 4, see man page for more info),\n" @@ -136,6 +142,12 @@ static std::string arguments()  		"  diverse:       The importance given to choosing samples\n"  		"                 which haven't been played recently. [0,1]\n"  		"  random:        The amount of randomness added. [0,1]\n" +		"\n" +		"Voice limit parameters:\n" +		"  max:           Maximum number of voices for each instrument before\n" +		"                 old samples are ramped down. [1,30]\n" +		"  rampdown:      Time it takes for an old sample to completely fall\n" +		"                 silent. [0.01,2.0]\n"  		"\n";  	return output.str();  } @@ -146,19 +158,31 @@ std::vector<ParmToken> parseParameters(std::string &parms)  	std::string parm;  	std::string val;  	bool inval = false; +#ifdef HAVE_WORDEXP  	wordexp_t exp_result; +#else +	glob_t g; +#endif  	for(size_t i = 0; i < parms.size(); ++i)  	{  		if(parms[i] == ',')  		{ +		#ifdef HAVE_WORDEXP  			int error = wordexp(val.data(), &exp_result, 0); +		#else +			int error = glob(val.data(), 0, NULL, &g); +		#endif  			if(error)  			{  				std::cerr << "Wrong argument: ";  				std::cerr << parm << " = " << val << std::endl;  				exit(1);  			} +		#ifdef HAVE_WORDEXP  			result.push_back({parm, exp_result.we_wordv[0]}); +		#else +			result.push_back({parm, g.gl_pathv[0]}); +		#endif  			parm = "";  			val = "";  			inval = false; @@ -182,14 +206,22 @@ std::vector<ParmToken> parseParameters(std::string &parms)  	}  	if(parm != "")  	{ +	#ifdef HAVE_WORDEXP  		int error = wordexp(val.data(), &exp_result, 0); +	#else +		int error = glob(val.data(), 0, NULL, &g); +	#endif  		if(error)  		{  			std::cerr << "Wrong argument: ";  			std::cerr << parm << " = " << val << std::endl;  			exit(1);  		} +	#ifdef HAVE_WORDEXP  		result.push_back({parm, exp_result.we_wordv[0]}); +	#else +		result.push_back({parm, g.gl_pathv[0]}); +	#endif  	}  	return result;  } @@ -237,7 +269,7 @@ int main(int argc, char* argv[])  	        });  	opt.add("inputengine", required_argument, 'i', -	        "dummy|test|jackmidi|midifile  Use said event input engine.", +	        "dummy|test|jackmidi|alsamidi|midifile  Use said event input engine.",  	        [&]()  	        {  		        std::string engine = optarg; @@ -300,6 +332,7 @@ int main(int argc, char* argv[])  		        }  		        oe = factory.createOutput(engine);  		        if(ie == NULL) +		        if(oe == NULL)  		        {  			        std::cerr << "Invalid output engine: " << engine << std::endl;  			        return 1; @@ -518,6 +551,54 @@ int main(int argc, char* argv[])  		        return 0;  	        }); +	// Default is to disable voice limit +	settings.enable_voice_limit.store(false); + +	opt.add("voice-limit", no_argument, 'l', +	        "Enable voice limit.", +	        [&]() +	        { +		        settings.enable_voice_limit.store(true); +		        return 0; +	        }); + +	opt.add("voice-limitparms", required_argument, 'L', +	        "Voice limit options.", +	        [&]() +	        { +		        std::string parms = optarg; +		        auto tokens = parseParameters(parms); +		        for(auto& token : tokens) +		        { +			        if(token.key == "max") +			        { +				        auto val = atof_nol(token.value.data()); +				        if(val < 1.0 || val > 30.0) +				        { +					        std::cerr << "max range is [1, 30].\n"; +					        return 1; +				        } +				        settings.voice_limit_max.store(val); +			        } +			        else if(token.key == "rampdown") +			        { +				        auto val = atof_nol(token.value.data()); +				        if(val < 0.01 || val > 2.0) +				        { +					        std::cerr << "rampdown range is [0.01, 2.0].\n"; +					        return 1; +				        } +				        settings.voice_limit_rampdown.store(val); +			        } +			        else +			        { +				        std::cerr << "Unknown voice limitparms argument " << token.key << std::endl; +				        return 1; +			        } +		        } +		        return 0; +	        }); +  	opt.add("parameters", required_argument, 'p',  	        "Parameters for sample selection algorithm.",  	        [&]() @@ -674,6 +755,34 @@ int main(int argc, char* argv[])  		}  		std::cout << "\ndone" << std::endl;  	} +	else +	{ +		// Async loading in progress + +		// Wait until the loader has passed the kit parsing step before proceeding. +		bool parsing_done{false}; +		while(!parsing_done) +		{ +			std::this_thread::sleep_for(std::chrono::milliseconds(10)); + +			switch(settings.drumkit_load_status.load()) +			{ +			case LoadStatus::Idle: +			case LoadStatus::Parsing: +				// Not yet past the parsing step +				break; +			case LoadStatus::Loading: +			case LoadStatus::Done: +				// Past parsing step +				parsing_done = true; +				break; +			case LoadStatus::Error: +				// Kit parser error? +				std::cout << "\nFailed to load " << kitfile << std::endl; +				return 1; +			} +		} +	}  	gizmo.setSamplerate(oe->getSamplerate());  	oe->onLatencyChange(gizmo.getLatency()); diff --git a/drumgizmo/enginefactory.cc b/drumgizmo/enginefactory.cc index c93607e..6d267c3 100644 --- a/drumgizmo/enginefactory.cc +++ b/drumgizmo/enginefactory.cc @@ -49,6 +49,9 @@ EngineFactory::EngineFactory()  #ifdef HAVE_INPUT_JACKMIDI  	input.push_back("jackmidi");  #endif +#ifdef HAVE_INPUT_ALSAMIDI +	input.push_back("alsamidi"); +#endif  #ifdef HAVE_INPUT_OSS  	input.push_back("oss");  #endif @@ -118,6 +121,12 @@ std::unique_ptr<AudioInputEngine> EngineFactory::createInput(const std::string&  		return std::make_unique<JackMidiInputEngine>(*jack);  	}  #endif +#ifdef HAVE_INPUT_ALSAMIDI +	if(name == "alsamidi") +	{ +		return std::make_unique<AlsaMidiInputEngine>(); +	} +#endif  #ifdef HAVE_INPUT_OSSMIDI  	if(name == "ossmidi")  	{ diff --git a/drumgizmo/enginefactory.h b/drumgizmo/enginefactory.h index 0b37c6e..7dbc9b3 100644 --- a/drumgizmo/enginefactory.h +++ b/drumgizmo/enginefactory.h @@ -53,6 +53,10 @@  #include "input/jackmidi.h"  #endif +#ifdef HAVE_INPUT_ALSAMIDI +#include "input/alsamidi.h" +#endif +  #ifdef HAVE_INPUT_OSS  #include "input/ossmidi.h"  #endif @@ -77,11 +81,14 @@  #include "output/oss.h"  #endif -  #ifdef HAVE_INPUT_OSSMIDI  #include "input/ossmidi.h"  #endif +#ifdef HAVE_INPUT_ALSAMIDI +#include "input/alsamidi.h" +#endif +  //! Factory for various input- and output engines  class EngineFactory diff --git a/drumgizmo/input/alsamidi.cc b/drumgizmo/input/alsamidi.cc new file mode 100644 index 0000000..068ea2b --- /dev/null +++ b/drumgizmo/input/alsamidi.cc @@ -0,0 +1,196 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*************************************************************************** + *            alsamidi.cc + * + *  Copyright 2021 Volker Fischer (github.com/corrados) + ****************************************************************************/ + +/* + *  This file is part of DrumGizmo. + * + *  DrumGizmo is free software; you can redistribute it and/or modify + *  it under the terms of the GNU Lesser General Public License as published by + *  the Free Software Foundation; either version 3 of the License, or + *  (at your option) any later version. + * + *  DrumGizmo 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 Lesser General Public License for more details. + * + *  You should have received a copy of the GNU Lesser General Public License + *  along with DrumGizmo; if not, write to the Free Software + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. + */ +#include <iostream> +#include <cassert> + +#include "cpp11fix.h" // required for c++11 +#include "alsamidi.h" + +struct AlsaMidiInitError +{ +	int const code; +	const std::string msg; + +	AlsaMidiInitError(int op_code, const std::string& msg) +		: code{op_code} +		, msg{msg} +	{ +	} + +	static inline void test(int code, const std::string& msg) +	{ +		if(code < 0) +		{ +			throw AlsaMidiInitError(code, msg); +		} +	} +}; + +AlsaMidiInputEngine::AlsaMidiInputEngine() +	: AudioInputEngineMidi{} +	, in_port(0) +	, seq_handle{nullptr} +	, pos{0u} +	, events{} +{ +} + +AlsaMidiInputEngine::~AlsaMidiInputEngine() +{ +	if(seq_handle != nullptr) +	{ +		snd_seq_close(seq_handle); +	} +} + +bool AlsaMidiInputEngine::init(const Instruments& instruments) +{ +	if(!loadMidiMap(midimap_file, instruments)) +	{ +		std::cerr << "[AlsaMidiInputEngine] Failed to parse midimap '" +		          << midimap_file << "'\n"; +		return false; +	} + +	// try to initialize alsa MIDI +	try +	{ +		// it is not allowed to block in the run() function, therefore we +		// have to use a non-blocking mode +		int value = snd_seq_open(&seq_handle, "default", +		                         SND_SEQ_OPEN_INPUT, SND_SEQ_NONBLOCK); +		AlsaMidiInitError::test(value, "snd_seq_open"); + +		value = snd_seq_set_client_name(seq_handle, "drumgizmo"); +		AlsaMidiInitError::test(value, "snd_seq_set_client_name"); + +		in_port = +			snd_seq_create_simple_port(seq_handle, "listen:in", +			                           SND_SEQ_PORT_CAP_WRITE | +			                           SND_SEQ_PORT_CAP_SUBS_WRITE, +			                           SND_SEQ_PORT_TYPE_APPLICATION); +		AlsaMidiInitError::test(in_port, "snd_seq_create_simple_port"); +	} +	catch(AlsaMidiInitError const& error) +	{ +		std::cerr << "[AlsaMidiInputEngine] " << error.msg +		          << " failed: " << snd_strerror(error.code) << std::endl; +		return false; +	} + +	return true; +} + +void AlsaMidiInputEngine::setParm(const std::string& parm, +                                  const std::string& value) +{ +	if(parm == "midimap") +	{ +		// apply midimap filename +		midimap_file = value; +	} +	else +	{ +		std::cerr << "[AlsaMidiInputEngine] Unsupported parameter '" << parm +		          << "'\n"; +	} +} + +bool AlsaMidiInputEngine::start() +{ +	return true; +} + +void AlsaMidiInputEngine::stop() +{ +} + +void AlsaMidiInputEngine::pre() +{ +} + +void AlsaMidiInputEngine::run(size_t pos, size_t len, +                              std::vector<event_t>& events) +{ +	assert(events.empty()); +	snd_seq_event_t* ev = NULL; +	if ( snd_seq_event_input(seq_handle, &ev) >= 0 ) +	{ +		// TODO Better solution needed: The ALSA MIDI event structure does +		// not seem to contain the raw MIDI data, therefore we have to re-create +		// the raw MIDI data based on the ALSA sequence event information. +		std::vector<uint8_t> midi_buffer(3, 0); +		bool message_type_handled = true; + +		switch(ev->type) +		{ +		case SND_SEQ_EVENT_NOTEON: +			midi_buffer[0] = ev->data.note.channel + 0x90; // NoteOn +			midi_buffer[1] = ev->data.note.note; +			midi_buffer[2] = ev->data.note.velocity; +			break; + +		case SND_SEQ_EVENT_NOTEOFF: +			midi_buffer[0] = ev->data.note.channel + 0x80; // NoteOff +			midi_buffer[1] = ev->data.note.note; +			midi_buffer[2] = ev->data.note.off_velocity; +			break; + +		case SND_SEQ_EVENT_KEYPRESS: +			midi_buffer[0] = ev->data.note.channel + 0xA0; // NoteAftertouch +			midi_buffer[1] = ev->data.note.note; +			midi_buffer[2] = ev->data.note.velocity; +			break; + +		case SND_SEQ_EVENT_CONTROLLER: +			midi_buffer[0] = ev->data.control.channel + 0xB0; // ControlChange +			midi_buffer[1] = ev->data.control.param; +			midi_buffer[2] = ev->data.control.value; +			break; + +		default: +			// unkown message type, ignore the message +			message_type_handled = false; +			break; +		} + +		if(message_type_handled) +		{ +			// since we do not want to introduce any additional delay for the +			// MIDI processing, we set the offset to zero +			processNote(midi_buffer.data(), midi_buffer.size(), 0, events); +		} +	} +	snd_seq_free_event(ev); +} + +void AlsaMidiInputEngine::post() +{ +} + +bool AlsaMidiInputEngine::isFreewheeling() const +{ +	return true; +} diff --git a/drumgizmo/input/alsamidi.h b/drumgizmo/input/alsamidi.h new file mode 100644 index 0000000..73e0fc8 --- /dev/null +++ b/drumgizmo/input/alsamidi.h @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*************************************************************************** + *            alsamidi.h + * + *  Copyright 2021 Volker Fischer (github.com/corrados) + ****************************************************************************/ + +/* + *  This file is part of DrumGizmo. + * + *  DrumGizmo is free software; you can redistribute it and/or modify + *  it under the terms of the GNU Lesser General Public License as published by + *  the Free Software Foundation; either version 3 of the License, or + *  (at your option) any later version. + * + *  DrumGizmo 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 Lesser General Public License for more details. + * + *  You should have received a copy of the GNU Lesser General Public License + *  along with DrumGizmo; if not, write to the Free Software + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. + */ +#pragma once +#include <memory> +#include <alsa/asoundlib.h> + +#include "audioinputenginemidi.h" +#include "midimapper.h" +#include "midimapparser.h" + +class AlsaMidiInputEngine +	: public AudioInputEngineMidi +{ +public: +	AlsaMidiInputEngine(); +	~AlsaMidiInputEngine(); + +	// based on AudioInputEngineMidi +	bool init(const Instruments& instruments) override; +	void setParm(const std::string& parm, const std::string& value) override; +	bool start() override; +	void stop() override; +	void pre() override; +	void run(size_t pos, size_t len, std::vector<event_t>& events) override; +	void post() override; +	bool isFreewheeling() const override; + +private: +	int in_port; +	snd_seq_t* seq_handle; + +	std::string midimap_file; +	std::size_t pos; +	std::vector<event_t> events; +}; diff --git a/drumgizmo/jackclient.cc b/drumgizmo/jackclient.cc index 8bf0939..0b05358 100644 --- a/drumgizmo/jackclient.cc +++ b/drumgizmo/jackclient.cc @@ -28,12 +28,6 @@  #include "jackclient.h" -JackProcess::~JackProcess() -{ -} - -// -------------------------------------------------------------------- -  JackPort::JackPort(JackClient& client, const std::string& name,                     const char* type, JackPortFlags flags)  	: client{client.client} // register jack port for given client @@ -57,8 +51,7 @@ int JackClient::wrapJackProcess(jack_nframes_t nframes, void* arg)  	return static_cast<JackClient*>(arg)->process(nframes);  } -void JackClient::latencyCallback(jack_latency_callback_mode_t mode, -                                 void* arg) +void JackClient::latencyCallback(jack_latency_callback_mode_t mode, void* arg)  {  	static_cast<JackClient*>(arg)->jackLatencyCallback(mode);  } @@ -92,12 +85,23 @@ JackClient::~JackClient()  void JackClient::add(JackProcess& process)  { -	processes.insert(&process); +	JackProcessContainer c; +	c.process = &process; +	processes.push_back(std::move(c));  }  void JackClient::remove(JackProcess& process)  { -	processes.erase(&process); +	// Do not erase here. Instead mark as disabled - it will be erased at next +	// JackClient::process call. +	for(auto& ptr : processes) +	{ +		if(ptr.process == &process) +		{ +			ptr.active = false; +		} +	} +	dirty = true;  }  void JackClient::activate() @@ -111,10 +115,30 @@ void JackClient::activate()  int JackClient::process(jack_nframes_t num_frames)  { +	// Clear out any inactive processes before iterating +	if(dirty) +	{ +		auto it = processes.begin(); +		while(it != processes.end()) +		{ +			if(it->active == false) +			{ +				it = processes.erase(it); +			} +			else +			{ +				it++; +			} +		} + +		dirty = false; +	} +  	for(auto& ptr : processes)  	{ -		ptr->process(num_frames); +		ptr.process->process(num_frames);  	} +  	return 0;  } @@ -122,7 +146,7 @@ void JackClient::jackLatencyCallback(jack_latency_callback_mode_t mode)  {  	for(auto& ptr : processes)  	{ -		ptr->jackLatencyCallback(mode); +		ptr.process->jackLatencyCallback(mode);  	}  } diff --git a/drumgizmo/jackclient.h b/drumgizmo/jackclient.h index f769ab4..04d6654 100644 --- a/drumgizmo/jackclient.h +++ b/drumgizmo/jackclient.h @@ -27,7 +27,7 @@  #pragma once  #include <vector>  #include <string> -#include <set> +#include <list>  #include <jack/jack.h> @@ -38,7 +38,7 @@ class JackClient;  class JackProcess  {  public: -	virtual ~JackProcess(); +	virtual ~JackProcess() = default;  	virtual void process(jack_nframes_t num_frames) = 0;  	virtual void jackLatencyCallback(jack_latency_callback_mode_t mode) {}  }; @@ -76,7 +76,13 @@ public:  private:  	jack_client_t* client; -	std::set<JackProcess*> processes; +	bool dirty{false}; +	struct JackProcessContainer +	{ +		JackProcess *process; +		bool active{true}; +	}; +	std::list<JackProcessContainer> processes;  	bool is_active;  	bool is_freewheeling; diff --git a/drumgizmo/output/alsa.cc b/drumgizmo/output/alsa.cc index f340c30..db7932b 100644 --- a/drumgizmo/output/alsa.cc +++ b/drumgizmo/output/alsa.cc @@ -58,6 +58,7 @@ AlsaOutputEngine::AlsaOutputEngine()  	, dev{"default"}  	, srate{44100}  	, frames{32} +	, periods{3}  {  } @@ -104,6 +105,9 @@ bool AlsaOutputEngine::init(const Channels& channels)  		value =  		    snd_pcm_hw_params_set_period_size_near(handle, params, &frames, 0);  		AlsaInitError::test(value, "snd_pcm_hw_params_set_period_size_near"); +		value = +		    snd_pcm_hw_params_set_periods_near(handle, params, &periods, 0); +		AlsaInitError::test(value, "snd_pcm_hw_params_set_periods_near");  		value = snd_pcm_hw_params(handle, params);  		AlsaInitError::test(value, "snd_pcm_hw_params");  	} @@ -140,6 +144,19 @@ void AlsaOutputEngine::setParm(const std::string& parm, const std::string& value  			          << "\n";  		}  	} +	else if(parm == "periods") +	{ +		// try to apply number of periods +		try +		{ +			periods = std::stoi(value); +		} +		catch(...) +		{ +			std::cerr << "[AlsaOutputEngine] Invalid number of periods " << value +			          << "\n"; +		} +	}  	else if(parm == "srate")  	{  		try @@ -184,7 +201,28 @@ void AlsaOutputEngine::run(int ch, sample_t* samples, size_t nsamples)  void AlsaOutputEngine::post(size_t nsamples)  {  	// Write the interleaved buffer to the soundcard -	snd_pcm_writei(handle, data.data(), nsamples); +	snd_pcm_sframes_t value = snd_pcm_writei(handle, data.data(), nsamples); + +	if(value == -EPIPE) // under-run +	{ +		snd_pcm_prepare(handle); +	} +	else if(value == -ESTRPIPE) +	{ +		while((value = snd_pcm_resume(handle)) == -EAGAIN) +		{ +			sleep(1); // wait until the suspend flag is released +		} +		if(value < 0) +		{ +			snd_pcm_prepare(handle); +		} +	} +} + +size_t AlsaOutputEngine::getBufferSize() const +{ +	return frames;  }  size_t AlsaOutputEngine::getSamplerate() const diff --git a/drumgizmo/output/alsa.h b/drumgizmo/output/alsa.h index 56011b6..96baf44 100644 --- a/drumgizmo/output/alsa.h +++ b/drumgizmo/output/alsa.h @@ -49,6 +49,7 @@ public:  	void pre(size_t nsamples) override;  	void run(int ch, sample_t* samples, size_t nsamples) override;  	void post(size_t nsamples) override; +	size_t getBufferSize() const override;  	size_t getSamplerate() const override;  	bool isFreewheeling() const override; @@ -61,4 +62,5 @@ private:  	std::string dev;  	unsigned int srate; // samplerate  	snd_pcm_uframes_t frames; +	unsigned int periods;  }; diff --git a/man/drumgizmo.1 b/man/drumgizmo.1 index ac8628e..43b0a29 100644 --- a/man/drumgizmo.1 +++ b/man/drumgizmo.1 @@ -176,6 +176,23 @@ Higher value makes it more likely that a sample further  away from the input velocity will be played. [0,4.5])  .RE +\fB-l, --voice-limit\fR +.RS 7 +Enable voice limit. + +.RE +\fB-L, --voice-limitparms parmlist\fR +.RS 7 +Voice limit options. + +.P +\fBmax\fR=<val> (Maximum number of voices for each instrument before +old samples are ramped down. [1,30]) +.P +\fBrampdown\fR=<val> (Time it takes for an old sample to completely fall +silent. [0.01,2.0]) + +.RE  \fB-p, --parameters parmlist\fR  .RS 7  Parameters for the sample selection algorithm. diff --git a/man/drumgizmo.fr.1 b/man/drumgizmo.fr.1 index 1d7f891..794d762 100644 --- a/man/drumgizmo.fr.1 +++ b/man/drumgizmo.fr.1 @@ -155,21 +155,55 @@ Options du timing de l'humaniseur.  \fBregain\fR=<val> (Contrôle la rapidité avec laquelle le batteur se rattrape au tempo. [0; 1])  .RE +\fB-t, --velocity-humanizer\fR +.RS 7 +Permet d'adapter les vitesses d'entrée pour obtenir un son plus réaliste. + +.RE +\fB-T, --velocity-humanizerparms parmlist\fR +.RS 7 +Options de l'humaniseur de vélocité. + +.P +\fBattack\fR=<val> (La vitesse à laquelle la vélocité est réduite lorsque vous jouez des notes rapides. +Des valeurs plus faibles entraînent une réduction plus rapide de la vitesse. [0,1]) +.P +\fBrelease\fR=<val> (La vitesse à laquelle le batteur retrouve la vélocité +lorsqu'il y a des espaces entre les notes. Des valeurs plus faibles entraînent une reprise plus rapide. [0,1]) +.P +\fBstddev\fR=<val> (L'écart-type pour l'humaniseur de vitesse. +Une valeur plus élevée rend plus probable qu'un échantillon +plus éloigné de la vélocité d'entrée soit joué. [0,4.5]) + +.RE +\fB-l, --voice-limit\fR +.RS 7 +Activer la limite vocale. + +.RE +\fB-L, --voice-limitparms parmlist\fR +.RS 7 +Options de limite de voix. + +.P +\fBmax\fR=<val> (Nombre maximum de voix pour chaque instrument avant +que les anciens échantillons ne soient réduits. [1,30]) +.P +\fBrampdown\fR=<val> (Temps qu'il faut à un ancien échantillon pour +devenir complètement silencieux. [0.01,2.0]) + +.RE  \fB-p, --parameters parmlist\fR  .RS 7  Paramètres de l'algorithme de sélection des échantillons.  .P  \fBclose\fR=<val> (L'importance accordée au choix d'un échantillon proche de  -la valeur réelle de la vitesse (après humanisation) [0; 16]) +la valeur réelle de la vitesse (après humanisation) [0,1])  .P  \fBdiverse\fR=<val> (L'importance accordée au choix d'échantillons qui -n'ont pas été joués récemment [0; 0.5]) -.P -\fBrandom\fR=<val> (La quantité d'aléatoire ajoutée [0; 0.5]) +n'ont pas été joués récemment [0,1])  .P -\fBstddev\fR=<val> (L'écart type pour la sélection de l'échantillon. -Plus la valeur est élevée, plus il est probable qu'un échantillon -plus éloigné de la vitesse d'entrée sera joué [0; 4.5]) +\fBrandom\fR=<val> (La quantité d'aléatoire ajoutée [0,1])  .RE  \fB-v, --version\fR diff --git a/plugin/Makefile.am b/plugin/Makefile.am index f382acc..935b601 100644 --- a/plugin/Makefile.am +++ b/plugin/Makefile.am @@ -19,6 +19,7 @@ drumgizmo_la_CXXFLAGS = -DLV2 -DLV2_PLUGIN_URI=\"http://drumgizmo.org/lv2\" \  	$(LV2_CFLAGS) \  	$(SNDFILE_CFLAGS) \  	-I$(top_srcdir)/plugin/plugingizmo \ +	-I$(top_srcdir)/ \  	-I$(top_srcdir)/plugingui \  	-I$(top_srcdir)/src \  	-I$(top_srcdir)/hugin @@ -35,7 +36,7 @@ drumgizmo_la_LDFLAGS = -shared -module -avoid-version \  	-no-undefined -export-symbols $(top_srcdir)/plugin/drumgizmo_lv2.sym  drumgizmo_la_LIBADD = $(LV2_LIBS) \ -	$(top_builddir)/plugingui/libdggui.la \ +	$(top_builddir)/plugingui/libplugingui.la \  	$(top_builddir)/src/libdg.la \  	$(top_builddir)/src/libnls.la @@ -93,6 +94,7 @@ drumgizmo_vst_la_CXXFLAGS = -DVST \  	-I$(top_srcdir)/zita-resampler/libs \  	$(SNDFILE_CFLAGS) \  	-I$(top_srcdir)/plugin/plugingizmo \ +	-I$(top_srcdir)/ \  	-I$(top_srcdir)/plugingui \  	-I$(top_srcdir)/src \  	-I$(top_srcdir)/hugin \ @@ -111,7 +113,7 @@ drumgizmo_vst_la_LDFLAGS = -shared -module -avoid-version \  drumgizmo_vst_la_LIBADD = \  	vst/libvstsdk.la \ -	$(top_builddir)/plugingui/libdggui.la \ +	$(top_builddir)/plugingui/libplugingui.la \  	$(top_builddir)/src/libdg.la \  	$(top_builddir)/src/libnls.la diff --git a/plugin/Makefile.mingw32.in b/plugin/Makefile.mingw32.in index 2c2055c..ad47bcc 100644 --- a/plugin/Makefile.mingw32.in +++ b/plugin/Makefile.mingw32.in @@ -59,66 +59,70 @@ DG_CFLAGS = -I@top_srcdir@ -I@top_srcdir@/src \  GUI_SRC = \  	@top_srcdir@/plugingui/abouttab.cc \  	@top_srcdir@/plugingui/bleedcontrolframecontent.cc \ -	@top_srcdir@/plugingui/button.cc \ -	@top_srcdir@/plugingui/button_base.cc \ -	@top_srcdir@/plugingui/checkbox.cc \ -	@top_srcdir@/plugingui/colour.cc \ -	@top_srcdir@/plugingui/combobox.cc \ -	@top_srcdir@/plugingui/dialog.cc \  	@top_srcdir@/plugingui/diskstreamingframecontent.cc \  	@top_srcdir@/plugingui/drumkitframecontent.cc \  	@top_srcdir@/plugingui/drumkittab.cc \ -	@top_srcdir@/plugingui/eventhandler.cc \  	@top_srcdir@/plugingui/filebrowser.cc \ -	@top_srcdir@/plugingui/font.cc \ -	@top_srcdir@/plugingui/frame.cc \ -	@top_srcdir@/plugingui/helpbutton.cc \ -	@top_srcdir@/plugingui/humanizerframecontent.cc \  	@top_srcdir@/plugingui/humaniservisualiser.cc \ -	@top_srcdir@/plugingui/image.cc \ -	@top_srcdir@/plugingui/imagecache.cc \ -	@top_srcdir@/plugingui/knob.cc \ -	@top_srcdir@/plugingui/label.cc \ -	@top_srcdir@/plugingui/layout.cc \ -	@top_srcdir@/plugingui/led.cc \ -	@top_srcdir@/plugingui/lineedit.cc \ -	@top_srcdir@/plugingui/listbox.cc \ -	@top_srcdir@/plugingui/listboxbasic.cc \ -	@top_srcdir@/plugingui/listboxthin.cc \ +	@top_srcdir@/plugingui/humanizerframecontent.cc \  	@top_srcdir@/plugingui/maintab.cc \  	@top_srcdir@/plugingui/mainwindow.cc \ -	@top_srcdir@/plugingui/nativewindow_win32.cc \ -	@top_srcdir@/plugingui/painter.cc \ -	@top_srcdir@/plugingui/pixelbuffer.cc \  	@top_srcdir@/plugingui/pluginconfig.cc \ -	@top_srcdir@/plugingui/powerbutton.cc \  	@top_srcdir@/plugingui/powerwidget.cc \ -	@top_srcdir@/plugingui/progressbar.cc \  	@top_srcdir@/plugingui/resamplingframecontent.cc \ -	@top_srcdir@/plugingui/resource.cc \  	@top_srcdir@/plugingui/sampleselectionframecontent.cc \ -	@top_srcdir@/plugingui/scrollbar.cc \ -	@top_srcdir@/plugingui/slider.cc \ -	@top_srcdir@/plugingui/stackedwidget.cc \  	@top_srcdir@/plugingui/statusframecontent.cc \ -	@top_srcdir@/plugingui/tabbutton.cc \ -	@top_srcdir@/plugingui/tabwidget.cc \ -	@top_srcdir@/plugingui/textedit.cc \ -	@top_srcdir@/plugingui/texture.cc \ -	@top_srcdir@/plugingui/texturedbox.cc \  	@top_srcdir@/plugingui/timingframecontent.cc \ -	@top_srcdir@/plugingui/toggle.cc \ -	@top_srcdir@/plugingui/tooltip.cc \ -	@top_srcdir@/plugingui/uitranslation.cc \ -	@top_srcdir@/plugingui/utf8.cc \ -	@top_srcdir@/plugingui/verticalline.cc \  	@top_srcdir@/plugingui/visualizerframecontent.cc \  	@top_srcdir@/plugingui/voicelimitframecontent.cc \ -	@top_srcdir@/plugingui/widget.cc \ -	@top_srcdir@/plugingui/window.cc \ -	@top_srcdir@/plugingui/lodepng/lodepng.cpp +\ +	@top_srcdir@/dggui/button.cc \ +	@top_srcdir@/dggui/button_base.cc \ +	@top_srcdir@/dggui/checkbox.cc \ +	@top_srcdir@/dggui/colour.cc \ +	@top_srcdir@/dggui/combobox.cc \ +	@top_srcdir@/dggui/dialog.cc \ +	@top_srcdir@/dggui/eventhandler.cc \ +	@top_srcdir@/dggui/font.cc \ +	@top_srcdir@/dggui/frame.cc \ +	@top_srcdir@/dggui/helpbutton.cc \ +	@top_srcdir@/dggui/image.cc \ +	@top_srcdir@/dggui/imagecache.cc \ +	@top_srcdir@/dggui/knob.cc \ +	@top_srcdir@/dggui/label.cc \ +	@top_srcdir@/dggui/layout.cc \ +	@top_srcdir@/dggui/led.cc \ +	@top_srcdir@/dggui/lineedit.cc \ +	@top_srcdir@/dggui/listbox.cc \ +	@top_srcdir@/dggui/listboxbasic.cc \ +	@top_srcdir@/dggui/listboxthin.cc \ +	@top_srcdir@/dggui/painter.cc \ +	@top_srcdir@/dggui/pixelbuffer.cc \ +	@top_srcdir@/dggui/powerbutton.cc \ +	@top_srcdir@/dggui/progressbar.cc \ +	@top_srcdir@/dggui/rc_data.cc \ +	@top_srcdir@/dggui/resource.cc \ +	@top_srcdir@/dggui/scrollbar.cc \ +	@top_srcdir@/dggui/slider.cc \ +	@top_srcdir@/dggui/stackedwidget.cc \ +	@top_srcdir@/dggui/tabbutton.cc \ +	@top_srcdir@/dggui/tabwidget.cc \ +	@top_srcdir@/dggui/textedit.cc \ +	@top_srcdir@/dggui/texture.cc \ +	@top_srcdir@/dggui/texturedbox.cc \ +	@top_srcdir@/dggui/toggle.cc \ +	@top_srcdir@/dggui/tooltip.cc \ +	@top_srcdir@/dggui/uitranslation.cc \ +	@top_srcdir@/dggui/utf8.cc \ +	@top_srcdir@/dggui/verticalline.cc \ +	@top_srcdir@/dggui/widget.cc \ +	@top_srcdir@/dggui/window.cc \ +\ +	@top_srcdir@/dggui/lodepng/lodepng.cpp \ +	@top_srcdir@/dggui/nativewindow_win32.cc + -GUI_CPPFLAGS=-I@top_srcdir@/plugingui/ -DUSE_THREAD @GUI_CPPFLAGS@ +GUI_CPPFLAGS=-I@top_srcdir@/plugingui/ -I@top_srcdir@/ -DUSE_THREAD @GUI_CPPFLAGS@  GUI_LIBS=@GUI_LIBS@  DBG_SRC = \ @@ -186,9 +190,9 @@ NLS_RES = \  all:  	(cd @top_srcdir@/plugingui/locale; msgfmt -c -v -o da.mo da.po)  	(cd @top_srcdir@/plugingui/locale; msgfmt -c -v -o fr.mo fr.po) -	g++ -I@top_srcdir@/getoptpp @top_srcdir@/plugingui/rcgen.cc -o @top_srcdir@/plugingui/rcgen -	@top_srcdir@/plugingui/rcgen -s @top_srcdir@/plugingui/ -s @top_builddir@/plugingui/ $(RES) $(NLS_RES) -o @top_srcdir@/plugingui/resource_data.cc -	g++ $(CXXFLAGS) @top_srcdir@/plugingui/resource_data.cc -c +	g++ -I@top_srcdir@/getoptpp @top_srcdir@/dggui/rcgentool.cc -o @top_srcdir@/dggui/rcgen +	@top_srcdir@/dggui/rcgen -s @top_srcdir@/dggui/ -s @top_builddir@/plugingui/ $(RES) $(NLS_RES) -o @top_srcdir@/plugingui/resource_data.cc +	g++ $(CXXFLAGS) -I@top_srcdir@ @top_srcdir@/plugingui/resource_data.cc -c  	gcc $(CFLAGS) $(DBG_CFLAGS) @top_srcdir@/hugin/hugin.c -c  	gcc $(CFLAGS) $(DBG_CFLAGS) @top_srcdir@/hugin/hugin_syslog.c -c  	g++ $(LDFLAGS) $(CXXFLAGS) -std=c++11 -static -static-libgcc -O2 -g -Wall $(DBG_CFLAGS) $(DG_CFLAGS) $(DG_LIBS) $(VST_CFLAGS) hugin.o hugin_syslog.o resource_data.o $(DG_SRC) $(VST_SRC) ${SRC} ${GUI_SRC} ${GUI_CPPFLAGS} $(GUI_LIBS) $(SNDFILE_CFLAGS) $(SNDFILE_LIBS) -latomic -shared -Wl,-retain-symbols-file -Wl,drumgizmo_vst.sym -o drumgizmo_vst.dll -Wl,--out-implib,libdrumgizmo_vst.a diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc index b955eb3..7960763 100644 --- a/plugin/drumgizmo_plugin.cc +++ b/plugin/drumgizmo_plugin.cc @@ -176,7 +176,7 @@ bool DrumGizmoPlugin::hasInlineGUI()  }  class InlinePixelBufferAlpha -	: public GUI::PixelBufferAlpha +	: public dggui::PixelBufferAlpha  {  public:  	InlinePixelBufferAlpha(Plugin::InlineDrawContext& context) @@ -190,7 +190,7 @@ public:  };  class InlineCanvas -	: public GUI::Canvas +	: public dggui::Canvas  {  public:  	InlineCanvas(Plugin::InlineDrawContext& context) @@ -199,7 +199,7 @@ public:  	}  	// From Canvas: -	GUI::PixelBufferAlpha& getPixelBuffer() override +	dggui::PixelBufferAlpha& getPixelBuffer() override  	{  		return pixbuf;  	} @@ -257,7 +257,7 @@ void DrumGizmoPlugin::onInlineRedraw(std::size_t width,  		context.data = (unsigned char*)inlineDisplayBuffer;  		InlineCanvas canvas(context); -		GUI::Painter painter(canvas); +		dggui::Painter painter(canvas);  		double progress =  			(double)settingsGetter.number_of_files_loaded.getValue() / @@ -281,6 +281,7 @@ void DrumGizmoPlugin::onInlineRedraw(std::size_t width,  				bar_green.setSize(val, bar_height);  				painter.drawImage(brd, height - bar_height, bar_green);  				break; +			case LoadStatus::Parsing:  			case LoadStatus::Loading:  			case LoadStatus::Idle:  				bar_blue.setSize(val, bar_height); @@ -409,7 +410,18 @@ bool DrumGizmoPlugin::Input::loadMidiMap(const std::string& file,  	bool result = AudioInputEngineMidi::loadMidiMap(file, i);  	std::vector<std::pair<int, std::string>> midnam; -	const auto& map = mmap.getMap(); +	const auto& midimap = mmap.getMap(); +	std::map<int, std::string> map; +	for(const auto& entry : midimap) +	{ +		// in case of multiple instruments mapped to one note, use '/' as separator +		if(!map[entry.note_id].empty()) +		{ +			map[entry.note_id] += "/"; +		} +		map[entry.note_id] += entry.instrument_name; +	} +  	midnam.reserve(map.size());  	for(const auto& m : map)  	{ diff --git a/plugin/drumgizmo_plugin.h b/plugin/drumgizmo_plugin.h index 78a74dc..09cdcba 100644 --- a/plugin/drumgizmo_plugin.h +++ b/plugin/drumgizmo_plugin.h @@ -39,14 +39,14 @@  #endif  #include <drumgizmo.h> -#include <uitranslation.h>  #include <audioinputenginemidi.h>  #include <audiooutputengine.h>  #include <mainwindow.h> -#include <texturedbox.h> -#include <imagecache.h> -#include <image.h> +#include <dggui/uitranslation.h> +#include <dggui/texturedbox.h> +#include <dggui/imagecache.h> +#include <dggui/image.h>  class DrumGizmoPlugin  #ifdef LV2 @@ -188,23 +188,23 @@ private:  	ConfigStringIO config_string_io;  	SettingsGetter settingsGetter{settings}; -	GUI::ImageCache imageCache; -	GUI::TexturedBox box{imageCache, ":resources/progress.png", +	dggui::ImageCache imageCache; +	dggui::TexturedBox box{imageCache, ":resources/progress.png",  			0, 0, // atlas offset (x, y)  			6, 1, 6, // dx1, dx2, dx3  			11, 0, 0}; // dy1, dy2, dy3 -	GUI::TexturedBox bar_red{imageCache, ":resources/progress.png", +	dggui::TexturedBox bar_red{imageCache, ":resources/progress.png",  			13, 0, // atlas offset (x, y)  			2, 1, 2, // dx1, dx2, dx3  			11, 0, 0}; // dy1, dy2, dy3 -	GUI::TexturedBox bar_green{imageCache, ":resources/progress.png", +	dggui::TexturedBox bar_green{imageCache, ":resources/progress.png",  			18, 0, // atlas offset (x, y)  			2, 1, 2, // dx1, dx2, dx3  			11, 0, 0}; // dy1, dy2, dy3 -	GUI::TexturedBox bar_blue{imageCache, ":resources/progress.png", +	dggui::TexturedBox bar_blue{imageCache, ":resources/progress.png",  			23, 0, // atlas offset (x, y)  			2, 1, 2, // dx1, dx2, dx3  			11, 0, 0}; // dy1, dy2, dy3 @@ -213,10 +213,10 @@ private:  	std::shared_ptr<DrumGizmo> drumgizmo;  	std::uint32_t inlineDisplayBuffer[1024*1024]; -	GUI::Image inline_display_image{":resources/logo.png"}; +	dggui::Image inline_display_image{":resources/logo.png"};  	bool inline_image_first_draw{true};  #ifdef WITH_NLS -	UITranslation translation; +	dggui::UITranslation translation;  #endif // WITH_NLS  }; diff --git a/plugingui/Makefile.am b/plugingui/Makefile.am index d102024..706b3c9 100644 --- a/plugingui/Makefile.am +++ b/plugingui/Makefile.am @@ -1,8 +1,8 @@  SUBDIRS = locale  DISTDIRS = locale -noinst_PROGRAMS = plugingui rcgen -noinst_LTLIBRARIES = libdggui.la +noinst_PROGRAMS = plugingui +noinst_LTLIBRARIES = libplugingui.la  # If you add a file here, remember to add it to plugin/Makefile.mingw32.in  RES = \ @@ -70,14 +70,14 @@ BUILT_SOURCES = \  	resource_data.cc \  	$(NLS_RES) -resource_data.cc: rcgen$(EXEEXT) $(RES) $(NLS_RES) -	$(rcgen_verbose)./rcgen$(EXEEXT) -s $(top_srcdir)/plugingui/ -s $(top_builddir)/plugingui/ -o $@ $(RES) $(NLS_RES) +resource_data.cc: $(top_builddir)/dggui/rcgen$(EXEEXT) $(RES) $(NLS_RES) +	$(rcgen_verbose)$(top_builddir)/dggui/rcgen$(EXEEXT) -s $(top_srcdir)/plugingui/ -s $(top_builddir)/plugingui/ -o $@ $(RES) $(NLS_RES)  CLEANFILES = \  	resource_data.cc \  	$(NLS_RES) -libdggui_la_CPPFLAGS = \ +libplugingui_la_CPPFLAGS = \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir) \  	$(GUI_CPPFLAGS) \ @@ -90,205 +90,64 @@ libdggui_la_CPPFLAGS = \  	-DLODEPNG_NO_COMPILE_ERROR_TEXT \  	-DLODEPNG_NO_COMPILE_CPP -libdggui_la_CFLAGS = +libplugingui_la_CFLAGS = -libdggui_la_LIBTOOLFLAGS=--tag=CC +libplugingui_la_LIBTOOLFLAGS=--tag=CC -libdggui_la_LIBADD = \ +libplugingui_la_LIBADD = \ +	$(top_builddir)/dggui/libdggui.la \  	$(GUI_LIBS) $(PTHREAD_LIBS)  # If you add a file here, remember to add it to plugin/Makefile.mingw32.in  GUI_SRC = \  	abouttab.cc \  	bleedcontrolframecontent.cc \ -	button.cc \ -	button_base.cc \ -	checkbox.cc \ -	colour.cc \ -	combobox.cc \ -	dialog.cc \  	diskstreamingframecontent.cc \  	drumkitframecontent.cc \  	drumkittab.cc \ -	eventhandler.cc \  	filebrowser.cc \ -	font.cc \ -	frame.cc \ -	helpbutton.cc \ -	humanizerframecontent.cc \  	humaniservisualiser.cc \ -	image.cc \ -	imagecache.cc \ -	knob.cc \ -	label.cc \ -	layout.cc \ -	led.cc \ -	lineedit.cc \ -	listbox.cc \ -	listboxbasic.cc \ -	listboxthin.cc \ +	humanizerframecontent.cc \  	maintab.cc \  	mainwindow.cc \ -	painter.cc \ -	pixelbuffer.cc \  	pluginconfig.cc \ -	powerbutton.cc \  	powerwidget.cc \ -	progressbar.cc \  	resamplingframecontent.cc \ -	resource.cc \  	sampleselectionframecontent.cc \ -	scrollbar.cc \ -	slider.cc \ -	stackedwidget.cc \  	statusframecontent.cc \ -	tabbutton.cc \ -	tabwidget.cc \ -	textedit.cc \ -	texture.cc \ -	texturedbox.cc \  	timingframecontent.cc \ -	toggle.cc \ -	tooltip.cc \ -	uitranslation.cc \ -	utf8.cc \ -	verticalline.cc \  	visualizerframecontent.cc \ -	voicelimitframecontent.cc \ -	widget.cc \ -	window.cc +	voicelimitframecontent.cc  GUI_HDR = \  	abouttab.h \  	bleedcontrolframecontent.h \ -	button.h \ -	button_base.h \ -	canvas.h \ -	checkbox.h \ -	colour.h \ -	combobox.h \ -	dialog.h \  	diskstreamingframecontent.h \ -	drawable.h \  	drumkitframecontent.h \  	drumkittab.h \ -	eventhandler.h \  	filebrowser.h \ -	font.h \ -	frame.h \ -	guievent.h \ -	helpbutton.h \  	humaniservisualiser.h \  	humanizerframecontent.h \ -	image.h \ -	imagecache.h \ -	knob.h \ -	label.h \  	labeledcontrol.h \ -	layout.h \ -	led.h \ -	lineedit.h \ -	listbox.h \ -	listboxbasic.h \ -	listboxthin.h \  	maintab.h \  	mainwindow.h \ -	nativewindow.h \ -	nativewindow_cocoa.h \ -	nativewindow_cocoa.mm \ -	nativewindow_pugl.h \ -	nativewindow_pugl.cc \ -	nativewindow_win32.h \ -	nativewindow_win32.cc \ -	nativewindow_x11.h \ -	nativewindow_x11.cc \ -	painter.h \ -	pixelbuffer.h \  	pluginconfig.h \ -	powerbutton.h \  	powerwidget.h \ -	progressbar.h \  	resamplingframecontent.h \ -	resource.h \ -	resource_data.h \  	sampleselectionframecontent.h \ -	scrollbar.h \ -	slider.h \ -	stackedwidget.h \  	statusframecontent.h \ -	tabbutton.h \ -	tabwidget.h \ -	textedit.h \ -	texture.h \ -	texturedbox.h \  	timingframecontent.h \ -	toggle.h \ -	tooltip.h \ -	uitranslation.h \ -	utf8.h \ -	verticalline.h \  	visualizerframecontent.h \ -	voicelimitframecontent.h \ -	widget.h \ -	window.h +	voicelimitframecontent.h -libdggui_la_SOURCES = \ -	$(GUI_SRC) \ -	lodepng/lodepng.cpp +libplugingui_la_SOURCES = \ +	$(GUI_SRC) -nodist_libdggui_la_SOURCES = \ +nodist_libplugingui_la_SOURCES = \  	$(top_builddir)/plugingui/resource_data.cc -if ENABLE_X11 -nodist_libdggui_la_SOURCES += \ -	nativewindow_x11.cc -endif - -if ENABLE_WIN32 -nodist_libdggui_la_SOURCES += \ -	nativewindow_win32.cc -endif - -if ENABLE_COCOA -nodist_libdggui_la_SOURCES += \ -	nativewindow_cocoa.mm - -libdggui_la_OBJCXXFLAGS = \ -	-fblocks -endif - -if ENABLE_PUGL_X11 -nodist_libdggui_la_SOURCES += \ -	nativewindow_pugl.cc \ -	$(top_srcdir)/pugl/pugl/pugl_x11.c - -libdggui_la_CPPFLAGS += \ -	-I$(top_srcdir)/pugl - -libdggui_la_CFLAGS += \ -	-std=c99 -endif - -if ENABLE_PUGL_WIN32 -nodist_libdggui_la_SOURCES += \ -	nativewindow_pugl.cc \ -	$(top_srcdir)/pugl/pugl/pugl_win.cpp - -libdggui_la_CPPFLAGS += \ -	-I$(top_srcdir)/pugl -endif - -if ENABLE_PUGL_COCOA -nodist_libdggui_la_SOURCES += \ -	nativewindow_pugl.cc \ -	$(top_srcdir)/pugl/pugl/pugl_osx.m - -libdggui_la_CPPFLAGS += \ -	-I$(top_srcdir)/pugl -endif -  plugingui_LDADD = \ -	libdggui.la \ +	libplugingui.la \  	$(top_builddir)/src/libdg.la \  	$(top_builddir)/src/libnls.la @@ -297,6 +156,7 @@ plugingui_CXXFLAGS = \  	$(GUI_CPPFLAGS) \  	$(SNDFILE_CXXFLAGS) \  	$(PTHREAD_CFLAGS) \ +	-I$(top_srcdir) \  	-I$(top_srcdir)/src \  	-I$(top_srcdir)/hugin @@ -306,10 +166,6 @@ plugingui_SOURCES = \  	testmain.cc \  	$(top_srcdir)/hugin/hugin.c -rcgen_CXXFLAGS = -I$(top_srcdir)/getoptpp -rcgen_SOURCES = \ -	rcgen.cc -  EXTRA_DIST = \  	$(RES) \  	$(GUI_HDR) diff --git a/plugingui/abouttab.cc b/plugingui/abouttab.cc index 384c815..57daec3 100644 --- a/plugingui/abouttab.cc +++ b/plugingui/abouttab.cc @@ -29,21 +29,23 @@  #include <version.h>  #include <translation.h> -#include "utf8.h" +#include <dggui/utf8.h>  namespace  {  std::string getLocalizedFile(const std::string& file)  { +#ifdef WITH_NLS  	auto language = Translation::getISO639LanguageName();  	std::string file_localized = file + "." + language; -	GUI::Resource resource_localized{file_localized}; +	dggui::Resource resource_localized{file_localized};  	if(resource_localized.valid())  	{  		return resource_localized.data();  	} +#endif -	GUI::Resource resource{file}; +	dggui::Resource resource{file};  	if(resource.valid())  	{  		return resource.data(); @@ -56,8 +58,8 @@ std::string getLocalizedFile(const std::string& file)  namespace GUI  { -AboutTab::AboutTab(Widget* parent) -	: Widget(parent) +AboutTab::AboutTab(dggui::Widget* parent) +	: dggui::Widget(parent)  {  	text_edit.setText(getAboutText());  	text_edit.setReadOnly(true); @@ -68,7 +70,7 @@ AboutTab::AboutTab(Widget* parent)  void AboutTab::resize(std::size_t width, std::size_t height)  { -	Widget::resize(width, height); +	dggui::Widget::resize(width, height);  	text_edit.resize(std::max((int)width - 2*margin, 0),  	                 std::max((int)height - 2*margin, 0));  } @@ -83,7 +85,7 @@ std::string AboutTab::getAboutText()  	"             About\n"  	"=============\n"  	"\n")); -	about_text.append(UTF8().toLatin1(getLocalizedFile(":../ABOUT"))); +	about_text.append(dggui::UTF8().toLatin1(getLocalizedFile(":../ABOUT")));  	// Version  	about_text.append(_( @@ -101,7 +103,7 @@ std::string AboutTab::getAboutText()  	"            Bugs\n"  	"=============\n"  	"\n")); -	about_text.append(UTF8().toLatin1(getLocalizedFile(":../BUGS"))); +	about_text.append(dggui::UTF8().toLatin1(getLocalizedFile(":../BUGS")));  	// Authors  	about_text.append(_( @@ -110,7 +112,7 @@ std::string AboutTab::getAboutText()  	"            Authors\n"  	"=============\n"  	"\n")); -	about_text.append(UTF8().toLatin1(getLocalizedFile(":../AUTHORS"))); +	about_text.append(dggui::UTF8().toLatin1(getLocalizedFile(":../AUTHORS")));  	// GPL  	about_text.append(_( @@ -119,7 +121,7 @@ std::string AboutTab::getAboutText()  	"            License\n"  	"=============\n"  	"\n")); -	about_text.append(UTF8().toLatin1(getLocalizedFile(":../COPYING"))); +	about_text.append(dggui::UTF8().toLatin1(getLocalizedFile(":../COPYING")));  	return about_text;  } diff --git a/plugingui/abouttab.h b/plugingui/abouttab.h index ed06b1d..48c9137 100644 --- a/plugingui/abouttab.h +++ b/plugingui/abouttab.h @@ -26,9 +26,9 @@   */  #pragma once -#include "widget.h" -#include "resource.h" -#include "textedit.h" +#include <dggui/widget.h> +#include <dggui/resource.h> +#include <dggui/textedit.h>  #include <string> @@ -36,10 +36,10 @@ namespace GUI  {  class AboutTab -	: public Widget +	: public dggui::Widget  {  public: -	AboutTab(Widget* parent); +	AboutTab(dggui::Widget* parent);  	// From Widget:  	void resize(std::size_t width, std::size_t height) override; @@ -47,7 +47,7 @@ public:  private:  	std::string getAboutText(); -	TextEdit text_edit{this}; +	dggui::TextEdit text_edit{this};  	int margin{10};  }; diff --git a/plugingui/bleedcontrolframecontent.cc b/plugingui/bleedcontrolframecontent.cc index b999062..e5e46c9 100644 --- a/plugingui/bleedcontrolframecontent.cc +++ b/plugingui/bleedcontrolframecontent.cc @@ -35,19 +35,19 @@  namespace GUI  { -BleedcontrolframeContent::BleedcontrolframeContent(Widget* parent, +BleedcontrolframeContent::BleedcontrolframeContent(dggui::Widget* parent,                                                     Settings& settings,                                                     SettingsNotifier& settings_notifier) -	: Widget(parent) +	: dggui::Widget(parent)  	, slider_width{250}  	, settings(settings)  	, settings_notifier(settings_notifier)  {  	label_text.setText(_("Master Bleed Volume:")); -	label_text.setAlignment(TextAlignment::center); +	label_text.setAlignment(dggui::TextAlignment::center);  	label_value.setText(_("0 %")); -	label_value.setAlignment(TextAlignment::center); +	label_value.setAlignment(dggui::TextAlignment::center);  	CONNECT(this, settings_notifier.master_bleed,  	        this, &BleedcontrolframeContent::bleedSettingsValueChanged); @@ -57,7 +57,7 @@ BleedcontrolframeContent::BleedcontrolframeContent(Widget* parent,  void BleedcontrolframeContent::resize(std::size_t width, std::size_t height)  { -	Widget::resize(width, height); +	dggui::Widget::resize(width, height);  	slider_width = 0.8 * width;  	auto x_start = 0.1 * width; @@ -75,12 +75,14 @@ void BleedcontrolframeContent::setEnabled(bool enabled)  {  	this->enabled = enabled; -	if (enabled) { +	if(enabled) +	{  		label_text.resetColour();  		label_value.resetColour();  		slider.setEnabled(true);  	} -	else { +	else +	{  		label_text.setColour(0.7);  		label_value.setColour(0.7);  		slider.setEnabled(false); @@ -95,7 +97,7 @@ void BleedcontrolframeContent::bleedSettingsValueChanged(float value)  	int percentage = 100 * value;  	label_value.setText(std::to_string(percentage) + " %"); -	slider.setColour(Slider::Colour::Blue); +	slider.setColour(dggui::Slider::Colour::Blue);  }  void BleedcontrolframeContent::bleedValueChanged(float value) diff --git a/plugingui/bleedcontrolframecontent.h b/plugingui/bleedcontrolframecontent.h index 78733c0..fadb98e 100644 --- a/plugingui/bleedcontrolframecontent.h +++ b/plugingui/bleedcontrolframecontent.h @@ -25,9 +25,9 @@   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.   */ -#include "label.h" -#include "slider.h" -#include "widget.h" +#include <dggui/label.h> +#include <dggui/slider.h> +#include <dggui/widget.h>  struct Settings;  class SettingsNotifier; @@ -35,10 +35,11 @@ class SettingsNotifier;  namespace GUI  { -class BleedcontrolframeContent : public Widget +class BleedcontrolframeContent +	: public dggui::Widget  {  public: -	BleedcontrolframeContent(Widget* parent, +	BleedcontrolframeContent(dggui::Widget* parent,  	                         Settings& settings,  	                         SettingsNotifier& settings_notifier); @@ -53,10 +54,10 @@ private:  	bool enabled = true; -	Label label_text{this}; -	Label label_value{this}; +	dggui::Label label_text{this}; +	dggui::Label label_value{this}; -	Slider slider{this}; +	dggui::Slider slider{this};  	int slider_width; diff --git a/plugingui/diskstreamingframecontent.cc b/plugingui/diskstreamingframecontent.cc index 97937df..4c63817 100644 --- a/plugingui/diskstreamingframecontent.cc +++ b/plugingui/diskstreamingframecontent.cc @@ -35,22 +35,22 @@  namespace GUI  { -DiskstreamingframeContent::DiskstreamingframeContent(Widget* parent, +DiskstreamingframeContent::DiskstreamingframeContent(dggui::Widget* parent,                                                       Settings& settings,                                                       SettingsNotifier& settings_notifier) -	: Widget(parent) +	: dggui::Widget(parent)  	, slider_width{250}  	, settings(settings)  	, settings_notifier(settings_notifier)  {  	label_text.setText(_("Cache limit (max memory usage):")); -	label_text.setAlignment(TextAlignment::center); +	label_text.setAlignment(dggui::TextAlignment::center);  	button.setText(_("Apply"));  	button.setEnabled(false);  	label_value.setText(_("0 MB")); -	label_value.setAlignment(TextAlignment::center); +	label_value.setAlignment(dggui::TextAlignment::center);  	CONNECT(this, settings_notifier.disk_cache_upper_limit,  	        this, &DiskstreamingframeContent::limitSettingsValueChanged); @@ -73,7 +73,7 @@ DiskstreamingframeContent::DiskstreamingframeContent(Widget* parent,  void DiskstreamingframeContent::resize(std::size_t width, std::size_t height)  { -	Widget::resize(width, height); +	dggui::Widget::resize(width, height);  	int slider_button_gap = 10; @@ -98,14 +98,16 @@ void DiskstreamingframeContent::limitSettingsValueChanged(std::size_t value)  	float new_slider_value = (float)(value - min_limit)/(max_limit - min_limit);  	slider.setValue(new_slider_value); -	if (new_slider_value < 0.99) { +	if(new_slider_value < 0.99) +	{  		int value_in_mb = value/(1024 * 1024);  		label_value.setText(std::to_string(value_in_mb) + " MB"); -		slider.setColour(Slider::Colour::Blue); +		slider.setColour(dggui::Slider::Colour::Blue);  	} -	else { +	else +	{  		label_value.setText(_("Unlimited")); -		slider.setColour(Slider::Colour::Grey); +		slider.setColour(dggui::Slider::Colour::Grey);  	}  	button.setEnabled(true); diff --git a/plugingui/diskstreamingframecontent.h b/plugingui/diskstreamingframecontent.h index eabc6e2..10ed90a 100644 --- a/plugingui/diskstreamingframecontent.h +++ b/plugingui/diskstreamingframecontent.h @@ -26,10 +26,10 @@   */  #pragma once -#include "button.h" -#include "label.h" -#include "slider.h" -#include "widget.h" +#include <dggui/button.h> +#include <dggui/label.h> +#include <dggui/slider.h> +#include <dggui/widget.h>  struct Settings;  class SettingsNotifier; @@ -37,10 +37,11 @@ class SettingsNotifier;  namespace GUI  { -class DiskstreamingframeContent : public Widget +class DiskstreamingframeContent +	: public dggui::Widget  {  public: -	DiskstreamingframeContent(Widget* parent, +	DiskstreamingframeContent(dggui::Widget* parent,  	                          Settings& settings,  	                          SettingsNotifier& settings_notifier); @@ -57,11 +58,11 @@ private:  	static constexpr std::size_t min_limit = 1024.0 * 1024.0 * 32;  	static constexpr std::size_t max_limit = 1024.0 * 1024.0 * 1024.0 * 4.0 - 1; -	Label label_text{this}; -	Label label_value{this}; +	dggui::Label label_text{this}; +	dggui::Label label_value{this}; -	Slider slider{this}; -	Button button{this}; +	dggui::Slider slider{this}; +	dggui::Button button{this};  	int slider_width;  	int button_width; diff --git a/plugingui/drumkitframecontent.cc b/plugingui/drumkitframecontent.cc index 7dd2234..2ae298b 100644 --- a/plugingui/drumkitframecontent.cc +++ b/plugingui/drumkitframecontent.cc @@ -28,7 +28,6 @@  #include <settings.h> -#include "label.h"  #include "pluginconfig.h"  #include <translation.h> @@ -36,11 +35,11 @@  namespace GUI  { -BrowseFile::BrowseFile(Widget* parent) -	: Widget(parent) +BrowseFile::BrowseFile(dggui::Widget* parent) +	: dggui::Widget(parent)  {  	layout.setResizeChildren(false); -	layout.setVAlignment(VAlignment::center); +	layout.setVAlignment(dggui::VAlignment::center);  	layout.setSpacing(gap);  	layout.addItem(&lineedit); @@ -51,7 +50,7 @@ BrowseFile::BrowseFile(Widget* parent)  void BrowseFile::resize(std::size_t width, std::size_t height)  { -	Widget::resize(width, height); +	dggui::Widget::resize(width, height);  	lineedit_width = std::max((int)(0.77 * (int)width - gap), 0);  	button_width = std::max((int)width - lineedit_width - gap, 0); @@ -72,26 +71,26 @@ std::size_t BrowseFile::getButtonWidth()  	return button_width;  } -Button& BrowseFile::getBrowseButton() +dggui::Button& BrowseFile::getBrowseButton()  {  	return browse_button;  } -LineEdit& BrowseFile::getLineEdit() +dggui::LineEdit& BrowseFile::getLineEdit()  {  	return lineedit;  } -DrumkitframeContent::DrumkitframeContent(Widget* parent, +DrumkitframeContent::DrumkitframeContent(dggui::Widget* parent,                                           Settings& settings,                                           SettingsNotifier& settings_notifier,                                           Config& config) -	: Widget(parent) +	: dggui::Widget(parent)  	, settings(settings)  	, settings_notifier(settings_notifier)  	, config(config)  { -	layout.setHAlignment(HAlignment::left); +	layout.setHAlignment(dggui::HAlignment::left);  	drumkit_caption.setText(_("Drumkit file:"));  	midimap_caption.setText(_("Midimap file:")); @@ -111,20 +110,20 @@ DrumkitframeContent::DrumkitframeContent(Widget* parent,  	CONNECT(this, settings_notifier.drumkit_file, -	        &drumkit_file.getLineEdit(), &LineEdit::setText); +	        &drumkit_file.getLineEdit(), &dggui::LineEdit::setText);  	CONNECT(this, settings_notifier.drumkit_load_status,  	        this, &DrumkitframeContent::setDrumKitLoadStatus);  	CONNECT(this, settings_notifier.midimap_file, -	        &midimap_file.getLineEdit(), &LineEdit::setText); +	        &midimap_file.getLineEdit(), &dggui::LineEdit::setText);  	CONNECT(this, settings_notifier.midimap_load_status,  	        this, &DrumkitframeContent::setMidiMapLoadStatus);  	CONNECT(this, settings_notifier.number_of_files, -	        &drumkit_file_progress, &ProgressBar::setTotal); +	        &drumkit_file_progress, &dggui::ProgressBar::setTotal);  	CONNECT(this, settings_notifier.number_of_files_loaded, -	        &drumkit_file_progress, &ProgressBar::setValue); +	        &drumkit_file_progress, &dggui::ProgressBar::setValue);  	CONNECT(this, file_browser. defaultPathChangedNotifier,  	        this, &DrumkitframeContent::defaultPathChanged); @@ -137,7 +136,7 @@ DrumkitframeContent::DrumkitframeContent(Widget* parent,  void DrumkitframeContent::resize(std::size_t width, std::size_t height)  { -	Widget::resize(width, height); +	dggui::Widget::resize(width, height);  	drumkit_caption.resize(width, 15);  	drumkit_file.resize(width, 37); @@ -170,8 +169,8 @@ void DrumkitframeContent::kitBrowseClick()  	CONNECT(&file_browser, fileSelectNotifier,  	        this, &DrumkitframeContent::selectKitFile);  	file_browser.show(); -	Point p{ window()->x() + (int)window()->width() / 2, -	         window()->y() + (int)window()->height() / 2 }; +	dggui::Point p{ window()->x() + (int)window()->width() / 2, +	                window()->y() + (int)window()->height() / 2 };  	auto p0 = window()->translateToScreen(p);  	auto sz = file_browser.window()->getNativeSize();  	file_browser.move(p0.x - sz.width / 2, @@ -198,8 +197,8 @@ void DrumkitframeContent::midimapBrowseClick()  	CONNECT(&file_browser, fileSelectNotifier,  	        this, &DrumkitframeContent::selectMapFile);  	file_browser.show(); -	Point p{ window()->x() + (int)window()->width() / 2, -	         window()->y() + (int)window()->height() / 2 }; +	dggui::Point p{ window()->x() + (int)window()->width() / 2, +	                window()->y() + (int)window()->height() / 2 };  	auto p0 = window()->translateToScreen(p);  	auto sz = file_browser.window()->getNativeSize();  	file_browser.move(p0.x - sz.width / 2, @@ -230,18 +229,19 @@ void DrumkitframeContent::selectMapFile(const std::string& filename)  void DrumkitframeContent::setDrumKitLoadStatus(LoadStatus load_status)  { -	ProgressBarState state = ProgressBarState::Blue; +	auto state = dggui::ProgressBarState::Blue;  	switch(load_status)  	{  	case LoadStatus::Idle: +	case LoadStatus::Parsing:  	case LoadStatus::Loading: -		state = ProgressBarState::Blue; +		state = dggui::ProgressBarState::Blue;  		break;  	case LoadStatus::Done: -		state = ProgressBarState::Green; +		state = dggui::ProgressBarState::Green;  		break;  	case LoadStatus::Error: -		state = ProgressBarState::Red; +		state = dggui::ProgressBarState::Red;  		break;  	} @@ -250,23 +250,24 @@ void DrumkitframeContent::setDrumKitLoadStatus(LoadStatus load_status)  void DrumkitframeContent::setMidiMapLoadStatus(LoadStatus load_status)  { -	ProgressBarState state = ProgressBarState::Blue; +	auto state = dggui::ProgressBarState::Blue;  	switch(load_status)  	{  	case LoadStatus::Idle:  		midimap_file_progress.setValue(0);  		break; +	case LoadStatus::Parsing:  	case LoadStatus::Loading:  		midimap_file_progress.setValue(1); -		state = ProgressBarState::Blue; +		state = dggui::ProgressBarState::Blue;  		break;  	case LoadStatus::Done:  		midimap_file_progress.setValue(2); -		state = ProgressBarState::Green; +		state = dggui::ProgressBarState::Green;  		break;  	case LoadStatus::Error:  		midimap_file_progress.setValue(2); -		state = ProgressBarState::Red; +		state = dggui::ProgressBarState::Red;  		break;  	} diff --git a/plugingui/drumkitframecontent.h b/plugingui/drumkitframecontent.h index 921927d..4c5cc9e 100644 --- a/plugingui/drumkitframecontent.h +++ b/plugingui/drumkitframecontent.h @@ -28,11 +28,12 @@  #include <settings.h> -#include "button.h" -#include "label.h" -#include "lineedit.h" -#include "progressbar.h" -#include "widget.h" +#include <dggui/button.h> +#include <dggui/label.h> +#include <dggui/lineedit.h> +#include <dggui/progressbar.h> +#include <dggui/widget.h> +  #include "filebrowser.h"  namespace GUI @@ -41,10 +42,10 @@ namespace GUI  class Config;  class BrowseFile -	: public Widget +	: public dggui::Widget  {  public: -	BrowseFile(Widget* parent); +	BrowseFile(dggui::Widget* parent);  	// From Widget  	virtual void resize(std::size_t width, std::size_t height) override; @@ -52,14 +53,14 @@ public:  	std::size_t getLineEditWidth();  	std::size_t getButtonWidth(); -	Button& getBrowseButton(); -	LineEdit& getLineEdit(); +	dggui::Button& getBrowseButton(); +	dggui::LineEdit& getLineEdit();  private: -	HBoxLayout layout{this}; +	dggui::HBoxLayout layout{this}; -	LineEdit lineedit{this}; -	Button browse_button{this}; +	dggui::LineEdit lineedit{this}; +	dggui::Button browse_button{this};  	int lineedit_width;  	int button_width; @@ -67,10 +68,10 @@ private:  };  class DrumkitframeContent -	: public Widget +	: public dggui::Widget  {  public: -	DrumkitframeContent(Widget* parent, +	DrumkitframeContent(dggui::Widget* parent,  	                    Settings& settings,  	                    SettingsNotifier& settings_notifier,  	                    Config& config); @@ -90,14 +91,14 @@ private:  	void setDrumKitLoadStatus(LoadStatus load_status);  	void setMidiMapLoadStatus(LoadStatus load_status); -	VBoxLayout layout{this}; +	dggui::VBoxLayout layout{this}; -	Label drumkit_caption{this}; -	Label midimap_caption{this}; +	dggui::Label drumkit_caption{this}; +	dggui::Label midimap_caption{this};  	BrowseFile drumkit_file{this};  	BrowseFile midimap_file{this}; -	ProgressBar drumkit_file_progress{this}; -	ProgressBar midimap_file_progress{this}; +	dggui::ProgressBar drumkit_file_progress{this}; +	dggui::ProgressBar midimap_file_progress{this};  	FileBrowser file_browser{this}; diff --git a/plugingui/drumkittab.cc b/plugingui/drumkittab.cc index 8d85f1e..6323e94 100644 --- a/plugingui/drumkittab.cc +++ b/plugingui/drumkittab.cc @@ -31,7 +31,9 @@  #include <sstream>  #include "cpp11fix.h" // required for c++11 -#include "painter.h" + +#include <dggui/painter.h> +  #include "settings.h"  #include <dgxmlparser.h> @@ -40,10 +42,10 @@  namespace GUI  { -DrumkitTab::DrumkitTab(Widget* parent, +DrumkitTab::DrumkitTab(dggui::Widget* parent,                         Settings& settings,                         SettingsNotifier& settings_notifier) -	: Widget(parent) +	: dggui::Widget(parent)  	, settings(settings)  	, settings_notifier(settings_notifier)  { @@ -63,11 +65,11 @@ DrumkitTab::DrumkitTab(Widget* parent,  void DrumkitTab::resize(std::size_t width, std::size_t height)  { -	Widget::resize(width, height); +	dggui::Widget::resize(width, height);  	if(drumkit_image)  	{ -		Painter painter(*this); +		dggui::Painter painter(*this);  		painter.clear();  		drumkit_image_x = (this->width()-drumkit_image->width())/2; @@ -80,24 +82,24 @@ void DrumkitTab::resize(std::size_t width, std::size_t height)  	                           height-instrument_name_label.height()-5);  } -void DrumkitTab::buttonEvent(ButtonEvent* buttonEvent) +void DrumkitTab::buttonEvent(dggui::ButtonEvent* buttonEvent)  {  	if(map_image)  	{ -		if(buttonEvent->button == MouseButton::right) +		if(buttonEvent->button == dggui::MouseButton::right)  		{ -			if(buttonEvent->direction == GUI::Direction::down) +			if(buttonEvent->direction == dggui::Direction::down)  			{ -				Painter painter(*this); +				dggui::Painter painter(*this);  				painter.drawImage(drumkit_image_x, drumkit_image_y, *map_image);  				shows_overlay = true;  				redraw();  				return;  			} -			if(buttonEvent->direction == GUI::Direction::up) +			if(buttonEvent->direction == dggui::Direction::up)  			{ -				Painter painter(*this); +				dggui::Painter painter(*this);  				painter.clear();  				painter.drawImage(drumkit_image_x, drumkit_image_y, *drumkit_image); @@ -110,20 +112,20 @@ void DrumkitTab::buttonEvent(ButtonEvent* buttonEvent)  		}  	} -	if(buttonEvent->button == MouseButton::left) +	if(buttonEvent->button == dggui::MouseButton::left)  	{ -		if(buttonEvent->direction == GUI::Direction::down) +		if(buttonEvent->direction == dggui::Direction::down)  		{  			triggerAudition(buttonEvent->x, buttonEvent->y);  			highlightInstrument(current_index);  			redraw();  		} -		if(buttonEvent->direction == GUI::Direction::up) +		if(buttonEvent->direction == dggui::Direction::up)  		{  			if(shows_instrument_overlay)  			{ -				Painter painter(*this); +				dggui::Painter painter(*this);  				painter.clear();  				painter.drawImage(drumkit_image_x, drumkit_image_y, *drumkit_image);  				if(shows_overlay) @@ -138,9 +140,9 @@ void DrumkitTab::buttonEvent(ButtonEvent* buttonEvent)  	}  } -void DrumkitTab::scrollEvent(ScrollEvent* scrollEvent) +void DrumkitTab::scrollEvent(dggui::ScrollEvent* scrollEvent)  { -	current_velocity -=  0.01*scrollEvent->delta; +	current_velocity -=  0.01 * scrollEvent->delta;  	current_velocity = std::max(std::min(current_velocity, 1.0f), 0.0f);  	updateVelocityLabel();  	velocity_label.resizeToText(); @@ -148,18 +150,22 @@ void DrumkitTab::scrollEvent(ScrollEvent* scrollEvent)  	triggerAudition(scrollEvent->x, scrollEvent->y);  } -void DrumkitTab::mouseMoveEvent(MouseMoveEvent* mouseMoveEvent) +void DrumkitTab::mouseMoveEvent(dggui::MouseMoveEvent* mouseMoveEvent)  {  	// change to image coordinates -	auto const x = mouseMoveEvent->x - drumkit_image_x; -	auto const y = mouseMoveEvent->y - drumkit_image_y; +	const auto x = mouseMoveEvent->x - drumkit_image_x; +	const auto y = mouseMoveEvent->y - drumkit_image_y;  	auto index = pos_to_colour_index(x, y); -	if(index == current_index) { return; } +	if(index == current_index) +	{ +		return; +	} +  	current_index = index; -	Painter painter(*this); +	dggui::Painter painter(*this);  	painter.clear();  	painter.drawImage(drumkit_image_x, drumkit_image_y, *drumkit_image);  	if(shows_overlay) @@ -176,7 +182,7 @@ void DrumkitTab::mouseLeaveEvent()  {  	if(map_image && (shows_overlay || shows_instrument_overlay))  	{ -		Painter painter(*this); +		dggui::Painter painter(*this);  		painter.clear();  		painter.drawImage(drumkit_image_x, drumkit_image_y, *drumkit_image); @@ -210,8 +216,8 @@ void DrumkitTab::highlightInstrument(int index)  {  	if(index != -1)  	{ -		Painter painter(*this); -		auto const& colour = colours[index]; +		dggui::Painter painter(*this); +		const auto& colour = colours[index];  		//Colour colour(1.0f, 1.0f, 0.0f);  		auto const& positions = colour_index_to_positions[index];  		painter.draw(positions.begin(), positions.end(), @@ -238,11 +244,11 @@ void DrumkitTab::updateInstrumentLabel(int index)  	instrument_name_label.resizeToText();  } -void DrumkitTab::init(std::string const& image_file, -                      std::string const& map_file) +void DrumkitTab::init(const std::string& image_file, +                      const std::string& map_file)  { -	drumkit_image = std::make_unique<Image>(image_file); -	map_image = std::make_unique<Image>(map_file); +	drumkit_image = std::make_unique<dggui::Image>(image_file); +	map_image = std::make_unique<dggui::Image>(map_file);  	// collect all colours and build lookup table  	auto const height = map_image->height(); @@ -319,7 +325,7 @@ void DrumkitTab::drumkitFileChanged(const std::string& drumkit_file)  				float red   = (hex_colour >> 16 & 0xff) / 255.0f;  				float green = (hex_colour >>  8 & 0xff) / 255.0f;  				float blue  = (hex_colour >>  0 & 0xff) / 255.0f; -				Colour colour(red, green, blue); +				dggui::Colour colour(red, green, blue);  				colour_instrument_pairs.push_back({colour, clickmap.instrument});  			}  			catch(...) diff --git a/plugingui/drumkittab.h b/plugingui/drumkittab.h index a14a9c5..ad89fb1 100644 --- a/plugingui/drumkittab.h +++ b/plugingui/drumkittab.h @@ -32,9 +32,9 @@  #include <grid.h> -#include "image.h" -#include "label.h" -#include "widget.h" +#include <dggui/image.h> +#include <dggui/label.h> +#include <dggui/widget.h>  struct Settings;  class SettingsNotifier; @@ -45,21 +45,21 @@ namespace GUI  class Config;  class DrumkitTab -	: public Widget +	: public dggui::Widget  {  public: -	DrumkitTab(Widget* parent, +	DrumkitTab(dggui::Widget* parent,  	           Settings& settings,  	           SettingsNotifier& settings_notifier); -	// From Widget: +	// From dggui::Widget:  	void resize(std::size_t width, std::size_t height) override; -	void buttonEvent(ButtonEvent* buttonEvent) override; -	void scrollEvent(ScrollEvent* scrollEvent) override; -	void mouseMoveEvent(MouseMoveEvent* mouseMoveEvent) override; +	void buttonEvent(dggui::ButtonEvent* buttonEvent) override; +	void scrollEvent(dggui::ScrollEvent* scrollEvent) override; +	void mouseMoveEvent(dggui::MouseMoveEvent* mouseMoveEvent) override;  	void mouseLeaveEvent() override; -	void init(std::string const& image_file, std::string const& map_file); +	void init(const std::string& image_file, const std::string& map_file);  	Notifier<bool> imageChangeNotifier; // bool has_valid_image @@ -72,34 +72,34 @@ private:  	using Position = IndexGrid::Pos;  	using Positions = std::vector<Position>; -	std::vector<Colour> colours; +	std::vector<dggui::Colour> colours;  	IndexGrid pos_to_colour_index;  	std::vector<Positions> colour_index_to_positions;  	std::vector<std::string> to_instrument_name;  	struct ColourInstrumentPair  	{ -		Colour colour; +		dggui::Colour colour;  		std::string instrument;  	};  	// FIXME: load this from instrument file  	std::vector<ColourInstrumentPair> colour_instrument_pairs = { -		{Colour(0), "Snare"}, -		{Colour(255./255, 15./255, 55./255), "KdrumL"}, -		{Colour(154./255, 153./255, 33./255), "HihatClosed"}, -		{Colour(248./255, 221./255, 37./255), "Tom4"} +		{dggui::Colour(0), "Snare"}, +		{dggui::Colour(255./255, 15./255, 55./255), "KdrumL"}, +		{dggui::Colour(154./255, 153./255, 33./255), "HihatClosed"}, +		{dggui::Colour(248./255, 221./255, 37./255), "Tom4"}  	};  	bool shows_overlay{false};  	bool shows_instrument_overlay{false}; -	std::unique_ptr<Image> drumkit_image; -	std::unique_ptr<Image> map_image; +	std::unique_ptr<dggui::Image> drumkit_image; +	std::unique_ptr<dggui::Image> map_image;  	int drumkit_image_x;  	int drumkit_image_y; -	Label velocity_label{this}; -	Label instrument_name_label{this}; +	dggui::Label velocity_label{this}; +	dggui::Label instrument_name_label{this};  	Settings& settings;  	SettingsNotifier& settings_notifier; diff --git a/plugingui/filebrowser.cc b/plugingui/filebrowser.cc index 59daab4..d4fc009 100644 --- a/plugingui/filebrowser.cc +++ b/plugingui/filebrowser.cc @@ -26,8 +26,8 @@   */  #include "filebrowser.h" -#include "painter.h" -#include "button.h" +#include <dggui/painter.h> +#include <dggui/button.h>  #include <sys/types.h>  #include <dirent.h> @@ -48,8 +48,8 @@  namespace GUI  { -FileBrowser::FileBrowser(Widget* parent) -	: Dialog(parent, true) +FileBrowser::FileBrowser(dggui::Widget* parent) +	: dggui::Dialog(parent, true)  	, dir(Directory::cwd())  	, lbl_path(this)  	, lineedit(this) @@ -106,7 +106,7 @@ void FileBrowser::setPath(const std::string& path)  void FileBrowser::resize(std::size_t width, std::size_t height)  { -	Dialog::resize(width, height); +	dggui::Dialog::resize(width, height);  	int offset = 0;  	int brd = 5; // border @@ -139,9 +139,9 @@ void FileBrowser::resize(std::size_t width, std::size_t height)  	btn_sel.resize(btn_w, btn_h);  } -void FileBrowser::repaintEvent(RepaintEvent* repaintEvent) +void FileBrowser::repaintEvent(dggui::RepaintEvent* repaintEvent)  { -	Painter p(*this); +	dggui::Painter p(*this);  	p.drawImageStretched(0,0, back, width(), height());  } @@ -233,7 +233,7 @@ void FileBrowser::changeDir()  	  return;  	} -	std::vector<ListBoxBasic::Item> items; +	std::vector<dggui::ListBoxBasic::Item> items;  #if DG_PLATFORM == DG_PLATFORM_WINDOWS  	if(Directory::isRoot(dir.path()) && (value == "..")) @@ -241,7 +241,7 @@ void FileBrowser::changeDir()  		DEBUG(filebrowser, _("Showing partitions...\n"));  		for(auto drive : dir.drives())  		{ -			ListBoxBasic::Item item; +			dggui::ListBoxBasic::Item item;  			item.name = drive.name;  			item.value = drive.name;  			items.push_back(item); @@ -271,7 +271,7 @@ void FileBrowser::changeDir()  		for(auto entry : entries)  		{ -			ListBoxBasic::Item item; +			dggui::ListBoxBasic::Item item;  			item.name = entry;  			item.value = entry;  			items.push_back(item); diff --git a/plugingui/filebrowser.h b/plugingui/filebrowser.h index bc7adb3..0620ef3 100644 --- a/plugingui/filebrowser.h +++ b/plugingui/filebrowser.h @@ -30,21 +30,21 @@  #include <platform.h>  #include <directory.h> -#include "dialog.h" -#include "button.h" -#include "listbox.h" -#include "lineedit.h" -#include "label.h" -#include "image.h" +#include <dggui/dialog.h> +#include <dggui/button.h> +#include <dggui/listbox.h> +#include <dggui/lineedit.h> +#include <dggui/label.h> +#include <dggui/image.h>  namespace GUI  {  class FileBrowser -	: public Dialog +	: public dggui::Dialog  {  public: -	FileBrowser(Widget* parent); +	FileBrowser(dggui::Widget* parent);  	void setPath(const std::string& path); @@ -54,7 +54,7 @@ public:  	// From Widget:  	bool isFocusable() override { return true; } -	virtual void repaintEvent(RepaintEvent* repaintEvent) override; +	virtual void repaintEvent(dggui::RepaintEvent* repaintEvent) override;  	virtual void resize(std::size_t width, std::size_t height) override;  	//! Return the filename selected in the browser. @@ -81,16 +81,16 @@ private:  	void select(const std::string& file);  	void changeDir(); -	Label lbl_path; +	dggui::Label lbl_path; -	LineEdit lineedit; -	ListBox listbox; +	dggui::LineEdit lineedit; +	dggui::ListBox listbox; -	Button btn_sel; -	Button btn_def; -	Button btn_esc; +	dggui::Button btn_sel; +	dggui::Button btn_def; +	dggui::Button btn_esc; -	Image back; +	dggui::Image back;  	bool has_filename{false};  	std::string filename; diff --git a/plugingui/humaniservisualiser.cc b/plugingui/humaniservisualiser.cc index 92da164..1045e31 100644 --- a/plugingui/humaniservisualiser.cc +++ b/plugingui/humaniservisualiser.cc @@ -26,25 +26,28 @@   */  #include "humaniservisualiser.h" -#include "painter.h" +#include <dggui/painter.h>  #include <notifier.h>  #include <settings.h>  #include <hugin.hpp> -HumaniserVisualiser::HumaniserVisualiser(GUI::Widget* parent, +namespace GUI +{ + +HumaniserVisualiser::HumaniserVisualiser(dggui::Widget* parent,                                           Settings& settings,                                           SettingsNotifier& settings_notifier) -	: GUI::Widget(parent) +	: dggui::Widget(parent)  	, canvas(this, settings, settings_notifier)  {  	canvas.move(7, 7);  } -void HumaniserVisualiser::repaintEvent(GUI::RepaintEvent *repaintEvent) +void HumaniserVisualiser::repaintEvent(dggui::RepaintEvent *repaintEvent)  { -	GUI::Painter p(*this); +	dggui::Painter p(*this);  	box.setSize(width(), height());  	p.drawImage(0, 0, box); @@ -52,7 +55,7 @@ void HumaniserVisualiser::repaintEvent(GUI::RepaintEvent *repaintEvent)  void HumaniserVisualiser::resize(std::size_t width, std::size_t height)  { -	Widget::resize(width, height); +	dggui::Widget::resize(width, height);  	if(width < 14 || height < 14)  	{  		canvas.resize(1, 1); @@ -61,10 +64,10 @@ void HumaniserVisualiser::resize(std::size_t width, std::size_t height)  	canvas.resize(width - 14, height - 14);  } -HumaniserVisualiser::Canvas::Canvas(GUI::Widget* parent, +HumaniserVisualiser::Canvas::Canvas(dggui::Widget* parent,                                      Settings& settings,                                      SettingsNotifier& settings_notifier) -	: GUI::Widget(parent) +	: dggui::Widget(parent)  	, settings_notifier(settings_notifier)  	, latency_max_ms(settings.latency_max_ms.load())  	, settings(settings) @@ -87,14 +90,14 @@ HumaniserVisualiser::Canvas::Canvas(GUI::Widget* parent,  	        this, &HumaniserVisualiser::Canvas::velocityStddevChanged);  } -void HumaniserVisualiser::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent) +void HumaniserVisualiser::Canvas::repaintEvent(dggui::RepaintEvent *repaintEvent)  {  	if(width() < 1 || height() < 1)  	{  		return;  	} -	GUI::Painter p(*this); +	dggui::Painter p(*this);  	p.clear(); @@ -131,26 +134,26 @@ void HumaniserVisualiser::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent)  	// Lines  	if(velocity_enabled)  	{ -		p.setColour(GUI::Colour(0.0f, 1.0f, 1.0f)); +		p.setColour(dggui::Colour(0.0f, 1.0f, 1.0f));  	}  	else  	{ -		p.setColour(GUI::Colour(0.4f, 0.4f, 0.4f)); +		p.setColour(dggui::Colour(0.4f, 0.4f, 0.4f));  	}  	p.drawLine(0, y, width(), y);  	if(latency_enabled)  	{ -		p.setColour(GUI::Colour(0.0f, 1.0f, 1.0f)); +		p.setColour(dggui::Colour(0.0f, 1.0f, 1.0f));  	}  	else  	{ -		p.setColour(GUI::Colour(0.4f, 0.4f, 0.4f)); +		p.setColour(dggui::Colour(0.4f, 0.4f, 0.4f));  	}  	p.drawLine(x, 0, x, height());  	// Zero-lines -	p.setColour(GUI::Colour(0.0f, 1.0f, 0.0f, 0.9f)); +	p.setColour(dggui::Colour(0.0f, 1.0f, 0.0f, 0.9f));  	p.drawLine(0, height() * 0.2f, width(), height() * 0.2f);  	p.drawLine(width() / 2, 0, width() / 2, height());  } @@ -196,3 +199,5 @@ void HumaniserVisualiser::Canvas::velocityStddevChanged(float stddev)  	velocity_stddev = stddev;  	redraw();  } + +} // ::GUI diff --git a/plugingui/humaniservisualiser.h b/plugingui/humaniservisualiser.h index 55e37d2..028f10d 100644 --- a/plugingui/humaniservisualiser.h +++ b/plugingui/humaniservisualiser.h @@ -26,40 +26,43 @@   */  #pragma once -#include "widget.h" -#include "texturedbox.h" -#include "texture.h" +#include <dggui/widget.h> +#include <dggui/texturedbox.h> +#include <dggui/texture.h>  struct Settings;  class SettingsNotifier; +namespace GUI +{ +  class HumaniserVisualiser -	: public GUI::Widget +	: public dggui::Widget  {  public: -	HumaniserVisualiser(GUI::Widget* parent, +	HumaniserVisualiser(dggui::Widget* parent,  	                    Settings& settings,  	                    SettingsNotifier& settings_notifier);  	// From Widget: -	virtual void repaintEvent(GUI::RepaintEvent *repaintEvent) override; +	virtual void repaintEvent(dggui::RepaintEvent *repaintEvent) override;  	virtual void resize(std::size_t width, std::size_t height) override;  private: -	GUI::TexturedBox box{getImageCache(), ":resources/widget.png", +	dggui::TexturedBox box{getImageCache(), ":resources/widget.png",  			0, 0, // atlas offset (x, y)  			7, 1, 7, // dx1, dx2, dx3  			7, 63, 7}; // dy1, dy2, dy3  	class Canvas -		: public GUI::Widget +		: public dggui::Widget  	{  	public: -		Canvas(GUI::Widget* parent, Settings& settings, +		Canvas(dggui::Widget* parent, Settings& settings,  		       SettingsNotifier& settings_notifier);  		// From Widget: -		virtual void repaintEvent(GUI::RepaintEvent *repaintEvent) override; +		virtual void repaintEvent(dggui::RepaintEvent *repaintEvent) override;  		void latencyEnabledChanged(bool enabled);  		void velocityEnabledChanged(bool enabled); @@ -69,10 +72,10 @@ private:  		void latencyLaidbackChanged(float laidback);  		void velocityStddevChanged(float stddev); -		GUI::Texture stddev_h{getImageCache(), ":resources/stddev_horizontal.png"}; -		GUI::Texture stddev_h_disabled{getImageCache(), ":resources/stddev_horizontal_disabled.png"}; -		GUI::Texture stddev_v{getImageCache(), ":resources/stddev_vertical.png"}; -		GUI::Texture stddev_v_disabled{getImageCache(), ":resources/stddev_vertical_disabled.png"}; +		dggui::Texture stddev_h{getImageCache(), ":resources/stddev_horizontal.png"}; +		dggui::Texture stddev_h_disabled{getImageCache(), ":resources/stddev_horizontal_disabled.png"}; +		dggui::Texture stddev_v{getImageCache(), ":resources/stddev_vertical.png"}; +		dggui::Texture stddev_v_disabled{getImageCache(), ":resources/stddev_vertical_disabled.png"};  		bool latency_enabled{false};  		bool velocity_enabled{false}; @@ -90,3 +93,5 @@ private:  	Canvas canvas;  }; + +} // ::GUI diff --git a/plugingui/humanizerframecontent.cc b/plugingui/humanizerframecontent.cc index 475f16d..aa36b7b 100644 --- a/plugingui/humanizerframecontent.cc +++ b/plugingui/humanizerframecontent.cc @@ -28,15 +28,15 @@  #include <settings.h> -#include "painter.h" +#include <dggui/painter.h>  namespace GUI  { -HumanizerframeContent::HumanizerframeContent(Widget* parent, +HumanizerframeContent::HumanizerframeContent(dggui::Widget* parent,                                               Settings& settings,                                               SettingsNotifier& settings_notifier) -	: Widget(parent) +	: dggui::Widget(parent)  	, settings(settings)  	, settings_notifier(settings_notifier)  { @@ -63,14 +63,14 @@ HumanizerframeContent::HumanizerframeContent(Widget* parent,  	stddev.setControl(&stddev_knob);  	layout.addItem(&stddev); -	layout.setPosition(&attack, GridLayout::GridRange{0, 1, 0, 1}); -	layout.setPosition(&falloff, GridLayout::GridRange{1, 2, 0, 1}); -	layout.setPosition(&stddev, GridLayout::GridRange{2, 3, 0, 1}); +	layout.setPosition(&attack, dggui::GridLayout::GridRange{0, 1, 0, 1}); +	layout.setPosition(&falloff, dggui::GridLayout::GridRange{1, 2, 0, 1}); +	layout.setPosition(&stddev, dggui::GridLayout::GridRange{2, 3, 0, 1});  	CONNECT(this, settings_notifier.velocity_modifier_weight, -	        &attack_knob, &Knob::setValue); +	        &attack_knob, &dggui::Knob::setValue);  	CONNECT(this, settings_notifier.velocity_modifier_falloff, -	        &falloff_knob, &Knob::setValue); +	        &falloff_knob, &dggui::Knob::setValue);  	CONNECT(this, settings_notifier.velocity_stddev,  	        this, &HumanizerframeContent::stddevSettingsValueChanged); diff --git a/plugingui/humanizerframecontent.h b/plugingui/humanizerframecontent.h index 10ae0f3..4603132 100644 --- a/plugingui/humanizerframecontent.h +++ b/plugingui/humanizerframecontent.h @@ -26,10 +26,11 @@   */  #pragma once -#include "knob.h" +#include <dggui/knob.h> +#include <dggui/layout.h> +#include <dggui/widget.h> +  #include "labeledcontrol.h" -#include "layout.h" -#include "widget.h"  #include <translation.h> @@ -40,10 +41,10 @@ namespace GUI  {  class HumanizerframeContent -	: public Widget +	: public dggui::Widget  {  public: -	HumanizerframeContent(Widget* parent, +	HumanizerframeContent(dggui::Widget* parent,  	                      Settings& settings,  	                      SettingsNotifier& settings_notifier); @@ -56,15 +57,15 @@ private:  	void stddevSettingsValueChanged(float value); -	GridLayout layout{this, 3, 1}; +	dggui::GridLayout layout{this, 3, 1};  	LabeledControl attack{this, _("pAttack")}; // drummer strength  	LabeledControl falloff{this, _("pRelease")}; // regain  	LabeledControl stddev{this, _("pStdDev")}; -	Knob attack_knob{&attack}; -	Knob falloff_knob{&falloff}; -	Knob stddev_knob{&stddev}; +	dggui::Knob attack_knob{&attack}; +	dggui::Knob falloff_knob{&falloff}; +	dggui::Knob stddev_knob{&stddev};  	Settings& settings;  	SettingsNotifier& settings_notifier; diff --git a/plugingui/labeledcontrol.h b/plugingui/labeledcontrol.h index 3cbae39..693f582 100644 --- a/plugingui/labeledcontrol.h +++ b/plugingui/labeledcontrol.h @@ -26,8 +26,8 @@   */  #pragma once -#include "label.h" -#include "widget.h" +#include <dggui/label.h> +#include <dggui/widget.h>  #include <iomanip>  #include <sstream> @@ -37,34 +37,34 @@ namespace GUI  {  class LabeledControl -	: public Widget +	: public dggui::Widget  {  public:  	using ValueTransformationFunction =  		std::function<std::string(float, float, float)>; -	LabeledControl(Widget* parent, const std::string& name) -		: Widget(parent) +	LabeledControl(dggui::Widget* parent, const std::string& name) +		: dggui::Widget(parent)  	{  		layout.setResizeChildren(false); -		layout.setHAlignment(HAlignment::center); +		layout.setHAlignment(dggui::HAlignment::center);  		layout.setSpacing(2);  		caption.setText(name);  		caption.resize(100, 20); -		caption.setAlignment(TextAlignment::center); +		caption.setAlignment(dggui::TextAlignment::center);  		layout.addItem(&caption);  	} -	void setControl(Knob* control) +	void setControl(dggui::Knob* control)  	{  		layout.addItem(control);  		CONNECT(control, valueChangedNotifier, this, &LabeledControl::setValue);  		setValue(control->value());  		value.resize(100, 20); -		value.setAlignment(TextAlignment::center); +		value.setAlignment(dggui::TextAlignment::center);  		layout.addItem(&value);  	} @@ -77,9 +77,9 @@ public:  	float scale{1.0f};  private: -	VBoxLayout layout{this}; -	Label caption{this}; -	Label value{this}; +	dggui::VBoxLayout layout{this}; +	dggui::Label caption{this}; +	dggui::Label value{this};  	ValueTransformationFunction value_transformation_func; diff --git a/plugingui/locale/da.po b/plugingui/locale/da.po index 3b74d56..e3904d0 100644 --- a/plugingui/locale/da.po +++ b/plugingui/locale/da.po @@ -6,7 +6,7 @@  #  msgid ""  msgstr "" -"Project-Id-Version: drumgizmo 0.9.17\n" +"Project-Id-Version: drumgizmo 0.9.20\n"  "Report-Msgid-Bugs-To: \n"  "POT-Creation-Date: 2019-09-13 21:07+0200\n"  "PO-Revision-Date: 2019-09-13 19:42+0200\n" @@ -82,19 +82,19 @@ msgstr ""  msgid "0 MB"  msgstr "" -#: diskstreamingframecontent.cc:107 +#: diskstreamingframecontent.cc:109  msgid "Unlimited"  msgstr "" -#: drumkitframecontent.cc:49 +#: drumkitframecontent.cc:48  msgid "Browse..."  msgstr "" -#: drumkitframecontent.cc:96 +#: drumkitframecontent.cc:95  msgid "Drumkit file:"  msgstr "" -#: drumkitframecontent.cc:97 +#: drumkitframecontent.cc:96  msgid "Midimap file:"  msgstr "" @@ -467,15 +467,15 @@ msgstr ""  msgid "About"  msgstr "" -#: powerwidget.cc:52 +#: powerwidget.cc:55  msgid "Shelf"  msgstr "" -#: powerwidget.cc:210 +#: powerwidget.cc:213  msgid "in"  msgstr "" -#: powerwidget.cc:211 +#: powerwidget.cc:214  msgid "out"  msgstr "" @@ -503,47 +503,47 @@ msgstr ""  msgid "No"  msgstr "" -#: statusframecontent.cc:72 +#: statusframecontent.cc:73  msgid "Drumkit status:   "  msgstr "" -#: statusframecontent.cc:74 +#: statusframecontent.cc:75  msgid "Drumkit name:   "  msgstr "" -#: statusframecontent.cc:75 +#: statusframecontent.cc:76  msgid "Drumkit description:   "  msgstr "" -#: statusframecontent.cc:77 +#: statusframecontent.cc:78  msgid "Session buffer size:   "  msgstr "" -#: statusframecontent.cc:78 +#: statusframecontent.cc:79  msgid "Number of underruns: "  msgstr "" -#: statusframecontent.cc:79 +#: statusframecontent.cc:80  msgid "Messages:\n"  msgstr "" -#: statusframecontent.cc:88 +#: statusframecontent.cc:89  msgid "No Kit Loaded"  msgstr "" -#: statusframecontent.cc:91 statusframecontent.cc:133 +#: statusframecontent.cc:92 statusframecontent.cc:134  msgid "Loading..."  msgstr "" -#: statusframecontent.cc:94 statusframecontent.cc:136 +#: statusframecontent.cc:95 statusframecontent.cc:137  msgid "Ready"  msgstr "" -#: statusframecontent.cc:97 statusframecontent.cc:139 +#: statusframecontent.cc:98 statusframecontent.cc:140  msgid "Error"  msgstr "" -#: statusframecontent.cc:130 +#: statusframecontent.cc:131  msgid "No Midimap Loaded"  msgstr "" @@ -551,46 +551,46 @@ msgstr ""  msgid "Per-instrument voice limit:"  msgstr "" -#: humanizerframecontent.h:61 +#: humanizerframecontent.h:62  msgid "pAttack"  msgstr "" -#: humanizerframecontent.h:62 +#: humanizerframecontent.h:63  msgid "pRelease"  msgstr "" -#: humanizerframecontent.h:63 +#: humanizerframecontent.h:64  msgid "pStdDev"  msgstr "" -#: sampleselectionframecontent.h:61 +#: sampleselectionframecontent.h:62  msgid "pClose"  msgstr "" -#: sampleselectionframecontent.h:62 +#: sampleselectionframecontent.h:63  msgid "pDiverse"  msgstr "" -#: sampleselectionframecontent.h:63 +#: sampleselectionframecontent.h:64  msgid "pRandom"  msgstr "" -#: timingframecontent.h:73 +#: timingframecontent.h:74  msgid "pTightness"  msgstr "" -#: timingframecontent.h:74 +#: timingframecontent.h:75  msgid "pTimingRegain"  msgstr "" -#: timingframecontent.h:75 +#: timingframecontent.h:76  msgid "pLaidback"  msgstr "" -#: voicelimitframecontent.h:66 +#: voicelimitframecontent.h:67  msgid "Max voices"  msgstr "" -#: voicelimitframecontent.h:67 +#: voicelimitframecontent.h:68  msgid "Rampdown time"  msgstr "" diff --git a/plugingui/locale/drumgizmo.pot b/plugingui/locale/drumgizmo.pot index 88023ab..e93e387 100644 --- a/plugingui/locale/drumgizmo.pot +++ b/plugingui/locale/drumgizmo.pot @@ -6,7 +6,7 @@  #, fuzzy  msgid ""  msgstr "" -"Project-Id-Version: drumgizmo 0.9.18.1\n" +"Project-Id-Version: drumgizmo 0.9.20\n"  "Report-Msgid-Bugs-To: \n"  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" @@ -80,19 +80,19 @@ msgstr ""  msgid "0 MB"  msgstr "" -#: diskstreamingframecontent.cc:107 +#: diskstreamingframecontent.cc:109  msgid "Unlimited"  msgstr "" -#: drumkitframecontent.cc:49 +#: drumkitframecontent.cc:48  msgid "Browse..."  msgstr "" -#: drumkitframecontent.cc:96 +#: drumkitframecontent.cc:95  msgid "Drumkit file:"  msgstr "" -#: drumkitframecontent.cc:97 +#: drumkitframecontent.cc:96  msgid "Midimap file:"  msgstr "" @@ -465,15 +465,15 @@ msgstr ""  msgid "About"  msgstr "" -#: powerwidget.cc:52 +#: powerwidget.cc:55  msgid "Shelf"  msgstr "" -#: powerwidget.cc:210 +#: powerwidget.cc:213  msgid "in"  msgstr "" -#: powerwidget.cc:211 +#: powerwidget.cc:214  msgid "out"  msgstr "" @@ -501,47 +501,47 @@ msgstr ""  msgid "No"  msgstr "" -#: statusframecontent.cc:72 +#: statusframecontent.cc:73  msgid "Drumkit status:   "  msgstr "" -#: statusframecontent.cc:74 +#: statusframecontent.cc:75  msgid "Drumkit name:   "  msgstr "" -#: statusframecontent.cc:75 +#: statusframecontent.cc:76  msgid "Drumkit description:   "  msgstr "" -#: statusframecontent.cc:77 +#: statusframecontent.cc:78  msgid "Session buffer size:   "  msgstr "" -#: statusframecontent.cc:78 +#: statusframecontent.cc:79  msgid "Number of underruns: "  msgstr "" -#: statusframecontent.cc:79 +#: statusframecontent.cc:80  msgid "Messages:\n"  msgstr "" -#: statusframecontent.cc:88 +#: statusframecontent.cc:89  msgid "No Kit Loaded"  msgstr "" -#: statusframecontent.cc:91 statusframecontent.cc:133 +#: statusframecontent.cc:92 statusframecontent.cc:134  msgid "Loading..."  msgstr "" -#: statusframecontent.cc:94 statusframecontent.cc:136 +#: statusframecontent.cc:95 statusframecontent.cc:137  msgid "Ready"  msgstr "" -#: statusframecontent.cc:97 statusframecontent.cc:139 +#: statusframecontent.cc:98 statusframecontent.cc:140  msgid "Error"  msgstr "" -#: statusframecontent.cc:130 +#: statusframecontent.cc:131  msgid "No Midimap Loaded"  msgstr "" @@ -549,46 +549,46 @@ msgstr ""  msgid "Per-instrument voice limit:"  msgstr "" -#: humanizerframecontent.h:61 +#: humanizerframecontent.h:62  msgid "pAttack"  msgstr "" -#: humanizerframecontent.h:62 +#: humanizerframecontent.h:63  msgid "pRelease"  msgstr "" -#: humanizerframecontent.h:63 +#: humanizerframecontent.h:64  msgid "pStdDev"  msgstr "" -#: sampleselectionframecontent.h:61 +#: sampleselectionframecontent.h:62  msgid "pClose"  msgstr "" -#: sampleselectionframecontent.h:62 +#: sampleselectionframecontent.h:63  msgid "pDiverse"  msgstr "" -#: sampleselectionframecontent.h:63 +#: sampleselectionframecontent.h:64  msgid "pRandom"  msgstr "" -#: timingframecontent.h:73 +#: timingframecontent.h:74  msgid "pTightness"  msgstr "" -#: timingframecontent.h:74 +#: timingframecontent.h:75  msgid "pTimingRegain"  msgstr "" -#: timingframecontent.h:75 +#: timingframecontent.h:76  msgid "pLaidback"  msgstr "" -#: voicelimitframecontent.h:66 +#: voicelimitframecontent.h:67  msgid "Max voices"  msgstr "" -#: voicelimitframecontent.h:67 +#: voicelimitframecontent.h:68  msgid "Rampdown time"  msgstr "" diff --git a/plugingui/locale/fr.po b/plugingui/locale/fr.po index a41db20..c2fbb63 100644 --- a/plugingui/locale/fr.po +++ b/plugingui/locale/fr.po @@ -7,7 +7,7 @@  #  msgid ""  msgstr "" -"Project-Id-Version: drumgizmo 0.9.18.1\n" +"Project-Id-Version: drumgizmo 0.9.20\n"  "Report-Msgid-Bugs-To: \n"  "POT-Creation-Date: 2019-09-13 21:07+0200\n"  "PO-Revision-Date: 2020-11-21 16:49+0200\n" @@ -102,19 +102,19 @@ msgstr "Appliquer"  msgid "0 MB"  msgstr "" -#: diskstreamingframecontent.cc:107 +#: diskstreamingframecontent.cc:109  msgid "Unlimited"  msgstr "Illimité" -#: drumkitframecontent.cc:49 +#: drumkitframecontent.cc:48  msgid "Browse..."  msgstr "Naviguer..." -#: drumkitframecontent.cc:96 +#: drumkitframecontent.cc:95  msgid "Drumkit file:"  msgstr "Fichier de kit de batterie :" -#: drumkitframecontent.cc:97 +#: drumkitframecontent.cc:96  msgid "Midimap file:"  msgstr "Fichier midimap :" @@ -452,8 +452,8 @@ msgid ""  "This feature works on a per-instrument basis, e.g., voices played on the "  "bass\n"  msgstr "" -"Cette caractéristique fonctionne instrument par instrument, c'est-à-dire " -"que les\n" +"Cette caractéristique fonctionne instrument par instrument, c'est-à-dire que " +"les\n"  #: maintab.cc:126  msgid "" @@ -467,13 +467,14 @@ msgid ""  "  * Max voices: The maximum number of voices that should be allowed to "  "play.\n"  msgstr "" -"  * Voix max : le nombre maximum de voix qui peuvent être autorisées à jouer.\n" - +"  * Voix max : le nombre maximum de voix qui peuvent être autorisées à " +"jouer.\n"  #: maintab.cc:129  msgid "  * Rampdown time: How many seconds it takes to silence a voice."  msgstr "" -"  * Durée de rampe : le nombre de secondes nécessaires pour silencer une voix." +"  * Durée de rampe : le nombre de secondes nécessaires pour silencer une " +"voix."  #: maintab.cc:134 mainwindow.cc:56  msgid "Drumkit" @@ -531,15 +532,15 @@ msgstr "Principal"  msgid "About"  msgstr "À propos" -#: powerwidget.cc:52 +#: powerwidget.cc:55  msgid "Shelf"  msgstr "Plateau" -#: powerwidget.cc:210 +#: powerwidget.cc:213  msgid "in"  msgstr "entrée" -#: powerwidget.cc:211 +#: powerwidget.cc:214  msgid "out"  msgstr "sortie" @@ -567,47 +568,47 @@ msgstr "Oui"  msgid "No"  msgstr "Non" -#: statusframecontent.cc:72 +#: statusframecontent.cc:73  msgid "Drumkit status:   "  msgstr "Status du kit de batterie :   " -#: statusframecontent.cc:74 +#: statusframecontent.cc:75  msgid "Drumkit name:   "  msgstr "Nom du kit de batterie :   " -#: statusframecontent.cc:75 +#: statusframecontent.cc:76  msgid "Drumkit description:   "  msgstr "Description du kit de batterie :   " -#: statusframecontent.cc:77 +#: statusframecontent.cc:78  msgid "Session buffer size:   "  msgstr "Taille du tampon de session :   " -#: statusframecontent.cc:78 +#: statusframecontent.cc:79  msgid "Number of underruns: "  msgstr "Nombre de désynchros : " -#: statusframecontent.cc:79 +#: statusframecontent.cc:80  msgid "Messages:\n"  msgstr "Messages :\n" -#: statusframecontent.cc:88 +#: statusframecontent.cc:89  msgid "No Kit Loaded"  msgstr "pas de kit chargé" -#: statusframecontent.cc:91 statusframecontent.cc:133 +#: statusframecontent.cc:92 statusframecontent.cc:134  msgid "Loading..."  msgstr "Chargement..." -#: statusframecontent.cc:94 statusframecontent.cc:136 +#: statusframecontent.cc:95 statusframecontent.cc:137  msgid "Ready"  msgstr "Prêt" -#: statusframecontent.cc:97 statusframecontent.cc:139 +#: statusframecontent.cc:98 statusframecontent.cc:140  msgid "Error"  msgstr "Erreur" -#: statusframecontent.cc:130 +#: statusframecontent.cc:131  msgid "No Midimap Loaded"  msgstr "Pas de midimap chargée" @@ -615,46 +616,46 @@ msgstr "Pas de midimap chargée"  msgid "Per-instrument voice limit:"  msgstr "Limite de voix par instrument :" -#: humanizerframecontent.h:61 +#: humanizerframecontent.h:62  msgid "pAttack"  msgstr "pAttaque" -#: humanizerframecontent.h:62 +#: humanizerframecontent.h:63  msgid "pRelease"  msgstr "pRelâche" -#: humanizerframecontent.h:63 +#: humanizerframecontent.h:64  msgid "pStdDev"  msgstr "pDévStd" -#: sampleselectionframecontent.h:61 +#: sampleselectionframecontent.h:62  msgid "pClose"  msgstr "pProche" -#: sampleselectionframecontent.h:62 +#: sampleselectionframecontent.h:63  msgid "pDiverse"  msgstr "pDiversité" -#: sampleselectionframecontent.h:63 +#: sampleselectionframecontent.h:64  msgid "pRandom"  msgstr "pAléatoire" -#: timingframecontent.h:73 +#: timingframecontent.h:74  msgid "pTightness"  msgstr "pRaideur" -#: timingframecontent.h:74 +#: timingframecontent.h:75  msgid "pTimingRegain"  msgstr "pRetourTiming" -#: timingframecontent.h:75 +#: timingframecontent.h:76  msgid "pLaidback"  msgstr "pNonchalance" -#: voicelimitframecontent.h:66 +#: voicelimitframecontent.h:67  msgid "Max voices"  msgstr "Voix max" -#: voicelimitframecontent.h:67 +#: voicelimitframecontent.h:68  msgid "Rampdown time"  msgstr "Durée de rampe" diff --git a/plugingui/maintab.cc b/plugingui/maintab.cc index d6da057..d95885e 100644 --- a/plugingui/maintab.cc +++ b/plugingui/maintab.cc @@ -31,7 +31,7 @@  namespace GUI  { -MainTab::MainTab(Widget* parent, +MainTab::MainTab(dggui::Widget* parent,                   Settings& settings,                   SettingsNotifier& settings_notifier,                   Config& config) @@ -131,7 +131,7 @@ MainTab::MainTab(Widget* parent,  	layout.setResizeChildren(true);  	//Left column... -	add(_("Drumkit"), drumkit_frame, drumkitframe_content, 14, 0); +	add(_("Drumkit"), drumkit_frame, drumkitframe_content, 15, 0);  	add(_("Status"), status_frame, statusframe_content, 12, 0);  	add(_("Resampling"), resampling_frame, resamplingframe_content, 10, 0);  	add(_("Voice Limit"), voicelimit_frame, voicelimit_content, 10, 0); @@ -153,7 +153,7 @@ MainTab::MainTab(Widget* parent,  	add(_("Visualizer"), visualizer_frame, visualizerframe_content, 14, 1);  	visualizer_frame.setHelpText(visualizer_tip); -	add(_("Velocity Curve"), power_frame, powerframe_content, 20, 1); +	add(_("Velocity Curve"), power_frame, powerframe_content, 21, 1);  	power_frame.setHelpText(power_tip);  	humanizer_frame.setOnSwitch(settings.enable_velocity_modifier); @@ -166,11 +166,11 @@ MainTab::MainTab(Widget* parent,  	bleedcontrol_frame.setEnabled(false);  	CONNECT(this, settings_notifier.enable_velocity_modifier, -	        &humanizer_frame, &FrameWidget::setOnSwitch); +	        &humanizer_frame, &dggui::FrameWidget::setOnSwitch);  	CONNECT(this, settings_notifier.enable_resampling, -	        &resampling_frame, &FrameWidget::setOnSwitch); +	        &resampling_frame, &dggui::FrameWidget::setOnSwitch);  	CONNECT(this, settings_notifier.has_bleed_control, -	        &bleedcontrol_frame, &FrameWidget::setEnabled); +	        &bleedcontrol_frame, &dggui::FrameWidget::setEnabled);  	CONNECT(&humanizer_frame, onSwitchChangeNotifier,  	        this, &MainTab::humanizerOnChange);  	CONNECT(&bleedcontrol_frame, onSwitchChangeNotifier, @@ -182,7 +182,7 @@ MainTab::MainTab(Widget* parent,  	CONNECT(&bleedcontrol_frame, onEnabledChanged,  	        &bleedcontrolframe_content, &BleedcontrolframeContent::setEnabled);  	CONNECT(&settings_notifier, enable_powermap, -	        &power_frame, &FrameWidget::setOnSwitch); +	        &power_frame, &dggui::FrameWidget::setOnSwitch);  	CONNECT(&power_frame, onSwitchChangeNotifier,  	        this, &MainTab::powerOnChange);  	CONNECT(&voicelimit_frame, onSwitchChangeNotifier, @@ -192,10 +192,10 @@ MainTab::MainTab(Widget* parent,  void MainTab::resize(std::size_t width, std::size_t height)  { -	Widget::resize(width, height); +	dggui::Widget::resize(width, height);  	// DrumGizmo logo -	Painter painter(*this); +	dggui::Painter painter(*this);  	painter.clear();  	painter.drawImage(width - logo.width(), height - logo.height(), logo);  } @@ -230,18 +230,18 @@ void MainTab::voicelimitOnChange(bool status)  	settings.enable_voice_limit.store(status);  } -void MainTab::add(std::string const& title, FrameWidget& frame, Widget& content, -                  std::size_t height, int column) +void MainTab::add(std::string const& title, dggui::FrameWidget& frame, +                  dggui::Widget& content, std::size_t height, int column)  {  	layout.addItem(&frame);  	frame.setTitle(title);  	frame.setContent(&content);  	auto grid_start = layout.lastUsedRow(column) + 1; -	auto range = GridLayout::GridRange{column, -	                                   column + 1, -	                                   grid_start, -	                                   grid_start + int(height)}; +	auto range = dggui::GridLayout::GridRange{column, +	                                          column + 1, +	                                          grid_start, +	                                          grid_start + int(height)};  	layout.setPosition(&frame, range);  } diff --git a/plugingui/maintab.h b/plugingui/maintab.h index 57aec72..9050061 100644 --- a/plugingui/maintab.h +++ b/plugingui/maintab.h @@ -26,9 +26,10 @@   */  #pragma once -#include "widget.h" -#include "layout.h" -#include "frame.h" +#include <dggui/widget.h> +#include <dggui/layout.h> +#include <dggui/frame.h> +  #include "drumkitframecontent.h"  #include "statusframecontent.h"  #include "humanizerframecontent.h" @@ -49,10 +50,10 @@ namespace GUI  {  class MainTab -	: public Widget +	: public dggui::Widget  {  public: -	MainTab(Widget* parent, +	MainTab(dggui::Widget* parent,  	        Settings& settings,  	        SettingsNotifier& settings_notifier,  	        Config& config); @@ -68,21 +69,21 @@ private:  	void powerOnChange(bool on);  	void voicelimitOnChange(bool status); -	Image logo{":resources/logo.png"}; +	dggui::Image logo{":resources/logo.png"}; -	GridLayout layout{this, 2, 64}; +	dggui::GridLayout layout{this, 2, 64}; -	FrameWidget drumkit_frame{this, false}; -	FrameWidget status_frame{this, false}; -	FrameWidget diskstreaming_frame{this, false}; -	FrameWidget bleedcontrol_frame{this, true}; -	FrameWidget resampling_frame{this, true}; -	FrameWidget humanizer_frame{this, true, true}; -	FrameWidget timing_frame{this, true, true}; -	FrameWidget sampleselection_frame{this, false, true}; -	FrameWidget visualizer_frame{this, false, true}; -	FrameWidget power_frame{this, true, true}; -	FrameWidget voicelimit_frame{this, true, true}; +	dggui::FrameWidget drumkit_frame{this, false}; +	dggui::FrameWidget status_frame{this, false}; +	dggui::FrameWidget diskstreaming_frame{this, false}; +	dggui::FrameWidget bleedcontrol_frame{this, true}; +	dggui::FrameWidget resampling_frame{this, true}; +	dggui::FrameWidget humanizer_frame{this, true, true}; +	dggui::FrameWidget timing_frame{this, true, true}; +	dggui::FrameWidget sampleselection_frame{this, false, true}; +	dggui::FrameWidget visualizer_frame{this, false, true}; +	dggui::FrameWidget power_frame{this, true, true}; +	dggui::FrameWidget voicelimit_frame{this, true, true};  	DrumkitframeContent drumkitframe_content;  	StatusframeContent statusframe_content; @@ -96,8 +97,8 @@ private:  	PowerWidget powerframe_content;  	VoiceLimitFrameContent voicelimit_content; -	void add(std::string const& title, FrameWidget& frame, Widget& content, -	         std::size_t height, int column); +	void add(std::string const& title, dggui::FrameWidget& frame, +	         dggui::Widget& content, std::size_t height, int column);  	Settings& settings;  	SettingsNotifier& settings_notifier; diff --git a/plugingui/mainwindow.cc b/plugingui/mainwindow.cc index 932e8f3..a4ad7b5 100644 --- a/plugingui/mainwindow.cc +++ b/plugingui/mainwindow.cc @@ -32,13 +32,13 @@  #include <translation.h> -#include "painter.h" +#include <dggui/painter.h>  namespace GUI  {  MainWindow::MainWindow(Settings& settings, void* native_window) -	: Window(native_window) +	: dggui::Window(native_window)  	, settings_notifier(settings)  	, main_tab(this, settings, settings_notifier, config)  	, drumkit_tab(this, settings, settings_notifier) @@ -81,14 +81,14 @@ bool MainWindow::processEvents()  	return true;  } -void MainWindow::repaintEvent(RepaintEvent* repaintEvent) +void MainWindow::repaintEvent(dggui::RepaintEvent* repaintEvent)  {  	if(!visible())  	{  		return;  	} -	Painter painter(*this); +	dggui::Painter painter(*this);  	auto bar_height = tabs.getBarHeight(); diff --git a/plugingui/mainwindow.h b/plugingui/mainwindow.h index 219f851..e517a0d 100644 --- a/plugingui/mainwindow.h +++ b/plugingui/mainwindow.h @@ -28,12 +28,13 @@  #include <settings.h> +#include <dggui/image.h> +#include <dggui/tabwidget.h> +#include <dggui/texturedbox.h> +#include <dggui/window.h> +  #include "abouttab.h"  #include "drumkittab.h" -#include "image.h" -#include "tabwidget.h" -#include "texturedbox.h" -#include "window.h"  #include "maintab.h"  #include "pluginconfig.h" @@ -41,12 +42,12 @@ namespace GUI  {  class MainWindow -	: public Window +	: public dggui::Window  {  public:  	static constexpr std::size_t main_width{750}; -	static constexpr std::size_t main_height{800}; +	static constexpr std::size_t main_height{740};  	MainWindow(Settings& settings, void* native_window);  	~MainWindow(); @@ -64,31 +65,31 @@ private:  	void changeDrumkitTabVisibility(bool visible);  	// From Widget -	void repaintEvent(RepaintEvent* repaintEvent) override final; +	void repaintEvent(dggui::RepaintEvent* repaintEvent) override final;  	Config config;  	SettingsNotifier settings_notifier; -	TabWidget tabs{this}; +	dggui::TabWidget tabs{this};  	MainTab main_tab;  	DrumkitTab drumkit_tab;  	AboutTab about_tab{&tabs}; -	Image back{":resources/bg.png"}; +	dggui::Image back{":resources/bg.png"}; -	TexturedBox sidebar{getImageCache(), ":resources/sidebar.png", +	dggui::TexturedBox sidebar{getImageCache(), ":resources/sidebar.png",  			0, 0, // offset  			16, 0, 0, // delta-x  			14, 1, 14}; // delta-y -	TexturedBox topbar{getImageCache(), ":resources/topbar.png", +	dggui::TexturedBox topbar{getImageCache(), ":resources/topbar.png",  			0, 0, // atlas offset (x, y)  			1, 1, 1, // dx1, dx2, dx3  			17, 1, 1}; // dy1, dy2, dy3  	bool closing{false}; -	TabID drumkit_tab_id; +	dggui::TabID drumkit_tab_id;  };  } // GUI:: diff --git a/plugingui/powerwidget.cc b/plugingui/powerwidget.cc index 0a565e6..9be0c48 100644 --- a/plugingui/powerwidget.cc +++ b/plugingui/powerwidget.cc @@ -26,11 +26,11 @@   */  #include "powerwidget.h" -#include "painter.h" +#include <dggui/painter.h> +#include <dggui/colour.h>  #include <notifier.h>  #include <settings.h> -#include <colour.h>  #include <powermap.h>  #include <hugin.hpp> @@ -38,10 +38,13 @@  #include <translation.h> -PowerWidget::PowerWidget(GUI::Widget* parent, +namespace GUI +{ + +PowerWidget::PowerWidget(dggui::Widget* parent,                           Settings& settings,                           SettingsNotifier& settings_notifier) -	: GUI::Widget(parent) +	: dggui::Widget(parent)  	, canvas(this, settings, settings_notifier)  	, settings(settings)  { @@ -50,12 +53,12 @@ PowerWidget::PowerWidget(GUI::Widget* parent,  	CONNECT(&shelf_checkbox, stateChangedNotifier, this, &PowerWidget::chk_shelf);  	shelf_label.setText(_("Shelf")); -	shelf_label.setAlignment(GUI::TextAlignment::center); +	shelf_label.setAlignment(dggui::TextAlignment::center);  	shelf_label.resize(59, 16);  	shelf_checkbox.resize(59, 40);  	CONNECT(&settings_notifier, powermap_shelf, &shelf_checkbox, -	        &GUI::CheckBox::setChecked); +	        &dggui::CheckBox::setChecked);  }  void PowerWidget::chk_shelf(bool v) @@ -63,9 +66,9 @@ void PowerWidget::chk_shelf(bool v)  	settings.powermap_shelf.store(v);  } -void PowerWidget::repaintEvent(GUI::RepaintEvent *repaintEvent) +void PowerWidget::repaintEvent(dggui::RepaintEvent *repaintEvent)  { -	GUI::Painter p(*this); +	dggui::Painter p(*this);  	box.setSize(width() - 59 - 64, height());  	p.drawImage(0, 0, box);  } @@ -84,10 +87,10 @@ void PowerWidget::resize(std::size_t width, std::size_t height)  	shelf_checkbox.move(width - 59 + 5 - 32, 16);  } -PowerWidget::Canvas::Canvas(GUI::Widget* parent, +PowerWidget::Canvas::Canvas(dggui::Widget* parent,                              Settings& settings,                              SettingsNotifier& settings_notifier) -	: GUI::Widget(parent) +	: dggui::Widget(parent)  	, settings_notifier(settings_notifier)  	, settings(settings)  { @@ -115,7 +118,7 @@ PowerWidget::Canvas::Canvas(GUI::Widget* parent,  	parameterChangedFloat(0);  } -void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent) +void PowerWidget::Canvas::repaintEvent(dggui::RepaintEvent *repaintEvent)  {  	if(width() < 1 || height() < 1)  	{ @@ -127,29 +130,29 @@ void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent)  	const float width0 = (int)width() - 2 * brd;  	const float height0 = (int)height() - 2 * brd; -	GUI::Painter p(*this); +	dggui::Painter p(*this);  	p.clear(); -	p.setColour(GUI::Colour(1.0f, 1.0f, 1.0f, 0.2f)); +	p.setColour(dggui::Colour(1.0f, 1.0f, 1.0f, 0.2f));  	p.drawRectangle(x0, y0 + height0, x0 + width0, y0);  	if(enabled)  	{  		// draw 1:1 line in grey in the background to indicate where 1:1 is -		p.setColour(GUI::Colour(0.5)); +		p.setColour(dggui::Colour(0.5));  		p.drawLine(x0, y0 + height0, x0 + width0, y0);  	}  	if(enabled)  	{  		// enabled green -		p.setColour(GUI::Colour(0.0f, 1.0f, 0.0f, 1.0f)); +		p.setColour(dggui::Colour(0.0f, 1.0f, 0.0f, 1.0f));  	}  	else  	{  		// disabled grey -		p.setColour(GUI::Colour(0.5f)); +		p.setColour(dggui::Colour(0.5f));  	}  	// Draw very short line segments across the region @@ -172,14 +175,14 @@ void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent)  	if(!enabled)  	{  		// draw 1:1 line in green in the foreground -		p.setColour(GUI::Colour(0.0f, 1.0f, 0.0f, 1.0f)); +		p.setColour(dggui::Colour(0.0f, 1.0f, 0.0f, 1.0f));  		p.drawLine(x0, y0 + height0, x0 + width0, y0);  	}  	// draw the input/output of the last hit  	if(settings.powermap_input.load() != -1 && settings.powermap_output.load() != -1)  	{ -		p.setColour(GUI::Colour(.8f, 0.0f, .2f, .5f)); +		p.setColour(dggui::Colour(.8f, 0.0f, .2f, .5f));  		p.drawLine(x0 + settings.powermap_input.load()*width0, y0 + height0,  				   x0 + settings.powermap_input.load()*width0, y0);  		p.drawLine(x0, y0 + height0 - settings.powermap_output.load()*height0, @@ -188,30 +191,30 @@ void PowerWidget::Canvas::repaintEvent(GUI::RepaintEvent *repaintEvent)  	// draw the fixed nodes of the spline  	float rad = radius * width(); -	p.setColour(GUI::Colour{0.0f, 1.0f, 0.0f, 0.7f}); +	p.setColour(dggui::Colour{0.0f, 1.0f, 0.0f, 0.7f});  	p.drawFilledCircle(x0 + std::round(settings.powermap_fixed0_x.load() * width0),  	                   y0 + height0 - std::round(settings.powermap_fixed0_y.load() * height0), rad);  	p.drawCircle(x0 + std::round(power_map.getFixed0().in * width0),  	             y0 + height0 - std::round(power_map.getFixed0().out * height0), rad + 1); -	p.setColour(GUI::Colour{1.0f, 1.0f, 0.0f, 0.7f}); +	p.setColour(dggui::Colour{1.0f, 1.0f, 0.0f, 0.7f});  	p.drawFilledCircle(x0 + std::round(settings.powermap_fixed1_x.load() * width0),  	                   y0 + height0 - std::round(settings.powermap_fixed1_y.load() * height0), rad);  	p.drawCircle(x0 + std::round(power_map.getFixed1().in * width0),  	             y0 + height0 - std::round(power_map.getFixed1().out * height0), rad + 1); -	p.setColour(GUI::Colour{1.0f, 0.0f, 0.0f, 0.7f}); +	p.setColour(dggui::Colour{1.0f, 0.0f, 0.0f, 0.7f});  	p.drawFilledCircle(x0 + std::round(settings.powermap_fixed2_x.load() * width0),  	                   y0 + height0 - std::round(settings.powermap_fixed2_y.load() * height0), rad);  	p.drawCircle(x0 + std::round(power_map.getFixed2().in * width0),  	             y0 + height0 - std::round(power_map.getFixed2().out * height0), rad + 1); -	p.setColour(GUI::Colour(1.0f, 1.0f, 1.0f, 0.2f)); +	p.setColour(dggui::Colour(1.0f, 1.0f, 1.0f, 0.2f));  	p.drawText(width() / 2 - (font.textWidth(_("in")) / 2), height() - 8, font, _("in"));  	p.drawText(8, height() / 2 - (font.textWidth(_("out")) / 2), font, _("out"), false, true);  } -void PowerWidget::Canvas::buttonEvent(GUI::ButtonEvent* buttonEvent) +void PowerWidget::Canvas::buttonEvent(dggui::ButtonEvent* buttonEvent)  {  	const float x0 = brd;  	const float y0 = brd; @@ -226,10 +229,10 @@ void PowerWidget::Canvas::buttonEvent(GUI::ButtonEvent* buttonEvent)  	switch(buttonEvent->direction)  	{ -	case GUI::Direction::up: +	case dggui::Direction::up:  		in_point = -1;  		break; -	case GUI::Direction::down: +	case dggui::Direction::down:  		if(std::abs(mx0 - settings.powermap_fixed0_x.load()) < radius_x &&  		   std::abs(my0 - settings.powermap_fixed0_y.load()) < radius_y)  		{ @@ -259,7 +262,7 @@ float clamp(float val, float min, float max)  }  } -void PowerWidget::Canvas::mouseMoveEvent(GUI::MouseMoveEvent* mouseMoveEvent) +void PowerWidget::Canvas::mouseMoveEvent(dggui::MouseMoveEvent* mouseMoveEvent)  {  	const float x0 = brd;  	const float y0 = brd; @@ -332,3 +335,5 @@ void PowerWidget::Canvas::parameterChangedBool(bool)  {  	parameterChangedFloat(0);  } + +} // ::GUI diff --git a/plugingui/powerwidget.h b/plugingui/powerwidget.h index c5c6665..3a7bb8e 100644 --- a/plugingui/powerwidget.h +++ b/plugingui/powerwidget.h @@ -26,48 +26,52 @@   */  #pragma once -#include <widget.h> -#include <texturedbox.h> -#include <texture.h> -#include <knob.h> -#include <checkbox.h> -#include <label.h> -#include <font.h> +#include <dggui/widget.h> +#include <dggui/texturedbox.h> +#include <dggui/texture.h> +#include <dggui/knob.h> +#include <dggui/checkbox.h> +#include <dggui/label.h> +#include <dggui/font.h> +  #include <powermap.h>  struct Settings;  class SettingsNotifier; +namespace GUI +{ +  class PowerWidget -	: public GUI::Widget +	: public dggui::Widget  {  public: -	PowerWidget(GUI::Widget* parent, +	PowerWidget(dggui::Widget* parent,  	            Settings& settings,  	            SettingsNotifier& settings_notifier);  	// From Widget: -	virtual void repaintEvent(GUI::RepaintEvent *repaintEvent) override; +	virtual void repaintEvent(dggui::RepaintEvent *repaintEvent) override;  	virtual void resize(std::size_t width, std::size_t height) override;  private: -	GUI::TexturedBox box{getImageCache(), ":resources/widget.png", +	dggui::TexturedBox box{getImageCache(), ":resources/widget.png",  			0, 0, // atlas offset (x, y)  			7, 1, 7, // dx1, dx2, dx3  			7, 63, 7}; // dy1, dy2, dy3  	class Canvas -		: public GUI::Widget +		: public dggui::Widget  	{  	public: -		Canvas(GUI::Widget* parent, Settings& settings, +		Canvas(dggui::Widget* parent, Settings& settings,  		       SettingsNotifier& settings_notifier);  		// From Widget:  		virtual bool catchMouse() override { return true; } -		virtual void repaintEvent(GUI::RepaintEvent *repaintEvent) override; -		virtual void buttonEvent(GUI::ButtonEvent* buttonEvent) override; -		virtual void mouseMoveEvent(GUI::MouseMoveEvent* mouseMoveEvent) override; +		virtual void repaintEvent(dggui::RepaintEvent *repaintEvent) override; +		virtual void buttonEvent(dggui::ButtonEvent* buttonEvent) override; +		virtual void mouseMoveEvent(dggui::MouseMoveEvent* mouseMoveEvent) override;  		virtual void mouseLeaveEvent() override;  	private: @@ -84,14 +88,16 @@ private:  		int in_point{-1};  		const float radius = 0.02f;  		const float brd = 6.0f; -		GUI::Font font{":resources/fontemboss.png"}; +		dggui::Font font{":resources/fontemboss.png"};  	};  	void chk_shelf(bool v);  	Canvas canvas; -	GUI::Label shelf_label{this}; -	GUI::CheckBox shelf_checkbox{this}; +	dggui::Label shelf_label{this}; +	dggui::CheckBox shelf_checkbox{this};  	Settings& settings;  }; + +} // ::GUI diff --git a/plugingui/resamplingframecontent.cc b/plugingui/resamplingframecontent.cc index 035781f..d92dc27 100644 --- a/plugingui/resamplingframecontent.cc +++ b/plugingui/resamplingframecontent.cc @@ -33,10 +33,10 @@  namespace GUI  { -ResamplingframeContent::ResamplingframeContent(Widget* parent, +ResamplingframeContent::ResamplingframeContent(dggui::Widget* parent,                                                 Settings& settings,                                                 SettingsNotifier& settings_notifier) -	: Widget(parent) +	: dggui::Widget(parent)  	, settings(settings)  	, settings_notifier(settings_notifier)  { @@ -57,7 +57,7 @@ ResamplingframeContent::ResamplingframeContent(Widget* parent,  	quality_knob.showValue(false);  	quality_label.setText(_("Quality")); -	quality_label.setAlignment(TextAlignment::center); +	quality_label.setAlignment(dggui::TextAlignment::center);  	quality_label.resize(40, 16);  	CONNECT(&quality_knob, valueChangedNotifier, diff --git a/plugingui/resamplingframecontent.h b/plugingui/resamplingframecontent.h index 3efc62e..3bdddc6 100644 --- a/plugingui/resamplingframecontent.h +++ b/plugingui/resamplingframecontent.h @@ -26,10 +26,10 @@   */  #pragma once -#include "widget.h" -#include "textedit.h" -#include "knob.h" -#include "label.h" +#include <dggui/widget.h> +#include <dggui/textedit.h> +#include <dggui/knob.h> +#include <dggui/label.h>  class SettingsNotifier;  struct Settings; @@ -38,10 +38,10 @@ namespace GUI  {  class ResamplingframeContent -	: public Widget +	: public dggui::Widget  {  public: -	ResamplingframeContent(Widget* parent, +	ResamplingframeContent(dggui::Widget* parent,  	                       Settings& settings,  	                       SettingsNotifier& settings_notifier); @@ -58,9 +58,9 @@ private:  	void valueChangedNotifier(float value);  private: -	TextEdit text_field{this}; -	Knob quality_knob{this}; -	Label quality_label{this}; +	dggui::TextEdit text_field{this}; +	dggui::Knob quality_knob{this}; +	dggui::Label quality_label{this};  	Settings& settings;  	SettingsNotifier& settings_notifier; diff --git a/plugingui/sampleselectionframecontent.cc b/plugingui/sampleselectionframecontent.cc index f0aa5e7..61b816f 100644 --- a/plugingui/sampleselectionframecontent.cc +++ b/plugingui/sampleselectionframecontent.cc @@ -28,15 +28,15 @@  #include <settings.h> -#include "painter.h" +#include <dggui/painter.h>  namespace GUI  { -SampleselectionframeContent::SampleselectionframeContent(Widget* parent, +SampleselectionframeContent::SampleselectionframeContent(dggui::Widget* parent,                                               Settings& settings,                                               SettingsNotifier& settings_notifier) -	: Widget(parent) +	: dggui::Widget(parent)  	, settings(settings)  	, settings_notifier(settings_notifier)  { @@ -63,9 +63,9 @@ SampleselectionframeContent::SampleselectionframeContent(Widget* parent,  	f_random.setControl(&f_random_knob);  	layout.addItem(&f_random); -	layout.setPosition(&f_close, GridLayout::GridRange{0, 1, 0, 1}); -	layout.setPosition(&f_diverse, GridLayout::GridRange{1, 2, 0, 1}); -	layout.setPosition(&f_random, GridLayout::GridRange{2, 3, 0, 1}); +	layout.setPosition(&f_close, dggui::GridLayout::GridRange{0, 1, 0, 1}); +	layout.setPosition(&f_diverse, dggui::GridLayout::GridRange{1, 2, 0, 1}); +	layout.setPosition(&f_random, dggui::GridLayout::GridRange{2, 3, 0, 1});  	CONNECT(this, settings_notifier.sample_selection_f_close,  	        this, &SampleselectionframeContent::fCloseSettingsValueChanged); diff --git a/plugingui/sampleselectionframecontent.h b/plugingui/sampleselectionframecontent.h index f3636da..ab1be04 100644 --- a/plugingui/sampleselectionframecontent.h +++ b/plugingui/sampleselectionframecontent.h @@ -26,10 +26,11 @@   */  #pragma once -#include "knob.h" +#include <dggui/knob.h> +#include <dggui/layout.h> +#include <dggui/widget.h> +  #include "labeledcontrol.h" -#include "layout.h" -#include "widget.h"  #include <translation.h> @@ -40,10 +41,10 @@ namespace GUI  {  class SampleselectionframeContent -	: public Widget +	: public dggui::Widget  {  public: -	SampleselectionframeContent(Widget* parent, +	SampleselectionframeContent(dggui::Widget* parent,  	                            Settings& settings,  	                            SettingsNotifier& settings_notifier); @@ -56,15 +57,15 @@ private:  	void fDiverseSettingsValueChanged(float value);  	void fRandomSettingsValueChanged(float value); -	GridLayout layout{this, 3, 1}; +	dggui::GridLayout layout{this, 3, 1};  	LabeledControl f_close{this, _("pClose")};  	LabeledControl f_diverse{this, _("pDiverse")};  	LabeledControl f_random{this, _("pRandom")}; -	Knob f_close_knob{&f_close}; -	Knob f_diverse_knob{&f_diverse}; -	Knob f_random_knob{&f_random}; +	dggui::Knob f_close_knob{&f_close}; +	dggui::Knob f_diverse_knob{&f_diverse}; +	dggui::Knob f_random_knob{&f_random};  	Settings& settings;  	SettingsNotifier& settings_notifier; diff --git a/plugingui/statusframecontent.cc b/plugingui/statusframecontent.cc index 3152dfd..7990d3e 100644 --- a/plugingui/statusframecontent.cc +++ b/plugingui/statusframecontent.cc @@ -31,9 +31,10 @@  namespace GUI  { -StatusframeContent::StatusframeContent(Widget* parent, +StatusframeContent::StatusframeContent(dggui::Widget* parent,                                         SettingsNotifier& settings_notifier) -	: Widget(parent), settings_notifier(settings_notifier) +	: dggui::Widget(parent) +	, settings_notifier(settings_notifier)  {  	CONNECT(this, settings_notifier.drumkit_load_status,  	        this, &StatusframeContent::updateDrumkitLoadStatus); @@ -62,7 +63,7 @@ StatusframeContent::StatusframeContent(Widget* parent,  void StatusframeContent::resize(std::size_t width, std::size_t height)  { -	Widget::resize(width, height); +	dggui::Widget::resize(width, height);  	text_field.resize(width, height);  } @@ -87,6 +88,7 @@ void StatusframeContent::updateDrumkitLoadStatus(LoadStatus load_status)  	case LoadStatus::Idle:  		drumkit_load_status = _("No Kit Loaded");  		break; +	case LoadStatus::Parsing:  	case LoadStatus::Loading:  		drumkit_load_status = _("Loading...");  		break; @@ -129,6 +131,7 @@ void StatusframeContent::updateMidimapLoadStatus(LoadStatus load_status)  	case LoadStatus::Idle:  		midimap_load_status = _("No Midimap Loaded");  		break; +	case LoadStatus::Parsing:  	case LoadStatus::Loading:  		midimap_load_status = _("Loading...");  		break; diff --git a/plugingui/statusframecontent.h b/plugingui/statusframecontent.h index 998e87c..55f7a16 100644 --- a/plugingui/statusframecontent.h +++ b/plugingui/statusframecontent.h @@ -27,18 +27,21 @@  #pragma once  #include "settings.h" -#include "textedit.h" -#include "widget.h" + +#include <dggui/textedit.h> +#include <dggui/widget.h>  class SettingsNotifier;  namespace GUI  { -class StatusframeContent : public Widget +class StatusframeContent +	: public dggui::Widget  {  public: -	StatusframeContent(Widget* parent, SettingsNotifier& settings_notifier); +	StatusframeContent(dggui::Widget* parent, +	                   SettingsNotifier& settings_notifier);  	// From Widget  	virtual void resize(std::size_t width, std::size_t height) override; @@ -55,7 +58,7 @@ public:  	void loadStatusTextChanged(const std::string& text);  private: -	TextEdit text_field{this}; +	dggui::TextEdit text_field{this};  	SettingsNotifier& settings_notifier; diff --git a/plugingui/testmain.cc b/plugingui/testmain.cc index 3f73039..0ac3bc5 100644 --- a/plugingui/testmain.cc +++ b/plugingui/testmain.cc @@ -31,23 +31,23 @@  #include <settings.h>  #include <config.h> -#include "mainwindow.h" -#include "window.h" -#include "resource.h" -#include "uitranslation.h" +#include <dggui/window.h> +#include <dggui/resource.h> +#include <dggui/uitranslation.h> +  #include "mainwindow.h"  int main()  {  #ifdef WITH_NLS -	UITranslation translation; +	dggui::UITranslation translation;  #endif // WITH_NLS  	INFO(example, "We are up and running");  	void* native_window_handle{nullptr};  #ifndef UI_PUGL -	GUI::Window parent{nullptr}; +	dggui::Window parent{nullptr};  	parent.setCaption("PluginGui Test Application");  	native_window_handle = parent.getNativeWindowHandle();  #endif @@ -57,7 +57,7 @@ int main()  #ifndef UI_PUGL  	CONNECT(&parent, eventHandler()->closeNotifier, &main_window, -	    &GUI::MainWindow::closeEventHandler); +	        &GUI::MainWindow::closeEventHandler);  	parent.show();  #endif diff --git a/plugingui/timingframecontent.cc b/plugingui/timingframecontent.cc index ceaf5be..18784f0 100644 --- a/plugingui/timingframecontent.cc +++ b/plugingui/timingframecontent.cc @@ -29,15 +29,15 @@  #include <cmath>  #include <iostream> -#include "painter.h" +#include <dggui/painter.h>  namespace GUI  { -TimingframeContent::TimingframeContent(Widget* parent, +TimingframeContent::TimingframeContent(dggui::Widget* parent,                                         Settings& settings,                                         SettingsNotifier& settings_notifier) -	: Widget(parent) +	: dggui::Widget(parent)  	, settings(settings)  	, settings_notifier(settings_notifier)  { @@ -65,9 +65,9 @@ TimingframeContent::TimingframeContent(Widget* parent,  	laidback.setControl(&laidback_knob);  	layout.addItem(&laidback); -	layout.setPosition(&tightness, GridLayout::GridRange{0, 1, 0, 1}); -	layout.setPosition(®ain, GridLayout::GridRange{1, 2, 0, 1}); -	layout.setPosition(&laidback, GridLayout::GridRange{2, 3, 0, 1}); +	layout.setPosition(&tightness, dggui::GridLayout::GridRange{0, 1, 0, 1}); +	layout.setPosition(®ain, dggui::GridLayout::GridRange{1, 2, 0, 1}); +	layout.setPosition(&laidback, dggui::GridLayout::GridRange{2, 3, 0, 1});  	CONNECT(this, settings_notifier.latency_stddev,  	        this, &TimingframeContent::tightnessSettingsValueChanged); diff --git a/plugingui/timingframecontent.h b/plugingui/timingframecontent.h index 3dde8c1..4dfa974 100644 --- a/plugingui/timingframecontent.h +++ b/plugingui/timingframecontent.h @@ -26,11 +26,12 @@   */  #pragma once -#include "knob.h" -#include "label.h" +#include <dggui/knob.h> +#include <dggui/label.h> +#include <dggui/layout.h> +#include <dggui/widget.h> +  #include "labeledcontrol.h" -#include "layout.h" -#include "widget.h"  #include <settings.h> @@ -45,10 +46,10 @@ namespace GUI  {  class TimingframeContent -	: public Widget +	: public dggui::Widget  {  public: -	TimingframeContent(Widget* parent, +	TimingframeContent(dggui::Widget* parent,  	                   Settings& settings,  	                   SettingsNotifier& settings_notifier); @@ -68,15 +69,15 @@ private:  	void latencyOffsetChanged(int offset);  	void velocityOffsetChanged(float offset); -	GridLayout layout{this, 3, 1}; +	dggui::GridLayout layout{this, 3, 1};  	LabeledControl tightness{this, _("pTightness")};  	LabeledControl regain{this, _("pTimingRegain")};  	LabeledControl laidback{this, _("pLaidback")}; -	Knob tightness_knob{&tightness}; -	Knob regain_knob{®ain}; -	Knob laidback_knob{&laidback}; +	dggui::Knob tightness_knob{&tightness}; +	dggui::Knob regain_knob{®ain}; +	dggui::Knob laidback_knob{&laidback};  	Settings& settings;  	SettingsNotifier& settings_notifier; diff --git a/plugingui/visualizerframecontent.cc b/plugingui/visualizerframecontent.cc index 7e5b298..3404bec 100644 --- a/plugingui/visualizerframecontent.cc +++ b/plugingui/visualizerframecontent.cc @@ -29,22 +29,22 @@  #include <cmath>  #include <iostream> -#include "painter.h" +#include <dggui/painter.h>  namespace GUI  { -VisualizerframeContent::VisualizerframeContent(Widget* parent, +VisualizerframeContent::VisualizerframeContent(dggui::Widget* parent,                                                 Settings& settings,                                                 SettingsNotifier& settings_notifier) -	: Widget(parent) +	: dggui::Widget(parent)  	, visualizer(this, settings, settings_notifier)  {  }  void VisualizerframeContent::resize(std::size_t width, std::size_t height)  { -	Widget::resize(width, height); +	dggui::Widget::resize(width, height);  	visualizer.resize(width, height);  } diff --git a/plugingui/visualizerframecontent.h b/plugingui/visualizerframecontent.h index edf8f35..abf54c4 100644 --- a/plugingui/visualizerframecontent.h +++ b/plugingui/visualizerframecontent.h @@ -25,8 +25,10 @@   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.   */  #pragma once -#include "layout.h" -#include "widget.h" + +#include <dggui/layout.h> +#include <dggui/widget.h> +  #include "humaniservisualiser.h"  #include <settings.h> @@ -40,10 +42,10 @@ namespace GUI  {  class VisualizerframeContent -	: public Widget +	: public dggui::Widget  {  public: -	VisualizerframeContent(Widget* parent, Settings& settings, +	VisualizerframeContent(dggui::Widget* parent, Settings& settings,  	                       SettingsNotifier& settings_notifier);  		// From Widget diff --git a/plugingui/voicelimitframecontent.cc b/plugingui/voicelimitframecontent.cc index c7c8c28..00036a0 100644 --- a/plugingui/voicelimitframecontent.cc +++ b/plugingui/voicelimitframecontent.cc @@ -30,25 +30,25 @@  namespace GUI  { -VoiceLimitFrameContent::VoiceLimitFrameContent(Widget* parent, +VoiceLimitFrameContent::VoiceLimitFrameContent(dggui::Widget* parent,                                                 Settings& settings,                                                 SettingsNotifier& settings_notifier) -	: Widget(parent) +	: dggui::Widget(parent)  	, settings(settings)  	, settings_notifier(settings_notifier)  {  	//Setup frame.  	label_text.setText(_("Per-instrument voice limit:")); -	label_text.setAlignment(TextAlignment::center); +	label_text.setAlignment(dggui::TextAlignment::center);  	//Setup layout  	layout.setResizeChildren(false);  	auto setup_control = -		[](Knob& knob, +		[](dggui::Knob& knob,  		   LabeledControl& label, -		   GridLayout& layout, -		   const GridLayout::GridRange& gridrange, +		   dggui::GridLayout& layout, +		   const dggui::GridLayout::GridRange& gridrange,  		   float min,  		   float max,  		   float defaultval) diff --git a/plugingui/voicelimitframecontent.h b/plugingui/voicelimitframecontent.h index 8b08014..2ea1978 100644 --- a/plugingui/voicelimitframecontent.h +++ b/plugingui/voicelimitframecontent.h @@ -28,10 +28,11 @@  #include <translation.h> -#include "label.h" -#include "knob.h" +#include <dggui/label.h> +#include <dggui/knob.h> +#include <dggui/widget.h> +  #include "labeledcontrol.h" -#include "widget.h"  struct Settings;  class SettingsNotifier; @@ -40,10 +41,10 @@ namespace GUI  {  class VoiceLimitFrameContent -	: public Widget +	: public dggui::Widget  {  public: -	VoiceLimitFrameContent(Widget* parent, +	VoiceLimitFrameContent(dggui::Widget* parent,  	                       Settings& settings,  	                       SettingsNotifier& settings_notifier); @@ -59,15 +60,15 @@ private:  	Settings& settings;  	SettingsNotifier& settings_notifier; -	Label label_text{this}; +	dggui::Label label_text{this}; -	GridLayout layout{this, 2, 1}; +	dggui::GridLayout layout{this, 2, 1};  	LabeledControl lc_max_voices{this, _("Max voices")};  	LabeledControl lc_rampdown_time{this, _("Rampdown time")}; -	Knob knob_max_voices{&lc_max_voices}; -	Knob knob_rampdown_time{&lc_rampdown_time}; +	dggui::Knob knob_max_voices{&lc_max_voices}; +	dggui::Knob knob_rampdown_time{&lc_rampdown_time};  };  } // GUI:: diff --git a/src/Makefile.am b/src/Makefile.am index b656f48..85b10fa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,7 +32,7 @@ libpugi_la_SOURCES = \  libdg_la_CPPFLAGS = \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/hugin -I$(top_srcdir)/pugixml/src \ -	$(SSEFLAGS) -I$(top_srcdir)/zita-resampler/libs +	$(SSEFLAGS) -I$(top_srcdir)/zita-resampler/libs \  	$(SNDFILE_CFLAGS) $(PTHREAD_CFLAGS)  libdg_la_LIBADD = \ diff --git a/src/audiofile.h b/src/audiofile.h index e20d91f..504d0ae 100644 --- a/src/audiofile.h +++ b/src/audiofile.h @@ -32,8 +32,6 @@  #include <limits>  #include <mutex> -#include <sndfile.h> -  #include "audio.h"  #include "channel.h"  #include "logger.h" diff --git a/src/audioinputenginemidi.cc b/src/audioinputenginemidi.cc index ce3ce18..69aeeb6 100644 --- a/src/audioinputenginemidi.cc +++ b/src/audioinputenginemidi.cc @@ -117,32 +117,35 @@ void AudioInputEngineMidi::processNote(const std::uint8_t* midi_buffer,  	auto key = midi_buffer[1];  	auto velocity = midi_buffer[2];  	auto instrument_idx = mmap.lookup(key); - -	switch(midi_buffer[0] & NoteMask) +	auto instruments = mmap.lookup(key); +	for(const auto& instrument_idx : instruments)  	{ -	case NoteOff: -		// Ignore for now -		break; - -	case NoteOn: -		if(velocity != 0 && instrument_idx != -1) -		{ -			// maps velocities to [.5/127, 126.5/127] -			auto centered_velocity = (velocity-.5f)/127.0f; -			events.push_back({EventType::OnSet, (std::size_t)instrument_idx, -			                  offset, centered_velocity}); -		} -		break; - -	case NoteAftertouch: -		if(velocity == 0 && instrument_idx != -1) +		switch(midi_buffer[0] & NoteMask)  		{ -			events.push_back({EventType::Choke, (std::size_t)instrument_idx, -			                  offset, .0f}); +		case NoteOff: +			// Ignore for now +			break; + +		case NoteOn: +			if(velocity != 0) +			{ +				// maps velocities to [.5/127, 126.5/127] +				auto centered_velocity = (velocity-.5f)/127.0f; +				events.push_back({EventType::OnSet, (std::size_t)instrument_idx, +				                  offset, centered_velocity}); +			} +			break; + +		case NoteAftertouch: +			if(velocity > 0) +			{ +				events.push_back({EventType::Choke, (std::size_t)instrument_idx, +				                  offset, .0f}); +			} +			break; + +		default: +			break;  		} -		break; - -	default: -		break;  	}  } diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index ca91c12..abe57be 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -119,6 +119,12 @@ void DrumGizmo::setRandomSeed(unsigned int seed)  bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples)  { +	if(settings_getter.drumkit_file.hasChanged()) +	{ +		// New kit loaded/loading - old events no longer makes sense. +		events_ds.clear(); +	} +  	if(settings_getter.enable_resampling.hasChanged())  	{  		enable_resampling = settings_getter.enable_resampling.getValue(); @@ -191,6 +197,11 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples)  		for(size_t c = 0; c < kit.channels.size(); ++c)  		{ +			if(c >= NUM_CHANNELS) // kit may have more channels than the engine +			{ +				break; +			} +  			sample_t *buf = samples;  			bool internal = false;  			if(oe.getBuffer(c)) @@ -218,6 +229,11 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples)  		size_t kitpos = pos * ratio;  		for(size_t c = 0; c < kit.channels.size(); ++c)  		{ +			if(c >= NUM_CHANNELS) // kit may have more channels than the engine +			{ +				break; +			} +  			sample_t *buf = samples;  			bool internal = false;  			if(oe.getBuffer(c)) @@ -333,6 +349,8 @@ repeat:  void DrumGizmo::getSamples(int ch, int pos, sample_t* s, size_t sz)  { +	assert(ch < NUM_CHANNELS); +  	// Store local values of settings to ensure they don't change intra-iteration  	const auto enable_bleed_control = settings.enable_bleed_control.load();  	const auto master_bleed = settings.master_bleed.load(); @@ -346,8 +364,9 @@ void DrumGizmo::getSamples(int ch, int pos, sample_t* s, size_t sz)  		if(!af.isLoaded() || !af.isValid() || (s == nullptr))  		{ -			removeevent = true; -			break; +			// This event cannot be played - schedule for deletion and continue. +			to_remove.push_back(sample_event.id); +			continue;  		}  		if(sample_event.offset > (pos + sz)) @@ -431,7 +450,7 @@ float DrumGizmo::samplerate()  void DrumGizmo::setSamplerate(float samplerate, float resampling_quality)  { -	DEBUG(dgeditor, "%s samplerate: %f\n", __PRETTY_FUNCTION__, samplerate); +	DEBUG(engine, "%s samplerate: %f\n", __PRETTY_FUNCTION__, samplerate);  	settings.samplerate.store(samplerate);  	// Notify input engine of the samplerate change. @@ -463,10 +482,14 @@ void DrumGizmo::setSamplerate(float samplerate, float resampling_quality)  		zita[c].set_inp_data(nullptr);  		zita[c].set_inp_count(null_size); -		constexpr auto sz = 4096 * 16; -		sample_t s[sz]; -		zita[c].set_out_data(s); -		zita[c].set_out_count(sz); +		std::size_t scratch_buffer_size = (null_size / ratio); + +		if(scratch_buffer.size() < scratch_buffer_size) +		{ +			scratch_buffer.resize(scratch_buffer_size); +		} +		zita[c].set_out_data(scratch_buffer.data()); +		zita[c].set_out_count(scratch_buffer_size);  		zita[c].process();  	} diff --git a/src/drumgizmo.h b/src/drumgizmo.h index f08c9f7..89c2960 100644 --- a/src/drumgizmo.h +++ b/src/drumgizmo.h @@ -107,5 +107,5 @@ protected:  	std::array<ZRWrapper, NUM_CHANNELS> zita;  	std::array<std::unique_ptr<sample_t>, NUM_CHANNELS> resampler_input_buffer;  	double ratio = 1.0; - +	std::vector<sample_t> scratch_buffer;  }; diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc index 6a4c9f4..9167201 100644 --- a/src/drumkitloader.cc +++ b/src/drumkitloader.cc @@ -138,7 +138,7 @@ bool DrumKitLoader::loadkit(const std::string& file)  	settings.drumkit_samplerate.store(44100);  	settings.load_status_text.store(""); -	settings.drumkit_load_status.store(LoadStatus::Loading); +	settings.drumkit_load_status.store(LoadStatus::Parsing);  	// Parse drumkit and instrument xml @@ -226,6 +226,9 @@ bool DrumKitLoader::loadkit(const std::string& file)  		settings.midimap_file = drumkit_path + "/" + drumkitdom.metadata.default_midimap_file;  	} +	// Done parsing. Now start loading the audio +	settings.midimap_load_status.store(LoadStatus::Loading); +  	loadKitAudio(kit);  	DEBUG(loadkit, "loadkit: Success\n"); diff --git a/src/events_ds.cc b/src/events_ds.cc index ee21f93..0195a89 100644 --- a/src/events_ds.cc +++ b/src/events_ds.cc @@ -99,6 +99,25 @@ void EventsDS::startAddingNewGroup(InstrumentID instrument_id)  	}  } +void EventsDS::clear() +{ +	// *this = EventsDS(); + +	id_to_info.clear(); +	id_to_group_data.clear(); +	for (auto& channel_data: channel_data_array) +	{ +		channel_data.sample_events.clear(); +	} +	for (auto& event_group_ids:  instruments_sample_event_group_ids) +	{ +		event_group_ids.clear(); +	} + +	current_group_id.invalidate(); +	current_groups_instrument_id.invalidate(); +} +  void EventsDS::removeGroup(EventGroupID group_id, InstrumentID instrument_id)  {  	// if we remove the current group, then invalidate it diff --git a/src/events_ds.h b/src/events_ds.h index 5855711..41287d1 100644 --- a/src/events_ds.h +++ b/src/events_ds.h @@ -96,6 +96,9 @@ public:  	//! when startAddingNewGroup is again called.  	void startAddingNewGroup(InstrumentID instrument_id = InstrumentID()); +	//! Clears the whole data structure to make it ready for a new drum kit. +	void clear(); +  private:  	struct ChannelData  	{ @@ -146,6 +149,8 @@ private:  template <typename T, typename... Args>  T& EventsDS::emplace(channel_t ch, Args&&... args)  { +	assert(ch < NUM_CHANNELS); +  	// add new event types here  	static_assert(std::is_same<T, SampleEvent>::value, "Check event type"); @@ -177,6 +182,8 @@ T& EventsDS::get(EventID event_id)  template <typename T>  ContainerRange<std::vector<T>> EventsDS::iterateOver(channel_t ch)  { +	assert(ch < NUM_CHANNELS); +  	// add new event types here  	static_assert(std::is_same<T, SampleEvent>::value, "Check event type"); @@ -190,6 +197,8 @@ ContainerRange<std::vector<T>> EventsDS::iterateOver(channel_t ch)  template <typename T>  T& EventsDS::getSample(EventInfo const& info)  { +	assert(info.ch < NUM_CHANNELS); +  	// add new event types here  	static_assert(std::is_same<T, SampleEvent>::value, "Check event type"); diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc index fd6e5b9..7d12bdd 100644 --- a/src/inputprocessor.cc +++ b/src/inputprocessor.cc @@ -163,6 +163,11 @@ static void applyChokeGroup(Settings& settings, DrumKit& kit,  	// Add event to ramp down all existing events with the same groupname.  	for(const auto& ch : kit.channels)  	{ +		if(ch.num >= NUM_CHANNELS) // kit may have more channels than the engine +		{ +			continue; +		} +  		for(auto& event_sample : events_ds.iterateOver<SampleEvent>(ch.num))  		{  			if(event_sample.group == instr.getGroup() && @@ -186,13 +191,18 @@ static void applyDirectedChoke(Settings& settings, DrumKit& kit,  		// Add event to ramp down all existing events with the same groupname.  		for(const auto& ch : kit.channels)  		{ +			if(ch.num >= NUM_CHANNELS) // kit may have more channels than the engine +			{ +				continue; +			} +  			for(auto& event_sample : events_ds.iterateOver<SampleEvent>(ch.num))  			{  				if(choke.instrument_id == event_sample.instrument_id &&  				   event_sample.rampdown_count == -1) // Only if not already ramping.  				{  					// choke.choketime is in ms -					applyChoke(settings, event_sample, choke.choketime, event_sample.offset); +					applyChoke(settings, event_sample, choke.choketime, event.offset);  				}  			}  		} @@ -264,6 +274,11 @@ bool InputProcessor::processOnset(event_t& event, std::size_t pos,  	bool new_group_added = false;  	for(Channel& ch: kit.channels)  	{ +		if(ch.num >= NUM_CHANNELS) // kit may have more channels than the engine +		{ +			continue; +		} +  		const auto af = sample->getAudioFile(ch);  		if(af == nullptr || !af->isValid())  		{ @@ -330,13 +345,18 @@ bool InputProcessor::processChoke(event_t& event,  	// Add event to ramp down all existing events with the same groupname.  	for(const auto& ch : kit.channels)  	{ +		if(ch.num >= NUM_CHANNELS) // kit may have more channels than the engine +		{ +			continue; +		} +  		for(auto& event_sample : events_ds.iterateOver<SampleEvent>(ch.num))  		{  			if(event_sample.instrument_id == instrument_id &&  			   event_sample.rampdown_count == -1) // Only if not already ramping.  			{  				// Fixed group rampdown time of 68ms, independent of samplerate -				applyChoke(settings, event_sample, 68, event_sample.offset); +				applyChoke(settings, event_sample, 450, event.offset);  			}  		}  	} @@ -357,6 +377,11 @@ bool InputProcessor::processStop(event_t& event)  		int num_active_events = 0;  		for(auto& ch: kit.channels)  		{ +			if(ch.num >= NUM_CHANNELS) // kit may have more channels than the engine +			{ +				continue; +			} +  			num_active_events += events_ds.numberOfEvents(ch.num);  		} diff --git a/src/memory_heap.h b/src/memory_heap.h index 3f0105a..658598c 100644 --- a/src/memory_heap.h +++ b/src/memory_heap.h @@ -61,6 +61,7 @@ public:  	T& get(Index index);  	const T& get(Index index) const;  	void remove(Index index); +	void clear();  private:  	std::vector<T> memory; @@ -119,3 +120,10 @@ void MemoryHeap<T>::remove(Index index)  {  	free_indices.push_back(index);  } + +template <typename T> +void MemoryHeap<T>::clear() +{ +	memory.clear(); +	free_indices.clear(); +} diff --git a/src/midimapparser.cc b/src/midimapparser.cc index 059dfec..363e1d5 100644 --- a/src/midimapparser.cc +++ b/src/midimapparser.cc @@ -50,7 +50,8 @@ bool MidiMapParser::parseFile(const std::string& filename)  			continue;  		} -		midimap[note] = instr; +		MidimapEntry entry{note, instr}; +		midimap.push_back(entry);  	}  	return true; diff --git a/src/midimapper.cc b/src/midimapper.cc index 9593aae..b9316c5 100644 --- a/src/midimapper.cc +++ b/src/midimapper.cc @@ -26,23 +26,25 @@   */  #include "midimapper.h" -int MidiMapper::lookup(int note) +std::vector<int> MidiMapper::lookup(int note_id)  { -	std::lock_guard<std::mutex> guard(mutex); +	std::vector<int> instruments; -	auto midimap_it = midimap.find(note); -	if(midimap_it == midimap.end()) -	{ -		return -1; -	} +	std::lock_guard<std::mutex> guard(mutex); -	auto instrmap_it = instrmap.find(midimap_it->second); -	if(instrmap_it == instrmap.end()) +	for(const auto& map_entry : midimap)  	{ -		return -1; +		if(map_entry.note_id == note_id) +		{ +			auto instrmap_it = instrmap.find(map_entry.instrument_name); +			if(instrmap_it != instrmap.end()) +			{ +				instruments.push_back(instrmap_it->second); +			} +		}  	} -	return instrmap_it->second; +	return instruments;  }  void MidiMapper::swap(instrmap_t& instrmap, midimap_t& midimap) diff --git a/src/midimapper.h b/src/midimapper.h index 4673e33..94781d4 100644 --- a/src/midimapper.h +++ b/src/midimapper.h @@ -29,16 +29,22 @@  #include <map>  #include <string>  #include <mutex> +#include <vector> -typedef std::map<int, std::string> midimap_t; -typedef std::map<std::string, int> instrmap_t; +struct MidimapEntry +{ +	int note_id; +	std::string instrument_name; +}; + +using midimap_t = std::vector<MidimapEntry>; +using instrmap_t = std::map<std::string, int>;  class MidiMapper  {  public: -	//! Lookup note in map and return its index. -	//! \returns -1 if not found or the note index. -	int lookup(int note); +	//! Lookup note in map and returns the corresponding instrument index list. +	std::vector<int> lookup(int note_id);  	//! Set new map sets.  	void swap(instrmap_t& instrmap, midimap_t& midimap); diff --git a/src/sample_selection.cc b/src/sample_selection.cc index 7267faf..31313bb 100644 --- a/src/sample_selection.cc +++ b/src/sample_selection.cc @@ -103,8 +103,7 @@ const Sample* SampleSelection::get(level_t level, std::size_t pos)  	{  		DEBUG(rand, "%d %d", (int)up_index, (int)down_index); -		// at least avoid infinite loops in case of a bug... -		if (up_index == samples.size()-1 && down_index == 0) { break; } +		assert(down_index <= up_index);  		std::size_t current_index;  		if (up_value_lb < down_value_lb) diff --git a/src/settings.h b/src/settings.h index 7507827..fb93d79 100644 --- a/src/settings.h +++ b/src/settings.h @@ -38,6 +38,7 @@  enum class LoadStatus : unsigned int  {  	Idle, +	Parsing,  	Loading,  	Done,  	Error diff --git a/src/translation.h b/src/translation.h index 7f506a6..d8a6072 100644 --- a/src/translation.h +++ b/src/translation.h @@ -26,6 +26,8 @@   */  #pragma once +#include <cstdint> +  #include <config.h>  #ifdef WITH_NLS diff --git a/test/Makefile.am b/test/Makefile.am index c2c151d..6441fd3 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -8,7 +8,7 @@ TESTS = resource enginetest paintertest configfile audiocache \  	randomtest atomictest syncedsettingstest imagecachetest \  	semaphoretest drumkitcreatortest bytesizeparsertest notifiertest \  	dgxmlparsertest domloadertest configparsertest midimapparsertest \ -	eventsdstest powermaptest +	eventsdstest powermaptest midimappertest  if WITH_NLS  TESTS += translationtest @@ -24,27 +24,34 @@ if ENABLE_LV2  TESTS += lv2  endif +noinst_PROGRAMS = $(TESTS)  check_PROGRAMS = $(TESTS) -resource_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"resource\" $(SNDFILE_CFLAGS) \ + +resource_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"resource\" \ +	$(SNDFILE_CFLAGS) \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src \ -	-I$(top_srcdir)/plugingui \ +	-I$(top_srcdir)/ \  	-I$(top_srcdir)/hugin  resource_LDFLAGS = $(SNDFILE_LIBS)  nodist_resource_SOURCES = \  	$(top_builddir)/plugingui/resource_data.cc  resource_SOURCES = \ -	$(top_srcdir)/plugingui/resource.cc \ +	$(top_srcdir)/dggui/resource.cc \  	$(top_srcdir)/hugin/hugin.c \  	$(top_srcdir)/src/random.cc \  	uunit/uunit.cc \  	drumkit_creator.cc \  	resource_test.cc -audiocache_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocache\" \ +audiocache_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocache\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src \ -	-I$(top_srcdir)/hugin -DDISABLE_HUGIN $(PTHREAD_CFLAGS) $(SNDFILE_CFLAGS) +	-I$(top_srcdir)/hugin -DDISABLE_HUGIN \ +	$(PTHREAD_CFLAGS) \ +	$(SNDFILE_CFLAGS)  audiocache_LDFLAGS = $(PTHREAD_LIBS) $(SNDFILE_LIBS)  audiocache_SOURCES = \  	$(top_srcdir)/src/audiocache.cc \ @@ -59,10 +66,13 @@ audiocache_SOURCES = \  	drumkit_creator.cc \  	audiocachetest.cc -audiocachefile_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocachefile\" \ +audiocachefile_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocachefile\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src \ -	-I$(top_srcdir)/hugin -DDISABLE_HUGIN $(PTHREAD_CFLAGS) $(SNDFILE_CFLAGS) +	-I$(top_srcdir)/hugin -DDISABLE_HUGIN \ +	$(PTHREAD_CFLAGS) \ +	$(SNDFILE_CFLAGS)  audiocachefile_LDFLAGS = $(PTHREAD_LIBS) $(SNDFILE_LIBS)  audiocachefile_SOURCES = \  	$(top_srcdir)/src/audiocachefile.cc \ @@ -74,20 +84,25 @@ audiocachefile_SOURCES = \  	drumkit_creator.cc \  	audiocachefiletest.cc -audiocacheidmanager_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocacheidmanager\" \ +audiocacheidmanager_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocacheidmanager\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src \ -	-I$(top_srcdir)/hugin -DDISABLE_HUGIN $(SNDFILE_CFLAGS) +	-I$(top_srcdir)/hugin -DDISABLE_HUGIN \ +	$(SNDFILE_CFLAGS)  audiocacheidmanager_LDFLAGS = $(SNDFILE_LIBS)  audiocacheidmanager_SOURCES = \  	$(top_srcdir)/src/audiocacheidmanager.cc \  	uunit/uunit.cc \  	audiocacheidmanagertest.cc -audiocacheeventhandler_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocacheeventhandler\" \ +audiocacheeventhandler_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"audiocacheeventhandler\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src \ -	-I$(top_srcdir)/hugin -DDISABLE_HUGIN $(PTHREAD_CFLAGS) $(SNDFILE_CFLAGS) +	-I$(top_srcdir)/hugin -DDISABLE_HUGIN \ +	$(PTHREAD_CFLAGS) \ +	$(SNDFILE_CFLAGS)  audiocacheeventhandler_LDFLAGS = $(PTHREAD_LIBS) $(SNDFILE_LIBS)  audiocacheeventhandler_SOURCES = \  	$(top_srcdir)/src/audiocacheeventhandler.cc \ @@ -98,10 +113,12 @@ audiocacheeventhandler_SOURCES = \  	uunit/uunit.cc \  	audiocacheeventhandlertest.cc -enginetest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"enginetest\" \ +enginetest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"enginetest\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src \ -	-I$(top_srcdir)/hugin $(PTHREAD_CFLAGS) $(SNDFILE_CFLAGS) +	-I$(top_srcdir)/hugin $(PTHREAD_CFLAGS) \ +	$(SNDFILE_CFLAGS)  enginetest_LDFLAGS = $(PTHREAD_LIBS) $(SNDFILE_LIBS) \  	 $(top_builddir)/src/libdg.la  enginetest_SOURCES = \ @@ -110,20 +127,26 @@ enginetest_SOURCES = \  	drumkit_creator.cc \  	enginetest.cc -paintertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"paintertest\" \ +paintertest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"paintertest\" \  	$(DEBUG_FLAGS) \ -	-I$(top_srcdir)/src -I$(top_srcdir)/plugingui \ -	-I$(top_srcdir)/hugin $(PTHREAD_CFLAGS) -paintertest_LDFLAGS = $(top_builddir)/plugingui/libdggui.la +	-I$(top_srcdir)/src \ +	-I$(top_srcdir)/ \ +	-I$(top_srcdir)/hugin \ +	$(PTHREAD_CFLAGS) +paintertest_LDFLAGS = \ +	$(top_builddir)/dggui/libdggui.la  paintertest_SOURCES = \  	$(top_srcdir)/hugin/hugin.c \  	uunit/uunit.cc \ -	paintertest.cc +	paintertest.cc \ +	$(top_builddir)/plugingui/resource_data.cc -lv2_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"lv2\" \ +lv2_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"lv2\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src \ -	 `pkg-config --cflags serd-0` `pkg-config --cflags lilv-0` \ +	`pkg-config --cflags serd-0` `pkg-config --cflags lilv-0` \  	-DLV2_PATH=\"@LV2DIR@\" $(SNDFILE_CFLAGS)  lv2_LDFLAGS = `pkg-config --libs serd-0` \  	`pkg-config --libs lilv-0` -lcrypto \ @@ -135,9 +158,11 @@ lv2_SOURCES = \  	lv2_test_host.cc \  	lv2.cc -configfile_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"configfile\" \ +configfile_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"configfile\" \  	$(DEBUG_FLAGS) \ -	-I$(top_srcdir)/hugin -I$(top_srcdir)/src +	-I$(top_srcdir)/hugin \ +	-I$(top_srcdir)/src  configfile_LDFLAGS =  configfile_SOURCES = \  	$(top_srcdir)/src/configfile.cc \ @@ -146,7 +171,8 @@ configfile_SOURCES = \  	uunit/uunit.cc \  	configtest.cc -randomtest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"randomtest\" \ +randomtest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"randomtest\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src \  	-I$(top_srcdir)/hugin -DDISABLE_HUGIN @@ -157,30 +183,42 @@ randomtest_SOURCES = \  	uunit/uunit.cc \  	randomtest.cc -atomictest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"atomictest\" \ +atomictest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"atomictest\" \  	$(DEBUG_FLAGS) \ -	-I$(top_srcdir)/src -I$(top_srcdir)/hugin +	-I$(top_srcdir)/src \ +	-I$(top_srcdir)/hugin  atomictest_LDFLAGS =  atomictest_SOURCES = atomictest.cc uunit/uunit.cc -syncedsettingstest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"syncedsettingstest\" \ +syncedsettingstest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"syncedsettingstest\" \  	$(DEBUG_FLAGS) \ -	-I$(top_srcdir)/src -I$(top_srcdir)/hugin +	-I$(top_srcdir)/src \ +	-I$(top_srcdir)/hugin  syncedsettingstest_LDFLAGS =  syncedsettingstest_SOURCES = syncedsettings.cc uunit/uunit.cc -imagecachetest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"imagecachetest\" \ +imagecachetest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"imagecachetest\" \  	$(DEBUG_FLAGS) \ -	-I$(top_srcdir)/src -I$(top_srcdir)/plugingui  -I$(top_srcdir)/hugin -imagecachetest_LDFLAGS = $(top_builddir)/plugingui/libdggui.la +	-I$(top_srcdir)/src \ +	-I$(top_srcdir)/ \ +	-I$(top_srcdir)/hugin +imagecachetest_LDFLAGS = \ +	$(top_builddir)/dggui/libdggui.la \ +	$(top_builddir)/plugingui/libplugingui.la  imagecachetest_SOURCES = \  	$(top_srcdir)/hugin/hugin.c \  	imagecachetest.cc \  	uunit/uunit.cc -semaphoretest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"semaphoretest\" \ +semaphoretest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"semaphoretest\" \  	$(DEBUG_FLAGS) \ -	-I$(top_srcdir)/src -I$(top_srcdir)/hugin $(PTHREAD_CFLAGS) +	-I$(top_srcdir)/src \ +	-I$(top_srcdir)/hugin \ +	$(PTHREAD_CFLAGS)  semaphoretest_LDFLAGS = $(PTHREAD_LIBS)  semaphoretest_SOURCES = \  	$(top_srcdir)/hugin/hugin.c \ @@ -188,10 +226,12 @@ semaphoretest_SOURCES = \  	semaphoretest.cc \  	uunit/uunit.cc -drumkitcreatortest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"drumkitcreatortest\" \ +drumkitcreatortest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"drumkitcreatortest\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src \ -	-I$(top_srcdir)/hugin -DDISABLE_HUGIN $(SNDFILE_CFLAGS) +	-I$(top_srcdir)/hugin -DDISABLE_HUGIN \ +	$(SNDFILE_CFLAGS)  drumkitcreatortest_CFLAGS = -DDISABLE_HUGIN  drumkitcreatortest_LDFLAGS = $(SNDFILE_LIBS)  drumkitcreatortest_SOURCES = \ @@ -200,7 +240,8 @@ drumkitcreatortest_SOURCES = \  	drumkit_creator.cc \  	drumkitcreatortest.cc -bytesizeparsertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"bytesizeparsertest\" \ +bytesizeparsertest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"bytesizeparsertest\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src  bytesizeparsertest_LDFLAGS = @@ -209,7 +250,8 @@ bytesizeparsertest_SOURCES = \  	bytesizeparsertest.cc \  	uunit/uunit.cc -notifiertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"notifiertest\" \ +notifiertest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"notifiertest\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src  notifiertest_LDFLAGS = @@ -217,9 +259,11 @@ notifiertest_SOURCES = \  	notifiertest.cc \  	uunit/uunit.cc -dgxmlparsertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"dgxmlparsertest\" \ +dgxmlparsertest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"dgxmlparsertest\" \  	$(DEBUG_FLAGS) \ -	-I$(top_srcdir)/src -I$(top_srcdir)/hugin \ +	-I$(top_srcdir)/src \ +	-I$(top_srcdir)/hugin \  	-I$(top_srcdir)/pugixml/src  dgxmlparsertest_LDFLAGS =  dgxmlparsertest_SOURCES = \ @@ -230,7 +274,8 @@ dgxmlparsertest_SOURCES = \  	scopedfile.cc \  	uunit/uunit.cc -domloadertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"domloadertest\" \ +domloadertest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"domloadertest\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src  domloadertest_LDFLAGS = \ @@ -241,9 +286,11 @@ domloadertest_SOURCES = \  	scopedfile.cc \  	uunit/uunit.cc -configparsertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"configparsertest\" \ +configparsertest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"configparsertest\" \  	$(DEBUG_FLAGS) \ -	-I$(top_srcdir)/src -I$(top_srcdir)/hugin \ +	-I$(top_srcdir)/src \ +	-I$(top_srcdir)/hugin \  	-I$(top_srcdir)/pugixml/src  configparsertest_LDFLAGS =  configparsertest_SOURCES = \ @@ -253,9 +300,11 @@ configparsertest_SOURCES = \  	configparsertest.cc \  	uunit/uunit.cc -midimapparsertest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"midimapparsertest\" \ +midimapparsertest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"midimapparsertest\" \  	$(DEBUG_FLAGS) \ -	-I$(top_srcdir)/src -I$(top_srcdir)/hugin \ +	-I$(top_srcdir)/src \ +	-I$(top_srcdir)/hugin \  	-I$(top_srcdir)/pugixml/src  midimapparsertest_LDFLAGS =  midimapparsertest_SOURCES = \ @@ -266,7 +315,8 @@ midimapparsertest_SOURCES = \  	midimapparsertest.cc \  	uunit/uunit.cc -eventsdstest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"eventsdstest\" \ +eventsdstest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"eventsdstest\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src  eventsdstest_LDFLAGS = @@ -275,7 +325,8 @@ eventsdstest_SOURCES = \  	eventsdstest.cc \  	uunit/uunit.cc -powermaptest_CXXFLAGS = -I$(top_srcdir)/test/uunit -DOUTPUT=\"powermaptest\" \ +powermaptest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"powermaptest\" \  	$(DEBUG_FLAGS) \  	-I$(top_srcdir)/src  powermaptest_LDFLAGS = @@ -284,6 +335,21 @@ powermaptest_SOURCES = \  	powermaptest.cc \  	uunit/uunit.cc +midimappertest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"midimappertest\" \ +	$(DEBUG_FLAGS) \ +	-I$(top_srcdir)/src \ +	-I$(top_srcdir)/hugin \ +	-I$(top_srcdir)/pugixml/src +midimappertest_LDFLAGS = +midimappertest_SOURCES = \ +	$(top_srcdir)/hugin/hugin.c \ +	$(top_srcdir)/src/midimapper.cc \ +	$(top_srcdir)/pugixml/src/pugixml.cpp \ +	scopedfile.cc \ +	midimappertest.cc \ +	uunit/uunit.cc +  RES = \  	$(top_srcdir)/test/locale/da.mo @@ -291,12 +357,12 @@ rcgen_verbose = $(rcgen_verbose_@AM_V@)  rcgen_verbose_ = $(rcgen_verbose_@AM_DEFAULT_V@)  rcgen_verbose_0 = @echo "  RCGEN    "$@; -translationtest_resource_data.cc: $(top_builddir)/plugingui/rcgen $(RES) -	$(rcgen_verbose)$(top_builddir)/plugingui/rcgen$(EXEEXT) -s $(top_srcdir)/test/ -o $@ $(RES) +translationtest_resource_data.cc: $(top_builddir)/dggui/rcgen $(RES) +	$(rcgen_verbose)$(top_builddir)/dggui/rcgen$(EXEEXT) -s $(top_srcdir)/test/ -o $@ $(RES) -translationtest_CXXFLAGS = -I$(top_srcdir)/test/uunit \ -	-DOUTPUT=\"translationtest\" \ -	-I$(top_srcdir)/plugingui \ +translationtest_CXXFLAGS = \ +	-I$(top_srcdir)/test/uunit -DOUTPUT=\"translationtest\" \ +	-I$(top_srcdir)/ \  	-I$(top_srcdir)/src \  	-I$(top_srcdir)/hugin \  	-DMO_SRC=\"$(top_srcdir)/test/locale/da.mo\" \ @@ -306,9 +372,9 @@ nodist_translationtest_SOURCES = \  	$(top_builddir)/test/translationtest_resource_data.cc  translationtest_SOURCES = \  	$(top_srcdir)/hugin/hugin.c \ -	$(top_srcdir)/plugingui/resource.cc \ +	$(top_srcdir)/dggui/resource.cc \  	$(top_srcdir)/src/translation.cc \ -	$(top_srcdir)/plugingui/uitranslation.cc \ +	$(top_srcdir)/dggui/uitranslation.cc \  	translationtest.cc \  	uunit/uunit.cc diff --git a/test/dgreftest/midiinputengine.cc b/test/dgreftest/midiinputengine.cc index ca223da..dbffec9 100644 --- a/test/dgreftest/midiinputengine.cc +++ b/test/dgreftest/midiinputengine.cc @@ -155,16 +155,15 @@ void MidifileInputEngine::run(size_t pos, size_t len, std::vector<event_t>& even  				int key = current_event->midi_buffer[1];  				int velocity = current_event->midi_buffer[2]; -				events.emplace_back(); -				auto& event = events.back(); -				event.type = EventType::OnSet; -				size_t evpos = current_event->time_seconds * (samplerate / speed); -				event.offset = evpos - pos; - -				int i = mmap.lookup(key); -				if(i != -1) +				auto instruments = mmap.lookup(key); +				for(const auto& instrument_idx : instruments)  				{ -					event.instrument = i; +					events.emplace_back(); +					auto& event = events.back(); +					event.type = EventType::OnSet; +					size_t evpos = current_event->time_seconds * (samplerate / speed); +					event.offset = evpos - pos; +					event.instrument = instrument_idx;  					event.velocity = velocity / 127.0;  				}  			} diff --git a/test/eventsdstest.cc b/test/eventsdstest.cc index 3c0af68..822cf14 100644 --- a/test/eventsdstest.cc +++ b/test/eventsdstest.cc @@ -34,7 +34,8 @@ class EventsDSTest  public:  	EventsDSTest()  	{ -		uUNIT_TEST(EventsDSTest::test_all); +		uTEST(EventsDSTest::test_all); +		uTEST(EventsDSTest::test_clear);  	}  public: @@ -48,27 +49,27 @@ public:  		events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "b", 42);  		events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "c", 42); -		uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(13).empty()); -		uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 1); +		uASSERT(events_ds.getSampleEventGroupIDsOf(13).empty()); +		uASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 1);  		auto group_id = events_ds.getSampleEventGroupIDsOf(42).back();  		const auto& event_ids = events_ds.getEventIDsOf(group_id); -		uUNIT_ASSERT(event_ids.size() == 3); +		uASSERT(event_ids.size() == 3);  		// group 2  		events_ds.startAddingNewGroup(42);  		events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "d", 42); -		uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 2); +		uASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 2);  		// group 3  		events_ds.startAddingNewGroup(23);  		events_ds.emplace<SampleEvent>(7, 7, 1.0, nullptr, "foo", 23);  		events_ds.emplace<SampleEvent>(7, 7, 1.0, nullptr, "bar", 23); -		uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 2); -		uUNIT_ASSERT(events_ds.numberOfEvents(13) == 4); -		uUNIT_ASSERT(events_ds.numberOfEvents(7) == 2); +		uASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 2); +		uASSERT(events_ds.numberOfEvents(13) == 4); +		uASSERT(events_ds.numberOfEvents(7) == 2);  		// iterate over  		std::string group_concat = ""; @@ -76,27 +77,55 @@ public:  		{  			group_concat.append(sample_event.group);  		} -		uUNIT_ASSERT(group_concat == "abcd"); +		uASSERT(group_concat == "abcd");  		// get and getType  		for (const auto& sample_event: events_ds.iterateOver<SampleEvent>(13))  		{ -			uUNIT_ASSERT(events_ds.get<SampleEvent>(sample_event.id).channel == 13); -			uUNIT_ASSERT(events_ds.getType(sample_event.id) == Event::Type::SampleEvent); +			uASSERT(events_ds.get<SampleEvent>(sample_event.id).channel == 13); +			uASSERT(events_ds.getType(sample_event.id) == Event::Type::SampleEvent);  		}  		// remove  		auto event_id = events_ds.getEventIDsOf(events_ds.getSampleEventGroupIDsOf(42).back()).back();  		events_ds.remove(event_id); -		uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 1); +		uASSERT(events_ds.getSampleEventGroupIDsOf(42).size() == 1);  		event_id = events_ds.getEventIDsOf(events_ds.getSampleEventGroupIDsOf(23).back()).back();  		events_ds.remove(event_id); -		uUNIT_ASSERT(!events_ds.getSampleEventGroupIDsOf(23).empty()); +		uASSERT(!events_ds.getSampleEventGroupIDsOf(23).empty());  		event_id = events_ds.getEventIDsOf(events_ds.getSampleEventGroupIDsOf(23).back()).back();  		events_ds.remove(event_id); -		uUNIT_ASSERT(events_ds.getSampleEventGroupIDsOf(23).empty()); +		uASSERT(events_ds.getSampleEventGroupIDsOf(23).empty());  	} + +	void test_clear() +	{ +		EventsDS events_ds; + +		uASSERT_EQUAL(0u, events_ds.getSampleEventGroupIDsOf(42).size()); +		uASSERT_EQUAL(0u, events_ds.getSampleEventGroupIDsOf(43).size()); + +		// group 1 +		events_ds.startAddingNewGroup(42); +		events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "a", 42); +		events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "b", 42); +		events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "c", 42); + +		// group 2 +		events_ds.startAddingNewGroup(43); +		events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "a", 43); +		events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "b", 43); +		events_ds.emplace<SampleEvent>(13, 13, 1.0, nullptr, "c", 43); + +		uASSERT_EQUAL(1u, events_ds.getSampleEventGroupIDsOf(42).size() == 1); +		uASSERT_EQUAL(1u, events_ds.getSampleEventGroupIDsOf(43).size() == 1); + +		events_ds.clear(); + +		uASSERT_EQUAL(0u, events_ds.getSampleEventGroupIDsOf(42).size()); +		uASSERT_EQUAL(0u, events_ds.getSampleEventGroupIDsOf(43).size()); +}  };  // Registers the fixture into the 'registry' diff --git a/test/imagecachetest.cc b/test/imagecachetest.cc index 5471afb..3e7b4fc 100644 --- a/test/imagecachetest.cc +++ b/test/imagecachetest.cc @@ -26,13 +26,11 @@   */  #include <uunit.h> -#include <cassert> - -#include <imagecache.h> -#include <image.h> +#include <dggui/imagecache.h> +#include <dggui/image.h>  class TestableImageCache -	: public GUI::ImageCache +	: public dggui::ImageCache  {  public:  	std::size_t count(const std::string& filename) diff --git a/test/midimapparsertest.cc b/test/midimapparsertest.cc index eb4d6d5..3e77c44 100644 --- a/test/midimapparsertest.cc +++ b/test/midimapparsertest.cc @@ -36,8 +36,8 @@ class MidimapParserTest  public:  	MidimapParserTest()  	{ -		uUNIT_TEST(MidimapParserTest::test); -		uUNIT_TEST(MidimapParserTest::invalid); +		uTEST(MidimapParserTest::test); +		uTEST(MidimapParserTest::invalid);  	}  	void test() @@ -49,23 +49,35 @@ public:  			"	<map note=\"60\" instr=\"Crash_left_whisker\"/>\n" \  			"	<map note=\"55\" instr=\"Crash_right_tip\"/>\n" \  			"	<map note=\"62\" instr=\"Crash_right_whisker\"/>\n" \ +			"	<map note=\"62\" instr=\"Hihat_closed\"/>\n" \  			"	<map note=\"56\" instr=\"Hihat_closed\"/>\n" \  			"</midimap>");  		MidiMapParser parser; -		uUNIT_ASSERT(parser.parseFile(scoped_file.filename())); - -		uUNIT_ASSERT(parser.midimap.find(54) != parser.midimap.end()); -		uUNIT_ASSERT(parser.midimap.find(60) != parser.midimap.end()); -		uUNIT_ASSERT(parser.midimap.find(55) != parser.midimap.end()); -		uUNIT_ASSERT(parser.midimap.find(62) != parser.midimap.end()); -		uUNIT_ASSERT(parser.midimap.find(56) != parser.midimap.end()); - -		uUNIT_ASSERT_EQUAL(std::string("Crash_left_tip"), parser.midimap[54]); -		uUNIT_ASSERT_EQUAL(std::string("Crash_left_whisker"), parser.midimap[60]); -		uUNIT_ASSERT_EQUAL(std::string("Crash_right_tip"), parser.midimap[55]); -		uUNIT_ASSERT_EQUAL(std::string("Crash_right_whisker"), parser.midimap[62]); -		uUNIT_ASSERT_EQUAL(std::string("Hihat_closed"), parser.midimap[56]); +		uASSERT(parser.parseFile(scoped_file.filename())); + +		const auto& midimap = parser.midimap; +		uASSERT_EQUAL(6u, midimap.size()); + +		uASSERT_EQUAL(54, midimap[0].note_id); +		uASSERT_EQUAL(std::string("Crash_left_tip"), midimap[0].instrument_name); + +		uASSERT_EQUAL(60, midimap[1].note_id); +		uASSERT_EQUAL(std::string("Crash_left_whisker"), midimap[1].instrument_name); + +		uASSERT_EQUAL(55, midimap[2].note_id); +		uASSERT_EQUAL(std::string("Crash_right_tip"), midimap[2].instrument_name); + +		// These next two note numbers are intentionally the same and trigger two +		// different instruments: +		uASSERT_EQUAL(62, midimap[3].note_id); +		uASSERT_EQUAL(std::string("Crash_right_whisker"), midimap[3].instrument_name); + +		uASSERT_EQUAL(62, midimap[4].note_id); +		uASSERT_EQUAL(std::string("Hihat_closed"), midimap[4].instrument_name); + +		uASSERT_EQUAL(56, midimap[5].note_id); +		uASSERT_EQUAL(std::string("Hihat_closed"), midimap[5].instrument_name);  	}  	void invalid() @@ -81,7 +93,7 @@ public:  			"</midimap>");  		MidiMapParser parser; -		uUNIT_ASSERT(!parser.parseFile(scoped_file.filename())); +		uASSERT(!parser.parseFile(scoped_file.filename()));  	}  }; diff --git a/test/midimappertest.cc b/test/midimappertest.cc new file mode 100644 index 0000000..703c646 --- /dev/null +++ b/test/midimappertest.cc @@ -0,0 +1,140 @@ +/* -*- Mode: c++ -*- */ +/*************************************************************************** + *            midimappertest.cc + * + *  Sun Aug 8 09:55:13 CEST 2021 + *  Copyright 2021 Bent Bisballe Nyeng + *  deva@aasimon.org + ****************************************************************************/ + +/* + *  This file is part of DrumGizmo. + * + *  DrumGizmo is free software; you can redistribute it and/or modify + *  it under the terms of the GNU Lesser General Public License as published by + *  the Free Software Foundation; either version 3 of the License, or + *  (at your option) any later version. + * + *  DrumGizmo 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 Lesser General Public License for more details. + * + *  You should have received a copy of the GNU Lesser General Public License + *  along with DrumGizmo; if not, write to the Free Software + *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA. */ +#include <uunit.h> + +#include <algorithm> + +#include <midimapper.h> + +#include "scopedfile.h" + +class MidiMapperTest +	: public uUnit +{ +public: +	MidiMapperTest() +	{ +		uTEST(MidiMapperTest::test); +		uTEST(MidiMapperTest::exceptional); +	} + +	void test() +	{ +		midimap_t midimap +		{ +			{ 54, "Crash_left_tip" }, +			{ 60, "Crash_left_whisker" }, +			{ 55, "Crash_right_tip" }, +			{ 62, "Crash_right_whisker" }, +			{ 62, "Hihat_closed" }, +			{ 56, "Hihat_closed" }, +		}; + +		instrmap_t instrmap +		{ +			{ "Crash_left_tip", 0 }, +			{ "Crash_left_whisker", 1 }, +			{ "Crash_right_tip", 2 }, +			{ "Crash_right_whisker", 3 }, +			{ "Hihat_closed", 4 }, +		}; + +		MidiMapper mapper; +		mapper.swap(instrmap, midimap); + +		{ +			auto is = mapper.lookup(54); +			uASSERT_EQUAL(1u, is.size()); +			uASSERT_EQUAL(0, is[0]); +		} + +		{ +			auto is = mapper.lookup(60); +			uASSERT_EQUAL(1u, is.size()); +			uASSERT_EQUAL(1, is[0]); +		} + +		{ +			auto is = mapper.lookup(55); +			uASSERT_EQUAL(1u, is.size()); +			uASSERT_EQUAL(2, is[0]); +		} + +		{ +			auto is = mapper.lookup(62); +			uASSERT_EQUAL(2u, is.size()); +			// We don't care about the order, so just count the instances +			uASSERT_EQUAL(1u, std::count(is.begin(), is.end(), 3)); +			uASSERT_EQUAL(1u, std::count(is.begin(), is.end(), 4)); +		} + +		{ +			auto is = mapper.lookup(56); +			uASSERT_EQUAL(1u, is.size()); +			uASSERT_EQUAL(4, is[0]); +		} +	} + +	void exceptional() +	{ +		midimap_t midimap +		{ +			{ 54, "Crash_left_tip" }, +			{ 60, "Crash_left_whisker_MISSING" }, +			{ 55, "Crash_right_tip" }, +			{ 62, "Crash_right_whisker" }, +			{ 62, "Hihat_closed" }, +			{ 56, "Hihat_closed" }, +		}; + +		instrmap_t instrmap +		{ +			{ "Crash_left_tip", 0 }, +			{ "Crash_left_whisker", 1 }, +			{ "Crash_right_tip", 2 }, +			{ "Crash_right_whisker", 3 }, +			{ "Hihat_closed", 4 }, +		}; + +		MidiMapper mapper; +		mapper.swap(instrmap, midimap); + +		// no such note id +		{ +			auto is = mapper.lookup(42); +			uASSERT_EQUAL(0u, is.size()); +		} + +		// no such instrument +		{ +			auto is = mapper.lookup(60); +			uASSERT_EQUAL(0u, is.size()); +		} +	} +}; + +// Registers the fixture into the 'registry' +static MidiMapperTest test; diff --git a/test/paintertest.cc b/test/paintertest.cc index fb17a91..5a1c44a 100644 --- a/test/paintertest.cc +++ b/test/paintertest.cc @@ -26,17 +26,17 @@   */  #include <uunit.h> -#include "../plugingui/canvas.h" -#include "../plugingui/painter.h" -#include "../plugingui/image.h" -#include "../plugingui/font.h" +#include <dggui/canvas.h> +#include <dggui/painter.h> +#include <dggui/image.h> +#include <dggui/font.h>  class TestColour  {  public:  	TestColour(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a)  		: colour(r, g, b, a) {} -	TestColour(const GUI::Colour& colour) +	TestColour(const dggui::Colour& colour)  		: colour(colour) {}  	bool operator!=(const TestColour& other) const @@ -49,7 +49,7 @@ public:  			;  	} -	const GUI::Colour colour; +	const dggui::Colour colour;  };  std::ostream& operator<<(std::ostream& stream, const TestColour& col) @@ -63,28 +63,28 @@ std::ostream& operator<<(std::ostream& stream, const TestColour& col)  }  class TestableCanvas -	: public GUI::Canvas +	: public dggui::Canvas  {  public:  	TestableCanvas(std::size_t width, std::size_t height)  		: pixbuf(width, height)  	{} -	GUI::PixelBufferAlpha& getPixelBuffer() override +	dggui::PixelBufferAlpha& getPixelBuffer() override  	{  		return pixbuf;  	}  private: -	GUI::PixelBufferAlpha pixbuf; +	dggui::PixelBufferAlpha pixbuf;  };  class TestImage -	: public GUI::Image +	: public dggui::Image  {  public:  	TestImage(std::uint8_t width, std::uint8_t height, bool alpha) -		: GUI::Image(":resources/logo.png") // just load some default image +		: dggui::Image(":resources/logo.png") // just load some default image  	{  		_width = width;  		_height = height; @@ -98,7 +98,7 @@ public:  		{  			for(std::uint8_t y = 0; y < _height; ++y)  			{ -				image_data[x + _width * y] = GUI::Colour(x, y, 0, alpha ? 128 : 255); +				image_data[x + _width * y] = dggui::Colour(x, y, 0, alpha ? 128 : 255);  				image_data_raw[4 * (x + _width * y) + 0] = x;  				image_data_raw[4 * (x + _width * y) + 1] = y;  				image_data_raw[4 * (x + _width * y) + 2] = 0; @@ -124,35 +124,35 @@ public:  	void testDrawImage()  	{  		// Success criterion is simply to not assert in the drawing routines... -		GUI::Image image(":resources/logo.png"); +		dggui::Image image(":resources/logo.png");  		{ // Image fits in pixelbuffer  			TestableCanvas canvas(image.width(), image.height()); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawImage(0, 0, image);  		}  		{ // Image fits in pixelbuffer, negative offset  			TestableCanvas canvas(image.width(), image.height()); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawImage(-10, -10, image);  		}  		{ // Image too big for pixelbuffer  			TestableCanvas canvas(image.width() / 2, image.height() / 2); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawImage(0, 0, image);  		}  		{ // Image fits in pixelbuffer but offset so it is drawn over the edge.  			TestableCanvas canvas(image.width(), image.height()); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawImage(10, 10, image);  		}  		{ // Image is offset to the right and down so nothing is to be drawn.  			TestableCanvas canvas(image.width(), image.height()); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawImage(image.width() + 1,  			                  image.height() + 1,  			                  image); @@ -160,7 +160,7 @@ public:  		{ // Image is offset to the left and up so nothing is to be drawn.  			TestableCanvas canvas(image.width(), image.height()); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawImage(-1 * (image.width() + 1),  			                  -1 * (image.height() + 1),  			                  image); @@ -170,7 +170,7 @@ public:  	void testDrawText()  	{  		// Success criterion is simply to not assert in the drawing routines... -		GUI::Font font; +		dggui::Font font;  		// a string with unicode characters  		std::string someText = "Hello World - лæ Библиотека";  		std::size_t width = font.textWidth(someText); @@ -178,31 +178,31 @@ public:  		{ // Text fits in pixelbuffer  			TestableCanvas canvas(width, height); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawText(0, 0, font, someText);  		}  		{ // Text fits in pixelbuffer, negative offset  			TestableCanvas canvas(width, height); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawText(-10, -10, font, someText);  		}  		{ // Text too big for pixelbuffer  			TestableCanvas canvas(width / 2, height / 2); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawText(0, 0, font, someText);  		}  		{ // Text fits in pixelbuffer but offset so it is drawn over the edge.  			TestableCanvas canvas(width, height); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawText(10, 10, font, someText);  		}  		{ // Text is offset to the right and down so nothing is to be drawn.  			TestableCanvas canvas(width, height); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawText(width + 1,  			                 height + 1,  			                 font, someText); @@ -210,7 +210,7 @@ public:  		{ // Text is offset to the left and up so nothing is to be drawn.  			TestableCanvas canvas(width, height); -			GUI::Painter painter(canvas); +			dggui::Painter painter(canvas);  			painter.drawText(-1 * (width + 1),  			                 -1 * (height + 1),  			                 font, someText); @@ -221,7 +221,7 @@ public:  	void testClipping()  	{  		TestableCanvas canvas(100, 100); -		GUI::Painter painter(canvas); +		dggui::Painter painter(canvas);  		{ // Without alpha  			TestImage image(16, 16, false); diff --git a/test/resource_test.cc b/test/resource_test.cc index 1433dca..5781ff2 100644 --- a/test/resource_test.cc +++ b/test/resource_test.cc @@ -26,16 +26,16 @@   */  #include <uunit.h> -#include "../plugingui/resource.h" +#include "../dggui/resource.h"  #include "drumkit_creator.h"  class ResourceTester -	: public GUI::Resource +	: public dggui::Resource  {  public:  	ResourceTester(const std::string& name) -		: GUI::Resource(name) +		: dggui::Resource(name)  	{}  	bool probeIsInternal() diff --git a/test/scopedfile.cc b/test/scopedfile.cc index b03a2bc..3c30734 100644 --- a/test/scopedfile.cc +++ b/test/scopedfile.cc @@ -34,6 +34,9 @@  #ifdef _WIN32  #define WIN32_LEAN_AND_MEAN  #include <windows.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h>  #endif  struct Pimpl @@ -50,8 +53,8 @@ ScopedFile::ScopedFile(const std::string& data)  	pimpl->fd = mkstemp(templ);  #else  	char templ[] = "dg-scoped-file-XXXXXX"; // buffer for filename -	_mktemp_s(templ); -	pimpl->fd = open(templ); +	_mktemp_s(templ, sizeof(templ)); +	pimpl->fd = open(templ, O_CREAT | O_RDWR);  #endif  	pimpl->filename = templ;  	auto sz = write(pimpl->fd, data.data(), data.size()); diff --git a/test/translationtest.cc b/test/translationtest.cc index 98cff11..bf33599 100644 --- a/test/translationtest.cc +++ b/test/translationtest.cc @@ -29,7 +29,7 @@  #include <locale>  #include <translation.h> -#include <uitranslation.h> +#include <dggui/uitranslation.h>  #include <stdlib.h>  class TranslationTest @@ -63,8 +63,12 @@ public:  	void testFromLocale()  	{ +#ifdef _WIN32 +		_putenv_s("LANG", "da_DK.UTF-8"); +#else  		setenv("LANG", "da_DK.UTF-8", 1); -		UITranslation t; +#endif +		dggui::UITranslation t;  		// Look up translation from .mo file  		uUNIT_ASSERT_EQUAL(std::string("Trommesæt"), diff --git a/test/uitests/Makefile.am b/test/uitests/Makefile.am index 8b1877e..a27a44b 100644 --- a/test/uitests/Makefile.am +++ b/test/uitests/Makefile.am @@ -2,11 +2,12 @@ noinst_PROGRAMS = resizetest tabwidgettest framewidgettest \  	filebrowsertest benchmarktest powerwidgettest  resizetest_LDADD = \ -	$(top_builddir)/plugingui/libdggui.la \ +	$(top_builddir)/dggui/libdggui.la \ +	$(top_builddir)/plugingui/libplugingui.la \  	$(top_builddir)/src/libdg.la \  	$(top_builddir)/src/libnls.la  resizetest_CXXFLAGS = \ -	-I$(top_srcdir)/plugingui \ +	-I$(top_srcdir)/ \  	-I$(top_srcdir)/src \  	-I$(top_srcdir)/hugin  resizetest_SOURCES = \ @@ -14,11 +15,12 @@ resizetest_SOURCES = \  	$(top_srcdir)/hugin/hugin.c  tabwidgettest_LDADD = \ -	$(top_builddir)/plugingui/libdggui.la \ +	$(top_builddir)/dggui/libdggui.la \ +	$(top_builddir)/plugingui/libplugingui.la \  	$(top_builddir)/src/libdg.la \  	$(top_builddir)/src/libnls.la  tabwidgettest_CXXFLAGS = \ -	-I$(top_srcdir)/plugingui \ +	-I$(top_srcdir)/ \  	-I$(top_srcdir)/src \  	-I$(top_srcdir)/hugin  tabwidgettest_SOURCES = \ @@ -26,11 +28,13 @@ tabwidgettest_SOURCES = \  	$(top_srcdir)/hugin/hugin.c  filebrowsertest_LDADD = \ -	$(top_builddir)/plugingui/libdggui.la \ +	$(top_builddir)/dggui/libdggui.la \ +	$(top_builddir)/plugingui/libplugingui.la \  	$(top_builddir)/src/libdg.la \  	$(top_builddir)/src/libnls.la  filebrowsertest_CXXFLAGS = \  	-I$(top_srcdir)/plugingui \ +	-I$(top_srcdir)/ \  	-I$(top_srcdir)/src \  	-I$(top_srcdir)/hugin  filebrowsertest_SOURCES = \ @@ -38,11 +42,12 @@ filebrowsertest_SOURCES = \  	$(top_srcdir)/hugin/hugin.c  framewidgettest_LDADD = \ -	$(top_builddir)/plugingui/libdggui.la \ +	$(top_builddir)/dggui/libdggui.la \ +	$(top_builddir)/plugingui/libplugingui.la \  	$(top_builddir)/src/libdg.la \  	$(top_builddir)/src/libnls.la  framewidgettest_CXXFLAGS = \ -	-I$(top_srcdir)/plugingui \ +	-I$(top_srcdir)/ \  	-I$(top_srcdir)/src \  	-I$(top_srcdir)/hugin  framewidgettest_SOURCES = \ @@ -59,15 +64,15 @@ rcgen_verbose = $(rcgen_verbose_@AM_V@)  rcgen_verbose_ = $(rcgen_verbose_@AM_DEFAULT_V@)  rcgen_verbose_0 = @echo "  RCGEN    "$@; -benchmarktest_resource_data.cc: $(top_builddir)/plugingui/rcgen $(RES) -	$(rcgen_verbose)$(top_builddir)/plugingui/rcgen$(EXEEXT) -d $(top_srcdir)/test/uitests -o $@ $(RES) +benchmarktest_resource_data.cc: $(top_builddir)/dggui/rcgen $(RES) +	$(rcgen_verbose)$(top_builddir)/dggui/rcgen$(EXEEXT) -d $(top_srcdir)/test/uitests -o $@ $(RES)  benchmarktest_LDADD = \ -	$(top_builddir)/plugingui/libdggui.la \ +	$(top_builddir)/dggui/libdggui.la \  	$(top_builddir)/src/libdg.la \  	$(top_builddir)/src/libnls.la  benchmarktest_CXXFLAGS = \ -	-I$(top_srcdir)/plugingui \ +	-I$(top_srcdir)/ \  	-I$(top_srcdir)/src \  	-I$(top_srcdir)/hugin  nodist_benchmarktest_SOURCES = \ @@ -81,11 +86,13 @@ CLEANFILES = benchmarktest_resource_data.cc  powerwidgettest_LDADD = \ -	$(top_builddir)/plugingui/libdggui.la \ +	$(top_builddir)/dggui/libdggui.la \ +	$(top_builddir)/plugingui/libplugingui.la \  	$(top_builddir)/src/libdg.la \  	$(top_builddir)/src/libnls.la  powerwidgettest_CXXFLAGS = \  	-I$(top_srcdir)/plugingui \ +	-I$(top_srcdir)/ \  	-I$(top_srcdir)/src \  	-I$(top_srcdir)/hugin  powerwidgettest_SOURCES = \ diff --git a/test/uitests/benchmarktest.cc b/test/uitests/benchmarktest.cc index aaf3946..59a6968 100644 --- a/test/uitests/benchmarktest.cc +++ b/test/uitests/benchmarktest.cc @@ -29,15 +29,15 @@  #include <cstdint>  #include <string> -#include <image.h> -#include <painter.h> -#include <canvas.h> +#include <dggui/image.h> +#include <dggui/painter.h> +#include <dggui/canvas.h>  class TimedCanvas -	: public GUI::Canvas +	: public dggui::Canvas  {  public: -	GUI::PixelBufferAlpha& getPixelBuffer() override +	dggui::PixelBufferAlpha& getPixelBuffer() override  	{  		return pixbuf;  	} @@ -48,7 +48,7 @@ public:  	}  private: -	GUI::PixelBufferAlpha pixbuf{800, 600}; +	dggui::PixelBufferAlpha pixbuf{800, 600};  };  class TimedScope @@ -82,16 +82,16 @@ private:  int main()  {  	TimedCanvas canvas; -	GUI::Painter painter(canvas); -	GUI::Image image_no_alpha(":benchmarktest_resources/image_no_alpha.png"); -	GUI::Image image_full_alpha(":benchmarktest_resources/image_full_alpha.png"); -	GUI::Image image_edge_alpha(":benchmarktest_resources/image_edge_alpha.png"); -	GUI::Image image_inner_alpha(":benchmarktest_resources/image_inner_alpha.png"); +	dggui::Painter painter(canvas); +	dggui::Image image_no_alpha(":benchmarktest_resources/image_no_alpha.png"); +	dggui::Image image_full_alpha(":benchmarktest_resources/image_full_alpha.png"); +	dggui::Image image_edge_alpha(":benchmarktest_resources/image_edge_alpha.png"); +	dggui::Image image_inner_alpha(":benchmarktest_resources/image_inner_alpha.png");  	{  		TimedCanvas canvas;  		TimedScope timed("Pixelbuffer resize", 100000); -		painter.setColour(GUI::Colour(1.f, 1.f, 1.f, 1.f)); +		painter.setColour(dggui::Colour(1.f, 1.f, 1.f, 1.f));  		for(int i = 0; i < 100000; ++i)  		{  			canvas.resize(i % 1000 + 100, i % 1000 + 100); @@ -108,7 +108,7 @@ int main()  	{  		TimedScope timed("Filled rect, with alpha", 100000); -		painter.setColour(GUI::Colour(1.f, 1.f, 1.f, 0.5f)); +		painter.setColour(dggui::Colour(1.f, 1.f, 1.f, 0.5f));  		for(int i = 0; i < 100000; ++i)  		{  			painter.drawRectangle(0, 0, 800, 600); @@ -148,11 +148,11 @@ int main()  	}  	{ -		GUI::PixelBuffer wpixbuf(800, 600); -		std::vector<GUI::PixelBufferAlpha*> children; +		dggui::PixelBuffer wpixbuf(800, 600); +		std::vector<dggui::PixelBufferAlpha*> children;  		for(int i = 0; i < 100; ++i)  		{ -			auto child = new GUI::PixelBufferAlpha(300, 300); +			auto child = new dggui::PixelBufferAlpha(300, 300);  			child->x = i * 2;  			child->y = i * 2;  			children.push_back(child); diff --git a/test/uitests/filebrowsertest.cc b/test/uitests/filebrowsertest.cc index 5f78921..8cede7e 100644 --- a/test/uitests/filebrowsertest.cc +++ b/test/uitests/filebrowsertest.cc @@ -29,17 +29,18 @@  #include <thread>  #include <hugin.hpp> -#include <window.h> -#include <button.h> -#include <label.h> + +#include <dggui/window.h> +#include <dggui/button.h> +#include <dggui/label.h>  #include <filebrowser.h>  class TestWindow -	: public GUI::Window +	: public dggui::Window  {  public:  	TestWindow() -		: GUI::Window(nullptr) +		: dggui::Window(nullptr)  	{  		setCaption("FileBrowserTest Window");  		CONNECT(eventHandler(), closeNotifier, @@ -99,22 +100,22 @@ public:  		return !closing;  	} -	void repaintEvent(GUI::RepaintEvent* repaintEvent) +	void repaintEvent(dggui::RepaintEvent* repaintEvent)  	{ -		GUI::Painter painter(*this); +		dggui::Painter painter(*this);  		label.resize(width(), 30);  		//painter.clear(); -		painter.setColour(GUI::Colour(0,1,0)); +		painter.setColour(dggui::Colour(0,1,0));  		painter.drawFilledRectangle(0, 0, width(), height());  	}  private:  	bool closing{false}; -	GUI::Button button{this}; -	GUI::Label label{this}; +	dggui::Button button{this}; +	dggui::Label label{this};  	GUI::FileBrowser file_browser{this};  }; diff --git a/test/uitests/framewidgettest.cc b/test/uitests/framewidgettest.cc index a2a24db..97f9ed0 100644 --- a/test/uitests/framewidgettest.cc +++ b/test/uitests/framewidgettest.cc @@ -28,76 +28,77 @@  #include <chrono>  #include <thread> -#include <button.h> -#include <checkbox.h> -#include <frame.h>  #include <hugin.hpp> -#include <label.h> -#include <layout.h> -#include <window.h> -#include <painter.h> + +#include <dggui/button.h> +#include <dggui/checkbox.h> +#include <dggui/frame.h> +#include <dggui/label.h> +#include <dggui/layout.h> +#include <dggui/window.h> +#include <dggui/painter.h>  // TODO: fix segfault on close -class Widget1 : public GUI::Widget +class Widget1 : public dggui::Widget  {  public: -	Widget1(GUI::Widget* parent) : GUI::Widget(parent) +	Widget1(dggui::Widget* parent) : dggui::Widget(parent)  	{  		layout.setResizeChildren(true); -		layout.setHAlignment(GUI::HAlignment::center); +		layout.setHAlignment(dggui::HAlignment::center);  		label1.setText("Label1"); -		label1.setAlignment(GUI::TextAlignment::left); +		label1.setAlignment(dggui::TextAlignment::left);  		layout.addItem(&label1);  		label2.setText("Label2"); -		label2.setAlignment(GUI::TextAlignment::center); +		label2.setAlignment(dggui::TextAlignment::center);  		layout.addItem(&label2);  		label3.setText("Label3"); -		label3.setAlignment(GUI::TextAlignment::right); +		label3.setAlignment(dggui::TextAlignment::right);  		layout.addItem(&label3);  	}  private: -	GUI::VBoxLayout layout{this}; -	GUI::Label label1{this}; -	GUI::Label label2{this}; -	GUI::Label label3{this}; +	dggui::VBoxLayout layout{this}; +	dggui::Label label1{this}; +	dggui::Label label2{this}; +	dggui::Label label3{this};  }; -class Widget2 : public GUI::Widget +class Widget2 : public dggui::Widget  {  public: -	Widget2(GUI::Widget* parent) : GUI::Widget(parent) +	Widget2(dggui::Widget* parent) : dggui::Widget(parent)  	{  		layout.setSpacing(10);  		layout.setResizeChildren(true); -		layout.setVAlignment(GUI::VAlignment::top); +		layout.setVAlignment(dggui::VAlignment::top);  		label1.setText("Label1"); -		label1.setAlignment(GUI::TextAlignment::right); +		label1.setAlignment(dggui::TextAlignment::right);  		layout.addItem(&label1);  		label2.setText("Label2"); -		label2.setAlignment(GUI::TextAlignment::left); +		label2.setAlignment(dggui::TextAlignment::left);  		layout.addItem(&label2);  		layout.addItem(&checkbox);  	}  private: -	GUI::HBoxLayout layout{this}; -	GUI::Label label1{this}; -	GUI::Label label2{this}; -	GUI::CheckBox checkbox{this}; +	dggui::HBoxLayout layout{this}; +	dggui::Label label1{this}; +	dggui::Label label2{this}; +	dggui::CheckBox checkbox{this};  }; -class TestWindow : public GUI::Window +class TestWindow : public dggui::Window  {  public: -	TestWindow() : GUI::Window(nullptr) +	TestWindow() : dggui::Window(nullptr)  	{  		setCaption("FrameWidgetTest Window");  		CONNECT(eventHandler(), closeNotifier, this, @@ -106,7 +107,7 @@ public:  		layout.setSpacing(10);  		layout.setResizeChildren(true); -		layout.setHAlignment(GUI::HAlignment::center); +		layout.setHAlignment(dggui::HAlignment::center);  		layout.addItem(&frame1);  		layout.addItem(&frame2); @@ -140,22 +141,22 @@ public:  		return !closing;  	} -	void repaintEvent(GUI::RepaintEvent* repaintEvent) override +	void repaintEvent(dggui::RepaintEvent* repaintEvent) override  	{ -		GUI::Painter painter(*this); -		painter.setColour(GUI::Colour(0.85)); +		dggui::Painter painter(*this); +		painter.setColour(dggui::Colour(0.85));  		painter.drawFilledRectangle(0, 0, width() - 1, height() - 1);  	}  private:  	bool closing{false}; -	GUI::VBoxLayout layout{this}; +	dggui::VBoxLayout layout{this}; -	GUI::FrameWidget frame1{this, true}; -	GUI::FrameWidget frame2{this, false}; -	GUI::FrameWidget frame3{this, true}; -	GUI::FrameWidget frame4{this, false}; +	dggui::FrameWidget frame1{this, true}; +	dggui::FrameWidget frame2{this, false}; +	dggui::FrameWidget frame3{this, true}; +	dggui::FrameWidget frame4{this, false};  	Widget1 w1_1{this};  	Widget1 w1_2{this}; diff --git a/test/uitests/powerwidgettest.cc b/test/uitests/powerwidgettest.cc index 9ab0458..4d01168 100644 --- a/test/uitests/powerwidgettest.cc +++ b/test/uitests/powerwidgettest.cc @@ -28,23 +28,26 @@  #include <chrono>  #include <thread> -#include <button.h> -#include <checkbox.h> -#include <frame.h>  #include <hugin.hpp> -#include <label.h> -#include <layout.h> -#include <window.h> -#include <painter.h> + +#include <dggui/button.h> +#include <dggui/checkbox.h> +#include <dggui/frame.h> +#include <dggui/label.h> +#include <dggui/layout.h> +#include <dggui/window.h> +#include <dggui/painter.h> +  #include <settings.h> +  #include <powerwidget.h>  class TestWindow -	: public GUI::Window +	: public dggui::Window  {  public:  	TestWindow() -		: GUI::Window() +		: dggui::Window()  	{  		setCaption("PowerWidgetTest Window");  		CONNECT(eventHandler(), closeNotifier, this, @@ -93,10 +96,10 @@ public:  		return !closing;  	} -	void repaintEvent(GUI::RepaintEvent* repaintEvent) override +	void repaintEvent(dggui::RepaintEvent* repaintEvent) override  	{ -		GUI::Painter painter(*this); -		painter.setColour(GUI::Colour(0.85)); +		dggui::Painter painter(*this); +		painter.setColour(dggui::Colour(0.85));  		painter.drawFilledRectangle(0, 0, width() - 1, height() - 1);  	} @@ -105,7 +108,7 @@ private:  	Settings settings;  	SettingsNotifier settings_notifier{settings}; -	PowerWidget w{this, settings, settings_notifier}; +	GUI::PowerWidget w{this, settings, settings_notifier};  };  int main() diff --git a/test/uitests/resizetest.cc b/test/uitests/resizetest.cc index 8facc61..17748bf 100644 --- a/test/uitests/resizetest.cc +++ b/test/uitests/resizetest.cc @@ -29,16 +29,17 @@  #include <thread>  #include <hugin.hpp> -#include <window.h> -#include <font.h> -#include <painter.h> + +#include <dggui/window.h> +#include <dggui/font.h> +#include <dggui/painter.h>  class TestWindow -	: public GUI::Window +	: public dggui::Window  {  public:  	TestWindow() -		: GUI::Window(nullptr) +		: dggui::Window(nullptr)  	{  		setCaption("ResizeTest Window");  		CONNECT(eventHandler(), closeNotifier, @@ -70,19 +71,19 @@ public:  		return !closing;  	} -	void repaintEvent(GUI::RepaintEvent* repaintEvent) +	void repaintEvent(dggui::RepaintEvent* repaintEvent)  	{ -		GUI::Painter painter(*this); +		dggui::Painter painter(*this);  		//painter.clear(); -		painter.setColour(GUI::Colour(0,1,0)); +		painter.setColour(dggui::Colour(0,1,0));  		painter.drawFilledRectangle(0, 0, width(), height());  		auto currentSize = std::make_pair(width(), height());  		auto currentPosition = std::make_pair(x(), y());  		{ -			painter.setColour(GUI::Colour(1,0,0)); +			painter.setColour(dggui::Colour(1,0,0));  			char str[64];  			sprintf(str, "reported: (%d, %d); (%d, %d)",  			        (int)reportedPosition.first, @@ -97,7 +98,7 @@ public:  		}  		{ -			painter.setColour(GUI::Colour(1,0,0)); +			painter.setColour(dggui::Colour(1,0,0));  			char str[64];  			sprintf(str, "current: (%d, %d); (%d, %d)",  			        (int)currentPosition.first, @@ -114,7 +115,7 @@ public:  private:  	bool closing{false}; -	GUI::Font font{":resources/font.png"}; +	dggui::Font font{":resources/font.png"};  	std::pair<std::size_t, std::size_t> reportedSize;  	std::pair<int, int> reportedPosition;  }; diff --git a/test/uitests/tabwidgettest.cc b/test/uitests/tabwidgettest.cc index 722dc02..804e979 100644 --- a/test/uitests/tabwidgettest.cc +++ b/test/uitests/tabwidgettest.cc @@ -29,75 +29,76 @@  #include <thread>  #include <hugin.hpp> -#include <window.h> -#include <tabwidget.h> -#include <label.h> -#include <layout.h> -#include <button.h> -#include <painter.h> + +#include <dggui/window.h> +#include <dggui/tabwidget.h> +#include <dggui/label.h> +#include <dggui/layout.h> +#include <dggui/button.h> +#include <dggui/painter.h>  class Widget1 -	: public GUI::Widget +	: public dggui::Widget  {  public: -	Widget1(GUI::Widget* parent) -		: GUI::Widget(parent) +	Widget1(dggui::Widget* parent) +		: dggui::Widget(parent)  	{  		layout.setResizeChildren(true); -		layout.setHAlignment(GUI::HAlignment::center); +		layout.setHAlignment(dggui::HAlignment::center);  		label1.setText("Label1"); -		label1.setAlignment(GUI::TextAlignment::left); +		label1.setAlignment(dggui::TextAlignment::left);  		layout.addItem(&label1);  		label2.setText("Label2"); -		label2.setAlignment(GUI::TextAlignment::center); +		label2.setAlignment(dggui::TextAlignment::center);  		layout.addItem(&label2);  		label3.setText("Label3"); -		label3.setAlignment(GUI::TextAlignment::right); +		label3.setAlignment(dggui::TextAlignment::right);  		layout.addItem(&label3);  	}  private: -	GUI::VBoxLayout layout{this}; -	GUI::Label label1{this}; -	GUI::Label label2{this}; -	GUI::Label label3{this}; +	dggui::VBoxLayout layout{this}; +	dggui::Label label1{this}; +	dggui::Label label2{this}; +	dggui::Label label3{this};  };  class Widget2 -	: public GUI::Button +	: public dggui::Button  {  public: -	Widget2(GUI::Widget* parent) -		: GUI::Button(parent) +	Widget2(dggui::Widget* parent) +		: dggui::Button(parent)  	{  		setText("Widget2");  	}  };  class Widget3 -	: public GUI::Widget +	: public dggui::Widget  {  public: -	Widget3(GUI::Widget* parent) -		: GUI::Widget(parent) +	Widget3(dggui::Widget* parent) +		: dggui::Widget(parent)  	{  		label.move(100, 80);  		label.resize(100, 20);  		label.setText("Widget3");  	}  private: -	GUI::Label label{this}; +	dggui::Label label{this};  };  class TestWindow -	: public GUI::Window +	: public dggui::Window  {  public:  	TestWindow() -		: GUI::Window(nullptr) +		: dggui::Window(nullptr)  	{  		setCaption("TabWidgetTest Window");  		CONNECT(eventHandler(), closeNotifier, @@ -125,16 +126,16 @@ public:  		return !closing;  	} -	void repaintEvent(GUI::RepaintEvent* repaintEvent) override +	void repaintEvent(dggui::RepaintEvent* repaintEvent) override  	{ -		GUI::Painter painter(*this); -		painter.setColour(GUI::Colour(0.85)); +		dggui::Painter painter(*this); +		painter.setColour(dggui::Colour(0.85));  		painter.drawFilledRectangle(0, 0, width() - 1, height() - 1);  	}  private:  	bool closing{false}; -	GUI::TabWidget tabs{this}; +	dggui::TabWidget tabs{this};  	Widget1 widget1{this};  	Widget2 widget2{this};  	Widget3 widget3{this}; diff --git a/tools/macos/build-dg.sh b/tools/macos/build-dg.sh new file mode 100755 index 0000000..84585d4 --- /dev/null +++ b/tools/macos/build-dg.sh @@ -0,0 +1,264 @@ +#!/bin/bash + +# --------------------------------------------------------------------------------------------------------------------- +# stop on error + +set -e + +# --------------------------------------------------------------------------------------------------------------------- +# stop on error + +TARGETDIR=$PWD/builds/drumgizmo + +DOWNLOADS=$PWD/downloads + +PKG_CONFIG_VERSION=0.28 +LIBOGG_VERSION=1.3.3 +LIBVORBIS_VERSION=1.3.6 +FLAC_VERSION=1.3.2 +LIBSNDFILE_VERSION=1.0.28 +ZITA_RESAMPLER_VERSION=1.6.2 + +DRUMGIZMO_VERSION=0.9.20 + +# --------------------------------------------------------------------------------------------------------------------- +# function to remove old stuff + +cleanup() +{ + +rm -rf $TARGETDIR +rm -rf flac-* +rm -rf libogg-* +rm -rf libsndfile-* +rm -rf libvorbis-* +rm -rf pkg-config-* +exit 0 + +} + +# --------------------------------------------------------------------------------------------------------------------- +# setup build vars + +export CC=clang +export CXX=clang++ + +export PREFIX=${TARGETDIR} +export PATH=${PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin +export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig + +export CFLAGS="-O3 -mtune=generic -msse -msse2 -fvisibility=hidden" +export CFLAGS="${CFLAGS} -fPIC -DPIC -DNDEBUG -I${PREFIX}/include" +export CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden -stdlib=libc++" + +export LDFLAGS="-Wl,-dead_strip -Wl,-dead_strip_dylibs" +export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib" + +# --------------------------------------------------------------------------------------------------------------------- +echo ==== Package pkgconfig ==== + +if [ ! -f ${DOWNLOADS}/pkg-config-${PKG_CONFIG_VERSION}.tar.gz ]; then +  pushd ${DOWNLOADS} +  curl -O https://pkg-config.freedesktop.org/releases/pkg-config-${PKG_CONFIG_VERSION}.tar.gz || \ +  curl -k -O https://drumgizmo.org/mirror/pkg-config-${PKG_CONFIG_VERSION}.tar.gz +  popd +fi + +if [ ! -d pkg-config-${PKG_CONFIG_VERSION} ]; then +  tar -xf ${DOWNLOADS}/pkg-config-${PKG_CONFIG_VERSION}.tar.gz +fi + +if [ ! -f pkg-config-${PKG_CONFIG_VERSION}/build-done ]; then +  cd pkg-config-${PKG_CONFIG_VERSION} +  ./configure --enable-indirect-deps --with-internal-glib --with-pc-path=$PKG_CONFIG_PATH --prefix=${PREFIX} +  make ${MAKE_ARGS} +  make install +  touch build-done +  cd .. +fi + +# --------------------------------------------------------------------------------------------------------------------- +echo ==== Package libogg ==== + +if [ ! -f ${DOWNLOADS}/libogg-${LIBOGG_VERSION}.tar.gz ]; then +  pushd ${DOWNLOADS} +  curl -O http://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz || \ +  curl -k -O https://drumgizmo.org/mirror/libogg-${LIBOGG_VERSION}.tar.gz +  popd +fi + +if [ ! -d libogg-${LIBOGG_VERSION} ]; then +  tar -xf ${DOWNLOADS}/libogg-${LIBOGG_VERSION}.tar.gz +fi + +if [ ! -f libogg-${LIBOGG_VERSION}/build-done ]; then +  cd libogg-${LIBOGG_VERSION} +  ./configure --enable-static --disable-shared --prefix=${PREFIX} +  make ${MAKE_ARGS} +  make install +  touch build-done +  cd .. +fi + +# --------------------------------------------------------------------------------------------------------------------- +echo ==== Package libvorbis ==== + +if [ ! -f ${DOWNLOADS}/libvorbis-${LIBVORBIS_VERSION}.tar.gz ]; then +  pushd ${DOWNLOADS} +  curl -O http://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-${LIBVORBIS_VERSION}.tar.gz || \ +  curl -k -O https://drumgizmo.org/mirror/libvorbis-${LIBVORBIS_VERSION}.tar.gz +  popd +fi + +if [ ! -d libvorbis-${LIBVORBIS_VERSION} ]; then +  tar -xf ${DOWNLOADS}/libvorbis-${LIBVORBIS_VERSION}.tar.gz +fi + +if [ ! -f libvorbis-${LIBVORBIS_VERSION}/build-done ]; then +  cd libvorbis-${LIBVORBIS_VERSION} +  ./configure --enable-static --disable-shared --prefix=${PREFIX} +  make ${MAKE_ARGS} +  make install +  touch build-done +  cd .. +fi + +# --------------------------------------------------------------------------------------------------------------------- +echo ==== Package flac ==== + +if [ ! -f ${DOWNLOADS}/flac-${FLAC_VERSION}.tar.xz ]; then +  pushd ${DOWNLOADS} +  curl -O http://ftp.osuosl.org/pub/xiph/releases/flac/flac-${FLAC_VERSION}.tar.xz || \ +  curl -k -O https://drumgizmo.org/mirror/flac-${FLAC_VERSION}.tar.xz +  popd +fi +if [ ! -d flac-${FLAC_VERSION} ]; then +  tar -xf ${DOWNLOADS}/flac-${FLAC_VERSION}.tar.xz +fi + +if [ ! -f flac-${FLAC_VERSION}/build-done ]; then +  cd flac-${FLAC_VERSION} +  sed -i -e "s/HAVE_CPUID_H/HAVE_CPUID_H_NOT/" src/libFLAC/cpu.c +  chmod +x configure install-sh +  ./configure --enable-static --disable-shared --prefix=${PREFIX} \ +    --disable-cpplibs +  echo "exit 0" > missing +  make ${MAKE_ARGS} +  make install +  touch build-done +  cd .. +fi + +# --------------------------------------------------------------------------------------------------------------------- +echo ==== Package libsndfile ==== + +if [ ! -f ${DOWNLOADS}/libsndfile-${LIBSNDFILE_VERSION}.tar.gz ]; then +  pushd ${DOWNLOADS} +  curl -O http://www.mega-nerd.com/libsndfile/files/libsndfile-${LIBSNDFILE_VERSION}.tar.gz || \ +  curl -k -O https://drumgizmo.org/mirror/libsndfile-${LIBSNDFILE_VERSION}.tar.gz +  popd +fi + +if [ ! -d libsndfile-${LIBSNDFILE_VERSION} ]; then +  tar -xf ${DOWNLOADS}/libsndfile-${LIBSNDFILE_VERSION}.tar.gz +fi + +if [ ! -f libsndfile-${LIBSNDFILE_VERSION}/build-done ]; then +  cd libsndfile-${LIBSNDFILE_VERSION} +  ./configure --enable-static --disable-shared --prefix=${PREFIX} \ +    --disable-full-suite --disable-sqlite +  make ${MAKE_ARGS} +  make install +  sed -i -e "s|-lsndfile|-lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lm|" ${PREFIX}/lib/pkgconfig/sndfile.pc +  touch build-done +  cd .. +fi + +# --------------------------------------------------------------------------------------------------------------------- +echo ==== Package zita-resampler ==== + +if [ ! -f ${DOWNLOADS}/zita-resampler-${ZITA_RESAMPLER_VERSION}.tar.bz2 ]; then +  pushd ${DOWNLOADS} +  curl -O http://kokkinizita.linuxaudio.org/linuxaudio/downloads/zita-resampler-${ZITA_RESAMPLER_VERSION}.tar.bz2 || \ +  curl -k -O https://drumgizmo.org/mirror/zita-resampler-${ZITA_RESAMPLER_VERSION}.tar.bz2 +  popd +fi + +if [ ! -d zita-resampler-${ZITA_RESAMPLER_VERSION} ]; then +  tar -xf ${DOWNLOADS}/zita-resampler-${ZITA_RESAMPLER_VERSION}.tar.bz2 +fi + +if [ ! -f zita-resampler-${ZITA_RESAMPLER_VERSION}/build-done ]; then +  cd zita-resampler-${ZITA_RESAMPLER_VERSION} +  if [ ! -f patched ]; then +    patch -p1 -i ../zita-resampler-static-build.patch +    touch patched +  fi +  make ${MAKE_ARGS} -C source +  mkdir ${PREFIX}/include/zita-resampler +  cp source/*.a ${PREFIX}/lib/ +  cp source/zita-resampler/*.h ${PREFIX}/include/zita-resampler/ +  touch build-done +  cd .. +fi + +# --------------------------------------------------------------------------------------------------------------------- +echo ==== Package drumgizmo ==== + +if [ ! -f ${DOWNLOADS}/drumgizmo-${DRUMGIZMO_VERSION}.tar.gz ]; then +  pushd ${DOWNLOADS} +  curl -O https://www.drumgizmo.org/releases/drumgizmo-${DRUMGIZMO_VERSION}/drumgizmo-${DRUMGIZMO_VERSION}.tar.gz +  popd +fi + +if [ ! -d drumgizmo-${DRUMGIZMO_VERSION} ]; then +  tar -xf ${DOWNLOADS}/drumgizmo-${DRUMGIZMO_VERSION}.tar.gz +fi + +if [ ! -f drumgizmo-${DRUMGIZMO_VERSION}/build-done ]; then +  PATH=/usr/local/opt/gettext/bin:$PATH +  cd drumgizmo-${DRUMGIZMO_VERSION} +  ./configure --prefix=${PREFIX} \ +    --disable-input-midifile \ +    --disable-input-jackmidi \ +    --disable-output-jackaudio \ +    --disable-input-alsamidi \ +    --disable-output-alsa \ +    --enable-cli \ +    --without-debug \ +    --with-test \ +    --disable-lv2 \ +    --enable-vst \ +    --with-vst-sources=$HOME/VST3_SDK +  make ${MAKE_ARGS} +  make install +  touch build-done +  cd .. +fi + +# --------------------------------------------------------------------------------------------------------------------- + +echo Make macOS package: + +otool -L ${PREFIX}/lib/vst/drumgizmo_vst.so + +if [ ! -f drumgizmo.vst.tar.gz ]; then +  exit "Missing VST package template: drumgizmo.vst.tar.gz " +fi + +if [ ! -d ${DRUMGIZMO_VERSION}/drumgizmo.vst ]; then +  mkdir -p ${DRUMGIZMO_VERSION} +  pushd ${DRUMGIZMO_VERSION} +  tar -xvzf ../drumgizmo.vst.tar.gz +  popd +fi + +cp -a ${PREFIX}/lib/vst/drumgizmo_vst.so ${DRUMGIZMO_VERSION}/drumgizmo.vst/Contents/MacOS/drumgizmo +sed -e "s/@VERSION@/${DRUMGIZMO_VERSION}/g" -i .bak ${DRUMGIZMO_VERSION}/drumgizmo.vst/Contents/Info.plist +rm -f ${DRUMGIZMO_VERSION}/drumgizmo.vst/Contents/Info.plist.bak + +pushd ${DRUMGIZMO_VERSION} +tar cvzf ../drumgizmo_vst-osx-${DRUMGIZMO_VERSION}.tar.gz drumgizmo.vst/ +popd + +echo Package is now ready in drumgizmo_vst-osx-${DRUMGIZMO_VERSION}.tar.gz diff --git a/tools/macos/drumgizmo.vst.tar.gz b/tools/macos/drumgizmo.vst.tar.gzBinary files differ new file mode 100644 index 0000000..0db45db --- /dev/null +++ b/tools/macos/drumgizmo.vst.tar.gz diff --git a/tools/macos/zita-resampler-static-build.patch b/tools/macos/zita-resampler-static-build.patch new file mode 100644 index 0000000..5b894e1 --- /dev/null +++ b/tools/macos/zita-resampler-static-build.patch @@ -0,0 +1,28 @@ +--- zita-resampler-static-1.6.2.orig/source/Makefile ++++ zita-resampler-static-1.6.2/source/Makefile +@@ -32,12 +32,12 @@ DISTDIR = zita-resampler-$(VERSION) +  +  + CPPFLAGS += -I. -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS +-CXXFLAGS += -Wall -fPIC -O2 -ffast-math +-CXXFLAGS += -march=native ++CXXFLAGS += -Wall -fPIC -O3 -ffast-math + LDFLAGS +=  + LDLIBS += +  +  ++ZITA-RESAMPLER_A = libzita-resampler.a + ZITA-RESAMPLER_SO = libzita-resampler.so + ZITA-RESAMPLER_MAJ = $(ZITA-RESAMPLER_SO).$(MAJVERS) + ZITA-RESAMPLER_MIN = $(ZITA-RESAMPLER_MAJ).$(MINVERS) +@@ -47,6 +47,10 @@ ZITA-RESAMPLER_H = zita-resampler/resamp + 	zita-resampler/vresampler.h zita-resampler/cresampler.h +  +  ++$(ZITA-RESAMPLER_A): $(ZITA-RESAMPLER_O) ++	rm -f $@ ++	ar cr $@ $^ ++ + $(ZITA-RESAMPLER_MIN): $(ZITA-RESAMPLER_O) + 	$(CXX) -shared $(LDFLAGS) -Wl,-soname,$(ZITA-RESAMPLER_MAJ) -o $(ZITA-RESAMPLER_MIN) $(ZITA-RESAMPLER_O) $(ZITA-RESAMPLER_DEP) +  @@ -1 +1 @@ -#define VERSION "0.9.19" +#define VERSION "0.9.20" | 
