src/Tools/jEdit/patches/jedit/extended_styles
author wenzelm
Thu, 05 Sep 2013 12:33:51 +0200
changeset 53415 9ebab8b7d73c
parent 50306 b655d2d0406d
permissions -rw-r--r--
updated to jedit_build-20130905 which is based on jedit-5.1.0; added jsr305-2.0.0.jar from http://code.google.com/p/findbugs (via ivy cache), which is required to resolve javax.annotation.*;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53415
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
     1
diff -ru 5.1.0/jEdit/org/gjt/sp/jedit/gui/StyleEditor.java 5.1.0/jEdit-patched/org/gjt/sp/jedit/gui/StyleEditor.java
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
     2
--- 5.1.0/jEdit/org/gjt/sp/jedit/gui/StyleEditor.java	2013-07-28 19:03:38.000000000 +0200
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
     3
+++ 5.1.0/jEdit-patched/org/gjt/sp/jedit/gui/StyleEditor.java	2013-09-05 10:51:29.192192327 +0200
50306
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
     4
@@ -79,7 +79,7 @@
48786
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
     5
 			start = next;
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
     6
 			token = token.next;
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
     7
 		}
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
     8
-		if (token.id == Token.END || token.id == Token.NULL)
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
     9
+		if (token.id == Token.END || (token.id % Token.ID_COUNT) == Token.NULL)
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    10
 		{
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    11
 			JOptionPane.showMessageDialog(textArea.getView(),
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    12
 				jEdit.getProperty("syntax-style-no-token.message"),
53415
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    13
diff -ru 5.1.0/jEdit/org/gjt/sp/jedit/syntax/Chunk.java 5.1.0/jEdit-patched/org/gjt/sp/jedit/syntax/Chunk.java
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    14
--- 5.1.0/jEdit/org/gjt/sp/jedit/syntax/Chunk.java	2013-07-28 19:03:51.000000000 +0200
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    15
+++ 5.1.0/jEdit-patched/org/gjt/sp/jedit/syntax/Chunk.java	2013-09-05 10:51:29.192192327 +0200
50306
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    16
@@ -256,9 +256,9 @@
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    17
 	//{{{ Package private members
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    18
 
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    19
 	//{{{ Instance variables
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    20
-	SyntaxStyle style;
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    21
+	public SyntaxStyle style;
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    22
 	// set up after init()
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    23
-	float width;
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    24
+	public float width;
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    25
 	//}}}
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    26
 
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    27
 	//{{{ Chunk constructor
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    28
@@ -506,7 +506,7 @@
48786
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    29
 	// this is either style.getBackgroundColor() or
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    30
 	// styles[defaultID].getBackgroundColor()
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    31
 	private Color background;
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    32
-	private String str;
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    33
+	public String str;
50306
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    34
 	private GlyphVector[] glyphs;
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    35
 	//}}}
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    36
 
53415
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    37
diff -ru 5.1.0/jEdit/org/gjt/sp/jedit/syntax/Token.java 5.1.0/jEdit-patched/org/gjt/sp/jedit/syntax/Token.java
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    38
--- 5.1.0/jEdit/org/gjt/sp/jedit/syntax/Token.java	2013-07-28 19:03:51.000000000 +0200
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    39
+++ 5.1.0/jEdit-patched/org/gjt/sp/jedit/syntax/Token.java	2013-09-05 10:51:29.192192327 +0200
48786
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    40
@@ -57,7 +57,7 @@
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    41
 	 */
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    42
 	public static String tokenToString(byte token)
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    43
 	{
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    44
-		return (token == Token.END) ? "END" : TOKEN_TYPES[token];
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    45
+		return (token == Token.END) ? "END" : TOKEN_TYPES[token % ID_COUNT];
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    46
 	} //}}}
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    47
 
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    48
 	//{{{ Token types
53415
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    49
diff -ru 5.1.0/jEdit/org/gjt/sp/util/SyntaxUtilities.java 5.1.0/jEdit-patched/org/gjt/sp/util/SyntaxUtilities.java
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    50
--- 5.1.0/jEdit/org/gjt/sp/util/SyntaxUtilities.java	2013-07-28 19:03:53.000000000 +0200
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    51
+++ 5.1.0/jEdit-patched/org/gjt/sp/util/SyntaxUtilities.java	2013-09-05 10:51:29.192192327 +0200
48786
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    52
@@ -194,7 +194,24 @@
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    53
 	{
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    54
 		return loadStyles(family,size,true);
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    55
 	}
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    56
-	
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    57
+
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    58
+	/**
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    59
+	 * Extended styles derived from the user-specified style array.
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    60
+	 */
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    61
+
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    62
+	public static class StyleExtender
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    63
+	{
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    64
+		public SyntaxStyle[] extendStyles(SyntaxStyle[] styles)
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    65
+		{
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    66
+			return styles;
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    67
+		}
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    68
+	}
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    69
+	volatile private static StyleExtender _styleExtender = new StyleExtender();
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    70
+	public static void setStyleExtender(StyleExtender ext)
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    71
+	{
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    72
+		_styleExtender = ext;
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    73
+	}
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    74
+
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    75
 	/**
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    76
 	 * Loads the syntax styles from the properties, giving them the specified
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    77
 	 * base font family and size.
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    78
@@ -224,9 +241,9 @@
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    79
 				Log.log(Log.ERROR,StandardUtilities.class,e);
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    80
 			}
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    81
 		}
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    82
-
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    83
-		return styles;
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    84
+		styles[0] = new SyntaxStyle(Color.black, null, new Font(family, 0, size));
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    85
+		return _styleExtender.extendStyles(styles);
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    86
 	} //}}}
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    87
-	
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    88
+
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    89
 	private SyntaxUtilities(){}
2b08d10a2f75 updated to jedit-4.5.2 (still unchanged);
wenzelm
parents:
diff changeset
    90
 }
53415
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    91
diff -ru 5.1.0/jEdit/org/gjt/sp/jedit/textarea/TextArea.java 5.1.0/jEdit-patched/org/gjt/sp/jedit/textarea/TextArea.java
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    92
--- 5.1.0/jEdit/org/gjt/sp/jedit/textarea/TextArea.java	2013-07-28 19:03:32.000000000 +0200
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    93
+++ 5.1.0/jEdit-patched/org/gjt/sp/jedit/textarea/TextArea.java	2013-09-05 10:51:29.196192309 +0200
9ebab8b7d73c updated to jedit_build-20130905 which is based on jedit-5.1.0;
wenzelm
parents: 50306
diff changeset
    94
@@ -907,6 +907,11 @@
50306
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    95
 		return chunkCache.getLineInfo(screenLine).physicalLine;
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    96
 	} //}}}
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    97
 
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    98
+        public Chunk getChunksOfScreenLine(int screenLine)
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
    99
+        {
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
   100
+                return chunkCache.getLineInfo(screenLine).chunks;
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
   101
+        }
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
   102
+
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
   103
 	//{{{ getScreenLineOfOffset() method
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
   104
 	/**
b655d2d0406d updated to jedit-5.0.0;
wenzelm
parents: 50305
diff changeset
   105
 	 * Returns the screen (wrapped) line containing the specified offset.