--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/jEdit/patches/extended_styles Sun Jun 19 21:34:55 2011 +0200
@@ -0,0 +1,89 @@
+diff -ru jEdit/org/gjt/sp/jedit/Buffer.java jEdit-patched/org/gjt/sp/jedit/Buffer.java
+--- jEdit/org/gjt/sp/jedit/Buffer.java 2010-05-09 14:29:25.000000000 +0200
++++ jEdit-patched/org/gjt/sp/jedit/Buffer.java 2011-06-18 18:28:19.000000000 +0200
+@@ -2232,7 +2232,7 @@
+ start = next;
+ token = token.next;
+ }
+- if (token.id == Token.END || token.id == Token.NULL)
++ if (token.id == Token.END || (token.id % Token.ID_COUNT) == Token.NULL)
+ {
+ JOptionPane.showMessageDialog(jEdit.getActiveView(),
+ jEdit.getProperty("syntax-style-no-token.message"),
+diff -ru jEdit/org/gjt/sp/jedit/syntax/Token.java jEdit-patched/org/gjt/sp/jedit/syntax/Token.java
+--- jEdit/org/gjt/sp/jedit/syntax/Token.java 2010-05-09 14:29:24.000000000 +0200
++++ jEdit-patched/org/gjt/sp/jedit/syntax/Token.java 2011-06-18 18:28:10.000000000 +0200
+@@ -57,7 +57,7 @@
+ */
+ public static String tokenToString(byte token)
+ {
+- return (token == Token.END) ? "END" : TOKEN_TYPES[token];
++ return (token == Token.END) ? "END" : TOKEN_TYPES[token % ID_COUNT];
+ } //}}}
+
+ //{{{ Token types
+diff -ru jEdit/org/gjt/sp/util/SyntaxUtilities.java jEdit-patched/org/gjt/sp/util/SyntaxUtilities.java
+--- jEdit/org/gjt/sp/util/SyntaxUtilities.java 2010-05-09 14:29:29.000000000 +0200
++++ jEdit-patched/org/gjt/sp/util/SyntaxUtilities.java 2011-06-19 21:24:41.000000000 +0200
+@@ -26,6 +26,7 @@
+ //{{{ Imports
+ import java.awt.Color;
+ import java.awt.Font;
++import java.awt.font.TextAttribute;
+ import java.util.Locale;
+ import java.util.StringTokenizer;
+ import org.gjt.sp.jedit.syntax.SyntaxStyle;
+@@ -194,6 +195,22 @@
+ }
+
+ /**
++ * Style with sub/superscript font attribute.
++ */
++ public static SyntaxStyle scriptStyle(SyntaxStyle style, int script)
++ {
++ java.util.Map attributes = new java.util.HashMap();
++ attributes.put(TextAttribute.SUPERSCRIPT, new Integer(script));
++ return new SyntaxStyle(style.getForegroundColor(), style.getBackgroundColor(),
++ style.getFont().deriveFont(attributes));
++ }
++
++ public static SyntaxStyle boldStyle(SyntaxStyle style) {
++ return new SyntaxStyle(style.getForegroundColor(), style.getBackgroundColor(),
++ style.getFont().deriveFont(Font.BOLD));
++ }
++
++ /**
+ * Loads the syntax styles from the properties, giving them the specified
+ * base font family and size.
+ * @param family The font family
+@@ -203,10 +220,10 @@
+ */
+ public static SyntaxStyle[] loadStyles(String family, int size, boolean color)
+ {
+- SyntaxStyle[] styles = new SyntaxStyle[Token.ID_COUNT];
++ SyntaxStyle[] styles = new SyntaxStyle[4 * Token.ID_COUNT + 1];
+
+ // start at 1 not 0 to skip Token.NULL
+- for(int i = 1; i < styles.length; i++)
++ for(int i = 1; i < Token.ID_COUNT; i++)
+ {
+ try
+ {
+@@ -223,6 +240,17 @@
+ }
+ }
+
++ styles[0] = new SyntaxStyle(Color.black, null, new Font(family, 0, size));
++ for(int i = 0; i < Token.ID_COUNT; i++)
++ {
++ styles[i + Token.ID_COUNT] = scriptStyle(styles[i], -1);
++ styles[i + 2 * Token.ID_COUNT] = scriptStyle(styles[i], 1);
++ styles[i + 3 * Token.ID_COUNT] = boldStyle(styles[i]);
++ }
++ styles[0] = null;
++ styles[4 * Token.ID_COUNT] =
++ new SyntaxStyle(Color.white, null, new Font(family, 0, 1));
++
+ return styles;
+ } //}}}
+
--- a/src/Tools/jEdit/patches/scriptstyles Sun Jun 19 15:31:16 2011 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-diff -ru jEdit/org/gjt/sp/jedit/Buffer.java jEdit-patched/org/gjt/sp/jedit/Buffer.java
---- jEdit/org/gjt/sp/jedit/Buffer.java 2010-05-09 14:29:25.000000000 +0200
-+++ jEdit-patched/org/gjt/sp/jedit/Buffer.java 2011-06-18 18:28:19.000000000 +0200
-@@ -2232,7 +2232,7 @@
- start = next;
- token = token.next;
- }
-- if (token.id == Token.END || token.id == Token.NULL)
-+ if (token.id == Token.END || (token.id % Token.ID_COUNT) == Token.NULL)
- {
- JOptionPane.showMessageDialog(jEdit.getActiveView(),
- jEdit.getProperty("syntax-style-no-token.message"),
-diff -ru jEdit/org/gjt/sp/jedit/syntax/Token.java jEdit-patched/org/gjt/sp/jedit/syntax/Token.java
---- jEdit/org/gjt/sp/jedit/syntax/Token.java 2010-05-09 14:29:24.000000000 +0200
-+++ jEdit-patched/org/gjt/sp/jedit/syntax/Token.java 2011-06-18 18:28:10.000000000 +0200
-@@ -57,7 +57,7 @@
- */
- public static String tokenToString(byte token)
- {
-- return (token == Token.END) ? "END" : TOKEN_TYPES[token];
-+ return (token == Token.END) ? "END" : TOKEN_TYPES[token % ID_COUNT];
- } //}}}
-
- //{{{ Token types
-diff -ru jEdit/org/gjt/sp/util/SyntaxUtilities.java jEdit-patched/org/gjt/sp/util/SyntaxUtilities.java
---- jEdit/org/gjt/sp/util/SyntaxUtilities.java 2010-05-09 14:29:29.000000000 +0200
-+++ jEdit-patched/org/gjt/sp/util/SyntaxUtilities.java 2011-06-18 18:28:10.000000000 +0200
-@@ -26,6 +26,7 @@
- //{{{ Imports
- import java.awt.Color;
- import java.awt.Font;
-+import java.awt.font.TextAttribute;
- import java.util.Locale;
- import java.util.StringTokenizer;
- import org.gjt.sp.jedit.syntax.SyntaxStyle;
-@@ -194,6 +195,17 @@
- }
-
- /**
-+ * Style with sub/superscript font attribute.
-+ */
-+ public static SyntaxStyle scriptStyle(SyntaxStyle style, int script)
-+ {
-+ java.util.Map attributes = new java.util.HashMap();
-+ attributes.put(TextAttribute.SUPERSCRIPT, new Integer(script));
-+ return new SyntaxStyle(style.getForegroundColor(), style.getBackgroundColor(),
-+ style.getFont().deriveFont(attributes));
-+ }
-+
-+ /**
- * Loads the syntax styles from the properties, giving them the specified
- * base font family and size.
- * @param family The font family
-@@ -203,10 +215,10 @@
- */
- public static SyntaxStyle[] loadStyles(String family, int size, boolean color)
- {
-- SyntaxStyle[] styles = new SyntaxStyle[Token.ID_COUNT];
-+ SyntaxStyle[] styles = new SyntaxStyle[3 * Token.ID_COUNT + 1];
-
- // start at 1 not 0 to skip Token.NULL
-- for(int i = 1; i < styles.length; i++)
-+ for(int i = 1; i < Token.ID_COUNT; i++)
- {
- try
- {
-@@ -223,6 +235,16 @@
- }
- }
-
-+ styles[0] = new SyntaxStyle(Color.black, null, new Font(family, 0, size));
-+ for(int i = 0; i < Token.ID_COUNT; i++)
-+ {
-+ styles[i + Token.ID_COUNT] = scriptStyle(styles[i], -1);
-+ styles[i + 2 * Token.ID_COUNT] = scriptStyle(styles[i], 1);
-+ }
-+ styles[0] = null;
-+ styles[3 * Token.ID_COUNT] =
-+ new SyntaxStyle(Color.black, null, new Font(family, 0, 1));
-+
- return styles;
- } //}}}
-
--- a/src/Tools/jEdit/src/plugin.scala Sun Jun 19 15:31:16 2011 +0200
+++ b/src/Tools/jEdit/src/plugin.scala Sun Jun 19 21:34:55 2011 +0200
@@ -279,7 +279,7 @@
val family = jEdit.getProperty("view.font")
val size = jEdit.getIntegerProperty("view.fontsize", 12)
val styles = SyntaxUtilities.loadStyles(family, size)
- _extended_styles = (styles.length == JEditToken.ID_COUNT * 3 + 1)
+ _extended_styles = (styles.length == JEditToken.ID_COUNT * 4 + 1)
}
--- a/src/Tools/jEdit/src/token_markup.scala Sun Jun 19 15:31:16 2011 +0200
+++ b/src/Tools/jEdit/src/token_markup.scala Sun Jun 19 21:34:55 2011 +0200
@@ -25,17 +25,18 @@
def subscript(i: Byte): Byte = { check_range(i); (i + plain_range).toByte }
def superscript(i: Byte): Byte = { check_range(i); (i + 2 * plain_range).toByte }
- val hidden: Byte = (3 * plain_range).toByte
+ def bold(i: Byte): Byte = { check_range(i); (i + 3 * plain_range).toByte }
+ val hidden: Byte = (4 * plain_range).toByte
private def extended_styles(symbols: Symbol.Interpretation, text: CharSequence)
: Map[Text.Offset, Byte => Byte] =
{
if (Isabelle.extended_styles) {
// FIXME \\<^bsub> \\<^esub> \\<^bsup> \\<^esup>
- // FIXME \\<^bold>
def ctrl_style(sym: String): Option[Byte => Byte] =
if (symbols.is_subscript_decoded(sym)) Some(subscript(_))
else if (symbols.is_superscript_decoded(sym)) Some(superscript(_))
+ else if (symbols.is_bold_decoded(sym)) Some(bold(_))
else None
var result = Map[Text.Offset, Byte => Byte]()