From e1959c0c0bd2291232701b799ec1560c9962ff85 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Sat, 27 Aug 2011 20:14:20 +0800 Subject: [PATCH] Zoom toggle, alt+z --- src/interface.c | 13 ++++++++----- src/main.c | 9 ++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/interface.c b/src/interface.c index f84918e7e..901888897 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2221,7 +2221,10 @@ int sdl_poll(void) sdl_caps = 1; if (event.key.keysym.sym=='z') { - sdl_zoom_trig = 1; + if (event.key.keysym.mod&KMOD_ALT)//toggle + sdl_zoom_trig = (!sdl_zoom_trig)*2; + else + sdl_zoom_trig = 1; } if ( event.key.keysym.sym == SDLK_PLUS) { @@ -2272,7 +2275,7 @@ int sdl_poll(void) sdl_rkey=event.key.keysym.sym; if (event.key.keysym.sym == SDLK_CAPSLOCK) sdl_caps = 0; - if (event.key.keysym.sym == 'z') + if (event.key.keysym.sym == 'z' && sdl_zoom_trig==1)//if ==2 then it was toggled with alt+z, don't turn off on keyup sdl_zoom_trig = 0; if (event.key.keysym.sym == SDLK_RIGHT || event.key.keysym.sym == SDLK_LEFT) { @@ -5092,7 +5095,7 @@ unsigned int decorations_ui(pixel *vid_buf,int *bsx,int *bsy, unsigned int saved if (sdl_wheel) { - if (sdl_zoom_trig==1)//zoom window change + if (sdl_zoom_trig)//zoom window change { ZSIZE += sdl_wheel; if (ZSIZE>60) @@ -5135,7 +5138,7 @@ unsigned int decorations_ui(pixel *vid_buf,int *bsx,int *bsy, unsigned int saved } } if (sdl_key==SDLK_LEFTBRACKET) { - if (sdl_zoom_trig==1) + if (sdl_zoom_trig) { ZSIZE -= 1; if (ZSIZE>60) @@ -5175,7 +5178,7 @@ unsigned int decorations_ui(pixel *vid_buf,int *bsx,int *bsy, unsigned int saved } } if (sdl_key==SDLK_RIGHTBRACKET) { - if (sdl_zoom_trig==1) + if (sdl_zoom_trig) { ZSIZE += 1; if (ZSIZE>60) diff --git a/src/main.c b/src/main.c index 88474bcb4..10fb0affd 100644 --- a/src/main.c +++ b/src/main.c @@ -2131,7 +2131,7 @@ int main(int argc, char *argv[]) CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ; } if (sdl_key==SDLK_LEFTBRACKET) { - if (sdl_zoom_trig==1) + if (sdl_zoom_trig) { ZSIZE -= 1; if (ZSIZE>60) @@ -2171,7 +2171,7 @@ int main(int argc, char *argv[]) } } if (sdl_key==SDLK_RIGHTBRACKET) { - if (sdl_zoom_trig==1) + if (sdl_zoom_trig) { ZSIZE += 1; if (ZSIZE>60) @@ -2477,7 +2477,7 @@ int main(int argc, char *argv[]) if (sdl_wheel) { - if (sdl_zoom_trig==1)//zoom window change + if (sdl_zoom_trig)//zoom window change { ZSIZE += sdl_wheel; if (ZSIZE>60) @@ -2889,7 +2889,10 @@ int main(int argc, char *argv[]) zoom_wy = 0; zoom_en = 1; if (!b && bq) + { zoom_en = 2; + sdl_zoom_trig = 0; + } } else if (b)//there is a click {