# HG changeset patch # User Matti Hamalainen # Date 1535022692 -10800 # Node ID 1cb7ecd735541e761980052b146e13342bfdc472 # Parent 55a3fee48fe181ca0b9a161488f53ed01050a622 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale. diff -r 55a3fee48fe1 -r 1cb7ecd73554 events.pde --- a/events.pde Thu Aug 23 14:10:22 2018 +0300 +++ b/events.pde Thu Aug 23 14:11:32 2018 +0300 @@ -78,10 +78,10 @@ { g_dirty = true; - if (moicon(16 * 16 * g_uizoom, height - 32 * g_uizoom, 16 * g_uizoom, 24 * g_uizoom)) help(int('<')); - if (moicon(16 * 16 * g_uizoom, height - 8 * g_uizoom, 16 * g_uizoom, 8 * g_uizoom)) help(int('>')); - if (moicon(0, height - 32 * g_uizoom, 15 * 16 * g_uizoom, 32 * g_uizoom)) help(TAB); - if (moicon(width - 32 * g_uizoom, 0, 32 * g_uizoom, 16 * g_uizoom)) help(int('.')); + if (moicon(16 * 16 * g_uiscale, height - 32 * g_uiscale, 16 * g_uiscale, 24 * g_uiscale)) help(int('<')); + if (moicon(16 * 16 * g_uiscale, height - 8 * g_uiscale, 16 * g_uiscale, 8 * g_uiscale)) help(int('>')); + if (moicon(0, height - 32 * g_uiscale, 15 * 16 * g_uiscale, 32 * g_uiscale)) help(TAB); + if (moicon(width - 32 * g_uiscale, 0, 32 * g_uiscale, 16 * g_uiscale)) help(int('.')); } diff -r 55a3fee48fe1 -r 1cb7ecd73554 interface.pde --- a/interface.pde Thu Aug 23 14:10:22 2018 +0300 +++ b/interface.pde Thu Aug 23 14:11:32 2018 +0300 @@ -158,13 +158,13 @@ int magmode() { - // return the mode "number" based on g_uizoom and 'm' and 'M' + // return the mode "number" based on g_uiscale and 'm' and 'M' // currently valid outputs are 0,10,20,1,11,21,2,12,22 // flat variants: 100,110,120,101,111,121,102,112,122 int base = 0; if (g_aspect == AR_FLAT) base = 100; - if (g_uizoom == 1) base += 10; - if (g_uizoom == 3) base += 20; + if (g_uiscale == 1) base += 10; + if (g_uiscale == 3) base += 20; if (g_data[int('M')] == 1 && g_data[int('m')] == 1) g_data[int('m')] = 0; if (g_data[int('m')] == 1) base += 1; if (g_data[int('M')] == 1) base += 2; @@ -176,7 +176,7 @@ { //return the amount of horizontal 8x8 characters in current mode ('m' or 'M') int mag = g_magpix[magmode()] * 8; - return int((width - (33 * g_uizoom)) / mag); + return int((width - (33 * g_uiscale)) / mag); } @@ -184,7 +184,7 @@ { //return the amount of vertical 8x8 characters in current mode ('m' or 'M') int mag = g_magpiy[magmode()] * 8; - return int((height - (33 * g_uizoom)) / mag); //how many chars in a magmode + return int((height - (33 * g_uiscale)) / mag); //how many chars in a magmode } @@ -395,7 +395,7 @@ } } - e_rect(xo + x * g_uizoom, yo + y * g_uizoom, g_uizoom, g_uizoom, far); + e_rect(xo + x * g_uiscale, yo + y * g_uiscale, g_uiscale, g_uiscale, far); } ad += 256; } @@ -430,7 +430,7 @@ if (g_msgctr > 0 && t + 32 < 128) far = 0xff0000ff; //different background color } - e_rect(xo + x * g_uizoom, yo + y * g_uizoom, g_uizoom, g_uizoom, far); + e_rect(xo + x * g_uiscale, yo + y * g_uiscale, g_uiscale, g_uiscale, far); } } } @@ -805,13 +805,13 @@ { //draw the preset brush box drawchar(xx, yy, 128); - drawchar(xx + 8 * g_uizoom, yy, 129); - drawchar(xx + 16 * g_uizoom, yy, 130); - drawchar(xx + 24 * g_uizoom, yy, 131); - drawchar(xx, yy + 8 * g_uizoom, 132); - drawchar(xx + 8 * g_uizoom, yy + 8 * g_uizoom, 133); - drawchar(xx + 16 * g_uizoom, yy + 8 * g_uizoom, 134); - drawchar(xx + 24 * g_uizoom, yy + 8 * g_uizoom, 135); + drawchar(xx + 8 * g_uiscale, yy, 129); + drawchar(xx + 16 * g_uiscale, yy, 130); + drawchar(xx + 24 * g_uiscale, yy, 131); + drawchar(xx, yy + 8 * g_uiscale, 132); + drawchar(xx + 8 * g_uiscale, yy + 8 * g_uiscale, 133); + drawchar(xx + 16 * g_uiscale, yy + 8 * g_uiscale, 134); + drawchar(xx + 24 * g_uiscale, yy + 8 * g_uiscale, 135); } } @@ -819,9 +819,9 @@ if (ad != ':' && ad != ';' && ad != '.') { if (realdraw == 0) { - if (moicon(xx + x, yy + y, 16 * g_uizoom, 16 * g_uizoom)) help(ad); + if (moicon(xx + x, yy + y, 16 * g_uiscale, 16 * g_uiscale)) help(ad); } - if (doicon(xx + x, yy + y, 16 * g_uizoom, 16 * g_uizoom)) + if (doicon(xx + x, yy + y, 16 * g_uiscale, 16 * g_uiscale)) { //println(g_realbutton); if (ad == 'C' && g_realbutton == RIGHT) ad = 'V'; @@ -843,32 +843,32 @@ for (int ii = 0; ii <= 3; ii++) for (int jj = 0; jj <= 1; jj++) { - if (doicon(xx + ii * 8 * g_uizoom, yy + jj * 8 * g_uizoom, - 8 * g_uizoom, 8 * g_uizoom)) + if (doicon(xx + ii * 8 * g_uiscale, yy + jj * 8 * g_uiscale, + 8 * g_uiscale, 8 * g_uiscale)) command(128 + ii + jj * 4); } } if (tabletype == 0) { - x += 16 * g_uizoom; - if (ad == '.') x = x - 8 * g_uizoom; - if (x > 16 * g_uizoom) + x += 16 * g_uiscale; + if (ad == '.') x = x - 8 * g_uiscale; + if (x > 16 * g_uiscale) { x = 0; - y += 16 * g_uizoom; + y += 16 * g_uiscale; if (ad == ':') - y -= 14 * g_uizoom; + y -= 14 * g_uiscale; } } else if (tabletype == 1 || tabletype == 2) { - y += 16 * g_uizoom; - if (y > 16 * g_uizoom) + y += 16 * g_uiscale; + if (y > 16 * g_uiscale) { y = 0; - x += 16 * g_uizoom; + x += 16 * g_uiscale; } } } @@ -996,21 +996,21 @@ float expand = ((x1 - x0) / g_palsteps); int divs = int(255 / (g_palsteps - 1)); for (int i = 0; i < g_palsteps; i++) { - if (doicon_drag(int(x0 + expand * i), y0, int(expand), 7 * g_uizoom)) { + if (doicon_drag(int(x0 + expand * i), y0, int(expand), 7 * g_uiscale)) { g_r[g_farge] = int(i * divs); message("RED:" + i); makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]); refresh(); g_boxreconstruct = 2; } - if (doicon_drag(int(x0 + expand * i), y0 + 10 * g_uizoom, int(expand), 7 * g_uizoom)) { + if (doicon_drag(int(x0 + expand * i), y0 + 10 * g_uiscale, int(expand), 7 * g_uiscale)) { g_g[g_farge] = int(i * divs); message("GREEN:" + i); makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]); refresh(); g_boxreconstruct = 2; } - if (doicon_drag(int(x0 + expand * i), y0 + 20 * g_uizoom, int(expand), 7 * g_uizoom)) { + if (doicon_drag(int(x0 + expand * i), y0 + 20 * g_uiscale, int(expand), 7 * g_uiscale)) { g_b[g_farge] = int(i * divs); message("BLUE:" + i); makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]); @@ -1021,16 +1021,16 @@ for (int j = 0; j < 3; j++) { - e_rect(int(x0), y0 + j * 10 * g_uizoom, int(x1 - x0), 7 * g_uizoom, g_rgb[258]); + e_rect(int(x0), y0 + j * 10 * g_uiscale, int(x1 - x0), 7 * g_uiscale, g_rgb[258]); for (int i = 1; i < g_palsteps; i++) { - e_rect(int(x0 + expand * i), y0 + j * 10 * g_uizoom, g_uizoom, 2 * g_uizoom, g_rgb[257]); + e_rect(int(x0 + expand * i), y0 + j * 10 * g_uiscale, g_uiscale, 2 * g_uiscale, g_rgb[257]); } } - e_rect(int(x0 + expand * g_r[g_farge] / divs), y0, int(expand), 7 * g_uizoom, g_rgb[260]); - e_rect(int(x0 + expand * g_g[g_farge] / divs), y0 + 10 * g_uizoom, int(expand), 7 * g_uizoom, g_rgb[261]); - e_rect(int(x0 + expand * g_b[g_farge] / divs), y0 + 20 * g_uizoom, int(expand), 7 * g_uizoom, g_rgb[262]); + e_rect(int(x0 + expand * g_r[g_farge] / divs), y0, int(expand), 7 * g_uiscale, g_rgb[260]); + e_rect(int(x0 + expand * g_g[g_farge] / divs), y0 + 10 * g_uiscale, int(expand), 7 * g_uiscale, g_rgb[261]); + e_rect(int(x0 + expand * g_b[g_farge] / divs), y0 + 20 * g_uiscale, int(expand), 7 * g_uiscale, g_rgb[262]); } @@ -1041,14 +1041,14 @@ int bfat; float expand, divus; - xonko = 16 * g_uizoom; - yhei = 16 * g_uizoom; + xonko = 16 * g_uiscale; + yhei = 16 * g_uiscale; expand = 1; - yfat = 4 * g_uizoom; - bfat = 1 * g_uizoom; + yfat = 4 * g_uiscale; + bfat = 1 * g_uiscale; if (g_maxcolors > 60) { - yhei = 4 * g_uizoom; + yhei = 4 * g_uiscale; yfat = 0; bfat = 1; } @@ -1059,7 +1059,7 @@ far = 0xff000000; maxp = g_maxcolors; - xonko = int(int(512 / g_maxcolors) / 2) * g_uizoom; + xonko = int(int(512 / g_maxcolors) / 2) * g_uiscale; if (g_maxcolors > 32) { maxp = int(g_maxcolors / 2); @@ -1067,12 +1067,12 @@ } if (g_machine == PLUS4 || g_machine == PLUS4M) - xonko = 15 * g_uizoom; + xonko = 15 * g_uiscale; for (x = 0; x < g_maxcolors; x++) { xloc = xo + x * xonko; - yloc = yo + 8 * g_uizoom; + yloc = yo + 8 * g_uiscale; if (g_maxcolors > 60) { yloc = yo + yhei * 7; @@ -1175,7 +1175,7 @@ { // lcd character display chardisplay textbox // coordinates. has its own "dirtychar" - int cz = 8 * g_uizoom; + int cz = 8 * g_uiscale; for (int xx = 0; xx < 12; xx++) for (int yy = 0; yy < 4; yy++) { @@ -1190,11 +1190,11 @@ void colorindicator(int ox, int oy) { - int bs = 8 * g_uizoom; + int bs = 8 * g_uiscale; int h = 0; if (g_button == RIGHT) h = 1; e_rect(ox, oy, bs * 2, bs * 4, g_rgb[int(g_realback)]); - e_rect(ox + bs / 2, oy + 4 * g_uizoom, 12 * g_uizoom, bs * 2, g_rgb[int(g_realfront)]); + e_rect(ox + bs / 2, oy + 4 * g_uiscale, 12 * g_uiscale, bs * 2, g_rgb[int(g_realfront)]); if (doicon(ox, oy, bs * 2, bs * 3)) command(int('<')); if (g_machine == C64M || g_machine == MSX || g_machine == AMIGA) { e_rect(ox, oy + bs * 3, bs * 2, bs, g_rgb[int(g_map[1])]); @@ -1206,14 +1206,14 @@ } if (g_machine == PLUS4M) { e_rect(ox, oy + bs * 3, bs, bs, g_rgb[int(g_map[1])]); - e_rect(ox + 8 * g_uizoom, oy + bs * 3, bs, bs, g_rgb[int(g_map[2])]); + e_rect(ox + 8 * g_uiscale, oy + bs * 3, bs, bs, g_rgb[int(g_map[2])]); d_rect(ox, oy + bs * 3, bs, bs, g_rgb[257]); - d_rect(ox + 8 * g_uizoom, oy + bs * 3, bs, bs, g_rgb[257]); + d_rect(ox + 8 * g_uiscale, oy + bs * 3, bs, bs, g_rgb[257]); if (doicon(ox, oy + bs * 3, bs, bs)) { if (g_shift == false) selectcolor(h, int(g_map[1])); if (g_shift) command(int('C')); } - if (doicon(ox + 8 * g_uizoom, oy + bs * 3, bs, bs)) { + if (doicon(ox + 8 * g_uiscale, oy + bs * 3, bs, bs)) { if (g_shift == false) selectcolor(h, int(g_map[2])); if (g_shift) command(int('V')); } @@ -1226,31 +1226,31 @@ if (g_repanel <= 0) g_repanel++; - messagebox(width - 12 * 8 * g_uizoom, height - 4 * 8 * g_uizoom - g_uizoom); + messagebox(width - 12 * 8 * g_uiscale, height - 4 * 8 * g_uiscale - g_uiscale); // when tooltipping, the panels are not really // drawn but used for easy coordinate reference if (g_repanel > 0 && !forced) { - icontable(width - 32 * g_uizoom, 0, 0, 0); - icontable(272 * g_uizoom, height - 32 * g_uizoom, 1, 0); + icontable(width - 32 * g_uiscale, 0, 0, 0); + icontable(272 * g_uiscale, height - 32 * g_uiscale, 1, 0); //icontable(0,0,3,0); if (g_machine == PLUS4M || g_machine == PLUS4) { - icontable(240 * g_uizoom, height - 32 * g_uizoom, 2, 0); + icontable(240 * g_uiscale, height - 32 * g_uiscale, 2, 0); } } else { - icontable(width - 32 * g_uizoom - 1, 0, 0, 1); - icontable(272 * g_uizoom, height - 32 * g_uizoom, 1, 1); - palettebox(g_uizoom * 324 + 4, height - 32 * g_uizoom, width - (96 * g_uizoom) - 4); + icontable(width - 32 * g_uiscale - 1, 0, 0, 1); + icontable(272 * g_uiscale, height - 32 * g_uiscale, 1, 1); + palettebox(g_uiscale * 324 + 4, height - 32 * g_uiscale, width - (96 * g_uiscale) - 4); if (g_machine == PLUS4M || g_machine == PLUS4) { - icontable(240 * g_uizoom, height - 32 * g_uizoom, 2, 1); + icontable(240 * g_uiscale, height - 32 * g_uiscale, 2, 1); } - colorselector(0, height - 32 * g_uizoom); - colorindicator(256 * g_uizoom, height - 32 * g_uizoom); + colorselector(0, height - 32 * g_uiscale); + colorindicator(256 * g_uiscale, height - 32 * g_uiscale); } } @@ -1263,7 +1263,7 @@ int xx, yy, xo, yo, xwin, ywin, x, y, winsux, winsuy, rubx; int ad, cad, a, b, c, mmode, fari, psizex, psizey; int maxx, mayy, xcmag, ycmag, raddr; - int left = 32 * g_uizoom; + int left = 32 * g_uiscale; raddr = 0; winsux = 0; winsuy = 0; @@ -1291,25 +1291,25 @@ //between mag window and toolboxes if (g_data['m'] == 1 || g_data['M'] == 1) { - e_rect(0, (mayy * psizex) * 8, maxx * psizex * 8, height - ((g_vedge + g_uizoom * 2) + (mayy * psizex * 8)), g_rgb[263]); - e_rect((maxx * psizex) * 8, 0, width - (maxx * psizex * 8 + (g_hedge + g_uizoom * 2)), height - (g_vedge + g_uizoom), g_rgb[263]); + e_rect(0, (mayy * psizex) * 8, maxx * psizex * 8, height - ((g_vedge + g_uiscale * 2) + (mayy * psizex * 8)), g_rgb[263]); + e_rect((maxx * psizex) * 8, 0, width - (maxx * psizex * 8 + (g_hedge + g_uiscale * 2)), height - (g_vedge + g_uiscale), g_rgb[263]); } - // e_rect(width-(g_hedge+g_uizoom*2),0,g_hedge+g_uizoom*2,height,g_rgb[263]); - // e_rect(0,height-(g_vedge+g_uizoom*2),width,g_vedge+g_uizoom*2,g_rgb[263]); + // e_rect(width-(g_hedge+g_uiscale*2),0,g_hedge+g_uiscale*2,height,g_rgb[263]); + // e_rect(0,height-(g_vedge+g_uiscale*2),width,g_vedge+g_uiscale*2,g_rgb[263]); } if (g_boxreconstruct == 2) { //in case of full window update g_boxreconstruct = 0; - e_rect(0, 0, width - (g_hedge + g_uizoom * 2 - 2), height - (g_vedge + g_uizoom * 2 - 2), g_rgb[259]); + e_rect(0, 0, width - (g_hedge + g_uiscale * 2 - 2), height - (g_vedge + g_uiscale * 2 - 2), g_rgb[259]); } if (g_pgrab) { // avoid preview window embarassment - e_rect(width - (g_hedge + g_uizoom * 2), 0, g_hedge + g_uizoom * 2 - 1, height - 1, g_rgb[263]); - e_rect(0, height - (g_vedge + g_uizoom * 2), width - 1, g_vedge + g_uizoom * 2 - 1, g_rgb[263]); + e_rect(width - (g_hedge + g_uiscale * 2), 0, g_hedge + g_uiscale * 2 - 1, height - 1, g_rgb[263]); + e_rect(0, height - (g_vedge + g_uiscale * 2), width - 1, g_vedge + g_uiscale * 2 - 1, g_rgb[263]); } maxx--; @@ -1568,7 +1568,7 @@ pixels[raddr + 7] = ari; break; case 2: - e_rect(xo * (64 * g_uizoom) + x * (8 * g_uizoom), yo * (64 * g_uizoom) + y * (8 * g_uizoom), 8 * g_uizoom, 8 * g_uizoom, g_rgb[fari]); + e_rect(xo * (64 * g_uiscale) + x * (8 * g_uiscale), yo * (64 * g_uiscale) + y * (8 * g_uiscale), 8 * g_uiscale, 8 * g_uiscale, g_rgb[fari]); break; // mini modes case 10: diff -r 55a3fee48fe1 -r 1cb7ecd73554 mpui.js --- a/mpui.js Thu Aug 23 14:10:22 2018 +0300 +++ b/mpui.js Thu Aug 23 14:11:32 2018 +0300 @@ -2,7 +2,7 @@ * Multipaint.JS - Initializer/loader * (C) Copyright 2018 Matti 'ccr' Hämäläinen */ -var mpMachine = 0, mpUIZoom, mpForcedWidth, mpForcedHeight; +var mpMachine = 0, mpUIScale, mpForcedWidth, mpForcedHeight; var mpURL; var mpMachines = diff -r 55a3fee48fe1 -r 1cb7ecd73554 multipaint.pde --- a/multipaint.pde Thu Aug 23 14:10:22 2018 +0300 +++ b/multipaint.pde Thu Aug 23 14:11:32 2018 +0300 @@ -91,7 +91,7 @@ int g_prex, g_prey, g_storedcoordx, g_storedcoordy; //window positioning int g_windowx, g_windowy, g_maglocx, g_maglocy; -int g_hedge, g_vedge, g_uizoom, g_wzoom; +int g_hedge, g_vedge, g_uiscale, g_wzoom; //icons & gui stuff int g_iconx, g_icony, g_piconx, g_picony; int g_gridx, g_gridy, g_spare; @@ -108,7 +108,7 @@ { // Get settings from Javascript runner, or use defaults g_machine = (mpMachine >= 0) ? mpMachine : C64; - g_uizoom = (mpUIZoom >= 1 && mpUIZoom <= 3) ? mpUIZoom : 2; + g_uiscale = (mpUIScale >= 1 && mpUIScale <= 3) ? mpUIScale : 2; g_forced_width = mpForcedWidth > 0 ? mpForcedWidth : 0; g_forced_height = mpForcedHeight > 0 ? mpForcedHeight : 0; g_animspeed = 1; @@ -162,11 +162,11 @@ g_magpiy[122] = 14; // Setup other stuff - if (g_uizoom >= 1 && g_uizoom <= 3) - g_wzoom = g_uizoom + 1; + if (g_uiscale >= 1 && g_uiscale <= 3) + g_wzoom = g_uiscale + 1; - g_hedge = 32 * g_uizoom; - g_vedge = 32 * g_uizoom; + g_hedge = 32 * g_uiscale; + g_vedge = 32 * g_uiscale; g_spare = 0; g_bsize = 0;