equal
deleted
inserted
replaced
22 /* events */ |
22 /* events */ |
23 |
23 |
24 //{{{ |
24 //{{{ |
25 case object Global_Settings |
25 case object Global_Settings |
26 case object Caret_Focus |
26 case object Caret_Focus |
|
27 case class Raw_Edits(edits: List[Document.Edit_Text]) |
27 case class Commands_Changed( |
28 case class Commands_Changed( |
28 assignment: Boolean, nodes: Set[Document.Node.Name], commands: Set[Command]) |
29 assignment: Boolean, nodes: Set[Document.Node.Name], commands: Set[Command]) |
29 |
30 |
30 sealed abstract class Phase |
31 sealed abstract class Phase |
31 case object Inactive extends Phase |
32 case object Inactive extends Phase |
59 |
60 |
60 /* pervasive event buses */ |
61 /* pervasive event buses */ |
61 |
62 |
62 val global_settings = new Event_Bus[Session.Global_Settings.type] |
63 val global_settings = new Event_Bus[Session.Global_Settings.type] |
63 val caret_focus = new Event_Bus[Session.Caret_Focus.type] |
64 val caret_focus = new Event_Bus[Session.Caret_Focus.type] |
|
65 val raw_edits = new Event_Bus[Session.Raw_Edits] |
64 val commands_changed = new Event_Bus[Session.Commands_Changed] |
66 val commands_changed = new Event_Bus[Session.Commands_Changed] |
65 val phase_changed = new Event_Bus[Session.Phase] |
67 val phase_changed = new Event_Bus[Session.Phase] |
66 val syslog_messages = new Event_Bus[Isabelle_Process.Output] |
68 val syslog_messages = new Event_Bus[Isabelle_Process.Output] |
67 val raw_output_messages = new Event_Bus[Isabelle_Process.Output] |
69 val raw_output_messages = new Event_Bus[Isabelle_Process.Output] |
68 val all_messages = new Event_Bus[Isabelle_Process.Message] // potential bottle-neck |
70 val all_messages = new Event_Bus[Isabelle_Process.Message] // potential bottle-neck |
166 |
168 |
167 /* actor messages */ |
169 /* actor messages */ |
168 |
170 |
169 private case class Start(args: List[String]) |
171 private case class Start(args: List[String]) |
170 private case object Cancel_Execution |
172 private case object Cancel_Execution |
171 private case class Edit(edits: List[Document.Edit_Text]) |
|
172 private case class Change( |
173 private case class Change( |
173 doc_edits: List[Document.Edit_Command], |
174 doc_edits: List[Document.Edit_Command], |
174 previous: Document.Version, |
175 previous: Document.Version, |
175 version: Document.Version) |
176 version: Document.Version) |
176 private case class Messages(msgs: List[Isabelle_Process.Message]) |
177 private case class Messages(msgs: List[Isabelle_Process.Message]) |
389 reply(()) |
390 reply(()) |
390 |
391 |
391 case Cancel_Execution if prover.isDefined => |
392 case Cancel_Execution if prover.isDefined => |
392 prover.get.cancel_execution() |
393 prover.get.cancel_execution() |
393 |
394 |
394 case Edit(edits) if prover.isDefined => |
395 case raw @ Session.Raw_Edits(edits) if prover.isDefined => |
395 prover.get.discontinue_execution() |
396 prover.get.discontinue_execution() |
396 |
397 |
397 val previous = global_state().history.tip.version |
398 val previous = global_state().history.tip.version |
398 val version = Future.promise[Document.Version] |
399 val version = Future.promise[Document.Version] |
399 val change = global_state >>> (_.continue_history(previous, edits, version)) |
400 val change = global_state >>> (_.continue_history(previous, edits, version)) |
|
401 raw_edits.event(raw) |
400 change_parser ! Text_Edits(previous, edits, version) |
402 change_parser ! Text_Edits(previous, edits, version) |
401 |
403 |
402 reply(()) |
404 reply(()) |
403 |
405 |
404 case Messages(msgs) => |
406 case Messages(msgs) => |
433 def stop() { commands_changed_buffer !? Stop; change_parser !? Stop; session_actor !? Stop } |
435 def stop() { commands_changed_buffer !? Stop; change_parser !? Stop; session_actor !? Stop } |
434 |
436 |
435 def cancel_execution() { session_actor ! Cancel_Execution } |
437 def cancel_execution() { session_actor ! Cancel_Execution } |
436 |
438 |
437 def edit(edits: List[Document.Edit_Text]) |
439 def edit(edits: List[Document.Edit_Text]) |
438 { session_actor !? Edit(edits) } |
440 { session_actor !? Session.Raw_Edits(edits) } |
439 |
441 |
440 def init_node(name: Document.Node.Name, |
442 def init_node(name: Document.Node.Name, |
441 header: Document.Node.Header, perspective: Text.Perspective, text: String) |
443 header: Document.Node.Header, perspective: Text.Perspective, text: String) |
442 { |
444 { |
443 edit(List(header_edit(name, header), |
445 edit(List(header_edit(name, header), |