7#ifndef HAS_LIVES_WIDGET_HELPER_H
8#define HAS_LIVES_WIDGET_HELPER_H
11#define WIDGET_HELPER_GLOBAL_INLINE inline
12#define WIDGET_HELPER_LOCAL_INLINE static inline
14#define WIDGET_HELPER_GLOBAL_INLINE
15#define WIDGET_HELPER_LOCAL_INLINE
19#define M_PI 3.1415926536
22#define LIVES_HAS_GRID_WIDGET 0
23#define LIVES_HAS_SWITCH_WIDGET 0
24#define LIVES_HAS_IMAGE_MENU_ITEM 0
25#define LIVES_HAS_DEVICE_MANAGER 0
27#define MIN_SPINBUTTON_SIZE 6
29#define LONG_ENTRY_WIDTH ((int)(100.*widget_opts.scale))
30#define SHORT_ENTRY_WIDTH ((int)(40.*widget_opts.scale))
31#define MEDIUM_ENTRY_WIDTH ((int)(60.*widget_opts.scale))
32#define SHORTER_ENTRY_WIDTH (MEDIUM_ENTRY_WIDTH >> 1)
47#define W_CSS_MIN_WIDTH -1
48#define W_CSS_MIN_HEIGHT 18
49#define W_PACKING_WIDTH 10
50#define W_PACKING_HEIGHT 6
51#define W_BORDER_WIDTH 10
52#define W_FILL_LENGTH (W_PACKING_WIDTH * 4)
54#if defined (GUI_GTK) || defined (LIVES_PAINTER_IS_CAIRO)
60#ifdef LIVES_LINGO_IS_PANGO
62typedef PangoLayout LingoLayout;
63typedef PangoContext LingoContext;
64typedef PangoWrapMode LingoWrapMode;
65typedef PangoEllipsizeMode LingoEllipsizeMode;
66typedef PangoFontDescription LingoFontDescription;
67#define lingo_layout_set_alignment(a, b) pango_layout_set_alignment(a, b)
69#define LINGO_ALIGN_LEFT PANGO_ALIGN_LEFT
70#define LINGO_ALIGN_RIGHT PANGO_ALIGN_RIGHT
71#define LINGO_ALIGN_CENTER PANGO_ALIGN_CENTER
73#define LINGO_WRAP_WORD PANGO_WRAP_WORD
74#define LINGO_WRAP_CHAR PANGO_WRAP_CHAR
75#define LINGO_WRAP_WORD_CHAR PANGO_WRAP_WORD_CHAR
77#define LINGO_ELLIPSIZE_NONE PANGO_ELLIPSIZE_NONE
78#define LINGO_ELLIPSIZE_START PANGO_ELLIPSIZE_START
79#define LINGO_ELLIPSIZE_END PANGO_ELLIPSIZE_END
80#define LINGO_ELLIPSIZE_MIDDLE PANGO_ELLIPSIZE_MIDDLE
82#define lingo_layout_set_text(a, b, c) pango_layout_set_text(a, b, c)
83#define lingo_layout_set_markup_with_accel(a, b, c, d, e) \
84 pango_layout_set_markup_with_accel(a, b, c, d, e)
85#ifdef LIVES_PAINTER_IS_CAIRO
86#define LIVES_PAINTER_COLOR_PALETTE(endian) (endian == LIVES_BIG_ENDIAN ? WEED_PALETTE_ARGB32 \
87 : WEED_PALETTE_BGRA32)
88#define lingo_painter_show_layout(a, b) pango_cairo_show_layout(a, b)
91#define lives_widget_create_lingo_context(a) gtk_widget_create_pango_context(a)
93#define lingo_layout_get_size(a, b, c) pango_layout_get_size(a, b, c)
94#define lingo_layout_new(a) pango_layout_new(a)
95#define lingo_layout_set_markup(a, b, c) pango_layout_set_markup(a, b, c)
96#define lingo_layout_set_width(a, b) pango_layout_set_width(a, b)
97#define lingo_layout_set_height(a, b) pango_layout_set_height(a, b)
99#define lingo_font_description_new(a) pango_font_description_new()
100#define lingo_font_description_get_size(a) pango_font_description_get_size(a)
101#define lingo_font_description_set_size(a, b) pango_font_description_set_size(a, b)
102#define lingo_font_description_free(a) pango_font_description_free(a)
104#define LINGO_IS_LAYOUT(a) PANGO_IS_LAYOUT(a)
105#define LINGO_IS_CONTEXT(a) PANGO_IS_CONTEXT(a)
107#define LINGO_SCALE PANGO_SCALE
111#define LIVES_ELLIPSIZE_NONE LINGO_ELLIPSIZE_NONE
112#define LIVES_ELLIPSIZE_START LINGO_ELLIPSIZE_START
113#define LIVES_ELLIPSIZE_MIDDLE LINGO_ELLIPSIZE_MIDDLE
114#define LIVES_ELLIPSIZE_END LINGO_ELLIPSIZE_END
117#ifdef LIVES_PAINTER_IS_CAIRO
120#include <cairo/cairo.h>
123typedef cairo_t lives_painter_t;
124typedef cairo_surface_t lives_painter_surface_t;
129typedef cairo_format_t lives_painter_format_t;
131#define LIVES_PAINTER_FORMAT_A1 CAIRO_FORMAT_A1
132#define LIVES_PAINTER_FORMAT_A8 CAIRO_FORMAT_A8
133#define LIVES_PAINTER_FORMAT_RGB24 CAIRO_FORMAT_RGB24
134#define LIVES_PAINTER_FORMAT_ARGB32 CAIRO_FORMAT_ARGB32
136typedef cairo_content_t lives_painter_content_t;
138#define LIVES_PAINTER_CONTENT_COLOR CAIRO_CONTENT_COLOR
140typedef cairo_operator_t lives_painter_operator_t;
142#define LIVES_PAINTER_OPERATOR_UNKNOWN CAIRO_OPERATOR_OVER
143#define LIVES_PAINTER_OPERATOR_DEFAULT CAIRO_OPERATOR_OVER
145#define LIVES_PAINTER_OPERATOR_DEST_OUT CAIRO_OPERATOR_DEST_OUT
146#if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 10, 0)
147#define LIVES_PAINTER_OPERATOR_DIFFERENCE CAIRO_OPERATOR_OVER
148#define LIVES_PAINTER_OPERATOR_OVERLAY CAIRO_OPERATOR_OVER
150#define LIVES_PAINTER_OPERATOR_DIFFERENCE CAIRO_OPERATOR_DIFFERENCE
151#define LIVES_PAINTER_OPERATOR_OVERLAY CAIRO_OPERATOR_OVERLAY
154typedef cairo_fill_rule_t lives_painter_fill_rule_t;
156#define LIVES_PAINTER_FILL_RULE_WINDING CAIRO_FILL_RULE_WINDING
157#define LIVES_PAINTER_FILL_RULE_EVEN_ODD CAIRO_FILL_RULE_EVEN_ODD
172 lives_painter_content_t cont,
173 int width,
int height);
177 int width,
int height,
int stride);
201boolean lives_painter_arc(lives_painter_t *,
double xc,
double yc,
double radius,
double angle1,
double angle2);
224boolean lives_has_icon(LiVESIconTheme *,
const char *stock_id, LiVESIconSize size);
240boolean clear_widget_bg(LiVESWidget *widget, lives_painter_surface_t *);
242 double x,
double y,
double width,
double height);
275 int rowstride, LiVESPixbufDestroyNotify lives_free_buffer_fn,
276 livespointer destroy_fn_data);
284 LiVESInterpType interp_type);
294typedef GConnectFlags LiVESConnectFlags;
296#define LIVES_CONNECT_AFTER G_CONNECT_AFTER
297#define LIVES_CONNECT_SWAPPED G_CONNECT_SWAPPED
300 livespointer data, LiVESConnectFlags flags);
303 livespointer data, LiVESConnectFlags flags);
305#define lives_signal_connect(instance, detailed_signal, c_handler, data) \
306 lives_signal_connect_async(instance, detailed_signal, c_handler, data, 0)
307#define lives_signal_connect_after(instance, detailed_signal, c_handler, data) \
308 lives_signal_connect_async(instance, detailed_signal, c_handler, data, LIVES_CONNECT_AFTER)
309#define lives_signal_connect_swapped(instance, detailed_signal, c_handler, data) \
310 lives_signal_connect_async(instance, detailed_signal, c_handler, data, LIVES_CONNECT_SWAPPED)
312#define lives_signal_sync_connect(instance, detailed_signal, c_handler, data) \
313 lives_signal_connect_sync(instance, detailed_signal, c_handler, data, 0)
314#define lives_signal_sync_connect_after(instance, detailed_signal, c_handler, data) \
315 lives_signal_connect_sync(instance, detailed_signal, c_handler, data, LIVES_CONNECT_AFTER)
316#define lives_signal_sync_connect_swapped(instance, detailed_signal, c_handler, data) \
317 lives_signal_connect_sync(instance, detailed_signal, c_handler, data, LIVES_CONNECT_SWAPPED)
341 const char *detail,
const char *value);
509 double step_increment,
double page_increment,
double page_size);
515 uint32_t padding, LiVESPackType pack_type);
517boolean lives_box_pack_start(LiVESBox *, LiVESWidget *child,
boolean expand,
boolean fill, uint32_t padding);
518boolean lives_box_pack_end(LiVESBox *, LiVESWidget *child,
boolean expand,
boolean fill, uint32_t padding);
559boolean lives_alignment_set(LiVESWidget *,
float xalign,
float yalign,
float xscale,
float yscale);
606 LiVESTextIter *end,
boolean inc_hidden_chars);
619 const LiVESTextIter *where,
boolean left_gravity);
759 LiVESButtonsType buttons,
760 const char *msg_fmt, ...);
765boolean lives_ruler_set_range(LiVESRuler *,
double lower,
double upper,
double position,
double max_size);
832LiVESWidget *
lives_table_new(uint32_t rows, uint32_t cols,
boolean homogeneous);
836boolean lives_table_attach(LiVESTable *, LiVESWidget *child, uint32_t left, uint32_t right,
837 uint32_t top, uint32_t bottom, LiVESAttachOptions xoptions, LiVESAttachOptions yoptions,
838 uint32_t xpad, uint32_t ypad);
843#if LIVES_TABLE_IS_GRID
848 LiVESPositionType side,
int width,
int height);
854#if GTK_CHECK_VERSION(3,2,0)
855char *lives_font_chooser_get_font(LiVESFontChooser *);
856boolean lives_font_chooser_set_font(LiVESFontChooser *,
const char *fontname);
857LingoFontDescription *lives_font_chooser_get_font_desc(LiVESFontChooser *);
858boolean lives_font_chooser_set_font_desc(LiVESFontChooser *, LingoFontDescription *lfd);
901#if !GTK_CHECK_VERSION(3, 10, 0)
934 LiVESWidgetClosure *closure);
939 uint32_t accel_key, LiVESXModifierType accel_mods, LiVESAccelFlags accel_flags);
944boolean lives_display_get_pointer(LiVESXDevice *, LiVESXDisplay *, LiVESXScreen **,
int *x,
int *y, LiVESXModifierType *mask);
966uint32_t
lives_timer_add(uint32_t interval, LiVESWidgetSourceFunc function, livespointer data);
968uint32_t
lives_idle_add(LiVESWidgetSourceFunc function, livespointer data);
999boolean lives_box_pack_first(LiVESBox *, LiVESWidget *child,
boolean expand,
boolean fill, uint32_t padding);
1016#define BUTTON_DIM_VAL (0.4 * 65535.)
1018#define LOCK_BUTTON_WIDTH 24
1019#define LOCK_BUTTON_HEIGHT 24
1028#ifdef USE_SPECIAL_BUTTONS
1029void sbutt_render(LiVESWidget *, LiVESWidgetState state, livespointer user_data);
1038 boolean fake_default,
const char *ttips);
1040 int width,
int height, LiVESBox *,
boolean fake_default,
const char *ttips);
1042#define lives_standard_button_new(w, h) lives_button_new()
1043#define lives_standard_button_new_with_label(l, w, h) lives_button_new_with_label(l)
1044#define lives_standard_button_set_label(b, l); lives_button_set_label(b, l)
1045#define lives_standard_button_get_label(b) lives_button_get_label(b)
1046#define lives_standard_button_set_image(b, i) lives_button_set_image(b, i)
1050 int width,
int height);
1066 const char *tooltip);
1090 LiVESBox *,
const char *tooltip);
1092 double max,
double step,
double page,
int dp, LiVESBox *,
1093 const char *tooltip);
1098LiVESWidget *
lives_standard_entry_new(
const char *labeltext,
const char *txt,
int dispwidth,
int maxchars, LiVESBox *,
1099 const char *tooltip);
1102 const char *tooltip);
1106 LiVESBox *box,
const char *tooltip);
1115 const char *label,
const char *tooltip);
1139 LiVESWidget **sb_red, LiVESWidget **sb_green, LiVESWidget **sb_blue, LiVESWidget **sb_alpha);
1175boolean lives_image_scale(LiVESImage *,
int width,
int height, LiVESInterpType interp_type);
1187boolean lives_tree_store_find_iter(LiVESTreeStore *,
int col,
const char *val, LiVESTreeIter *existing, LiVESTreeIter *newiter);
1217 double step_increment,
double page_increment);
1225boolean lives_box_pack_top(LiVESBox *, LiVESWidget *child,
boolean expand,
boolean fill, uint32_t padding);
1240 livespointer condsens, livespointer condinsens,
boolean invert);
1244boolean label_act_toggle(LiVESWidget *, LiVESXEventButton *, LiVESWidget *);
1278 boolean *togglevalue);
1289#define LIVES_JUSTIFY_DEFAULT (def_widget_opts.justify)
1311#define LIVES_EXPAND_NONE 0
1312#define LIVES_EXPAND_DEFAULT_HEIGHT 1
1313#define LIVES_EXPAND_DEFAULT_WIDTH 2
1314#define LIVES_EXPAND_DEFAULT (LIVES_EXPAND_DEFAULT_HEIGHT | LIVES_EXPAND_DEFAULT_WIDTH)
1315#define LIVES_EXPAND_EXTRA_HEIGHT 4
1316#define LIVES_EXPAND_EXTRA_WIDTH 8
1317#define LIVES_EXPAND_EXTRA (LIVES_EXPAND_EXTRA_HEIGHT | LIVES_EXPAND_EXTRA_WIDTH)
1319#define LIVES_SHOULD_EXPAND (widget_opts.expand != LIVES_EXPAND_NONE)
1320#define LIVES_SHOULD_EXPAND_DEFAULT (widget_opts.expand == LIVES_EXPAND_DEFAULT)
1321#define LIVES_SHOULD_EXPAND_EXTRA (widget_opts.expand == LIVES_EXPAND_EXTRA)
1323#define LIVES_SHOULD_EXPAND_WIDTH (widget_opts.expand & (LIVES_EXPAND_DEFAULT_WIDTH | LIVES_EXPAND_EXTRA_WIDTH))
1324#define LIVES_SHOULD_EXPAND_HEIGHT (widget_opts.expand & (LIVES_EXPAND_DEFAULT_HEIGHT | LIVES_EXPAND_EXTRA_HEIGHT))
1326#define LIVES_SHOULD_EXPAND_EXTRA_WIDTH (widget_opts.expand & LIVES_EXPAND_EXTRA_WIDTH)
1327#define LIVES_SHOULD_EXPAND_EXTRA_HEIGHT (widget_opts.expand & LIVES_EXPAND_EXTRA_HEIGHT)
1329#define LIVES_SHOULD_EXPAND_DEFAULT_WIDTH (LIVES_SHOULD_EXPAND_WIDTH && !LIVES_SHOULD_EXPAND_EXTRA_WIDTH)
1330#define LIVES_SHOULD_EXPAND_DEFAULT_HEIGHT (LIVES_SHOULD_EXPAND_HEIGHT && !LIVES_SHOULD_EXPAND_EXTRA_HEIGHT)
1332#define LIVES_SHOULD_EXPAND_DEFAULT_FOR(box) ((LIVES_IS_HBOX(box) && LIVES_SHOULD_EXPAND_DEFAULT_WIDTH) || (LIVES_IS_VBOX(box) && LIVES_EXPAND_DEFAULT_HEIGHT))
1334#define LIVES_SHOULD_EXPAND_EXTRA_FOR(box) ((LIVES_IS_HBOX(box) && LIVES_SHOULD_EXPAND_EXTRA_WIDTH) || (LIVES_IS_VBOX(box) && LIVES_SHOULD_EXPAND_EXTRA_HEIGHT))
1336#define LIVES_SHOULD_EXPAND_FOR(box) (LIVES_SHOULD_EXPAND_DEFAULT_FOR(box) || LIVES_SHOULD_EXPAND_EXTRA_FOR(box))
1342#define LIVES_LIVES_STOCK_AUDIO "lives-audio"
1343#define LIVES_LIVES_STOCK_PLAY_SEL "lives-playsel"
1344#define LIVES_LIVES_STOCK_FULLSCREEN "lives-fullscreen"
1345#define LIVES_LIVES_STOCK_SEPWIN "lives-sepwin"
1346#define LIVES_LIVES_STOCK_VOLUME_MUTE "lives-volume_mute"
1347#define LIVES_LIVES_STOCK_LOOP "lives-loop"
1348#define LIVES_LIVES_STOCK_ZOOM_IN "lives-zoom-in"
1349#define LIVES_LIVES_STOCK_ZOOM_OUT "lives-zoom-out"
1350#define LIVES_LIVES_STOCK_PREF_GUI "lives-pref_gui"
1351#define LIVES_LIVES_STOCK_PREF_DECODING "lives-pref_decoding"
1352#define LIVES_LIVES_STOCK_PREF_DIRECTORY "lives-pref_directory"
1353#define LIVES_LIVES_STOCK_PREF_EFFECTS "lives-pref_effects"
1354#define LIVES_LIVES_STOCK_PREF_ENCODING "lives-pref_encoding"
1355#define LIVES_LIVES_STOCK_PREF_JACK "lives-pref_jack"
1356#define LIVES_LIVES_STOCK_PREF_MIDI "lives-pref_midi"
1357#define LIVES_LIVES_STOCK_PREF_MISC "lives-pref_misc"
1358#define LIVES_LIVES_STOCK_PREF_MULTITRACK "lives-pref_multitrack"
1359#define LIVES_LIVES_STOCK_PREF_NET "lives-pref_net"
1360#define LIVES_LIVES_STOCK_PREF_PLAYBACK "lives-pref_playback"
1361#define LIVES_LIVES_STOCK_PREF_RECORD "lives-pref_record"
1362#define LIVES_LIVES_STOCK_PREF_THEMES "lives-pref_themes"
1363#define LIVES_LIVES_STOCK_PREF_WARNING "lives-pref_warning"
1366#define LIVES_TEXT_SIZE_XX_SMALL "xx-small"
1367#define LIVES_TEXT_SIZE_X_SMALL "x-small"
1368#define LIVES_TEXT_SIZE_SMALL "small"
1369#define LIVES_TEXT_SIZE_MEDIUM "medium"
1370#define LIVES_TEXT_SIZE_LARGE "large"
1371#define LIVES_TEXT_SIZE_X_LARGE "x-large"
1372#define LIVES_TEXT_SIZE_XX_LARGE "xx-large"
1373#define LIVES_TEXT_SIZE_NORMAL LIVES_TEXT_SIZE_MEDIUM
1374#define N_TEXT_SIZES 7
1445#ifdef NEED_DEF_WIDGET_OPTS
1454 LIVES_JUSTIFY_START,
1469 LIVES_ICON_SIZE_LARGE_TOOLBAR,
1485#define HIDDEN_KEY "hidden"
1486#define SECLIST_KEY "secondary_list"
1487#define SECLIST_VAL_KEY "secondary_list_value"
1488#define ISDIR_KEY "is_dir"
1489#define FILTER_KEY "filter"
1490#define DEFDIR_KEY "def_dir"
1491#define RFX_KEY "rfx"
1492#define TEXTWIDGET_KEY "def_dir"
1493#define FILESEL_TYPE_KEY "filesel_type"
1494#define PARAM_NUMBER_KEY "param_number"
1495#define WH_LAYOUT_KEY "_wh_layout"
error("LSD_RANDFUNC(ptr, size) must be defined")
void resize(double scale)