annotate gui/mplayer/gtk/mb.c @ 28711:5669ee1ebe39

Use YUV420P code path for YUVA420P where appropriate
author sdrik
date Fri, 27 Feb 2009 22:13:55 +0000
parents e16088a911c1
children 0f1b5b68af32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26458
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
1 /*
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
2 * This file is part of MPlayer.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
3 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
5 * it under the terms of the GNU General Public License as published by
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
7 * (at your option) any later version.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
8 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
12 * GNU General Public License for more details.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
13 *
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
14 * You should have received a copy of the GNU General Public License along
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
17 */
b0a7b35b78d2 Add standard GPL header to individual files.
diego
parents: 26382
diff changeset
18
26203
0d255d03016f #include config.h before all other headers.
diego
parents: 25601
diff changeset
19 #include "config.h"
26365
10dfbc523184 Add gui/ prefix to some #include paths so that compilation from the
diego
parents: 26203
diff changeset
20 #include "gui/app.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
21 #include "help_mp.h"
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
22
27463
e16088a911c1 consistency cosmetics: Avoid using .. in #include paths.
diego
parents: 26458
diff changeset
23 #include "gui/mplayer/pixmaps/error.xpm"
e16088a911c1 consistency cosmetics: Avoid using .. in #include paths.
diego
parents: 26458
diff changeset
24 #include "gui/mplayer/pixmaps/warning.xpm"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
25
26382
b2f4abcf20ed Make include paths consistent; do not use ../ in them.
diego
parents: 26365
diff changeset
26 #include "gui/mplayer/widgets.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
27 #include "mb.h"
25601
8a0adeba5910 Rename common.[ch] to gtk_common.[ch], there are too many files by that name.
diego
parents: 23077
diff changeset
28 #include "gtk_common.h"
23077
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
29
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
30 GtkWidget * gtkMessageBoxText;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
31 GtkWidget * MessageBox = NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
32
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
33 void ShowMessageBox( const char * msg )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
34 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
35 if ( MessageBox ) { gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
36 MessageBox=create_MessageBox( 0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
37 if ( strlen( msg ) < 20 ) gtk_widget_set_usize( MessageBox,196,-1 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
38 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
39
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
40 static void on_Ok_released( GtkButton * button,gpointer user_data )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
41 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
42 gtk_widget_hide( MessageBox );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
43 gtk_widget_destroy( MessageBox );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
44 MessageBox=NULL;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
45 }
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
46
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
47 GtkWidget * create_MessageBox( int type )
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
48 {
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
49 GtkWidget * vbox1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
50 GtkWidget * hbox1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
51 GtkWidget * hbuttonbox1;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
52 GtkWidget * Ok;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
53 GtkAccelGroup * accel_group;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
54 GtkStyle * pixmapstyle;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
55 GdkPixmap * pixmapwid;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
56 GdkBitmap * mask;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
57
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
58 accel_group=gtk_accel_group_new();
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
59
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
60 MessageBox=gtk_window_new( GTK_WINDOW_TOPLEVEL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
61 gtk_widget_set_name( MessageBox,"MessageBox" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
62 gtk_object_set_data( GTK_OBJECT( MessageBox ),"MessageBox",MessageBox );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
63 gtk_widget_set_events( MessageBox,GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
64 gtk_window_set_title( GTK_WINDOW( MessageBox ),"MPlayer ..." );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
65 gtk_window_set_position( GTK_WINDOW( MessageBox ),GTK_WIN_POS_CENTER );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
66 gtk_window_set_modal( GTK_WINDOW( MessageBox ),TRUE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
67 gtk_window_set_policy( GTK_WINDOW( MessageBox ),TRUE,TRUE,FALSE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
68 gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message","MPlayer" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
69
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
70 gtk_widget_realize( MessageBox );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
71 gtkAddIcon( MessageBox );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
72
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
73 vbox1=AddVBox( AddDialogFrame( MessageBox ),0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
74 hbox1=AddHBox( vbox1,1 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
75
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
76 pixmapstyle=gtk_widget_get_style( MessageBox );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
77
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
78 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
79 WarningPixmap=gtk_pixmap_new( pixmapwid,mask );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
80 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
81 ErrorPixmap=gtk_pixmap_new( pixmapwid,mask );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
82
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
83 gtk_widget_set_name( WarningPixmap,"pixmap1" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
84 gtk_widget_hide( WarningPixmap );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
85 gtk_box_pack_start( GTK_BOX( hbox1 ),WarningPixmap,FALSE,FALSE,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
86 gtk_widget_set_usize( WarningPixmap,55,-2 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
87
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
88 gtk_widget_set_name( ErrorPixmap,"pixmap1" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
89 gtk_widget_hide( ErrorPixmap );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
90 gtk_box_pack_start( GTK_BOX( hbox1 ),ErrorPixmap,FALSE,FALSE,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
91 gtk_widget_set_usize( ErrorPixmap,55,-2 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
92
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
93 gtkMessageBoxText=gtk_label_new( "Text jol. Ha ezt megerted,akkor neked nagyon jo a magyar tudasod,te." );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
94 gtk_widget_set_name( gtkMessageBoxText,"gtkMessageBoxText" );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
95 gtk_widget_show( gtkMessageBoxText );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
96 gtk_box_pack_start( GTK_BOX( hbox1 ),gtkMessageBoxText,TRUE,TRUE,0 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
97 // gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
98 gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_CENTER );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
99 gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),FALSE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
100
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
101 AddHSeparator( vbox1 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
102 hbuttonbox1=AddHButtonBox( vbox1 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
103 Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
104
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
105 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
106 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
107
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
108 gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&MessageBox );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
109 gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
110
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
111 gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group );
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
112
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
113 return MessageBox;
17bf4f4b0715 Gui --> gui
diego
parents:
diff changeset
114 }