mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
712d5d0a48
Original commit message from CVS: Initial work for the new editor.
211 lines
6.3 KiB
C
211 lines
6.3 KiB
C
/* Gnome-Streamer
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Library General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Library General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this library; if not, write to the
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
* Boston, MA 02111-1307, USA.
|
|
*/
|
|
|
|
|
|
#include <gnome.h>
|
|
#include <gst/gst.h>
|
|
|
|
#include <glade/glade.h>
|
|
#include "gsteditorproject.h"
|
|
#include "gsteditorpalette.h"
|
|
#include "gsteditorproperty.h"
|
|
#include "gsteditorimage.h"
|
|
|
|
/* class functions */
|
|
static void gst_editor_project_view_class_init(GstEditorProjectViewClass *klass);
|
|
static void gst_editor_project_view_init(GstEditorProjectView *project_view);
|
|
static void gst_editor_project_view_set_arg(GtkObject *object,GtkArg *arg,guint id);
|
|
static void gst_editor_project_view_get_arg(GtkObject *object,GtkArg *arg,guint id);
|
|
|
|
enum {
|
|
ARG_0,
|
|
};
|
|
|
|
enum {
|
|
LAST_SIGNAL
|
|
};
|
|
|
|
static GtkObjectClass *parent_class;
|
|
//static guint gst_editor_project_view_signals[LAST_SIGNAL] = { 0 };
|
|
|
|
GtkType gst_editor_project_view_get_type() {
|
|
static GtkType project_view_type = 0;
|
|
|
|
if (!project_view_type) {
|
|
static const GtkTypeInfo project_view_info = {
|
|
"GstEditorProjectView",
|
|
sizeof(GstEditorProjectView),
|
|
sizeof(GstEditorProjectViewClass),
|
|
(GtkClassInitFunc)gst_editor_project_view_class_init,
|
|
(GtkObjectInitFunc)gst_editor_project_view_init,
|
|
NULL,
|
|
NULL,
|
|
(GtkClassInitFunc)NULL,
|
|
};
|
|
project_view_type = gtk_type_unique(gtk_object_get_type(),&project_view_info);
|
|
}
|
|
return project_view_type;
|
|
}
|
|
|
|
static void gst_editor_project_view_class_init(GstEditorProjectViewClass *klass) {
|
|
GtkObjectClass *object_class;
|
|
|
|
object_class = (GtkObjectClass*)klass;
|
|
|
|
parent_class = gtk_type_class(gtk_object_get_type());
|
|
|
|
object_class->set_arg = gst_editor_project_view_set_arg;
|
|
object_class->get_arg = gst_editor_project_view_get_arg;
|
|
}
|
|
|
|
static void gst_editor_project_view_init(GstEditorProjectView *project) {
|
|
}
|
|
|
|
typedef struct {
|
|
GstEditorProject *project;
|
|
GModule *symbols;
|
|
} connect_struct;
|
|
|
|
/* we need more control here so... */
|
|
static void gst_editor_project_connect_func (const gchar *handler_name,
|
|
GtkObject *object,
|
|
const gchar *signal_name,
|
|
const gchar *signal_data,
|
|
GtkObject *connect_object,
|
|
gboolean after,
|
|
gpointer user_data)
|
|
{
|
|
GtkSignalFunc func;
|
|
connect_struct *data = (connect_struct *)user_data;
|
|
|
|
if (!g_module_symbol(data->symbols, handler_name, (gpointer *)&func))
|
|
g_warning("GstEditorProject: could not find signal handler '%s'.", handler_name);
|
|
else {
|
|
if (after)
|
|
gtk_signal_connect_after(object, signal_name, func, (gpointer) data->project);
|
|
else
|
|
gtk_signal_connect(object, signal_name, func, (gpointer) data->project);
|
|
}
|
|
}
|
|
|
|
static void gst_editor_project_element_selected(GstEditorProjectView *view, GtkType type, GstEditorPalette *palette) {
|
|
GstElement *element;
|
|
|
|
element = gtk_type_new(type);
|
|
|
|
g_return_if_fail(element != NULL);
|
|
g_return_if_fail(GST_IS_ELEMENT(element));
|
|
|
|
gst_editor_project_add_toplevel_element(view->project, element);
|
|
}
|
|
|
|
static void on_name_change(GstEditorProjectView *view, GstEditorElement *element, GstEditor *editor) {
|
|
gint row;
|
|
gchar *text;
|
|
guint8 spacing;
|
|
GdkPixmap *pixmap;
|
|
GdkBitmap *mask;
|
|
|
|
row = gtk_clist_find_row_from_data(GTK_CLIST(view->list), editor);
|
|
|
|
gtk_clist_get_pixtext(GTK_CLIST(view->list), row, 0, &text, &spacing, &pixmap, &mask);
|
|
gtk_clist_set_pixtext(GTK_CLIST(view->list), row, 0, gst_editor_get_name(editor),
|
|
spacing, pixmap, mask);
|
|
}
|
|
|
|
static void view_on_element_added(GstEditorProjectView *view, GstElement *element) {
|
|
gchar *name;
|
|
gint row;
|
|
GstEditorImage *image;
|
|
GstEditor *editor;
|
|
|
|
image = gst_editor_image_get_for_type(GTK_OBJECT_TYPE(element));
|
|
name = gst_element_get_name(element);
|
|
row = gtk_clist_append(GTK_CLIST(view->list), &name);
|
|
editor = gst_editor_new(element);
|
|
|
|
gtk_signal_connect_object(GTK_OBJECT(editor), "name_changed", on_name_change, GTK_OBJECT(view));
|
|
gtk_clist_set_row_data(GTK_CLIST(view->list), row, editor);
|
|
gtk_clist_set_pixtext(GTK_CLIST(view->list), row, 0, name, 3, image->pixmap, image->bitmap);
|
|
}
|
|
|
|
GstEditorProjectView *gst_editor_project_view_new(GstEditorProject *project) {
|
|
GstEditorProjectView *view;
|
|
GtkWidget *main_window;
|
|
connect_struct data;
|
|
GModule *symbols;
|
|
GstEditorPalette *palette;
|
|
|
|
view = GST_EDITOR_PROJECT_VIEW(gtk_type_new(GST_TYPE_EDITOR_PROJECT_VIEW));
|
|
|
|
view->project = project;
|
|
|
|
symbols = g_module_open(NULL, 0);
|
|
|
|
data.project = project;
|
|
data.symbols = symbols;
|
|
|
|
view->xml = glade_xml_new("editor.glade", "main_project_window");
|
|
glade_xml_signal_autoconnect_full (view->xml, gst_editor_project_connect_func, &data);
|
|
|
|
gtk_signal_connect_object(GTK_OBJECT(project), "element_added", view_on_element_added, GTK_OBJECT(view));
|
|
|
|
main_window = glade_xml_get_widget(view->xml, "main_project_window");
|
|
gtk_widget_show(main_window);
|
|
|
|
palette = gst_editor_palette_new();
|
|
gtk_signal_connect_object(GTK_OBJECT(palette), "element_selected", gst_editor_project_element_selected, GTK_OBJECT(view));
|
|
|
|
view->list = glade_xml_get_widget(view->xml, "clist1");
|
|
gtk_clist_set_row_height(GTK_CLIST(view->list), 21);
|
|
|
|
gst_editor_property_get();
|
|
|
|
return view;
|
|
}
|
|
|
|
static void gst_editor_project_view_set_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|
GstEditorProjectView *project_view;
|
|
|
|
/* get the major types of this object */
|
|
project_view = GST_EDITOR_PROJECT_VIEW(object);
|
|
|
|
switch (id) {
|
|
default:
|
|
g_warning("gsteditorproject_view: unknown arg!");
|
|
break;
|
|
}
|
|
}
|
|
|
|
static void gst_editor_project_view_get_arg(GtkObject *object,GtkArg *arg,guint id) {
|
|
GstEditorProjectView *project_view;
|
|
|
|
/* get the major types of this object */
|
|
project_view = GST_EDITOR_PROJECT_VIEW(object);
|
|
|
|
switch (id) {
|
|
default:
|
|
arg->type = GTK_TYPE_INVALID;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|