Commit 5525a154 authored by Pierre Baillet's avatar Pierre Baillet

.Added crop and invert selection.

.Fixed a potential segfault.
parent 585b6ad7
......@@ -478,6 +478,7 @@ on_intf_window_drag_data_received (GtkWidget *widget,
{
intf_thread_t * p_intf = GetIntf( GTK_WIDGET(widget), "intf_window" );
on_generic_drop_data_received( p_intf, data, info, 0);
if( p_intf->p_input != NULL )
{
/* FIXME: temporary hack */
......@@ -744,7 +745,6 @@ on_intf_window_destroy (GtkWidget *widget,
gtk_widget_hide(widget);
} else {
p_intf->b_die = 1;
gtk_widget_destroy(widget);
}
return TRUE;
}
......
......@@ -268,3 +268,11 @@ on_main_window_toggle (GtkMenuItem *menuitem,
void
on_delete_clicked (GtkMenuItem *menuitem,
gpointer user_data);
void
on_crop_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_invertselection_clicked (GtkMenuItem *menuitem,
gpointer user_data);
......@@ -1174,6 +1174,8 @@ create_intf_playlist (void)
GtkWidget *delete1_menu;
GtkAccelGroup *delete1_menu_accels;
guint tmp_key;
GtkWidget *crop1;
GtkWidget *invert1;
GtkWidget *selection;
GtkWidget *selection1;
GtkWidget *scrolledwindow1;
......@@ -1181,7 +1183,7 @@ create_intf_playlist (void)
GtkWidget *label22;
GtkWidget *label23;
intf_playlist = gtk_window_new (GTK_WINDOW_DIALOG);
intf_playlist = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_object_set_data (GTK_OBJECT (intf_playlist), "intf_playlist", intf_playlist);
gtk_window_set_title (GTK_WINDOW (intf_playlist), _("Playlist"));
gtk_window_set_default_size (GTK_WINDOW (intf_playlist), 386, 200);
......@@ -1221,6 +1223,28 @@ create_intf_playlist (void)
gtk_menu_item_set_submenu (GTK_MENU_ITEM (delete1), delete1_menu);
delete1_menu_accels = gtk_menu_ensure_uline_accel_group (GTK_MENU (delete1_menu));
crop1 = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (crop1)->child),
_("_crop"));
gtk_widget_add_accelerator (crop1, "activate_item", delete1_menu_accels,
tmp_key, 0, 0);
gtk_widget_ref (crop1);
gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "crop1", crop1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (crop1);
gtk_container_add (GTK_CONTAINER (delete1_menu), crop1);
invert1 = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (invert1)->child),
_("_invert"));
gtk_widget_add_accelerator (invert1, "activate_item", delete1_menu_accels,
tmp_key, 0, 0);
gtk_widget_ref (invert1);
gtk_object_set_data_full (GTK_OBJECT (intf_playlist), "invert1", invert1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (invert1);
gtk_container_add (GTK_CONTAINER (delete1_menu), invert1);
selection = gtk_menu_item_new_with_label ("");
tmp_key = gtk_label_parse_uline (GTK_LABEL (GTK_BIN (selection)->child),
_("_selection"));
......@@ -1275,6 +1299,12 @@ create_intf_playlist (void)
gtk_signal_connect (GTK_OBJECT (intf_playlist), "delete_event",
GTK_SIGNAL_FUNC (on_intf_playlist_destroy_event),
NULL);
gtk_signal_connect (GTK_OBJECT (crop1), "activate",
GTK_SIGNAL_FUNC (on_crop_activate),
NULL);
gtk_signal_connect (GTK_OBJECT (invert1), "activate",
GTK_SIGNAL_FUNC (on_invertselection_clicked),
NULL);
gtk_signal_connect (GTK_OBJECT (selection), "activate",
GTK_SIGNAL_FUNC (on_delete_clicked),
NULL);
......
......@@ -126,8 +126,11 @@ on_toolbar_playlist_clicked (GtkButton *button,
if( GTK_WIDGET_VISIBLE(p_intf->p_sys->p_playlist) ) {
gtk_widget_hide( p_intf->p_sys->p_playlist);
} else {
GtkCList * clist;
gtk_widget_show( p_intf->p_sys->p_playlist );
clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"clist1" ));
gdk_window_raise( p_intf->p_sys->p_playlist->window );
rebuildCList( clist , p_main->p_playlist );
}
}
......@@ -194,6 +197,50 @@ rebuildCList(GtkCList * clist, playlist_t * playlist_p)
gtk_clist_thaw( clist );
}
void
on_invertselection_clicked (GtkMenuItem *item, gpointer user_data)
{
int * selected, sel_l;
GtkCList * clist;
playlist_t * playlist_p;
int dummy;
/* catch the thread back */
intf_thread_t *p_intf = GetIntf( GTK_WIDGET(item), "intf_playlist" );
playlist_p = p_main->p_playlist;
/* lock the struct */
vlc_mutex_lock( &p_intf->p_sys->change_lock );
clist = GTK_CLIST( lookup_widget(p_intf->p_sys->p_playlist,"clist1") );
selected = malloc(sizeof(int)* g_list_length(clist->selection));
sel_l = g_list_length(clist->selection);
for(dummy=0; dummy < sel_l; dummy++)
{
selected[dummy] = (int)g_list_nth_data(clist->selection,dummy);
}
gtk_clist_freeze( clist );
gtk_clist_select_all( clist );
for(dummy=0; dummy < sel_l; dummy++)
{
gtk_clist_unselect_row( clist, selected[dummy],0);
gtk_clist_unselect_row( clist, selected[dummy],1);
}
free( selected );
gtk_clist_thaw( clist );
vlc_mutex_unlock( &p_intf->p_sys->change_lock );
}
void
on_crop_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
on_invertselection_clicked (menuitem, user_data);
on_delete_clicked(menuitem, user_data);
}
void
on_delete_clicked (GtkMenuItem *item,
gpointer user_data)
......
......@@ -2,7 +2,7 @@
* intf_gtk.c: Gtk+ interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: intf_gtk.c,v 1.6 2001/03/08 13:32:55 octplane Exp $
* $Id: intf_gtk.c,v 1.7 2001/03/08 15:48:14 octplane Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -204,6 +204,7 @@ static void intf_Run( intf_thread_t *p_intf )
p_intf->p_sys->p_popup = create_intf_popup( );
p_intf->p_sys->p_playlist = create_intf_playlist( );
/* Set the title of the main window */
gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),
VOUT_TITLE " (Gtk+ interface)");
......@@ -215,6 +216,8 @@ static void intf_Run( intf_thread_t *p_intf )
/* Accept file drops on the playlist window */
temp = lookup_widget(p_intf->p_sys->p_playlist, "clist1");
gtk_drag_dest_set( GTK_WIDGET( temp ),
GTK_DEST_DEFAULT_ALL, target_table,
1, GDK_ACTION_COPY );
......
......@@ -1283,7 +1283,7 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;</label>
<last_modification_time>Thu, 08 Mar 2001 10:16:44 GMT</last_modification_time>
</signal>
<title>Playlist</title>
<type>GTK_WINDOW_DIALOG</type>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<default_width>386</default_width>
......@@ -1325,6 +1325,30 @@ Henri Fallon &lt;henri@via.ecp.fr&gt;</label>
<class>GtkMenu</class>
<name>delete1_menu</name>
<widget>
<class>GtkMenuItem</class>
<name>crop1</name>
<signal>
<name>activate</name>
<handler>on_crop_activate</handler>
<last_modification_time>Thu, 08 Mar 2001 15:12:17 GMT</last_modification_time>
</signal>
<label>_crop</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>invert1</name>
<signal>
<name>activate</name>
<handler>on_invertselection_clicked</handler>
<last_modification_time>Thu, 08 Mar 2001 15:12:17 GMT</last_modification_time>
</signal>
<label>_invert</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>selection</name>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment