static gboolean _roll_start (GESTimelineElement * element, GstClockTime start);
static gboolean _roll_end (GESTimelineElement * element, GstClockTime end);
static gboolean _trim (GESTimelineElement * element, GstClockTime start);
+static void _compute_height (GESContainer * container);
G_DEFINE_ABSTRACT_TYPE (GESClip, ges_clip, GES_TYPE_CONTAINER);
_set_priority0 (child, real_tck_prio);
}
_ges_container_set_children_control_mode (container, GES_CHILDREN_UPDATE);
+ _compute_height (container);
return TRUE;
}
* *
****************************************************/
-static guint32
+static void
_compute_height (GESContainer * container)
{
GList *tmp;
guint32 min_prio = G_MAXUINT32, max_prio = 0;
- if (container->children == NULL)
- return 0;
+ if (container->children == NULL) {
+ /* FIXME Why not 0! */
+ _ges_container_set_height (container, 1);
+ return;
+ }
/* Go over all childs and check if height has changed */
for (tmp = container->children; tmp; tmp = tmp->next) {
max_prio = tck_priority;
}
- return max_prio - min_prio + 1;
+ _ges_container_set_height (container, max_prio - min_prio + 1);
}
static void
}
static void
+_child_added (GESContainer * container, GESTimelineElement * element)
+{
+ _compute_height (container);
+}
+
+static void
+_child_removed (GESContainer * container, GESTimelineElement * element)
+{
+ _compute_height (container);
+}
+
+static void
add_tlobj_to_list (gpointer key, gpointer tlobj, GList ** list)
{
*list = g_list_prepend (*list, gst_object_ref (tlobj));
/* TODO implement the deep_copy Virtual method */
container_class->get_priority_range = _get_priority_range;
- container_class->compute_height = _compute_height;
container_class->add_child = _add_child;
container_class->remove_child = _remove_child;
+ container_class->child_removed = _child_removed;
+ container_class->child_added = _child_added;
container_class->ungroup = _ungroup;
container_class->group = _group;
container_class->grouping_priority = G_MAXUINT;
* Private methods *
************************/
static void
-update_height (GESContainer * container)
-{
- guint32 height;
-
- height = GES_CONTAINER_GET_CLASS (container)->compute_height (container);
-
- if (container->height != height) {
- container->height = height;
- GST_DEBUG_OBJECT (container, "Updating height %i", container->height);
- g_object_notify (G_OBJECT (container), "height");
- }
-}
-
-static void
_free_mapping (ChildMapping * mapping)
{
GESTimelineElement *child = mapping->child;
if (priv->children_control_mode == GES_CHILDREN_IGNORE_NOTIFIES)
return;
- update_height (container);
-
/* Update mapping */
map = g_hash_table_lookup (priv->mappings, child);
g_assert (map);
GESChildrenControlMode children_control_mode)
{
container->priv->children_control_mode = children_control_mode;
+}
- if (children_control_mode == GES_CHILDREN_UPDATE)
- update_height (container);
-
+void
+_ges_container_set_height (GESContainer * container, guint32 height)
+{
+ if (container->height != height) {
+ container->height = height;
+ GST_DEBUG_OBJECT (container, "Updating height %i", container->height);
+ g_object_notify (G_OBJECT (container), "height");
+ }
}
/**********************************************
mapping->priority_notifyid =
g_signal_connect (G_OBJECT (child), "notify::priority",
G_CALLBACK (_child_priority_changed_cb), container);
- update_height (container);
if (ges_timeline_element_set_parent (child, GES_TIMELINE_ELEMENT (container))
* @ungroup: Ungroups the #GESTimelineElement contained in this #GESContainer, creating new
* @group: Groups the #GESContainers together
* #GESContainer containing those #GESTimelineElement apropriately.
- * @compute_height: Return the @height of the container
*/
struct _GESContainerClass
{
void (*get_priority_range) (GESContainer *container, guint32 *min_prio, guint32 *max_prio);
GList* (*ungroup) (GESContainer *container, gboolean recursive);
GESContainer * (*group) (GList *containers);
- guint32 (*compute_height) (GESContainer *container);
gboolean (*edit) (GESContainer * container,
GList * layers, gint new_layer_priority,
GESEditMode mode,
/* To be used by subclasses only */
void _ges_container_set_children_control_mode (GESContainer * container,
GESChildrenControlMode children_control_mode);
+void _ges_container_set_height (GESContainer * container,
+ guint32 height);
gboolean ges_container_edit (GESContainer * container,
GList * layers, gint new_layer_priority,
GESEditMode mode,