Fix underlined cells rendering.

libgui/GuiCanvasWxBackend.py: FUCK YOU WXPYTHON
assets/text/TODO: updated.
This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-16 08:39:55 +02:00
parent 9de2f906ba
commit da15324fee
2 changed files with 16 additions and 6 deletions

View File

@ -24,8 +24,7 @@ Queue:
2) text tool: impl. backspace & enter, update internal brushPos if updated w/ arrow keys 2) text tool: impl. backspace & enter, update internal brushPos if updated w/ arrow keys
3) text tool: a) honour RTL text flow b) navigating w/ cursor keys c) pasting text 3) text tool: a) honour RTL text flow b) navigating w/ cursor keys c) pasting text
4) scroll down, apply operator to entire canvas, scroll up 4) scroll down, apply operator to entire canvas, scroll up
5) underline FUCKING BROKEN _AGAIN_ 5) select-related {re,un}do bugs
6) select-related {re,un}do bugs 6) clone selection lag
7) clone selection lag
vim:ff=dos tw=0 vim:ff=dos tw=0

View File

@ -27,6 +27,14 @@ class GuiBufferedDC(wx.MemoryDC):
# }}} # }}}
class GuiCanvasWxBackend(): class GuiCanvasWxBackend():
# {{{ _CellState(): Cell state
class _CellState():
CS_NONE = 0x00
CS_BOLD = 0x01
CS_ITALIC = 0x02
CS_UNDERLINE = 0x04
# }}}
# {{{ _drawBrushPatch(self, eventDc, patch, point) # {{{ _drawBrushPatch(self, eventDc, patch, point)
def _drawBrushPatch(self, eventDc, patch, point): def _drawBrushPatch(self, eventDc, patch, point):
absPoint = self._xlatePoint(point) absPoint = self._xlatePoint(point)
@ -43,10 +51,11 @@ class GuiCanvasWxBackend():
fontDc.SetTextForeground(wx.Colour(Colours[patch[0]][:4])) fontDc.SetTextForeground(wx.Colour(Colours[patch[0]][:4]))
fontDc.SetTextBackground(wx.Colour(Colours[patch[1]][:4])) fontDc.SetTextBackground(wx.Colour(Colours[patch[1]][:4]))
fontDc.DrawRectangle(0, 0, *self.cellSize) fontDc.DrawRectangle(0, 0, *self.cellSize)
if patch[3] == "_": fontDc.SetPen(self._pens[patch[0]])
fontDc.SetPen(self._pens[patch[0]]) if (patch[2] & self._CellState.CS_UNDERLINE) \
or (patch[3] == "_"):
fontDc.DrawLine(0, self.cellSize[1] - 1, self.cellSize[0], self.cellSize[1] - 1) fontDc.DrawLine(0, self.cellSize[1] - 1, self.cellSize[0], self.cellSize[1] - 1)
else: if patch[3] != "_":
fontDc.DrawText(patch[3], 0, 0) fontDc.DrawText(patch[3], 0, 0)
eventDc.Blit(*absPoint, *self.cellSize, fontDc, 0, 0) eventDc.Blit(*absPoint, *self.cellSize, fontDc, 0, 0)
# }}} # }}}
@ -115,6 +124,8 @@ class GuiCanvasWxBackend():
if patch[5] == " ": if patch[5] == " ":
if patch[3] == -1: if patch[3] == -1:
self._drawCharPatch(eventDc, [*patch[2:-1], ""], point) self._drawCharPatch(eventDc, [*patch[2:-1], ""], point)
elif patch[4] & self._CellState.CS_UNDERLINE:
self._drawCharPatch(eventDc, patch[2:], point)
else: else:
self._drawBrushPatch(eventDc, patch[2:], point) self._drawBrushPatch(eventDc, patch[2:], point)
else: else: