139 } |
139 } |
140 |
140 |
141 |
141 |
142 /* document changes */ |
142 /* document changes */ |
143 |
143 |
144 def handle_change(change: Change) { |
144 def begin_document(path: String) { |
145 val old = document(change.parent.get.id).get |
|
146 val (doc, structure_change) = old.text_changed(change) |
|
147 document_versions ::= doc |
|
148 edit_document(old, doc, structure_change) |
|
149 document_change.event(doc) |
|
150 } |
|
151 |
|
152 def set_document(path: String) { |
|
153 process.begin_document(document_0.id, path) |
145 process.begin_document(document_0.id, path) |
154 } |
146 } |
155 |
147 |
156 private def edit_document(old: ProofDocument, doc: ProofDocument, |
148 def handle_change(change: Change) { |
157 changes: ProofDocument.StructureChange) = |
149 val old = document(change.parent.get.id).get |
158 { |
150 val (doc, changes) = old.text_changed(change) |
|
151 document_versions ::= doc |
|
152 |
159 val id_changes = changes map { case (c1, c2) => |
153 val id_changes = changes map { case (c1, c2) => |
160 (c1.map(_.id).getOrElse(document_0.id), |
154 (c1.map(_.id).getOrElse(document_0.id), |
161 c2 match { |
155 c2 match { |
162 case None => None |
156 case None => None |
163 case Some(command) => |
157 case Some(command) => |