[vlc-devel] [WIP] hotkeys: new hotkeys for changing font size

Jean-Baptiste Kempf jb at videolan.org
Sat Mar 7 20:02:07 CET 2015


On 07 Mar, Hannes Domani wrote :
> Sadly this doesn't work with libass subtitles (is it possible there?).


> From 2257cd6895f64d11e0a2b45c79666c7ad8039974 Mon Sep 17 00:00:00 2001
> From: Hannes Domani <ssbssa at yahoo.de>
> Date: Sat, 7 Mar 2015 19:40:02 +0100
> Subject: [PATCH] hotkeys: new hotkeys for changing font size
> 
> ---
>  include/vlc_keys.h        |  3 +++
>  modules/control/hotkeys.c | 33 +++++++++++++++++++++++++++++++++
>  src/config/keys.c         |  2 ++
>  src/libvlc-module.c       | 14 ++++++++++++++
>  4 files changed, 52 insertions(+)
> 
> diff --git a/include/vlc_keys.h b/include/vlc_keys.h
> index 49edab3..e248d08 100644
> --- a/include/vlc_keys.h
> +++ b/include/vlc_keys.h
> @@ -224,6 +224,9 @@ typedef enum vlc_action {
>      ACTIONID_PROGRAM_SID_NEXT,
>      ACTIONID_PROGRAM_SID_PREV,
>      ACTIONID_INTF_POPUP_MENU,
> +    /* font size */
> +    ACTIONID_FONT_SIZE_UP,
> +    ACTIONID_FONT_SIZE_DOWN,

OK

>  
>  } vlc_action_t;
>  
> diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
> index 77843a3..ff8680d 100644
> --- a/modules/control/hotkeys.c
> +++ b/modules/control/hotkeys.c
> @@ -1095,6 +1095,39 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
>              if( p_vout && vout_OSDEpg( p_vout, input_GetItem( p_input ) ) )
>                  DisplayPosition( p_intf, p_vout, p_input );
>              break;
> +
> +        /* font size */
> +        case ACTIONID_FONT_SIZE_UP:
> +        case ACTIONID_FONT_SIZE_DOWN:
> +            if( p_vout )
> +            {
> +                module_config_t *p_config = config_FindConfig(
> +                        VLC_OBJECT(p_vout), "freetype-rel-fontsize" );

No, this is a bad idea. You should trigger that in the core.


> +                if( p_config )
> +                {
> +                    int i;
> +                    for( i = 0; i < p_config->list_count; i++ )
> +                    {
> +                        if( p_config->value.i == p_config->list.i[i] )
> +                        {
> +                            if( i_action == ACTIONID_FONT_SIZE_UP )
> +                                i++;
> +                            else
> +                                i--;
> +                            break;
> +                        }
> +                    }
> +                    if( i >= 0 && i < p_config->list_count )
> +                    {
> +                        config_PutInt( VLC_OBJECT(p_vout),
> +                                p_config->psz_name, p_config->list.i[i] );
> +
> +                        DisplayMessage( p_vout, _("Relative font size: %s"),
> +                                p_config->list_text[i] );
> +                    }
> +                }
> +            }
> +            break;
>      }
>  
>      if( p_vout )
> diff --git a/src/config/keys.c b/src/config/keys.c
> index b247a57..ac27208 100644
> --- a/src/config/keys.c
> +++ b/src/config/keys.c
> @@ -288,6 +288,8 @@ static const struct action actions[] =
>      { "deinterlace-mode", ACTIONID_DEINTERLACE_MODE, },
>      { "disc-menu", ACTIONID_DISC_MENU, },
>      { "faster", ACTIONID_FASTER, },
> +    { "font-size-down", ACTIONID_FONT_SIZE_DOWN, },
> +    { "font-size-up", ACTIONID_FONT_SIZE_UP, },
>      { "frame-next", ACTIONID_FRAME_NEXT, },
>      { "incr-scalefactor", ACTIONID_SCALE_UP, },
>      { "intf-boss", ACTIONID_INTF_BOSS, },
> diff --git a/src/libvlc-module.c b/src/libvlc-module.c
> index 76b1914..a7f1408 100644
> --- a/src/libvlc-module.c
> +++ b/src/libvlc-module.c
> @@ -1397,6 +1397,12 @@ static const char *const mouse_wheel_texts[] = {
>  #define AUDI_DEVICE_CYCLE_KEY_TEXT N_("Cycle through audio devices")
>  #define AUDI_DEVICE_CYCLE_KEY_LONGTEXT N_("Cycle through available audio devices")
>  
> +#define FONT_SIZE_UP_KEY_TEXT N_("Increase font size")
> +#define FONT_SIZE_UP_KEY_LONGTEXT FONT_SIZE_UP_KEY_TEXT
> +
> +#define FONT_SIZE_DOWN_KEY_TEXT N_("Decrease font size")
> +#define FONT_SIZE_DOWN_KEY_LONGTEXT FONT_SIZE_DOWN_KEY_TEXT
> +
>  /*
>   * Quick usage guide for the configuration options:
>   *
> @@ -2167,6 +2173,8 @@ vlc_module_begin ()
>  #   define KEY_UNZOOM             "Shift+z"
>  #   define KEY_RANDOM             "Command+z"
>  #   define KEY_LOOP               "Shift+l"
> +#   define KEY_FONT_SIZE_UP       NULL
> +#   define KEY_FONT_SIZE_DOWN     NULL
>  
>  #   define KEY_CROP_TOP           "Alt+i"
>  #   define KEY_UNCROP_TOP         "Alt+Shift+i"
> @@ -2276,6 +2284,8 @@ vlc_module_begin ()
>  #   define KEY_AUDIODELAY_DOWN    "j"
>  #   define KEY_RANDOM             "r"
>  #   define KEY_LOOP               "l"
> +#   define KEY_FONT_SIZE_UP       NULL
> +#   define KEY_FONT_SIZE_DOWN     NULL
>  
>  #   define KEY_AUDIO_TRACK        "b"
>  #   define KEY_SUBTITLE_TRACK     "v"
> @@ -2509,6 +2519,10 @@ vlc_module_begin ()
>               RANDOM_KEY_TEXT, RANDOM_KEY_LONGTEXT, false )
>      add_key( "key-loop", KEY_LOOP,
>               LOOP_KEY_TEXT, LOOP_KEY_LONGTEXT, false )
> +    add_key( "key-font-size-up", KEY_FONT_SIZE_UP,
> +             FONT_SIZE_UP_KEY_TEXT, FONT_SIZE_UP_KEY_LONGTEXT, true )
> +    add_key( "key-font-size-down", KEY_FONT_SIZE_DOWN,
> +             FONT_SIZE_DOWN_KEY_TEXT, FONT_SIZE_DOWN_KEY_LONGTEXT, true )
>  
>      set_section ( N_("Zoom" ), NULL )
>      add_key( "key-zoom-quarter",  KEY_ZOOM_QUARTER,
-- 
1.9.4.msysgit.2

> 
> Tell me what you think.
> 
> 
> Regards
> Domani Hannes


> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


-- 
With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device



More information about the vlc-devel mailing list