Zoom toggle, alt+z

This commit is contained in:
jacksonmj 2011-08-27 20:14:20 +08:00 committed by Simon Robertshaw
parent 42cfb74c2b
commit e1959c0c0b
2 changed files with 14 additions and 8 deletions

View File

@ -2221,6 +2221,9 @@ int sdl_poll(void)
sdl_caps = 1; sdl_caps = 1;
if (event.key.keysym.sym=='z') if (event.key.keysym.sym=='z')
{ {
if (event.key.keysym.mod&KMOD_ALT)//toggle
sdl_zoom_trig = (!sdl_zoom_trig)*2;
else
sdl_zoom_trig = 1; sdl_zoom_trig = 1;
} }
if ( event.key.keysym.sym == SDLK_PLUS) if ( event.key.keysym.sym == SDLK_PLUS)
@ -2272,7 +2275,7 @@ int sdl_poll(void)
sdl_rkey=event.key.keysym.sym; sdl_rkey=event.key.keysym.sym;
if (event.key.keysym.sym == SDLK_CAPSLOCK) if (event.key.keysym.sym == SDLK_CAPSLOCK)
sdl_caps = 0; 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; sdl_zoom_trig = 0;
if (event.key.keysym.sym == SDLK_RIGHT || event.key.keysym.sym == SDLK_LEFT) 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_wheel)
{ {
if (sdl_zoom_trig==1)//zoom window change if (sdl_zoom_trig)//zoom window change
{ {
ZSIZE += sdl_wheel; ZSIZE += sdl_wheel;
if (ZSIZE>60) 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_key==SDLK_LEFTBRACKET) {
if (sdl_zoom_trig==1) if (sdl_zoom_trig)
{ {
ZSIZE -= 1; ZSIZE -= 1;
if (ZSIZE>60) 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_key==SDLK_RIGHTBRACKET) {
if (sdl_zoom_trig==1) if (sdl_zoom_trig)
{ {
ZSIZE += 1; ZSIZE += 1;
if (ZSIZE>60) if (ZSIZE>60)

View File

@ -2131,7 +2131,7 @@ int main(int argc, char *argv[])
CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ; CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
} }
if (sdl_key==SDLK_LEFTBRACKET) { if (sdl_key==SDLK_LEFTBRACKET) {
if (sdl_zoom_trig==1) if (sdl_zoom_trig)
{ {
ZSIZE -= 1; ZSIZE -= 1;
if (ZSIZE>60) if (ZSIZE>60)
@ -2171,7 +2171,7 @@ int main(int argc, char *argv[])
} }
} }
if (sdl_key==SDLK_RIGHTBRACKET) { if (sdl_key==SDLK_RIGHTBRACKET) {
if (sdl_zoom_trig==1) if (sdl_zoom_trig)
{ {
ZSIZE += 1; ZSIZE += 1;
if (ZSIZE>60) if (ZSIZE>60)
@ -2477,7 +2477,7 @@ int main(int argc, char *argv[])
if (sdl_wheel) if (sdl_wheel)
{ {
if (sdl_zoom_trig==1)//zoom window change if (sdl_zoom_trig)//zoom window change
{ {
ZSIZE += sdl_wheel; ZSIZE += sdl_wheel;
if (ZSIZE>60) if (ZSIZE>60)
@ -2889,7 +2889,10 @@ int main(int argc, char *argv[])
zoom_wy = 0; zoom_wy = 0;
zoom_en = 1; zoom_en = 1;
if (!b && bq) if (!b && bq)
{
zoom_en = 2; zoom_en = 2;
sdl_zoom_trig = 0;
}
} }
else if (b)//there is a click else if (b)//there is a click
{ {