aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--meson.build10
-rw-r--r--patchmatrix_nk.c57
-rw-r--r--share/patchmatrix/audio.png (renamed from pix/audio.png)bin639 -> 639 bytes
-rw-r--r--share/patchmatrix/cv.png (renamed from pix/cv.png)bin681 -> 681 bytes
-rw-r--r--share/patchmatrix/midi.png (renamed from pix/midi.png)bin1011 -> 1011 bytes
-rw-r--r--share/patchmatrix/osc.png (renamed from pix/osc.png)bin441 -> 441 bytes
-rw-r--r--share/patchmatrix/patchmatrix.png (renamed from pix/patchmatrix.png)bin15385 -> 15385 bytes
8 files changed, 58 insertions, 11 deletions
diff --git a/VERSION b/VERSION
index d898071..85a7643 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.25.7
+0.25.9
diff --git a/meson.build b/meson.build
index 36d0b7d..bab92df 100644
--- a/meson.build
+++ b/meson.build
@@ -106,14 +106,14 @@ install_man('patchmatrix.1')
install_man('patchmatrix_mixer.1')
install_man('patchmatrix_monitor.1')
-install_data(join_paths('pix', 'patchmatrix.png'),
+install_data(join_paths('share', 'patchmatrix', 'patchmatrix.png'),
install_dir : join_paths(prefix, datadir, 'icons', 'hicolor', '256x256', 'apps'))
-install_data(join_paths('pix', 'audio.png'),
+install_data(join_paths('share', 'patchmatrix', 'audio.png'),
install_dir : pdatadir)
-install_data(join_paths('pix', 'midi.png'),
+install_data(join_paths('share', 'patchmatrix', 'midi.png'),
install_dir : pdatadir)
-install_data(join_paths('pix', 'osc.png'),
+install_data(join_paths('share', 'patchmatrix', 'osc.png'),
install_dir : pdatadir)
-install_data(join_paths('pix', 'cv.png'),
+install_data(join_paths('share', 'patchmatrix', 'cv.png'),
install_dir : pdatadir)
diff --git a/patchmatrix_nk.c b/patchmatrix_nk.c
index 23683d4..54c4f25 100644
--- a/patchmatrix_nk.c
+++ b/patchmatrix_nk.c
@@ -15,6 +15,10 @@
* http://www.perlfoundation.org/artistic_license_2_0.
*/
+#include <limits.h>
+#include <dirent.h>
+#include <libgen.h>
+
#include <patchmatrix_jack.h>
#include <patchmatrix_db.h>
#include <patchmatrix_nk.h>
@@ -1261,11 +1265,54 @@ _icon_unload(app_t *app, struct nk_image img)
nk_pugl_icon_unload(&app->win, img);
}
+static char *
+_get_path(const char *data_dir, const char *fn)
+{
+ static char path [PATH_MAX];
+
+ snprintf(path, sizeof(path), "%s%s", data_dir, fn);
+
+ return path;
+}
+
+static const char *
+_get_data_dir()
+{
+ // check whether build-time defined data dir exists
+ DIR *dir = opendir(PATCHMATRIX_DATA_DIR);
+ if(dir)
+ {
+ closedir(dir);
+
+ return PATCHMATRIX_DATA_DIR;
+ }
+
+ // derive directory of executable
+ char bin_path [PATH_MAX];
+ if(readlink("/proc/self/exe", bin_path, sizeof(bin_path)) == -1)
+ {
+ return NULL;
+ }
+ char *base_path = dirname(bin_path);
+
+ // derive data dir reative to executable
+ static char rel_path [PATH_MAX];
+ snprintf(rel_path, sizeof(rel_path), "%s/../share/patchmatrix/", base_path);
+
+ return rel_path;
+}
+
int
_ui_init(app_t *app)
{
app->scale = nk_pugl_get_scale();
+ const char *data_dir = _get_data_dir();
+ if(!data_dir)
+ {
+ return 1;
+ }
+
// UI
nk_pugl_config_t *cfg = &app->win.cfg;
cfg->width = 1280 * app->scale;
@@ -1278,7 +1325,7 @@ _ui_init(app_t *app)
cfg->threads = true;
cfg->data = app;
cfg->expose = _expose;
- cfg->font.face = PATCHMATRIX_DATA_DIR"/Cousine-Regular.ttf";
+ cfg->font.face = _get_path(data_dir, "Cousine-Regular.ttf");
cfg->font.size = 13 * app->scale;
app->type = TYPE_AUDIO;
@@ -1293,11 +1340,11 @@ _ui_init(app_t *app)
struct nk_style *style = &app->win.ctx.style;
style->button.border_color = button_border_color;
- app->icons.audio= _icon_load(app, PATCHMATRIX_DATA_DIR"audio.png");
- app->icons.midi = _icon_load(app, PATCHMATRIX_DATA_DIR"midi.png");
+ app->icons.audio= _icon_load(app, _get_path(data_dir, "audio.png"));
+ app->icons.midi = _icon_load(app, _get_path(data_dir, "midi.png"));
#ifdef JACK_HAS_METADATA_API
- app->icons.cv = _icon_load(app, PATCHMATRIX_DATA_DIR"cv.png");
- app->icons.osc = _icon_load(app, PATCHMATRIX_DATA_DIR"osc.png");
+ app->icons.cv = _icon_load(app, _get_path(data_dir, "cv.png"));
+ app->icons.osc = _icon_load(app, _get_path(data_dir, "osc.png"));
#endif
return 0;
diff --git a/pix/audio.png b/share/patchmatrix/audio.png
index 698dfc7..698dfc7 100644
--- a/pix/audio.png
+++ b/share/patchmatrix/audio.png
Binary files differ
diff --git a/pix/cv.png b/share/patchmatrix/cv.png
index 103619c..103619c 100644
--- a/pix/cv.png
+++ b/share/patchmatrix/cv.png
Binary files differ
diff --git a/pix/midi.png b/share/patchmatrix/midi.png
index de63931..de63931 100644
--- a/pix/midi.png
+++ b/share/patchmatrix/midi.png
Binary files differ
diff --git a/pix/osc.png b/share/patchmatrix/osc.png
index 679b99b..679b99b 100644
--- a/pix/osc.png
+++ b/share/patchmatrix/osc.png
Binary files differ
diff --git a/pix/patchmatrix.png b/share/patchmatrix/patchmatrix.png
index 01845c1..01845c1 100644
--- a/pix/patchmatrix.png
+++ b/share/patchmatrix/patchmatrix.png
Binary files differ