[jsword-svn] bibledesktop/java/main/org/crosswire/bibledesktop/desktop s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Tue May 3 17:26:45 MST 2005


Update of /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/desktop
In directory www.crosswire.org:/tmp/cvs-serv12607/java/main/org/crosswire/bibledesktop/desktop

Modified Files:
	ViewSourcePane.java DesktopActions.java 
Log Message:
Fixed a bug in TabbedBookDisplay.getInnerDisplayPane, which manifested itself in Edit->copy when there were tabs.
Also, fixed the performance problem with ViewSourcePane, by not stylizing the text in an HTMLEditorKit and by limiting the text to the selected tab's tab.

Index: DesktopActions.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/desktop/DesktopActions.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** DesktopActions.java	6 Apr 2005 04:07:41 -0000	1.23
--- DesktopActions.java	4 May 2005 00:26:43 -0000	1.24
***************
*** 14,18 ****
--- 14,20 ----
  import org.crosswire.bibledesktop.book.BibleViewPane;
  import org.crosswire.bibledesktop.book.install.SitesPane;
+ import org.crosswire.bibledesktop.display.BookDataDisplay;
  import org.crosswire.bibledesktop.display.splitlist.SplitBookDataDisplay;
+ import org.crosswire.bibledesktop.display.tab.TabbedBookDataDisplay;
  import org.crosswire.common.config.swing.ConfigEditorFactory;
  import org.crosswire.common.swing.ActionFactory;
***************
*** 300,307 ****
          try
          {
              BibleViewPane view = (BibleViewPane) getDesktop().getViews().getSelected();
              SplitBookDataDisplay da = view.getPassagePane();
  
!             Key key = da.getKey();
  
              if (key == null)
--- 302,315 ----
          try
          {
+             // Limit view source to the current tab.
              BibleViewPane view = (BibleViewPane) getDesktop().getViews().getSelected();
              SplitBookDataDisplay da = view.getPassagePane();
+             BookDataDisplay bdd = da.getBookDataDisplay();
+             if (bdd instanceof TabbedBookDataDisplay)
+             {
+                 bdd = ((TabbedBookDataDisplay) bdd).getInnerDisplayPane();
+             }
  
!             Key key = bdd.getKey();
  
              if (key == null)

Index: ViewSourcePane.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/desktop/ViewSourcePane.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ViewSourcePane.java	6 Apr 2005 04:07:41 -0000	1.12
--- ViewSourcePane.java	4 May 2005 00:26:43 -0000	1.13
***************
*** 16,32 ****
  import javax.swing.JTabbedPane;
  import javax.swing.JTextArea;
- import javax.swing.JTextPane;
  import javax.swing.WindowConstants;
  import javax.swing.text.JTextComponent;
- import javax.swing.text.html.HTMLEditorKit;
  
  import org.crosswire.bibledesktop.util.ConfigurableSwingConverter;
  import org.crosswire.common.swing.ActionFactory;
- import org.crosswire.common.swing.AntiAliasedTextPane;
  import org.crosswire.common.swing.GuiUtil;
  import org.crosswire.common.util.Reporter;
  import org.crosswire.common.xml.Converter;
  import org.crosswire.common.xml.FormatType;
! import org.crosswire.common.xml.HTMLSerializingContentHandler;
  import org.crosswire.common.xml.SAXEventProvider;
  import org.crosswire.common.xml.TransformingSAXEventProvider;
--- 16,29 ----
  import javax.swing.JTabbedPane;
  import javax.swing.JTextArea;
  import javax.swing.WindowConstants;
  import javax.swing.text.JTextComponent;
  
  import org.crosswire.bibledesktop.util.ConfigurableSwingConverter;
  import org.crosswire.common.swing.ActionFactory;
  import org.crosswire.common.swing.GuiUtil;
  import org.crosswire.common.util.Reporter;
  import org.crosswire.common.xml.Converter;
  import org.crosswire.common.xml.FormatType;
! import org.crosswire.common.xml.PrettySerializingContentHandler;
  import org.crosswire.common.xml.SAXEventProvider;
  import org.crosswire.common.xml.TransformingSAXEventProvider;
***************
*** 34,37 ****
--- 31,35 ----
  import org.crosswire.jsword.book.BookData;
  import org.crosswire.jsword.book.BookMetaData;
+ import org.crosswire.jsword.book.BookType;
  import org.crosswire.jsword.passage.Key;
  import org.crosswire.jsword.util.ConverterFactory;
***************
*** 79,96 ****
              SAXEventProvider osissep = bdata.getSAXEventProvider();
  
!             ContentHandler osis = new HTMLSerializingContentHandler(FormatType.CLASSIC_INDENT);
              osissep.provideSAXEvents(osis);
  
              TransformingSAXEventProvider htmlsep = (TransformingSAXEventProvider) converter.convert(osissep);
!             htmlsep.setParameter(XSLTProperty.STRONGS_NUMBERS.getName(), Boolean.toString(XSLTProperty.STRONGS_NUMBERS.getState()));
!             htmlsep.setParameter(XSLTProperty.MORPH.getName(), Boolean.toString(XSLTProperty.MORPH.getState()));
!             htmlsep.setParameter(XSLTProperty.START_VERSE_ON_NEWLINE.getName(), Boolean.toString(XSLTProperty.START_VERSE_ON_NEWLINE.getState()));
!             htmlsep.setParameter(XSLTProperty.VERSE_NUMBERS.getName(), Boolean.toString(XSLTProperty.VERSE_NUMBERS.getState()));
!             htmlsep.setParameter(XSLTProperty.TINY_VERSE_NUMBERS.getName(), Boolean.toString(XSLTProperty.TINY_VERSE_NUMBERS.getState()));
!             htmlsep.setParameter(XSLTProperty.NOTES.getName(), Boolean.toString(XSLTProperty.NOTES.getState()));
!             htmlsep.setParameter(XSLTProperty.XREF.getName(), Boolean.toString(XSLTProperty.XREF.getState()));
!             htmlsep.setParameter("direction", direction ? "ltr" : "rtl"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  
!             ContentHandler html = new HTMLSerializingContentHandler(FormatType.CLASSIC_INDENT);
              htmlsep.provideSAXEvents(html);
  
--- 77,101 ----
              SAXEventProvider osissep = bdata.getSAXEventProvider();
  
!             // This really looks nice but its performance was terrible.
! //            ContentHandler osis = new HTMLSerializingContentHandler(FormatType.CLASSIC_INDENT);
!             ContentHandler osis = new PrettySerializingContentHandler(FormatType.CLASSIC_INDENT);
              osissep.provideSAXEvents(osis);
  
              TransformingSAXEventProvider htmlsep = (TransformingSAXEventProvider) converter.convert(osissep);
!             if (bmd.getType() == BookType.BIBLE)
!             {
!                 htmlsep.setParameter(XSLTProperty.STRONGS_NUMBERS.getName(), Boolean.toString(XSLTProperty.STRONGS_NUMBERS.getState()));
!                 htmlsep.setParameter(XSLTProperty.MORPH.getName(), Boolean.toString(XSLTProperty.MORPH.getState()));
!                 htmlsep.setParameter(XSLTProperty.START_VERSE_ON_NEWLINE.getName(), Boolean.toString(XSLTProperty.START_VERSE_ON_NEWLINE.getState()));
!                 htmlsep.setParameter(XSLTProperty.VERSE_NUMBERS.getName(), Boolean.toString(XSLTProperty.VERSE_NUMBERS.getState()));
!                 htmlsep.setParameter(XSLTProperty.TINY_VERSE_NUMBERS.getName(), Boolean.toString(XSLTProperty.TINY_VERSE_NUMBERS.getState()));
!                 htmlsep.setParameter(XSLTProperty.NOTES.getName(), Boolean.toString(XSLTProperty.NOTES.getState()));
!                 htmlsep.setParameter(XSLTProperty.XREF.getName(), Boolean.toString(XSLTProperty.XREF.getState()));
!                 htmlsep.setParameter("direction", direction ? "ltr" : "rtl"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
!             }
  
!             // This really looks nice but its performance was terrible.
! //            ContentHandler html = new HTMLSerializingContentHandler(FormatType.CLASSIC_INDENT);
!             ContentHandler html = new PrettySerializingContentHandler(FormatType.CLASSIC_INDENT);
              htmlsep.provideSAXEvents(html);
  
***************
*** 104,118 ****
  
      /**
-      * Construct a ViewSourcePane with some string contents
-      * @param orig The original contents of the text area
-      * @param osis The OSIS contents of the text area
-      * @param html The HTML contents of the text area
-      */
-     public ViewSourcePane(String orig, String osis, String html)
-     {
-         init(orig, osis, html);
-     }
- 
-     /**
       * Actually create the GUI
       */
--- 109,112 ----
***************
*** 133,152 ****
          pnlOrig.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  
!         JTextPane txtOsis = new AntiAliasedTextPane();
          txtOsis.setFont(userRequestedFont);
          txtOsis.setEditable(false);
-         txtOsis.setEditorKit(new HTMLEditorKit());
-         txtOsis.setText(osis);
-         txtOsis.setCaretPosition(0);
          JPanel pnlOsis = new JPanel(new BorderLayout());
          pnlOsis.add(new JScrollPane(txtOsis), BorderLayout.CENTER);
          pnlOsis.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  
!         JTextPane txtHtml = new AntiAliasedTextPane();
          txtHtml.setFont(userRequestedFont);
          txtHtml.setEditable(false);
-         txtHtml.setEditorKit(new HTMLEditorKit());
-         txtHtml.setText(html);
-         txtHtml.setCaretPosition(0);
          JPanel pnlHtml = new JPanel(new BorderLayout());
          pnlHtml.add(new JScrollPane(txtHtml), BorderLayout.CENTER);
--- 127,160 ----
          pnlOrig.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  
!         // This really looks nice but its performance was terrible.
! //        JTextPane txtOsis = new AntiAliasedTextPane();
! //        txtOsis.setFont(userRequestedFont);
! //        txtOsis.setEditable(false);
! //        txtOsis.setEditorKit(new HTMLEditorKit());
! //        txtOsis.setText(osis);
! //        txtOsis.setCaretPosition(0);
!         JTextArea txtOsis = new JTextArea(html, 24, 80);
          txtOsis.setFont(userRequestedFont);
+         txtOsis.setLineWrap(true);
+         txtOsis.setWrapStyleWord(true);
+         txtOsis.setTabSize(2);
          txtOsis.setEditable(false);
          JPanel pnlOsis = new JPanel(new BorderLayout());
          pnlOsis.add(new JScrollPane(txtOsis), BorderLayout.CENTER);
          pnlOsis.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  
!         // This really looks nice but its performance was terrible.
! //        JTextPane txtHtml = new AntiAliasedTextPane();
! //        txtHtml.setFont(userRequestedFont);
! //        txtHtml.setEditable(false);
! //        txtHtml.setEditorKit(new HTMLEditorKit());
! //        txtHtml.setText(html);
! //        txtHtml.setCaretPosition(0);
!         JTextArea txtHtml = new JTextArea(osis, 24, 80);
          txtHtml.setFont(userRequestedFont);
+         txtHtml.setLineWrap(true);
+         txtHtml.setWrapStyleWord(true);
+         txtHtml.setTabSize(2);
          txtHtml.setEditable(false);
          JPanel pnlHtml = new JPanel(new BorderLayout());
          pnlHtml.add(new JScrollPane(txtHtml), BorderLayout.CENTER);



More information about the jsword-svn mailing list