rendering information and style sheets via settings;
authorwenzelm
Sat, 22 May 2010 19:42:20 +0200
changeset 37098c47653f3ec14
parent 37057 e70f9230c608
child 37099 d1840e304ed0
rendering information and style sheets via settings;
generalized Isabelle_System.try_read;
prefer getenv_strict in most situations;
etc/settings
src/Pure/System/isabelle_system.scala
src/Tools/jEdit/dist-template/etc/settings
src/Tools/jEdit/src/jedit/html_panel.scala
     1.1 --- a/etc/settings	Fri May 21 23:48:48 2010 +0200
     1.2 +++ b/etc/settings	Sat May 22 19:42:20 2010 +0200
     1.3 @@ -192,6 +192,14 @@
     1.4  
     1.5  
     1.6  ###
     1.7 +### Rendering information
     1.8 +###
     1.9 +
    1.10 +ISABELLE_FONT_FAMILY="IsabelleText"
    1.11 +ISABELLE_SYMBOLS="$ISABELLE_HOME/etc/symbols:$ISABELLE_HOME_USER/etc/symbols"
    1.12 +
    1.13 +
    1.14 +###
    1.15  ### External reasoning tools
    1.16  ###
    1.17  
     2.1 --- a/src/Pure/System/isabelle_system.scala	Fri May 21 23:48:48 2010 +0200
     2.2 +++ b/src/Pure/System/isabelle_system.scala	Sat May 22 19:42:20 2010 +0200
     2.3 @@ -93,7 +93,7 @@
     2.4      if (value != "") value else error("Undefined environment variable: " + name)
     2.5    }
     2.6  
     2.7 -  override def toString = getenv("ISABELLE_HOME")
     2.8 +  override def toString = getenv_strict("ISABELLE_HOME")
     2.9  
    2.10  
    2.11  
    2.12 @@ -164,10 +164,15 @@
    2.13  
    2.14    /* try_read */
    2.15  
    2.16 -  def try_read(path: String): String =
    2.17 +  def try_read(paths: Seq[String]): String =
    2.18    {
    2.19 -    val file = platform_file(path)
    2.20 -    if (file.isFile) Source.fromFile(file).mkString else ""
    2.21 +    val buf = new StringBuilder
    2.22 +    for {
    2.23 +      path <- paths
    2.24 +      file = platform_file(path) if file.isFile
    2.25 +      c <- (Source.fromFile(file) ++ Iterator.single('\n'))
    2.26 +    } buf.append(c)
    2.27 +    buf.toString
    2.28    }
    2.29  
    2.30  
    2.31 @@ -303,7 +308,7 @@
    2.32    /* components */
    2.33  
    2.34    def components(): List[String] =
    2.35 -    getenv("ISABELLE_COMPONENTS").split(":").toList
    2.36 +    getenv_strict("ISABELLE_COMPONENTS").split(":").toList
    2.37  
    2.38  
    2.39    /* find logics */
    2.40 @@ -324,17 +329,13 @@
    2.41  
    2.42    /* symbols */
    2.43  
    2.44 -  private def read_symbols(path: String): List[String] =
    2.45 -    Library.chunks(try_read(path)).map(_.toString).toList
    2.46 -
    2.47    val symbols = new Symbol.Interpretation(
    2.48 -    read_symbols("$ISABELLE_HOME/etc/symbols") :::
    2.49 -    read_symbols("$ISABELLE_HOME_USER/etc/symbols"))
    2.50 +    try_read(getenv_strict("ISABELLE_SYMBOLS").split(":").toList).split("\n").toList)
    2.51  
    2.52  
    2.53    /* fonts */
    2.54  
    2.55 -  val font_family = "IsabelleText"
    2.56 +  val font_family = getenv_strict("ISABELLE_FONT_FAMILY")
    2.57  
    2.58    def get_font(size: Int = 1, bold: Boolean = false): Font =
    2.59      new Font(font_family, if (bold) Font.BOLD else Font.PLAIN, size)
    2.60 @@ -357,6 +358,7 @@
    2.61        val ge = GraphicsEnvironment.getLocalGraphicsEnvironment()
    2.62        ge.registerFont(font)
    2.63        // workaround strange problem with Apple's Java 1.6 font manager
    2.64 +      // FIXME does not quite work!?
    2.65        if (bold_font.getFamily == font_family) ge.registerFont(bold_font)
    2.66        if (!check_font()) error("Failed to install IsabelleText fonts")
    2.67      }
     3.1 --- a/src/Tools/jEdit/dist-template/etc/settings	Fri May 21 23:48:48 2010 +0200
     3.2 +++ b/src/Tools/jEdit/dist-template/etc/settings	Sat May 22 19:42:20 2010 +0200
     3.3 @@ -6,6 +6,9 @@
     3.4  #JEDIT_JAVA_OPTIONS="-server -Xms128m -Xmx1024m -Xss4m $JEDIT_APPLE_PROPERTIES"
     3.5  JEDIT_OPTIONS="-reuseview -noserver -nobackground"
     3.6  
     3.7 +JEDIT_STYLE_SHEETS="$ISABELLE_HOME/lib/html/isabelle.css:$JEDIT_HOME/etc/isabelle-jedit.css:$ISABELLE_HOME_USER/etc/isabelle.css:$ISABELLE_HOME_USER/etc/isabelle-jedit.css"
     3.8 +
     3.9  ISABELLE_JEDIT_OPTIONS="-m xsymbols -m no_brackets -m no_type_brackets"
    3.10  
    3.11  ISABELLE_TOOLS="$ISABELLE_TOOLS:$JEDIT_HOME/lib/Tools"
    3.12 +
     4.1 --- a/src/Tools/jEdit/src/jedit/html_panel.scala	Fri May 21 23:48:48 2010 +0200
     4.2 +++ b/src/Tools/jEdit/src/jedit/html_panel.scala	Sat May 22 19:42:20 2010 +0200
     4.3 @@ -92,10 +92,7 @@
     4.4  <head>
     4.5  <style media="all" type="text/css">
     4.6  """ +
     4.7 -  system.try_read("$ISABELLE_HOME/lib/html/isabelle.css") + "\n" +
     4.8 -  system.try_read("$JEDIT_HOME/etc/isabelle-jedit.css") + "\n" +
     4.9 -  system.try_read("$ISABELLE_HOME_USER/etc/isabelle.css") + "\n" +
    4.10 -  system.try_read("$ISABELLE_HOME_USER/etc/isabelle-jedit.css") + "\n"
    4.11 +  system.try_read(system.getenv_strict("JEDIT_STYLE_SHEETS").split(":"))
    4.12  
    4.13    private val template_tail =
    4.14  """