From e2da2602b60d4cbf5f9743d6733ec2f85555b9ed Mon Sep 17 00:00:00 2001 From: Niki Roo Date: Sun, 24 Mar 2019 18:08:22 +0100 Subject: [PATCH] gui: improve internal text reader --- .../reader/ui/GuiReaderViewerTextOutput.java | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/be/nikiroo/fanfix/reader/ui/GuiReaderViewerTextOutput.java b/src/be/nikiroo/fanfix/reader/ui/GuiReaderViewerTextOutput.java index e9a44b5..47d9664 100644 --- a/src/be/nikiroo/fanfix/reader/ui/GuiReaderViewerTextOutput.java +++ b/src/be/nikiroo/fanfix/reader/ui/GuiReaderViewerTextOutput.java @@ -6,6 +6,7 @@ import java.util.Arrays; import be.nikiroo.fanfix.Instance; import be.nikiroo.fanfix.data.Chapter; import be.nikiroo.fanfix.data.Paragraph; +import be.nikiroo.fanfix.data.Paragraph.ParagraphType; import be.nikiroo.fanfix.data.Story; import be.nikiroo.fanfix.output.BasicOutput; @@ -57,27 +58,35 @@ public class GuiReaderViewerTextOutput { @Override protected void writeParagraph(Paragraph para) throws IOException { + if ((para.getType() == ParagraphType.QUOTE) == !paraInQuote) { + paraInQuote = !paraInQuote; + if (paraInQuote) { + builder.append("
"); + builder.append("
"); + } else { + builder.append("
"); + builder.append("
"); + } + } + switch (para.getType()) { case NORMAL: + builder.append("    "); builder.append(decorateText(para.getContent())); builder.append("
"); break; case BLANK: - builder.append("
"); + builder.append("

"); break; case BREAK: - builder.append("
* * *

"); + builder.append("

"); + builder.append("* * *"); + builder.append("



"); break; case QUOTE: - if (!paraInQuote) { - builder.append("
"); - } else { - builder.append("
"); - } - paraInQuote = !paraInQuote; - builder.append("
"); - builder.append("–  "); + builder.append("    "); + builder.append("— "); builder.append(decorateText(para.getContent())); builder.append("
"); @@ -88,7 +97,7 @@ public class GuiReaderViewerTextOutput { @Override protected String enbold(String word) { - return "" + word + ""; + return "" + word + ""; } @Override -- 2.27.0