void elicit_free(Elicit *el) { elicit_magnify_stop(el); if (el->color) color_unref(el->color); if (el->obj.main) evas_object_del(el->obj.main); if (el->obj.shot) evas_object_del(el->obj.shot); if (el->obj.swatch) evas_object_del(el->obj.swatch); if (el->ee) ecore_evas_free(el->ee); if (el->band) elicit_band_free(el->band); if (el->palette) palette_free(el->palette); IF_FREE(el->conf.theme); IF_FREE(el->path.theme); IF_FREE(el->path.datadir); IF_FREE(el->path.confdir); IF_FREE(el->path.palette); IF_FREE(el->path.conffile); free(el); }
void elicit_cslider_color_set(Evas_Object *o, Color *color, Color_Type type) { Elicit_Cslider *cs; cs = evas_object_smart_data_get(o); if (cs->color) { color_callback_changed_del(cs->color, cb_color_changed); color_unref(cs->color); } cs->color = color; color_ref(color); cs->type = type; if (edje_object_part_exists(cs->gui, "label")) { edje_object_part_text_set(cs->gui, "label", cslider_labels[cs->type]); } color_callback_changed_add(cs->color, cb_color_changed, cs); }
static void cb_edje_signal(void *data, Evas_Object *obj, const char *emission, const char *source) { Elicit *el = data; char *signal; char *tok; int invalid = 0; /* ignore signals we sent */ if (!strcmp(source, "elicit")) return; signal = strdup(emission); printf("signal: %s\n", signal); tok = strtok(signal, ","); // first is 'elicit' tok = strtok(NULL, ","); if (!tok) { fprintf(stderr, "[Elicit] Error: invalid signal: %s\n", emission); free(signal); return; } /* magnification */ if (!strcmp(tok, "magnify")) { tok = strtok(NULL, ","); if (tok && !strcmp(tok, "start")) { el->state.magnifying = 1; elicit_cursor_set_cross(el); } else if (tok && !strcmp(tok, "stop")) { el->state.magnifying = 0; elicit_magnify_stop(el); } else invalid = 1; } /* color selection */ else if (!strcmp(tok, "pick")) { tok = strtok(NULL, ","); if (tok && !strcmp(tok, "start")) { el->state.picking = 1; elicit_cursor_set_cross(el); } else if (tok && !strcmp(tok, "stop")) { el->state.picking = 0; elicit_cursor_set_default(el); } else invalid = 1; } else if (!strcmp(tok, "scroll")) { tok = strtok(NULL, ","); if (tok && !strcmp(tok, "up")) elicit_scroll(el, source, 1); else if (tok && !strcmp(tok, "down")) elicit_scroll(el, source, -1); else invalid = 1; } /* palette */ else if (!strcmp(tok, "palette")) { tok = strtok(NULL, ","); if (tok && !strcmp(tok, "add")) { Color *c; c = color_clone(el->color); palette_color_append(el->palette, c); palette_view_select(el->obj.palette, c); color_unref(c); // (the palette retains a ref) } else if (tok && !strcmp(tok, "remove")) { Color *c; c = palette_view_selected(el->obj.palette); if (c) { palette_color_remove(el->palette, c); palette_view_select(el->obj.palette, NULL); } } else if (tok && !strcmp(tok, "columns")) { int col; tok = strtok(NULL, ","); col = palette_columns_get(el->palette); if (tok && !strcmp(tok, "up")) col += 1; else if (tok && !strcmp(tok, "down")) col -= 1; palette_columns_set(el->palette, col); palette_view_changed(el->obj.palette); } else invalid = 1; } /* band config */ else if (!strcmp(tok, "band")) { tok = strtok(NULL, ","); if (tok && !strcmp(tok, "toggle")) { elicit_show_band_set(el, !el->conf.show_band); } else if (tok && !strcmp(tok, "on")) { elicit_show_band_set(el, 1); } else if (tok && !strcmp(tok, "off")) { elicit_show_band_set(el, 0); } } /* grid config */ else if (!strcmp(tok, "grid")) { tok = strtok(NULL, ","); if (tok && !strcmp(tok, "toggle")) { elicit_grid_visible_set(el, !el->conf.grid_visible); } else if (tok && !strcmp(tok, "on")) { elicit_grid_visible_set(el, 1); } else if (tok && !strcmp(tok, "off")) { elicit_grid_visible_set(el, 0); } } /* color classes */ else if (!strcmp(tok, "colorclass")) { int r,g,b,a; color_rgba_get(el->color, &r, &g, &b, &a); edje_object_color_class_set(el->obj.main, source, r, g, b, a, r, g, b, a, r, g, b, a); } else if (!strcmp(tok, "hex")) { tok = strtok(NULL, ","); if (tok && !strcmp(tok, "copy")) { Ecore_X_Window win; const char *hex; int len; win = ecore_evas_software_x11_window_get(el->ee); hex = color_hex_get(el->color, COLOR_HEX_HASH | COLOR_HEX_CAPS); if (hex) { len = strlen(hex); ecore_x_selection_primary_set(win, hex, len); ecore_x_selection_clipboard_set(win, hex, len); } } else invalid = 1; } /* quit */ else if (!strcmp(tok, "quit")) ecore_main_loop_quit(); /* unknown signal */ else invalid = 1; if (invalid) fprintf(stderr, "[Elicit] Error: invalid signal: %s\n", emission); free(signal); }