[brailleblaster] 3 new revisions pushed by RandomCh...@xxxxxxxxx on 2014-07-29 19:10 GMT

  • From: brailleblaster@xxxxxxxxxxxxxx
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Tue, 29 Jul 2014 19:11:01 +0000

3 new revisions:

Revision: c44b23759a7c
Branch:   default
Author:   cmyers@xxxxxxxxxxxxxxxxx
Date:     Mon Jul 28 19:11:35 2014 UTC
Log:      Turned logging back on.
http://code.google.com/p/brailleblaster/source/detail?r=c44b23759a7c

Revision: 6e6df1a8327d
Branch:   default
Author:   cmyers@xxxxxxxxxxxxxxxxx
Date:     Tue Jul 29 20:11:34 2014 UTC
Log: Fixed ImgDesc bug related to per-page image counts. Bugfix - Creating ...
http://code.google.com/p/brailleblaster/source/detail?r=6e6df1a8327d

Revision: 332ae8ad03a5
Branch:   default
Author:   cmyers@xxxxxxxxxxxxxxxxx
Date:     Tue Jul 29 20:13:42 2014 UTC
Log: Fixed ImgDesc bug related to per-page image counts. Bugfix - Creating ...
http://code.google.com/p/brailleblaster/source/detail?r=332ae8ad03a5

==============================================================================
Revision: c44b23759a7c
Branch:   default
Author:   cmyers@xxxxxxxxxxxxxxxxx
Date:     Mon Jul 28 19:11:35 2014 UTC
Log:      Turned logging back on.
http://code.google.com/p/brailleblaster/source/detail?r=c44b23759a7c

Modified:
 /src/main/org/brailleblaster/BBIni.java

=======================================
--- /src/main/org/brailleblaster/BBIni.java     Mon Jul 28 18:58:18 2014 UTC
+++ /src/main/org/brailleblaster/BBIni.java     Mon Jul 28 19:11:35 2014 UTC
@@ -244,8 +244,8 @@
                }
                try {
                        LibLouisUTDML.loadLibrary(nativeLibraryPath, 
nativeLibrarySuffix);
-                       // 
LibLouisUTDML.getInstance().setLogLevel(LogLevel.ERROR);
-                       LibLouisUTDML.getInstance().setLogLevel(LogLevel.OFF);
+                        
LibLouisUTDML.getInstance().setLogLevel(LogLevel.ERROR);
+//                     LibLouisUTDML.getInstance().setLogLevel(LogLevel.OFF);
org.brailleblaster.louisutdml.LogHandler louisutdmlLogHandler = new org.brailleblaster.louisutdml.LogHandler();
                        
LibLouis.getInstance().registerLogCallback(louisutdmlLogHandler);
                        
LibLouisUTDML.getInstance().registerLogCallback(louisutdmlLogHandler);

==============================================================================
Revision: 6e6df1a8327d
Branch:   default
Author:   cmyers@xxxxxxxxxxxxxxxxx
Date:     Tue Jul 29 20:11:34 2014 UTC
Log: Fixed ImgDesc bug related to per-page image counts. Bugfix - Creating premature nimas xml before needed when pressing next/prev. Bugfix - performance degradation upon clicking next/prev numerous times.
http://code.google.com/p/brailleblaster/source/detail?r=6e6df1a8327d

Modified:
 /src/main/org/brailleblaster/BBIni.java
 /src/main/org/brailleblaster/archiver/Archiver.java
 /src/main/org/brailleblaster/archiver/NimasArchiver.java
/src/main/org/brailleblaster/perspectives/imageDescriber/views/ImageDescriberView.java

=======================================
--- /src/main/org/brailleblaster/BBIni.java     Mon Jul 28 19:11:35 2014 UTC
+++ /src/main/org/brailleblaster/BBIni.java     Tue Jul 29 20:11:34 2014 UTC
@@ -245,7 +245,6 @@
                try {
                        LibLouisUTDML.loadLibrary(nativeLibraryPath, 
nativeLibrarySuffix);
                         
LibLouisUTDML.getInstance().setLogLevel(LogLevel.ERROR);
-//                     LibLouisUTDML.getInstance().setLogLevel(LogLevel.OFF);
org.brailleblaster.louisutdml.LogHandler louisutdmlLogHandler = new org.brailleblaster.louisutdml.LogHandler();
                        
LibLouis.getInstance().registerLogCallback(louisutdmlLogHandler);
                        
LibLouisUTDML.getInstance().registerLogCallback(louisutdmlLogHandler);
=======================================
--- /src/main/org/brailleblaster/archiver/Archiver.java Mon Jul 28 18:58:18 2014 UTC +++ /src/main/org/brailleblaster/archiver/Archiver.java Tue Jul 29 20:11:34 2014 UTC
@@ -303,8 +303,6 @@
                // If there are no images, return.
                if(imgElements == null)
                        return;
-               if(imgElements.getLength() == 0)
-                       return;

                // Add this value to the list.

=======================================
--- /src/main/org/brailleblaster/archiver/NimasArchiver.java Mon Jul 28 19:01:59 2014 UTC +++ /src/main/org/brailleblaster/archiver/NimasArchiver.java Tue Jul 29 20:11:34 2014 UTC
@@ -30,27 +30,12 @@

 package org.brailleblaster.archiver;

-import java.io.BufferedOutputStream;
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.StringWriter;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Set;

-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
 import nu.xom.Attribute;
 import nu.xom.Builder;
 import nu.xom.Document;
@@ -59,18 +44,12 @@
 import nu.xom.Nodes;
 import nu.xom.ParsingException;
 import nu.xom.ValidityException;
-import nu.xom.XPathContext;
-import nu.xom.converters.DOMConverter;
-import nu.xom.xslt.XSLException;
-import nu.xom.xslt.XSLTransform;

 import org.brailleblaster.BBIni;
 import org.brailleblaster.document.BBDocument;
 import org.brailleblaster.util.FileUtils;
 import org.brailleblaster.util.Notify;
 import org.brailleblaster.util.Zipper;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.NodeList;

//////////////////////////////////////////////////////////////////////////////////
 // Prepares Nimas Archive for opening.
@@ -247,24 +226,8 @@
                        fu.createXMLFile( curDoc, outPath );
                        allPaths.add(Integer.toString(index));

-                       // Save path in archiver and temp list.
-                       // epubFileList is for multi-file traversal and tempList
-                       // is for deleting temp files.
-
-                       // Make these lists as big as they should be.
-                       if(epubFileList.size() == 0) {
-                               for(int curF = 0; curF < numPotentialFiles; 
curF++) {
-                                       epubFileList.add(null);
-                                       tempList.add(null);
-                               }
-                       }
-
-                       // Add new value.
-                       epubFileList.set(index, outPath);
-                       tempList.set(index, outPath);
-
-                       // Count the images in this document.
-               // addToNumImgsList(curDoc, index);
+                       // Add this file to the temp list so it will be deleted 
later.
+                       tempList.add(outPath);
                }

                return outPath;
@@ -303,6 +266,14 @@
                                Node nd = allNode.get(curLvl1);
                                addToNumImgsList( new 
Document((Element)nd.copy()), curLvl1);
                        }
+
+                       // Save paths to files that we may create.
+                       // Fill list.
+                       if(epubFileList.size() == 0) {
+                               for(int curF = 0; curF < numPotentialFiles; 
curF++) {
+ epubFileList.add(workingDocPath.substring(0, workingDocPath.lastIndexOf(BBIni.getFileSep())) + BBIni.getFileSep() + Integer.toString(curF) + ".xml");
+                               }
+                       }
                }


=======================================
--- /src/main/org/brailleblaster/perspectives/imageDescriber/views/ImageDescriberView.java Mon Jul 28 18:58:18 2014 UTC +++ /src/main/org/brailleblaster/perspectives/imageDescriber/views/ImageDescriberView.java Tue Jul 29 20:11:34 2014 UTC
@@ -113,31 +113,22 @@
                        // Grab index of current image.
                        int imgIndex = 
idd.getImageDescriber().getCurrentElementIndex();

-                       // We probably need to create another page/section.
-                       // This will apply most to NIMAS files.
-                       if( (idd.getArchiver() instanceof NimasArchiver) )
-                       {
-                               // Get current spine index and number of spine 
files.
-                               int curSpineIdx = 
idd.getArchiver().getCurSpineIdx() - 1;
- int numSpineFiles = ((NimasArchiver)(idd.getArchiver())).getNumPotentialFiles();
-
-                               // Which spine file SHOULD we be on right now?
-                               if(curSpineIdx >= numSpineFiles)
-                                       curSpineIdx = 0;
-                               if(curSpineIdx < 0)
-                                       curSpineIdx = numSpineFiles - 1;
-
-                               // Write the new file.
-                               
((NimasArchiver)(idd.getArchiver())).wrtieToDisk( curSpineIdx );
-
-                       } // if( (idd.getArchiver() instanceof NimasArchiver) )
+                       // Hang onto old spine file path.
+                       String oldPath = 
idd.getArchiver().getCurSpineFilePath();

                        // Is it time to move to another page/chapter?
                        String newPath = 
idd.getArchiver().setSpineFileWithImgIndex(imgIndex);
+
+                       // If the spine paths are different, then we may need 
to create
+                       // the new spine file. Nimas.
+                       if( (idd.getArchiver() instanceof NimasArchiver) ) {
+                               if( oldPath.compareTo(newPath) != 0)
+ ((NimasArchiver)(idd.getArchiver())).wrtieToDisk( idd.getArchiver().getCurSpineIdx() );
+                       }

                        // If the page needs to move/change, update.
                        // Otherwise, don't move the page yet.
-                       if(newPath != null && 
newPath.compareTo(curBrowserFilePath) != 0) {
+ if(newPath != null && newPath.replace(".xml", ".html").compareTo(curBrowserFilePath) != 0) {
                                // Store path.
                                curBrowserFilePath = newPath;
                                // Update browser view.
@@ -165,31 +156,21 @@
                                // Grab index of current image.
                                int imgIndex = 
idd.getImageDescriber().getCurrentElementIndex();

-                               // We probably need to create another 
page/section.
-                               // This will apply most to NIMAS files.
-                               if( (idd.getArchiver() instanceof 
NimasArchiver) )
-                               {
-                                       // Get current spine index and number 
of spine files.
-                                       int curSpineIdx = 
idd.getArchiver().getCurSpineIdx() + 1;
- int numSpineFiles = ((NimasArchiver)(idd.getArchiver())).getNumPotentialFiles();
-
-                                       // Which spine file SHOULD we be on 
right now?
-                                       if(curSpineIdx >= numSpineFiles)
-                                               curSpineIdx = 0;
-                                       if(curSpineIdx < 0)
-                                               curSpineIdx = numSpineFiles - 1;
-
-                                       // Write the new file.
-                                       
((NimasArchiver)(idd.getArchiver())).wrtieToDisk( curSpineIdx );
-
-                               } // if( (idd.getArchiver() instanceof 
NimasArchiver) )
+                               // Hang onto old spine file path.
+                               String oldPath = 
idd.getArchiver().getCurSpineFilePath();

-                               // Move to next section.
+                               // Is it time to move to another page/chapter?
                                String newPath = 
idd.getArchiver().setSpineFileWithImgIndex(imgIndex);

+                               // If the spine paths are different, then we 
may need to create
+                               // the new spine file. Nimas.
+                               if( (idd.getArchiver() instanceof 
NimasArchiver) )
+                                       if( oldPath.compareTo(newPath) != 0)
+ ((NimasArchiver)(idd.getArchiver())).wrtieToDisk( idd.getArchiver().getCurSpineIdx() );
+
                                // If the page needs to move/change, update.
                                // Otherwise, don't move the page yet.
-                               if(newPath != null && 
newPath.compareTo(curBrowserFilePath) != 0) {
+ if(newPath != null && newPath.replace(".xml", ".html").compareTo(curBrowserFilePath) != 0) {
                                        // Store path.
                                        curBrowserFilePath = newPath;
                                        // Update browser view.
@@ -640,19 +621,24 @@
                        // properly.
                        if(idd.getArchiver() instanceof NimasArchiver) {

-                               // Write the section to disc.
- ((NimasArchiver)(idd.getArchiver())).wrtieToDisk( idd.getArchiver().getCurSpineIdx() );
-
-                               // Create html version.
+                               // File handles to xml file and html file.
                                File xmlFile = new File(curBrowserFilePath);
File htmlFile = new File(curBrowserFilePath = curBrowserFilePath.replace(".xml", ".html"));
-                               try { FileUtils.copyFile( xmlFile, htmlFile ); }
-                               catch (IOException e) { e.printStackTrace(); }

- // Add this file path to our temp list so it will get deleted later.
-                               
idd.getArchiver().addTempFile(curBrowserFilePath);
-                       }
-               }
+                               // Create html version if it doesn't already 
exist.
+                               if(htmlFile.exists() == false) {
+                               // Write the section to disc.
+ ((NimasArchiver)(idd.getArchiver())).wrtieToDisk( idd.getArchiver().getCurSpineIdx() );
+                                       try { FileUtils.copyFile( xmlFile, 
htmlFile ); }
+                                       catch (IOException e) { 
e.printStackTrace(); }
+ // Add this file path to our temp list so it will get deleted later.
+                                       
idd.getArchiver().addTempFile(curBrowserFilePath);
+
+                               } // if(htmlFile.exists() == false)
+
+                       } // if(idd.getArchiver() instanceof NimasArchiver)
+
+               } // if(idd.getArchiver().getCurSpineFilePath() != null)


// Progress listener. Adds javascript code that will modify our img elements with
@@ -663,7 +649,7 @@
                        public void changed(ProgressEvent event) { }

                @Override
-                       public void completed(ProgressEvent event) {
+                       public void completed(ProgressEvent event)      {

                        // Refresh the view one time. This fixes
                        // an issue with certain documents
@@ -718,9 +704,10 @@

                // Get the index of the current element.
                String indexStr = Integer.toString( imgIdx );
-
+
                // Create script.
-               String s = "var allLinks = document.getElementsByTagName('img'); 
" +
+               String s =
+                               "var allLinks = 
document.getElementsByTagName('img'); " +
                 "elm = allLinks[" + indexStr + "];" +
                 "var x = elm.offsetLeft;" +
                 "var y = elm.offsetTop;" +

==============================================================================
Revision: 332ae8ad03a5
Branch:   default
Author:   cmyers@xxxxxxxxxxxxxxxxx
Date:     Tue Jul 29 20:13:42 2014 UTC
Log: Fixed ImgDesc bug related to per-page image counts. Bugfix - Creating premature nimas xml before needed when pressing next/prev. Bugfix - performance degradation upon clicking next/prev numerous times.
http://code.google.com/p/brailleblaster/source/detail?r=332ae8ad03a5



Other related posts:

  • » [brailleblaster] 3 new revisions pushed by RandomCh...@xxxxxxxxx on 2014-07-29 19:10 GMT - brailleblaster