20 #include "giw/giwknob.h"
23 static int ireinit = 0;
28 static void after_param_text_buffer_changed(LiVESTextBuffer *textbuffer,
lives_rfx_t *rfx);
33 static LiVESSList *usrgrp_to_livesgrp[2] = {NULL, NULL};
36 LiVESList *onchange = NULL;
37 LiVESList *retvals = NULL;
60 for (i = 0; i < lives_list_length(onchange); i++) {
61 array = lives_strsplit((
char *)lives_list_nth_data(onchange, i), rfx->
delim, -1);
62 if (!strcmp(array[0],
"init")) {
66 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(dummy_widget),
PARAM_NUMBER_KEY,
67 LIVES_INT_TO_POINTER(-1));
68 retvals =
do_onchange(LIVES_WIDGET_OBJECT(dummy_widget), rfx);
70 lives_strfreev(array);
73 lives_strfreev(array);
83 static void on_paramwindow_button_clicked2(LiVESButton *button,
lives_rfx_t *rfx) {
91 LiVESWidget *dialog = NULL;
92 boolean def_ok =
FALSE;
100 if (dialog && LIVES_IS_DIALOG(dialog)) {
108 LiVESWidget *textwidget =
138 if (
cfile->start == 0) {
167 if (usrgrp_to_livesgrp[1]) lives_slist_free(usrgrp_to_livesgrp[1]);
168 usrgrp_to_livesgrp[1] = NULL;
171 if (usrgrp_to_livesgrp[1]) lives_slist_free(usrgrp_to_livesgrp[1]);
172 usrgrp_to_livesgrp[1] = NULL;
178 if (usrgrp_to_livesgrp[0]) lives_slist_free(usrgrp_to_livesgrp[0]);
179 usrgrp_to_livesgrp[0] = NULL;
223 uint32_t chk_mask = 0;
245 static void gen_width_changed(LiVESSpinButton *spin, livespointer user_data) {
246 weed_plant_t *ctmpl = (weed_plant_t *)user_data;
248 int error, old_val = 0;
252 if (val == old_val)
return;
254 if (weed_plant_has_leaf(ctmpl, WEED_LEAF_HSTEP)) step = weed_get_int_value(ctmpl, WEED_LEAF_HSTEP, &
error);
262 static void gen_height_changed(LiVESSpinButton *spin, livespointer user_data) {
263 weed_plant_t *ctmpl = (weed_plant_t *)user_data;
265 int error, old_val = 0;
270 if (val == old_val)
return;
272 if (weed_plant_has_leaf(ctmpl, WEED_LEAF_HSTEP)) step = weed_get_int_value(ctmpl, WEED_LEAF_HSTEP, &
error);
280 static void gen_fps_changed(LiVESSpinButton *spin, livespointer user_data) {
281 weed_plant_t *filter = (weed_plant_t *)user_data;
287 static void trans_in_out_pressed(
lives_rfx_t *rfx,
boolean in) {
288 weed_plant_t **in_params;
290 weed_plant_t *inst = (weed_plant_t *)rfx->
source;
292 weed_plant_t *tparam;
293 weed_plant_t *tparamtmpl;
301 if (weed_plant_has_leaf(inst, WEED_LEAF_IN_PARAMETERS)) {
302 nparams = weed_leaf_num_elements(inst, WEED_LEAF_IN_PARAMETERS);
303 if (trans < nparams)
break;
310 tparam = in_params[trans];
316 if (ptype == WEED_PARAM_INTEGER) {
317 if (in) weed_set_int_value(tparam, WEED_LEAF_VALUE, weed_get_int_value(tparamtmpl, WEED_LEAF_MIN, NULL));
318 else weed_set_int_value(tparam, WEED_LEAF_VALUE, weed_get_int_value(tparamtmpl, WEED_LEAF_MAX, NULL));
320 if (in) weed_set_double_value(tparam, WEED_LEAF_VALUE, weed_get_double_value(tparamtmpl, WEED_LEAF_MIN, NULL));
321 else weed_set_double_value(tparam, WEED_LEAF_VALUE, weed_get_double_value(tparamtmpl, WEED_LEAF_MAX, NULL));
333 static void transition_in_pressed(LiVESToggleButton *tbut, livespointer rfx) {
338 static void transition_out_pressed(LiVESToggleButton *tbut, livespointer rfx) {
343 static void after_transaudio_toggled(LiVESToggleButton *togglebutton, livespointer rfx) {
354 LiVESWidget *radiobutton_in;
355 LiVESWidget *radiobutton_out;
356 LiVESWidget *radiobutton_dummy;
357 LiVESWidget *hbox, *hbox2;
358 LiVESWidget *hseparator;
360 LiVESSList *radiobutton_group = NULL;
370 if (add_audio_check) {
373 LiVESWidget *checkbutton;
383 LIVES_BOX(hbox2), (tmp2 = lives_strdup(
384 _(
"If checked, audio from both layers is mixed relative to the transition parameter.\n"
385 "The setting is applied instantly to the entire transition."))));
390 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(checkbutton), LIVES_WIDGET_TOGGLED_SIGNAL,
391 LIVES_GUI_CALLBACK(after_transaudio_toggled),
394 after_transaudio_toggled(LIVES_TOGGLE_BUTTON(checkbutton), (livespointer)rfx);
403 &radiobutton_group, LIVES_BOX(hbox),
404 (tmp2 = (
_(
"Click to set the transition parameter to show only the rear frame"))));
409 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(radiobutton_out), LIVES_WIDGET_TOGGLED_SIGNAL,
410 LIVES_GUI_CALLBACK(transition_out_pressed),
414 &radiobutton_group, LIVES_BOX(hbox),
415 (tmp2 = (
_(
"Click to set the transition parameter to show only the front frame"))));
418 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(radiobutton_in), LIVES_WIDGET_TOGGLED_SIGNAL,
419 LIVES_GUI_CALLBACK(transition_in_pressed), (livespointer)rfx);
430 rfx->params[trans].widgets[
WIDGET_RB_IN] = radiobutton_in;
436 static boolean add_sizes(LiVESBox *vbox,
boolean add_fps,
boolean has_param,
lives_rfx_t *rfx) {
438 LiVESWidget *label, *hbox;
439 LiVESWidget *spinbuttonh = NULL, *spinbuttonw = NULL;
440 LiVESWidget *spinbuttonf;
444 weed_plant_t **ctmpls = weed_get_plantptr_array_counted(filter, WEED_LEAF_OUT_CHANNEL_TEMPLATES, &num_chans);
450 boolean chk_params = (vbox == NULL);
451 boolean added =
FALSE;
453 int def_width = 0, max_width, width_step;
454 int def_height = 0, max_height, height_step;
460 if (add_fps)
return TRUE;
473 else if (weed_plant_has_leaf(filter, WEED_LEAF_PREFERRED_FPS))
474 def_fps = weed_get_double_value(filter, WEED_LEAF_PREFERRED_FPS, NULL);
479 def_fps, 1.,
FPS_MAX, 1., 10., 3, LIVES_BOX(hbox), NULL);
481 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(spinbuttonf), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
482 LIVES_GUI_CALLBACK(gen_fps_changed), filter);
488 for (i = 0; i < num_chans; i++) {
496 if (weed_get_int_value(tmpl, WEED_LEAF_WIDTH, NULL))
continue;
497 if (weed_get_int_value(tmpl, WEED_LEAF_HEIGHT, NULL))
continue;
499 if (chk_params)
return TRUE;
504 cname = weed_get_string_value(tmpl, WEED_LEAF_NAME, NULL);
508 ltxt = (
_(
"New size (pixels)"));
520 max_width = weed_get_int_value(tmpl, WEED_LEAF_MAXWIDTH, NULL);
521 if (!max_width) max_width = INT_MAX;
522 if (def_width > max_width) def_width = max_width;
523 width_step = weed_get_int_value(tmpl, WEED_LEAF_HSTEP, NULL);
524 if (!width_step) width_step = 4;
527 width_step, 0, LIVES_BOX(hbox), NULL);
531 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(spinbuttonw), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
532 LIVES_GUI_CALLBACK(gen_width_changed), tmpl);
534 gen_width_changed(LIVES_SPIN_BUTTON(spinbuttonw), tmpl);
542 max_height = weed_get_int_value(tmpl, WEED_LEAF_MAXHEIGHT, NULL);
543 if (!max_height) max_height = INT_MAX;
544 if (def_height > max_height) def_height = max_height;
545 height_step = weed_get_int_value(tmpl, WEED_LEAF_VSTEP, NULL);
546 if (!height_step) height_step = 4;
549 height_step, 0, LIVES_BOX(hbox), NULL);
553 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(spinbuttonh), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
554 LIVES_GUI_CALLBACK(gen_height_changed), tmpl);
556 gen_height_changed(LIVES_SPIN_BUTTON(spinbuttonh), tmpl);
560 if (chk_params)
return TRUE;
570 }
else has_param =
TRUE;
576 static void add_gen_to(LiVESBox *vbox,
lives_rfx_t *rfx) {
578 LiVESSList *radiobutton_group = NULL;
580 LiVESWidget *radiobutton;
581 LiVESWidget *hseparator;
590 &radiobutton_group, LIVES_BOX(hbox),
591 (tmp2 = (
_(
"Generate frames to the clipboard"))));
598 &radiobutton_group, LIVES_BOX(hbox),
599 (tmp2 = (
_(
"Generate frames to a new clip"))));
612 static void xspinw_changed(LiVESSpinButton *spinbutton, livespointer user_data) {
617 static void xspinh_changed(LiVESSpinButton *spinbutton, livespointer user_data) {
622 static void xspinfr_changed(LiVESSpinButton *spinbutton, livespointer user_data) {
626 static void xspinfps_changed(LiVESSpinButton *spinbutton, livespointer user_data) {
631 static void add_genparams(LiVESWidget *vbox,
lives_rfx_t *rfx) {
633 LiVESWidget *sp_width, *sp_height, *sp_frames, *sp_fps;
645 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(sp_width), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
646 LIVES_GUI_CALLBACK(xspinw_changed), NULL);
647 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(sp_height), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
648 LIVES_GUI_CALLBACK(xspinh_changed), NULL);
649 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(sp_frames), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
650 LIVES_GUI_CALLBACK(xspinfr_changed), NULL);
651 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(sp_fps), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
652 LIVES_GUI_CALLBACK(xspinfps_changed), NULL);
666 start =
cfile->start;
689 LiVESWidget *top_dialog_vbox = NULL;
690 LiVESAccelGroup *fxw_accel_group;
691 LiVESList *retvals = NULL;
695 boolean no_process =
FALSE;
696 boolean is_defaults =
FALSE;
697 boolean add_reset_ok =
FALSE;
785 char *title, *defstr;
796 if (is_defaults) defstr = (
_(
"Defaults for "));
797 else defstr = lives_strdup(
"");
842 if (top_dialog_vbox) {
849 LIVES_STOCK_CANCEL, NULL, LIVES_RESPONSE_CANCEL);
851 LIVES_STOCK_OK, NULL, LIVES_RESPONSE_OK);
852 }
else add_reset_ok =
TRUE;
861 LIVES_STOCK_REVERT_TO_SAVED,
_(
"Reset"), LIVES_RESPONSE_RESET);
863 _(
"Set as default"), LIVES_RESPONSE_OK);
870 if (
fx_dialog[didx]->cancelbutton == NULL) {
872 _(
"_Close Window"), LIVES_RESPONSE_CANCEL);
875 LIVES_KEY_Escape, (LiVESXModifierType)0, (LiVESAccelFlags)0);
883 if (no_process && !is_defaults) {
886 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->okbutton), LIVES_WIDGET_CLICKED_SIGNAL,
888 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->cancelbutton), LIVES_WIDGET_CLICKED_SIGNAL,
890 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->dialog), LIVES_WIDGET_DELETE_EVENT,
893 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->cancelbutton), LIVES_WIDGET_CLICKED_SIGNAL,
894 LIVES_GUI_CALLBACK(on_paramwindow_button_clicked2), rfx);
896 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->okbutton), LIVES_WIDGET_CLICKED_SIGNAL,
897 LIVES_GUI_CALLBACK(on_paramwindow_button_clicked2), rfx);
900 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->okbutton), LIVES_WIDGET_CLICKED_SIGNAL,
903 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(
fx_dialog[didx]->resetbutton), LIVES_WIDGET_CLICKED_SIGNAL,
907 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->dialog), LIVES_WIDGET_DELETE_EVENT,
908 LIVES_GUI_CALLBACK(on_paramwindow_button_clicked2), rfx);
913 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->okbutton), LIVES_WIDGET_CLICKED_SIGNAL,
915 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->cancelbutton), LIVES_WIDGET_CLICKED_SIGNAL,
917 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->dialog), LIVES_WIDGET_DELETE_EVENT,
921 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(
fx_dialog[didx]->okbutton), LIVES_WIDGET_CLICKED_SIGNAL,
924 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(
fx_dialog[didx]->resetbutton), LIVES_WIDGET_CLICKED_SIGNAL,
927 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->cancelbutton), LIVES_WIDGET_CLICKED_SIGNAL,
929 lives_signal_sync_connect(LIVES_GUI_OBJECT(
fx_dialog[didx]->dialog), LIVES_WIDGET_DELETE_EVENT,
950 static void check_hidden_gui(weed_plant_t *inst,
lives_param_t *param,
int idx) {
951 weed_plant_t *wparam;
974 static int num_in_params_for_nth_instance(weed_plant_t *inst,
int idx) {
977 return weed_leaf_num_elements(inst, WEED_LEAF_IN_PARAMETERS);
981 static boolean fmt_match(
char *fmt_string) {
996 if (xlen < ylen) ylen = xlen;
998 for (
int j = 0; j < ylen; j++) {
1000 if (xfmt[j] != -1 && myfmt[j] != -1 && xfmt[j] != myfmt[j])
return FALSE;
1001 if ((xfmt[j] == -2 || myfmt[j] == -2) && xfmt[j] != myfmt[j])
return FALSE;
1018 LiVESWidget *param_vbox = NULL;
1019 LiVESWidget *top_hbox = NULL;
1020 LiVESWidget *hbox = NULL;
1021 LiVESWidget *last_label = NULL;
1022 LiVESWidget *layoutx = NULL;
1023 LiVESWidget *dummy_label = NULL;
1026 LiVESWidget *scrolledwindow;
1028 LiVESList *hints = NULL;
1029 LiVESList *onchange = NULL;
1030 LiVESList *layout = NULL;
1034 char label_text[256];
1038 char *format = NULL;
1045 boolean has_box =
FALSE;
1046 boolean internal =
FALSE;
1048 boolean has_param =
FALSE;
1049 boolean chk_params =
FALSE;
1050 boolean needs_sizes =
FALSE;
1051 boolean layout_mode =
FALSE;
1056 int poffset = 0, inum = 0;
1061 int c_fmt_strings = 0;
1067 char sepnpnum[1024];
1070 lives_snprintf(sepnpnum, 1024,
"s%s", rfx->
delim);
1071 sepnpnumlen = strlen(sepnpnum);
1086 else usrgrp_to_livesgrp[0] = NULL;
1127 has_param = add_sizes(LIVES_BOX(param_vbox),
FALSE,
FALSE, rfx);
1128 if (chk_params && has_param)
return TRUE;
1143 if (chk_params)
return TRUE;
1152 if (chk_params)
return TRUE;
1153 add_gen_to(LIVES_BOX(param_vbox), rfx);
1156 add_genparams(param_vbox, rfx);
1163 for (i = 0; i < lives_list_length(onchange); i++) {
1164 array = lives_strsplit((
char *)lives_list_nth_data(onchange, i), rfx->
delim, -1);
1165 if (strcmp(array[0],
"init")) {
1167 int which = atoi(array[0]);
1168 if (which >= 0 && which < rfx->num_params) {
1172 lives_strfreev(array);
1184 char *lstring = lives_strconcat(
"layout", rfx->
delim, NULL);
1185 char *sstring = lives_strconcat(
"special", rfx->
delim, NULL);
1186 char *istring = lives_strconcat(
"internal", rfx->
delim, NULL);
1187 for (list = hints; list; list = list->next) {
1188 char *line = (
char *)list->data;
1190 layout = lives_list_append(layout, lives_strdup(line + 7));
1192 layout = lives_list_append(layout, lives_strdup(line + 9));
1205 for (pass = 0; pass < 2; pass++) {
1214 if (chk_params) pass = 1;
1219 for (i = 0; list; i++) {
1220 line = (
char *)list->data;
1222 layout_mode =
FALSE;
1227 format = fmt_strings[i];
1228 if (pass == 1 && !chk_params && (i > 0 || list)) {
1229 if (fmt_match((
char *)fmt_strings[list == NULL ? i - 1 : i])) {
1240 }
else if (pass == 0)
break;
1244 array = lives_strsplit(line, rfx->
delim, num_tok);
1245 if (!*(array[num_tok - 1])) num_tok--;
1247 for (j = 0; j < num_tok; j++) {
1248 if (!strcmp(array[j],
"nextfilter")) {
1250 poffset += num_in_params_for_nth_instance((weed_plant_t *)rfx->
source, inum);
1255 if (!strcmp(array[j],
"hseparator")) {
1257 if (pass == 1 && !chk_params) {
1265 if (!strncmp(array[j],
"p", 1) && (pnum = atoi((
char *)(array[j] + 1))) >= 0
1266 && (pnum = pnum + poffset) < rfx->
num_params && !used[pnum]) {
1268 param = &rfx->
params[pnum];
1273 check_hidden_gui((weed_plant_t *)rfx->
source, param, pnum);
1302 if (
add_param_to_box(LIVES_BOX(hbox), rfx, pnum, (j == (num_tok - 1)) && !noslid)) noslid =
TRUE;
1304 }
else if (!strncmp(array[j],
"fill", 4)) {
1308 if (strlen(array[j]) == 4 || (length = atoi(array[j] + 4)) == 0) length = 1;
1335 for (k = 1; k < length; k++) {
1348 }
else if (*array[j] ==
'"') {
1352 if (has_box) last_label = dummy_label;
1371 ll = lives_snprintf(label_text, 256,
"%s", array[j] + 1);
1372 if (ll > 255) ll = 255;
1374 while (j < num_tok - 1 && label_text[ll - 1] !=
'"') {
1381 if (!last_label && !has_param) {
1382 if (j == num_tok - 1 || strncmp(array[j + 1], sepnpnum, sepnpnumlen)) keepsmall =
TRUE;
1386 if (label_text[ll - 1] ==
'"') label_text[ll - 1] = 0;
1389 else if (last_label) {
1402 if (!layout_mode) layoutx = NULL;
1403 lives_strfreev(array);
1415 if (used[i])
continue;
1418 layout_mode =
FALSE;
1422 format = fmt_strings[c_fmt_strings + i];
1423 if (pass == 1 && !chk_params) {
1424 if (fmt_match((
char *)fmt_strings[i + c_fmt_strings])) {
1435 }
else if (pass == 0)
break;
1438 check_hidden_gui((weed_plant_t *)rfx->
source, &rfx->
params[i], i);
1442 if (chk_params)
return TRUE;
1453 if (!layout_mode) layoutx = NULL;
1457 if (needs_sizes) has_param = add_sizes(chk_params ? NULL : LIVES_BOX(top_vbox),
TRUE, has_param, rfx);
1458 if (chk_params)
return has_param;
1470 float box_scale = 1.;
1490 LiVESWidget *checkbutton;
1491 LiVESWidget *radiobutton;
1492 LiVESWidget *spinbutton;
1493 LiVESWidget *scale = NULL;
1494 LiVESWidget *spinbutton_red;
1495 LiVESWidget *spinbutton_green;
1496 LiVESWidget *spinbutton_blue;
1497 LiVESWidget *cbutton;
1498 LiVESWidget *entry = NULL;
1502 LiVESWidget *textview = NULL;
1503 LiVESWidget *scrolledwindow;
1504 LiVESWidget *layout = (LiVESWidget *)lives_widget_object_get_data(LIVES_WIDGET_OBJECT(box),
1507 LiVESAdjustment *spinbutton_adj;
1509 LiVESTextBuffer *textbuffer = NULL;
1513 LiVESSList *rbgroup;
1524 boolean use_mnemonic;
1525 boolean was_num =
FALSE;
1527 boolean add_scalers =
TRUE;
1534 param = &rfx->
params[pnum];
1546 if (LIVES_IS_HBOX(LIVES_WIDGET(box))) {
1547 hbox = LIVES_WIDGET(box);
1559 switch (param->
type) {
1561 if (!param->
group) {
1564 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(checkbutton), LIVES_WIDGET_TOGGLED_SIGNAL,
1570 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(checkbutton),
PARAM_NUMBER_KEY, LIVES_INT_TO_POINTER(pnum));
1571 param->
widgets[0] = checkbutton;
1573 group = get_group(rfx, param);
1575 if (group) rbgroup = group->
rbgroup;
1576 else rbgroup = NULL;
1582 if (group == NULL) {
1585 rbgroup, param->
group);
1588 rbgroup, param->
group);
1592 group = get_group(rfx, param);
1603 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(radiobutton), LIVES_WIDGET_TOGGLED_SIGNAL,
1607 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(radiobutton),
PARAM_NUMBER_KEY, LIVES_INT_TO_POINTER(pnum));
1608 param->
widgets[0] = radiobutton;
1620 (LiVESBox *)hbox, param->
desc);
1624 (LiVESBox *)hbox, param->
desc);
1630 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(spinbutton), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
1634 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(spinbutton),
PARAM_NUMBER_KEY, LIVES_INT_TO_POINTER(pnum));
1635 param->
widgets[0] = spinbutton;
1637 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(param->
widgets[0]),
RFX_KEY, rfx);
1643 scale = giw_knob_new(LIVES_ADJUSTMENT(spinbutton_adj));
1644 giw_knob_set_wrap(GIW_KNOB(scale), param->
wrap);
1646 giw_knob_set_legends_digits(GIW_KNOB(scale), 0);
1657 param->
widgets[++wcount] = scale;
1671 if (!LIVES_IS_HBOX(LIVES_WIDGET(box)))
add_fill_to_box(LIVES_BOX(hbox));
1675 param->
widgets[++wcount] = scale;
1692 &spinbutton_blue, NULL);
1696 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(cbutton),
PARAM_NUMBER_KEY, LIVES_INT_TO_POINTER(pnum));
1699 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(spinbutton_red), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
1701 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(spinbutton_green), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
1703 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(spinbutton_blue), LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
1706 lives_signal_sync_connect_after(LIVES_GUI_OBJECT(cbutton), LIVES_WIDGET_COLOR_SET_SIGNAL,
1707 LIVES_GUI_CALLBACK(
on_pwcolsel), (livespointer)rfx);
1710 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(spinbutton_red),
PARAM_NUMBER_KEY, LIVES_INT_TO_POINTER(pnum));
1711 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(spinbutton_green),
PARAM_NUMBER_KEY, LIVES_INT_TO_POINTER(pnum));
1712 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(spinbutton_blue),
PARAM_NUMBER_KEY, LIVES_INT_TO_POINTER(pnum));
1714 param->
widgets[0] = spinbutton_red;
1715 param->
widgets[1] = spinbutton_green;
1716 param->
widgets[2] = spinbutton_blue;
1723 if (param->
max == 0.) txt = lives_strdup((
char *)param->
value);
1724 else txt = lives_strndup((
char *)param->
value, (
int)param->
max);
1750 lives_signal_sync_connect_after(LIVES_WIDGET_OBJECT(textbuffer), LIVES_WIDGET_CHANGED_SIGNAL,
1751 LIVES_GUI_CALLBACK(after_param_text_buffer_changed),
1752 (livespointer) rfx);
1773 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(textbuffer),
"textview", textview);
1780 (
int)param->
max, LIVES_BOX(hbox), param->
desc);
1783 lives_signal_sync_connect_after(LIVES_WIDGET_OBJECT(entry), LIVES_WIDGET_CHANGED_SIGNAL,
1791 lives_signal_sync_connect_after(LIVES_WIDGET_OBJECT(hbox), LIVES_WIDGET_SET_FOCUS_CHILD_SIGNAL,
1799 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(hbox),
TEXTWIDGET_KEY, (livespointer)param->
widgets[0]);
1800 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(param->
widgets[0]),
PARAM_NUMBER_KEY, LIVES_INT_TO_POINTER(pnum));
1801 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(param->
widgets[0]),
RFX_KEY, rfx);
1820 lives_signal_sync_connect_after(LIVES_WIDGET_OBJECT(combo), LIVES_WIDGET_CHANGED_SIGNAL,
1824 lives_widget_object_set_data(LIVES_WIDGET_OBJECT(combo),
PARAM_NUMBER_KEY, LIVES_INT_TO_POINTER(pnum));
1852 markup = g_markup_printf_escaped(
"<span weight=\"bold\" style=\"italic\"> %s </span>",
_(text));
1855 QString qs = QString(
"<span weight=\"bold\" style=\"italic\"> %s </span>").arg(
_(text));
1856 markup = strdup((
const char *)qs.toHtmlEscaped().constData());
1863 if (LIVES_IS_HBOX(LIVES_WIDGET(box)))
1877 u2l = lives_slist_append(u2l, (livespointer)wgroup);
1884 LiVESSList *list = u2l;
1885 for (; list; list = list->next) {
1887 if (group->
usr_number == usrgrp)
return group;
1894 weed_plant_t *wparam = NULL, *inst;
1910 inst = (weed_plant_t *)rfx->
source;
1914 check_hidden_gui(inst, param, i);
1918 if (!param->
widgets[j])
break;
1933 static void after_any_changed_1(
lives_rfx_t *rfx,
int param_number,
int index) {
1934 weed_plant_t *inst = (weed_plant_t *)rfx->
source;
1936 int numvals = weed_leaf_num_elements(wparam, WEED_LEAF_VALUE);
1940 if (index >= numvals) {
1943 numvals = index + 1;
1947 if (weed_plant_has_leaf(wparam, WEED_LEAF_IGNORE)) {
1948 ign = weed_get_boolean_array_counted(wparam, WEED_LEAF_IGNORE, &nvals);
1949 if (index >= 0 && index < nvals) {
1950 ign[index] = WEED_FALSE;
1951 weed_set_boolean_array(wparam, WEED_LEAF_IGNORE, nvals, ign);
1963 weed_plant_t *wparam = NULL, *gui, *inst = NULL;
1968 needs_update =
FALSE;
1971 if (--ireinit > 0) {
1985 if (weed_get_boolean_value(gui,
"host_hidden_backup", NULL) != weed_get_boolean_value(gui, WEED_LEAF_HIDDEN, NULL))
1986 needs_update =
TRUE;
1988 weed_leaf_delete(gui,
"host_hidden_backup");
1993 inst = (weed_plant_t *)rfx->
source;
2008 needs_update =
FALSE;
2036 int param_number = LIVES_POINTER_TO_INT(lives_widget_object_get_data(LIVES_WIDGET_OBJECT(togglebutton),
PARAM_NUMBER_KEY));
2037 LiVESList *retvals = NULL;
2038 weed_plant_t *inst = NULL;
2041 boolean needs_update =
FALSE;
2045 if (old_bool == new_bool)
return;
2059 inst = (weed_plant_t *)rfx->
source;
2062 int index = 0, numvals;
2065 int *valis = weed_get_boolean_array(wparam, WEED_LEAF_VALUE, NULL);
2071 after_any_changed_1(rfx, param_number, index);
2073 valis[index] = new_bool;
2075 numvals = weed_leaf_num_elements(wparam, WEED_LEAF_VALUE);
2077 weed_set_boolean_array(wparam, WEED_LEAF_VALUE, numvals, valis);
2080 if (copyto != -1) needs_update =
TRUE;
2094 retvals =
do_onchange(LIVES_WIDGET_OBJECT(togglebutton), rfx);
2096 needs_update =
TRUE;
2098 after_any_changed_2(rfx, param, needs_update);
2103 int param_number = LIVES_POINTER_TO_INT(lives_widget_object_get_data(LIVES_WIDGET_OBJECT(spinbutton),
PARAM_NUMBER_KEY));
2104 LiVESList *retvals = NULL;
2106 double new_double = 0., old_double = 0.;
2107 int new_int = 0, old_int = 0;
2108 boolean needs_update =
FALSE;
2113 if (param->
dp > 0) {
2116 if (old_double == new_double)
return;
2120 if (old_int == new_int)
return;
2139 if (param->
dp > 0) {
2148 weed_plant_t *inst = (weed_plant_t *)rfx->
source;
2151 int index = 0, numvals;
2160 if (param->
dp == 0) {
2161 if (new_int == (
int)param->
min)
2163 else if (new_int == (
int)param->
max)
2167 if (new_double == param->
min)
2169 else if (new_double == param->
max)
2180 after_any_changed_1(rfx, param_number, index);
2182 numvals = weed_leaf_num_elements(wparam, WEED_LEAF_VALUE);
2184 if (weed_leaf_seed_type(wparam, WEED_LEAF_VALUE) == WEED_SEED_DOUBLE) {
2185 valds = weed_get_double_array(wparam, WEED_LEAF_VALUE, NULL);
2186 if (param->
dp > 0) valds[index] = new_double;
2187 else valds[index] = (double)new_int;
2189 weed_set_double_array(wparam, WEED_LEAF_VALUE, numvals, valds);
2192 if (copyto != -1) needs_update =
TRUE;
2196 valis = weed_get_int_array(wparam, WEED_LEAF_VALUE, NULL);
2197 valis[index] = new_int;
2198 weed_set_int_array(wparam, WEED_LEAF_VALUE, numvals, valis);
2201 if (copyto != -1) needs_update =
TRUE;
2216 retvals =
do_onchange(LIVES_WIDGET_OBJECT(spinbutton), rfx);
2218 needs_update =
TRUE;
2221 after_any_changed_2(rfx, param, needs_update);
2226 weed_plant_t *ptmpl;
2227 weed_plant_t *param = NULL;
2229 int *maxs = NULL, *mins = NULL;
2230 int cols[4] = {c1, c2, c3, c4};
2232 int rmax, rmin, gmax, gmin, bmax, bmin;
2237 double *maxds = NULL, *minds = NULL;
2239 double rmaxd, rmind, gmaxd, gmind, bmaxd, bmind;
2243 ptmpl = weed_get_plantptr_value(param, WEED_LEAF_TEMPLATE, NULL);
2251 is_int = (weed_leaf_seed_type(ptmpl, WEED_LEAF_DEFAULT) == WEED_SEED_INT);
2252 cspace = weed_get_int_value(ptmpl, WEED_LEAF_COLORSPACE, NULL);
2256 case WEED_COLORSPACE_RGB:
2258 if (weed_leaf_num_elements(ptmpl, WEED_LEAF_MAX) == 3) {
2259 maxs = weed_get_int_array(ptmpl, WEED_LEAF_MAX, NULL);
2264 }
else rmax = gmax = bmax = weed_get_int_value(ptmpl, WEED_LEAF_MAX, NULL);
2265 if (weed_leaf_num_elements(ptmpl, WEED_LEAF_MIN) == 3) {
2266 mins = weed_get_int_array(ptmpl, WEED_LEAF_MIN, NULL);
2271 }
else rmin = gmin = bmin = weed_get_int_value(ptmpl, WEED_LEAF_MIN, NULL);
2273 cols[0] = rmin + (int)((
double)cols[0] / 255.*(double)(rmax - rmin));
2274 cols[1] = gmin + (int)((
double)cols[1] / 255.*(double)(gmax - gmin));
2275 cols[2] = bmin + (int)((
double)cols[2] / 255.*(double)(bmax - bmin));
2279 int index = 0, numvals;
2285 numvals = weed_leaf_num_elements(param, WEED_LEAF_VALUE);
2286 if (index * 3 >= numvals) {
2287 weed_plant_t *paramtmpl = weed_get_plantptr_value(param, WEED_LEAF_TEMPLATE, NULL);
2289 numvals = (index + 1) * 3;
2293 if (weed_plant_has_leaf(param, WEED_LEAF_IGNORE)) {
2294 int nvals = weed_leaf_num_elements(param, WEED_LEAF_IGNORE);
2295 if (index >= 0 && index < nvals) {
2296 int *ign = weed_get_boolean_array(param, WEED_LEAF_IGNORE, NULL);
2297 ign[index] = WEED_FALSE;
2298 weed_set_boolean_array(param, WEED_LEAF_IGNORE, nvals, ign);
2304 valis = weed_get_int_array(param, WEED_LEAF_VALUE, NULL);
2305 valis[index * 3] = cols[0];
2306 valis[index * 3 + 1] = cols[1];
2307 valis[index * 3 + 2] = cols[2];
2308 weed_set_int_array(param, WEED_LEAF_VALUE, numvals, valis);
2314 if (weed_leaf_num_elements(ptmpl, WEED_LEAF_MAX) == 3) {
2315 maxds = weed_get_double_array(ptmpl, WEED_LEAF_MAX, NULL);
2320 }
else rmaxd = gmaxd = bmaxd = weed_get_double_value(ptmpl, WEED_LEAF_MAX, NULL);
2321 if (weed_leaf_num_elements(ptmpl, WEED_LEAF_MIN) == 3) {
2322 minds = weed_get_double_array(ptmpl, WEED_LEAF_MIN, NULL);
2327 }
else rmind = gmind = bmind = weed_get_double_value(ptmpl, WEED_LEAF_MIN, NULL);
2328 colds[0] = rmind + (double)cols[0] / 255.*(rmaxd - rmind);
2329 colds[1] = gmind + (double)cols[1] / 255.*(gmaxd - gmind);
2330 colds[2] = bmind + (double)cols[2] / 255.*(bmaxd - bmind);
2334 int index = 0, numvals;
2340 numvals = weed_leaf_num_elements(param, WEED_LEAF_VALUE);
2341 if (index * 3 >= numvals) {
2342 weed_plant_t *paramtmpl = weed_get_plantptr_value(param, WEED_LEAF_TEMPLATE, NULL);
2344 numvals = (index + 1) * 3;
2348 if (weed_plant_has_leaf(param, WEED_LEAF_IGNORE)) {
2349 int nvals = weed_leaf_num_elements(param, WEED_LEAF_IGNORE);
2350 if (index >= 0 && index < nvals) {
2351 int *ign = weed_get_boolean_array(param, WEED_LEAF_IGNORE, NULL);
2352 ign[index] = WEED_FALSE;
2353 weed_set_boolean_array(param, WEED_LEAF_IGNORE, nvals, ign);
2359 valds = weed_get_double_array(param, WEED_LEAF_VALUE, NULL);
2360 valds[index * 3] = colds[0];
2361 valds[index * 3 + 1] = colds[1];
2362 valds[index * 3 + 2] = colds[2];
2363 weed_set_double_array(param, WEED_LEAF_VALUE, numvals, valds);
2373 LiVESList *retvals = NULL;
2375 int param_number = LIVES_POINTER_TO_INT(lives_widget_object_get_data(LIVES_WIDGET_OBJECT(spinbutton),
PARAM_NUMBER_KEY));
2377 boolean needs_update =
FALSE;
2383 if (old_value.
red == new_red)
return;
2407 weed_plant_t *inst = (weed_plant_t *)rfx->
source;
2414 if (copyto != -1) needs_update =
TRUE;
2425 if (new_red != old_value.
red && param->
onchange) {
2427 retvals =
do_onchange(LIVES_WIDGET_OBJECT(spinbutton), rfx);
2429 needs_update =
TRUE;
2431 after_any_changed_2(rfx, param, needs_update);
2436 LiVESList *retvals = NULL;
2440 boolean needs_update =
FALSE;
2441 int param_number = LIVES_POINTER_TO_INT(lives_widget_object_get_data(LIVES_WIDGET_OBJECT(spinbutton),
PARAM_NUMBER_KEY));
2446 if (old_value.
green == new_green)
return;
2469 weed_plant_t *inst = (weed_plant_t *)rfx->
source;
2476 if (copyto != -1) needs_update =
TRUE;
2489 retvals =
do_onchange(LIVES_WIDGET_OBJECT(spinbutton), rfx);
2491 needs_update =
TRUE;
2493 after_any_changed_2(rfx, param, needs_update);
2498 LiVESList *retvals = NULL;
2502 boolean needs_update =
FALSE;
2503 int param_number = LIVES_POINTER_TO_INT(lives_widget_object_get_data(LIVES_WIDGET_OBJECT(spinbutton),
PARAM_NUMBER_KEY));
2508 if (old_value.
blue == new_blue)
return;
2530 weed_plant_t *inst = (weed_plant_t *)rfx->
source;
2537 if (copyto != -1) needs_update =
TRUE;
2550 retvals =
do_onchange(LIVES_WIDGET_OBJECT(spinbutton), rfx);
2552 needs_update =
TRUE;
2554 after_any_changed_2(rfx, param, needs_update);
2560 int param_number = LIVES_POINTER_TO_INT(lives_widget_object_get_data(LIVES_WIDGET_OBJECT(spinbutton),
PARAM_NUMBER_KEY));
2561 LiVESList *retvals = NULL;
2566 boolean needs_update =
FALSE;
2598 retvals =
do_onchange(LIVES_WIDGET_OBJECT(spinbutton), rfx);
2600 needs_update =
TRUE;
2602 after_any_changed_2(rfx, param, needs_update);
2611 LiVESWidget *textwidget;
2613 if (rfx == NULL)
return FALSE;
2637 weed_plant_t *inst = NULL, *wparam = NULL;
2638 LiVESList *retvals = NULL;
2641 const char *new_text;
2643 boolean needs_update =
FALSE;
2646 if (rfx == NULL || rfx->
params == NULL || textwidget == NULL)
return;
2649 param_number = LIVES_POINTER_TO_INT(lives_widget_object_get_data(LIVES_WIDGET_OBJECT(textwidget),
PARAM_NUMBER_KEY));
2650 param = &rfx->
params[param_number];
2651 old_text = (
char *)param->
value;
2653 if (LIVES_IS_TEXT_VIEW(textwidget)) {
2668 param->
value = lives_strdup(new_text);
2674 inst = (weed_plant_t *)rfx->
source;
2677 int index = 0, numvals, key = -1;
2684 after_any_changed_1(rfx, param_number, index);
2686 numvals = weed_leaf_num_elements(wparam, WEED_LEAF_VALUE);
2688 valss = weed_get_string_array(wparam, WEED_LEAF_VALUE, NULL);
2689 valss[index] = lives_strdup((
char *)param->
value);
2693 weed_set_string_array(wparam, WEED_LEAF_VALUE, numvals, valss);
2696 if (copyto != -1) needs_update =
TRUE;
2698 for (
int i = 0; i < numvals; i++)
lives_free(valss[i]);
2712 retvals =
do_onchange(LIVES_WIDGET_OBJECT(textwidget), rfx);
2714 needs_update =
TRUE;
2716 after_any_changed_2(rfx, param, needs_update);
2720 static void after_param_text_buffer_changed(LiVESTextBuffer * textbuffer,
lives_rfx_t *rfx) {
2721 LiVESWidget *textview = (LiVESWidget *)lives_widget_object_get_data(LIVES_WIDGET_OBJECT(textbuffer),
"textview");
2727 LiVESList *retvals = NULL;
2728 int param_number = LIVES_POINTER_TO_INT(lives_widget_object_get_data(LIVES_WIDGET_OBJECT(entry),
PARAM_NUMBER_KEY));
2729 LiVESCombo *combo = (LiVESCombo *)(rfx->
params[param_number].
widgets[0]);
2734 boolean needs_update =
FALSE;
2737 if (new_index == -1)
return;
2738 if (new_index == old_index)
return;
2752 weed_plant_t *inst = (weed_plant_t *)rfx->
source;
2756 int index = 0, numvals;
2764 after_any_changed_1(rfx, param_number, index);
2766 valis = weed_get_int_array(wparam, WEED_LEAF_VALUE, NULL);
2767 valis[index] = new_index;
2768 numvals = weed_leaf_num_elements(wparam, WEED_LEAF_VALUE);
2771 weed_set_int_array(wparam, WEED_LEAF_VALUE, numvals, valis);
2774 if (copyto != -1) needs_update =
TRUE;
2787 if (old_index != new_index && param->
onchange) {
2789 retvals =
do_onchange(LIVES_WIDGET_OBJECT(combo), rfx);
2791 needs_update =
TRUE;
2793 after_any_changed_2(rfx, param, needs_update);
2852 char *new_return = lives_strdup(
"");
2853 char *old_return = new_return;
2854 char *return_pattern;
2855 char *tmp, *mysubst, *mysubst2;
2863 if (!with_min_max) {
2869 old_return = new_return;
2875 mysubst2 =
subst(mysubst,
"\"",
"\\\\\\\"");
2877 mysubst =
subst(mysubst2,
"`",
"\\`");
2879 mysubst2 =
subst(mysubst,
"'",
"\\`");
2885 old_return = new_return;
2891 old_return = new_return;
2900 old_return = new_return;
2903 old_return = new_return;
2911 old_return = new_return;
2914 old_return = new_return;
2919 old_return = new_return;
2930 int start =
cfile->start, end =
cfile->end, ttl;
2940 end = cb_frames * ttl;
2942 start =
cfile->end - end + 1;
2945 start =
cfile->start;
2953 new_return = lives_strdup(old_return);
2967 char *ret = lives_strdup(
""), *ret2;
2970 boolean lastword =
FALSE;
2974 word = L2U8((
char *)lives_list_nth_data(plist, start));
2976 if (!word || !*word || word[0] !=
'\"') {
2983 for (i = start; i < lives_list_length(plist); i++) {
2986 if ((word[wl - 1] ==
'\"') && (wl == 1 || word[wl - 2] !=
'\\')) {
2992 ret2 = lives_strconcat(ret, (tmp =
subst(word,
"\\\"",
"\"")),
" ", NULL);
2997 if (i == start) word--;
3000 if (lastword)
break;
3002 if (i < lives_list_length(plist) - 1) word = L2U8((
char *)lives_list_nth_data(plist, i + 1));
3022 if (plist == NULL)
return;
3032 LiVESList *plist = NULL;
3034 char *tmp, *tmp2, *tmp3;
3038 if (argc == 0)
return plist;
3040 for (i = 0; i <= argc && argv[i]; i++) {
3043 plist = lives_list_append(plist, tmp);
3047 plist = lives_list_append(plist, lives_strdup(argv[i]));
3068 int red, green, blue;
3070 int maxlen = lives_list_length(plist) - 1;
3072 if (
ABS(pnum) > maxlen)
return 0;
3074 switch (param->
type) {
3080 tmp = lives_strdup((
char *)lives_list_nth_data(plist, pnum++));
3082 if (param->
widgets[0] && LIVES_IS_TOGGLE_BUTTON(param->
widgets[0])) {
3086 if (upd && param->
widgets[0] && LIVES_IS_TOGGLE_BUTTON(param->
widgets[0])) {
3095 if (with_min_max) pnum += 2;
3100 tmp = lives_strdup((
char *)lives_list_nth_data(plist, pnum++));
3101 double_val = lives_strtod(tmp, NULL);
3104 if (
ABS(pnum) > maxlen)
return 1;
3105 tmp = lives_strdup((
char *)lives_list_nth_data(plist, pnum++));
3106 param->
min = lives_strtod(tmp, NULL);
3108 if (
ABS(pnum) > maxlen)
return 2;
3109 tmp = lives_strdup((
char *)lives_list_nth_data(plist, pnum++));
3110 param->
max = lives_strtod(tmp, NULL);
3112 if (double_val < param->min) double_val = param->
min;
3113 if (double_val > param->
max) double_val = param->
max;
3116 if (param->
widgets[0] && LIVES_IS_SPIN_BUTTON(param->
widgets[0])) {
3126 if (upd && param->
widgets[0] && LIVES_IS_SPIN_BUTTON(param->
widgets[0])) {
3132 int int_min, int_max;
3133 tmp = lives_strdup((
char *)lives_list_nth_data(plist, pnum++));
3134 int_value = atoi(tmp);
3137 int_value = (int)((
double)int_value / param->
step_size + .5) * (int)param->
step_size;
3138 int_min = (
int)param->
min;
3139 int_max = (int)param->
max;
3140 if (int_value < int_min) int_value = int_min;
3141 if (int_value > int_max) int_value = int_max;
3144 if (
ABS(pnum) > maxlen)
return 1;
3145 tmp = lives_strdup((
char *)lives_list_nth_data(plist, pnum++));
3146 int_min = atoi(tmp);
3148 if (
ABS(pnum) > maxlen)
return 2;
3149 tmp = lives_strdup((
char *)lives_list_nth_data(plist, pnum++));
3150 int_max = atoi(tmp);
3152 if (int_value < int_min) int_value = int_min;
3153 if (int_value > int_max) int_value = int_max;
3154 param->
min = (double)int_min;
3155 param->
max = (double)int_max;
3158 if (param->
widgets[0] && LIVES_IS_SPIN_BUTTON(param->
widgets[0])) {
3168 if (upd && param->
widgets[0] && LIVES_IS_SPIN_BUTTON(param->
widgets[0])) {
3175 tmp = lives_strdup((
char *)lives_list_nth_data(plist, pnum++));
3178 if (
ABS(pnum) > maxlen)
return 1;
3179 tmp = lives_strdup((
char *)lives_list_nth_data(plist, pnum++));
3182 if (
ABS(pnum) > maxlen)
return 2;
3183 tmp = lives_strdup((
char *)lives_list_nth_data(plist, pnum++));
3188 if (param->
widgets[0] && LIVES_IS_SPIN_BUTTON(param->
widgets[0])) {
3191 if (param->
widgets[1] && LIVES_IS_SPIN_BUTTON(param->
widgets[1])) {
3194 if (param->
widgets[2] && LIVES_IS_SPIN_BUTTON(param->
widgets[2])) {
3198 if (upd && param->
widgets[0] && LIVES_IS_SPIN_BUTTON(param->
widgets[0])
3200 && param->
widgets[2] && LIVES_IS_SPIN_BUTTON(param->
widgets[2])) {
3216 if (LIVES_IS_TEXT_VIEW(param->
widgets[0])) {
3225 param->
def = (
void *)lives_strdup(strval);
3230 if (upd && param->
widgets[0] && (LIVES_IS_TEXT_VIEW(param->
widgets[0])
3231 || LIVES_IS_ENTRY(param->
widgets[0]))) {
3233 if (LIVES_IS_TEXT_VIEW(param->
widgets[0])) {
3239 param->
value = strval;
3244 tmp = lives_strdup((
char *)lives_list_nth_data(plist, pnum++));
3245 int_value = atoi(tmp);
3248 if (upd && param->
widgets[0] && LIVES_IS_COMBO(param->
widgets[0]) && int_value < lives_list_length(param->
list))
3251 if (upd && param->
widgets[0] && LIVES_IS_COMBO(param->
widgets[0])) {
3268 int which = LIVES_POINTER_TO_INT(lives_widget_object_get_data(
object,
PARAM_NUMBER_KEY));
3269 int width = 0, height = 0;
3271 const char *handle =
"";
3296 width =
cfile->hsize;
3297 height =
cfile->vsize;
3298 handle =
cfile->handle;
3327 if (which <= 0 && mainw->
error) {
3339 LiVESWidgetColor selected;
3341 int pnum = LIVES_POINTER_TO_INT(lives_widget_object_get_data(LIVES_WIDGET_OBJECT(button),
PARAM_NUMBER_KEY));
3348 r = (int)((
double)(selected.red + LIVES_WIDGET_COLOR_SCALE_255(0.5)) / (
double)LIVES_WIDGET_COLOR_SCALE_255(1.));
3349 g = (int)((
double)(selected.green + LIVES_WIDGET_COLOR_SCALE_255(0.5)) / (
double)LIVES_WIDGET_COLOR_SCALE_255(1.));
3350 b = (int)((
double)(selected.blue + LIVES_WIDGET_COLOR_SCALE_255(0.5)) / (
double)LIVES_WIDGET_COLOR_SCALE_255(1.));
3365 weed_plant_t **in_params, *in_param;
3366 weed_plant_t *inst = (weed_plant_t *)rfx->
source;
3367 weed_plant_t *paramtmpl;
3369 int *colsi, *colsis, *valis;
3370 int *maxis = NULL, *minis = NULL;
3372 double *colsd, *colsds, *valds;
3373 double *maxds = NULL, *minds = NULL;
3375 double red_maxd, green_maxd, blue_maxd;
3376 double red_mind, green_mind, blue_mind;
3377 double vald, mind, maxd;
3381 char *vals, *pattern;
3388 int vali, mini, maxi;
3390 int red_max, green_max, blue_max;
3391 int red_min, green_min, blue_min;
3401 if (num_params == 0)
return;
3405 for (i = 0; i < num_params; i++) {
3408 in_param = in_params[i];
3423 numvals = weed_leaf_num_elements(in_param, WEED_LEAF_VALUE);
3425 if (param_type != WEED_PARAM_COLOR && index >= numvals) {
3427 numvals = index + 1;
3430 switch (param_type) {
3431 case WEED_PARAM_INTEGER:
3432 valis = weed_get_int_array(in_param, WEED_LEAF_VALUE, &
error);
3433 vali = valis[index];
3436 mini = weed_get_int_value(paramtmpl, WEED_LEAF_MIN, &
error);
3437 maxi = weed_get_int_value(paramtmpl, WEED_LEAF_MAX, &
error);
3446 case WEED_PARAM_FLOAT:
3447 valds = weed_get_double_array(in_param, WEED_LEAF_VALUE, &
error);
3448 vald = valds[index];
3451 mind = weed_get_double_value(paramtmpl, WEED_LEAF_MIN, &
error);
3452 maxd = weed_get_double_value(paramtmpl, WEED_LEAF_MAX, &
error);
3454 pattern = lives_strdup(
"%.2f");
3456 if (weed_plant_has_leaf(paramtmpl, WEED_LEAF_GUI)) {
3457 weed_plant_t *gui = weed_get_plantptr_value(paramtmpl, WEED_LEAF_GUI, &
error);
3458 if (weed_plant_has_leaf(gui, WEED_LEAF_DECIMALS)) {
3459 int dp = weed_get_int_value(gui, WEED_LEAF_DECIMALS, &
error);
3475 case WEED_PARAM_SWITCH:
3476 valis = weed_get_boolean_array(in_param, WEED_LEAF_VALUE, &
error);
3477 vali = valis[index];
3485 case WEED_PARAM_TEXT:
3486 valss = weed_get_string_array(in_param, WEED_LEAF_VALUE, &
error);
3487 vals = valss[index];
3492 for (j = 0; j < numvals; j++) {
3499 case WEED_PARAM_COLOR:
3500 cspace = weed_get_int_value(paramtmpl, WEED_LEAF_COLORSPACE, &
error);
3502 case WEED_COLORSPACE_RGB:
3503 numvals = weed_leaf_num_elements(in_param, WEED_LEAF_VALUE);
3506 if (weed_leaf_seed_type(paramtmpl, WEED_LEAF_DEFAULT) == WEED_SEED_INT) {
3507 colsis = weed_get_int_array(in_param, WEED_LEAF_VALUE, &
error);
3508 colsi = &colsis[3 * index];
3510 if (weed_leaf_num_elements(paramtmpl, WEED_LEAF_MAX) == 1) {
3511 red_max = green_max = blue_max = weed_get_int_value(paramtmpl, WEED_LEAF_MAX, &
error);
3513 maxis = weed_get_int_array(paramtmpl, WEED_LEAF_MAX, &
error);
3515 green_max = maxis[1];
3516 blue_max = maxis[2];
3518 if (weed_leaf_num_elements(paramtmpl, WEED_LEAF_MIN) == 1) {
3519 red_min = green_min = blue_min = weed_get_int_value(paramtmpl, WEED_LEAF_MIN, &
error);
3521 minis = weed_get_int_array(paramtmpl, WEED_LEAF_MIN, &
error);
3523 green_min = minis[1];
3524 blue_min = minis[2];
3527 colsi[0] = (int)((
double)(colsi[0] - red_min) / (
double)(red_max - red_min) * 255. + .5);
3528 colsi[1] = (int)((
double)(colsi[1] - green_min) / (
double)(green_max - green_min) * 255. + .5);
3529 colsi[2] = (int)((
double)(colsi[2] - blue_min) / (
double)(blue_max - blue_min) * 255. + .5);
3531 if (colsi[0] < red_min) colsi[0] = red_min;
3532 if (colsi[1] < green_min) colsi[1] = green_min;
3533 if (colsi[2] < blue_min) colsi[2] = blue_min;
3534 if (colsi[0] > red_max) colsi[0] = red_max;
3535 if (colsi[1] > green_max) colsi[1] = green_max;
3536 if (colsi[2] > blue_max) colsi[2] = blue_max;
3549 colsds = weed_get_double_array(in_param, WEED_LEAF_VALUE, &
error);
3550 colsd = &colsds[3 * index];
3551 if (weed_leaf_num_elements(paramtmpl, WEED_LEAF_MAX) == 1) {
3552 red_maxd = green_maxd = blue_maxd = weed_get_double_value(paramtmpl, WEED_LEAF_MAX, &
error);
3554 maxds = weed_get_double_array(paramtmpl, WEED_LEAF_MAX, &
error);
3555 red_maxd = maxds[0];
3556 green_maxd = maxds[1];
3557 blue_maxd = maxds[2];
3559 if (weed_leaf_num_elements(paramtmpl, WEED_LEAF_MIN) == 1) {
3560 red_mind = green_mind = blue_mind = weed_get_double_value(paramtmpl, WEED_LEAF_MIN, &
error);
3562 minds = weed_get_double_array(paramtmpl, WEED_LEAF_MIN, &
error);
3563 red_mind = minds[0];
3564 green_mind = minds[1];
3565 blue_mind = minds[2];
3567 colsd[0] = (colsd[0] - red_mind) / (red_maxd - red_mind) * 255. + .5;
3568 colsd[1] = (colsd[1] - green_mind) / (green_maxd - green_mind) * 255. + .5;
3569 colsd[2] = (colsd[2] - blue_mind) / (blue_maxd - blue_mind) * 255. + .5;
3571 if (colsd[0] < red_mind) colsd[0] = red_mind;
3572 if (colsd[1] < green_mind) colsd[1] = green_mind;
3573 if (colsd[2] < blue_mind) colsd[2] = blue_mind;
3574 if (colsd[0] > red_maxd) colsd[0] = red_maxd;
3575 if (colsd[1] > green_maxd) colsd[1] = green_maxd;
3576 if (colsd[2] > blue_maxd) colsd[2] = blue_maxd;