diff -Naur xine-ui-cvs-02-26-08.org/src/xitk/actions.c xine-ui-cvs-02-26-08/src/xitk/actions.c --- xine-ui-cvs-02-26-08.org/src/xitk/actions.c 2008-01-16 08:04:17.000000000 -0700 +++ xine-ui-cvs-02-26-08/src/xitk/actions.c 2008-03-10 20:44:36.000000000 -0600 @@ -430,22 +430,26 @@ play_data.start_time_in_secs = start_time_in_secs; play_data.update_mmk = update_mmk; play_data.running = 1; - - xw = xitk_window_dialog_yesno_with_width(gGui->imlib_data, _("Start Playback ?"), + + if( gGui->nongui_error_msg ) { + gGui->nongui_error_msg( buffer ); + } + else { + xw = xitk_window_dialog_yesno_with_width(gGui->imlib_data, _("Start Playback ?"), start_anyway_yesno, start_anyway_yesno, NULL, 400, ALIGN_CENTER, "%s%s%s%s", buffer, v_info, a_info, _("\nStart playback anyway ?\n")); - free(buffer); free(v_info); free(a_info); + free(buffer); free(v_info); free(a_info); + XLockDisplay(gGui->display); + if(!gGui->use_root_window && gGui->video_display == gGui->display) + XSetTransientForHint(gGui->display, xitk_window_get_window(xw), gGui->video_window); + XSync(gGui->display, False); + XUnlockDisplay(gGui->display); + layer_above_video(xitk_window_get_window(xw)); + } - XLockDisplay(gGui->display); - if(!gGui->use_root_window && gGui->video_display == gGui->display) - XSetTransientForHint(gGui->display, xitk_window_get_window(xw), gGui->video_window); - XSync(gGui->display, False); - XUnlockDisplay(gGui->display); - layer_above_video(xitk_window_get_window(xw)); - /* Doesn't work so well yet use play_data.running hack for a while xitk_window_dialog_set_modal(xw); @@ -1070,8 +1074,8 @@ xine_set_param(gGui->stream, XINE_PARAM_VO_ASPECT_RATIO, aspect); - osd_display_info(_("Aspect ratio: %s"), - ratios[xine_get_param(gGui->stream, XINE_PARAM_VO_ASPECT_RATIO)]); + /*osd_display_info(_("Aspect ratio: %s"), + ratios[xine_get_param(gGui->stream, XINE_PARAM_VO_ASPECT_RATIO)]);*/ if (panel_is_visible()) { XLockDisplay(gGui->display); @@ -1085,7 +1089,7 @@ void gui_toggle_interlaced(void) { gGui->deinterlace_enable = !gGui->deinterlace_enable; - osd_display_info(_("Deinterlace: %s"), (gGui->deinterlace_enable) ? _("enabled") : _("disabled")); + /*osd_display_info(_("Deinterlace: %s"), (gGui->deinterlace_enable) ? _("enabled") : _("disabled"));*/ post_deinterlace(); if (panel_is_visible()) { @@ -1109,10 +1113,14 @@ channel = xine_get_param(gGui->stream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL); - if(dir == GUI_NEXT) + if(dir == GUI_NEXT) { channel++; - else if(dir == GUI_PREV) + if(channel > 5) + channel = -1; + } + else if(dir == GUI_PREV) { channel--; + } gui_direct_change_audio_channel(w, data, channel); } @@ -1930,7 +1938,7 @@ gGui->mixer.volume_level = value; xine_set_param(gGui->stream, XINE_PARAM_AUDIO_VOLUME, gGui->mixer.volume_level); xitk_slider_set_pos(panel->mixer.slider, gGui->mixer.volume_level); - osd_draw_bar(_("Audio Volume"), 0, 100, gGui->mixer.volume_level, OSD_BAR_STEPPER); + osd_draw_bar(_("Volume"), 0, 100, gGui->mixer.volume_level, OSD_BAR_STEPPER); } void gui_increase_audio_volume(void) { if((gGui->mixer.method == SOUND_CARD_MIXER) && (gGui->mixer.caps & MIXER_CAP_VOL)) @@ -1972,6 +1983,10 @@ } } +void gui_zoom_mode(void) { + osd_draw_bar(_(""), 0, 100, 100, OSD_ZOOM); +} + void gui_change_zoom(int zoom_dx, int zoom_dy) { xine_set_param(gGui->stream, XINE_PARAM_VO_ZOOM_X, diff -Naur xine-ui-cvs-02-26-08.org/src/xitk/actions.h xine-ui-cvs-02-26-08/src/xitk/actions.h --- xine-ui-cvs-02-26-08.org/src/xitk/actions.h 2008-01-16 08:04:17.000000000 -0700 +++ xine-ui-cvs-02-26-08/src/xitk/actions.h 2008-08-18 20:08:35.000000000 -0400 @@ -95,6 +95,7 @@ void gui_increase_amp_level(void); void gui_decrease_amp_level(void); void gui_reset_amp_level(void); +void gui_zoom_mode(void); void gui_change_zoom(int zoom_dx, int zoom_dy); void gui_reset_zoom(void); void gui_toggle_tvmode(void); diff -Naur xine-ui-cvs-02-26-08.org/src/xitk/event.c xine-ui-cvs-02-26-08/src/xitk/event.c --- xine-ui-cvs-02-26-08.org/src/xitk/event.c 2008-01-16 07:42:07.000000000 -0700 +++ xine-ui-cvs-02-26-08/src/xitk/event.c 2008-03-10 17:40:45.000000000 -0600 @@ -366,63 +366,6 @@ */ void gui_execute_action_id(action_id_t action) { xine_event_t xine_event; - - if(action & ACTID_IS_INPUT_EVENT) { - - /* Note: In the following overflow checks, we must test against INT_MAX */ - /* carefully. Otherwise, the comparison term may overflow itself and */ - /* detecting the overflow condition will fail (never true or true by */ - /* chance, depending on expression and rearranging by the compiler). */ - - if((action >= ACTID_EVENT_NUMBER_0) && (action <= ACTID_EVENT_NUMBER_9)) { - - if(!gGui->numeric.set) { - gGui->numeric.set = 1; - gGui->numeric.arg = 0; - } - - if(gGui->numeric.arg <= ((INT_MAX - (action - ACTID_EVENT_NUMBER_0)) / 10)) { - /* ((gGui->numeric.arg * 10) + (action - ACTID_EVENT_NUMBER_0)) <= INT_MAX */ - gGui->numeric.arg *= 10; - gGui->numeric.arg += (action - ACTID_EVENT_NUMBER_0); - } - else - fprintf(stderr, "WARNING: Input number canceled, avoid overflow\n"); - - } - else if(action == ACTID_EVENT_NUMBER_10_ADD) { - - if(!gGui->numeric.set) { - gGui->numeric.set = 1; - gGui->numeric.arg = 0; - } - - if(gGui->numeric.arg <= (INT_MAX - 10)) - /* (gGui->numeric.arg + 10) <= INT_MAX */ - gGui->numeric.arg += 10; - else - fprintf(stderr, "WARNING: Input number canceled, avoid overflow\n"); - - } - else { - gGui->numeric.set = 0; - gGui->numeric.arg = 0; - } - - /* check if osd menu like this event */ - if( oxine_action_event(action & ~ACTID_IS_INPUT_EVENT) ) - return; - - /* events for advanced input plugins. */ - xine_event.type = action & ~ACTID_IS_INPUT_EVENT; - xine_event.data_length = 0; - xine_event.data = NULL; - xine_event.stream = gGui->stream; - gettimeofday(&xine_event.tv, NULL); - - xine_event_send(gGui->stream, &xine_event); - return; - } switch(action) { @@ -467,7 +410,6 @@ } break; - case ACTID_ZOOM_1_1: case ACTID_WINDOW100: if(video_window_set_mag (1.0f, 1.0f)) osd_display_info(_("Zoom: 1:1")); @@ -786,10 +786,14 @@ break; case ACTID_pVOLUME: + if(gGui->mixer.mute) + panel_toggle_audio_mute(NULL, NULL, !gGui->mixer.mute); gui_increase_audio_volume(); break; case ACTID_mVOLUME: + if(gGui->mixer.mute) + panel_toggle_audio_mute(NULL, NULL, !gGui->mixer.mute); gui_decrease_audio_volume(); break; @@ -818,10 +764,12 @@ break; case ACTID_ZOOM_IN: + gui_zoom_mode(); gui_change_zoom(1,1); break; case ACTID_ZOOM_OUT: + gui_zoom_mode(); gui_change_zoom(-1,-1); break; @@ -840,11 +788,65 @@ case ACTID_ZOOM_Y_OUT: gui_change_zoom(0,-1); break; - + + case ACTID_ZOOM_1_1: + //use this function for quickzoom + if( gGui->osd.bar.visible > 5 ) { + gui_reset_zoom(); + gui_change_zoom(34,34); + } + else { + // maybe this should be attenuate? + //AudioMenu (DVD) + action = ACTID_EVENT_MENU5; + } + break; + case ACTID_ZOOM_RESET: - gui_reset_zoom(); + if( gGui->osd.bar.visible > 5 ) { + gui_reset_zoom(); + } + else { + //TitleMenu (DVD) + action = ACTID_EVENT_MENU2; + } break; + case ACTID_EVENT_NUMBER_1: + if( gGui->osd.bar.visible > 5 ) { + gui_toggle_aspect(1); + action = ACTID_NOKEY; + } + break; + + case ACTID_EVENT_NUMBER_2: + if( gGui->osd.bar.visible > 5 ) { + gui_toggle_aspect(2); + action = ACTID_NOKEY; + } + break; + + case ACTID_EVENT_NUMBER_3: + if( gGui->osd.bar.visible > 5 ) { + gui_toggle_aspect(3); + action = ACTID_NOKEY; + } + break; + + case ACTID_EVENT_NUMBER_4: + if( gGui->osd.bar.visible > 5 ) { + gui_toggle_aspect(4); + action = ACTID_NOKEY; + } + break; + + case ACTID_EVENT_NUMBER_5: + if( gGui->osd.bar.visible > 5 ) { + gui_toggle_aspect(5); + action = ACTID_NOKEY; + } + break; + case ACTID_GRAB_POINTER: if(!gGui->cursor_grabbed) { if(!panel_is_visible()) { @@ -958,7 +960,9 @@ break; case ACTID_OSD_MENU: - oxine_menu(); + // used this function for mapping ESC button to OSD clear function + //oxine_menu(); + osd_hide(); break; case ACTID_FILESELECTOR: @@ -1207,6 +1211,64 @@ default: break; } + + if(action & ACTID_IS_INPUT_EVENT) { + + /* Note: In the following overflow checks, we must test against INT_MAX */ + /* carefully. Otherwise, the comparison term may overflow itself and */ + /* detecting the overflow condition will fail (never true or true by */ + /* chance, depending on expression and rearranging by the compiler). */ + + if((action >= ACTID_EVENT_NUMBER_0) && (action <= ACTID_EVENT_NUMBER_9)) { + + if(!gGui->numeric.set) { + gGui->numeric.set = 1; + gGui->numeric.arg = 0; + } + + if(gGui->numeric.arg <= ((INT_MAX - (action - ACTID_EVENT_NUMBER_0)) / 10)) { + /* ((gGui->numeric.arg * 10) + (action - ACTID_EVENT_NUMBER_0)) <= INT_MAX */ + gGui->numeric.arg *= 10; + gGui->numeric.arg += (action - ACTID_EVENT_NUMBER_0); + } + else + fprintf(stderr, "WARNING: Input number canceled, avoid overflow\n"); + + } + else if(action == ACTID_EVENT_NUMBER_10_ADD) { + + if(!gGui->numeric.set) { + gGui->numeric.set = 1; + gGui->numeric.arg = 0; + } + + if(gGui->numeric.arg <= (INT_MAX - 10)) + /* (gGui->numeric.arg + 10) <= INT_MAX */ + gGui->numeric.arg += 10; + else + fprintf(stderr, "WARNING: Input number canceled, avoid overflow\n"); + + } + else { + gGui->numeric.set = 0; + gGui->numeric.arg = 0; + } + + /* check if osd menu like this event */ + if( oxine_action_event(action & ~ACTID_IS_INPUT_EVENT) ) + return; + + /* events for advanced input plugins. */ + xine_event.type = action & ~ACTID_IS_INPUT_EVENT; + xine_event.data_length = 0; + xine_event.data = NULL; + xine_event.stream = gGui->stream; + gettimeofday(&xine_event.tv, NULL); + + xine_event_send(gGui->stream, &xine_event); + return; + } + /* Some sort of function was done. Clear arguments. */ gGui->numeric.set = 0; @@ -1707,7 +1711,7 @@ gGui->osd.timeout = xine_config_register_num(gGui->xine, "gui.osd_timeout", - 3, + 5, _("Dismiss OSD time (s)"), _("Persistence time of OSD visual, in seconds."), CONFIG_LEVEL_BEG, diff -Naur xine-ui-cvs-02-26-08.org/src/xitk/errors.c xine-ui-cvs-02-26-08/src/xitk/errors.c --- xine-ui-cvs-02-26-08.org/src/xitk/errors.c 2007-11-13 14:12:17.000000000 -0700 +++ xine-ui-cvs-02-26-08/src/xitk/errors.c 2008-03-10 22:36:26.000000000 -0600 @@ -263,41 +263,32 @@ case XINE_ERROR_NO_INPUT_PLUGIN: dump_error(gGui->verbosity, "got XINE_ERROR_NO_INPUT_PLUGIN."); - xine_error_with_more(_("- xine engine error -\n\n" - "There is no input plugin available to handle '%s'.\n" - "Maybe MRL syntax is wrong or file/stream source doesn't exist."), - _mrl); + xine_error_with_more(_("No compatible input plugin to handle '%s'\n"), _mrl); break; case XINE_ERROR_NO_DEMUX_PLUGIN: dump_error(gGui->verbosity, "got XINE_ERROR_NO_DEMUX_PLUGIN."); - xine_error_with_more(_("- xine engine error -\n\nThere is no demuxer plugin available " - "to handle '%s'.\n" - "Usually this means that the file format was not recognized."), - _mrl); + xine_error_with_more(_("No compatible demuxer plugin to handle '%s'\n"), _mrl); break; case XINE_ERROR_DEMUX_FAILED: dump_error(gGui->verbosity, "got XINE_ERROR_DEMUX_FAILED."); - xine_error_with_more(_("- xine engine error -\n\nDemuxer failed. " - "Maybe '%s' is a broken file?\n"), _mrl); + xine_error_with_more(_("Demuxer failed. Possible broken file '%s'\n"), _mrl); break; case XINE_ERROR_MALFORMED_MRL: dump_error(gGui->verbosity, "got XINE_ERROR_MALFORMED_MRL."); - xine_error_with_more(_("- xine engine error -\n\nMalformed mrl. " - "Mrl '%s' seems malformed/invalid.\n"), _mrl); + xine_error_with_more(_("Malformed or invalid mrl '%s'\n"), _mrl); break; case XINE_ERROR_INPUT_FAILED: dump_error(gGui->verbosity, "got XINE_ERROR_INPUT_FAILED."); - xine_error_with_more(_("- xine engine error -\n\nInput plugin failed to open " - "mrl '%s'\n"), _mrl); + xine_error_with_more(_("Input plugin failed to open mrl '%s'\n"), _mrl); break; default: dump_error(gGui->verbosity, "got unhandle error."); - xine_error_with_more(_("- xine engine error -\n\n!! Unhandled error !!\n")); + xine_error_with_more(_("!! Unhandled error !!\n")); break; } diff -Naur xine-ui-cvs-02-26-08.org/src/xitk/main.c xine-ui-cvs-02-26-08/src/xitk/main.c --- xine-ui-cvs-02-26-08.org/src/xitk/main.c 2008-01-18 19:48:01.000000000 -0700 +++ xine-ui-cvs-02-26-08/src/xitk/main.c 2008-03-10 22:40:31.000000000 -0600 @@ -1423,7 +1423,7 @@ gGui->no_gui = 0; gGui->no_mouse = 0; gGui->wid = 0; - gGui->nongui_error_msg = NULL; + gGui->nongui_error_msg = osd_display_info; gGui->stdout = stdout; window_attribute.x = window_attribute.y = -8192; diff -Naur xine-ui-cvs-02-26-08.org/src/xitk/osd.c xine-ui-cvs-02-26-08/src/xitk/osd.c --- xine-ui-cvs-02-26-08.org/src/xitk/osd.c 2008-01-16 07:45:28.000000000 -0700 +++ xine-ui-cvs-02-26-08/src/xitk/osd.c 2008-04-05 21:27:22.000000000 -0400 @@ -58,22 +58,22 @@ CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), //4 CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), //5 CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), //6 - CLUT_Y_CR_CB_INIT(0xa0, 0x80, 0x80), //7 + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), //7 - changed the grey bar to white here (XINE_OSD_TEXT1 + 7) CLUT_Y_CR_CB_INIT(0xc0, 0x80, 0x80), //8 - CLUT_Y_CR_CB_INIT(0xe0, 0x80, 0x80), //9 + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), //9 - changed the off-white font to white (XINE_OSD_TEXT1 + 9) CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), //10 /* yellow, black border, transparent */ CLUT_Y_CR_CB_INIT(0x00, 0x00, 0x00), //0 - CLUT_Y_CR_CB_INIT(0x80, 0x80, 0xe0), //1 + CLUT_Y_CR_CB_INIT(0x01, 0x40, 0xee), //1 - changed the pale blue to darker blue here (XINE_OSD_TEXT1 + 12) CLUT_Y_CR_CB_INIT(0x80, 0x80, 0xc0), //2 CLUT_Y_CR_CB_INIT(0x60, 0x80, 0xa0), //3 CLUT_Y_CR_CB_INIT(0x40, 0x80, 0x80), //4 CLUT_Y_CR_CB_INIT(0x20, 0x80, 0x80), //5 CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), //6 CLUT_Y_CR_CB_INIT(0x40, 0x84, 0x60), //7 - CLUT_Y_CR_CB_INIT(0xd0, 0x88, 0x40), //8 - CLUT_Y_CR_CB_INIT(0xe0, 0x8a, 0x00), //9 - CLUT_Y_CR_CB_INIT(0xff, 0x90, 0x00), //10 + CLUT_Y_CR_CB_INIT(0xb5, 0xa1, 0x40), //8 - darkened yellow + CLUT_Y_CR_CB_INIT(0x58, 0xff, 0x25), //9 - changed the yellow bar to red here (XINE_OSD_TEXT1 + 20) + CLUT_Y_CR_CB_INIT(0xa0, 0x28, 0x45), //10 - changed the yellow bar to green here (XINE_OSD_TEXT1 + 21) }; static const uint8_t textpalettes_trans[] = { @@ -105,27 +105,35 @@ { ">$$", XINE_SPEED_FAST_4 } }; -#define BAR_WIDTH 336 -#define BAR_HEIGHT 25 - #define MINIMUM_WIN_WIDTH 300 -#define FONT_SIZE 20 -#define UNSCALED_FONT_SIZE 24 static pthread_mutex_t osd_mutex; +int iBarWidth = 336; +int iBarHeight = 14; +int iFontSize = 20; +int iSignHeight = 33; +int iSignWidthSeg = 14.4; +int iWidthVar = 40; +int iTrueInit = 0; + static void _xine_osd_show(xine_osd_t *osd, int64_t vpts) { - if( gGui->osd.use_unscaled && gGui->osd.unscaled_available ) xine_osd_show_unscaled(osd, vpts); - else - xine_osd_show(osd, vpts); } static void _osd_get_output_size(int *w, int *h) { - if( gGui->osd.use_unscaled && gGui->osd.unscaled_available ) video_window_get_output_size(w, h); - else - video_window_get_frame_size(w, h); + /* reinitialize osd based on video_window dimensions */ + if(( iBarWidth != (*w / 1.25)) && ( iTrueInit == 1 )) { + osd_hide(); + iBarWidth = *w / 1.25; + iBarHeight = *h / 30; + iWidthVar = iBarWidth / 10; + iFontSize = iBarHeight * 1.4; + iSignHeight = iFontSize + 1 + 12; + iSignWidthSeg = *w / 50; + osd_init(); + } } static char *_osd_get_speed_sym(int speed) { @@ -150,28 +158,28 @@ } void osd_init(void) { - int fonth = FONT_SIZE; - gGui->osd.sinfo.osd[0] = xine_osd_new(gGui->stream, 0, 0, 900, (fonth * 6) + (5 * 3)); - xine_osd_set_font(gGui->osd.sinfo.osd[0], "sans", fonth); + gGui->osd.sinfo.osd[0] = xine_osd_new(gGui->stream, 0, 0, (iBarWidth * 1.25), (iFontSize * 6) + (5 * 3)); + xine_osd_set_font(gGui->osd.sinfo.osd[0], "sans", iFontSize); xine_osd_set_text_palette(gGui->osd.sinfo.osd[0], XINE_TEXTPALETTE_WHITE_BLACK_TRANSPARENT, XINE_OSD_TEXT1); - gGui->osd.bar.osd[0] = xine_osd_new(gGui->stream, 0, 0, BAR_WIDTH + 1, BAR_HEIGHT + 1); + gGui->osd.bar.osd[0] = xine_osd_new(gGui->stream, 0, 0, (iBarWidth * 1.25), iBarHeight + 1); xine_osd_set_palette(gGui->osd.bar.osd[0], textpalettes_color, textpalettes_trans); - gGui->osd.bar.osd[1] = xine_osd_new(gGui->stream, 0, 0, BAR_WIDTH + 1, BAR_HEIGHT + 1); - xine_osd_set_font(gGui->osd.bar.osd[1], "sans", fonth); + gGui->osd.bar.osd[1] = xine_osd_new(gGui->stream, 0, 0, (iBarWidth * 1.25), iSignHeight); + xine_osd_set_font(gGui->osd.bar.osd[1], "sans", iFontSize); xine_osd_set_text_palette(gGui->osd.bar.osd[1], XINE_TEXTPALETTE_WHITE_BLACK_TRANSPARENT, XINE_OSD_TEXT1); + xine_osd_set_palette(gGui->osd.bar.osd[1], textpalettes_color, textpalettes_trans); - gGui->osd.status.osd[0] = xine_osd_new(gGui->stream, 0, 0, 300, 2 * fonth); + gGui->osd.status.osd[0] = xine_osd_new(gGui->stream, 0, 0, (iBarWidth * 1.25), 2 * iFontSize); xine_osd_set_text_palette(gGui->osd.status.osd[0], XINE_TEXTPALETTE_WHITE_BLACK_TRANSPARENT, XINE_OSD_TEXT1); - gGui->osd.info.osd[0] = xine_osd_new(gGui->stream, 0, 0, 2048, fonth + (fonth >> 1)); - xine_osd_set_font(gGui->osd.info.osd[0], "sans", fonth); + gGui->osd.info.osd[0] = xine_osd_new(gGui->stream, 0, 0, (iBarWidth * 1.25), iFontSize + (iFontSize >> 1)); + xine_osd_set_font(gGui->osd.info.osd[0], "sans", iFontSize); xine_osd_set_text_palette(gGui->osd.info.osd[0], XINE_TEXTPALETTE_WHITE_BLACK_TRANSPARENT, XINE_OSD_TEXT1); @@ -179,6 +182,8 @@ (xine_osd_get_capabilities(gGui->osd.status.osd[0]) & XINE_OSD_CAP_UNSCALED ); pthread_mutex_init(&osd_mutex, NULL); + + iTrueInit = 1; } void osd_hide_sinfo(void) { @@ -285,6 +290,7 @@ int vwidth, vheight, asrate; int wwidth, wheight; const char *vcodec, *acodec; + char *filename_had_path; char buffer[256], *p; int x, y; int w, h, osdw; @@ -328,26 +334,38 @@ _osd_get_output_size(&wwidth, &wheight); - y = x = 0; + /* adjust position in case user suffers from TV overscan */ + y = 12; + if( wwidth <= 720 ) /* work-around */ + x = ((wwidth - iBarWidth) / 2) >> 1; /* be nice to know what the deal is here */ + else + x = ((wwidth - iBarWidth) / 2); - strlcpy(buffer, (gGui->is_display_mrl) ? gGui->mmk.mrl : gGui->mmk.ident, sizeof(buffer)); - xine_osd_get_text_size(gGui->osd.sinfo.osd[0], buffer, &osdw, &h); - p = buffer; - while(osdw > (wwidth - 40)) { - *(p++) = '\0'; - *(p) = '.'; - *(p+1) = '.'; - *(p+2) = '.'; - xine_osd_get_text_size(gGui->osd.sinfo.osd[0], p, &osdw, &h); + filename_had_path = strrchr((gGui->is_display_mrl) ? gGui->mmk.mrl : gGui->mmk.ident, '/'); + if (filename_had_path) { + strlcpy(buffer, filename_had_path, sizeof(buffer)); + xine_osd_get_text_size(gGui->osd.sinfo.osd[0], buffer, &wwidth, &h); + p = buffer; + /* replace the slash with a space at the beginning of filename */ + *(p) = ' '; + } + else { + strlcpy(buffer, (gGui->is_display_mrl) ? gGui->mmk.mrl : gGui->mmk.ident, sizeof(buffer)); + xine_osd_get_text_size(gGui->osd.sinfo.osd[0], buffer, &wwidth, &h); + p = buffer; } + xine_osd_get_text_size(gGui->osd.sinfo.osd[0], p, &osdw, &h); xine_osd_draw_text(gGui->osd.sinfo.osd[0], x, y, p, XINE_OSD_TEXT1); - y += h; + /* cosmetics - adjust position to make it more readable */ + x += iBarWidth / 7; + y += 6; + if(vcodec && vwidth && vheight) { snprintf(buffer, sizeof(buffer), "%s: %dX%d", vcodec, vwidth, vheight); - xine_osd_draw_text(gGui->osd.sinfo.osd[0], x, y, buffer, XINE_OSD_TEXT1); xine_osd_get_text_size(gGui->osd.sinfo.osd[0], buffer, &w, &h); + xine_osd_draw_text(gGui->osd.sinfo.osd[0], x, y, buffer, XINE_OSD_TEXT1); if(w > osdw) osdw = w; y += h; @@ -355,8 +373,8 @@ if(acodec && asrate) { snprintf(buffer, sizeof(buffer), "%s: %d%s", acodec, asrate, "Hz"); - xine_osd_draw_text(gGui->osd.sinfo.osd[0], x, y, buffer, XINE_OSD_TEXT1); xine_osd_get_text_size(gGui->osd.sinfo.osd[0], buffer, &w, &h); + xine_osd_draw_text(gGui->osd.sinfo.osd[0], x, y, buffer, XINE_OSD_TEXT1); if(w > osdw) osdw = w; y += h; @@ -394,8 +412,8 @@ break; } strlcat(buffer, ".", sizeof(buffer)); - xine_osd_draw_text(gGui->osd.sinfo.osd[0], x, y, buffer, XINE_OSD_TEXT1); xine_osd_get_text_size(gGui->osd.sinfo.osd[0], buffer, &w, &h); + xine_osd_draw_text(gGui->osd.sinfo.osd[0], x, y, buffer, XINE_OSD_TEXT1); if(w > osdw) osdw = w; @@ -420,17 +438,16 @@ sprintf(buffer+strlen(buffer), "%d:%02d:%02d", totaltime / 3600, (totaltime % 3600) / 60, totaltime % 60); } - xine_osd_draw_text(gGui->osd.sinfo.osd[0], x, y, buffer, XINE_OSD_TEXT1); xine_osd_get_text_size(gGui->osd.sinfo.osd[0], buffer, &w, &h); + xine_osd_draw_text(gGui->osd.sinfo.osd[0], x, y, buffer, XINE_OSD_TEXT1); if(w > osdw) osdw = w; osd_stream_position(pos); - x = (wwidth - osdw) - 40; - xine_osd_set_position(gGui->osd.sinfo.osd[0], (x >= 0) ? x : 0, 15); - gGui->osd.sinfo.x = (x >= 0) ? x : 0; - gGui->osd.sinfo.y = 15; + xine_osd_set_position(gGui->osd.sinfo.osd[0], 20, 10 + 30); + gGui->osd.sinfo.x = 20; + gGui->osd.sinfo.y = 40; gGui->osd.sinfo.w = osdw; pthread_mutex_lock(&osd_mutex); @@ -444,12 +461,13 @@ if(gGui->osd.enabled) { int wwidth, wheight; - int bar_color[40]; + int bar_color[240]; int i, x; float _val = (int) val; float _min = (int) min; float _max = (int) max; int pos; + int iStepper, iStepperSegment; if(max <= min) _max = (int) (min + 1); @@ -460,20 +483,50 @@ if(val < min) _val = (int) min; - pos = (int) (_val + -_min) / ((_max + -_min) / 40); - _osd_get_output_size(&wwidth, &wheight); + /* + * -- based on 0 -> 100 -- + * iWidthVar = iBarWidth / 10; + * x + (iStepperSegment * 2) + */ + iStepper = iWidthVar / 5; + iStepperSegment = iWidthVar / 50; + + pos = (int) (_val + -_min) / ((_max + -_min) / iWidthVar); + xine_osd_clear(gGui->osd.bar.osd[0]); xine_osd_clear(gGui->osd.bar.osd[1]); - memset(&bar_color, (XINE_OSD_TEXT1 + 7), sizeof(int) * 40); + memset(&bar_color, (XINE_OSD_TEXT1 + 7), sizeof(int) * iWidthVar); switch(type) { + case OSD_ZOOM: + /* red reset sign */ + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*5), (iSignHeight*6/33), (iSignWidthSeg*5)+(iSignWidthSeg*25/14.4), (iSignHeight*30/33), XINE_OSD_TEXT1 + 20, 1); + /* green minus sign */ + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*15), (iSignHeight*13/33), (iSignWidthSeg*15)+(iSignWidthSeg*40/14.4), (iSignHeight*20/33), XINE_OSD_TEXT1 + 21, 1); + /* yellow plus sign */ + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*25)+(iSignWidthSeg*17/14.4), 0, (iSignWidthSeg*25)+(iSignWidthSeg*24/14.4), iSignHeight, XINE_OSD_TEXT1 + 19, 1); + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*25), (iSignHeight*13/33), (iSignWidthSeg*25)+(iSignWidthSeg*40/14.4), (iSignHeight*20/33), XINE_OSD_TEXT1 + 19, 1); + /* blue extents sign */ + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*35), 0, (iSignWidthSeg*35)+(iSignWidthSeg*14/14.4), (iSignHeight*7/33), XINE_OSD_TEXT1 + 12, 1); + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*35)+(iSignWidthSeg*26/14.4), 0, (iSignWidthSeg*35)+(iSignWidthSeg*40/14.4), (iSignHeight*7/33), XINE_OSD_TEXT1 + 12, 1); + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*35), (iSignHeight*7/33), (iSignWidthSeg*35)+(iSignWidthSeg*7/14.4), (iSignHeight*14/33), XINE_OSD_TEXT1 + 12, 1); + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*35)+(iSignWidthSeg*33/14.4), (iSignHeight*7/33), (iSignWidthSeg*35)+(iSignWidthSeg*40/14.4), (iSignHeight*14/33), XINE_OSD_TEXT1 + 12, 1); + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*35), (iSignHeight*20/33), (iSignWidthSeg*35)+(iSignWidthSeg*7/14.4), (iSignHeight*27/33), XINE_OSD_TEXT1 + 12, 1); + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*35)+(iSignWidthSeg*33/14.4), (iSignHeight*20/33), (iSignWidthSeg*35)+(iSignWidthSeg*40/14.4), (iSignHeight*27/33), XINE_OSD_TEXT1 + 12, 1); + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*35), (iSignHeight*27/33), (iSignWidthSeg*35)+(iSignWidthSeg*14/14.4), iSignHeight, XINE_OSD_TEXT1 + 12, 1); + xine_osd_draw_rect(gGui->osd.bar.osd[1], (iSignWidthSeg*35)+(iSignWidthSeg*26/14.4), (iSignHeight*27/33), (iSignWidthSeg*35)+(iSignWidthSeg*40/14.4), iSignHeight, XINE_OSD_TEXT1 + 12, 1); + break; case OSD_BAR_PROGRESS: case OSD_BAR_STEPPER: - if(pos) - memset(bar_color, (XINE_OSD_TEXT1 + 21), sizeof(int) * pos); + if(pos) { + if(gGui->mixer.mute) + memset(bar_color, (XINE_OSD_TEXT1 + 20), sizeof(int) * pos); /* red */ + else + memset(bar_color, (XINE_OSD_TEXT1 + 21), sizeof(int) * pos); /* green */ + } break; case OSD_BAR_POS: case OSD_BAR_POS2: @@ -483,47 +513,40 @@ } if((type == OSD_BAR_PROGRESS) || (type == OSD_BAR_POS)) { - x = 3; - xine_osd_draw_rect(gGui->osd.bar.osd[0], x, 2, x + 3, BAR_HEIGHT - 2, XINE_OSD_TEXT1 + 9, 1); - x += 8; + x = 0; + xine_osd_draw_rect(gGui->osd.bar.osd[0], x, 0, x + (iStepperSegment * 2), iBarHeight, XINE_OSD_TEXT1 + 9, 1); + x += iStepper; - for(i = 0; i < 40; i++, x += 8) { + for(i = 0; i < iWidthVar; i += iStepperSegment, x += iStepper) { xine_osd_draw_rect(gGui->osd.bar.osd[0], - x, 6, x + 3, BAR_HEIGHT - 2, bar_color[i], 1); + x, (iBarHeight / 4), x + (iStepperSegment * 2), iBarHeight - (iBarHeight / 4), bar_color[i], 1); } xine_osd_draw_rect(gGui->osd.bar.osd[0], - x, 2, x + 3, BAR_HEIGHT - 2, XINE_OSD_TEXT1 + 9, 1); + x, 0, x + (iStepperSegment * 2), iBarHeight, XINE_OSD_TEXT1 + 9, 1); } else if(type == OSD_BAR_POS2) { - x = 3; - xine_osd_draw_rect(gGui->osd.bar.osd[0], x, 2, x + 3, BAR_HEIGHT - 2, XINE_OSD_TEXT1 + 9, 1); - x += 8; + x = 0; + /* first tall line */ + xine_osd_draw_rect(gGui->osd.bar.osd[0], x, 0, x + (iStepperSegment * 2), iBarHeight, XINE_OSD_TEXT1 + 9, 1); + x += iStepper; - for(i = 0; i < 40; i++, x += 8) { - if(i == (pos - 1)) + for(i = 0; i < iWidthVar; i += iStepperSegment, x += iStepper) { + if(i <= (pos - 1)) xine_osd_draw_rect(gGui->osd.bar.osd[0], - x, 2, x + 3, BAR_HEIGHT - 2, bar_color[i], 1); + x, 0, x + (iStepperSegment * 3), iBarHeight, XINE_OSD_TEXT1 + 21, 1); else xine_osd_draw_rect(gGui->osd.bar.osd[0], - x, 6, x + 3, BAR_HEIGHT - 6, bar_color[i], 1); + x, (iBarHeight / 4), x + (iStepperSegment * 2), iBarHeight - (iBarHeight / 4), bar_color[i], 1); } - - xine_osd_draw_rect(gGui->osd.bar.osd[0], - x, 2, x + 3, BAR_HEIGHT - 2, XINE_OSD_TEXT1 + 9, 1); + /* last tall line */ + xine_osd_draw_rect(gGui->osd.bar.osd[0], x, 0, x + (iStepperSegment * 2), iBarHeight, XINE_OSD_TEXT1 + 9, 1); } else if(type == OSD_BAR_STEPPER) { - int y = BAR_HEIGHT - 4; - int step = y / 20; - - x = 11; - - for(i = 0; i < 40; i++, x += 8) { + x = 0; + for(i = 0; i < iWidthVar; i += iStepperSegment, x += iStepper) { xine_osd_draw_rect(gGui->osd.bar.osd[0], - x, y, x + 3, BAR_HEIGHT - 2, bar_color[i], 1); - - if(!(i % 2)) - y -= step; + x, 0, x + iStepper, iBarHeight, bar_color[i], 1); } } @@ -534,14 +557,17 @@ gGui->osd.bar.have_text = 1; xine_osd_get_text_size(gGui->osd.bar.osd[1], title, &tw, &th); - xine_osd_draw_text(gGui->osd.bar.osd[1], (BAR_WIDTH - tw) >> 1, 0, title, XINE_OSD_TEXT1); + xine_osd_draw_text(gGui->osd.bar.osd[1], 1, 0, title, XINE_OSD_TEXT1); } else gGui->osd.bar.have_text = 0; - x = (wwidth - BAR_WIDTH) >> 1; - xine_osd_set_position(gGui->osd.bar.osd[0], (x >= 0) ? x : 0, (wheight - BAR_HEIGHT) - 40); - xine_osd_set_position(gGui->osd.bar.osd[1], (x >= 0) ? x : 0, (wheight - (BAR_HEIGHT * 2)) - 40); + if( wwidth <= 720 ) /* work-around */ + x = ((wwidth - iBarWidth) / 2) >> 1; /* be nice to know what the deal is here */ + else + x = ((wwidth - iBarWidth) / 2); + xine_osd_set_position(gGui->osd.bar.osd[0], (x >= 0) ? x : 0, wheight - (iBarHeight * 3) - iBarHeight); + xine_osd_set_position(gGui->osd.bar.osd[1], (x >= 0) ? x : 0, wheight - (iBarHeight * 3) - iBarHeight - iFontSize - 2); /* don't even bother drawing osd over those small streams. * it would look pretty bad. @@ -551,14 +600,19 @@ _xine_osd_show(gGui->osd.bar.osd[0], 0); if(title) _xine_osd_show(gGui->osd.bar.osd[1], 0); - gGui->osd.bar.visible = gGui->osd.timeout; + if( type == OSD_ZOOM ) { + gGui->osd.bar.visible = 120; + } + else { + gGui->osd.bar.visible = gGui->osd.timeout; + } pthread_mutex_unlock(&osd_mutex); } } } void osd_stream_position(int pos) { - osd_draw_bar(_("Position in Stream"), 0, 65535, pos, OSD_BAR_POS2); + osd_draw_bar(_("Position"), 0, 65535, pos, OSD_BAR_POS2); } void osd_display_info(char *info, ...) { @@ -566,7 +592,8 @@ if(gGui->osd.enabled && !gGui->on_quit) { va_list args; char *buf; - int n, size = 100; + int n, x, size = 100; + int wwidth, wheight; if((buf = xine_xmalloc(size)) == NULL) return; @@ -588,11 +615,16 @@ if((buf = realloc(buf, size)) == NULL) return; } + _osd_get_output_size(&wwidth, &wheight); xine_osd_clear(gGui->osd.info.osd[0]); + if( wwidth <= 720 ) /* work-around */ + x = ((wwidth - iBarWidth) / 2) >> 1; /* be nice to know what the deal is here */ + else + x = ((wwidth - iBarWidth) / 2); xine_osd_draw_text(gGui->osd.info.osd[0], 0, 0, buf, XINE_OSD_TEXT1); - xine_osd_set_position(gGui->osd.info.osd[0], 20, 10 + 30); + xine_osd_set_position(gGui->osd.info.osd[0], x, wheight - (iBarHeight * 3) - 2 - iBarHeight - (iFontSize * 2)); pthread_mutex_lock(&osd_mutex); _xine_osd_show(gGui->osd.info.osd[0], 0); @@ -631,11 +663,11 @@ switch(status) { case XINE_STATUS_IDLE: case XINE_STATUS_STOP: - strlcpy(buffer, _osd_get_status_sym(status), sizeof(buffer)); + /* strlcpy(buffer, _osd_get_status_sym(status), sizeof(buffer)); */ break; case XINE_STATUS_PLAY: - { + /*{ int speed = xine_get_param(gGui->stream, XINE_PARAM_SPEED); int secs; @@ -648,7 +680,7 @@ else strlcpy(buffer, _osd_get_speed_sym(speed), sizeof(buffer)); - } + }*/ break; case XINE_STATUS_QUIT: @@ -656,10 +688,9 @@ break; } - if( gGui->osd.use_unscaled && gGui->osd.unscaled_available ) - xine_osd_set_font(gGui->osd.status.osd[0], "cetus", UNSCALED_FONT_SIZE); - else - xine_osd_set_font(gGui->osd.status.osd[0], "cetus", FONT_SIZE); + _osd_get_output_size(&wwidth, &wheight); + + xine_osd_set_font(gGui->osd.status.osd[0], "cetus", iFontSize); /* set latin1 encoding (NULL) for status text with special characters, * then switch back to locale encoding ("") @@ -669,8 +700,6 @@ xine_osd_set_encoding(gGui->osd.status.osd[0], ""); xine_osd_set_position(gGui->osd.status.osd[0], 20, 10); - _osd_get_output_size(&wwidth, &wheight); - /* don't even bother drawing osd over those small streams. * it would look pretty bad. */ @@ -770,7 +799,7 @@ if(gGui->osd.sinfo.visible) { xine_osd_hide(gGui->osd.sinfo.osd[0], 0); - x = (wwidth - gGui->osd.sinfo.w) - 40; + x = (wwidth - gGui->osd.sinfo.w) - 60; xine_osd_set_position(gGui->osd.sinfo.osd[0], (x >= 0) ? x : 0, gGui->osd.sinfo.y); _xine_osd_show(gGui->osd.sinfo.osd[0], 0); } @@ -779,9 +808,12 @@ xine_osd_hide(gGui->osd.bar.osd[0], 0); xine_osd_hide(gGui->osd.bar.osd[1], 0); - x = (wwidth - BAR_WIDTH) >> 1; - xine_osd_set_position(gGui->osd.bar.osd[0], (x >= 0) ? x : 0, (wheight - BAR_HEIGHT) - 40); - xine_osd_set_position(gGui->osd.bar.osd[1], (x >= 0) ? x : 0, (wheight - (BAR_HEIGHT * 2)) - 40); + if( wwidth <= 720 ) /* work-around */ + x = ((wwidth - iBarWidth) / 2) >> 1; /* be nice to know what the deal is here */ + else + x = ((wwidth - iBarWidth) / 2); + xine_osd_set_position(gGui->osd.bar.osd[0], (x >= 0) ? x : 0, wheight - (iBarHeight * 3) - iBarHeight); + xine_osd_set_position(gGui->osd.bar.osd[1], (x >= 0) ? x : 0, wheight - (iBarHeight * 3) - iBarHeight - iFontSize - 2); /* don't even bother drawing osd over those small streams. * it would look pretty bad. diff -Naur xine-ui-cvs-02-26-08.org/src/xitk/osd.h xine-ui-cvs-02-26-08/src/xitk/osd.h --- xine-ui-cvs-02-26-08.org/src/xitk/osd.h 2008-01-16 07:45:28.000000000 -0700 +++ xine-ui-cvs-02-26-08/src/xitk/osd.h 2008-04-05 21:27:22.000000000 -0400 @@ -38,6 +38,7 @@ #define OSD_BAR_POS 2 #define OSD_BAR_POS2 3 #define OSD_BAR_STEPPER 4 +#define OSD_ZOOM 5 void osd_init(void); void osd_hide_sinfo(void); diff -Naur xine-ui-cvs-02-26-08.org/src/xitk/panel.c xine-ui-cvs-02-26-08/src/xitk/panel.c --- xine-ui-cvs-02-26-08.org/src/xitk/panel.c 2008-01-19 15:03:00.000000000 -0700 +++ xine-ui-cvs-02-26-08/src/xitk/panel.c 2008-03-10 22:07:04.000000000 -0600 @@ -545,6 +545,8 @@ * Show/Hide panel window. */ static void _panel_toggle_visibility (xitk_widget_t *w, void *data) { + if (gGui->nongui_error_msg) return; + int visible = xitk_is_window_visible(gGui->display, gGui->panel_window); if(((!panel->visible || !visible) && !playlist_is_visible()) || (visible && playlist_is_visible())) @@ -828,12 +830,18 @@ if(gGui->mixer.method == SOFTWARE_MIXER) { gGui->mixer.mute = state; xine_set_param(gGui->stream, XINE_PARAM_AUDIO_AMP_MUTE, gGui->mixer.mute); - osd_display_info(_("Amp: %s"), gGui->mixer.mute ? _("Muted") : _("Unmuted")); + if(gGui->mixer.mute) + osd_draw_bar(_("Mute"), 0, 100, gGui->mixer.volume_level, OSD_BAR_STEPPER); + else + osd_hide(); } else if(gGui->mixer.caps & MIXER_CAP_MUTE) { gGui->mixer.mute = state; xine_set_param(gGui->stream, XINE_PARAM_AUDIO_MUTE, gGui->mixer.mute); - osd_display_info(_("Audio: %s"), gGui->mixer.mute ? _("Muted") : _("Unmuted")); + if(gGui->mixer.mute) + osd_draw_bar(_("Mute"), 0, 100, gGui->mixer.volume_level, OSD_BAR_STEPPER); + else + osd_hide(); } panel_check_mute(); }