[dasher: 173/217] Changes in control.*.xml file structure.



commit 1666ae03502df322291fe6662e1a6eee53e217ee
Author: Ada Majorek <amajorek google com>
Date:   Wed Jan 13 13:07:57 2016 -0800

    Changes in control.*.xml file structure.

 Data/control/control.411.xml             |    4 +-
 Data/control/control.all.xml             |   92 ++++++++++++++++++++----------
 Data/control/control.dtd                 |   11 ++--
 Data/control/control.edit.xml            |    7 ++-
 Data/control/control.prepared_speech.xml |   85 +++++++++++----------------
 Data/control/control.speak.xml           |   91 +++++++++++++++--------------
 Src/DasherCore/ControlManager.cpp        |    6 +-
 7 files changed, 159 insertions(+), 137 deletions(-)
---
diff --git a/Data/control/control.411.xml b/Data/control/control.411.xml
index 982fab4..9cda07c 100644
--- a/Data/control/control.411.xml
+++ b/Data/control/control.411.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE control SYSTEM "control.dtd">
 
-<nodes>
+<control name="Dasher 4.11">
   <alph/>
   
   <node label="Stop" color="242">
@@ -182,4 +182,4 @@
     </node>
   </node>
   
-</nodes>
+</control>
diff --git a/Data/control/control.all.xml b/Data/control/control.all.xml
index c4b64b5..c1214ec 100644
--- a/Data/control/control.all.xml
+++ b/Data/control/control.all.xml
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<nodes>
+<!DOCTYPE control SYSTEM "control.dtd">
+<control name="All Available Commands">
   <alph/>
+  
   <node label="&#9209;" color="242">
     <stop/>
     <alph/>
@@ -211,9 +213,51 @@
     </node>
   </node>
 
-  <node  name="CTL_SPEAK" label="&#128483;" color="241">
-    <alph/>
+  <node  name="CTL_COPY" label="&#128203;" color="-1">
+
+    <node label="&#128464;" color="-1">
+      <copy what="all"/>
+      <alph/>
+      <root/>
+    </node>
+    <node label="&#127381;" color="-1">
+      <copy what="new"/>
+      <alph/>
+      <root/>
+    </node>
+    <node label="&#128259;" color="-1">
+      <copy what="repeat"/>
+      <alph/>
+      <root/>
+    </node>
+    <node label="&#128463;" color="-1">
+      <copy what="page"/>
+      <alph/>
+      <root/>
+    </node>
+    <node label="&#182;" color="-1">
+      <copy what="paragraph"/>
+      <alph/>
+      <root/>
+    </node>
+    <node label=".&#8265;" color="-1">
+      <copy what="sentence"/>
+      <alph/>
+      <root/>
+    </node>
+    <node label="&#9473;" color="-1">
+      <copy what="line"/>
+      <alph/>
+      <root/>
+    </node>
+    <node label="&#11052;" color="-1">
+      <copy what="word"/>
+      <alph/>
+      <root/>
+    </node>
+  </node>
 
+  <node  name="CTL_SPEAK" label="&#128483;" color="241">
     <node label="&#128464;" color="-1">
       <speak what="all"/>
       <ref name="CTL_SPEAK"/>
@@ -322,49 +366,35 @@
     </node>
   </node>
 
-  <node  name="CTL_COPY" label="&#128203;" color="-1">
-
-    <node label="&#128464;" color="-1">
-      <copy what="all"/>
-      <alph/>
-      <root/>
-    </node>
-    <node label="&#127381;" color="-1">
-      <copy what="new"/>
-      <alph/>
-      <root/>
-    </node>
-    <node label="&#128259;" color="-1">
-      <copy what="repeat"/>
+  <alph/>
+  
+  <!--
+  <node label="utf symbols" color="241">
+    <node label="&#128263;&#128172;&#128266;&#128265;&#128264;&#8635;&#9477;&#9473;&#9549;&#11097;&#8265;" 
color="242">
       <alph/>
       <root/>
     </node>
-    <node label="&#128463;" color="-1">
-      <copy what="page"/>
+    <node label="&#9114;&#9112;&#9111;&#9100;&#9086;&#9003;    &#8999;&#8998;&#128711;&#8210;&#10683;" 
color="242">
       <alph/>
       <root/>
     </node>
-    <node label="&#182;" color="-1">
-      <copy what="paragraph"/>
+    <node label="&#128483;&#128471;&#128470;&#128469;&#128276;&#128259;&#128257;&#128227;&#128463;&#128464;" 
color="242">
       <alph/>
       <root/>
     </node>
-    <node label=".&#8265;" color="-1">
-      <copy what="sentence"/>
+    <node label="&#128203;&#128193;&#128190;&#10008;&#9986;&#9888;&#9776;&#9477;&#11052;&#9679;&#8226;" 
color="242">
       <alph/>
       <root/>
     </node>
-    <node label="&#9473;" color="-1">
-      <copy what="line"/>
+       <node label="&#128203;&#128193;&#128190;&#10008;&#9986;&#9888;&#9776;&#9477;&#11052;&#9679;&#8226;" 
color="242">
       <alph/>
-      <root/>
-    </node>
-    <node label="&#11052;" color="-1">
-      <copy what="word"/>
+         <root/>
+       </node>
+    <node label="&#8678;&#128712;&#128479;&#10561;&#10227;&#8680;&#8596;&#127381;" color="242">
       <alph/>
       <root/>
     </node>
   </node>
-
-</nodes>
+  -->
+</control>
 
diff --git a/Data/control/control.dtd b/Data/control/control.dtd
index f938a43..5458f93 100644
--- a/Data/control/control.dtd
+++ b/Data/control/control.dtd
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!ELEMENT nodes (node*)>
+<!ELEMENT control ((node|alph)*)>
+<!ATTLIST control name CDATA #REQUIRED>
 
 <!ELEMENT node ((node|move|delete|copy|speak|pause|stop|ref|root|alph)*)>
 <!--by specifying the name attribute as type ID rather than CDATA, the XML
@@ -10,17 +11,17 @@
 
 <!ELEMENT move EMPTY>
 <!ATTLIST move forward (yes|no) #REQUIRED>
-<!ATTLIST move dist (char|word|line|sentence|paragraph|all) #REQUIRED>
+<!ATTLIST move dist (char|word|line|sentence|paragraph|page|all) #REQUIRED>
 
 <!ELEMENT delete EMPTY>
 <!ATTLIST delete forward (yes|no) #REQUIRED>
-<!ATTLIST delete dist (char|word|line|sentence|paragraph|all) #REQUIRED>
+<!ATTLIST delete dist (char|word|line|sentence|paragraph|page|all) #REQUIRED>
 
 <!ELEMENT copy EMPTY>
-<!ATTLIST copy dist (all|new|repeat|sentence|paragraph) #REQUIRED>
+<!ATTLIST copy what (new|repeat|word|line|sentence|paragraph|page|all) #REQUIRED>
 
 <!ELEMENT speak EMPTY>
-<!ATTLIST speak what (cancel|all|new|repeat|sentence|paragraph) #REQUIRED>
+<!ATTLIST speak what (cancel|new|repeat|word|line|sentence|paragraph|page|all) #REQUIRED>
 
 <!ELEMENT pause EMPTY>
 
diff --git a/Data/control/control.edit.xml b/Data/control/control.edit.xml
index 4eddd90..3e3ba32 100644
--- a/Data/control/control.edit.xml
+++ b/Data/control/control.edit.xml
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<nodes>
+<!DOCTYPE control SYSTEM "control.dtd">
+<control name="Edit Larger Document">
   <alph/>
+  
   <node label="&#9209;" color="242">
     <stop/>
     <alph/>
@@ -226,5 +228,6 @@
     </node>
   </node>
 
-</nodes>
+  <alph/>
+</control>
 
diff --git a/Data/control/control.prepared_speech.xml b/Data/control/control.prepared_speech.xml
index f2f3757..2297c07 100644
--- a/Data/control/control.prepared_speech.xml
+++ b/Data/control/control.prepared_speech.xml
@@ -1,59 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<nodes>
-  
-  <node  name="CTL_SPEAK" label="&#128483;" color="241">
-    <alph/>
-
-    <node label="&#182;" color="-1">
-      <speak what="paragraph"/>
-      <ref name="CTL_SPEAK"/>
-      <node label="&#8680;&#182;" color="-1">
-        <move forward="yes" dist="paragraph"/>
-        <ref name="CTL_SPEAK"/>
-        <root/>
-      </node>
-    </node>
-    <node label=".&#8265;" color="-1">
-      <speak what="sentence"/>
-      <ref name="CTL_SPEAK"/>
-      <node label="&#8680;.&#8265;" color="-1">
-        <move forward="yes" dist="sentence"/>
-        <ref name="CTL_SPEAK"/>
-        <root/>
-      </node>
-    </node>
-
-    <node label="&#128259;" color="241">
-      <speak what="repeat"/>
-      <ref name="CTL_SPEAK"/>
-      <root/>
-    </node>
-    <node label="&#128711;" color="241">
-      <speak what="cancel"/>
-      <ref name="CTL_SPEAK"/>
-      <root/>
-    </node>
-  </node>
+<!DOCTYPE control SYSTEM "control.dtd">
+<control name="Speak From Prepared Document">
 
   <node name="CTL_MOVE" label="&#10018;" color="-1">
+    
     <node name="CTL_MOVE_BACKWARD" label="&#8678;" color="-1">
       <node label="&#128464;" color="-1">
         <move forward="no" dist="all"/>
+        <ref name="CTL_MOVE"/>
         <ref name="CTL_SPEAK"/>
-        <ref name="CTL_MOVE_BACKWARD"/>
-        <ref name="CTL_MOVE_FORWARD"/>
       </node>
       <node label="&#182;" color="-1">
         <move forward="no" dist="paragraph"/>
+        <ref name="CTL_MOVE"/>
         <ref name="CTL_SPEAK"/>
-        <ref name="CTL_MOVE_BACKWARD"/>
-        <ref name="CTL_MOVE_FORWARD"/>
       </node>
       <node label=".&#8265;" color="-1">
         <move forward="no" dist="sentence"/>
+        <ref name="CTL_MOVE"/>
         <ref name="CTL_SPEAK"/>
-        <ref name="CTL_MOVE_BACKWARD"/>
-        <ref name="CTL_MOVE_FORWARD"/>
       </node>
     </node>
 
@@ -61,26 +26,46 @@
 
       <node label=".&#8265;" color="-1">
         <move forward="yes" dist="sentence"/>
+        <ref name="CTL_MOVE"/>
         <ref name="CTL_SPEAK"/>
-        <ref name="CTL_MOVE_BACKWARD"/>
-        <ref name="CTL_MOVE_FORWARD"/>
       </node>
       <node label="&#182;" color="-1">
         <move forward="yes" dist="paragraph"/>
+        <ref name="CTL_MOVE"/>
         <ref name="CTL_SPEAK"/>
-        <ref name="CTL_MOVE_BACKWARD"/>
-        <ref name="CTL_MOVE_FORWARD"/>
       </node>
       <node label="&#128464;" color="-1">
         <move forward="yes" dist="all"/>
+        <ref name="CTL_MOVE"/>
         <ref name="CTL_SPEAK"/>
-        <ref name="CTL_MOVE_BACKWARD"/>
-        <ref name="CTL_MOVE_FORWARD"/>
       </node>
     </node>
+  </node>
 
-    
+  <node  name="CTL_SPEAK" label="&#128483;" color="241">
+
+    <node label="&#182;" color="-1">
+      <speak what="paragraph"/>
+      <move forward="yes" dist="paragraph"/>
+      <ref name="CTL_MOVE"/>
+      <ref name="CTL_SPEAK"/>
+    </node>
+    <node label=".&#8265;" color="-1">
+      <speak what="sentence"/>
+      <move forward="yes" dist="sentence"/>
+      <ref name="CTL_MOVE"/>
+      <ref name="CTL_SPEAK"/>
+    </node>
+    <node label="&#128259;" color="241">
+      <speak what="repeat"/>
+      <ref name="CTL_MOVE"/>
+      <ref name="CTL_SPEAK"/>
+    </node>
+    <node label="&#128711;" color="241">
+      <speak what="cancel"/>
+      <ref name="CTL_MOVE"/>
+      <ref name="CTL_SPEAK"/>
+    </node>
   </node>
-  
-</nodes>
+</control>
 
diff --git a/Data/control/control.speak.xml b/Data/control/control.speak.xml
index 651b6a8..c103843 100644
--- a/Data/control/control.speak.xml
+++ b/Data/control/control.speak.xml
@@ -1,49 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<nodes>
+<!DOCTYPE control SYSTEM "control.dtd">
+<control name="Conversation">
   
-  <node  name="CTL_SPEAK" label="&#128483;" color="241">
-    <alph/>
-
-    <node label="&#128464;" color="-1">
-      <speak what="all"/>
-      <ref name="CTL_SPEAK"/>
-      <node label="&#8999;&#128464;" color="242">
-        <delete forward="yes" dist="all"/>
-        <delete forward="no" dist="all"/>
-        <alph/>
-        <root/>
-      </node>
-      <root/>
-    </node>
-    <node label="&#182;" color="-1">
-      <speak what="paragraph"/>
-      <ref name="CTL_SPEAK"/>
-      <node label="&#8999;&#182;" color="242">
-        <move forward="yes" dist="paragraph"/>
-        <delete forward="no" dist="paragraph"/>
-        <move forward="no" dist="char"/>
-        <alph/>
-        <root/>
-      </node>
-      <node label="&#8680;&#182;" color="-1">
-        <move forward="yes" dist="paragraph"/>
-        <ref name="CTL_SPEAK"/>
-        <root/>
-      </node>
-    </node>
-    <node label="&#128259;" color="241">
-      <speak what="repeat"/>
-      <alph/>
-      <root/>
-    </node>
-      <node label="&#128711;" color="241">
-      <speak what="cancel"/>
-      <alph/>
-      <root/>
-    </node>
-  </node>
 
   <node name="CTL_MOVE" label="&#10018;" color="-1">
+    <alph/>
     <node name="CTL_MOVE_BACKWARD" label="&#8678;" color="-1">
       <node label="&#128464;" color="-1">
         <move forward="no" dist="all"/>
@@ -113,8 +74,8 @@
 
     
   </node>
-  
   <node name="CTL_DELETE" label="&#10683;" color="-1">
+    <alph/>
     <node name="CTL_DELETE_BACKWARD" label="&#9003;" color="-1">
       <node label="&#128464;" color="-1">
         <delete forward="no" dist="all"/>
@@ -193,5 +154,47 @@
     </node>
   </node>
 
-</nodes>
+  <node  name="CTL_SPEAK" label="&#128483;" color="241">
+
+    <node label="&#128464;" color="-1">
+      <speak what="all"/>
+      <ref name="CTL_SPEAK"/>
+      <node label="&#8999;&#128464;" color="242">
+        <delete forward="yes" dist="all"/>
+        <delete forward="no" dist="all"/>
+        <alph/>
+        <root/>
+      </node>
+      <root/>
+    </node>
+    <node label="&#182;" color="-1">
+      <speak what="paragraph"/>
+      <ref name="CTL_SPEAK"/>
+      <node label="&#8999;&#182;" color="242">
+        <move forward="yes" dist="paragraph"/>
+        <delete forward="no" dist="paragraph"/>
+        <move forward="no" dist="char"/>
+        <alph/>
+        <root/>
+      </node>
+      <node label="&#8680;&#182;" color="-1">
+        <move forward="yes" dist="paragraph"/>
+        <ref name="CTL_SPEAK"/>
+        <root/>
+      </node>
+    </node>
+    <node label="&#128259;" color="241">
+      <speak what="repeat"/>
+      <alph/>
+      <root/>
+    </node>
+    <node label="&#128711;" color="241">
+      <speak what="cancel"/>
+      <alph/>
+      <root/>
+    </node>
+    <alph/>
+  </node>
+
+</control>
 
diff --git a/Src/DasherCore/ControlManager.cpp b/Src/DasherCore/ControlManager.cpp
index 42a5099..166a2d4 100644
--- a/Src/DasherCore/ControlManager.cpp
+++ b/Src/DasherCore/ControlManager.cpp
@@ -193,7 +193,7 @@ bool CControlParser::ParseFile(const string &strFileName, bool bUser) {
 }
 
 void CControlParser::XmlStartHandler(const XML_Char *name, const XML_Char **atts) {
-  vector<CControlBase::NodeTemplate *> &parent(nodeStack.empty() ? m_vParsed : nodeStack.back()->successors);
+  auto& parent(nodeStack.empty() ? m_vParsed : nodeStack.back()->successors);
   if (strcmp(name,"node")==0) {
     string label,nodeName; int color=-1;
     while (*atts) {
@@ -219,7 +219,7 @@ void CControlParser::XmlStartHandler(const XML_Char *name, const XML_Char **atts
         target=*(atts+1);
       atts+=2;
     }
-    map<string,CControlBase::NodeTemplate*>::iterator it=namedNodes.find(target);
+    auto it=namedNodes.find(target);
     if (it!=namedNodes.end())
       parent.push_back(it->second);
     else {
@@ -505,7 +505,7 @@ bool CControlBoxIO::ParseFile(const std::string &strFilename, bool bUser) {
 }
 
 void CControlBoxIO::XmlStartHandler(const XML_Char *name, const XML_Char **atts) {
-  if (strcmp(name, "nodes") == 0) {
+  if (strcmp(name, "control") == 0) {
     string id;
     while (*atts != 0) {
       if (strcmp(*atts, "name") == 0) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]