src/Pure/PIDE/rendering.scala
changeset 66074 4329cc78c2a1
parent 66055 07175635f78c
child 66114 c137a9f038a6
equal deleted inserted replaced
66073:50a28b3cceb2 66074:4329cc78c2a1
   134     Markup.ML_STRING -> Color.inner_quoted,
   134     Markup.ML_STRING -> Color.inner_quoted,
   135     Markup.ML_COMMENT -> Color.inner_comment,
   135     Markup.ML_COMMENT -> Color.inner_comment,
   136     Markup.SML_STRING -> Color.inner_quoted,
   136     Markup.SML_STRING -> Color.inner_quoted,
   137     Markup.SML_COMMENT -> Color.inner_comment)
   137     Markup.SML_COMMENT -> Color.inner_comment)
   138 
   138 
       
   139   val foreground =
       
   140     Map(
       
   141       Markup.STRING -> Color.quoted,
       
   142       Markup.ALT_STRING -> Color.quoted,
       
   143       Markup.VERBATIM -> Color.quoted,
       
   144       Markup.CARTOUCHE -> Color.quoted,
       
   145       Markup.ANTIQUOTED -> Color.antiquoted)
       
   146 
   139 
   147 
   140   /* tooltips */
   148   /* tooltips */
   141 
   149 
   142   val tooltip_descriptions =
   150   val tooltip_descriptions =
   143     Map(
   151     Map(
   175       Markup.TRACING_MESSAGE + Markup.WARNING_MESSAGE +
   183       Markup.TRACING_MESSAGE + Markup.WARNING_MESSAGE +
   176       Markup.LEGACY_MESSAGE + Markup.ERROR_MESSAGE +
   184       Markup.LEGACY_MESSAGE + Markup.ERROR_MESSAGE +
   177       Markup.BAD + Markup.INTENSIFY + Markup.ENTITY +
   185       Markup.BAD + Markup.INTENSIFY + Markup.ENTITY +
   178       Markup.Markdown_Item.name ++ active_elements
   186       Markup.Markdown_Item.name ++ active_elements
   179 
   187 
   180   val foreground_elements =
   188   val foreground_elements = Markup.Elements(foreground.keySet)
   181     Markup.Elements(Markup.STRING, Markup.ALT_STRING, Markup.VERBATIM,
   189 
   182       Markup.CARTOUCHE, Markup.ANTIQUOTED)
   190   val text_color_elements = Markup.Elements(text_color.keySet)
   183 
   191 
   184   val tooltip_elements =
   192   val tooltip_elements =
   185     Markup.Elements(Markup.LANGUAGE, Markup.EXPRESSION, Markup.TIMING, Markup.ENTITY,
   193     Markup.Elements(Markup.LANGUAGE, Markup.EXPRESSION, Markup.TIMING, Markup.ENTITY,
   186       Markup.SORTING, Markup.TYPING, Markup.CLASS_PARAMETER, Markup.ML_TYPING,
   194       Markup.SORTING, Markup.TYPING, Markup.CLASS_PARAMETER, Markup.ML_TYPING,
   187       Markup.ML_BREAKPOINT, Markup.PATH, Markup.DOC, Markup.URL, Markup.MARKDOWN_PARAGRAPH,
   195       Markup.ML_BREAKPOINT, Markup.PATH, Markup.DOC, Markup.URL, Markup.MARKDOWN_PARAGRAPH,
   190   val tooltip_message_elements =
   198   val tooltip_message_elements =
   191     Markup.Elements(Markup.WRITELN, Markup.INFORMATION, Markup.WARNING, Markup.LEGACY, Markup.ERROR,
   199     Markup.Elements(Markup.WRITELN, Markup.INFORMATION, Markup.WARNING, Markup.LEGACY, Markup.ERROR,
   192       Markup.BAD)
   200       Markup.BAD)
   193 
   201 
   194   val caret_focus_elements = Markup.Elements(Markup.ENTITY)
   202   val caret_focus_elements = Markup.Elements(Markup.ENTITY)
   195 
       
   196   val text_color_elements = Markup.Elements(text_color.keySet)
       
   197 }
   203 }
   198 
   204 
   199 abstract class Rendering(
   205 abstract class Rendering(
   200   val snapshot: Document.Snapshot,
   206   val snapshot: Document.Snapshot,
   201   val options: Options,
   207   val options: Options,
   347   /* text foreground */
   353   /* text foreground */
   348 
   354 
   349   def foreground(range: Text.Range): List[Text.Info[Rendering.Color.Value]] =
   355   def foreground(range: Text.Range): List[Text.Info[Rendering.Color.Value]] =
   350     snapshot.select(range, Rendering.foreground_elements, _ =>
   356     snapshot.select(range, Rendering.foreground_elements, _ =>
   351       {
   357       {
   352         case Text.Info(_, elem) =>
   358         case info => Some(Rendering.foreground(info.info.name))
   353           if (elem.name == Markup.ANTIQUOTED) Some(Rendering.Color.antiquoted)
       
   354           else Some(Rendering.Color.quoted)
       
   355       })
   359       })
   356 
   360 
   357 
   361 
   358   /* caret focus */
   362   /* caret focus */
   359 
   363