11.06.11 18:59, Maksym Veremeyenko написав(ла):
Hi,

next e-mails will be attached with a patches makes (IMHO) more
comfortable work with rugen.

[...]
*0004-join-clips-and-status-control-to-same-operate-page.patch* - adds a
common wrapper for page_clips and page_status to join them into the same
page



--
________________________________________
Maksym Veremeyenko
>From e2f5473fd145b558dc19c5d07c05061a2120e2b8 Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko <ve...@m1stereo.tv>
Date: Sat, 11 Jun 2011 18:18:59 +0300
Subject: [PATCH 4/6] join clips and status control to same 'operate' page

---
 src/Makefile.am    |    1 +
 src/dv1394app.c    |    3 +-
 src/interface.c    |   25 +++--------
 src/interface.h    |    3 +-
 src/page.h         |    5 +-
 src/page_clips.c   |    7 ++-
 src/page_operate.c |  122 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/page_status.c  |    8 ++-
 8 files changed, 144 insertions(+), 30 deletions(-)
 create mode 100644 src/page_operate.c

diff --git a/src/Makefile.am b/src/Makefile.am
index 4f30e03..6bc5baa 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,7 @@ rugen_SOURCES = \
 	page_command.c \
 	page_status.c \
 	page_units.c \
+	page_operate.c \
 	gtkenhancedscale.c gtkenhancedscale.h
 
 rugen_CFLAGS = `pkg-config --cflags gthread-2.0 mlt-melted mlt-mvcp`
diff --git a/src/dv1394app.c b/src/dv1394app.c
index b1919ae..c462b50 100644
--- a/src/dv1394app.c
+++ b/src/dv1394app.c
@@ -401,8 +401,7 @@ dv1394app dv1394app_init( GtkWidget *window, char *instance )
 //		gtk_signal_connect( GTK_OBJECT( widget ), "clicked", GTK_SIGNAL_FUNC( on_item_quit_activate ), this );
 		
 		/* Initialise the pages. */
-		dv1394app_register_page( this, page_status_init( this ) );
-		dv1394app_register_page( this, page_clips_init( this ) );
+		dv1394app_register_page( this, page_operate_init( this ) );
 		dv1394app_register_page( this, page_command_init( this ) );
 		this->guard = 1;
 		gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( this->page_buttons[ 0 ] ), TRUE );
diff --git a/src/interface.c b/src/interface.c
index 3720315..adc7b86 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -554,21 +554,7 @@ static GtkWidget* create_pane_status (GtkWidget* parent, GtkWidget* top)
 }
 
 GtkWidget*
-create_page_status (void)
-{
-	GtkWidget *page_status;
-
-	page_status = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-	gtk_window_set_title (GTK_WINDOW (page_status), _("page_status"));
-	GLADE_HOOKUP_OBJECT_NO_REF (page_status, page_status, "page_status");
-
-	create_pane_status (page_status, page_status);
-
-	return page_status;
-}
-
-GtkWidget*
-create_page_clips (void)
+create_page_operate (void)
 {
   GtkWidget *page_clips;
   GtkWidget *vbox8;
@@ -618,7 +604,8 @@ create_page_clips (void)
   GtkWidget *frame1, *frame2;
 
   page_clips = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  gtk_window_set_title (GTK_WINDOW (page_clips), _("page_clips"));
+  gtk_window_set_title (GTK_WINDOW (page_clips), _("page_operate"));
+  GLADE_HOOKUP_OBJECT_NO_REF (page_clips, page_clips, "page_operate");
 
   hpaned0 = gtk_hpaned_new ();
   gtk_widget_show (hpaned0);
@@ -630,7 +617,9 @@ create_page_clips (void)
   gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN);
   gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_IN);
   gtk_widget_show(frame1);
+  GLADE_HOOKUP_OBJECT (page_clips, frame1, "page_clips");
   gtk_widget_show(frame2);
+  GLADE_HOOKUP_OBJECT (page_clips, frame2, "page_status");
 
   gtk_widget_set_size_request (hpaned0, 200 , -1);
   gtk_paned_pack1 (GTK_PANED (hpaned0), frame1, TRUE, FALSE);
@@ -638,8 +627,7 @@ create_page_clips (void)
   gtk_paned_pack2 (GTK_PANED (hpaned0), frame2, FALSE, FALSE);
   gtk_widget_set_size_request (frame2, 250, -1);
 
-//  create_pane_status (page_clips, frame2);
-//  GLADE_HOOKUP_OBJECT_NO_REF (page_status, page_status, "page_status");
+  create_pane_status (frame2, page_clips);
 
   vbox8 = gtk_vbox_new (FALSE, 0);
   gtk_widget_show (vbox8);
@@ -859,7 +847,6 @@ create_page_clips (void)
   gtk_label_set_justify (GTK_LABEL (label45), GTK_JUSTIFY_LEFT);
 
   /* Store pointers to all widgets, for use by lookup_widget(). */
-  GLADE_HOOKUP_OBJECT_NO_REF (page_clips, page_clips, "page_clips");
   GLADE_HOOKUP_OBJECT (page_clips, vbox8, "vbox8");
   GLADE_HOOKUP_OBJECT (page_clips, hbox26, "hbox26");
   GLADE_HOOKUP_OBJECT (page_clips, label_directory, "label_directory");
diff --git a/src/interface.h b/src/interface.h
index 07ec112..df95306 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -4,6 +4,5 @@
 
 GtkWidget* create_gdv1394d (void);
 GtkWidget* create_window_connection (void);
-GtkWidget* create_page_status (void);
-GtkWidget* create_page_clips (void);
+GtkWidget* create_page_operate (void);
 GtkWidget* create_page_shell (void);
diff --git a/src/page.h b/src/page.h
index c3403c0..7f54f4a 100644
--- a/src/page.h
+++ b/src/page.h
@@ -48,9 +48,10 @@ extern void page_show_status( page, mvcp_status );
 extern void page_close( page );
 
 /* page factories */
-extern page page_clips_init( dv1394app );
+extern page page_clips_init( dv1394app, struct page_t* );
 extern page page_command_init( dv1394app );
-extern page page_status_init( dv1394app );
+extern page page_status_init( dv1394app, struct page_t* );
 extern page page_units_init( dv1394app );
+extern page page_operate_init( dv1394app );
 
 #endif
diff --git a/src/page_clips.c b/src/page_clips.c
index 173f97e..aeefc74 100644
--- a/src/page_clips.c
+++ b/src/page_clips.c
@@ -47,6 +47,8 @@ typedef struct
 	// TODO: This comes out later
 	int mode;
 	GtkWidget *modes[ 4 ];
+
+	struct page_t *parent_page;
 }
 *page_clips, page_clips_t;
 
@@ -488,7 +490,7 @@ void on_mode_change( GtkMenuItem *menuitem, gpointer data )
 static GtkWidget *this_page_get_widget( page_clips this )
 {
 	if ( this->widget == NULL )
-		this->widget = create_page_clips( );
+		this->widget = this->parent_page->get_widget(this->parent_page);
 	return this->widget;
 }
 
@@ -533,12 +535,13 @@ static void this_page_close( page_clips this )
 		free( this );
 }
 
-page page_clips_init( dv1394app app )
+page page_clips_init( dv1394app app, struct page_t *parent_page)
 {
 	page_clips this = calloc( 1, sizeof( page_clips_t ) );
 	GtkWidget *widget;
 	int index = 0;
 
+	this->parent_page = parent_page;
 	this->parent.get_widget = ( GtkWidget *(*)( page ) )this_page_get_widget;
 	this->parent.get_toolbar_info = this_page_get_toolbar_info;
 	this->parent.on_connect = ( void (*)( page ) )this_page_on_connect;
diff --git a/src/page_operate.c b/src/page_operate.c
new file mode 100644
index 0000000..2cb9d63
--- /dev/null
+++ b/src/page_operate.c
@@ -0,0 +1,122 @@
+/*
+ * page_status.c -- Status Page Handling
+ * Copyright (C) 2002-2003 Charles Yates <charles.ya...@pandora.be>
+ * Copyright (C) 2010 Dan Dennedy <d...@dennedy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gtk/gtk.h>
+
+#include "interface.h"
+#include "support.h"
+#include "dv1394app.h"
+#include "page.h"
+
+typedef struct
+{
+	struct page_t parent;
+	dv1394app app;
+	GtkWidget *widget;
+	page status;
+	page clips;
+}
+*page_operate, page_operate_t;
+
+static GtkWidget *this_page_get_widget( page super )
+{
+	page_operate this = ( page_operate )super;
+	if ( this->widget == NULL )
+		this->widget = create_page_operate( );
+	return this->widget;
+}
+
+static void this_page_get_toolbar_info( page super, GtkIconSize size, GtkWidget **icon, char **label )
+{
+	page_operate this = ( page_operate )super;
+
+	if ( this != NULL )
+	{
+		*icon = gtk_image_new_from_stock( "gtk-justify-fill",  size );
+		*label = _("_Operate");
+	}
+}
+
+static void this_page_on_connect( page super )
+{
+	page_operate this = ( page_operate )super;
+
+	if ( this != NULL )
+	{
+		this->clips->on_connect(this->clips);
+		this->status->on_connect(this->status);
+	}
+}
+
+static void this_page_on_disconnect( page super )
+{
+	page_operate this = ( page_operate )super;
+
+	if ( this != NULL )
+	{
+		this->clips->on_disconnect(this->clips);
+		this->status->on_disconnect(this->status);
+	}
+}
+
+static void this_page_close( page super )
+{
+	page_operate this = ( page_operate )super;
+
+	if ( this != NULL )
+	{
+		this->clips->close(this->clips);
+		this->status->close(this->status);
+		free( this );
+	}
+}
+
+static void this_page_show_status( page super, mvcp_status status )
+{
+	page_operate this = ( page_operate )super;
+
+	if ( this != NULL )
+		this->clips->show_status(this->clips, status);
+}
+
+
+page page_operate_init( dv1394app app )
+{
+	page_operate this = calloc( 1, sizeof( page_operate_t ) );
+
+	this->parent.get_widget = this_page_get_widget;
+	this->parent.get_toolbar_info = this_page_get_toolbar_info;
+	this->parent.on_connect = this_page_on_connect;
+	this->parent.on_disconnect = this_page_on_disconnect;
+	this->parent.close = this_page_close;
+	this->parent.show_status = this_page_show_status;
+
+	this->clips = page_clips_init( app, (page)this);
+	this->status = page_status_init( app, (page)this );
+
+	return ( page )this;
+}
diff --git a/src/page_status.c b/src/page_status.c
index 1ca9487..aec2168 100644
--- a/src/page_status.c
+++ b/src/page_status.c
@@ -43,6 +43,7 @@ typedef struct
 	guint context;
 	int unit;
 	int count;
+	struct page_t *parent_page;
 }
 *page_status, page_status_t;
 
@@ -261,7 +262,7 @@ static GtkWidget *this_page_get_widget( page super )
 {
 	page_status this = ( page_status )super;
 	if ( this->widget == NULL )
-		this->widget = create_page_status( );
+		this->widget = this->parent_page->get_widget(this->parent_page);
 	return this->widget;
 }
 
@@ -305,12 +306,13 @@ static void this_page_close( page super )
 		free( this );
 }
 
-page page_status_init( dv1394app app )
+page page_status_init( dv1394app app, struct page_t *parent_page )
 {
 	page_status this = calloc( 1, sizeof( page_status_t ) );
 	int index = 0;
 	GtkWidget *widget;
-	
+
+	this->parent_page = parent_page;
 	this->parent.get_widget = this_page_get_widget;
 	this->parent.get_toolbar_info = this_page_get_toolbar_info;
 	this->parent.on_connect = this_page_on_connect;
-- 
1.7.4.4

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to