[brailleblaster] [brailleblaster.newdesign] push by john.bo...@xxxxxxxxxxxxxxxxx - work on Styles class on 2013-01-15 12:41 GMT

  • From: brailleblaster@xxxxxxxxxxxxxx
  • To: brailleblaster@xxxxxxxxxxxxx
  • Date: Tue, 15 Jan 2013 12:42:08 +0000

Revision: 6e14c767f81d
Branch:   default
Author:   John Boyer <john.boyer@xxxxxxxxxxxxxxxxx>
Date:     Tue Jan 15 04:41:13 2013
Log:      work on Styles class
http://code.google.com/p/brailleblaster/source/detail?r=6e14c767f81d&repo=newdesign

Modified:
 /src/main/org/brailleblaster/document/Semantics.java
 /src/main/org/brailleblaster/document/Styles.java

=======================================
--- /src/main/org/brailleblaster/document/Semantics.java Sun Jan 13 22:03:03 2013 +++ /src/main/org/brailleblaster/document/Semantics.java Tue Jan 15 04:41:13 2013
@@ -139,8 +139,11 @@
  * being processed is read and each line is used to create an entry in
  * this table.
  */
-SemanticEntry[] semanticsTable = new SemanticEntry[100];
+static SemanticEntry[] semanticsTable = new SemanticEntry[100];
 int semanticsCount = 0; // Number of entries in semanticsTable
+static SemanticEntry getSemanticEntry (int index) {
+return semanticsTable[index];
+}

 /**
  * The semanticsLookup hash table has literal markup  in the
=======================================
--- /src/main/org/brailleblaster/document/Styles.java Wed Jan 9 23:35:09 2013 +++ /src/main/org/brailleblaster/document/Styles.java Tue Jan 15 04:41:13 2013
@@ -32,6 +32,7 @@
 package org.brailleblaster.document;

 import java.util.Properties;
+import java.util.Hashtable;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import nu.xom.Element;
@@ -56,6 +57,10 @@
  */
 class Styles {

+Styles() {
+makeStyleTable();
+}
+
 FileUtils fu = new FileUtils();
 String fileSep = BBIni.getFileSep();

@@ -118,9 +123,14 @@
   int firstLineIndent = 0;
   StyleFormat format = StyleFormat.leftJustified;
 }
+
+private Hashtable<String, StyleType> stuleTable = new Hashtable<String,
+StyleType>();
+void makeStyleTable() {
+}

 /**
- * This methods writes the style as a properties file on
+ * This method writes the style as a properties file on
  * userProgramDataPath/styles.
  */
 void writeStyle (StyleType st) {
@@ -197,6 +207,7 @@
 private class StyleRecord {
   StyleType style;
   StyleStatus status;
+  int depth;
   StyleFormat curStyleFormat;
   Element curElement;
   int curLeftMargin;
@@ -207,7 +218,7 @@
 /**
  * Index of the top item on the style stack.
  */
-private int styleTop;
+private int styleTop = -1;

 /**
  * The stack array is managed as a fifo stack to handle nested styles.
@@ -218,17 +229,35 @@
  * endStyle.
  */
 private StyleRecord[] stack = new StyleRecord[20];
+
+/**
+ * Display a set of radio buttons with style names. Teturn the name of
+ * the selected style.
+ */
+String pickStyle () {
+return null;
+}

 /**
  * Begins the processing of a style and places a strylRecord on the top
  * of the stack. If the element does not have a style it returns false.
  */
-boolean startStyle (Element element) {
+boolean startStyle (Semantics.ElementSemantics es) {
+  Semantics.SemanticEntry se = Semantics.getSemanticEntry
+  (es.semanticsIndex);
+  if (!se.operation.equals ("style")) {
+  return false;
+  }
+  styleTop++;
+  StyleRecord sr = stack[styleTop];
+  sr.depth = es.depth;
+
   return true;
 }

 /**
- * Completes the processing of the styleRecord on the top of the stack
+ * Completes the processing of the styleRecord on the top of the w
+ stack
  * and pops it.
  */
 void endStyle () {

Other related posts: