src/Tools/jEdit/src/simplifier_trace_dockable.scala
author wenzelm
Fri, 15 Nov 2024 13:31:36 +0100
changeset 81448 9b2e13b3ee43
parent 81398 f92ea68473f2
child 81491 c7a88aaa60d2
permissions -rw-r--r--
more rebust mechanics of refresh (see also 82110cbcf9a1 and 2d9b6e32632d): painter.getFontRenderContext might be in undefined state (notably on macOS due to display scaling);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
75853
f981111768ec clarified signature;
wenzelm
parents: 75852
diff changeset
    12
import scala.swing.{Orientation, Separator}
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
    13
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
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
    15
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
    16
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
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
    18
55556
60ba93d8f9e5 tuned imports;
wenzelm
parents: 55316
diff changeset
    19
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 73987
diff changeset
    20
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
    21
  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
    22
60748
wenzelm
parents: 57612
diff changeset
    23
57612
990ffb84489b clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents: 57593
diff changeset
    24
  /* 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
    25
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
  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
    27
  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
    28
  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
    29
  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
    30
  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
    31
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
81388
69c61216c87a tuned signature: more standard names;
wenzelm
parents: 81387
diff changeset
    33
  private val pretty_text_area = new Pretty_Text_Area(view)
69c61216c87a tuned signature: more standard names;
wenzelm
parents: 81387
diff changeset
    34
  set_content(pretty_text_area)
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
    35
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 73987
diff changeset
    36
  private def update_contents(): Unit = {
57593
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
    37
    val snapshot = current_snapshot
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
    38
    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
    39
57593
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
    40
    answers.contents.clear()
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
    41
    context.questions.values.toList match {
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
    42
      case q :: _ =>
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
    43
        val data = q.data
81398
f92ea68473f2 clarified signature with subtle change of semantics: output consists of individual messages that are formatted (and separated) internally;
wenzelm
parents: 81388
diff changeset
    44
        val output = List(Pretty.block(XML.Text(data.text) :: data.content, indent = 0))
f92ea68473f2 clarified signature with subtle change of semantics: output consists of individual messages that are formatted (and separated) internally;
wenzelm
parents: 81388
diff changeset
    45
        pretty_text_area.update(snapshot, Command.Results.empty, output)
57593
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
    46
        q.answers.foreach { answer =>
75853
f981111768ec clarified signature;
wenzelm
parents: 75852
diff changeset
    47
          answers.contents += new GUI.Button(answer.string) {
f981111768ec clarified signature;
wenzelm
parents: 75852
diff changeset
    48
            override def clicked(): Unit =
f981111768ec clarified signature;
wenzelm
parents: 75852
diff changeset
    49
              Simplifier_Trace.send_reply(PIDE.session, data.serial, answer)
57593
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
    50
          }
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
    51
        }
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
    52
      case Nil =>
81388
69c61216c87a tuned signature: more standard names;
wenzelm
parents: 81387
diff changeset
    53
        pretty_text_area.update(snapshot, Command.Results.empty, Nil)
57593
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
    54
    }
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
    55
81385
072ce947ee50 tuned signature: more standard names;
wenzelm
parents: 81382
diff changeset
    56
    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
    57
  }
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
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 73987
diff changeset
    59
  private def show_trace(): Unit = {
71650
95ab607398bd support multiple sessions, notably for "isabelle build -P -j2";
wenzelm
parents: 66591
diff changeset
    60
    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
    61
    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
    62
  }
885500f4aa6a interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
    63
81388
69c61216c87a tuned signature: more standard names;
wenzelm
parents: 81387
diff changeset
    64
  private def handle_resize(): Unit = pretty_text_area.zoom()
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
    65
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 73987
diff changeset
    66
  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
    67
    val (new_snapshot, new_command, new_results, new_id) =
66082
2d12a730a380 clarified modules;
wenzelm
parents: 65246
diff changeset
    68
      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
    69
        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
    70
          if (follow && !snapshot.is_outdated) {
66082
2d12a730a380 clarified modules;
wenzelm
parents: 65246
diff changeset
    71
            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
    72
              case Some(cmd) =>
65195
wenzelm
parents: 60748
diff changeset
    73
                (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
    74
              case None =>
56299
8201790fdeb9 more careful treatment of multiple command states (eval + prints): merge content that is actually required;
wenzelm
parents: 55825
diff changeset
    75
                (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
    76
            }
885500f4aa6a interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
    77
          }
56299
8201790fdeb9 more careful treatment of multiple command states (eval + prints): merge content that is actually required;
wenzelm
parents: 55825
diff changeset
    78
          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
    79
        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
    80
      }
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
885500f4aa6a interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
    82
    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
    83
    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
    84
    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
    85
    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
    86
    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
    87
  }
885500f4aa6a interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
    88
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
56715
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
    90
  /* main */
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
    91
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
    92
  private val main =
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
    93
    Session.Consumer[Any](getClass.getName) {
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
    94
      case _: Session.Global_Options =>
57612
990ffb84489b clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents: 57593
diff changeset
    95
        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
    96
56715
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
    97
      case changed: Session.Commands_Changed =>
57612
990ffb84489b clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents: 57593
diff changeset
    98
        GUI_Thread.later { handle_update(do_update) }
56715
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
    99
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
   100
      case Session.Caret_Focus =>
57612
990ffb84489b clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents: 57593
diff changeset
   101
        GUI_Thread.later { handle_update(do_update) }
56715
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
   102
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
   103
      case Simplifier_Trace.Event =>
57612
990ffb84489b clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents: 57593
diff changeset
   104
        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
   105
    }
885500f4aa6a interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   106
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 73987
diff changeset
   107
  override def init(): Unit = {
56715
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
   108
    PIDE.session.global_options += main
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
   109
    PIDE.session.commands_changed += main
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
   110
    PIDE.session.caret_focus += main
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
   111
    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
   112
    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
   113
  }
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
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 73987
diff changeset
   115
  override def exit(): Unit = {
56715
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
   116
    PIDE.session.global_options -= main
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
   117
    PIDE.session.commands_changed -= main
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
   118
    PIDE.session.caret_focus -= main
52125652e82a clarified Session.Consumer, with Session.Outlet managed by dispatcher thread;
wenzelm
parents: 56662
diff changeset
   119
    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
   120
    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
   121
  }
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
885500f4aa6a interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   124
  /* 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
   125
885500f4aa6a interactive simplifier trace: new panel in Isabelle/jEdit to inspect and modify simplification state
Lars Hupel <lars.hupel@mytum.de>
parents:
diff changeset
   126
  private val delay_resize =
76610
6e2383488a55 clarified signature: proper scopes and types;
wenzelm
parents: 75854
diff changeset
   127
    Delay.first(PIDE.session.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
   128
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
  addComponentListener(new ComponentAdapter {
73340
0ffcad1f6130 tuned --- fewer warnings;
wenzelm
parents: 71704
diff changeset
   130
    override def componentResized(e: ComponentEvent): Unit = delay_resize.invoke()
0ffcad1f6130 tuned --- fewer warnings;
wenzelm
parents: 71704
diff changeset
   131
    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
   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
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
  /* 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
   136
66205
e9fa94f43a15 tuned signature;
wenzelm
parents: 66082
diff changeset
   137
  private val controls =
66206
2d2082db735a clarified defaults;
wenzelm
parents: 66205
diff changeset
   138
    Wrap_Panel(
66205
e9fa94f43a15 tuned signature;
wenzelm
parents: 66082
diff changeset
   139
      List(
75854
2163772eeaf2 tuned signature;
wenzelm
parents: 75853
diff changeset
   140
        new GUI.Check("Auto update", init = do_update) {
75852
fcc25bb49def clarified signature;
wenzelm
parents: 75833
diff changeset
   141
          override def clicked(state: Boolean): Unit = {
fcc25bb49def clarified signature;
wenzelm
parents: 75833
diff changeset
   142
            do_update = state
fcc25bb49def clarified signature;
wenzelm
parents: 75833
diff changeset
   143
            handle_update(do_update)
66205
e9fa94f43a15 tuned signature;
wenzelm
parents: 66082
diff changeset
   144
          }
e9fa94f43a15 tuned signature;
wenzelm
parents: 66082
diff changeset
   145
        },
75853
f981111768ec clarified signature;
wenzelm
parents: 75852
diff changeset
   146
        new GUI.Button("Update") { override def clicked(): Unit = handle_update(true) },
66205
e9fa94f43a15 tuned signature;
wenzelm
parents: 66082
diff changeset
   147
        new Separator(Orientation.Vertical),
75853
f981111768ec clarified signature;
wenzelm
parents: 75852
diff changeset
   148
        new GUI.Button("Show trace") { override def clicked(): Unit = show_trace() },
f981111768ec clarified signature;
wenzelm
parents: 75852
diff changeset
   149
        new GUI.Button("Clear memory") {
f981111768ec clarified signature;
wenzelm
parents: 75852
diff changeset
   150
          override def clicked(): Unit = Simplifier_Trace.clear_memory(PIDE.session)
66205
e9fa94f43a15 tuned signature;
wenzelm
parents: 66082
diff changeset
   151
        }))
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
   152
66206
2d2082db735a clarified defaults;
wenzelm
parents: 66205
diff changeset
   153
  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
   154
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
   155
  add(controls.peer, BorderLayout.NORTH)
57593
2f7d91242b99 proper Swing buttons instead of active areas within text (by Lars Hupel);
wenzelm
parents: 56770
diff changeset
   156
  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
   157
}