8 |
8 |
9 |
9 |
10 import isabelle._ |
10 import isabelle._ |
11 |
11 |
12 import scala.actors.Actor._ |
12 import scala.actors.Actor._ |
13 import scala.swing.{FlowPanel, Button, TextArea, Label, ListView, |
13 import scala.swing.{FlowPanel, Button, TextArea, Label, ListView, Alignment, |
14 ScrollPane, TabbedPane, Component, Swing} |
14 ScrollPane, TabbedPane, Component, Swing} |
15 import scala.swing.event.{ButtonClicked, SelectionChanged} |
15 import scala.swing.event.{ButtonClicked, SelectionChanged} |
16 |
16 |
17 import java.lang.System |
17 import java.lang.System |
18 import java.awt.{BorderLayout, Graphics} |
18 import java.awt.{BorderLayout, Graphics2D} |
19 import javax.swing.{JList, DefaultListCellRenderer} |
19 import javax.swing.{JList, DefaultListCellRenderer, UIManager} |
20 import javax.swing.border.{BevelBorder, SoftBevelBorder} |
20 import javax.swing.border.{BevelBorder, SoftBevelBorder} |
21 |
21 |
22 import org.gjt.sp.jedit.{View, jEdit} |
22 import org.gjt.sp.jedit.{View, jEdit} |
23 |
23 |
24 |
24 |
27 /* main tabs */ |
27 /* main tabs */ |
28 |
28 |
29 private val readme = new HTML_Panel("SansSerif", 14) |
29 private val readme = new HTML_Panel("SansSerif", 14) |
30 readme.render_document(Isabelle_System.try_read(List(Path.explode("$JEDIT_HOME/README.html")))) |
30 readme.render_document(Isabelle_System.try_read(List(Path.explode("$JEDIT_HOME/README.html")))) |
31 |
31 |
32 val status = new ListView(Nil: List[String]) |
32 val status = new ListView(Nil: List[Document.Node.Name]) |
33 status.peer.setLayoutOrientation(JList.VERTICAL_WRAP) |
33 status.peer.setLayoutOrientation(JList.VERTICAL_WRAP) |
34 status.selection.intervalMode = ListView.IntervalMode.Single |
34 status.selection.intervalMode = ListView.IntervalMode.Single |
35 |
35 |
36 private val syslog = new TextArea(Isabelle.session.syslog()) |
36 private val syslog = new TextArea(Isabelle.session.syslog()) |
37 |
37 |
84 |
84 |
85 /* component state -- owned by Swing thread */ |
85 /* component state -- owned by Swing thread */ |
86 |
86 |
87 private var nodes_status: Map[Document.Node.Name, Isar_Document.Node_Status] = Map.empty |
87 private var nodes_status: Map[Document.Node.Name, Isar_Document.Node_Status] = Map.empty |
88 |
88 |
89 val node_renderer = new DefaultListCellRenderer |
89 private class Node_Renderer_Component extends Label |
90 { |
90 { |
91 override def paintComponent(gfx: Graphics) |
91 xAlignment = Alignment.Leading |
|
92 border = UIManager.getBorder("List.cellNoFocusBorder") |
|
93 |
|
94 var node_name = Document.Node.Name.empty |
|
95 override def paintComponent(gfx: Graphics2D) |
92 { |
96 { |
93 nodes_status.get(Document.Node.Name(getText, "", "")) match { |
97 nodes_status.get(node_name) match { |
94 case Some(st) if st.total > 0 => |
98 case Some(st) if st.total > 0 => |
95 val w = getWidth |
99 val w = getWidth |
96 val h = getHeight |
100 val h = getHeight |
97 var end = w |
101 var end = w |
98 for { |
102 for { |
110 } |
114 } |
111 super.paintComponent(gfx) |
115 super.paintComponent(gfx) |
112 } |
116 } |
113 } |
117 } |
114 |
118 |
115 status.peer.setCellRenderer(node_renderer) |
119 private class Node_Renderer extends |
|
120 ListView.AbstractRenderer[Document.Node.Name, Node_Renderer_Component]( |
|
121 new Node_Renderer_Component) |
|
122 { |
|
123 def configure(list: ListView[_], isSelected: Boolean, focused: Boolean, |
|
124 name: Document.Node.Name, index: Int) |
|
125 { |
|
126 component.opaque = false |
|
127 component.node_name = name |
|
128 component.text = name.theory |
|
129 } |
|
130 } |
|
131 status.renderer = new Node_Renderer |
116 |
132 |
117 private def handle_changed(changed_nodes: Set[Document.Node.Name]) |
133 private def handle_changed(changed_nodes: Set[Document.Node.Name]) |
118 { |
134 { |
119 Swing_Thread.now { |
135 Swing_Thread.now { |
120 // FIXME correlation to changed_nodes!? |
136 // FIXME correlation to changed_nodes!? |