28
28
#include "../pixmaps/ff_up_small.xpm"
29
29
#include "../pixmaps/rew_down_small.xpm"
30
30
#include "../pixmaps/rew_up_small.xpm"
31
#include "../pixmaps/volume.xpm"
31
32
#include "../pixmaps/fs_down_small.xpm"
32
33
#include "../pixmaps/fs_up_small.xpm"
97
94
italic = XGetAtomName(dpy, GetFontAtom(dpy, fstr, "SLANT"));
98
95
size = GetFontAtom(dpy, fstr, "PIXEL_SIZE");
99
96
XFreeFontInfo(NULL, fstr, 0);
101
98
sprintf(fontname, "-*-%s-%s-%s-*--%d-*",
102
99
family, bold, italic, (int) size);
103
100
instance->font = XCreateFontSet(dpy,
137
134
gdk_pixbuf_new_from_xpm_data((const char **) rew_up_small);
138
135
instance->pb_sm_rew_down =
139
136
gdk_pixbuf_new_from_xpm_data((const char **) rew_down_small);
137
instance->pb_sm_vol =
138
gdk_pixbuf_new_from_xpm_data((const char **) volume);
140
139
instance->pb_sm_fs_up =
141
140
gdk_pixbuf_new_from_xpm_data((const char **) fs_up_small);
142
141
instance->pb_sm_fs_down =
175
174
instance->pb_sm_rew_down =
176
175
gdk_pixmap_create_from_xpm_d(instance->gtkwidget->window,
177
176
NULL, NULL, rew_down_small);
177
instance->pb_sm_vol =
178
gdk_pixmap_create_from_xpm_d(instance->gtkwidget->window,
178
180
instance->pb_sm_fs_up =
179
181
gdk_pixmap_create_from_xpm_d(instance->gtkwidget->window,
180
182
NULL, NULL, fs_up_small);
815
void fs_callback(GtkWidget * widget, GdkEventExpose * event,
816
nsPluginInstance * instance)
817
gboolean vol_callback(GtkWidget * widget, GdkEvent * event,
818
nsPluginInstance * instance)
821
if (event->type == GDK_SCROLL) {
822
if (((GdkEventScroll *) event)->direction == GDK_SCROLL_UP) {
823
instance->VolumeUp();
825
instance->VolumeDown();
829
if (event->type == GDK_BUTTON_PRESS) {
830
switch (((GdkEventButton *)event)->button) {
832
instance->VolumeUp();
835
instance->VolumeDown();
843
gboolean gtkgui_setvolumetip(void *data)
846
nsPluginInstance *instance;
848
instance = (nsPluginInstance *) data;
850
snprintf(tiptext, 1024, _("Volume %i%%"), instance->volume);
852
if (instance->vol_tooltip != NULL) {
853
gtk_tooltips_set_tip(instance->vol_tooltip,
854
instance->vol_event_box, tiptext, NULL);
861
gboolean fs_callback(GtkWidget * widget, GdkEventExpose * event,
862
nsPluginInstance * instance)
819
868
printf("fs_callback clicked\n");
820
869
if (instance == NULL)
823
873
if (instance->panel_drawn == 0 && instance->controlsvisible == 1)
876
fs_state = instance->fullscreen;
826
878
if (instance->controlsvisible == 1) {
827
879
if (instance->panel_height > 16)
863
915
gtk_widget_show(instance->fixed_container);
918
// printf("****\nfs_state = %i\nfullscreen = %i\n****\n",fs_state,instance->fullscreen);
919
while (gtk_events_pending())
920
gtk_main_iteration();
921
if (fs_state == 1 && instance->fullscreen == 0) {
868
929
gboolean keyboard_callback(GtkWidget * widget, GdkEventKey * event,
966
1027
gboolean mediaprogress_callback(GtkWidget * widget, GdkEventButton * event,
967
1028
nsPluginInstance * instance)
971
1031
float bytepercent;
974
req = (GtkRequisition *) NPN_MemAlloc(sizeof(GtkRequisition));
975
gtk_widget_size_request(widget, req);
978
percent = event->x / req->width;
1037
gdk_drawable_get_size(GDK_DRAWABLE(widget->window),&width,&height);
1040
gdk_window_get_size(widget->window,&width,&height);
1042
percent = event->x / width;
980
1044
if (instance->currentnode != NULL) {
981
1045
if (instance->currentnode->totalbytes != 0) {
994
printf("widget size: %i x %i\n", req->width, req->height);
1058
printf("widget size: %i x %i\n", width, height);
995
1059
printf("mouse click at %f x %f\n", event->x, event->y);
996
1060
printf("percent = %f\nseektime = %f\n", percent, seektime);
998
1062
if (seektime > 0)
999
1063
instance->Seek(seektime);
1118
1183
gtk_pixmap_new(instance->pb_sm_ff_up, NULL);
1119
1184
instance->image_rew =
1120
1185
gtk_pixmap_new(instance->pb_sm_rew_up, NULL);
1186
instance->image_vol =
1187
gtk_pixmap_new(instance->pb_sm_vol, NULL);
1121
1188
instance->image_fs =
1122
1189
gtk_pixmap_new(instance->pb_sm_fs_up, NULL);
1316
1383
gtk_widget_set_size_request(GTK_WIDGET
1317
1384
(instance->mediaprogress_bar),
1319
width * multiplier - 20 - width),
1386
width * multiplier - 20 -
1387
(width * 2)), height - 2);
1322
1389
#ifdef GTK1_ENABLED
1323
1390
gtk_signal_connect(GTK_OBJECT(instance->mediaprogress_bar),
1327
1394
gtk_widget_set_usize(GTK_WIDGET
1328
1395
(instance->mediaprogress_bar),
1330
width * multiplier - 20 - width),
1397
width * multiplier - 20 - (width * 2)),
1333
1400
gtk_fixed_put(GTK_FIXED(instance->fixed_container),
1340
1407
if (instance->mode == NP_EMBED && instance->noembed == 0)
1341
1408
gtk_widget_hide(GTK_WIDGET(instance->progress_bar));
1411
instance->vol_event_box = gtk_event_box_new();
1412
instance->vol_tooltip = gtk_tooltips_new();
1413
gtk_tooltips_set_tip(instance->vol_tooltip,
1414
instance->vol_event_box, _("Volume"),
1416
gtk_widget_set_events(instance->vol_event_box,
1417
GDK_BUTTON_PRESS_MASK);
1419
g_signal_connect(G_OBJECT(instance->vol_event_box),
1421
G_CALLBACK(vol_callback), instance);
1422
gtk_widget_set_size_request(GTK_WIDGET
1423
(instance->vol_event_box), width,
1427
gtk_signal_connect(GTK_OBJECT(instance->vol_event_box),
1428
"button_press_event",
1429
GTK_SIGNAL_FUNC(vol_callback), instance);
1430
gtk_widget_set_usize(GTK_WIDGET(instance->vol_event_box),
1433
gtk_container_add(GTK_CONTAINER(instance->vol_event_box),
1434
instance->image_vol);
1435
if (win_width > 126 || instance->targetplayer == 1) {
1436
gtk_fixed_put(GTK_FIXED(instance->fixed_container),
1437
instance->vol_event_box,
1438
win_width - (width * 2),
1439
win_height - height);
1440
if (instance->showbuttons) {
1441
gtk_widget_show(instance->image_vol);
1442
gtk_widget_show(instance->vol_event_box);
1344
1448
instance->fs_event_box = gtk_event_box_new();
1345
1449
tooltip = gtk_tooltips_new();
1488
1593
mediaprogress_bar));
1489
1594
instance->showtracker = 0;
1490
if (gtk_widget_get_parent_window(instance->drawing_area) == NULL) {
1595
if (gtk_widget_get_parent_window
1596
(instance->drawing_area) == NULL) {
1491
1597
gtk_fixed_put(GTK_FIXED
1492
1598
(instance->fixed_container),
1493
instance->drawing_area, 0, 0);
1599
instance->drawing_area, 0,
1552
gtk_widget_set_usize(instance->drawing_area,
1553
new_width, new_height);
1659
if (new_width > 0 && new_height > 0 ) {
1660
gtk_widget_set_usize(instance->drawing_area,
1661
new_width, new_height);
1555
1664
if ((instance->movie_width + 10) >= instance->window_width
1556
1665
|| (instance->movie_height + 100) >=
1566
1675
(instance->mediaprogress_bar));
1569
if (gtk_widget_get_parent_window(instance->drawing_area) == NULL) {
1570
gtk_fixed_put(GTK_FIXED
1571
(instance->fixed_container),
1678
if (gtk_widget_get_parent_window
1679
(instance->drawing_area) == NULL) {
1680
gtk_fixed_put(GTK_FIXED(instance->fixed_container),
1572
1681
instance->drawing_area, 10, 100);
1574
1683
if (GTK_IS_WIDGET(instance->image))
1581
1690
if (instance->targetplayer && instance->showcontrols) {
1582
gtk_widget_set_usize(instance->drawing_area,
1691
if (instance->movie_width > 0 && instance->movie_height > 0 )
1692
gtk_widget_set_usize(instance->drawing_area,
1583
1693
instance->movie_width,
1584
1694
instance->movie_height + 16);
1593
1703
instance->window_height -
1706
if (instance->movie_width > 0 && instance->movie_height > 0 )
1596
1707
gtk_widget_set_usize(GTK_WIDGET
1597
1708
(instance->drawing_area),
1598
1709
instance->movie_width,
1599
1710
instance->movie_height);
1713
if (instance->movie_width > 0 && instance->movie_height > 0 )
1602
1714
gtk_widget_set_usize(GTK_WIDGET
1603
1715
(instance->drawing_area),
1604
1716
instance->movie_width,
1975
2087
if (GTK_IS_WIDGET(instance->rew_event_box)) {
1976
gtk_widget_hide(GTK_WIDGET(instance->rew_event_box));
2088
gtk_widget_hide(GTK_WIDGET(instance->rew_event_box));
1979
2091
gtk_fixed_move(GTK_FIXED(instance->fixed_container),
2000
2112
if (GTK_IS_WIDGET(instance->ff_event_box)) {
2001
gtk_widget_hide(GTK_WIDGET(instance->ff_event_box));
2113
gtk_widget_hide(GTK_WIDGET(instance->ff_event_box));
2004
2116
gtk_fixed_move(GTK_FIXED(instance->fixed_container),
2005
2117
GTK_WIDGET(instance->mediaprogress_bar),
2006
2118
(width * multiplier + 10), win_height - height + 2);
2007
2119
gtk_fixed_move(GTK_FIXED(instance->fixed_container),
2120
GTK_WIDGET(instance->vol_event_box),
2121
(win_width - (width * 2)), win_height - height + 2);
2122
gtk_fixed_move(GTK_FIXED(instance->fixed_container),
2008
2123
GTK_WIDGET(instance->fs_event_box),
2009
2124
(win_width - width), win_height - height + 2);
2011
2126
gtk_widget_show(GTK_WIDGET(instance->mediaprogress_bar));
2012
2127
gtk_widget_set_usize(GTK_WIDGET(instance->mediaprogress_bar),
2013
win_width - (width * (multiplier + 1) +
2128
win_width - (width * (multiplier + 2) +
2014
2129
20), height - 4);
2031
2147
if (instance->mInitialized == FALSE)
2150
fs_state = instance->fullscreen;
2034
2151
instance->SetFullscreen(instance->fullscreen);
2153
// printf("****\nfs_state = %i\nfullscreen = %i\n****\n",fs_state,instance->fullscreen);
2154
if (fs_state == 1 && instance->fullscreen == 0) {
2199
2320
filename = getURLFilename(lastplayed->url);
2200
2321
if (filename) {
2201
2322
instance->file_selector =
2202
gtk_file_selection_new
2323
gtk_file_selection_new(_("Save As..."));
2205
2325
gtk_file_selection_set_filename(GTK_FILE_SELECTION
2206
2326
(instance->file_selector),
3053
3173
if (instance->targetplayer == 0)
3054
3174
gtk_widget_hide(instance->src_event_box);
3176
instance->cancelled = 0;
3177
pthread_mutex_lock(&(instance->playlist_mutex)); // manipulating the playlist, so lock it
3181
n->played = 0; // reset played flag
3184
pthread_mutex_unlock(&(instance->playlist_mutex)); // unlock the playlist
3056
3185
instance->Play();