mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-07-02 04:35:55 +00:00
add object-moved signal to simple timeline layer
This commit is contained in:
parent
98e070d412
commit
cd9ad5302e
|
@ -38,6 +38,7 @@
|
||||||
#include "ges-timeline-object.h"
|
#include "ges-timeline-object.h"
|
||||||
#include "ges-timeline-source.h"
|
#include "ges-timeline-source.h"
|
||||||
#include "ges-timeline-transition.h"
|
#include "ges-timeline-transition.h"
|
||||||
|
#include "gesmarshal.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ges_simple_timeline_layer_object_removed (GESTimelineLayer * layer,
|
ges_simple_timeline_layer_object_removed (GESTimelineLayer * layer,
|
||||||
|
@ -54,6 +55,14 @@ timeline_object_height_changed_cb (GESTimelineObject * object G_GNUC_UNUSED,
|
||||||
G_DEFINE_TYPE (GESSimpleTimelineLayer, ges_simple_timeline_layer,
|
G_DEFINE_TYPE (GESSimpleTimelineLayer, ges_simple_timeline_layer,
|
||||||
GES_TYPE_TIMELINE_LAYER);
|
GES_TYPE_TIMELINE_LAYER);
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
OBJECT_MOVED,
|
||||||
|
LAST_SIGNAL,
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint gstl_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ges_simple_timeline_layer_get_property (GObject * object,
|
ges_simple_timeline_layer_get_property (GObject * object,
|
||||||
guint property_id, GValue * value, GParamSpec * pspec)
|
guint property_id, GValue * value, GParamSpec * pspec)
|
||||||
|
@ -100,6 +109,14 @@ ges_simple_timeline_layer_class_init (GESSimpleTimelineLayerClass * klass)
|
||||||
/* Be informed when objects are being added/removed from elsewhere */
|
/* Be informed when objects are being added/removed from elsewhere */
|
||||||
layer_class->object_removed = ges_simple_timeline_layer_object_removed;
|
layer_class->object_removed = ges_simple_timeline_layer_object_removed;
|
||||||
layer_class->object_added = ges_simple_timeline_layer_object_added;
|
layer_class->object_added = ges_simple_timeline_layer_object_added;
|
||||||
|
|
||||||
|
gstl_signals[OBJECT_MOVED] =
|
||||||
|
g_signal_new ("object-moved", G_TYPE_FROM_CLASS (klass),
|
||||||
|
G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (GESSimpleTimelineLayerClass,
|
||||||
|
object_moved),
|
||||||
|
NULL, NULL,
|
||||||
|
ges_marshal_VOID__OBJECT_INT_INT, G_TYPE_NONE, 3,
|
||||||
|
GES_TYPE_TIMELINE_OBJECT, G_TYPE_INT, G_TYPE_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -317,13 +334,18 @@ ges_simple_timeline_layer_move_object (GESSimpleTimelineLayer * layer,
|
||||||
/* pop it off the list */
|
/* pop it off the list */
|
||||||
layer->objects = g_list_remove (layer->objects, object);
|
layer->objects = g_list_remove (layer->objects, object);
|
||||||
|
|
||||||
|
newposition = (newposition >= 0 && newposition < idx) ? newposition :
|
||||||
|
newposition - 1;
|
||||||
|
|
||||||
/* re-add it at the proper position */
|
/* re-add it at the proper position */
|
||||||
layer->objects = g_list_insert (layer->objects, object, (newposition >= 0
|
layer->objects = g_list_insert (layer->objects, object, newposition);
|
||||||
&& newposition < idx) ? newposition : newposition - 1);
|
|
||||||
|
|
||||||
/* recalculate positions */
|
/* recalculate positions */
|
||||||
gstl_recalculate (layer);
|
gstl_recalculate (layer);
|
||||||
|
|
||||||
|
g_signal_emit (layer, gstl_signals[OBJECT_MOVED], 0, object, idx,
|
||||||
|
newposition);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,10 @@ struct _GESSimpleTimelineLayer {
|
||||||
|
|
||||||
struct _GESSimpleTimelineLayerClass {
|
struct _GESSimpleTimelineLayerClass {
|
||||||
GESTimelineLayerClass parent_class;
|
GESTimelineLayerClass parent_class;
|
||||||
|
/*< signals >*/
|
||||||
|
|
||||||
|
void (*object_moved) (GESTimelineLayer * layer, GESTimelineObject * object,
|
||||||
|
gint old_position, gint new_position);
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
VOID:OBJECT
|
VOID:OBJECT
|
||||||
|
VOID:OBJECT,INT,INT
|
||||||
|
|
Loading…
Reference in a new issue