Mercurial > hg > forks > multipaint-js
comparison events.pde @ 232:ea6eb6541607
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 06 Sep 2018 12:58:41 +0300 |
parents | 2d2e313882b4 |
children | 7401300452c2 |
comparison
equal
deleted
inserted
replaced
231:a53b3fe97412 | 232:ea6eb6541607 |
---|---|
361 } | 361 } |
362 | 362 |
363 | 363 |
364 void command(int ckey) | 364 void command(int ckey) |
365 { | 365 { |
366 int tt = tool(); | |
366 g_dirty = true; | 367 g_dirty = true; |
367 | 368 |
368 //keypresses change g_data[] values directly as 1/0 switches | 369 //keypresses change g_data[] values directly as 1/0 switches |
369 //handling these presses "indirectly" adds complexity here | 370 //handling these presses "indirectly" adds complexity here |
370 //but is valuable elsewhere = corresponding icons have shortcuts automatically | 371 //but is valuable elsewhere = corresponding icons have shortcuts automatically |
563 else | 564 else |
564 if (ckey == '0') | 565 if (ckey == '0') |
565 { | 566 { |
566 if (g_data[int('m')] == 0 && g_data[int('M')] == 0) | 567 if (g_data[int('m')] == 0 && g_data[int('M')] == 0) |
567 { | 568 { |
568 if (tool() != 0) | 569 if (tt != 0) |
569 g_prevtool = tool(); | 570 g_prevtool = tt; |
570 } | 571 } |
571 else | 572 else |
572 ckey = 'm'; | 573 ckey = 'm'; |
573 } | 574 } |
574 else | 575 else |
657 g_ofx = int(g_storedcoordx / 8) - int(magx() / 2); | 658 g_ofx = int(g_storedcoordx / 8) - int(magx() / 2); |
658 g_ofy = int(g_storedcoordy / 8) - int(magy() / 2); | 659 g_ofy = int(g_storedcoordy / 8) - int(magy() / 2); |
659 g_data[int('m')] = 0; | 660 g_data[int('m')] = 0; |
660 message("Super|Magnify"); | 661 message("Super|Magnify"); |
661 | 662 |
662 if (tool() == 0) | 663 if (tt == 0) |
663 { | 664 { |
664 set_tool(g_prevtool); | 665 set_tool(g_prevtool); |
665 g_phase = 0; | 666 g_phase = 0; |
666 g_rubbermode = 0; | 667 g_rubbermode = 0; |
667 } | 668 } |
848 { | 849 { |
849 g_data[int('M')] = 0; | 850 g_data[int('M')] = 0; |
850 g_ofx = int(g_storedcoordx / 8) - int(magx() / 2); | 851 g_ofx = int(g_storedcoordx / 8) - int(magx() / 2); |
851 g_ofy = int(g_storedcoordy / 8) - int(magy() / 2); | 852 g_ofy = int(g_storedcoordy / 8) - int(magy() / 2); |
852 message("Magnify"); | 853 message("Magnify"); |
853 if (tool() == 0) | 854 if (tt == 0) |
854 { | 855 { |
855 set_tool(g_prevtool); | 856 set_tool(g_prevtool); |
856 g_phase = 0; | 857 g_phase = 0; |
857 g_rubbermode = 0; | 858 g_rubbermode = 0; |
858 } | 859 } |
912 for (int xx = 0; xx < X * Y; xx++) | 913 for (int xx = 0; xx < X * Y; xx++) |
913 { | 914 { |
914 g_map[1024 + xx] = 0; | 915 g_map[1024 + xx] = 0; |
915 } | 916 } |
916 | 917 |
918 g_farge = g_backg; | |
917 for (int xx = 0; xx < X; xx++) | 919 for (int xx = 0; xx < X; xx++) |
918 { | 920 { |
919 for (int yy = 0; yy < Y; yy++) | 921 for (int yy = 0; yy < Y; yy++) |
920 { | 922 { |
921 g_farge = g_backg; | |
922 makepoint(xx, yy); | 923 makepoint(xx, yy); |
923 g_farge = g_ofarge; | 924 } |
924 } | 925 } |
925 } | 926 g_farge = g_ofarge; |
926 | 927 |
927 restoreparameters(); | 928 restoreparameters(); |
928 } | 929 } |
929 | 930 |
930 if (g_data[int('h')] == 1) | 931 if (g_data[int('h')] == 1) |