Author: cazfi
Date: Fri Oct 30 21:18:18 2015
New Revision: 30324

URL: http://svn.gna.org/viewcvs/freeciv?rev=30324&view=rev
Log:
Updated Zoom API
- Added zoom_1_0() to set zoom level to exactly 1.0. For optimization purposes 
we
  can then consider zoom disabled
- Added zoom_is_enabled() to query whether zoom is enabled (not exactly 1.0)
- Added zoom_get_level() to query current zoom level
- Renamed set_map_zoom() as zoom_set()

See patch #6488

Modified:
    branches/S2_6/client/gui-gtk-3.0/gui_main.c
    branches/S2_6/client/zoom.c
    branches/S2_6/client/zoom.h

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=30324&r1=30323&r2=30324&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 Oct 30 21:18:18 2015
@@ -294,7 +294,7 @@
     } else if ((option = get_option_malloc("--zoom", argv, &i, argc))) {
       char *endptr;
 
-      set_map_zoom(strtof(option, &endptr));
+      zoom_set(strtof(option, &endptr));
     }
     /* Can't check against unknown options, as those might be gtk options */
 

Modified: branches/S2_6/client/zoom.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/zoom.c?rev=30324&r1=30323&r2=30324&view=diff
==============================================================================
--- branches/S2_6/client/zoom.c (original)
+++ branches/S2_6/client/zoom.c Fri Oct 30 21:18:18 2015
@@ -22,13 +22,26 @@
 
 
 float map_zoom = 1.0;
+bool zoom_enabled = FALSE;
 
 /**************************************************************************
   Set map zoom level.
 **************************************************************************/
-void set_map_zoom(float new_zoom)
+void zoom_set(float new_zoom)
 {
+  zoom_enabled = TRUE;
   map_zoom = new_zoom;
 
   map_canvas_resized(mapview.width, mapview.height);
 }
+
+/**************************************************************************
+  Set map zoom level to exactly one.
+**************************************************************************/
+void zoom_1_0(void)
+{
+  zoom_enabled = FALSE;
+  map_zoom = 1.0;
+
+  map_canvas_resized(mapview.width, mapview.height);
+}

Modified: branches/S2_6/client/zoom.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/zoom.h?rev=30324&r1=30323&r2=30324&view=diff
==============================================================================
--- branches/S2_6/client/zoom.h (original)
+++ branches/S2_6/client/zoom.h Fri Oct 30 21:18:18 2015
@@ -17,8 +17,13 @@
 extern "C" {
 #endif /* __cplusplus */
 
-void set_map_zoom(float new_zoom);
+void zoom_set(float new_zoom);
+void zoom_1_0(void);
 
+#define zoom_get_level() map_zoom
+#define zoom_is_enabled() zoom_enabled
+
+extern bool zoom_enabled;
 extern float map_zoom;
 
 #ifdef __cplusplus


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

Reply via email to