src/Pure/PIDE/active.ML
author wenzelm
Mon, 10 Dec 2012 13:52:33 +0100
changeset 50450 358b6020f8b6
parent 50215 src/Pure/PIDE/sendback.ML@97959912840a
child 50498 6647ba2775c1
permissions -rw-r--r--
generalized notion of active area, where sendback is just one application; some support for graphview via active area;

(*  Title:      Pure/PIDE/active.ML
    Author:     Makarius

Active areas within the document (see also Tools/jEdit/src/active.scala).
*)

signature ACTIVE =
sig
  val make_markup: string -> {implicit: bool, properties: Properties.T} -> Markup.T
  val markup_implicit: string -> string -> string
  val markup: string -> string -> string
  val sendback_markup_implicit: string -> string
  val sendback_markup: string -> string
end;

structure Active: ACTIVE =
struct

fun make_markup name {implicit, properties} =
  (name, [])
  |> not implicit ? (fn markup =>
      let
        val props =
          (case Position.get_id (Position.thread_data ()) of
            SOME id => [(Markup.idN, id)]
          | NONE => []);
      in Markup.properties props markup end)
  |> Markup.properties properties;

fun markup_implicit name s = Markup.markup (make_markup name {implicit = true, properties = []}) s;
fun markup name s = Markup.markup (make_markup name {implicit = false, properties = []}) s;

val sendback_markup_implicit = markup_implicit Markup.sendbackN;
val sendback_markup = markup Markup.sendbackN;

end;