author | wenzelm |
Wed, 31 Jul 2013 21:13:05 +0200 | |
changeset 52816 | c608e0ade554 |
parent 52815 | eaad5fe7bb1b |
child 52817 | 408fb2e563df |
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} |
49246 | 15 |
import scala.swing.event.{ButtonClicked, MouseClicked} |
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) |
31 |
reactions += { |
|
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
32 |
case MouseClicked(_, point, _, clicks, _) => |
44991 | 33 |
val index = peer.locationToIndex(point) |
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
34 |
if (index >= 0 && Node_Renderer_Component != null) { |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
35 |
Node_Renderer_Component.checkbox_geometry match { |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
36 |
case Some((loc, size)) => |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
37 |
val loc0 = peer.indexToLocation(index) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
38 |
val in_checkbox = |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
39 |
loc0.x + loc.x <= point.x && point.x < loc0.x + size.width && |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
40 |
loc0.y + loc.y <= point.y && point.y < loc0.y + size.height |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
41 |
|
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
42 |
if (clicks == 1 && in_checkbox) { |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
43 |
for { |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
44 |
buffer <- JEdit_Lib.jedit_buffer(listData(index).node) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
45 |
model <- PIDE.document_model(buffer) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
46 |
} model.node_required = !model.node_required |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
47 |
} |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
48 |
|
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
49 |
if (clicks == 2 && !in_checkbox) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
50 |
Hyperlink(listData(index).node).follow(view) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
51 |
|
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
52 |
case None => |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
53 |
} |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
54 |
} |
44991 | 55 |
} |
56 |
} |
|
50250 | 57 |
status.peer.setLayoutOrientation(JList.HORIZONTAL_WRAP) |
58 |
status.peer.setVisibleRowCount(0) |
|
44609 | 59 |
status.selection.intervalMode = ListView.IntervalMode.Single |
60 |
||
49038 | 61 |
set_content(new ScrollPane(status)) |
39515 | 62 |
|
63 |
||
39593 | 64 |
/* controls */ |
65 |
||
50299 | 66 |
def phase_text(phase: Session.Phase): String = |
67 |
"Prover: " + Library.lowercase(phase.toString) |
|
68 |
||
69 |
private val session_phase = new Label(phase_text(PIDE.session.phase)) |
|
39697 | 70 |
session_phase.border = new SoftBevelBorder(BevelBorder.LOWERED) |
50299 | 71 |
session_phase.tooltip = "Status of prover session" |
39635 | 72 |
|
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
73 |
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
|
74 |
{ |
50299 | 75 |
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
|
76 |
} |
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
77 |
|
52807
b859a180936b
simplified flag for continuous checking: avoid GUI complexity and slow checking of all theories (including prints);
wenzelm
parents:
52802
diff
changeset
|
78 |
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
|
79 |
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
|
80 |
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
|
81 |
def load() { selected = Isabelle.continuous_checking } |
52763 | 82 |
load() |
44776
47e8c8daccae
added "check" button: adhoc change to full buffer perspective;
wenzelm
parents:
44775
diff
changeset
|
83 |
} |
47e8c8daccae
added "check" button: adhoc change to full buffer perspective;
wenzelm
parents:
44775
diff
changeset
|
84 |
|
49246 | 85 |
private val logic = Isabelle_Logic.logic_selector(true) |
39702 | 86 |
|
44775
27930cf6f0f7
added "cancel" button based on cancel_execution, not interrupt (cf. 156be0e43336);
wenzelm
parents:
44734
diff
changeset
|
87 |
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
|
88 |
new FlowPanel(FlowPanel.Alignment.Right)(continuous_checking, session_phase, logic) |
39593 | 89 |
add(controls.peer, BorderLayout.NORTH) |
90 |
||
91 |
||
44609 | 92 |
/* component state -- owned by Swing thread */ |
93 |
||
45709
87017fcbad83
clarified modules (again) -- NB: both Document and Protocol are specific to this particular prover;
wenzelm
parents:
45672
diff
changeset
|
94 |
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
|
95 |
private var nodes_required: Set[Document.Node.Name] = Set.empty |
44866 | 96 |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
97 |
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
|
98 |
{ |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
99 |
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
|
100 |
for { |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
101 |
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
|
102 |
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
|
103 |
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
|
104 |
} 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
|
105 |
} |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
106 |
|
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
107 |
private object Node_Renderer_Component extends BorderPanel |
44866 | 108 |
{ |
44990 | 109 |
opaque = false |
44989
5450ab3c677e
explicit border independent of UI (cf. ad5883642a83, 2bec3b7514cf);
wenzelm
parents:
44981
diff
changeset
|
110 |
border = BorderFactory.createEmptyBorder(2, 2, 2, 2) |
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
111 |
|
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
112 |
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
|
113 |
|
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
114 |
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
|
115 |
val checkbox = new CheckBox { |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
116 |
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
|
117 |
{ |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
118 |
super.paintComponent(gfx) |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
119 |
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
|
120 |
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
|
121 |
} |
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
122 |
} |
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
123 |
|
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
124 |
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
|
125 |
opaque = false |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
126 |
xAlignment = Alignment.Leading |
52809
e750169a5884
paint unassigned/unchanged nodes as unprocessed -- relevant for editor_continuous_checking = false;
wenzelm
parents:
52807
diff
changeset
|
127 |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
128 |
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
|
129 |
{ |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
130 |
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
|
131 |
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
|
132 |
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
|
133 |
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
|
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 |
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
|
136 |
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
|
137 |
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
|
138 |
(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
|
139 |
(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
|
140 |
(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
|
141 |
(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
|
142 |
|
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
143 |
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
|
144 |
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
|
145 |
{ |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
146 |
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
|
147 |
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
|
148 |
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
|
149 |
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
|
150 |
} |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
151 |
case _ => |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
152 |
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
|
153 |
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
|
154 |
} |
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
155 |
super.paintComponent(gfx) |
44866 | 156 |
} |
157 |
} |
|
52815
eaad5fe7bb1b
actions and shortcuts to change node_required status, with painter that looks like CheckBox (non-clickable);
wenzelm
parents:
52809
diff
changeset
|
158 |
|
52816
c608e0ade554
home-grown mouse handling to pretend that the painted checkbox is actually a Swing component;
wenzelm
parents:
52815
diff
changeset
|
159 |
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
|
160 |
layout(label) = BorderPanel.Position.Center |
44866 | 161 |
} |
162 |
||
44990 | 163 |
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
|
164 |
{ |
44990 | 165 |
def componentFor(list: ListView[_], isSelected: Boolean, focused: Boolean, |
166 |
name: Document.Node.Name, index: Int): Component = |
|
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
167 |
{ |
44990 | 168 |
val component = Node_Renderer_Component |
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
169 |
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
|
170 |
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
|
171 |
component.label.text = name.theory |
44990 | 172 |
component |
44957
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
173 |
} |
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
174 |
} |
098dd95349e7
more elaborate Node_Renderer, which paints node_name.theory only;
wenzelm
parents:
44867
diff
changeset
|
175 |
status.renderer = new Node_Renderer |
44609 | 176 |
|
45011
436ea69d5d37
more careful treatment of initial update, similar to output panel;
wenzelm
parents:
44991
diff
changeset
|
177 |
private def handle_update(restriction: Option[Set[Document.Node.Name]] = None) |
44609 | 178 |
{ |
179 |
Swing_Thread.now { |
|
50205 | 180 |
val snapshot = PIDE.session.snapshot() |
44613 | 181 |
|
46723 | 182 |
val iterator = |
183 |
restriction match { |
|
184 |
case Some(names) => names.iterator.map(name => (name, snapshot.version.nodes(name))) |
|
185 |
case None => snapshot.version.nodes.entries |
|
186 |
} |
|
46681 | 187 |
val nodes_status1 = |
46723 | 188 |
(nodes_status /: iterator)({ case (status, (name, node)) => |
50205 | 189 |
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
|
190 |
else status + (name -> Protocol.node_status(snapshot.state, snapshot.version, node)) }) |
44672 | 191 |
|
192 |
if (nodes_status != nodes_status1) { |
|
193 |
nodes_status = nodes_status1 |
|
44866 | 194 |
status.listData = |
46723 | 195 |
snapshot.version.nodes.topological_order.filter( |
44960 | 196 |
(name: Document.Node.Name) => nodes_status.isDefinedAt(name)) |
44609 | 197 |
} |
198 |
} |
|
199 |
} |
|
200 |
||
201 |
||
39515 | 202 |
/* main actor */ |
203 |
||
204 |
private val main_actor = actor { |
|
205 |
loop { |
|
206 |
react { |
|
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
207 |
case phase: Session.Phase => handle_phase(phase) |
39635 | 208 |
|
52759
a20631db9c8a
support declarative editor_execution_range, instead of old-style check/cancel buttons;
wenzelm
parents:
51535
diff
changeset
|
209 |
case _: Session.Global_Options => |
a20631db9c8a
support declarative editor_execution_range, instead of old-style check/cancel buttons;
wenzelm
parents:
51535
diff
changeset
|
210 |
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
|
211 |
continuous_checking.load() |
52759
a20631db9c8a
support declarative editor_execution_range, instead of old-style check/cancel buttons;
wenzelm
parents:
51535
diff
changeset
|
212 |
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
|
213 |
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
|
214 |
status.repaint() |
52759
a20631db9c8a
support declarative editor_execution_range, instead of old-style check/cancel buttons;
wenzelm
parents:
51535
diff
changeset
|
215 |
} |
49247 | 216 |
|
45011
436ea69d5d37
more careful treatment of initial update, similar to output panel;
wenzelm
parents:
44991
diff
changeset
|
217 |
case changed: Session.Commands_Changed => handle_update(Some(changed.nodes)) |
44609 | 218 |
|
50299 | 219 |
case bad => System.err.println("Theories_Dockable: ignoring bad message " + bad) |
39515 | 220 |
} |
221 |
} |
|
222 |
} |
|
223 |
||
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
224 |
override def init() |
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
225 |
{ |
50205 | 226 |
PIDE.session.phase_changed += main_actor; handle_phase(PIDE.session.phase) |
227 |
PIDE.session.global_options += main_actor |
|
228 |
PIDE.session.commands_changed += main_actor; handle_update() |
|
39635 | 229 |
} |
230 |
||
48018
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
231 |
override def exit() |
b941dd7df92a
make double sure that GUI components are up-to-date after init;
wenzelm
parents:
48014
diff
changeset
|
232 |
{ |
50205 | 233 |
PIDE.session.phase_changed -= main_actor |
234 |
PIDE.session.global_options -= main_actor |
|
235 |
PIDE.session.commands_changed -= main_actor |
|
39635 | 236 |
} |
39515 | 237 |
} |