src/Tools/jEdit/src/rendering.scala
changeset 52472 3a43a8b1ecb0
parent 52471 ff0e0bb81597
child 52530 99dd8b4ef3fe
equal deleted inserted replaced
52471:ff0e0bb81597 52472:3a43a8b1ecb0
    53       else name
    53       else name
    54     val icon = GUIUtilities.loadIcon(name1)
    54     val icon = GUIUtilities.loadIcon(name1)
    55     if (icon.getIconWidth < 0 || icon.getIconHeight < 0) error("Bad icon: " + name)
    55     if (icon.getIconWidth < 0 || icon.getIconHeight < 0) error("Bad icon: " + name)
    56     else icon
    56     else icon
    57   }
    57   }
    58 
       
    59   private val gutter_icons = Map(
       
    60     warning_pri -> load_icon("16x16/status/dialog-information.png"),
       
    61     legacy_pri -> load_icon("16x16/status/dialog-warning.png"),
       
    62     error_pri -> load_icon("16x16/status/dialog-error.png"))
       
    63 
       
    64   val tooltip_close_icon = load_icon("16x16/actions/document-close.png")
       
    65   val tooltip_detach_icon = load_icon("16x16/actions/window-new.png")
       
    66 
    58 
    67 
    59 
    68   /* jEdit font */
    60   /* jEdit font */
    69 
    61 
    70   def font_family(): String = jEdit.getProperty("view.font")
    62   def font_family(): String = jEdit.getProperty("view.font")
   384   }
   376   }
   385 
   377 
   386   val tooltip_margin: Int = options.int("jedit_tooltip_margin")
   378   val tooltip_margin: Int = options.int("jedit_tooltip_margin")
   387   val tooltip_bounds: Double = (options.real("jedit_tooltip_bounds") max 0.2) min 0.8
   379   val tooltip_bounds: Double = (options.real("jedit_tooltip_bounds") max 0.2) min 0.8
   388 
   380 
       
   381   lazy val tooltip_close_icon = Rendering.load_icon(options.string("tooltip_close_icon"))
       
   382   lazy val tooltip_detach_icon = Rendering.load_icon(options.string("tooltip_detach_icon"))
       
   383 
       
   384 
       
   385   private lazy val gutter_icons = Map(
       
   386     Rendering.warning_pri -> Rendering.load_icon(options.string("gutter_warning_icon")),
       
   387     Rendering.legacy_pri -> Rendering.load_icon(options.string("gutter_legacy_icon")),
       
   388     Rendering.error_pri -> Rendering.load_icon(options.string("gutter_error_icon")))
   389 
   389 
   390   def gutter_message(range: Text.Range): Option[Icon] =
   390   def gutter_message(range: Text.Range): Option[Icon] =
   391   {
   391   {
   392     val results =
   392     val results =
   393       snapshot.cumulate_markup[Int](range, 0, Some(Set(Markup.WARNING, Markup.ERROR)), _ =>
   393       snapshot.cumulate_markup[Int](range, 0, Some(Set(Markup.WARNING, Markup.ERROR)), _ =>
   400             }
   400             }
   401           case (pri, Text.Info(_, XML.Elem(Markup(Markup.ERROR, _), _))) =>
   401           case (pri, Text.Info(_, XML.Elem(Markup(Markup.ERROR, _), _))) =>
   402             pri max Rendering.error_pri
   402             pri max Rendering.error_pri
   403         })
   403         })
   404     val pri = (0 /: results) { case (p1, Text.Info(_, p2)) => p1 max p2 }
   404     val pri = (0 /: results) { case (p1, Text.Info(_, p2)) => p1 max p2 }
   405     Rendering.gutter_icons.get(pri)
   405     gutter_icons.get(pri)
   406   }
   406   }
   407 
   407 
   408 
   408 
   409   private val squiggly_colors = Map(
   409   private val squiggly_colors = Map(
   410     Rendering.writeln_pri -> writeln_color,
   410     Rendering.writeln_pri -> writeln_color,