src/Tools/jEdit/src/output_dockable.scala
author wenzelm
Mon, 12 Aug 2013 14:53:16 +0200
changeset 52978 37fbb3fde380
parent 52972 8fd8e1c14988
child 53177 dcac8d837b9c
permissions -rw-r--r--
prefer PIDE editor operations; apply_query: insist in non-outdated snapshot via editor.current_command; tuned signature;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49494
cbcccf2a0f6f renamed Output to Output1 and Output2 to Output, and thus make the new version the default;
wenzelm
parents: 49473
diff changeset
     1
/*  Title:      Tools/jEdit/src/output_dockable.scala
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
     3
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
     4
Dockable window with result message output.
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
     5
*/
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
     6
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
     7
package isabelle.jedit
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
     8
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
     9
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    10
import isabelle._
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    11
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    12
import scala.actors.Actor._
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    13
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    14
import scala.swing.{FlowPanel, Button, CheckBox}
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    15
import scala.swing.event.ButtonClicked
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    16
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    17
import java.lang.System
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    18
import java.awt.BorderLayout
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    19
import java.awt.event.{ComponentEvent, ComponentAdapter}
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    20
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    21
import org.gjt.sp.jedit.View
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    22
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    23
49494
cbcccf2a0f6f renamed Output to Output1 and Output2 to Output, and thus make the new version the default;
wenzelm
parents: 49473
diff changeset
    24
class Output_Dockable(view: View, position: String) extends Dockable(view, position)
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    25
{
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    26
  Swing_Thread.require()
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    27
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    28
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    29
  /* component state -- owned by Swing thread */
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    30
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    31
  private var zoom_factor = 100
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    32
  private var do_update = true
52972
8fd8e1c14988 tuned signature;
wenzelm
parents: 52845
diff changeset
    33
  private var current_snapshot = Document.Snapshot.init
49414
d7b5fb2e9ca2 some support for inital command markup;
wenzelm
parents: 49412
diff changeset
    34
  private var current_state = Command.empty.init_state
49415
8b402b550a80 proper separation of output messages;
wenzelm
parents: 49414
diff changeset
    35
  private var current_output: List[XML.Tree] = Nil
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    36
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    37
49726
2074197dc274 detach tooltip as dockable window;
wenzelm
parents: 49701
diff changeset
    38
  /* pretty text area */
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    39
50541
021f054ff1fa tuned signature;
wenzelm
parents: 50501
diff changeset
    40
  val pretty_text_area = new Pretty_Text_Area(view)
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    41
  set_content(pretty_text_area)
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    42
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    43
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    44
  private def handle_resize()
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    45
  {
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    46
    Swing_Thread.require()
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    47
50206
6626bc5ed053 tuned signature;
wenzelm
parents: 50205
diff changeset
    48
    pretty_text_area.resize(Rendering.font_family(),
6626bc5ed053 tuned signature;
wenzelm
parents: 50205
diff changeset
    49
      (Rendering.font_size("jedit_font_scale") * zoom_factor / 100).round)
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    50
  }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    51
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    52
  private def handle_update(follow: Boolean, restriction: Option[Set[Command]])
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    53
  {
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    54
    Swing_Thread.require()
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    55
49419
e2726211f834 pass base_snapshot to enable hyperlinks into other nodes;
wenzelm
parents: 49418
diff changeset
    56
    val (new_snapshot, new_state) =
52978
37fbb3fde380 prefer PIDE editor operations;
wenzelm
parents: 52972
diff changeset
    57
      PIDE.editor.current_node_snapshot(view) match {
37fbb3fde380 prefer PIDE editor operations;
wenzelm
parents: 52972
diff changeset
    58
        case Some(snapshot) =>
49419
e2726211f834 pass base_snapshot to enable hyperlinks into other nodes;
wenzelm
parents: 49418
diff changeset
    59
          if (follow && !snapshot.is_outdated) {
52978
37fbb3fde380 prefer PIDE editor operations;
wenzelm
parents: 52972
diff changeset
    60
            PIDE.editor.current_command(view, snapshot) match {
37fbb3fde380 prefer PIDE editor operations;
wenzelm
parents: 52972
diff changeset
    61
              case Some((cmd, _)) =>
49419
e2726211f834 pass base_snapshot to enable hyperlinks into other nodes;
wenzelm
parents: 49418
diff changeset
    62
                (snapshot, snapshot.state.command_state(snapshot.version, cmd))
e2726211f834 pass base_snapshot to enable hyperlinks into other nodes;
wenzelm
parents: 49418
diff changeset
    63
              case None =>
52972
8fd8e1c14988 tuned signature;
wenzelm
parents: 52845
diff changeset
    64
                (Document.Snapshot.init, Command.empty.init_state)
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    65
            }
49419
e2726211f834 pass base_snapshot to enable hyperlinks into other nodes;
wenzelm
parents: 49418
diff changeset
    66
          }
e2726211f834 pass base_snapshot to enable hyperlinks into other nodes;
wenzelm
parents: 49418
diff changeset
    67
          else (current_snapshot, current_state)
e2726211f834 pass base_snapshot to enable hyperlinks into other nodes;
wenzelm
parents: 49418
diff changeset
    68
        case None => (current_snapshot, current_state)
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    69
      }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    70
50409
5eaebd8e52f4 discontinued obsolete "Tracing" button -- limited tracing channel works sufficiently well;
wenzelm
parents: 50207
diff changeset
    71
    val new_output =
50499
f496b2b7bafb rendering of selected dialog_result as active_result_color, depending on dynamic command status in output panel, but not static popups etc.;
wenzelm
parents: 50409
diff changeset
    72
      if (!restriction.isDefined || restriction.get.contains(new_state.command)) {
50500
c94bba7906d2 identify dialogs via official serial and maintain as result message;
wenzelm
parents: 50499
diff changeset
    73
        val rendering = Rendering(new_snapshot, PIDE.options.value)
c94bba7906d2 identify dialogs via official serial and maintain as result message;
wenzelm
parents: 50499
diff changeset
    74
        rendering.output_messages(new_state)
50499
f496b2b7bafb rendering of selected dialog_result as active_result_color, depending on dynamic command status in output panel, but not static popups etc.;
wenzelm
parents: 50409
diff changeset
    75
      }
50409
5eaebd8e52f4 discontinued obsolete "Tracing" button -- limited tracing channel works sufficiently well;
wenzelm
parents: 50207
diff changeset
    76
      else current_output
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    77
49415
8b402b550a80 proper separation of output messages;
wenzelm
parents: 49414
diff changeset
    78
    if (new_output != current_output)
50501
6f41f1646617 more careful handling of Dialog_Result, with active area and color feedback;
wenzelm
parents: 50500
diff changeset
    79
      pretty_text_area.update(new_snapshot, new_state.results, Pretty.separate(new_output))
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    80
49419
e2726211f834 pass base_snapshot to enable hyperlinks into other nodes;
wenzelm
parents: 49418
diff changeset
    81
    current_snapshot = new_snapshot
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    82
    current_state = new_state
49415
8b402b550a80 proper separation of output messages;
wenzelm
parents: 49414
diff changeset
    83
    current_output = new_output
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    84
  }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    85
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    86
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    87
  /* main actor */
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    88
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    89
  private val main_actor = actor {
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    90
    loop {
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    91
      react {
50117
32755e357a51 update options via protocol;
wenzelm
parents: 49891
diff changeset
    92
        case _: Session.Global_Options =>
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    93
          Swing_Thread.later { handle_resize() }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    94
        case changed: Session.Commands_Changed =>
50773
205d12333fdc more aggressive update -- potentially relevant for previously is_outdated output;
wenzelm
parents: 50541
diff changeset
    95
          val restriction = if (changed.assignment) None else Some(changed.commands)
205d12333fdc more aggressive update -- potentially relevant for previously is_outdated output;
wenzelm
parents: 50541
diff changeset
    96
          Swing_Thread.later { handle_update(do_update, restriction) }
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    97
        case Session.Caret_Focus =>
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    98
          Swing_Thread.later { handle_update(do_update, None) }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
    99
        case bad => System.err.println("Output_Dockable: ignoring bad message " + bad)
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   100
      }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   101
    }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   102
  }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   103
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   104
  override def init()
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   105
  {
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   106
    Swing_Thread.require()
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   107
50205
788c8263e634 renamed main plugin object to PIDE;
wenzelm
parents: 50146
diff changeset
   108
    PIDE.session.global_options += main_actor
788c8263e634 renamed main plugin object to PIDE;
wenzelm
parents: 50146
diff changeset
   109
    PIDE.session.commands_changed += main_actor
788c8263e634 renamed main plugin object to PIDE;
wenzelm
parents: 50146
diff changeset
   110
    PIDE.session.caret_focus += main_actor
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   111
    handle_update(true, None)
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   112
  }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   113
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   114
  override def exit()
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   115
  {
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   116
    Swing_Thread.require()
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   117
50205
788c8263e634 renamed main plugin object to PIDE;
wenzelm
parents: 50146
diff changeset
   118
    PIDE.session.global_options -= main_actor
788c8263e634 renamed main plugin object to PIDE;
wenzelm
parents: 50146
diff changeset
   119
    PIDE.session.commands_changed -= main_actor
788c8263e634 renamed main plugin object to PIDE;
wenzelm
parents: 50146
diff changeset
   120
    PIDE.session.caret_focus -= main_actor
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   121
    delay_resize.revoke()
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   122
  }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   123
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   124
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   125
  /* resize */
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   126
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   127
  private val delay_resize =
50207
54be125d8cdc tuned signature;
wenzelm
parents: 50206
diff changeset
   128
    Swing_Thread.delay_first(PIDE.options.seconds("editor_update_delay")) { handle_resize() }
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   129
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   130
  addComponentListener(new ComponentAdapter {
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   131
    override def componentResized(e: ComponentEvent) { delay_resize.invoke() }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   132
  })
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   133
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   134
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   135
  /* controls */
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   136
52845
wenzelm
parents: 51616
diff changeset
   137
  private val zoom = new GUI.Zoom_Box(factor => { zoom_factor = factor; handle_resize() }) {
wenzelm
parents: 51616
diff changeset
   138
    tooltip = "Zoom factor for output font size"
wenzelm
parents: 51616
diff changeset
   139
  }
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   140
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   141
  private val auto_update = new CheckBox("Auto update") {
52845
wenzelm
parents: 51616
diff changeset
   142
    tooltip = "Indicate automatic update following cursor movement"
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   143
    reactions += {
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   144
      case ButtonClicked(_) => do_update = this.selected; handle_update(do_update, None) }
52845
wenzelm
parents: 51616
diff changeset
   145
    selected = do_update
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   146
  }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   147
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   148
  private val update = new Button("Update") {
52845
wenzelm
parents: 51616
diff changeset
   149
    tooltip = "Update display according to the command at cursor position"
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   150
    reactions += { case ButtonClicked(_) => handle_update(true, None) }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   151
  }
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   152
49891
a6563caedf7a added Output "Detach" button;
wenzelm
parents: 49827
diff changeset
   153
  private val detach = new Button("Detach") {
52845
wenzelm
parents: 51616
diff changeset
   154
    tooltip = "Detach window with static copy of current output"
49891
a6563caedf7a added Output "Detach" button;
wenzelm
parents: 49827
diff changeset
   155
    reactions += {
a6563caedf7a added Output "Detach" button;
wenzelm
parents: 49827
diff changeset
   156
      case ButtonClicked(_) =>
50501
6f41f1646617 more careful handling of Dialog_Result, with active area and color feedback;
wenzelm
parents: 50500
diff changeset
   157
        Info_Dockable(view, current_snapshot,
6f41f1646617 more careful handling of Dialog_Result, with active area and color feedback;
wenzelm
parents: 50500
diff changeset
   158
          current_state.results, Pretty.separate(current_output))
49891
a6563caedf7a added Output "Detach" button;
wenzelm
parents: 49827
diff changeset
   159
    }
a6563caedf7a added Output "Detach" button;
wenzelm
parents: 49827
diff changeset
   160
  }
a6563caedf7a added Output "Detach" button;
wenzelm
parents: 49827
diff changeset
   161
52845
wenzelm
parents: 51616
diff changeset
   162
  private val controls = new FlowPanel(FlowPanel.Alignment.Right)(auto_update, update, detach, zoom)
49398
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   163
  add(controls.peer, BorderLayout.NORTH)
0fa4389c04f9 alternative output panel, based on Pretty_Text_Area, based on JEditEmbeddedTextArea;
wenzelm
parents:
diff changeset
   164
}