aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/synthpod_nsm.c4
-rw-r--r--data/synthpod.edc1
-rw-r--r--data/theme.edc4
-rw-r--r--lib/synthpod_app.c4
-rw-r--r--lib/synthpod_ui.c18
5 files changed, 14 insertions, 17 deletions
diff --git a/bin/synthpod_nsm.c b/bin/synthpod_nsm.c
index ca8386ba..3fdb5e5c 100644
--- a/bin/synthpod_nsm.c
+++ b/bin/synthpod_nsm.c
@@ -306,8 +306,6 @@ synthpod_nsm_new(const char *exe, const char *path,
}
else
{
- const char *data_dir = efreet_data_home_get();
-
if(path)
{
nsm->driver->open(path,
@@ -315,6 +313,8 @@ synthpod_nsm_new(const char *exe, const char *path,
}
else
{
+ const char *data_dir = efreet_data_home_get();
+
char *synthpod_dir = NULL;
asprintf(&synthpod_dir, "%s/synthpod", data_dir);
if(synthpod_dir)
diff --git a/data/synthpod.edc b/data/synthpod.edc
index 824ca3e4..0b839bf0 100644
--- a/data/synthpod.edc
+++ b/data/synthpod.edc
@@ -20,6 +20,7 @@ collections {
image: "omk_logo_256x256.png" COMP;
}
+#define COLORS_MAX "20"
#define COL00 0 0 0 255 // Black
#define COL01 255 179 0 255 // Vivid Yellow
#define COL02 128 62 117 255 // Strong Purple
diff --git a/data/theme.edc b/data/theme.edc
index 3e8ff791..12cb129a 100644
--- a/data/theme.edc
+++ b/data/theme.edc
@@ -22,6 +22,10 @@ fonts {
group {
name: "/synthpod/theme";
+ data {
+ item: "colors_max" COLORS_MAX;
+ }
+
parts {
part {
name: "clip";
diff --git a/lib/synthpod_app.c b/lib/synthpod_app.c
index 641d23f8..91ca9e66 100644
--- a/lib/synthpod_app.c
+++ b/lib/synthpod_app.c
@@ -2021,7 +2021,7 @@ sp_app_restore(sp_app_t *app, LV2_State_Retrieve_Function retrieve,
if(!(_flags & (LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE)))
return LV2_STATE_ERR_BAD_FLAGS;
- printf("absolute: %s\n", absolute);
+ //printf("absolute: %s\n", absolute);
char *root_str = NULL;
FILE *f = fopen(absolute, "rb");
@@ -2095,7 +2095,7 @@ sp_app_restore(sp_app_t *app, LV2_State_Retrieve_Function retrieve,
if(!path)
continue;
- printf("mapped path: %s\n", path);
+ //printf("mapped path: %s\n", path);
// strip 'file://'
const char *tmp = !strncmp(path, "file://", 7)
diff --git a/lib/synthpod_ui.c b/lib/synthpod_ui.c
index fb1488d1..4b3f8972 100644
--- a/lib/synthpod_ui.c
+++ b/lib/synthpod_ui.c
@@ -213,6 +213,8 @@ struct _sp_ui_t {
Evas_Object *win;
Evas_Object *theme;
+ int colors_max;
+
Evas_Object *mainpane;
Evas_Object *leftpane;
Evas_Object *plugpane;
@@ -240,18 +242,6 @@ struct _sp_ui_t {
Elm_Object_Item *sink_itm;
};
-#define COLORS_MAX 20 // FIXME read from theme
-static uint8_t color_cnt = 1;
-
-static inline int
-_next_color()
-{
- int col = color_cnt++;
- if(color_cnt >= COLORS_MAX)
- color_cnt = 1;
- return col;
-}
-
static inline void *
_sp_ui_to_app_request(sp_ui_t *ui, size_t size)
{
@@ -1419,7 +1409,7 @@ _sp_ui_mod_add(sp_ui_t *ui, const char *uri, u_id_t uid, LV2_Handle inst,
if(mod->system.source || mod->system.sink)
mod->col = 0; // reserved color for system ports
else
- mod->col = _next_color();
+ mod->col = ( (mod->uid - 3) % ui->colors_max + 1);
// load presets
mod->presets = lilv_plugin_get_related(mod->plug, ui->regs.pset.preset.node);
@@ -2971,6 +2961,8 @@ sp_ui_new(Evas_Object *win, const LilvWorld *world, sp_ui_driver_t *driver, void
ui->theme = elm_layout_add(win);
elm_layout_file_set(ui->theme, SYNTHPOD_DATA_DIR"/synthpod.edj",
"/synthpod/theme");
+ const char *colors_max = elm_layout_data_get(ui->theme, "colors_max");
+ ui->colors_max = colors_max ? atoi(colors_max) : 20;
evas_object_size_hint_weight_set(ui->theme, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ui->theme, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(ui->theme);