summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Nusser <andre.nusser@googlemail.com>2019-10-26 19:11:03 +0200
committerAndré Nusser <andre.nusser@googlemail.com>2019-10-26 20:04:01 +0200
commit85ce939590e9f60d51952b4cc1e6af6f9820ca28 (patch)
tree25b66ce7fbed77cb3b1d3e54065c03e67f31d125
parent6ad9b9d2ae3341bbd4914f4951070a02d3dd4d2b (diff)
Add default midimap functionality.
Move directory.{h,cc} to src/ for this.
-rw-r--r--plugin/Makefile.mingw32.in2
-rw-r--r--plugingui/Makefile.am2
-rw-r--r--plugingui/filebrowser.cc2
-rw-r--r--plugingui/filebrowser.h2
-rw-r--r--src/DGDOM.h1
-rw-r--r--src/Makefile.am2
-rw-r--r--src/dgxmlparser.cc5
-rw-r--r--src/directory.cc (renamed from plugingui/directory.cc)5
-rw-r--r--src/directory.h (renamed from plugingui/directory.h)4
-rw-r--r--src/drumkitloader.cc7
-rw-r--r--test/uitests/Makefile.am8
11 files changed, 21 insertions, 19 deletions
diff --git a/plugin/Makefile.mingw32.in b/plugin/Makefile.mingw32.in
index 50d6478..6bb0360 100644
--- a/plugin/Makefile.mingw32.in
+++ b/plugin/Makefile.mingw32.in
@@ -21,6 +21,7 @@ DG_SRC = \
@top_srcdir@/src/configfile.cc \
@top_srcdir@/src/configparser.cc \
@top_srcdir@/src/dgxmlparser.cc \
+ @top_srcdir@/src/directory.cc \
@top_srcdir@/src/domloader.cc \
@top_srcdir@/src/drumgizmo.cc \
@top_srcdir@/src/drumkit.cc \
@@ -55,7 +56,6 @@ GUI_SRC = \
@top_srcdir@/plugingui/colour.cc \
@top_srcdir@/plugingui/combobox.cc \
@top_srcdir@/plugingui/dialog.cc \
- @top_srcdir@/plugingui/directory.cc \
@top_srcdir@/plugingui/diskstreamingframecontent.cc \
@top_srcdir@/plugingui/drumkitframecontent.cc \
@top_srcdir@/plugingui/drumkittab.cc \
diff --git a/plugingui/Makefile.am b/plugingui/Makefile.am
index b33fc47..d0e8e0a 100644
--- a/plugingui/Makefile.am
+++ b/plugingui/Makefile.am
@@ -64,7 +64,6 @@ nodist_libdggui_la_SOURCES = \
colour.cc \
combobox.cc \
dialog.cc \
- directory.cc \
diskstreamingframecontent.cc \
drumkitframecontent.cc \
drumkittab.cc \
@@ -192,7 +191,6 @@ EXTRA_DIST = \
colour.h \
combobox.h \
dialog.h \
- directory.h \
diskstreamingframecontent.h \
drawable.h \
drumkitframecontent.h \
diff --git a/plugingui/filebrowser.cc b/plugingui/filebrowser.cc
index 68a80b0..604440d 100644
--- a/plugingui/filebrowser.cc
+++ b/plugingui/filebrowser.cc
@@ -29,8 +29,6 @@
#include "painter.h"
#include "button.h"
-#include "directory.h"
-
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
diff --git a/plugingui/filebrowser.h b/plugingui/filebrowser.h
index 7566391..bc7adb3 100644
--- a/plugingui/filebrowser.h
+++ b/plugingui/filebrowser.h
@@ -28,6 +28,7 @@
#include <notifier.h>
#include <platform.h>
+#include <directory.h>
#include "dialog.h"
#include "button.h"
@@ -35,7 +36,6 @@
#include "lineedit.h"
#include "label.h"
#include "image.h"
-#include "directory.h"
namespace GUI
{
diff --git a/src/DGDOM.h b/src/DGDOM.h
index b6c52ac..474b29c 100644
--- a/src/DGDOM.h
+++ b/src/DGDOM.h
@@ -131,6 +131,7 @@ struct MetadataDOM
std::string image;
std::string image_map;
std::vector<ClickMapDOM> clickmaps;
+ std::string default_midimap_file;
};
struct DrumkitDOM
diff --git a/src/Makefile.am b/src/Makefile.am
index 56d44ef..93ef5ed 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,6 +22,7 @@ nodist_libdg_la_SOURCES = \
channelmixer.cc \
configfile.cc \
configparser.cc \
+ directory.cc \
domloader.cc \
dgxmlparser.cc \
drumgizmo.cc \
@@ -63,6 +64,7 @@ EXTRA_DIST = \
channelmixer.h \
configfile.h \
configparser.h \
+ directory.h \
cpp11fix.h \
dgxmlparser.h \
domloader.h \
diff --git a/src/dgxmlparser.cc b/src/dgxmlparser.cc
index b924cc8..0d3cdcd 100644
--- a/src/dgxmlparser.cc
+++ b/src/dgxmlparser.cc
@@ -245,6 +245,11 @@ bool parseDrumkitFile(const std::string& filename, DrumkitDOM& dom, LogFunction
clickmap, "colour", logger, filename, true);
}
}
+ pugi::xml_node default_midimap = metadata.child("defaultmidimap");
+ if(default_midimap != pugi::xml_node())
+ {
+ res &= attrcpy(meta.default_midimap_file, default_midimap, "src", logger, filename, true);
+ }
}
pugi::xml_node channels = doc.child("drumkit").child("channels");
diff --git a/plugingui/directory.cc b/src/directory.cc
index 083c8e4..596b045 100644
--- a/plugingui/directory.cc
+++ b/src/directory.cc
@@ -52,9 +52,6 @@
#define SEP "/"
#endif
-namespace GUI
-{
-
Directory::Directory(std::string path)
{
setPath(path);
@@ -568,5 +565,3 @@ std::string Directory::pathDirectory(std::string filepath)
return Directory::pathToStr(path);
}
-
-} // GUI::
diff --git a/plugingui/directory.h b/src/directory.h
index 100204a..e46c5b9 100644
--- a/plugingui/directory.h
+++ b/src/directory.h
@@ -36,8 +36,6 @@
#define DIRECTORY_HIDDEN 1
-namespace GUI {
-
class Directory {
public:
typedef struct drive {
@@ -88,5 +86,3 @@ private:
static Path parsePath(std::string path);
static std::string pathToStr(Path &path);
};
-
-} // GUI::
diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc
index 91e3dd8..6a4c9f4 100644
--- a/src/drumkitloader.cc
+++ b/src/drumkitloader.cc
@@ -36,6 +36,7 @@
#include "dgxmlparser.h"
#include "path.h"
#include "domloader.h"
+#include "directory.h"
#define REFSFILE "refs.conf"
@@ -218,6 +219,12 @@ bool DrumKitLoader::loadkit(const std::string& file)
settings.drumkit_description = kit.getDescription();
settings.drumkit_version = kit.getVersion();
settings.drumkit_samplerate = kit.getSamplerate();
+ // only load the default midi map if there is one and no midimap is selected yet
+ if (drumkitdom.metadata.default_midimap_file != "" && settings.midimap_file == "")
+ {
+ const std::string drumkit_path = Directory::pathDirectory(settings.drumkit_file);
+ settings.midimap_file = drumkit_path + "/" + drumkitdom.metadata.default_midimap_file;
+ }
loadKitAudio(kit);
diff --git a/test/uitests/Makefile.am b/test/uitests/Makefile.am
index 63d8c61..14cbf4e 100644
--- a/test/uitests/Makefile.am
+++ b/test/uitests/Makefile.am
@@ -1,7 +1,7 @@
noinst_PROGRAMS = resizetest tabwidgettest framewidgettest \
filebrowsertest
-resizetest_LDADD = $(top_srcdir)/plugingui/libdggui.la
+resizetest_LDADD = $(top_srcdir)/plugingui/libdggui.la $(top_srcdir)/src/libdg.la
resizetest_CXXFLAGS = \
-I$(top_srcdir)/plugingui \
-I$(top_srcdir)/src \
@@ -10,7 +10,7 @@ resizetest_SOURCES = \
resizetest.cc \
$(top_srcdir)/hugin/hugin.c
-tabwidgettest_LDADD = $(top_srcdir)/plugingui/libdggui.la
+tabwidgettest_LDADD = $(top_srcdir)/plugingui/libdggui.la $(top_srcdir)/src/libdg.la
tabwidgettest_CXXFLAGS = \
-I$(top_srcdir)/plugingui \
-I$(top_srcdir)/src \
@@ -19,7 +19,7 @@ tabwidgettest_SOURCES = \
tabwidgettest.cc \
$(top_srcdir)/hugin/hugin.c
-filebrowsertest_LDADD = $(top_srcdir)/plugingui/libdggui.la
+filebrowsertest_LDADD = $(top_srcdir)/plugingui/libdggui.la $(top_srcdir)/src/libdg.la
filebrowsertest_CXXFLAGS = \
-I$(top_srcdir)/plugingui \
-I$(top_srcdir)/src \
@@ -28,7 +28,7 @@ filebrowsertest_SOURCES = \
filebrowsertest.cc \
$(top_srcdir)/hugin/hugin.c
-framewidgettest_LDADD = $(top_srcdir)/plugingui/libdggui.la
+framewidgettest_LDADD = $(top_srcdir)/plugingui/libdggui.la $(top_srcdir)/src/libdg.la
framewidgettest_CXXFLAGS = \
-I$(top_srcdir)/plugingui \
-I$(top_srcdir)/src \