16static double xstart, ystart;
17static double xcurrent, ycurrent;
18static double xinit, yinit;
19static volatile boolean b1_held;
21static volatile boolean noupdate =
FALSE;
23static LiVESWidget *fbord_eventbox;
26static double calc_fd_scale(
int width,
int height) {
61static void start_preview(LiVESButton *button,
lives_rfx_t *rfx) {
84 if (
cfile->start == 0) {
153 framedraw->
rfx = rfx;
156 LIVES_WIDGET_VALUE_CHANGED_SIGNAL,
157 LIVES_GUI_CALLBACK(after_framedraw_frame_spinbutton_changed), framedraw);
159 LIVES_GUI_CALLBACK(framedraw_redraw_cb), framedraw);
161 LIVES_GUI_CALLBACK(framedraw_redraw_cb), framedraw);
177 lives_signal_sync_connect(LIVES_GUI_OBJECT(
mainw->
framedraw), LIVES_WIDGET_SCROLL_EVENT,
201 LiVESWidget *hbox_rst;
219static void redraw_framedraw_image(
weed_layer_t *layer) {
225 lives_painter_t *cr, *cr2;
226 LiVESWidget *fd_widget;
228 int fd_width, fd_height;
229 int width, height, cx, cy;
238 if (!LIVES_IS_WIDGET(fd_widget))
return;
243 width =
cfile->hsize;
244 height =
cfile->vsize;
257 cx = (fd_width - width) / 2;
258 cy = (fd_height - height) / 2;
270static boolean expose_fd_event(LiVESWidget *widget, lives_painter_t *cr, livespointer user_data) {
271 if (!LIVES_IS_WIDGET(widget))
return TRUE;
279void widget_add_framedraw(LiVESVBox *box,
int start,
int end,
boolean add_preview_button,
int width,
int height,
285 LiVESAdjustment *spinbutton_adj;
287 LiVESWidget *vseparator;
291 LiVESWidget *cbutton;
309 fd_scale = calc_fd_scale(width, height);
344 LIVES_BUTTON_PRESS_MASK | LIVES_ENTER_NOTIFY_MASK | LIVES_LEAVE_NOTIFY_MASK);
371 FALSE, &opcol, NULL, NULL, NULL, NULL);
378 start, start, end, 1., 10., 0, LIVES_BOX(hbox), NULL);
408 if (add_preview_button) {
435 LiVESWidget *fd_widget;
437 double xstartf, ystartf, xendf, yendf;
446 if (noupdate)
return NULL;
450 if (!LIVES_IS_WIDGET(fd_widget))
return NULL;
455 if (fd_width < 4 || fd_height < 4)
return NULL;
457 width =
cfile->hsize;
458 height =
cfile->vsize;
476 weed_plant_free(layer);
504 switch (framedraw->
type) {
509 xstartf = xstartf / (double)
cfile->hsize * (
double)width;
512 xstartf = xstartf * (double)width;
517 xendf = xendf / (double)
cfile->hsize * (
double)width;
520 xendf = xendf * (double)width;
525 ystartf = ystartf / (double)
cfile->vsize * (
double)height;
528 ystartf = ystartf * (double)height;
533 yendf = yendf / (double)
cfile->vsize * (
double)height;
536 yendf = yendf * (double)height;
550 LiVESWidgetColor maskcol;
556 LIVES_WIDGET_COLOR_SCALE(maskcol.blue), opacity);
567 xstartf = xstartf / (double)
cfile->hsize * (
double)width;
570 xstartf *= (double)width;
575 ystartf = ystartf / (double)
cfile->vsize * (
double)height;
578 ystartf *= (double)height;
582 xstartf = xcurrent * (double)width;
583 ystartf = ycurrent * (double)height;
587 if (scale == 0.)
break;
593 / (
double)
cfile->hsize;
598 / (
double)
cfile->vsize;
603 if (xpos - xstartf / scale < 0.) xstartf = xpos * scale;
604 else if (xpos + xstartf / scale > 1.) xstartf = 1. - (1. - xpos) * scale;
605 if (ypos - ystartf / scale < 0.) ystartf = ypos * scale;
606 else if (ypos + ystartf / scale > 1.) ystartf = 1. - (1. - ypos) * scale;
607 xstartf *= (double)width;
608 ystartf *= (double)height;
674 FILE *infofile = NULL;
707 weed_plant_free(
cfile->pumper);
708 cfile->pumper = NULL;
730 if (infofile) fclose(infofile);
734 weed_plant_free(
cfile->pumper);
735 cfile->pumper = NULL;
748 }
while (retval == LIVES_RESPONSE_RETRY);
755 tot_frames =
cfile->end;
759 char **array = lives_strsplit(
mainw->
msg,
"|", numtok);
761 cfile->hsize = atoi(array[1]);
762 cfile->vsize = atoi(array[2]);
763 cfile->fps =
cfile->pb_fps = strtod(array[3], NULL);
765 tot_frames = atoi(array[4]);
766 lives_strfreev(array);
783 cfile->frames = tot_frames;
804 weed_plant_free(layer);
826 if (!framedraw)
return FALSE;
830 switch (framedraw->
type) {
856 LiVESWidget *fd_widget;
857 if (!framedraw)
return FALSE;
862 if (!LIVES_IS_WIDGET(fd_widget))
return FALSE;
878 int width =
cfile->hsize;
879 int height =
cfile->vsize;
881 int xstarti, ystarti;
885 if (!framedraw)
return FALSE;
893 if (event->button != 1)
return FALSE;
898 widget, &xstarti, &ystarti);
916 xstart = (double)xstarti - (
double)(fd_width - width) / 2.;
917 ystart = (double)ystarti - (
double)(fd_height - height) / 2.;
919 xstart /= (double)(width - 1);
920 ystart /= (double)(height - 1);
922 xend = xcurrent = xstart;
923 yend = ycurrent = ystart;
927 switch (framedraw->
type) {
936 / (
double)
cfile->hsize;
941 / (
double)
cfile->vsize;
953 (
int)(xstart * (
double)
cfile->hsize + .5));
958 (
int)(ystart * (
double)
cfile->vsize + .5));
991 int xcurrenti, ycurrenti;
993 int fd_width, fd_height, width, height;
995 if (noupdate)
return FALSE;
997 if (!b1_held)
return FALSE;
1000 if (!framedraw)
return FALSE;
1004 widget, &xcurrenti, &ycurrenti);
1007 width =
cfile->hsize;
1008 height =
cfile->vsize;
1015 xcurrent = (double)xcurrenti - (fd_width - width) / 2.;
1016 ycurrent = (double)ycurrenti - (fd_height - height) / 2.;
1018 xcurrent /= (double)(width - 1);
1019 ycurrent /= (double)(height - 1);
1023 switch (framedraw->
type) {
1026 double xscale, yscale;
1028 xscale = xcurrent - xstart;
1029 yscale = ycurrent - ystart;
1036 (
int)(xscale * (
double)
cfile->hsize + .5));
1043 (
int)(-xscale * (
double)
cfile->hsize - .5));
1045 (
int)(xcurrent * (
double)
cfile->hsize + .5));
1054 (
int)(yscale * (
double)
cfile->vsize + .5));
1061 (
int)(-yscale * (
double)
cfile->vsize - .5));
1063 (
int)(ycurrent * (
double)
cfile->vsize + .5));
1071 if (xcurrent > xstart) {
1076 (
int)(xcurrent * (
double)
cfile->hsize + .5));
1083 (
int)(xstart * (
double)
cfile->hsize + .5));
1085 (
int)(xcurrent * (
double)
cfile->hsize + .5));
1089 if (ycurrent > ystart) {
1094 (
int)(ycurrent * (
double)
cfile->vsize + .5));
1101 (
int)(ystart * (
double)
cfile->vsize + .5));
1103 (
int)(ycurrent * (
double)
cfile->vsize + .5));
1111 double offs_x, offs_y;
1113 if (scale == 0.)
break;
1114 offs_x = (xstart - xcurrent) / scale;
1115 offs_y = (ystart - ycurrent) / scale;
1117 if (xinit + offs_x < .5 / scale) offs_x = .5 / scale - xinit;
1118 if (xinit + offs_x > 1. - .5 / scale) offs_x = 1. - .5 / scale - xinit;
1119 if (yinit + offs_y < .5 / scale) offs_y = .5 / scale - yinit;
1120 if (yinit + offs_y > 1. - .5 / scale) offs_y = 1. - .5 / scale - yinit;
1126 * (
double)
cfile->hsize + .5));
1131 * (
double)
cfile->vsize + .5));
1139#if !GTK_CHECK_VERSION(3, 0, 0)
1158 int xcurrenti, ycurrenti;
1159 int fd_width, fd_height, width, height;
1161 if (event->button != 1 || !b1_held)
return FALSE;
1166 if (!framedraw)
return FALSE;
1170 widget, &xcurrenti, &ycurrenti);
1173 width =
cfile->hsize;
1174 height =
cfile->vsize;
1181 xcurrent = (double)xcurrenti - (fd_width - width) / 2.;
1182 ycurrent = (double)ycurrenti - (fd_height - height) / 2.;
1184 xcurrent /= (double)(width - 1);
1185 ycurrent /= (double)(height - 1);
1187 switch (framedraw->
type) {
1198 double offs_x, offs_y, scale, xend, yend;
1199 if (noupdate)
break;
1202 if (scale == 0.)
break;
1208 / (
double)
cfile->hsize;
1213 / (
double)
cfile->vsize;
1215 if (xend == xinit && yend == yinit && xcurrent == xstart && ycurrent == ystart) {
1221 if (xend - xstart / scale < 0.) xstart = xend * scale;
1222 else if (xend + xstart / scale > 1.) xstart = 1. - (1. - xend) * scale;
1223 if (yend - ystart / scale < 0.) ystart = yend * scale;
1224 else if (yend + ystart / scale > 1.) ystart = 1. - (1. - yend) * scale;
1226 offs_x = (xcurrent - xstart) / scale;
1227 offs_y = (ycurrent - ystart) / scale;
1233 * (
double)
cfile->hsize + .5));
1238 *
cfile->vsize + .5));
1248 (
int)(xstart * (
double)
cfile->hsize + .5));
1253 (
int)(ystart * (
double)
cfile->vsize + .5));
1266 if (!framedraw)
return FALSE;
boolean frame_context(LiVESWidget *widget, LiVESXEventButton *event, livespointer which)
LIVES_GLOBAL_INLINE weed_layer_t * lives_layer_new_for_frame(int clip, frames_t frame)
LiVESPixbuf * layer_to_pixbuf(weed_layer_t *layer, boolean realpalette, boolean fordisplay)
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_free(weed_layer_t *layer)
frees pixel_data for a layer, then the layer itself
LIVES_GLOBAL_INLINE int weed_layer_get_height(weed_layer_t *layer)
boolean convert_layer_palette(weed_layer_t *layer, int outpl, int op_clamping)
lives_painter_t * layer_to_lives_painter(weed_layer_t *layer)
convert a weed layer to lives_painter (a.k.a cairo)
LIVES_GLOBAL_INLINE boolean weed_palette_has_alpha(int pal)
boolean resize_layer(weed_layer_t *layer, int width, int height, LiVESInterpType interp, int opal_hint, int oclamp_hint)
resize a layer
LIVES_GLOBAL_INLINE int weed_palette_get_pixels_per_macropixel(int pal)
LIVES_GLOBAL_INLINE int weed_layer_get_width(weed_layer_t *layer)
LIVES_GLOBAL_INLINE weed_layer_t * weed_layer_nullify_pixel_data(weed_layer_t *layer)
LIVES_GLOBAL_INLINE int weed_layer_get_palette(weed_layer_t *layer)
boolean lives_painter_to_layer(lives_painter_t *cr, weed_layer_t *layer)
convert a lives_painter_t (a.k.a) cairo_t to a weed layer
weed_layer_t * weed_layer_copy(weed_layer_t *dlayer, weed_layer_t *slayer)
copy source layer slayer to dest layer dlayer
weed_plant_t weed_layer_t
frames_t virtual_to_images(int sfileno, frames_t sframe, frames_t eframe, boolean update_progress, LiVESPixbuf **pbr)
LiVESResponseType do_read_failed_error_s_with_retry(const char *fname, const char *errtext)
boolean do_effect(lives_rfx_t *rfx, boolean is_preview)
defined as extern in paramwindow.c
void after_framedraw_widget_changed(LiVESWidget *widget, lives_special_framedraw_rect_t *framedraw)
callback for widgets
boolean on_framedraw_enter(LiVESWidget *widget, LiVESXEventCrossing *event, lives_special_framedraw_rect_t *framedraw)
void framedraw_add_reset(LiVESVBox *box, lives_special_framedraw_rect_t *framedraw)
add "reset values" button
weed_plant_t * framedraw_redraw(lives_special_framedraw_rect_t *framedraw, weed_layer_t *layer)
redraw when exposed/frame number changes
boolean on_framedraw_mouse_start(LiVESWidget *widget, LiVESXEventButton *event, lives_special_framedraw_rect_t *framedraw)
boolean on_framedraw_scroll(LiVESWidget *widget, LiVESXEventScroll *event, lives_special_framedraw_rect_t *framedraw)
void framedraw_connect_spinbutton(lives_special_framedraw_rect_t *framedraw, lives_rfx_t *rfx)
connect spinbutton to preview
void widget_add_framedraw(LiVESVBox *box, int start, int end, boolean add_preview_button, int width, int height, lives_rfx_t *rfx)
call this to add framedraw widget to an hbox
boolean on_framedraw_mouse_update(LiVESWidget *widget, LiVESXEventMotion *event, lives_special_framedraw_rect_t *framedraw)
void framedraw_add_label(LiVESVBox *box)
add explanatory label
boolean on_framedraw_mouse_reset(LiVESWidget *widget, LiVESXEventButton *event, lives_special_framedraw_rect_t *framedraw)
void invalidate_preview(lives_special_framedraw_rect_t *frame_draw)
void framedraw_connect(lives_special_framedraw_rect_t *framedraw, int width, int height, lives_rfx_t *rfx)
activate the image for clicks and draws
void load_rfx_preview(lives_rfx_t *rfx)
rfx preview
void on_framedraw_reset_clicked(LiVESButton *button, lives_special_framedraw_rect_t *framedraw)
reset button
boolean on_framedraw_leave(LiVESWidget *widget, LiVESXEventCrossing *event, lives_special_framedraw_rect_t *framedraw)
#define CROSSHAIR_SIZE
pixel size for crosshair "arms"
LIVES_GLOBAL_INLINE boolean lives_proc_thread_cancel(lives_proc_thread_t tinfo)
LIVES_GLOBAL_INLINE boolean lives_strncmp(const char *st1, const char *st2, size_t len)
returns FALSE if strings match
lives_proc_thread_t lives_proc_thread_create(lives_thread_attr_t attr, lives_funcptr_t func, int return_type, const char *args_fmt,...)
create the specific plant which defines a background task to be run
#define lives_nanosleep(nanosec)
#define lives_nanosleep_until_nonzero(condition)
void *(* lives_funcptr_t)(void *)
#define LIVES_THRDATTR_NONE
void set_drawing_area_from_pixbuf(LiVESWidget *widget, LiVESPixbuf *pixbuf, lives_painter_surface_t *surface)
_palette * palette
interface colour settings
LIVES_GLOBAL_INLINE boolean pull_frame(weed_layer_t *layer, const char *image_ext, weed_timecode_t tc)
pull a frame from an external source into a layer the WEED_LEAF_CLIP and WEED_LEAF_FRAME leaves must ...
void clear_mainw_msg(void)
size_t get_token_count(const char *string, int delim)
boolean lives_alarm_clear(lives_alarm_t alarm_handle)
int lives_system(const char *com, boolean allow_error)
void lives_kill_subprocesses(const char *dirname, boolean kill_parent)
char * lives_fgets(char *s, int size, FILE *stream)
const char * get_image_ext_for_type(lives_img_type_t imgtype)
lives_alarm_t lives_alarm_set(ticks_t ticks)
set alarm for now + delta ticks (10 nanosec) param ticks (10 nanoseconds) is the offset when we want ...
#define CURRENT_CLIP_IS_VALID
void calc_maxspect(int rwidth, int rheight, int *cwidth, int *cheight)
@ CLIP_TYPE_FILE
unimported video, not or partially broken in frames
ticks_t lives_alarm_check(lives_alarm_t alarm_handle)
#define MAINW_MSG_SIZE
mainw->msg bytesize
#define DEF_BUTTON_HEIGHT
#define LIVES_LONGER_TIMEOUT
#define STYLE_1
turn on theming if set
_fx_dialog * fx_dialog[2]
#define LIVES_FILE_EXT_PRE
boolean check_filewrite_overwrites(void)
void do_rfx_cleanup(lives_rfx_t *rfx)
double get_double_param(void *value)
int get_int_param(void *value)
@ LIVES_PARAM_SPECIAL_TYPE_RECT_MULTIRECT
type may be used in framedraw
@ LIVES_PARAM_SPECIAL_TYPE_RECT_DEMASK
type may be used in framedraw
@ LIVES_PARAM_SPECIAL_TYPE_SCALEDPOINT
type may be used in framedraw
@ LIVES_PARAM_SPECIAL_TYPE_SINGLEPOINT
type may be used in framedraw
#define RFX_PROPS_MAY_RESIZE
is a tool
LiVESWidgetColor normal_fore
LiVESWidgetColor light_red
LiVESWidgetColor normal_back
boolean letterbox_mt
playback with letterbox (multitrack)
char backend_sync[PATH_MAX *4]
LiVESXDevice * mouse_device
unused for gtk+ < 3.0.0
int dp
decimals, 0 for int and bool
LiVESWidget * widgets[MAX_PARAM_WIDGETS]
TODO - change to LiVESWidget **widgets, terminated with a NULL.
lives_rfx_source_t source_type
lives_param_t * xend_param
lives_param_t * xstart_param
lives_param_special_t type
lives_param_t * scale_param
lives_param_t * yend_param
lives_param_t * ystart_param
weed_plant_t * fd_layer
framedraw preview layer
boolean block_param_updates
block visual param changes from updating real values
lives_mgeometry_t * mgeom
multi-head support
volatile lives_cancel_t cancelled
LiVESWidget * framedraw_preview
the 'redraw' button
lives_painter_surface_t * fd_surface
LiVESWidget * framedraw_cbutton
colour for mask
LiVESWidget * framedraw_spinbutton
the frame number button
LiVESWidget * framedraw_reset
the 'redraw' button
LiVESWidget * fd_frame
surrounding frame widget
LiVESWidget * framedraw_scale
the slider
LiVESWidget * framedraw
for the framedraw special widget - TODO - use a sub-struct
int framedraw_frame
current displayed frame
lives_mt * multitrack
holds a pointer to the entire multitrack environment; NULL in Clip Edit mode
weed_plant_t * fd_layer_orig
original layer uneffected
lives_painter_surface_t * play_surface
LiVESWidget * framedraw_maskbox
box for opacity controls
ulong fd_spin_func
spinbutton for framedraw previews
int fd_max_frame
max effected / generated frame
LiVESWidget * framedraw_opscale
opacity
#define lives_strdup_printf(fmt,...)