author | wenzelm |
Fri, 09 Aug 2013 12:25:24 +0200 | |
changeset 52932 | eb7d7c0034b5 |
parent 52860 | f155c38242c1 |
child 52973 | d5f7fa1498b7 |
permissions | -rw-r--r-- |
50299 | 1 |
/* Title: Tools/jEdit/src/theories_dockable.scala |
39515 | 2 |
Author: Makarius |
3 |
||
50299 | 4 |
Dockable window for theories managed by prover. |
39515 | 5 |
*/ |
6 |
||
7 |
package isabelle.jedit |
|
8 |
||
9 |
||
10 |
import isabelle._ |
|
11 |
||
12 |
import scala.actors.Actor._ |
|
52807
b859a180936b
simplified flag for continuous checking: avoid GUI complexity and slow checking of all theories (including prints);
wenzelm
parents:
52802
diff
changeset
|
13 |
import scala.swing.{FlowPanel, Button, TextArea, Label, ListView, Alignment, |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
14 |
ScrollPane, Component, CheckBox, BorderPanel} |
52817 | 15 |
import scala.swing.event.{ButtonClicked, MouseClicked, MouseMoved} |
39593 | 16 |
|
43520
cec9b95fa35d
explicit import java.lang.System to prevent odd scope problems;
wenzelm
parents:
43282
diff
changeset
|
17 |
import java.lang.System |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
18 |
import java.awt.{BorderLayout, Graphics2D, Insets, Point, Dimension} |
47588 | 19 |
import javax.swing.{JList, BorderFactory} |
52802 | 20 |
import javax.swing.border.{BevelBorder, SoftBevelBorder} |
39515 | 21 |
|
44865 | 22 |
import org.gjt.sp.jedit.{View, jEdit} |
39515 | 23 |
|
24 |
||
50299 | 25 |
class Theories_Dockable(view: View, position: String) extends Dockable(view, position) |
39515 | 26 |
{ |
48021
d899be1cfe6d
separate syslog dockable -- discontinued tendency of sub-window management via tabs;
wenzelm
parents:
48018
diff
changeset
|
27 |
/* status */ |
39591 | 28 |
|
48021
d899be1cfe6d
separate syslog dockable -- discontinued tendency of sub-window management via tabs;
wenzelm
parents:
48018
diff
changeset
|
29 |
private val status = new ListView(Nil: List[Document.Node.Name]) { |
44991 | 30 |
listenTo(mouse.clicks) |
52817 | 31 |
listenTo(mouse.moves) |
44991 | 32 |
reactions += { |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
33 |
case MouseClicked(_, point, _, clicks, _) => |
44991 | 34 |
val index = peer.locationToIndex(point) |
52817 | 35 |
if (index >= 0) { |
36 |
if (in_checkbox(peer.indexToLocation(index), point)) { |
|
37 |
if (clicks == 1) { |
|
38 |
for { |
|
39 |
buffer <- JEdit_Lib.jedit_buffer(listData(index).node) |
|
40 |
model <- PIDE.document_model(buffer) |
|
41 |
} model.node_required = !model.node_required |
|
42 |
} |
|
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
43 |
} |
52817 | 44 |
else if (clicks == 2) Hyperlink(listData(index).node).follow(view) |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
45 |
} |
52817 | 46 |
case MouseMoved(_, point, _) => |
47 |
val index = peer.locationToIndex(point) |
|
48 |
if (index >= 0 && in_checkbox(peer.indexToLocation(index), point)) |
|
49 |
tooltip = "Mark as required for continuous checking" |
|
50 |
else |
|
51 |
tooltip = null |
|
44991 | 52 |
} |
53 |
} |
|
50250 | 54 |
status.peer.setLayoutOrientation(JList.HORIZONTAL_WRAP) |
55 |
status.peer.setVisibleRowCount(0) |
|
44609 | 56 |
status.selection.intervalMode = ListView.IntervalMode.Single |
57 |
||
49038 | 58 |
set_content(new ScrollPane(status)) |
39515 | 59 |
|
60 |
||
39593 | 61 |
/* controls */ |
62 |
||
50299 | 63 |
def phase_text(phase: Session.Phase): String = |
64 |
"Prover: " + Library.lowercase(phase.toString) |
|
65 |
||
66 |
private val session_phase = new Label(phase_text(PIDE.session.phase)) |
|
39697 | 67 |
session_phase.border = new SoftBevelBorder(BevelBorder.LOWERED) |
50299 | 68 |
session_phase.tooltip = "Status of prover session" |
39635 | 69 |
|
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
70 |
private def handle_phase(phase: Session.Phase) |
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
71 |
{ |
50299 | 72 |
Swing_Thread.later { session_phase.text = " " + phase_text(phase) + " " } |
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
73 |
} |
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
74 |
|
52807
b859a180936b
simplified flag for continuous checking: avoid GUI complexity and slow checking of all theories (including prints);
wenzelm
parents:
52802
diff
changeset
|
75 |
private val continuous_checking = new CheckBox("Continuous checking") { |
b859a180936b
simplified flag for continuous checking: avoid GUI complexity and slow checking of all theories (including prints);
wenzelm
parents:
52802
diff
changeset
|
76 |
tooltip = "Continuous checking of proof document (visible and required parts)" |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
77 |
reactions += { case ButtonClicked(_) => Isabelle.continuous_checking = selected } |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
78 |
def load() { selected = Isabelle.continuous_checking } |
52763 | 79 |
load() |
44776
47e8c8daccae
added "check" button: adhoc change to full buffer perspective;
wenzelm
parents:
44775
diff
changeset
|
80 |
} |
47e8c8daccae
added "check" button: adhoc change to full buffer perspective;
wenzelm
parents:
44775
diff
changeset
|
81 |
|
49246 | 82 |
private val logic = Isabelle_Logic.logic_selector(true) |
39702 | 83 |
|
44775
27930cf6f0f7
added "cancel" button based on cancel_execution, not interrupt (cf. 156be0e43336);
wenzelm
parents:
44734
diff
changeset
|
84 |
private val controls = |
52807
b859a180936b
simplified flag for continuous checking: avoid GUI complexity and slow checking of all theories (including prints);
wenzelm
parents:
52802
diff
changeset
|
85 |
new FlowPanel(FlowPanel.Alignment.Right)(continuous_checking, session_phase, logic) |
39593 | 86 |
add(controls.peer, BorderLayout.NORTH) |
87 |
||
88 |
||
44609 | 89 |
/* component state -- owned by Swing thread */ |
90 |
||
45709
87017fcbad83
clarified modules (again) -- NB: both Document and Protocol are specific to this particular prover;
wenzelm
parents:
45672
diff
changeset
|
91 |
private var nodes_status: Map[Document.Node.Name, Protocol.Node_Status] = Map.empty |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
92 |
private var nodes_required: Set[Document.Node.Name] = Set.empty |
44866 | 93 |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
94 |
private def update_nodes_required() |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
95 |
{ |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
96 |
nodes_required = Set.empty |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
97 |
for { |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
98 |
buffer <- JEdit_Lib.jedit_buffers |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
99 |
model <- PIDE.document_model(buffer) |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
100 |
if model.node_required |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
101 |
} nodes_required += model.name |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
102 |
} |
52860
f155c38242c1
initial update of nodes_required, for proper GUI state;
wenzelm
parents:
52819
diff
changeset
|
103 |
update_nodes_required() |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
104 |
|
52817 | 105 |
private def in_checkbox(loc0: Point, p: Point): Boolean = |
106 |
Node_Renderer_Component != null && |
|
107 |
(Node_Renderer_Component.checkbox_geometry match { |
|
108 |
case Some((loc, size)) => |
|
109 |
loc0.x + loc.x <= p.x && p.x < loc0.x + size.width && |
|
110 |
loc0.y + loc.y <= p.y && p.y < loc0.y + size.height |
|
111 |
case None => false |
|
112 |
}) |
|
113 |
||
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
114 |
private object Node_Renderer_Component extends BorderPanel |
44866 | 115 |
{ |
44990 | 116 |
opaque = false |
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
117 |
|
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
118 |
var node_name = Document.Node.Name.empty |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
119 |
|
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
120 |
var checkbox_geometry: Option[(Point, Dimension)] = None |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
121 |
val checkbox = new CheckBox { |
52819 | 122 |
opaque = false |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
123 |
override def paintComponent(gfx: Graphics2D) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
124 |
{ |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
125 |
super.paintComponent(gfx) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
126 |
if (location != null && size != null) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
127 |
checkbox_geometry = Some((location, size)) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
128 |
} |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
129 |
} |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
130 |
|
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
131 |
val label = new Label { |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
132 |
opaque = false |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
133 |
xAlignment = Alignment.Leading |
52809
e750169a5884
paint unassigned/unchanged nodes as unprocessed -- relevant for editor_continuous_checking = false;
wenzelm
parents:
52807
diff
changeset
|
134 |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
135 |
override def paintComponent(gfx: Graphics2D) |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
136 |
{ |
52819 | 137 |
border = BorderFactory.createEmptyBorder(2, 2, 2, 2) |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
138 |
val size = peer.getSize() |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
139 |
val insets = border.getBorderInsets(peer) |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
140 |
val w = size.width - insets.left - insets.right |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
141 |
val h = size.height - insets.top - insets.bottom |
50900
6d80709ab862
separate color ranges by 1px to improve discernment of overall theory status;
wenzelm
parents:
50895
diff
changeset
|
142 |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
143 |
nodes_status.get(node_name) match { |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
144 |
case Some(st) if st.total > 0 => |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
145 |
val colors = List( |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
146 |
(st.unprocessed, PIDE.options.color_value("unprocessed1_color")), |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
147 |
(st.running, PIDE.options.color_value("running_color")), |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
148 |
(st.warned, PIDE.options.color_value("warning_color")), |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
149 |
(st.failed, PIDE.options.color_value("error_color"))) |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
150 |
|
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
151 |
var end = size.width - insets.right |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
152 |
for { (n, color) <- colors } |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
153 |
{ |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
154 |
gfx.setColor(color) |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
155 |
val v = (n * (w - colors.length) / st.total) max (if (n > 0) 4 else 0) |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
156 |
gfx.fillRect(end - v, insets.top, v, h) |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
157 |
end = end - v - 1 |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
158 |
} |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
159 |
case _ => |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
160 |
gfx.setColor(PIDE.options.color_value("unprocessed1_color")) |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
161 |
gfx.fillRect(insets.left, insets.top, w, h) |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
162 |
} |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
163 |
super.paintComponent(gfx) |
44866 | 164 |
} |
165 |
} |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
166 |
|
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
167 |
layout(checkbox) = BorderPanel.Position.West |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
168 |
layout(label) = BorderPanel.Position.Center |
44866 | 169 |
} |
170 |
||
44990 | 171 |
private class Node_Renderer extends ListView.Renderer[Document.Node.Name] |
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
172 |
{ |
44990 | 173 |
def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, |
174 |
name: Document.Node.Name, index: Int): Component = |
|
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
175 |
{ |
44990 | 176 |
val component = Node_Renderer_Component |
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
177 |
component.node_name = name |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
178 |
component.checkbox.selected = nodes_required.contains(name) |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
179 |
component.label.text = name.theory |
44990 | 180 |
component |
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
181 |
} |
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
182 |
} |
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
183 |
status.renderer = new Node_Renderer |
44609 | 184 |
|
45011
436ea69d5d37
more careful treatment of initial update, similar to output panel;
wenzelm
parents:
44991
diff
changeset
|
185 |
private def handle_update(restriction: Option[Set[Document.Node.Name]] = None) |
44609 | 186 |
{ |
187 |
Swing_Thread.now { |
|
50205 | 188 |
val snapshot = PIDE.session.snapshot() |
44613 | 189 |
|
46723 | 190 |
val iterator = |
191 |
restriction match { |
|
192 |
case Some(names) => names.iterator.map(name => (name, snapshot.version.nodes(name))) |
|
193 |
case None => snapshot.version.nodes.entries |
|
194 |
} |
|
46681 | 195 |
val nodes_status1 = |
46723 | 196 |
(nodes_status /: iterator)({ case (status, (name, node)) => |
50205 | 197 |
if (PIDE.thy_load.loaded_theories(name.theory)) status |
46739
6024353549ca
clarified document nodes (full import graph) vs. node_status (non-preloaded theories);
wenzelm
parents:
46723
diff
changeset
|
198 |
else status + (name -> Protocol.node_status(snapshot.state, snapshot.version, node)) }) |
44672 | 199 |
|
200 |
if (nodes_status != nodes_status1) { |
|
201 |
nodes_status = nodes_status1 |
|
44866 | 202 |
status.listData = |
46723 | 203 |
snapshot.version.nodes.topological_order.filter( |
44960 | 204 |
(name: Document.Node.Name) => nodes_status.isDefinedAt(name)) |
44609 | 205 |
} |
206 |
} |
|
207 |
} |
|
208 |
||
209 |
||
39515 | 210 |
/* main actor */ |
211 |
||
212 |
private val main_actor = actor { |
|
213 |
loop { |
|
214 |
react { |
|
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
215 |
case phase: Session.Phase => handle_phase(phase) |
39635 | 216 |
|
52759
a20631db9c8a
support declarative editor_execution_range, instead of old-style check/cancel buttons;
wenzelm
parents:
51535
diff
changeset
|
217 |
case _: Session.Global_Options => |
a20631db9c8a
support declarative editor_execution_range, instead of old-style check/cancel buttons;
wenzelm
parents:
51535
diff
changeset
|
218 |
Swing_Thread.later { |
52807
b859a180936b
simplified flag for continuous checking: avoid GUI complexity and slow checking of all theories (including prints);
wenzelm
parents:
52802
diff
changeset
|
219 |
continuous_checking.load() |
52759
a20631db9c8a
support declarative editor_execution_range, instead of old-style check/cancel buttons;
wenzelm
parents:
51535
diff
changeset
|
220 |
logic.load () |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
221 |
update_nodes_required() |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
222 |
status.repaint() |
52759
a20631db9c8a
support declarative editor_execution_range, instead of old-style check/cancel buttons;
wenzelm
parents:
51535
diff
changeset
|
223 |
} |
49247 | 224 |
|
45011
436ea69d5d37
more careful treatment of initial update, similar to output panel;
wenzelm
parents:
44991
diff
changeset
|
225 |
case changed: Session.Commands_Changed => handle_update(Some(changed.nodes)) |
44609 | 226 |
|
50299 | 227 |
case bad => System.err.println("Theories_Dockable: ignoring bad message " + bad) |
39515 | 228 |
} |
229 |
} |
|
230 |
} |
|
231 |
||
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
232 |
override def init() |
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
233 |
{ |
50205 | 234 |
PIDE.session.phase_changed += main_actor; handle_phase(PIDE.session.phase) |
235 |
PIDE.session.global_options += main_actor |
|
236 |
PIDE.session.commands_changed += main_actor; handle_update() |
|
39635 | 237 |
} |
238 |
||
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
239 |
override def exit() |
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
240 |
{ |
50205 | 241 |
PIDE.session.phase_changed -= main_actor |
242 |
PIDE.session.global_options -= main_actor |
|
243 |
PIDE.session.commands_changed -= main_actor |
|
39635 | 244 |
} |
39515 | 245 |
} |