Author: cazfi
Date: Fri Jan  1 00:21:56 2016
New Revision: 31280

URL: http://svn.gna.org/viewcvs/freeciv?rev=31280&view=rev
Log:
Set zoom level as given in client rc-file

See patch #6746

Modified:
    branches/S2_6/client/gui-gtk-2.0/canvas.c
    branches/S2_6/client/gui-gtk-3.0/canvas.c
    branches/S2_6/client/gui-gtk-3.0/gui_main.c
    branches/S2_6/client/gui-qt/canvas.cpp
    branches/S2_6/client/gui-qt/qtg_cxxside.cpp
    branches/S2_6/client/gui-qt/qtg_cxxside.h
    branches/S2_6/client/gui-sdl/canvas.c
    branches/S2_6/client/gui-sdl2/canvas.c
    branches/S2_6/client/gui-stub/canvas.c
    branches/S2_6/client/gui-xaw/mapview.c
    branches/S2_6/client/gui_cbsetter.c
    branches/S2_6/client/gui_interface.c
    branches/S2_6/client/gui_interface.h
    branches/S2_6/client/include/canvas_g.h
    branches/S2_6/client/update_queue.c

Modified: branches/S2_6/client/gui-gtk-2.0/canvas.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/canvas.c?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui-gtk-2.0/canvas.c   (original)
+++ branches/S2_6/client/gui-gtk-2.0/canvas.c   Fri Jan  1 00:21:56 2016
@@ -50,6 +50,14 @@
 void canvas_set_zoom(struct canvas *store, float zoom)
 {
   /* gtk2-client has no zoom support */
+}
+
+/****************************************************************************
+  This gui has zoom support.
+****************************************************************************/
+bool has_zoom_support(void)
+{
+  return FALSE;
 }
 
 /****************************************************************************

Modified: branches/S2_6/client/gui-gtk-3.0/canvas.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/canvas.c?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui-gtk-3.0/canvas.c   (original)
+++ branches/S2_6/client/gui-gtk-3.0/canvas.c   Fri Jan  1 00:21:56 2016
@@ -53,6 +53,14 @@
 void canvas_set_zoom(struct canvas *store, float zoom)
 {
   store->zoom = zoom;
+}
+
+/****************************************************************************
+  This gui has zoom support.
+****************************************************************************/
+bool has_zoom_support(void)
+{
+  return TRUE;
 }
 
 /****************************************************************************

Modified: branches/S2_6/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/gui_main.c?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui-gtk-3.0/gui_main.c (original)
+++ branches/S2_6/client/gui-gtk-3.0/gui_main.c Fri Jan  1 00:21:56 2016
@@ -304,7 +304,8 @@
     } else if ((option = get_option_malloc("--zoom", argv, &i, argc))) {
       char *endptr;
 
-      zoom_set(strtof(option, &endptr));
+      gui_options.zoom_set = TRUE;
+      gui_options.zoom_default_level = strtof(option, &endptr);
     } else if ((option = get_option_malloc("--resolution", argv, &i, argc))) {
       if (!string_to_video_mode(option, &vmode)) {
         fc_fprintf(stderr, _("Illegal video mode '%s'"), option);

Modified: branches/S2_6/client/gui-qt/canvas.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/canvas.cpp?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/canvas.cpp      (original)
+++ branches/S2_6/client/gui-qt/canvas.cpp      Fri Jan  1 00:21:56 2016
@@ -51,6 +51,14 @@
 void qtg_canvas_set_zoom(struct canvas *store, float zoom)
 {
   /* Qt-client has no zoom support */
+}
+
+/****************************************************************************
+  This gui has zoom support.
+****************************************************************************/
+bool qtg_has_zoom_support()
+{
+  return FALSE;
 }
 
 /****************************************************************************

Modified: branches/S2_6/client/gui-qt/qtg_cxxside.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/qtg_cxxside.cpp?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/qtg_cxxside.cpp (original)
+++ branches/S2_6/client/gui-qt/qtg_cxxside.cpp Fri Jan  1 00:21:56 2016
@@ -53,6 +53,7 @@
   funcs->canvas_create = qtg_canvas_create;
   funcs->canvas_free = qtg_canvas_free;
   funcs->canvas_set_zoom = qtg_canvas_set_zoom;
+  funcs->has_zoom_support = qtg_has_zoom_support;
   funcs->canvas_copy = qtg_canvas_copy;
   funcs->canvas_put_sprite = qtg_canvas_put_sprite;
   funcs->canvas_put_sprite_full = qtg_canvas_put_sprite_full;

Modified: branches/S2_6/client/gui-qt/qtg_cxxside.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/qtg_cxxside.h?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/qtg_cxxside.h   (original)
+++ branches/S2_6/client/gui-qt/qtg_cxxside.h   Fri Jan  1 00:21:56 2016
@@ -53,6 +53,7 @@
 struct canvas *qtg_canvas_create(int width, int height);
 void qtg_canvas_free(struct canvas *store);
 void qtg_canvas_set_zoom(struct canvas *store, float zoom);
+bool qtg_has_zoom_support();
 void qtg_canvas_copy(struct canvas *dest, struct canvas *src,
                     int src_x, int src_y, int dest_x, int dest_y, int width,
                     int height);

Modified: branches/S2_6/client/gui-sdl/canvas.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl/canvas.c?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui-sdl/canvas.c       (original)
+++ branches/S2_6/client/gui-sdl/canvas.c       Fri Jan  1 00:21:56 2016
@@ -78,6 +78,14 @@
 void canvas_set_zoom(struct canvas *store, float zoom)
 {
   /* sdl-client has no zoom support */
+}
+
+/****************************************************************************
+  This gui has zoom support.
+****************************************************************************/
+bool has_zoom_support(void)
+{
+  return FALSE;
 }
 
 /**************************************************************************

Modified: branches/S2_6/client/gui-sdl2/canvas.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl2/canvas.c?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui-sdl2/canvas.c      (original)
+++ branches/S2_6/client/gui-sdl2/canvas.c      Fri Jan  1 00:21:56 2016
@@ -68,6 +68,14 @@
   /* sdl2-client has no zoom support */
 }
 
+/****************************************************************************
+  This gui has zoom support.
+****************************************************************************/
+bool has_zoom_support(void)
+{
+  return FALSE;
+}
+
 /**************************************************************************
   Copies an area from the source canvas to the destination canvas.
 **************************************************************************/

Modified: branches/S2_6/client/gui-stub/canvas.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-stub/canvas.c?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui-stub/canvas.c      (original)
+++ branches/S2_6/client/gui-stub/canvas.c      Fri Jan  1 00:21:56 2016
@@ -44,6 +44,14 @@
 void gui_canvas_set_zoom(struct canvas *store, float zoom)
 {
   /* PORTME */
+}
+
+/****************************************************************************
+  This gui has zoom support.
+****************************************************************************/
+bool gui_has_zoom_support(void)
+{
+  return FALSE;
 }
 
 /****************************************************************************

Modified: branches/S2_6/client/gui-xaw/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-xaw/mapview.c?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui-xaw/mapview.c      (original)
+++ branches/S2_6/client/gui-xaw/mapview.c      Fri Jan  1 00:21:56 2016
@@ -124,6 +124,14 @@
 void canvas_set_zoom(struct canvas *store, float zoom)
 {
   /* xaw-client has no zoom support */
+}
+
+/****************************************************************************
+  This gui has zoom support.
+****************************************************************************/
+bool has_zoom_support(void)
+{
+  return FALSE;
 }
 
 /****************************************************************************

Modified: branches/S2_6/client/gui_cbsetter.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui_cbsetter.c?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui_cbsetter.c (original)
+++ branches/S2_6/client/gui_cbsetter.c Fri Jan  1 00:21:56 2016
@@ -67,6 +67,7 @@
   funcs->canvas_create = gui_canvas_create;
   funcs->canvas_free = gui_canvas_free;
   funcs->canvas_set_zoom = gui_canvas_set_zoom;
+  funcs->has_zoom_support = gui_has_zoom_support;
   funcs->canvas_copy = gui_canvas_copy;
   funcs->canvas_put_sprite = gui_canvas_put_sprite;
   funcs->canvas_put_sprite_full = gui_canvas_put_sprite_full;

Modified: branches/S2_6/client/gui_interface.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui_interface.c?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui_interface.c        (original)
+++ branches/S2_6/client/gui_interface.c        Fri Jan  1 00:21:56 2016
@@ -210,6 +210,14 @@
 }
 
 /**************************************************************************
+  Call has_zoom_support callback
+**************************************************************************/
+bool has_zoom_support(void)
+{
+  return funcs.has_zoom_support();
+}
+
+/**************************************************************************
   Call canvas_copy callback
 **************************************************************************/
 void canvas_copy(struct canvas *dest, struct canvas *src,

Modified: branches/S2_6/client/gui_interface.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui_interface.h?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/gui_interface.h        (original)
+++ branches/S2_6/client/gui_interface.h        Fri Jan  1 00:21:56 2016
@@ -61,6 +61,7 @@
   struct canvas *(*canvas_create)(int width, int height);
   void (*canvas_free)(struct canvas *store);
   void (*canvas_set_zoom)(struct canvas *store, float zoom);
+  bool (*has_zoom_support)(void);
   void (*canvas_copy)(struct canvas *dest, struct canvas *src,
                       int src_x, int src_y, int dest_x, int dest_y, int width,
                       int height);

Modified: branches/S2_6/client/include/canvas_g.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/include/canvas_g.h?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/include/canvas_g.h     (original)
+++ branches/S2_6/client/include/canvas_g.h     Fri Jan  1 00:21:56 2016
@@ -31,6 +31,7 @@
 GUI_FUNC_PROTO(void, canvas_free, struct canvas *store)
 
 GUI_FUNC_PROTO(void, canvas_set_zoom, struct canvas *store, float zoom)
+GUI_FUNC_PROTO(bool, has_zoom_support, void)
 
 /* Drawing functions */
 GUI_FUNC_PROTO(void, canvas_copy, struct canvas *dest, struct canvas *src,

Modified: branches/S2_6/client/update_queue.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/update_queue.c?rev=31280&r1=31279&r2=31280&view=diff
==============================================================================
--- branches/S2_6/client/update_queue.c (original)
+++ branches/S2_6/client/update_queue.c Fri Jan  1 00:21:56 2016
@@ -25,6 +25,7 @@
 #include "player.h"
 
 /* client/include */
+#include "canvas_g.h"
 #include "citydlg_g.h"
 #include "cityrep_g.h"
 #include "dialogs_g.h"
@@ -38,6 +39,8 @@
 /* client */
 #include "client_main.h"
 #include "connectdlg_common.h"
+#include "options.h"
+#include "zoom.h"
 
 #include "update_queue.h"
 
@@ -472,7 +475,19 @@
 ****************************************************************************/
 static void set_client_page_callback(void *data)
 {
-  real_set_client_page(FC_PTR_TO_INT(data));
+  enum client_pages page = FC_PTR_TO_INT(data);
+
+  real_set_client_page(page);
+
+  if (page == PAGE_GAME) {
+    if (has_zoom_support()) {
+      if (gui_options.zoom_set) {
+        zoom_set(gui_options.zoom_default_level);
+      } else {
+        zoom_1_0();
+      }
+    }
+  }
 }
 
 /****************************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to