From: Kevin Lamonte Date: Tue, 13 Aug 2019 22:53:06 +0000 (-0500) Subject: #35 cjk without sixel X-Git-Tag: fanfix-swing-0.0.1~12^2~13^2~82 X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=3fe82fa71d39d874691dc85e6a77250fd4953b17;p=fanfix-swing.git #35 cjk without sixel --- diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index ec93629b..8cbce900 100644 --- a/src/jexer/TApplication.java +++ b/src/jexer/TApplication.java @@ -1695,17 +1695,16 @@ public class TApplication implements Runnable { Cell cell = getScreen().getCharXY(x, y); if (cell.isImage()) { cell.invertImage(); + } + if (cell.getForeColorRGB() < 0) { + cell.setForeColor(cell.getForeColor().invert()); } else { - if (cell.getForeColorRGB() < 0) { - cell.setForeColor(cell.getForeColor().invert()); - } else { - cell.setForeColorRGB(cell.getForeColorRGB() ^ 0x00ffffff); - } - if (cell.getBackColorRGB() < 0) { - cell.setBackColor(cell.getBackColor().invert()); - } else { - cell.setBackColorRGB(cell.getBackColorRGB() ^ 0x00ffffff); - } + cell.setForeColorRGB(cell.getForeColorRGB() ^ 0x00ffffff); + } + if (cell.getBackColorRGB() < 0) { + cell.setBackColor(cell.getBackColor().invert()); + } else { + cell.setBackColorRGB(cell.getBackColorRGB() ^ 0x00ffffff); } getScreen().putCharXY(x, y, cell); if ((onlyThisCell == true) || (cell.getWidth() == Cell.Width.SINGLE)) { @@ -1856,7 +1855,7 @@ public class TApplication implements Runnable { menuColor); getScreen().putStringXY(x + 1, 0, menu.getTitle(), menuColor); // Draw the highlight character - getScreen().putCharXY(x + 1 + menu.getMnemonic().getShortcutIdx(), + getScreen().putCharXY(x + 1 + menu.getMnemonic().getScreenShortcutIdx(), 0, menu.getMnemonic().getShortcut(), menuMnemonicColor); if (menu.isActive()) { diff --git a/src/jexer/TButton.java b/src/jexer/TButton.java index 534c12a4..82a63892 100644 --- a/src/jexer/TButton.java +++ b/src/jexer/TButton.java @@ -250,12 +250,12 @@ public class TButton extends TWidget { GraphicsChars.CP437[0xDF], shadowColor); } } - if (mnemonic.getShortcutIdx() >= 0) { + if (mnemonic.getScreenShortcutIdx() >= 0) { if (inButtonPress) { - putCharXY(2 + mnemonic.getShortcutIdx(), 0, + putCharXY(2 + mnemonic.getScreenShortcutIdx(), 0, mnemonic.getShortcut(), menuMnemonicColor); } else { - putCharXY(1 + mnemonic.getShortcutIdx(), 0, + putCharXY(1 + mnemonic.getScreenShortcutIdx(), 0, mnemonic.getShortcut(), menuMnemonicColor); } } diff --git a/src/jexer/TCheckBox.java b/src/jexer/TCheckBox.java index 1e86470a..1f9a351c 100644 --- a/src/jexer/TCheckBox.java +++ b/src/jexer/TCheckBox.java @@ -176,8 +176,8 @@ public class TCheckBox extends TWidget { } putCharXY(2, 0, ']', checkboxColor); putStringXY(4, 0, mnemonic.getRawLabel(), checkboxColor); - if (mnemonic.getShortcutIdx() >= 0) { - putCharXY(4 + mnemonic.getShortcutIdx(), 0, + if (mnemonic.getScreenShortcutIdx() >= 0) { + putCharXY(4 + mnemonic.getScreenShortcutIdx(), 0, mnemonic.getShortcut(), mnemonicColor); } } diff --git a/src/jexer/TLabel.java b/src/jexer/TLabel.java index 1d65976b..38c014c2 100644 --- a/src/jexer/TLabel.java +++ b/src/jexer/TLabel.java @@ -186,8 +186,8 @@ public class TLabel extends TWidget { mnemonicColor.setBackColor(background.getBackColor()); } putStringXY(0, 0, mnemonic.getRawLabel(), color); - if (mnemonic.getShortcutIdx() >= 0) { - putCharXY(mnemonic.getShortcutIdx(), 0, + if (mnemonic.getScreenShortcutIdx() >= 0) { + putCharXY(mnemonic.getScreenShortcutIdx(), 0, mnemonic.getShortcut(), mnemonicColor); } } diff --git a/src/jexer/backend/LogicalScreen.java b/src/jexer/backend/LogicalScreen.java index b4e62141..4e4aecca 100644 --- a/src/jexer/backend/LogicalScreen.java +++ b/src/jexer/backend/LogicalScreen.java @@ -803,11 +803,30 @@ public class LogicalScreen implements Screen { clipBottom = height - offsetY; for (int i = 0; i < boxHeight; i++) { - putAttrXY(boxLeft + boxWidth, boxTop + 1 + i, shadowAttr); - putAttrXY(boxLeft + boxWidth + 1, boxTop + 1 + i, shadowAttr); + Cell cell = getCharXY(offsetX + boxLeft + boxWidth, + offsetY + boxTop + 1 + i); + if (cell.getWidth() == Cell.Width.SINGLE) { + putAttrXY(boxLeft + boxWidth, boxTop + 1 + i, shadowAttr); + } else { + putCharXY(boxLeft + boxWidth, boxTop + 1 + i, ' ', shadowAttr); + } + cell = getCharXY(offsetX + boxLeft + boxWidth + 1, + offsetY + boxTop + 1 + i); + if (cell.getWidth() == Cell.Width.SINGLE) { + putAttrXY(boxLeft + boxWidth + 1, boxTop + 1 + i, shadowAttr); + } else { + putCharXY(boxLeft + boxWidth + 1, boxTop + 1 + i, ' ', + shadowAttr); + } } for (int i = 0; i < boxWidth; i++) { - putAttrXY(boxLeft + 2 + i, boxTop + boxHeight, shadowAttr); + Cell cell = getCharXY(offsetX + boxLeft + 2 + i, + offsetY + boxTop + boxHeight); + if (cell.getWidth() == Cell.Width.SINGLE) { + putAttrXY(boxLeft + 2 + i, boxTop + boxHeight, shadowAttr); + } else { + putCharXY(boxLeft + 2 + i, boxTop + boxHeight, ' ', shadowAttr); + } } clipRight = oldClipRight; clipBottom = oldClipBottom; @@ -985,15 +1004,11 @@ public class LogicalScreen implements Screen { Cell left = new Cell(cell); left.setImage(leftImage); left.setWidth(Cell.Width.LEFT); - // Blank out the char itself, so that shadows do not leave artifacts. - left.setChar(' '); putCharXY(x, y, left); Cell right = new Cell(cell); right.setImage(rightImage); right.setWidth(Cell.Width.RIGHT); - // Blank out the char itself, so that shadows do not leave artifacts. - right.setChar(' '); putCharXY(x + 1, y, right); } diff --git a/src/jexer/menu/TMenuItem.java b/src/jexer/menu/TMenuItem.java index eafa9e5b..d9dfc2ac 100644 --- a/src/jexer/menu/TMenuItem.java +++ b/src/jexer/menu/TMenuItem.java @@ -231,9 +231,9 @@ public class TMenuItem extends TWidget { putStringXY((getWidth() - StringUtils.width(keyLabel) - 2), 0, keyLabel, menuColor); } - if (mnemonic.getShortcutIdx() >= 0) { - putCharXY(2 + mnemonic.getShortcutIdx(), 0, mnemonic.getShortcut(), - menuMnemonicColor); + if (mnemonic.getScreenShortcutIdx() >= 0) { + putCharXY(2 + mnemonic.getScreenShortcutIdx(), 0, + mnemonic.getShortcut(), menuMnemonicColor); } if (checked) { assert (checkable);