Hello, I made some progresses on displaying and editing. The patch is attached. To see clearly what changes are made, use diff tools like KDiff, which can ignore indentation and white-spaces. I didn't check the email John sent several days ago about revised framework while I was working on this patch, but our aims are basically the same. I will modify the patch to adjust to John's new framework, but meanwhile, I'd like to share my current progress with you. Here are some important details about this update: 1. Now when BB opens an XML (through File-> open or File-> Recent Document), it tries to add styling in the daisy view. Opening file is still handled in a different thread to maintain the best user experience, though a short period of sluggishness, around 5 second to 15 seconds, is observed when opening a file. Most parts of this delay are caused by XOM builder parsing the document, which was already there before this patch and I couldn't find a way to improve its performance yet. The styling part's performance should be good enough, though I haven't test it with really large documents. *To-do: According to John, BB should translate the document right after (or even simultaneously) the document is opened. 2. The initial styling is done in the following steps: i. According to the name of the root element of an XML file, the semantic file with the name [root element]_sem.properties in dist/programData/semantics/ will be used. Semantic files decides what style should be added to an element. Inside each file, it contains key-value pair as the key is the element name and the value is the style should be added to this element. *To-do : -configuration file was not implemented in this patch yet. -Xpath expressions were not supported yet. -I saw the discussion in the list about what kind of files should be used to carry this information. In my opinion, properties files are simpler to be handled in Java and easier to be viewed and modified than other formats, whereas XMLs could potentially be more powerful and hence complicated. I think XMLs can be used when BB gets more developed. For now properties files are good enough for containing information, and we can focus on more important tasks at hand. ii. The information of a style is stored in dist/prgramData/styles/[stylename]. properties or in user's local BB folder. iii. The document is partitioned during opening. Each partition represents a element in XML. It also contains information about its styling. Each partition is an object of class MyStyleRange. I think this is what was referred to as "block" by John. No change that takes place in more than one block can be done. iv. Now only three of the style properties are supported, they are lines after, lines before and first line indentation. Lines after defines how many new line characters should be inserted after an element. One cannot navigate through or edit these new line characters, but only though Edit-> Style Panel and then apply a style with different number of lines after. Lines before is basically the same, except that they are inserted before an element. First line indentation is self-evident. *To-do : Support other styling properties 3. As caret moves, the status bar shows some basic information about the block where the caret is at. Also if the style panel is opened when caret moves, its combo value automatically changes to what It also updates when a style is applied, an element is inserted or an element is deleted. 4. I didn't come up with a more convenient way to insert or delete a block, now a block can be deleted if its lines before and after are both 0, and all of its content is removed. An element can be inserted only between two elements by entering "Enter"/ "Carriage Return". When an element is inserted, the Enter itself won't insert a newline character like it used to do. The new inserted element is named "newElement" for now, and is not associated with any styles. *To-do: -Support changing element names -Better mechanism to delete elements and to insert elements precisely *Some known issues: -If there are elements with more than one Text child, it may mistakenly save the content to different element when inserting new nodes to such element. -After inserting a new element after a element whose line after range has a length of 0, the following input are considered new content for the previous element instead of the new one. I'm also attaching an XML that Vic used to send to the list. It could help testing the new features. Hi Vic, I hope it is okay that I am sending this to the list again. Best Regards, Hanxiao
<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="dtbookbasic.css" type="text/css"?><!DOCTYPE dtbook PUBLIC '-//NISO//DTD dtbook 2005-3//EN' 'http://www.daisy.org/z3986/2005/dtbook-2005-3.dtd' > <dtbook xmlns="http://www.daisy.org/z3986/2005/dtbook/"; version="2005-3" xml:lang="en-US" ><head><meta name="dtb:uid" content="AUTO-UID-5438739213267385981" /><meta name="dt:version" content="2.1.1.0" /><meta name="dc:Title" content="wickedness" /><meta name="dc:Creator" content="Victor L. Beckley Jr." /><meta name="dc:Date" content="2012-01-16" /><meta name="dc:Identifier" content="AUTO-UID-5438739213267385981" /><meta name="dc:Language" content="en-US" /></head><book showin="blp"><frontmatter><doctitle>wickedness</doctitle><docauthor>Victor L. Beckley Jr.</docauthor></frontmatter><bodymatter id="bodymatter_0001"><level1><pagenum page="normal" id="page1">1</pagenum><list type="ol"><li><p><strong><em>B.</em></strong><strong><em> </em></strong><strong><em>Why</em></strong><strong><em> </em></strong><strong><em>wickedness</em></strong><strong><em> </em></strong><strong><em>permitted</em></strong></p></li><li><p>Devil challenged loyalty of creatures to God. Job 1:11,12</p></li><li><p>Faithful given opportunity to prove loyal. Ro 9:17; Pr 27:11</p></li><li><p>Devil proved a liar, issue to be settled. Joh 12:31</p></li><li><p>Faithful rewarded with everlasting life. Ro 2:6,7; Re 21:3-5</p></li></list><p></p></level1></bodymatter></book></dtbook>