[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52291] trunk/blender/source/blender/ windowmanager/intern/wm_playanim.c: playanim move zooming into a static function, the switch statement passthrough was unnecessarily confusing.

Campbell Barton ideasman42 at gmail.com
Sat Nov 17 07:05:44 CET 2012


Revision: 52291
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52291
Author:   campbellbarton
Date:     2012-11-17 06:05:37 +0000 (Sat, 17 Nov 2012)
Log Message:
-----------
playanim move zooming into a static function, the switch statement passthrough was unnecessarily confusing.

Modified Paths:
--------------
    trunk/blender/source/blender/windowmanager/intern/wm_playanim.c

Modified: trunk/blender/source/blender/windowmanager/intern/wm_playanim.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_playanim.c	2012-11-17 05:16:54 UTC (rev 52290)
+++ trunk/blender/source/blender/windowmanager/intern/wm_playanim.c	2012-11-17 06:05:37 UTC (rev 52291)
@@ -75,6 +75,9 @@
 
 #include "WM_api.h"  /* only for WM_main_playanim */
 
+struct PlayState;
+static void playanim_window_zoom(const struct PlayState *ps, const float zoom_offset);
+
 typedef struct PlayState {
 
 	/* playback state */
@@ -596,27 +599,12 @@
 					break;
 				case GHOST_kKeyNumpadPlus:
 					if (val == 0) break;
-					zoomx += 2.0f;
-					zoomy += 2.0f;
-					/* no break??? - is this intentional? - campbell XXX25 */
+					playanim_window_zoom(ps, 1.0f);
+					break;
 				case GHOST_kKeyNumpadMinus:
 				{
-					int sizex, sizey;
-					/* int ofsx, ofsy; */ /* UNUSED */
-
 					if (val == 0) break;
-					if (zoomx > 1.0f) zoomx -= 1.0f;
-					if (zoomy > 1.0f) zoomy -= 1.0f;
-					// playanim_window_get_position(&ofsx, &ofsy);
-					playanim_window_get_size(&sizex, &sizey);
-					/* ofsx += sizex / 2; */ /* UNUSED */
-					/* ofsy += sizey / 2; */ /* UNUSED */
-					sizex = zoomx * ps->ibufx;
-					sizey = zoomy * ps->ibufy;
-					/* ofsx -= sizex / 2; */ /* UNUSED */
-					/* ofsy -= sizey / 2; */ /* UNUSED */
-					// window_set_position(g_WS.ghost_window,sizex,sizey);
-					GHOST_SetClientSize(g_WS.ghost_window, sizex, sizey);
+					playanim_window_zoom(ps, -1.0f);
 					break;
 				}
 				case GHOST_kKeyEsc:
@@ -722,7 +710,26 @@
 	                                       FALSE /* no stereo */, FALSE);
 }
 
+static void playanim_window_zoom(const PlayState *ps, const float zoom_offset)
+{
+	int sizex, sizey;
+	/* int ofsx, ofsy; */ /* UNUSED */
 
+	if (zoomx + zoom_offset > 0.0f) zoomx += zoom_offset;
+	if (zoomy + zoom_offset > 0.0f) zoomy += zoom_offset;
+
+	// playanim_window_get_position(&ofsx, &ofsy);
+	playanim_window_get_size(&sizex, &sizey);
+	/* ofsx += sizex / 2; */ /* UNUSED */
+	/* ofsy += sizey / 2; */ /* UNUSED */
+	sizex = zoomx * ps->ibufx;
+	sizey = zoomy * ps->ibufy;
+	/* ofsx -= sizex / 2; */ /* UNUSED */
+	/* ofsy -= sizey / 2; */ /* UNUSED */
+	// window_set_position(g_WS.ghost_window,sizex,sizey);
+	GHOST_SetClientSize(g_WS.ghost_window, sizex, sizey);
+}
+
 void WM_main_playanim(int argc, const char **argv)
 {
 	struct ImBuf *ibuf = NULL;
@@ -742,7 +749,7 @@
 	/* ps.doubleb   = TRUE;*/ /* UNUSED */
 	ps.go        = TRUE;
 	ps.direction = TRUE;
-	ps.next      = TRUE;
+	ps.next      = 1;
 	ps.once      = FALSE;
 	ps.turbo     = FALSE;
 	ps.pingpong  = FALSE;




More information about the Bf-blender-cvs mailing list