libxputty 0.1
Loading...
Searching...
No Matches
xplayhead.c
Go to the documentation of this file.
1/*
2 * 0BSD
3 *
4 * BSD Zero Clause License
5 *
6 * Copyright (c) 2019 Hermann Meyer
7 *
8 * Permission to use, copy, modify, and/or distribute this software for any
9 * purpose with or without fee is hereby granted.
10
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 *
19 */
20
21
22#include "xplayhead.h"
23#include "xplayhead_private.h"
24
25void playhead_mem_free(void *w_, void* user_data) {
26 Widget_t *wid = (Widget_t*)w_;
27 wid->adj_x = NULL;
28 wid->adj_y = NULL;
29}
30
31
32Widget_t* add_playhead(Widget_t *parent, const char * label, Adjustment_t *clip,
33 Adjustment_t *cut, int x, int y, int width, int height) {
34
35 Widget_t *wid = create_widget(parent->app, parent, x, y, width, height);
36 _create_playhead_image(wid, width, height);
37 wid->flags |= HAS_MEM;
38 wid->label = label;
39 wid->adj = add_adjustment(wid,0.0, 0.0, 0.0, 1000.0,1.0, CL_METER);
40 wid->adj_x = clip;
41 wid->adj_y = cut;
42 wid->scale.gravity = ASPECT;
45 return wid;
46}
Adjustment_t - struct to hold a controller adjustment.
Definition xadjustment.h:82
xevfunc expose_callback
Definition xwidget.h:85
xevfunc mem_free_callback
Definition xwidget.h:92
Gravity gravity
Definition xwidget.h:347
Widget_t - struct to hold the basic Widget_t info.
Definition xwidget.h:457
Resize_t scale
Definition xwidget.h:525
Adjustment_t * adj_y
Definition xwidget.h:495
Adjustment_t * adj_x
Definition xwidget.h:493
Adjustment_t * adj
Definition xwidget.h:497
long long flags
Definition xwidget.h:461
const char * label
Definition xwidget.h:463
Func_t func
Definition xwidget.h:481
Xputty * app
Definition xwidget.h:465
Adjustment_t * add_adjustment(Widget_t *w, float std_value, float value, float min_value, float max_value, float step, CL_type type)
*add_adjustment - adding a adjustment to a Widget_t
Definition xadjustment.c:25
@ CL_METER
Definition xadjustment.h:59
Widget_t * add_playhead(Widget_t *parent, const char *label, Adjustment_t *clip, Adjustment_t *cut, int x, int y, int width, int height)
add_playhead - add a playhead to a Widget_t connect to func.value_changed_callback to implement your ...
Definition xplayhead.c:32
void playhead_mem_free(void *w_, void *user_data)
Definition xplayhead.c:25
void _draw_playhead(void *w_, void *user_data)
_draw_playhead - internal draw the playhead to the buffer
void _create_playhead_image(Widget_t *w, int width, int height)
_create_playhead_image - internal draw the playhead image to the cairo image surface
Widget_t * create_widget(Xputty *app, Widget_t *win, int x, int y, int width, int height)
*create_widget - create a widget A Widget_t could only be created as child of a other Widget_t To...
Definition xwidget.c:265
@ ASPECT
Definition xwidget.h:322
@ HAS_MEM
Definition xwidget.h:406