Instance: use getInstance()
[nikiroo-utils.git] / src / be / nikiroo / fanfix / reader / ui / GuiReaderViewerTextOutput.java
index c5f7943c17ed9eab4a03eb0d0a22f4c3b3eeb26e..fc914ddb458eefbe3f2bf273d38a8d07d71dad14 100644 (file)
@@ -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;
 
@@ -41,10 +42,7 @@ public class GuiReaderViewerTextOutput {
                                builder.append(chap.getName());
                                builder.append("</H1>");
 
-                               builder.append("<JUSTIFY>");
-                               for (Paragraph para : chap) {
-                                       writeParagraph(para);
-                               }
+                               builder.append("<DIV align='justify'>");
                        }
 
                        @Override
@@ -54,33 +52,41 @@ public class GuiReaderViewerTextOutput {
                                }
                                paraInQuote = false;
 
-                               builder.append("</JUSTIFY>");
+                               builder.append("</DIV>");
                                builder.append("</HTML>");
                        }
 
                        @Override
                        protected void writeParagraph(Paragraph para) throws IOException {
+                               if ((para.getType() == ParagraphType.QUOTE) == !paraInQuote) {
+                                       paraInQuote = !paraInQuote;
+                                       if (paraInQuote) {
+                                               builder.append("<BR>");
+                                               builder.append("<DIV>");
+                                       } else {
+                                               builder.append("</DIV>");
+                                               builder.append("<BR>");
+                                       }
+                               }
+
                                switch (para.getType()) {
                                case NORMAL:
+                                       builder.append("&nbsp;&nbsp;&nbsp;&nbsp;");
                                        builder.append(decorateText(para.getContent()));
                                        builder.append("<BR>");
                                        break;
                                case BLANK:
-                                       builder.append("<BR>");
+                                       builder.append("<BR><BR>");
                                        break;
                                case BREAK:
-                                       builder.append("<BR>* * *<BR><BR>");
+                                       builder.append("<BR><P COLOR='#7777DD' ALIGN='CENTER'><B>");
+                                       builder.append("* * *");
+                                       builder.append("</B></P><BR><BR>");
                                        break;
                                case QUOTE:
-                                       if (!paraInQuote) {
-                                               builder.append("<DIV>");
-                                       } else {
-                                               builder.append("</DIV>");
-                                       }
-                                       paraInQuote = !paraInQuote;
-
                                        builder.append("<DIV>");
-                                       builder.append("&ndash;&nbsp;&nbsp;");
+                                       builder.append("&nbsp;&nbsp;&nbsp;&nbsp;");
+                                       builder.append("&mdash;&nbsp;");
                                        builder.append(decorateText(para.getContent()));
                                        builder.append("</DIV>");
 
@@ -91,7 +97,7 @@ public class GuiReaderViewerTextOutput {
 
                        @Override
                        protected String enbold(String word) {
-                               return "<B COLOR='BLUE'>" + word + "</B>";
+                               return "<B COLOR='#7777DD'>" + word + "</B>";
                        }
 
                        @Override
@@ -115,7 +121,7 @@ public class GuiReaderViewerTextOutput {
                        fakeStory.setChapters(Arrays.asList(chap));
                        output.process(fakeStory, null, null);
                } catch (IOException e) {
-                       Instance.getTraceHandler().error(e);
+                       Instance.getInstance().getTraceHandler().error(e);
                }
                return builder.toString();
        }