author | wenzelm |
Fri, 01 Apr 2022 17:06:10 +0200 | |
changeset 75393 | 87ebf5a50283 |
parent 73987 | fc363a3b690a |
child 75833 | 8ffbd9343e91 |
permissions | -rw-r--r-- |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
1 |
/* Title: Tools/jEdit/src/simplifier_trace_dockable.scala |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
2 |
Author: Lars Hupel |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
3 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
4 |
Dockable window with interactive simplifier trace. |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
5 |
*/ |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
6 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
7 |
package isabelle.jedit |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
8 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
9 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
10 |
import isabelle._ |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
11 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
12 |
import scala.swing.{Button, CheckBox, Orientation, Separator} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
13 |
import scala.swing.event.ButtonClicked |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
14 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
15 |
import java.awt.BorderLayout |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
16 |
import java.awt.event.{ComponentEvent, ComponentAdapter} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
17 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
18 |
import org.gjt.sp.jedit.View |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
19 |
|
55556 | 20 |
|
75393 | 21 |
class Simplifier_Trace_Dockable(view: View, position: String) extends Dockable(view, position) { |
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
57593
diff
changeset
|
22 |
GUI_Thread.require {} |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
23 |
|
60748 | 24 |
|
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
57593
diff
changeset
|
25 |
/* component state -- owned by GUI thread */ |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
26 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
27 |
private var current_snapshot = Document.State.init.snapshot() |
56299
8201790fdeb9
more careful treatment of multiple command states (eval + prints): merge content that is actually required;
wenzelm
parents:
55825
diff
changeset
|
28 |
private var current_command = Command.empty |
8201790fdeb9
more careful treatment of multiple command states (eval + prints): merge content that is actually required;
wenzelm
parents:
55825
diff
changeset
|
29 |
private var current_results = Command.Results.empty |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
30 |
private var current_id = 0L |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
31 |
private var do_update = true |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
32 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
33 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
34 |
private val text_area = new Pretty_Text_Area(view) |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
35 |
set_content(text_area) |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
36 |
|
75393 | 37 |
private def update_contents(): Unit = { |
57593
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
38 |
val snapshot = current_snapshot |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
39 |
val context = Simplifier_Trace.handle_results(PIDE.session, current_id, current_results) |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
40 |
|
57593
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
41 |
answers.contents.clear() |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
42 |
context.questions.values.toList match { |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
43 |
case q :: _ => |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
44 |
val data = q.data |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
45 |
val content = Pretty.separate(XML.Text(data.text) :: data.content) |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
46 |
text_area.update(snapshot, Command.Results.empty, content) |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
47 |
q.answers.foreach { answer => |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
48 |
answers.contents += new Button(answer.string) { |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
49 |
reactions += { |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
50 |
case ButtonClicked(_) => |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
51 |
Simplifier_Trace.send_reply(PIDE.session, data.serial, answer) |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
52 |
} |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
53 |
} |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
54 |
} |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
55 |
case Nil => |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
56 |
text_area.update(snapshot, Command.Results.empty, Nil) |
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
57 |
} |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
58 |
|
57593
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
59 |
do_paint() |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
60 |
} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
61 |
|
75393 | 62 |
private def show_trace(): Unit = { |
71650
95ab607398bd
support multiple sessions, notably for "isabelle build -P -j2";
wenzelm
parents:
66591
diff
changeset
|
63 |
val trace = Simplifier_Trace.generate_trace(PIDE.session, current_results) |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
64 |
new Simplifier_Trace_Window(view, current_snapshot, trace) |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
65 |
} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
66 |
|
75393 | 67 |
private def do_paint(): Unit = { |
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
57593
diff
changeset
|
68 |
GUI_Thread.later { |
55825 | 69 |
text_area.resize(Font_Info.main(PIDE.options.real("jedit_font_scale"))) |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
70 |
} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
71 |
} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
72 |
|
73340 | 73 |
private def handle_resize(): Unit = do_paint() |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
74 |
|
75393 | 75 |
private def handle_update(follow: Boolean): Unit = { |
56299
8201790fdeb9
more careful treatment of multiple command states (eval + prints): merge content that is actually required;
wenzelm
parents:
55825
diff
changeset
|
76 |
val (new_snapshot, new_command, new_results, new_id) = |
66082 | 77 |
PIDE.editor.current_node_snapshot(view) match { |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
78 |
case Some(snapshot) => |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
79 |
if (follow && !snapshot.is_outdated) { |
66082 | 80 |
PIDE.editor.current_command(view, snapshot) match { |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
81 |
case Some(cmd) => |
65195 | 82 |
(snapshot, cmd, snapshot.command_results(cmd), cmd.id) |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
83 |
case None => |
56299
8201790fdeb9
more careful treatment of multiple command states (eval + prints): merge content that is actually required;
wenzelm
parents:
55825
diff
changeset
|
84 |
(Document.State.init.snapshot(), Command.empty, Command.Results.empty, 0L) |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
85 |
} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
86 |
} |
56299
8201790fdeb9
more careful treatment of multiple command states (eval + prints): merge content that is actually required;
wenzelm
parents:
55825
diff
changeset
|
87 |
else (current_snapshot, current_command, current_results, current_id) |
8201790fdeb9
more careful treatment of multiple command states (eval + prints): merge content that is actually required;
wenzelm
parents:
55825
diff
changeset
|
88 |
case None => (current_snapshot, current_command, current_results, current_id) |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
89 |
} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
90 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
91 |
current_snapshot = new_snapshot |
56299
8201790fdeb9
more careful treatment of multiple command states (eval + prints): merge content that is actually required;
wenzelm
parents:
55825
diff
changeset
|
92 |
current_command = new_command |
8201790fdeb9
more careful treatment of multiple command states (eval + prints): merge content that is actually required;
wenzelm
parents:
55825
diff
changeset
|
93 |
current_results = new_results |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
94 |
current_id = new_id |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
95 |
update_contents() |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
96 |
} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
97 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
98 |
|
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
99 |
/* main */ |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
100 |
|
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
101 |
private val main = |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
102 |
Session.Consumer[Any](getClass.getName) { |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
103 |
case _: Session.Global_Options => |
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
57593
diff
changeset
|
104 |
GUI_Thread.later { handle_resize() } |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
105 |
|
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
106 |
case changed: Session.Commands_Changed => |
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
57593
diff
changeset
|
107 |
GUI_Thread.later { handle_update(do_update) } |
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
108 |
|
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
109 |
case Session.Caret_Focus => |
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
57593
diff
changeset
|
110 |
GUI_Thread.later { handle_update(do_update) } |
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
111 |
|
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
112 |
case Simplifier_Trace.Event => |
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
57593
diff
changeset
|
113 |
GUI_Thread.later { handle_update(do_update) } |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
114 |
} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
115 |
|
75393 | 116 |
override def init(): Unit = { |
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
117 |
PIDE.session.global_options += main |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
118 |
PIDE.session.commands_changed += main |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
119 |
PIDE.session.caret_focus += main |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
120 |
PIDE.session.trace_events += main |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
121 |
handle_update(true) |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
122 |
} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
123 |
|
75393 | 124 |
override def exit(): Unit = { |
56715
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
125 |
PIDE.session.global_options -= main |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
126 |
PIDE.session.commands_changed -= main |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
127 |
PIDE.session.caret_focus -= main |
52125652e82a
clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents:
56662
diff
changeset
|
128 |
PIDE.session.trace_events -= main |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
129 |
delay_resize.revoke() |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
130 |
} |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
131 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
132 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
133 |
/* resize */ |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
134 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
135 |
private val delay_resize = |
71704 | 136 |
Delay.first(PIDE.options.seconds("editor_update_delay"), gui = true) { handle_resize() } |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
137 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
138 |
addComponentListener(new ComponentAdapter { |
73340 | 139 |
override def componentResized(e: ComponentEvent): Unit = delay_resize.invoke() |
140 |
override def componentShown(e: ComponentEvent): Unit = delay_resize.invoke() |
|
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
141 |
}) |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
142 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
143 |
|
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
144 |
/* controls */ |
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
145 |
|
66205 | 146 |
private val controls = |
66206 | 147 |
Wrap_Panel( |
66205 | 148 |
List( |
149 |
new CheckBox("Auto update") { |
|
150 |
selected = do_update |
|
151 |
reactions += { |
|
152 |
case ButtonClicked(_) => |
|
153 |
do_update = this.selected |
|
154 |
handle_update(do_update) |
|
155 |
} |
|
156 |
}, |
|
157 |
new Button("Update") { |
|
158 |
reactions += { |
|
159 |
case ButtonClicked(_) => |
|
160 |
handle_update(true) |
|
161 |
} |
|
162 |
}, |
|
163 |
new Separator(Orientation.Vertical), |
|
164 |
new Button("Show trace") { |
|
165 |
reactions += { |
|
166 |
case ButtonClicked(_) => |
|
167 |
show_trace() |
|
168 |
} |
|
169 |
}, |
|
170 |
new Button("Clear memory") { |
|
171 |
reactions += { |
|
172 |
case ButtonClicked(_) => |
|
71650
95ab607398bd
support multiple sessions, notably for "isabelle build -P -j2";
wenzelm
parents:
66591
diff
changeset
|
173 |
Simplifier_Trace.clear_memory(PIDE.session) |
66205 | 174 |
} |
175 |
})) |
|
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
176 |
|
66206 | 177 |
private val answers = Wrap_Panel(Nil, Wrap_Panel.Alignment.Left) |
57593
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
178 |
|
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
179 |
add(controls.peer, BorderLayout.NORTH) |
57593
2f7d91242b99
proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents:
56770
diff
changeset
|
180 |
add(answers.peer, BorderLayout.SOUTH) |
55316
885500f4aa6a
interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff
changeset
|
181 |
} |