Any comment on this?

Am 02.03.2013 11:51, schrieb Jonas Petersen:
> Hi there,
>
> I have added a (maybe even "the") missing wallpaper mode to pcmanfm.
>
> I can be described as follows: The image will be cropped by the maximum
> necessary amount to fill the whole screen without changing the aspect ratio
> (i.e. stretch).
>
> Technically it is a variation of the 'fit' mode. The difference is that it
> uses the greater of the width/height aspect ratios to scale the image.
> Thus it cuts off the image on two sides, as compaired to filling (the other)
> two sides with the background color.
>
> I have not added any translations yet. I'm not sure what the workflow would
> be here. One combo box item was added: "Crop to fill the entire screen".
> The german translation (considering the existing translations of the other
> items) would be "Zuschneiden".
>
> Regards
> Jonas Petersen
>
>
> Signed-off-by: Jonas Petersen <[email protected]>
> ---
>   data/ui/desktop-pref.glade |    8 ++++++--
>   src/app-config.h           |    1 +
>   src/desktop.c              |    5 ++++-
>   src/pcmanfm.c              |    4 ++--
>   4 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/data/ui/desktop-pref.glade b/data/ui/desktop-pref.glade
> index 25f7769..45b56c7 100644
> --- a/data/ui/desktop-pref.glade
> +++ b/data/ui/desktop-pref.glade
> @@ -636,13 +636,17 @@
>           <col id="1">2</col>
>         </row>
>         <row>
> -        <col id="0" translatable="yes">Center on the screen</col>
> +        <col id="0" translatable="yes">Crop to fill the entire screen</col>
>           <col id="1">3</col>
>         </row>
>         <row>
> -        <col id="0" translatable="yes">Tile the image to fill the entire 
> screen</col>
> +        <col id="0" translatable="yes">Center on the screen</col>
>           <col id="1">4</col>
>         </row>
> +      <row>
> +        <col id="0" translatable="yes">Tile the image to fill the entire 
> screen</col>
> +        <col id="1">5</col>
> +      </row>
>       </data>
>     </object>
>   </interface>
> diff --git a/src/app-config.h b/src/app-config.h
> index a72d472..68ac99d 100644
> --- a/src/app-config.h
> +++ b/src/app-config.h
> @@ -46,6 +46,7 @@ typedef enum
>       FM_WP_COLOR,
>       FM_WP_STRETCH,
>       FM_WP_FIT,
> +    FM_WP_CROP,
>       FM_WP_CENTER,
>       FM_WP_TILE
>   }FmWallpaperMode;
> diff --git a/src/desktop.c b/src/desktop.c
> index 6725313..a2531f1 100644
> --- a/src/desktop.c
> +++ b/src/desktop.c
> @@ -892,11 +892,14 @@ static void update_background(FmDesktop* desktop, int 
> is_it)
>               pix = scaled;
>               break;
>           case FM_WP_FIT:
> +        case FM_WP_CROP:
>               if(dest_w != src_w || dest_h != src_h)
>               {
>                   gdouble w_ratio = (float)dest_w / src_w;
>                   gdouble h_ratio = (float)dest_h / src_h;
> -                gdouble ratio = MIN(w_ratio, h_ratio);
> +                gdouble ratio = app_config->wallpaper_mode == FM_WP_FIT
> +                    ? MIN(w_ratio, h_ratio)
> +                    : MAX(w_ratio, h_ratio);
>                   if(ratio != 1.0)
>                   {
>                       src_w *= ratio;
> diff --git a/src/pcmanfm.c b/src/pcmanfm.c
> index d62bb5f..bb1fee4 100644
> --- a/src/pcmanfm.c
> +++ b/src/pcmanfm.c
> @@ -83,7 +83,7 @@ static GOptionEntry opt_entries[] =
>       { "one-screen", '\0', 0, G_OPTION_ARG_NONE, &one_screen, N_("Use 
> --desktop option only for one screen"), NULL },
>       { "set-wallpaper", 'w', 0, G_OPTION_ARG_FILENAME, &set_wallpaper, 
> N_("Set desktop wallpaper from image FILE"), N_("FILE") },
>                       /* don't translate list of modes in description, please 
> */
> -    { "wallpaper-mode", '\0', 0, G_OPTION_ARG_STRING, &wallpaper_mode, 
> N_("Set mode of desktop wallpaper. MODE=(color|stretch|fit|center|tile)"), 
> N_("MODE") },
> +    { "wallpaper-mode", '\0', 0, G_OPTION_ARG_STRING, &wallpaper_mode, 
> N_("Set mode of desktop wallpaper. 
> MODE=(color|stretch|fit|crop|center|tile)"), N_("MODE") },
>       { "show-pref", '\0', 0, G_OPTION_ARG_INT, &show_pref, N_("Open 
> Preferences dialog on the page N"), N_("N") },
>       { "new-win", 'n', 0, G_OPTION_ARG_NONE, &new_win, N_("Open new 
> window"), NULL },
>       /* { "find-files", 'f', 0, G_OPTION_ARG_NONE, &find_files, N_("Open 
> Find Files utility"), NULL }, */
> @@ -92,7 +92,7 @@ static GOptionEntry opt_entries[] =
>       { NULL }
>   };
>   
> -static const char* valid_wallpaper_modes[] = {"color", "stretch", "fit", 
> "center", "tile"};
> +static const char* valid_wallpaper_modes[] = {"color", "stretch", "fit", 
> "crop", "center", "tile"};
>   
>   static gboolean pcmanfm_run(gint screen_num);
>   


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Pcmanfm-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pcmanfm-develop

Reply via email to