changeset 137:d6f60370b3e7

Cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 09 Aug 2018 14:29:59 +0300
parents 12cf30907f26
children a6af71199946
files Interface.pde events.pde
diffstat 2 files changed, 87 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/Interface.pde	Thu Aug 09 13:09:39 2018 +0300
+++ b/Interface.pde	Thu Aug 09 14:29:59 2018 +0300
@@ -115,7 +115,8 @@
 };
 
 
-void setup_raster() {
+void setup_raster()
+{
     g_raster_offset_x = 0;
     g_raster_offset_y = 0;
     g_raster_no = 3;
@@ -123,7 +124,8 @@
 }
 
 
-void fixed_raster_command(int par) {
+void fixed_raster_command(int par)
+{
     if (par == 'p') {
         g_raster_no--;
         if (g_raster_no < 0)
@@ -131,6 +133,7 @@
         set_fixed_raster(g_raster_no);
         g_data[int('r')] = 1;
     }
+    else
     if (par == 'n') {
         g_raster_no++;
         if (g_raster_no > 9)
@@ -138,11 +141,13 @@
         set_fixed_raster(g_raster_no);
         g_data[int('r')] = 1;
     }
+    else
     if (par == 'x') {
         g_raster_offset_x++;
         if (g_raster_offset_x > 3)
             g_raster_offset_x = 0;
     }
+    else
     if (par == 'y') {
         g_raster_offset_y++;
         if (g_raster_offset_y > 3)
@@ -151,7 +156,8 @@
 }
 
 
-int magmode() {
+int magmode()
+{
     //return the mode "number" based on g_uizoom and 'm' and 'M'
     //currently valid outputs are 0,10,20,1,11,21,2,12,22
     int base = 0;
@@ -173,7 +179,8 @@
 }
 
 
-int magy() {
+int magy()
+{
     //return the amount of vertical 8x8 characters in current mode ('m' or 'M')
     int psize, mag;
     psize = g_magpiy[magmode()];
@@ -232,7 +239,8 @@
 }
 
 
-void d_rect(int x1, int y1, int w, int h, int rgb) {
+void d_rect(int x1, int y1, int w, int h, int rgb)
+{
     int ad = x1 + y1 * width;
     //updatepixels has to be handled elsewhere
     for (int yy = 0; yy < h; yy++) {
@@ -245,7 +253,8 @@
 }
 
 
-void t_rect(int x1, int y1, int w, int h, int rgb) {
+void t_rect(int x1, int y1, int w, int h, int rgb)
+{
     // transparent rectangle
     // fixed tp, for grid drawing
 
@@ -253,8 +262,10 @@
     int r, g, b, s, fout;
     int ad = x1 + y1 * width;
 
-    if (g_gridmode == NEW) {
-        for (int yy = 0; yy < h; yy++) {
+    if (g_gridmode == NEW)
+    {
+        for (int yy = 0; yy < h; yy++)
+        {
             for (int xx = 0; xx < w; xx++) {
                 s = pixels[ad + xx];
                 fout = 0;
@@ -280,47 +291,53 @@
             }
             ad = ad + width;
         }
-        return;
     }
+    else
+    {
 
-    for (int yy = 0; yy < h; yy++) {
-        for (int xx = 0; xx < w; xx++) {
-            s = pixels[ad + xx];
+        for (int yy = 0; yy < h; yy++)
+        {
+            for (int xx = 0; xx < w; xx++)
+            {
+                s = pixels[ad + xx];
 
-            r = (s >> 16) & 0xff;
-            g = (s >> 8) & 0xff;
-            b = (s) & 0xff;
+                r = (s >> 16) & 0xff;
+                g = (s >> 8) & 0xff;
+                b = (s) & 0xff;
 
-            g = g + 64;
+                g = g + 64;
 
-            r = int((r * 2) / 3);
-            g = int((g * 2) / 3);
-            b = int((b * 2) / 3);
+                r = int((r * 2) / 3);
+                g = int((g * 2) / 3);
+                b = int((b * 2) / 3);
 
-            pixels[ad + xx] = 0xff000000 + r * 0x10000 + g * 0x100 + b;
+                pixels[ad + xx] = 0xff000000 + r * 0x10000 + g * 0x100 + b;
+            }
+            ad = ad + width;
         }
-        ad = ad + width;
     }
 }
 
 
 // parameter store/restore in case some functions need to bypass grid, attribute modes etc
-
-void storeparameters() {
+void storeparameters()
+{
     for (int i = 0; i <= 255; i++) {
         g_data[767 + i] = g_data[i];
     }
 }
 
 
-void restoreparameters() {
+void restoreparameters()
+{
     for (int i = 0; i <= 255; i++) {
         g_data[i] = g_data[767 + i];
     }
 }
 
 
-void drawtext(int xo, int yo, String ss) {
+void drawtext(int xo, int yo, String ss)
+{
     //draw a bunch of text maybe not needed
     for (int i = 0; i < ss.length(); i++) {
         drawchar(xo + i * 8 * 2, yo, ss.charAt(i));
@@ -328,21 +345,24 @@
 }
 
 
-void drawicon(int xo, int yo, int t, int mm) {
+void drawicon(int xo, int yo, int t, int mm)
+{
     //draw one icon
     int ad, cad, xx, yy, pop, far;
     int metal;
 
     yy = int(t / 16);
-    xx = t - yy * 16;
+    xx = t - (yy * 16);
 
     xx *= 2;
     yy *= 2;
 
     ad = 1024 + xx * 8 + yy * 2048;
 
-    for (int y = 0; y < 16; y++) {
-        for (int x = 0; x < 16; x++) {
+    for (int y = 0; y < 16; y++)
+    {
+        for (int x = 0; x < 16; x++)
+        {
             metal = 0xffa0a0a0;
             far = 0xff000000;
             if (t == 18 || (t == 19 && g_backmode == 1)) {
@@ -380,21 +400,23 @@
 }
 
 
-void drawchar(int xo, int yo, int t) {
+void drawchar(int xo, int yo, int t)
+{
     //characters at the help box
-    int ad, x, y, xx, yy, far;
-
     if (t < 32) return;
 
     t -= 32;
-    yy = int(t / 32);
-    xx = t - yy * 32;
+    int yy = int(t / 32);
+    int xx = t - (yy * 32);
     yy = yy + 18;
 
-    for (y = 0; y < 8; y++) {
-        ad = 1024 + xx * 8 + yy * 2048 + y * 256;
+    for (int y = 0; y < 8; y++)
+    {
+        int ad = 1024 + xx * 8 + yy * 2048 + y * 256;
 
-        for (x = 0; x < 8; x++) {
+        for (int x = 0; x < 8; x++)
+        {
+            int far;
             if (int(g_icons[ad + x]) != 0) {
                 far = 0xffb0b0b0;
                 if (g_bsize < 4) {
@@ -412,9 +434,11 @@
 }
 
 
-boolean moicon(int xx, int yy, int ww, int hh) {
+boolean moicon(int xx, int yy, int ww, int hh)
+{
     //check mouse/icon boundary without actually drawing the icon
-    if (g_data[int('m')] == 0 && g_data[int('M')] == 0) {
+    if (g_data[int('m')] == 0 && g_data[int('M')] == 0)
+    {
         if (g_mx + g_windowx >= xx && g_mx + g_windowx < xx + ww &&
             g_my + g_windowy >= yy && g_my + g_windowy < yy + hh)
             return true;
@@ -429,14 +453,17 @@
 }
 
 
-boolean doicon_drag(int xx, int yy, int ww, int hh) {
-    if (g_iconx >= xx && g_iconx < xx + ww && g_icony >= yy && g_icony < yy + hh) {
+boolean doicon_drag(int xx, int yy, int ww, int hh)
+{
+    if (g_iconx >= xx && g_iconx < xx + ww && g_icony >= yy && g_icony < yy + hh)
+    {
         g_iconx = -1;
         g_icony = -1;
         g_repanel = -2;
         return true;
     }
-    if (g_piconx >= xx && g_piconx < xx + ww && g_picony >= yy && g_picony < yy + hh) {
+    if (g_piconx >= xx && g_piconx < xx + ww && g_picony >= yy && g_picony < yy + hh)
+    {
         g_piconx = -1;
         g_picony = -1;
         g_repanel = -2;
@@ -446,8 +473,10 @@
 }
 
 
-boolean doicon(int xx, int yy, int ww, int hh) {
-    if (g_iconx >= xx && g_iconx < xx + ww && g_icony >= yy && g_icony < yy + hh) {
+boolean doicon(int xx, int yy, int ww, int hh)
+{
+    if (g_iconx >= xx && g_iconx < xx + ww && g_icony >= yy && g_icony < yy + hh)
+    {
         g_iconx = -1;
         g_icony = -1;
         g_repanel = -2;
@@ -462,13 +491,16 @@
     //creating text into the help box
     for (int tit = 0; tit < tex.length(); tit++)
     {
-        if (tex.charCodeAt(tit) != '|') {
+        if (tex.charCodeAt(tit) != '|')
+        {
             if (g_data[256 + xx + yy * 12] != byte(tex.charCodeAt(tit))) {
                 g_data[256 + xx + yy * 12] = byte(tex.charCodeAt(tit));
                 g_chaup[xx + yy * 16] = 1;
             }
             xx++;
-        } else {
+        }
+        else
+        {
             xx = 0;
             yy++;
         }
--- a/events.pde	Thu Aug 09 13:09:39 2018 +0300
+++ b/events.pde	Thu Aug 09 14:29:59 2018 +0300
@@ -100,8 +100,10 @@
     g_iconx = mouseX;
     g_icony = mouseY;
 
-    if (insidewindow(g_iconx, g_icony)) {
-        if (g_phase == 0) {
+    if (insidewindow(g_iconx, g_icony))
+    {
+        if (g_phase == 0)
+        {
             g_piconx = g_iconx;
             g_picony = g_icony;
             g_iconx = -1;
@@ -173,12 +175,15 @@
             msy = g_icony;
         }
 
-        if (g_button != CENTER) {
+        if (g_button != CENTER)
+        {
             if (tool() != 5 && tool() != 4) store_undo();
             if (tool() == 4) { //cut brush results in undo
                 if (g_button == RIGHT) store_undo();
             }
-        } else {
+        }
+        else
+        {
             g_button = 255;
             g_repanel = -2;
             if (g_shift) g_button = 254;