changeset 142:1ec3488bfd1e

Cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 14 Aug 2018 13:00:47 +0300
parents cdb62481ac97
children 5e18cb16bc4b
files Interface.pde draw_outputs.pde events.pde multipaint.pde preview.pde
diffstat 5 files changed, 67 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/Interface.pde	Mon Aug 13 13:57:51 2018 +0300
+++ b/Interface.pde	Tue Aug 14 13:00:47 2018 +0300
@@ -528,6 +528,7 @@
         g_msgctr = 100;
         return;
     }
+
     console.log("MSG: " + mstr);
     clearmsg();
     printat(0, 0, mstr);
@@ -956,12 +957,15 @@
     g_dirty = true;
 
     //refreshes all "dirty chars" and icon panels
-    for (int i = 0; i < MX * MY; i++) {
+    for (int i = 0; i < MX * MY; i++)
+    {
         g_redo[i] = byte(0);
         g_remdo[i] = byte(1);
     }
 
-    if (g_boxreconstruct == 0) g_boxreconstruct = 1;
+    if (g_boxreconstruct == 0)
+        g_boxreconstruct = 1;
+
     //elsewhere use g_boxreconstruct=2 for complete window reconstruction
 }
 
@@ -1278,7 +1282,10 @@
         e_rect(0, (mayy * psize) * 8, maxx * psize * 8, height - ((g_vedge + g_uizoom * 2) + (mayy * psize * 8)), g_rgb[259]);
         e_rect((maxx * psize) * 8, 0, width - (maxx * psize * 8 + (g_hedge + g_uizoom * 2)), height - (g_vedge + g_uizoom), g_rgb[259]);
     }
-    if (g_boxreconstruct == 2) { //in case of full window update
+
+    if (g_boxreconstruct == 2)
+    {
+        //in case of full window update
         g_boxreconstruct = 0;
         e_rect(0, 0, width - (g_hedge + g_uizoom * 2), height - (g_vedge + g_uizoom * 2), g_rgb[259]);
     }
--- a/draw_outputs.pde	Mon Aug 13 13:57:51 2018 +0300
+++ b/draw_outputs.pde	Tue Aug 14 13:00:47 2018 +0300
@@ -12,14 +12,17 @@
 }
 
 
-void createpoint(int x, int y, int mo) {
+
+void createpoint(int x, int y, int mo)
+{
     if (mo == LEFT) makepoint(x, y);
     else
     if (mo == RIGHT) clearpoint(x, y);
 }
 
 
-void doborx(int xf, int yf, int xt, int yt) {
+void doborx(int xf, int yf, int xt, int yt)
+{
     //rectangle for brush drawing
     for (int ii = xf; ii <= xt; ii++)
     for (int jj = yf; jj <= yt; jj++)
@@ -27,7 +30,8 @@
 }
 
 
-void docircx(int xf, int yf, int hh, int vv) {
+void docircx(int xf, int yf, int hh, int vv)
+{
     //circle for brush drawing
     float prop, fh = hh, fv = vv;
 
@@ -47,7 +51,8 @@
 }
 
 
-void craft(int x, int y, int c) {
+void craft(int x, int y, int c)
+{
     //foundational brush control
     //whether hard coded, circular or bitmap brush
     int calc, mb;
@@ -243,7 +248,9 @@
     }
 }
 
-void doline(int xfrom, int yfrom, int xto, int yto, int prevent) {
+
+void doline(int xfrom, int yfrom, int xto, int yto, int prevent)
+{
     //bresenham almost exactly from Wikipedia
     int swap, pex, pey;
     boolean steep;
@@ -326,7 +333,8 @@
     }
 }
 
-void docircle_new(int x1, int y1, int x2, int y2) {
+void docircle_new(int x1, int y1, int x2, int y2)
+{
     int hh, vv;
     float prop;
     int xf, yf;
@@ -356,7 +364,8 @@
 }
 
 
-void docircle(int x1, int y1, int x2, int y2) {
+void docircle(int x1, int y1, int x2, int y2)
+{
     float dds, a, t, sx, sy, gear1, gear2, x0, y0;
     int prex, prey;
 
@@ -394,7 +403,8 @@
 }
 
 
-void rectangle(int x1, int y1, int x2, int y2) {
+void rectangle(int x1, int y1, int x2, int y2)
+{
     int x0, y0, yt, xt, xf, yf;
 
     xf = chop8(x1);
@@ -470,7 +480,8 @@
 }
 
 
-void makepoint(int xx, int yy) {
+void makepoint(int xx, int yy)
+{
     //central pixelmaking function
     //has become very messy but what are you gonna do
     int uses[] = new int[8];
@@ -847,7 +858,8 @@
     }
 }
 
-void clearpoint(int xx, int yy) {
+void clearpoint(int xx, int yy)
+{
     if (g_multic == 2) {
         g_farge = g_backg;
         makepoint(xx, yy);
@@ -860,11 +872,11 @@
     g_farge = g_backg;
     makepoint(xx, yy);
     g_farge = g_ofarge;
-    return;
 }
 
 
-void absolute_clearpoint(int xx, int yy) {
+void absolute_clearpoint(int xx, int yy)
+{
     int mirrix = 0;
     int mirriy = 0;
     int ignore = 0;
@@ -878,10 +890,9 @@
         mirriy = 1;
         mirrix = 1;
     }
-    if (xx < 0) return;
-    if (yy < 0) return;
-    if (xx >= X) return;
-    if (yy >= Y) return;
+
+    if (xx < 0 || yy < 0 || xx >= X || yy >= Y)
+        return;
 
     if (g_multic == 2 && g_hzoomer != 2) {
         g_farge = g_backg;
@@ -893,6 +904,7 @@
         xx = chop2(xx);
     }
     if (g_data[int('b')] == 1) return;
+
     if (g_data[int('r')] == 1) { //raster
         if (get_raster(xx, yy) == 0) ignore = 1;
     }
@@ -917,6 +929,7 @@
         g_redo[xc + yc * MX] = byte(0); //block update
         g_remdo[xc + yc * MX] = byte(1); //block update
     }
+
     if (g_data[int('X')] == 1 && mirrix == 0) clearpoint(10000 + (X - 1) - xx, yy);
     if (g_data[int('Y')] == 1 && mirriy == 0) clearpoint(xx, 10000 + (Y - 1) - yy);
     if (g_data[int('X')] == 1 && g_data[int('Y')] == 1) {
@@ -924,7 +937,9 @@
     }
 }
 
-void simplepaint(int xx, int yy, int mode, int attr) {
+
+void simplepaint(int xx, int yy, int mode, int attr)
+{
     int ad, swad, j, miny, maxy, ojyx;
     xx = int(xx / 8);
     ojyx = chop8(yy);
@@ -1018,7 +1033,7 @@
         g_bsourcey = y;
         g_bsourcex2 = x + g_gridx - 1;
         g_bsourcey2 = y + g_gridy - 1;
-        //set_tool(1);
+
         g_btype = 9;
         return;
     }
@@ -1086,7 +1101,8 @@
             g_data[int('c')] = 0;
             g_data[int('t')] = 0;
 
-            if (ox >= 0 && ox < X && oy >= 0 & oy < Y) {
+            if (ox >= 0 && ox < X && oy >= 0 & oy < Y)
+            {
                 store_undo(); // exceptional!
                 if (g_multic)
                     floodfill_mc(ox, oy, mbut);
--- a/events.pde	Mon Aug 13 13:57:51 2018 +0300
+++ b/events.pde	Tue Aug 14 13:00:47 2018 +0300
@@ -1,9 +1,10 @@
 //collects mouse/key events and directly related command parsing
 
-boolean insidewindow(int x, int y)
+
+boolean insidewindow(int xc, int yc)
 {
     // XXX is this correct?
-    return (x > width - g_hedge || y > height - g_vedge);
+    return (xc > width - g_hedge || yc > height - g_vedge);
 }
 
 
@@ -72,6 +73,7 @@
     }
 }
 
+
 void mouseMoved()
 {
     g_dirty = true;
@@ -137,12 +139,15 @@
 
     if (insidewindow(g_iconx, g_icony))
     {
-        if (g_phase == 0) {
+        if (g_phase == 0)
+        {
             g_repanel = -2;
             g_tooltrigger = 100;
             g_piconx = g_iconx;
             g_picony = g_icony;
-        } else {
+        }
+        else
+        {
             g_iconx = -1;
             g_icony = -1;
         }
@@ -261,13 +266,21 @@
     }
 }
 
-void macro_command(int ckey) {
+
+void macro_command(int ckey)
+{
     //filter out load/save
-    if (ckey == 's' || ckey == 'S' || ckey == 'l' || ckey == 'E' || ckey == 'w' || ckey == 'W' || ckey == 'A') return;
+    if (ckey == 's' || ckey == 'S' || ckey == 'l' ||
+        ckey == 'E' || ckey == 'w' || ckey == 'W' ||
+        ckey == 'A')
+        return;
+
     command(ckey);
 }
 
-void command(int ckey) {
+
+void command(int ckey)
+{
     g_dirty = true;
 
     //keypresses change g_data[] values directly as 1/0 switches
--- a/multipaint.pde	Mon Aug 13 13:57:51 2018 +0300
+++ b/multipaint.pde	Tue Aug 14 13:00:47 2018 +0300
@@ -477,9 +477,8 @@
 
     switcher(0);
 
-    for (int i = 0; i < 1024; i++) {
+    for (int i = 0; i < 1024; i++)
         g_remdo[i] = 0;
-    }
 
     // Tool drawing for shows
     int savebut = g_button;
@@ -497,7 +496,6 @@
     // Screen update stuff
     loadPixels();
     viewport();
-    //magport();
     switcher(1);
     update_ui(false);
     updatePixels();
--- a/preview.pde	Mon Aug 13 13:57:51 2018 +0300
+++ b/preview.pde	Tue Aug 14 13:00:47 2018 +0300
@@ -35,6 +35,7 @@
     }
 }
 
+
 void preview_box_drag()
 {
     g_boxreconstruct = 2;