From 3fe82fa71d39d874691dc85e6a77250fd4953b17 Mon Sep 17 00:00:00 2001 From: Kevin Lamonte Date: Tue, 13 Aug 2019 17:53:06 -0500 Subject: [PATCH] #35 cjk without sixel --- src/jexer/TApplication.java | 21 ++++++++++---------- src/jexer/TButton.java | 6 +++--- src/jexer/TCheckBox.java | 4 ++-- src/jexer/TLabel.java | 4 ++-- src/jexer/backend/LogicalScreen.java | 29 +++++++++++++++++++++------- src/jexer/menu/TMenuItem.java | 6 +++--- 6 files changed, 42 insertions(+), 28 deletions(-) diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index ec93629..8cbce90 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 534c12a..82a6389 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 1e86470..1f9a351 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 1d65976..38c014c 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 b4e6214..4e4aecc 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 eafa9e5..d9dfc2a 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); -- 2.27.0