diff Interface.pde @ 131:9d17f991f102

Move undo and spare page management into buffers.pde as in Multipaint 2018.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 05 Aug 2018 10:44:45 +0300
parents b9b60552667e
children f5c32f6470d0
line wrap: on
line diff
--- a/Interface.pde	Sun Aug 05 09:55:17 2018 +0300
+++ b/Interface.pde	Sun Aug 05 10:44:45 2018 +0300
@@ -182,130 +182,15 @@
 }
 
 
-void ustats() {
-    //a debug thingie in case the step undo does not work
-    //println("UINDEX:"+g_uindex[g_spare]);
-    //println("UTOP:"+g_utop[g_spare]);
-    //println("UBOTTOM:"+g_ubottom[g_spare]);
-}
-
-
-void store_undo() //to_undo
+void sussborder()
 {
-    if (g_spare)
-        arrayCopy(g_map, g_undobs[g_uindex[g_spare]]);
-    else
-        arrayCopy(g_map, g_undob[g_uindex[g_spare]]);
-
-    g_uindex[g_spare]++;
-    if (g_uindex[g_spare] > 10)
-        g_uindex[g_spare] = 0;
-
-    if (g_uindex[g_spare] == g_ubottom[g_spare]) {
-        g_ubottom[g_spare]++;
-        if (g_ubottom[g_spare] > 10)
-            g_ubottom[g_spare] = 0;
-    }
-    g_utop[g_spare] = g_uindex[g_spare];
-
-    refreshpalette();
-    ustats();
-}
-
-
-void restore_undo() {
-    if (g_uindex[g_spare] == g_ubottom[g_spare])
-        return;
-
-    if (g_spare)
-        arrayCopy(g_map, g_undobs[g_uindex[g_spare]]);
-    else
-        arrayCopy(g_map, g_undob[g_uindex[g_spare]]);
-
-    g_uindex[g_spare]--;
-    if (g_uindex[g_spare] < 0)
-        g_uindex[g_spare] = 10;
-
-    if (g_spare)
-        arrayCopy(g_undobs[g_uindex[g_spare]], g_map);
-    else
-        arrayCopy(g_undob[g_uindex[g_spare]], g_map);
-
-    refreshpalette();
-    ustats();
-}
-
-
-void redo_undo() {
-    if (g_uindex[g_spare] == g_utop[g_spare])
-        return;
-
-    g_uindex[g_spare]++;
-    if (g_uindex[g_spare] > 10)
-        g_uindex[g_spare] = 0;
-
-    if (g_spare)
-        arrayCopy(g_undobs[g_uindex[g_spare]], g_map);
-    else
-        arrayCopy(g_undob[g_uindex[g_spare]], g_map);
-
-    refreshpalette();
-    ustats();
-}
-
-
-void spare() //dpaint style spare page
-{
-    arrayCopy(g_sparepage, g_swappage);
-    arrayCopy(g_map, g_sparepage);
-    arrayCopy(g_swappage, g_map);
-
-    mpSetTitle(g_spare ? sfilename : filename);
-
-    g_spare = 1 - g_spare;
-    g_realfront = byte(g_farge);
-    g_realback = byte(g_backg);
-    refreshpalette();
-}
-
-
-void switcher(int di) {
-    // this achieves varieties of whole screen copying
-    // needed for brush copy and pre-drawing the shapes when a
-    // tool is active etc.
-    switch (di) {
-        case 0:
-            arrayCopy(g_map, g_rmap);
-            break;
-        case 1:
-            arrayCopy(g_rmap, g_map);
-            for (int i = 0; i < 1024; i++) {
-                if (g_remdo[i] == 1) {
-                    g_remdo[i] = 0;
-                    g_redo[i] = 0;
-                }
-            }
-            break;
-        case 2:
-            arrayCopy(g_map, g_brush);
-            break;
-        case 3:
-            arrayCopy(g_map, g_sparepage);
-            break;
-        case 4:
-            arrayCopy(g_sparepage, g_mapm);
-            break;
-    }
-}
-
-
-void sussborder() {
     makecolor(259, g_r[g_map[0]], g_g[g_map[0]], g_b[g_map[0]]);
     g_boxreconstruct = 2;
 }
 
 
-void makecolor(int c, int rr, int gg, int bb) {
+void makecolor(int c, int rr, int gg, int bb)
+{
     //0-255 go to g_map[] up until 1021-1023
     //the rest is not stored
     if (c < 256) {
@@ -321,7 +206,8 @@
 }
 
 
-int fylli() {
+int fylli()
+{
     //for the animated rubberband thingy
     g_rband++;
     if (g_rband > g_rbang) {