mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
replace existing text position enums
This commit is contained in:
parent
52bec51bff
commit
2bb344635b
4 changed files with 27 additions and 128 deletions
|
@ -27,9 +27,7 @@
|
|||
|
||||
#include "ges-internal.h"
|
||||
#include "ges-timeline-text-overlay.h"
|
||||
#include "ges-timeline-source.h"
|
||||
#include "ges-track-object.h"
|
||||
#include "ges-track-title-source.h"
|
||||
#include "ges-track-text-overlay.h"
|
||||
#include <string.h>
|
||||
|
||||
|
@ -37,12 +35,10 @@ G_DEFINE_TYPE (GESTimelineTextOverlay, ges_tl_text_overlay,
|
|||
GES_TYPE_TIMELINE_OVERLAY);
|
||||
|
||||
#define DEFAULT_PROP_TEXT ""
|
||||
#define DEFAULT_PROP_FONT_DESC DEFAULT_FONT_DESC
|
||||
#define DEFAULT_PROP_VALIGNMENT DEFAULT_VALIGNMENT
|
||||
#define DEFAULT_PROP_HALIGNMENT DEFAULT_HALIGNMENT
|
||||
#define GES_TIMELINE_TITLE_SRC_VALIGN_TYPE (ges_timeline_text_overlay_valign_get_type())
|
||||
#define GES_TIMELINE_TITLE_SRC_HALIGN_TYPE (ges_timeline_text_overlay_halign_get_type())
|
||||
|
||||
#define DEFAULT_PROP_FONT_DESC "Serif 36"
|
||||
#define DEFAULT_PROP_VALIGNMENT GES_TEXT_VALIGN_BASELINE
|
||||
#define DEFAULT_PROP_HALIGNMENT GES_TEXT_HALIGN_CENTER
|
||||
#
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
@ -65,21 +61,15 @@ ges_tl_text_overlay_set_font_desc (GESTimelineTextOverlay * self, const gchar *
|
|||
font_desc);
|
||||
|
||||
static void
|
||||
ges_tl_text_overlay_set_valign (GESTimelineTextOverlay * self,
|
||||
GESTrackTitleSrcVAlign);
|
||||
ges_tl_text_overlay_set_valign (GESTimelineTextOverlay * self, GESTextVAlign);
|
||||
|
||||
static void
|
||||
ges_tl_text_overlay_set_halign (GESTimelineTextOverlay * self,
|
||||
GESTrackTitleSrcHAlign);
|
||||
ges_tl_text_overlay_set_halign (GESTimelineTextOverlay * self, GESTextHAlign);
|
||||
|
||||
static GESTrackObject
|
||||
* ges_tl_text_overlay_create_track_object (GESTimelineObject * obj,
|
||||
GESTrack * track);
|
||||
|
||||
static GType ges_timeline_text_overlay_valign_get_type (void);
|
||||
|
||||
static GType ges_timeline_text_overlay_halign_get_type (void);
|
||||
|
||||
static void
|
||||
ges_tl_text_overlay_get_property (GObject * object, guint property_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
|
@ -204,8 +194,8 @@ ges_tl_text_overlay_class_init (GESTimelineTextOverlayClass * klass)
|
|||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGNMENT,
|
||||
g_param_spec_enum ("halignment", "horizontal alignment",
|
||||
"Horizontal alignment of the text",
|
||||
GES_TIMELINE_TITLE_SRC_HALIGN_TYPE, DEFAULT_PROP_HALIGNMENT,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
GES_TEXT_HALIGN_TYPE, DEFAULT_PROP_HALIGNMENT,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
|
||||
/**
|
||||
* GESTimelineTextOverlay:mute:
|
||||
*
|
||||
|
@ -229,48 +219,6 @@ ges_tl_text_overlay_init (GESTimelineTextOverlay * self)
|
|||
self->valign = DEFAULT_PROP_VALIGNMENT;
|
||||
}
|
||||
|
||||
static GType
|
||||
ges_timeline_text_overlay_valign_get_type (void)
|
||||
{
|
||||
static GType text_overlay_valign_type = 0;
|
||||
static gsize initialized = 0;
|
||||
static const GEnumValue text_overlay_valign[] = {
|
||||
{GES_TRACK_TITLE_SRC_VALIGN_BASELINE, "baseline", "baseline"},
|
||||
{GES_TRACK_TITLE_SRC_VALIGN_BOTTOM, "bottom", "bottom"},
|
||||
{GES_TRACK_TITLE_SRC_VALIGN_TOP, "top", "top"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (g_once_init_enter (&initialized)) {
|
||||
text_overlay_valign_type =
|
||||
g_enum_register_static ("GESTimelineTextOverlayVAlign",
|
||||
text_overlay_valign);
|
||||
g_once_init_leave (&initialized, 1);
|
||||
}
|
||||
return text_overlay_valign_type;
|
||||
}
|
||||
|
||||
static GType
|
||||
ges_timeline_text_overlay_halign_get_type (void)
|
||||
{
|
||||
static GType text_overlay_halign_type = 0;
|
||||
static gsize initialized = 0;
|
||||
static const GEnumValue text_overlay_halign[] = {
|
||||
{GES_TRACK_TITLE_SRC_HALIGN_LEFT, "left", "left"},
|
||||
{GES_TRACK_TITLE_SRC_HALIGN_CENTER, "center", "center"},
|
||||
{GES_TRACK_TITLE_SRC_HALIGN_RIGHT, "right", "right"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (g_once_init_enter (&initialized)) {
|
||||
text_overlay_halign_type =
|
||||
g_enum_register_static ("GESTimelineTextOverlayHAlign",
|
||||
text_overlay_halign);
|
||||
g_once_init_leave (&initialized, 1);
|
||||
}
|
||||
return text_overlay_halign_type;
|
||||
}
|
||||
|
||||
static void
|
||||
ges_tl_text_overlay_set_text (GESTimelineTextOverlay * self, const gchar * text)
|
||||
{
|
||||
|
@ -319,7 +267,7 @@ ges_tl_text_overlay_set_font_desc (GESTimelineTextOverlay * self, const gchar *
|
|||
|
||||
static void
|
||||
ges_tl_text_overlay_set_halign (GESTimelineTextOverlay * self,
|
||||
GESTrackTitleSrcHAlign halign)
|
||||
GESTextHAlign halign)
|
||||
{
|
||||
GList *tmp;
|
||||
GESTimelineObject *object = (GESTimelineObject *) self;
|
||||
|
@ -341,7 +289,7 @@ ges_tl_text_overlay_set_halign (GESTimelineTextOverlay * self,
|
|||
|
||||
static void
|
||||
ges_tl_text_overlay_set_valign (GESTimelineTextOverlay * self,
|
||||
GESTrackTitleSrcVAlign valign)
|
||||
GESTextVAlign valign)
|
||||
{
|
||||
GList *tmp;
|
||||
GESTimelineObject *object = (GESTimelineObject *) self;
|
||||
|
|
|
@ -58,8 +58,8 @@ struct _GESTimelineTextOverlay {
|
|||
gboolean mute;
|
||||
gchar *text;
|
||||
gchar *font_desc;
|
||||
gint halign;
|
||||
gint valign;
|
||||
GESTextHAlign halign;
|
||||
GESTextVAlign valign;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,10 +39,8 @@
|
|||
G_DEFINE_TYPE (GESTimelineTitleSource, ges_tl_title_src,
|
||||
GES_TYPE_TIMELINE_SOURCE);
|
||||
|
||||
#define DEFAULT_PROP_TEXT ""
|
||||
#define DEFAULT_PROP_FONT_DESC DEFAULT_FONT_DESC
|
||||
#define DEFAULT_PROP_VALIGNMENT DEFAULT_VALIGNMENT
|
||||
#define DEFAULT_PROP_HALIGNMENT DEFAULT_HALIGNMENT
|
||||
#define DEFAULT_TEXT ""
|
||||
#define DEFAULT_FONT_DESC "Serif 36"
|
||||
#define GES_TIMELINE_TITLE_SRC_VALIGN_TYPE (ges_timeline_title_source_valign_get_type())
|
||||
#define GES_TIMELINE_TITLE_SRC_HALIGN_TYPE (ges_timeline_title_source_halign_get_type())
|
||||
|
||||
|
@ -67,21 +65,15 @@ ges_tl_title_src_set_font_desc (GESTimelineTitleSource * self, const gchar *
|
|||
font_desc);
|
||||
|
||||
static void
|
||||
ges_tl_title_src_set_valign (GESTimelineTitleSource * self,
|
||||
GESTrackTitleSrcVAlign);
|
||||
ges_tl_title_src_set_valign (GESTimelineTitleSource * self, GESTextVAlign);
|
||||
|
||||
static void
|
||||
ges_tl_title_src_set_halign (GESTimelineTitleSource * self,
|
||||
GESTrackTitleSrcHAlign);
|
||||
ges_tl_title_src_set_halign (GESTimelineTitleSource * self, GESTextHAlign);
|
||||
|
||||
static GESTrackObject
|
||||
* ges_tl_title_src_create_track_object (GESTimelineObject * obj,
|
||||
GESTrack * track);
|
||||
|
||||
static GType ges_timeline_title_source_valign_get_type (void);
|
||||
|
||||
static GType ges_timeline_title_source_halign_get_type (void);
|
||||
|
||||
static void
|
||||
ges_tl_title_src_get_property (GObject * object, guint property_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
|
@ -196,8 +188,9 @@ ges_tl_title_src_class_init (GESTimelineTitleSourceClass * klass)
|
|||
*/
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_VALIGNMENT,
|
||||
g_param_spec_enum ("valignment", "vertical alignment",
|
||||
"Vertical alignment of the text", GES_TIMELINE_TITLE_SRC_VALIGN_TYPE,
|
||||
DEFAULT_PROP_VALIGNMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
"Vertical alignment of the text", GES_TEXT_VALIGN_TYPE,
|
||||
DEFAULT_VALIGNMENT,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
|
||||
/**
|
||||
* GESTimelineTitleSource:halignment
|
||||
*
|
||||
|
@ -206,8 +199,8 @@ ges_tl_title_src_class_init (GESTimelineTitleSourceClass * klass)
|
|||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HALIGNMENT,
|
||||
g_param_spec_enum ("halignment", "horizontal alignment",
|
||||
"Horizontal alignment of the text",
|
||||
GES_TIMELINE_TITLE_SRC_HALIGN_TYPE, DEFAULT_PROP_HALIGNMENT,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||
GES_TEXT_HALIGN_TYPE, DEFAULT_HALIGNMENT,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
|
||||
/**
|
||||
* GESTimelineTitleSource:mute:
|
||||
*
|
||||
|
@ -227,50 +220,8 @@ ges_tl_title_src_init (GESTimelineTitleSource * self)
|
|||
GES_TIMELINE_OBJECT (self)->duration = 0;
|
||||
self->text = NULL;
|
||||
self->text = NULL;
|
||||
self->halign = DEFAULT_PROP_HALIGNMENT;
|
||||
self->valign = DEFAULT_PROP_VALIGNMENT;
|
||||
}
|
||||
|
||||
static GType
|
||||
ges_timeline_title_source_valign_get_type (void)
|
||||
{
|
||||
static GType text_overlay_valign_type = 0;
|
||||
static gsize initialized = 0;
|
||||
static const GEnumValue text_overlay_valign[] = {
|
||||
{GES_TRACK_TITLE_SRC_VALIGN_BASELINE, "baseline", "baseline"},
|
||||
{GES_TRACK_TITLE_SRC_VALIGN_BOTTOM, "bottom", "bottom"},
|
||||
{GES_TRACK_TITLE_SRC_VALIGN_TOP, "top", "top"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (g_once_init_enter (&initialized)) {
|
||||
text_overlay_valign_type =
|
||||
g_enum_register_static ("GESTimelineTitleSourceVAlign",
|
||||
text_overlay_valign);
|
||||
g_once_init_leave (&initialized, 1);
|
||||
}
|
||||
return text_overlay_valign_type;
|
||||
}
|
||||
|
||||
static GType
|
||||
ges_timeline_title_source_halign_get_type (void)
|
||||
{
|
||||
static GType text_overlay_halign_type = 0;
|
||||
static gsize initialized = 0;
|
||||
static const GEnumValue text_overlay_halign[] = {
|
||||
{GES_TRACK_TITLE_SRC_HALIGN_LEFT, "left", "left"},
|
||||
{GES_TRACK_TITLE_SRC_HALIGN_CENTER, "center", "center"},
|
||||
{GES_TRACK_TITLE_SRC_HALIGN_RIGHT, "right", "right"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
if (g_once_init_enter (&initialized)) {
|
||||
text_overlay_halign_type =
|
||||
g_enum_register_static ("GESTimelineTitleSourceHAlign",
|
||||
text_overlay_halign);
|
||||
g_once_init_leave (&initialized, 1);
|
||||
}
|
||||
return text_overlay_halign_type;
|
||||
self->halign = DEFAULT_HALIGNMENT;
|
||||
self->valign = DEFAULT_VALIGNMENT;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -320,7 +271,7 @@ ges_tl_title_src_set_font_desc (GESTimelineTitleSource * self, const gchar *
|
|||
|
||||
static void
|
||||
ges_tl_title_src_set_halign (GESTimelineTitleSource * self,
|
||||
GESTrackTitleSrcHAlign halign)
|
||||
GESTextHAlign halign)
|
||||
{
|
||||
GList *tmp;
|
||||
GESTimelineObject *object = (GESTimelineObject *) self;
|
||||
|
@ -340,7 +291,7 @@ ges_tl_title_src_set_halign (GESTimelineTitleSource * self,
|
|||
|
||||
static void
|
||||
ges_tl_title_src_set_valign (GESTimelineTitleSource * self,
|
||||
GESTrackTitleSrcVAlign valign)
|
||||
GESTextVAlign valign)
|
||||
{
|
||||
GList *tmp;
|
||||
GESTimelineObject *object = (GESTimelineObject *) self;
|
||||
|
|
|
@ -58,8 +58,8 @@ struct _GESTimelineTitleSource {
|
|||
gboolean mute;
|
||||
gchar *text;
|
||||
gchar *font_desc;
|
||||
gint halign;
|
||||
gint valign;
|
||||
GESTextVAlign halign;
|
||||
GESTextHAlign valign;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue