X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fio%2FScreen.java;h=4dab0ff65a44e3141d6451f84d12ec9920f8931b;hb=0d47c5460c8e9d1198928308767a63ad35f46eb8;hp=81dabd246a8f607a4c87994c70a65880482eda0a;hpb=87a17f3ca4b2602c396afdbb13cccb4c1e7cbd38;p=fanfix.git diff --git a/src/jexer/io/Screen.java b/src/jexer/io/Screen.java index 81dabd2..4dab0ff 100644 --- a/src/jexer/io/Screen.java +++ b/src/jexer/io/Screen.java @@ -183,7 +183,17 @@ public abstract class Screen { /** * When true, logical != physical. */ - protected boolean dirty; + protected volatile boolean dirty; + + /** + * Get dirty flag. + * + * @return if true, the logical screen is not in sync with the physical + * screen + */ + public final boolean isDirty() { + return dirty; + } /** * Set if the user explicitly wants to redraw everything starting with a @@ -215,7 +225,6 @@ public abstract class Screen { * @return attributes at (x, y) */ public final CellAttributes getAttrXY(final int x, final int y) { - CellAttributes attr = new CellAttributes(); if ((x >= 0) && (x < width) && (y >= 0) && (y < height)) { attr.setTo(logical[x][y]); @@ -266,11 +275,11 @@ public abstract class Screen { dirty = true; logical[X][Y].setForeColor(attr.getForeColor()); logical[X][Y].setBackColor(attr.getBackColor()); - logical[X][Y].setBold(attr.getBold()); - logical[X][Y].setBlink(attr.getBlink()); - logical[X][Y].setReverse(attr.getReverse()); - logical[X][Y].setUnderline(attr.getUnderline()); - logical[X][Y].setProtect(attr.getProtect()); + logical[X][Y].setBold(attr.isBold()); + logical[X][Y].setBlink(attr.isBlink()); + logical[X][Y].setReverse(attr.isReverse()); + logical[X][Y].setUnderline(attr.isUnderline()); + logical[X][Y].setProtect(attr.isProtect()); } } @@ -334,11 +343,11 @@ public abstract class Screen { logical[X][Y].setChar(ch); logical[X][Y].setForeColor(attr.getForeColor()); logical[X][Y].setBackColor(attr.getBackColor()); - logical[X][Y].setBold(attr.getBold()); - logical[X][Y].setBlink(attr.getBlink()); - logical[X][Y].setReverse(attr.getReverse()); - logical[X][Y].setUnderline(attr.getUnderline()); - logical[X][Y].setProtect(attr.getProtect()); + logical[X][Y].setBold(attr.isBold()); + logical[X][Y].setBlink(attr.isBlink()); + logical[X][Y].setReverse(attr.isReverse()); + logical[X][Y].setUnderline(attr.isUnderline()); + logical[X][Y].setProtect(attr.isProtect()); } } @@ -378,7 +387,7 @@ public abstract class Screen { * @param str string to draw * @param attr attributes to use (bold, foreColor, backColor) */ - public final void putStrXY(final int x, final int y, final String str, + public final void putStringXY(final int x, final int y, final String str, final CellAttributes attr) { int i = x; @@ -400,7 +409,7 @@ public abstract class Screen { * @param y row coordinate. 0 is the top-most row. * @param str string to draw */ - public final void putStrXY(final int x, final int y, final String str) { + public final void putStringXY(final int x, final int y, final String str) { int i = x; for (int j = 0; j < str.length(); j++) { @@ -581,12 +590,24 @@ public abstract class Screen { } /** - * Force the screen to be fully cleared and redrawn on the next flush(). + * Clear the logical screen. */ public final void clear() { reset(); } + /** + * Clear the physical screen. + */ + public final void clearPhysical() { + dirty = true; + for (int row = 0; row < height; row++) { + for (int col = 0; col < width; col++) { + physical[col][row].reset(); + } + } + } + /** * Draw a box with a border and empty background. * @@ -623,8 +644,6 @@ public abstract class Screen { final CellAttributes border, final CellAttributes background, final int borderType, final boolean shadow) { - int boxTop = top; - int boxLeft = left; int boxWidth = right - left; int boxHeight = bottom - top;