Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-11-17 10:05:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-17 10:05:37 +0400
commit3b008503ab4dc6de7893806408e77f5ae63bccf5 (patch)
tree6a04d5fc140ce78b9b88ea644bce431b6d317899 /source/blender/windowmanager
parent38eee0104b78e25963569d17116f1917b74f5419 (diff)
playanim move zooming into a static function, the switch statement passthrough was unnecessarily confusing.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index dbdc77f6478..c5df42b6c1e 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -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 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
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,6 +710,25 @@ static void playanim_window_open(const char *title, int posx, int posy, int size
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)
{
@@ -742,7 +749,7 @@ void WM_main_playanim(int argc, const char **argv)
/* 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;