Mercurial > hg > forks > multipaint-js
diff events.pde @ 225:1c9deae71fb1
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 05 Sep 2018 20:28:23 +0300 |
parents | 62016fa40651 |
children | caefc3c9e78c |
line wrap: on
line diff
--- a/events.pde Wed Sep 05 20:08:57 2018 +0300 +++ b/events.pde Wed Sep 05 20:28:23 2018 +0300 @@ -214,7 +214,9 @@ { msx = g_iconx - g_windowx; msy = g_icony - g_windowy; - } else { + } + else + { msx = g_iconx; msy = g_icony; } @@ -262,7 +264,8 @@ if (g_data[int('4')] == 1) { - if (g_phase == 1) { + if (g_phase == 1) + { g_phase = 0; g_rubbermode = 0; refresh(); @@ -380,16 +383,22 @@ g_boxreconstruct = 2; } - if (ckey == TAB) { - if (g_shift == false) { - if (g_britemode == 1) { + if (ckey == TAB) + { + if (g_shift == false) + { + if (g_britemode == 1) + { if (g_realfront == 7) g_realfront = -1; if (g_realfront == 15) g_realfront = 7; } selectcolor(0, g_realfront + 1); g_repanel = -2; - } else { - if (g_britemode == 1) { + } + else + { + if (g_britemode == 1) + { if (g_realfront == 8) g_realfront = 16; if (g_realfront == 0) g_realfront = 8; } @@ -602,15 +611,18 @@ g_data[ckey]++; if (g_data[ckey] > 1) g_data[ckey] = 0; - if (ckey == 'Q') { + if (ckey == 'Q') + { g_repanel = -2; g_msgctr = 0; help(int('B')); g_msgctr = 50; } - if (ckey == 'G') { + if (ckey == 'G') + { g_data[int('G')] = 0; - switch (g_gridx) { + switch (g_gridx) + { case 8: g_gridx = 16; g_gridy = 16; @@ -630,7 +642,8 @@ g_msgctr = 50; } - if (ckey == 'G') { + if (ckey == 'G') + { if (g_data[int('g')] == 0) g_data[int('g')] = 1; } @@ -654,35 +667,43 @@ } } - if (g_data[int('B')] == 1) { + if (g_data[int('B')] == 1) + { changeborder(LEFT); if (g_machine == MSX) g_data[int('C')] = 1; } - if (g_data[int('C')] == 1) { + if (g_data[int('C')] == 1) + { g_data[int('C')] = 0; - if (int(g_map[1]) != 255) { + if (int(g_map[1]) != 255) + { store_undo(); - if (g_machine == PLUS4M && g_farge == g_map[2]) { + if (g_machine == PLUS4M && g_farge == g_map[2]) + { message("1st and 2nd|can't be|same"); refresh(); return; } g_map[1] = byte(g_farge); - if (g_machine == MSX) { + if (g_machine == MSX) + { g_map[0] = byte(g_farge); sussborder(); } message("Set back|color"); } } - if (g_data[int('V')] == 1) { + if (g_data[int('V')] == 1) + { g_data[int('V')] = 0; - if (int(g_map[1]) != 255) { + if (int(g_map[1]) != 255) + { store_undo(); - if (g_machine == PLUS4M && g_farge == g_map[1]) { + if (g_machine == PLUS4M && g_farge == g_map[1]) + { message("1st and 2nd|can't be|same"); refresh(); return; @@ -691,7 +712,8 @@ message("Set 2nd|back color"); } } - if (g_data[int('N')] == 1) { + if (g_data[int('N')] == 1) + { g_data[int('N')] = 0; if (++g_animspeed > 3) g_animspeed = 0; @@ -737,57 +759,69 @@ } } - if (g_data[int('i')] == 1) { + if (g_data[int('i')] == 1) + { g_data[int('i')] = 0; selectcolor(0, nextluminance(g_farge, 1)); } - if (g_data[int('k')] == 1) { + if (g_data[int('k')] == 1) + { g_data[int('k')] = 0; selectcolor(0, nextluminance(g_farge, -1)); } - if (g_data[int('d')] == 0) { + if (g_data[int('d')] == 0) + { if (ckey == 'd') consistency(); } - if (g_data[int('z')] == 1) { + if (g_data[int('z')] == 1) + { g_data[int('z')] = 0; int orient; orient = g_data[int('x')] * 100 + g_data[int('y')] * 10 + g_data[int('q')]; - if (orient == 0) { + if (orient == 0) + { g_data[int('x')] = 0; g_data[int('y')] = 0; g_data[int('q')] = 1; } - if (orient == 1) { + if (orient == 1) + { g_data[int('x')] = 1; g_data[int('y')] = 1; g_data[int('q')] = 0; } - if (orient == 110) { + if (orient == 110) + { g_data[int('x')] = 1; g_data[int('y')] = 1; g_data[int('q')] = 1; } - if (orient == 111) { + if (orient == 111) + { g_data[int('x')] = 0; g_data[int('y')] = 0; g_data[int('q')] = 0; } - if (orient == 100) { + if (orient == 100) + { g_data[int('x')] = 0; g_data[int('y')] = 1; g_data[int('q')] = 1; } - if (orient == 11) { + if (orient == 11) + { g_data[int('x')] = 0; g_data[int('y')] = 1; g_data[int('q')] = 0; } - if (orient == 10) { + if (orient == 10) + { g_data[int('x')] = 1; g_data[int('y')] = 0; g_data[int('q')] = 1; } - if (orient == 101) { + if (orient == 101) + { g_data[int('x')] = 1; g_data[int('y')] = 0; g_data[int('q')] = 0; @@ -795,8 +829,10 @@ message("Rotate|brush"); } - if (ckey == 'm') { - if (g_data[int('M')] == 1) { + if (ckey == 'm') + { + if (g_data[int('M')] == 1) + { g_data[int('m')] = 0; ckey = 0; g_boxreconstruct = 2; @@ -805,13 +841,16 @@ g_data[int('M')] = 0; } - if (g_data[int('m')] == 1) { - if (ckey == 'm') { + if (g_data[int('m')] == 1) + { + if (ckey == 'm') + { g_data[int('M')] = 0; g_ofx = int(g_storedcoordx / 8) - int(magx() / 2); g_ofy = int(g_storedcoordy / 8) - int(magy() / 2); message("Magnify"); - if (tool() == 0) { + if (tool() == 0) + { set_tool(g_prevtool); g_phase = 0; g_rubbermode = 0; @@ -821,7 +860,8 @@ refresh(); } - if (g_data[int('J')] == 1) { + if (g_data[int('J')] == 1) + { g_data[int('J')] = 0; g_data[int('j')] = 0; spare(); @@ -831,7 +871,8 @@ spare(); } - if (g_data[int('j')] == 1) { + if (g_data[int('j')] == 1) + { g_data[int('j')] = 0; spare(); message((g_spare ? "Spare" : "Front") + " Page"); @@ -839,10 +880,12 @@ g_boxreconstruct = 2; } - if (g_data[int('O')] == 1) { + if (g_data[int('O')] == 1) + { g_data[int('O')] = 0; store_undo(); - for (int xx = 0; xx < X * Y; xx++) { + for (int xx = 0; xx < X * Y; xx++) + { g_map[1024 + xx] = 0; } for (int xx = 0; xx < X; xx++) @@ -854,7 +897,8 @@ } } - if (g_data[int('o')] == 1) { + if (g_data[int('o')] == 1) + { g_data[int('o')] = 0; message("Clear all"); store_undo(); @@ -864,12 +908,15 @@ g_data[int('d')] = 0; g_data[int('t')] = 0; - for (int xx = 0; xx < X * Y; xx++) { + for (int xx = 0; xx < X * Y; xx++) + { g_map[1024 + xx] = 0; } - for (int xx = 0; xx < X; xx++) { - for (int yy = 0; yy < Y; yy++) { + for (int xx = 0; xx < X; xx++) + { + for (int yy = 0; yy < Y; yy++) + { g_farge = g_backg; makepoint(xx, yy); g_farge = g_ofarge; @@ -882,35 +929,40 @@ if (g_data[int('e')] == 1) g_data[int('e')] = 0; - if (g_data[int('h')] == 1) { + if (g_data[int('h')] == 1) + { g_data[int('h')] = 0; g_bsize--; if (g_bsize < 0) g_bsize = 0; g_msgctr = -2; help(int('h')); } - if (g_data[int('H')] == 1) { + if (g_data[int('H')] == 1) + { g_data[int('H')] = 0; g_bsize++; if (g_bsize > 10) g_bsize = 10; g_msgctr = -2; help(int('h')); } - if (g_data[int('u')] == 1) { + if (g_data[int('u')] == 1) + { g_data[int('u')] = 0; message("Undo"); restore_undo(); refresh(); g_boxreconstruct = 2; } - if (g_data[int('U')] == 1) { + if (g_data[int('U')] == 1) + { g_data[int('U')] = 0; message("Redo"); redo_undo(); refresh(); } - if (g_machine == SPECTRUM) { + if (g_machine == SPECTRUM) + { if (g_data[int('I')] == 1) { g_data[int('I')] = 0;