From 468d8d87be69c1c44d1fa4b299a08c1656c0d702 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 3 Jun 2021 02:57:19 +0300 Subject: [PATCH 55/55] Enable 1.0/2.0 zoom functionality by default Make only arbitrary zoom levels depend on configure time option to enable experimental zoom support. See osdn #42457 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.22/gui_main.c | 10 ++++------ client/gui-gtk-4.0/gui_main.c | 10 ++++------ client/zoom.c | 4 ++++ configure.ac | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/client/gui-gtk-3.22/gui_main.c b/client/gui-gtk-3.22/gui_main.c index 37924c49f3..f2c16c4095 100644 --- a/client/gui-gtk-3.22/gui_main.c +++ b/client/gui-gtk-3.22/gui_main.c @@ -260,14 +260,14 @@ static void print_usage(void) _("-r, --resolution WIDTHxHEIGHT\tAssume given resolution " "screen\n")); -#ifdef GTK3_ZOOM_ENABLED +#ifdef EXP_ZOOM_LEVELS fc_fprintf(stderr, /* TRANS: Keep word 'default' untranslated */ _("-z, --zoom LEVEL\tSet zoom level; use value 'default' " "to reset\n\n")); #else fc_fprintf(stderr, "\n"); -#endif /* GTK3_ZOOM_ENABLED */ +#endif /* EXP_ZOOM_LEVELS */ /* TRANS: No full stop after the URL, could cause confusion. */ fc_fprintf(stderr, _("Report bugs at %s\n"), BUG_URL); @@ -288,7 +288,7 @@ static void parse_options(int argc, char **argv) print_usage(); exit(EXIT_SUCCESS); -#ifdef GTK3_ZOOM_ENABLED +#ifdef EXP_ZOOM_LEVELS } else if ((option = get_option_malloc("--zoom", argv, &i, argc, FALSE))) { char *endptr; @@ -299,7 +299,7 @@ static void parse_options(int argc, char **argv) gui_options.zoom_set = FALSE; } free(option); -#endif /* GTK3_ZOOM_ENABLED */ +#endif /* EXP_ZOOM_LEVELS */ } else if ((option = get_option_malloc("--resolution", argv, &i, argc, FALSE))) { if (!string_to_video_mode(option, &vmode)) { @@ -451,7 +451,6 @@ static gboolean key_press_map_canvas(GtkWidget *w, GdkEventKey *ev, } } -#ifdef GTK3_ZOOM_ENABLED if (!(ev->state & GDK_CONTROL_MASK)) { switch (ev->keyval) { case GDK_KEY_plus: @@ -466,7 +465,6 @@ static gboolean key_press_map_canvas(GtkWidget *w, GdkEventKey *ev, break; } } -#endif /* GTK3_ZOOM_ENABLED */ /* Return here if observer */ if (client_is_observer()) { diff --git a/client/gui-gtk-4.0/gui_main.c b/client/gui-gtk-4.0/gui_main.c index dd2fb79f43..f5fa7de631 100644 --- a/client/gui-gtk-4.0/gui_main.c +++ b/client/gui-gtk-4.0/gui_main.c @@ -254,14 +254,14 @@ static void print_usage(void) _("-r, --resolution WIDTHxHEIGHT\tAssume given resolution " "screen\n")); -#ifdef GTK3_ZOOM_ENABLED +#ifdef EXP_ZOOM_LEVELS fc_fprintf(stderr, /* TRANS: Keep word 'default' untranslated */ _("-z, --zoom LEVEL\tSet zoom level; use value 'default' " "to reset\n\n")); #else fc_fprintf(stderr, "\n"); -#endif /* GTK3_ZOOM_ENABLED */ +#endif /* EXP_ZOOM_LEVELS */ /* TRANS: No full stop after the URL, could cause confusion. */ fc_fprintf(stderr, _("Report bugs at %s\n"), BUG_URL); @@ -282,7 +282,7 @@ static void parse_options(int argc, char **argv) print_usage(); exit(EXIT_SUCCESS); -#ifdef GTK3_ZOOM_ENABLED +#ifdef EXP_ZOOM_LEVELS } else if ((option = get_option_malloc("--zoom", argv, &i, argc, FALSE))) { char *endptr; @@ -293,7 +293,7 @@ static void parse_options(int argc, char **argv) gui_options.zoom_set = FALSE; } free(option); -#endif /* GTK3_ZOOM_ENABLED */ +#endif /* EXP_ZOOM_LEVELS */ } else if ((option = get_option_malloc("--resolution", argv, &i, argc, FALSE))) { if (!string_to_video_mode(option, &vmode)) { @@ -451,7 +451,6 @@ static gboolean key_press_map_canvas(GtkWidget *w, GdkEvent *ev, } } -#ifdef GTK3_ZOOM_ENABLED if (!(state & GDK_CONTROL_MASK)) { switch (keyval) { case GDK_KEY_plus: @@ -466,7 +465,6 @@ static gboolean key_press_map_canvas(GtkWidget *w, GdkEvent *ev, break; } } -#endif /* GTK3_ZOOM_ENABLED */ /* Return here if observer */ if (client_is_observer()) { diff --git a/client/zoom.c b/client/zoom.c index 032bc7c2bf..0e79443aa4 100644 --- a/client/zoom.c +++ b/client/zoom.c @@ -25,7 +25,11 @@ float map_zoom = 1.0; bool zoom_enabled = FALSE; static float zoom_steps[] = { +#ifdef EXP_ZOOM_LEVELS -1.0, 0.13, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 2.0, 2.5, 3.0, 4.0, -1.0 +#else + -1.0, 1.0, 2.0, -1.0 +#endif /* EXP_ZOOM_LEVELS */ }; static struct zoom_data diff --git a/configure.ac b/configure.ac index 3bd35a71b5..ec78b54d3c 100644 --- a/configure.ac +++ b/configure.ac @@ -480,8 +480,8 @@ for gui in $(echo $clients | $SED 's/,/ /g') ; do done AC_ARG_WITH([zoom], - [AS_HELP_STRING([--with-zoom], [expose experimental/WIP zoom support on gtk3-clients to user])], - [AC_DEFINE([GTK3_ZOOM_ENABLED], [1], [Experimental zoom functionality exposed to user])]) + [AS_HELP_STRING([--with-zoom], [expose experimental zoom levels support on gtk-clients to user])], + [AC_DEFINE([EXP_ZOOM_LEVELS], [1], [Experimental zoom levels (other than 1.0 and 2.0)])]) AC_ARG_WITH([3d], [AS_HELP_STRING([--with-3d], [build WIP 3D support to gtk3.22-client])], -- 2.30.2