From: <kp...@us...> - 2008-12-06 17:38:49
|
Revision: 14148 http://jedit.svn.sourceforge.net/jedit/?rev=14148&view=rev Author: kpouer Date: 2008-12-06 17:38:44 +0000 (Sat, 06 Dec 2008) Log Message: ----------- updated doc to 1.5.1 Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2008-12-06 17:34:21 UTC (rev 14147) +++ plugins/Highlight/trunk/Highlight.props 2008-12-06 17:38:44 UTC (rev 14148) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.5.0 +plugin.gatchan.highlight.HighlightPlugin.version=1.5.1 plugin.gatchan.highlight.HighlightPlugin.docs=Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2008-12-06 17:34:21 UTC (rev 14147) +++ plugins/Highlight/trunk/docs/Highlight.html 2008-12-06 17:38:44 UTC (rev 14148) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.5.0 (Dec 06, 2008)</span><br> + <span style="font-weight:bold">Version 1.5.1 (Dec 06, 2008)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,7 +42,7 @@ </p> <h2>History</h2> <ul> - <li>1.5.0 (Dec 06, 2008)</li> + <li>1.5.1 (Dec 06, 2008)</li> <ul> <li>Added the ability to choose the layer and alpha blending level (feature #1884608}</li> <li>Added a square around the highlighted text</li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2009-01-23 17:17:09
|
Revision: 14435 http://jedit.svn.sourceforge.net/jedit/?rev=14435&view=rev Author: kpouer Date: 2009-01-23 17:16:55 +0000 (Fri, 23 Jan 2009) Log Message: ----------- fixed highlight update when some folds are closed Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2009-01-23 13:34:22 UTC (rev 14434) +++ plugins/Highlight/trunk/Highlight.props 2009-01-23 17:16:55 UTC (rev 14435) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.5.1 +plugin.gatchan.highlight.HighlightPlugin.version=1.5.2 plugin.gatchan.highlight.HighlightPlugin.docs=Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2009-01-23 13:34:22 UTC (rev 14434) +++ plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2009-01-23 17:16:55 UTC (rev 14435) @@ -35,7 +35,7 @@ //}}} /** - * The Highlighter is the TextAreaExtension that will look for some String to + * The Highlighter is the TextAreaExtension that will look for some String to * highlightList in the textarea and draw a rectangle in it's background. * * @author Matthieu Casanova @@ -53,7 +53,7 @@ private AlphaComposite blend; private float alpha; public static boolean square; - + public static Color squareColor; //{{{ Highlighter constructor @@ -64,7 +64,7 @@ highlightManager = HighlightManagerTableModel.getManager(); this.textArea = textArea; } //}}} - + //{{{ setAlphaComposite() method public void setAlphaComposite(float alpha) { @@ -244,7 +244,7 @@ gfx.setColor(squareColor); gfx.drawRect(startX, y, endX - startX, fm.getHeight() - 1); } - + gfx.setColor(oldColor); gfx.setComposite(oldComposite); } //}}} @@ -253,6 +253,7 @@ public void highlightUpdated(boolean highlightEnabled) { int firstLine = textArea.getFirstPhysicalLine(); - textArea.invalidateLineRange(firstLine, firstLine + textArea.getVisibleLines()); + int lastLine = textArea.getLastPhysicalLine(); + textArea.invalidateLineRange(firstLine, lastLine); } //}}} } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sh...@us...> - 2009-01-29 23:15:37
|
Revision: 14515 http://jedit.svn.sourceforge.net/jedit/?rev=14515&view=rev Author: shlomy Date: 2009-01-29 23:15:35 +0000 (Thu, 29 Jan 2009) Log Message: ----------- Added an action to highlight the hypersearch results according to the highlight settings. Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/actions.xml plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java Added Paths: ----------- plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2009-01-29 21:59:42 UTC (rev 14514) +++ plugins/Highlight/trunk/Highlight.props 2009-01-29 23:15:35 UTC (rev 14515) @@ -21,6 +21,7 @@ gatchan-highlightcurrentSearch \ gatchan-highlightcurrentSearch-session \ gatchan-highlightcurrentSearch-buffer \ + gatchan-highlightHyperSearchResults \ - \ gatchan-removeAllHighlights \ gatchan-enableHighlights \ @@ -39,6 +40,7 @@ gatchan-highlightcurrentSearch.label=Highlight current search gatchan-highlightcurrentSearch-session.label=Highlight current search (session scope) gatchan-highlightcurrentSearch-buffer.label=Highlight current search (buffer scope) +gatchan-highlightHyperSearchResults.label=Highlight hypersearch results gatchan-removeAllHighlights.label=Remove all gatchan-enableHighlights.label=Enable highlights gatchan-disableHighlights.label=Disable highlights Modified: plugins/Highlight/trunk/actions.xml =================================================================== --- plugins/Highlight/trunk/actions.xml 2009-01-29 21:59:42 UTC (rev 14514) +++ plugins/Highlight/trunk/actions.xml 2009-01-29 23:15:35 UTC (rev 14515) @@ -92,4 +92,9 @@ gatchan.highlight.HighlightPlugin.addHighlight(highlight); </CODE> </ACTION> + <ACTION NAME="gatchan-highlightHyperSearchResults"> + <CODE> + gatchan.highlight.HighlightPlugin.highlightHyperSearchResult(view); + </CODE> + </ACTION> </ACTIONS> Added: plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java (rev 0) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java 2009-01-29 23:15:35 UTC (rev 14515) @@ -0,0 +1,163 @@ +package gatchan.highlight; + +import java.awt.Color; +import java.awt.Component; +import java.util.Collections; +import java.util.Vector; + +import javax.swing.JComponent; +import javax.swing.JTree; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeCellRenderer; + +import org.gjt.sp.jedit.View; +import org.gjt.sp.jedit.jEdit; +import org.gjt.sp.jedit.search.HyperSearchOperationNode; +import org.gjt.sp.jedit.search.HyperSearchResult; +import org.gjt.sp.jedit.search.HyperSearchResults; +import org.gjt.sp.jedit.search.SearchMatcher; +import org.gjt.sp.jedit.search.SearchMatcher.Match; + +public class HighlightHypersearchResults { + + private static final String HYPERSEARCH = "hypersearch-results"; + private View view; + + public HighlightHypersearchResults(View view) { + this.view = view; + } + + public void highlight() { + JComponent dockable = view.getDockableWindowManager().getDockable(HYPERSEARCH); + if (dockable == null) + return; + if (! (dockable instanceof HyperSearchResults)) + return; + HyperSearchResults hrd = (HyperSearchResults) dockable; + JTree tree = hrd.getTree(); + TreeCellRenderer renderer = tree.getCellRenderer(); + hrd.getTree().setCellRenderer(new HighlightTreeCellRenderer(renderer)); + } + + @SuppressWarnings("serial") + class HighlightTreeCellRenderer extends DefaultTreeCellRenderer + { + private TreeCellRenderer renderer; + + public HighlightTreeCellRenderer(TreeCellRenderer renderer) { + this.renderer = renderer; + } + @Override + public Component getTreeCellRendererComponent(JTree tree, Object value, + boolean sel, boolean expanded, boolean leaf, int row, + boolean hasFocus) + { + Component defaultComponent = renderer.getTreeCellRendererComponent(tree, + value, sel, expanded, leaf, row, hasFocus); + if (! (value instanceof DefaultMutableTreeNode)) + return defaultComponent; + DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; + Object obj = node.getUserObject(); + if (! (obj instanceof HyperSearchResult)) + return defaultComponent; + HyperSearchResult result = (HyperSearchResult) obj; + String s = getHighlightedString(result.toString()); + return renderer.getTreeCellRendererComponent(tree, + new DefaultMutableTreeNode(s), sel, expanded, leaf, row, hasFocus); + } + private String getHighlightedString(String s) + { + class HighlightPosition implements Comparable<HighlightPosition> { + public int pos; + public Highlight highlight; + public boolean start; + public HighlightPosition(int p, Highlight h, boolean s) + { + pos = p; + highlight = h; + start = s; + } + public int compareTo(HighlightPosition hlPos) + { + if (pos < hlPos.pos) + return (-1); + if (pos > hlPos.pos) + return 1; + return 0; + } + } + HighlightManager manager = HighlightManagerTableModel.getManager(); + Vector<HighlightPosition> highlights = new Vector<HighlightPosition>(); + try + { + manager.getReadLock(); + for (int hi = 0; hi < manager.countHighlights(); hi++) + { + Highlight highlight = manager.getHighlight(hi); + SearchMatcher matcher = highlight.getSearchMatcher(); + int i = 0; + Match m = null; + while ((m = matcher.nextMatch(s.substring(i), true, true, true, false)) != null) + { + highlights.add(new HighlightPosition(i + m.start, highlight, true)); + highlights.add(new HighlightPosition(i + m.end, highlight, false)); + i += m.end; + } + } + } + finally + { + manager.releaseLock(); + } + Collections.sort(highlights); + StringBuffer sb = new StringBuffer("<html><body>"); + int i = 0; + for (HighlightPosition hlPos: highlights) + { + appendString2html(sb, s.substring(i, hlPos.pos)); + if (hlPos.start) + { + Color c = hlPos.highlight.getColor(); + sb.append("<font style bgcolor=\"#"); + appendColorSpec(sb, c); + sb.append("\"/>"); + } + else + sb.append("</font>"); + i = hlPos.pos; + } + appendString2html(sb, s.substring(i)); + sb.append("</body></html>"); + return sb.toString(); + } + private void appendColorSpec(StringBuffer sb, Color c) + { + sb.append(Integer.toHexString(c.getRed())); + if (c.getGreen() <= 0xf) + sb.append("0"); + sb.append(Integer.toHexString(c.getGreen())); + if (c.getBlue() <= 0xf) + sb.append("0"); + sb.append(Integer.toHexString(c.getBlue())); + } + private void appendString2html(StringBuffer sb, String s) + { + for (int i = 0; i < s.length(); i++) + { + char c = s.charAt(i); + String r; + switch (c) { + case '"': r = """; break; + case '\'': r = "'"; break; + case '&': r = "&"; break; + case '<': r = "<"; break; + case '>': r = ">"; break; + default: r = String.valueOf(c); break; + } + sb.append(r); + } + } + } +} Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2009-01-29 21:59:42 UTC (rev 14514) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2009-01-29 23:15:35 UTC (rev 14515) @@ -341,6 +341,12 @@ highlightManager.setHighlightEnable(!highlightManager.isHighlightEnable()); } //}}} + public static void highlightHyperSearchResult(View view) + { + HighlightHypersearchResults h = new HighlightHypersearchResults(view); + h.highlight(); + } + //{{{ isHighlightEnable() method public static boolean isHighlightEnable() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sh...@us...> - 2009-01-30 13:18:56
|
Revision: 14522 http://jedit.svn.sourceforge.net/jedit/?rev=14522&view=rev Author: shlomy Date: 2009-01-30 13:18:55 +0000 (Fri, 30 Jan 2009) Log Message: ----------- Added an option to highlight hypersearch results automatically (without the need for the action). Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2009-01-30 13:16:19 UTC (rev 14521) +++ plugins/Highlight/trunk/Highlight.props 2009-01-30 13:18:55 UTC (rev 14522) @@ -77,6 +77,7 @@ gatchan.highlight.caretHighlight.subsequence.text=Highlight subsequences (if checked, the same highlight can be found several times inside the same word) gatchan.highlight.caretHighlight.whitespace.text=Highlight whitespace words gatchan.highlight.caretHighlight.onlyWords.text=Highlight only words +gatchan.highlight.hyperSearchResults.text=Highlight hypersearch results gatchan.highlight.caretHighlight.text=Highlight word at caret gatchan.highlight.caretHighlight.ignoreCase.text=ignore case gatchan.highlight.caretHighlight.entireWord.text=Entire word (this option could be slow) Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java 2009-01-30 13:16:19 UTC (rev 14521) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java 2009-01-30 13:18:55 UTC (rev 14522) @@ -3,19 +3,16 @@ import java.awt.Color; import java.awt.Component; import java.util.Collections; -import java.util.LinkedList; import java.util.Vector; import javax.swing.JComponent; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; -import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeCellRenderer; import org.gjt.sp.jedit.View; import org.gjt.sp.jedit.jEdit; -import org.gjt.sp.jedit.search.HyperSearchOperationNode; import org.gjt.sp.jedit.search.HyperSearchResult; import org.gjt.sp.jedit.search.HyperSearchResults; import org.gjt.sp.jedit.search.SearchMatcher; @@ -23,25 +20,41 @@ public class HighlightHypersearchResults { - private static final String HYPERSEARCH = "hypersearch-results"; + public static final String HYPERSEARCH = "hypersearch-results"; private View view; public HighlightHypersearchResults(View view) { this.view = view; } - - public void highlight() { + + private JTree getHyperSearchTree() { JComponent dockable = view.getDockableWindowManager().getDockable(HYPERSEARCH); if (dockable == null) - return; + return null; if (! (dockable instanceof HyperSearchResults)) + return null; + HyperSearchResults hrd = (HyperSearchResults) dockable; + return hrd.getTree(); + } + + public void start() { + JTree tree = getHyperSearchTree(); + if (tree == null) return; - HyperSearchResults hrd = (HyperSearchResults) dockable; - JTree tree = hrd.getTree(); TreeCellRenderer renderer = tree.getCellRenderer(); - hrd.getTree().setCellRenderer(new HighlightTreeCellRenderer(renderer)); + if (! (renderer instanceof HighlightTreeCellRenderer)) + tree.setCellRenderer(new HighlightTreeCellRenderer(renderer)); } + public void stop() { + JTree tree = getHyperSearchTree(); + if (tree == null) + return; + TreeCellRenderer renderer = tree.getCellRenderer(); + if (renderer instanceof HighlightTreeCellRenderer) + tree.setCellRenderer(((HighlightTreeCellRenderer)renderer).getOriginal()); + } + @SuppressWarnings("serial") class HighlightTreeCellRenderer extends DefaultTreeCellRenderer { @@ -50,6 +63,9 @@ public HighlightTreeCellRenderer(TreeCellRenderer renderer) { this.renderer = renderer; } + public TreeCellRenderer getOriginal() { + return renderer; + } @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, @@ -58,7 +74,9 @@ Component defaultComponent = renderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if (! (value instanceof DefaultMutableTreeNode)) - return defaultComponent; + return defaultComponent; + if (! jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_HYPERSEARCH_RESULTS)) + return defaultComponent; DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; Object obj = node.getUserObject(); if (! (obj instanceof HyperSearchResult)) Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2009-01-30 13:16:19 UTC (rev 14521) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2009-01-30 13:18:55 UTC (rev 14522) @@ -66,7 +66,7 @@ private boolean highlightWordAtCaretEntireWord; private boolean highlightWordAtCaretWhitespace; private boolean highlightWordAtCaretOnlyWords; - + /** * If true the highlight will be appended, if false the highlight will replace the previous one. */ Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2009-01-30 13:16:19 UTC (rev 14521) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2009-01-30 13:18:55 UTC (rev 14522) @@ -53,6 +53,7 @@ public static final String PROP_HIGHLIGHT_WORD_AT_CARET_SUBSEQUENCE = "gatchan.highlight.caretHighlight.subsequence"; public static final String PROP_HIGHLIGHT_WORD_AT_CARET_WHITESPACE = "gatchan.highlight.caretHighlight.whitespace"; public static final String PROP_HIGHLIGHT_WORD_AT_CARET_ONLYWORDS = "gatchan.highlight.caretHighlight.onlyWords"; + public static final String PROP_HIGHLIGHT_HYPERSEARCH_RESULTS = "gatchan.highlight.hyperSearchResults"; public static final String PROP_LAYER_PROPERTY = "gatchan.highlight.layer"; public static final String PROP_ALPHA = "gatchan.highlight.alpha"; @@ -72,6 +73,7 @@ private JCheckBox caretHighlightSubsequence; private JCheckBox wordAtCaretWhitespace; private JCheckBox wordAtCaretOnlyWords; + private JCheckBox highlightHypersearch; private TextAreaExtensionLayerChooser layerChooser; private JSlider alphaSlider; @@ -123,6 +125,7 @@ } }); squareColor.setEnabled(square.isSelected()); + addComponent(highlightHypersearch = createCheckBox(PROP_HIGHLIGHT_HYPERSEARCH_RESULTS)); addSeparator(PROP_HIGHLIGHT_WORD_AT_CARET + ".text"); addComponent(highlightWordAtCaret = createCheckBox(PROP_HIGHLIGHT_WORD_AT_CARET)); @@ -151,6 +154,7 @@ jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET_ENTIRE_WORD, entireWord.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET_WHITESPACE, wordAtCaretWhitespace.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET_ONLYWORDS, wordAtCaretOnlyWords.isSelected()); + jEdit.setBooleanProperty(PROP_HIGHLIGHT_HYPERSEARCH_RESULTS, highlightHypersearch.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_SUBSEQUENCE, highlightSubsequence.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_CYCLE_COLOR, cycleColor.isSelected()); Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2009-01-30 13:16:19 UTC (rev 14521) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2009-01-30 13:18:55 UTC (rev 14522) @@ -25,9 +25,12 @@ import org.gjt.sp.jedit.*; import org.gjt.sp.jedit.visitors.JEditVisitorAdapter; import org.gjt.sp.jedit.search.SearchAndReplace; +import org.gjt.sp.jedit.gui.DockableWindowManager; +import org.gjt.sp.jedit.msg.DockableWindowUpdate; import org.gjt.sp.jedit.msg.EditPaneUpdate; import org.gjt.sp.jedit.msg.BufferUpdate; import org.gjt.sp.jedit.msg.PropertiesChanged; +import org.gjt.sp.jedit.msg.ViewUpdate; import org.gjt.sp.jedit.textarea.JEditTextArea; import org.gjt.sp.jedit.textarea.TextAreaPainter; import org.gjt.sp.util.Log; @@ -66,6 +69,7 @@ highlightManager = HighlightManagerTableModel.createInstance(highlightFile); highlightManager.propertiesChanged(); jEdit.visit(new TextAreaInitializer()); + jEdit.visit(new ViewInitializer()); } //}}} //{{{ stop() method @@ -87,6 +91,7 @@ } jEdit.visit(new TextAreaUninitializer()); + jEdit.visit(new ViewUninitializer()); highlightManager = null; } //}}} @@ -129,11 +134,49 @@ return highlighter; } //}}} + //{{{ initView() method + /** + * Initialize the view with a hypersearch results highlighter. + * + * @param view the view whose hypersearch results to initialize + * @return the new highlighter for the hypersearch results of the view + */ + private HighlightHypersearchResults initView(View view) + { + HighlightHypersearchResults highlighter = new HighlightHypersearchResults(view); + highlighter.start(); + view.getDockableWindowManager().putClientProperty( + HighlightHypersearchResults.class, highlighter); + return highlighter; + } //}}} + + //{{{ uninitView() method + /** + * Remove the hypersearch results highlighter from the view. + * + * @param view the view whose hypersearch results to initialize + */ + private static void uninitView(View view) + { + HighlightHypersearchResults highlighter = (HighlightHypersearchResults) + view.getDockableWindowManager().getClientProperty( + HighlightHypersearchResults.class); + if (highlighter == null) + return; + highlighter.stop(); + view.getDockableWindowManager().putClientProperty( + HighlightHypersearchResults.class, null); + } //}}} + //{{{ handleMessage() method public void handleMessage(EBMessage message) { - if (message instanceof EditPaneUpdate) + if (message instanceof ViewUpdate) { + handleViewMessage((ViewUpdate) message); + } + else if (message instanceof EditPaneUpdate) + { handleEditPaneMessage((EditPaneUpdate) message); } else if (message instanceof BufferUpdate) @@ -144,6 +187,22 @@ highlightManager.bufferClosed(bufferUpdate.getBuffer()); } } + else if (message instanceof DockableWindowUpdate) + { + DockableWindowUpdate dockableUpdate = (DockableWindowUpdate) message; + if (dockableUpdate.getWhat() == DockableWindowUpdate.ACTIVATED && + HighlightHypersearchResults.HYPERSEARCH.equals(dockableUpdate.getDockable())) + { + View view = ((DockableWindowManager) dockableUpdate.getSource()).getView(); + HighlightHypersearchResults highlighter = (HighlightHypersearchResults) + view.getDockableWindowManager().getClientProperty( + HighlightHypersearchResults.class); + if (highlighter == null) + initView(view); + else + highlighter.start(); + } + } else if (message instanceof PropertiesChanged) { int layer = jEdit.getIntegerProperty(HighlightOptionPane.PROP_LAYER_PROPERTY, TextAreaPainter.HIGHEST_LAYER); @@ -168,6 +227,22 @@ } } //}}} + //{{{ handleViewMessage() method + private void handleViewMessage(ViewUpdate message) + { + View view = message.getView(); + Object what = message.getWhat(); + + if (what == ViewUpdate.CREATED) + { + initView(view); + } + else if (what == ViewUpdate.CLOSED) + { + uninitView(view); + } + } //}}} + //{{{ handleEditPaneMessage() method private void handleEditPaneMessage(EditPaneUpdate message) { @@ -344,8 +419,13 @@ //{{{ highlightHyperSearchResult() method public static void highlightHyperSearchResult(View view) { - HighlightHypersearchResults h = new HighlightHypersearchResults(view); - h.highlight(); + + HighlightHypersearchResults h = (HighlightHypersearchResults) + view.getDockableWindowManager().getClientProperty( + HighlightHypersearchResults.class); + if (h == null) + return; + h.start(); } //}}} //{{{ isHighlightEnable() method @@ -418,4 +498,22 @@ uninitTextArea(textArea); } } //}}} + + //{{{ ViewInitializer class + private class ViewInitializer extends JEditVisitorAdapter + { + public void visit(View view) + { + initView(view); + } + } //}}} + + //{{{ ViewUninitializer class + private class ViewUninitializer extends JEditVisitorAdapter + { + public void visit(View view) + { + uninitView(view); + } + } //}}} } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2009-03-24 09:09:29
|
Revision: 14849 http://jedit.svn.sourceforge.net/jedit/?rev=14849&view=rev Author: kpouer Date: 2009-03-24 09:09:22 +0000 (Tue, 24 Mar 2009) Log Message: ----------- updated version and documentation Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2009-03-24 07:58:02 UTC (rev 14848) +++ plugins/Highlight/trunk/Highlight.props 2009-03-24 09:09:22 UTC (rev 14849) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.5.2 +plugin.gatchan.highlight.HighlightPlugin.version=1.5.3 plugin.gatchan.highlight.HighlightPlugin.docs=Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2009-03-24 07:58:02 UTC (rev 14848) +++ plugins/Highlight/trunk/docs/Highlight.html 2009-03-24 09:09:22 UTC (rev 14849) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.5.2 (Jan 23, 2009)</span><br> + <span style="font-weight:bold">Version 1.5.3 (Mar 24, 2009)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,6 +42,10 @@ </p> <h2>History</h2> <ul> + <li>1.5.3 (Mar 24, 2009)</li> + <ul> + <li>Highlight regex can now match beginning or end of line using ^ and $ (Shlomy Reinstein)</li> + </ul> <li>1.5.2 (Jan 23, 2009)</li> <ul> <li>Fixed highlight update when some folds are closed</li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2009-08-25 13:22:23
|
Revision: 16055 http://jedit.svn.sourceforge.net/jedit/?rev=16055&view=rev Author: kpouer Date: 2009-08-25 12:14:07 +0000 (Tue, 25 Aug 2009) Log Message: ----------- Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/build.xml plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightManager.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2009-08-25 12:08:48 UTC (rev 16054) +++ plugins/Highlight/trunk/Highlight.props 2009-08-25 12:14:07 UTC (rev 16055) @@ -90,4 +90,9 @@ gatchan.highlight.square.text=Draw a square around the highlighted word gatchan.highlight.square.color=#FF0000 gatchan.highlight.square.color.text=Choose the color of the square + +gatchan.highlight.selectionHighlight.text=Highlight selection under caret +gatchan.highlight.selectionHighlight.ignoreCase.text=ignore case +gatchan.highlight.selectionHighlight.color=#FFFF66 +gatchan.highlight.selectionHighlight.color.text=Color of the caret highlight : #}}} \ No newline at end of file Modified: plugins/Highlight/trunk/build.xml =================================================================== --- plugins/Highlight/trunk/build.xml 2009-08-25 12:08:48 UTC (rev 16054) +++ plugins/Highlight/trunk/build.xml 2009-08-25 12:14:07 UTC (rev 16055) @@ -15,4 +15,7 @@ <pathelement location="${jedit.install.dir}/jedit.jar" /> </path> + <selector id="packageFiles"> + <filename name="docs/Highlight.html" /> + </selector> </project> \ No newline at end of file Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java 2009-08-25 12:08:48 UTC (rev 16054) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java 2009-08-25 12:14:07 UTC (rev 16055) @@ -118,6 +118,8 @@ } if (manager.isHighlightWordAtCaret()) addHighlight(highlights, s, HighlightManagerTableModel.currentWordHighlight); + if (manager.isHighlightSelection()) + addHighlight(highlights, s, HighlightManagerTableModel.selectionHighlight); } finally { Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightManager.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightManager.java 2009-08-25 12:08:48 UTC (rev 16054) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightManager.java 2009-08-25 12:14:07 UTC (rev 16055) @@ -114,4 +114,8 @@ void getReadLock(); void releaseLock(); + + //{{{ isHighlightSelection() method + boolean isHighlightSelection() //}}} + ; } Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2009-08-25 12:08:48 UTC (rev 16054) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2009-08-25 12:14:07 UTC (rev 16055) @@ -25,6 +25,7 @@ import org.gjt.sp.jedit.buffer.JEditBuffer; import org.gjt.sp.jedit.*; import org.gjt.sp.jedit.textarea.JEditTextArea; +import org.gjt.sp.jedit.textarea.Selection; import org.gjt.sp.util.Log; import org.gjt.sp.util.IOUtilities; @@ -62,11 +63,15 @@ private RWLock rwLock = new RWLock(); public static Highlight currentWordHighlight; + public static Highlight selectionHighlight; + private boolean highlightWordAtCaret; private boolean highlightWordAtCaretEntireWord; private boolean highlightWordAtCaretWhitespace; private boolean highlightWordAtCaretOnlyWords; - + + private boolean highlightSelection; + /** * If true the highlight will be appended, if false the highlight will replace the previous one. */ @@ -115,6 +120,7 @@ { highlights = highlightFile; currentWordHighlight = new Highlight(); + selectionHighlight = new Highlight(); if (highlights != null && highlights.exists()) { BufferedReader reader = null; @@ -155,6 +161,7 @@ } } highlightWordAtCaret = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_WORD_AT_CARET); + highlightSelection = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_SELECTION); highlightWordAtCaretEntireWord = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_WORD_AT_CARET_ENTIRE_WORD); highlightWordAtCaretWhitespace = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_WORD_AT_CARET_WHITESPACE); highlightWordAtCaretOnlyWords = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_WORD_AT_CARET_ONLYWORDS); @@ -162,7 +169,12 @@ highlightWordAtCaretEntireWord, jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_WORD_AT_CARET_IGNORE_CASE), jEdit.getColorProperty(HighlightOptionPane.PROP_HIGHLIGHT_WORD_AT_CARET_COLOR)); + selectionHighlight.init(" ", + false, + jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_SELECTION_IGNORE_CASE), + jEdit.getColorProperty(HighlightOptionPane.PROP_HIGHLIGHT_SELECTION_COLOR)); currentWordHighlight.setEnabled(false); + selectionHighlight.setEnabled(false); timer = new Timer(1000, new RemoveExpired()); timer.start(); } //}}} @@ -419,7 +431,7 @@ timer.stop(); timer = null; highlightManagerTableModel = null; - currentWordHighlight = null; + selectionHighlight = null; save(); } //}}} @@ -580,68 +592,86 @@ public void caretUpdate(CaretEvent e) { JEditTextArea textArea = (JEditTextArea) e.getSource(); - if (highlightWordAtCaret) - { - int line = textArea.getCaretLine(); + int line = textArea.getCaretLine(); + if (highlightWordAtCaret) + { - if (textArea.getLineLength(line) == 0 || textArea.getSelectionCount() != 0) - { - currentWordHighlight.setEnabled(false); - fireHighlightChangeListener(isHighlightEnable()); - return; - } + if (textArea.getLineLength(line) == 0 || textArea.getSelectionCount() != 0) + { + currentWordHighlight.setEnabled(false); + } + else + { + int lineStart = textArea.getLineStartOffset(line); + int offset = textArea.getCaretPosition() - lineStart; - int lineStart = textArea.getLineStartOffset(line); - int offset = textArea.getCaretPosition() - lineStart; + JEditBuffer buffer = textArea.getBuffer(); + String lineText = buffer.getLineText(line); + String noWordSep = buffer.getStringProperty("noWordSep"); - JEditBuffer buffer = textArea.getBuffer(); - String lineText = buffer.getLineText(line); - String noWordSep = buffer.getStringProperty("noWordSep"); + if (offset != 0) + offset--; - if (offset != 0) - offset--; + int wordStart = TextUtilities.findWordStart(lineText, offset, noWordSep); + char ch = lineText.charAt(wordStart); + if ((!highlightWordAtCaretWhitespace && Character.isWhitespace(ch)) || + (highlightWordAtCaretOnlyWords && + !Character.isLetterOrDigit(ch) && + noWordSep.indexOf(ch) == -1)) + { + currentWordHighlight.setEnabled(false); + } + else + { - int wordStart = TextUtilities.findWordStart(lineText, offset, noWordSep); - char ch = lineText.charAt(wordStart); - if ((!highlightWordAtCaretWhitespace && Character.isWhitespace(ch)) || - (highlightWordAtCaretOnlyWords && - !Character.isLetterOrDigit(ch) && - noWordSep.indexOf(ch) == -1)) - { - currentWordHighlight.setEnabled(false); - } - else - { + int wordEnd = TextUtilities.findWordEnd(lineText, offset + 1, noWordSep); - int wordEnd = TextUtilities.findWordEnd(lineText, offset + 1, noWordSep); + if (wordEnd - wordStart < 2) + { + currentWordHighlight.setEnabled(false); + } + else + { - if (wordEnd - wordStart < 2) - { - currentWordHighlight.setEnabled(false); - } - else - { + currentWordHighlight.setEnabled(true); + String stringToHighlight = lineText.substring(wordStart, wordEnd); + if (highlightWordAtCaretEntireWord) + { + stringToHighlight = "\\b" + stringToHighlight + "\\b"; + currentWordHighlight.init(stringToHighlight, + true, + currentWordHighlight.isIgnoreCase(), + currentWordHighlight.getColor()); - currentWordHighlight.setEnabled(true); - String stringToHighlight = lineText.substring(wordStart, wordEnd); - if (highlightWordAtCaretEntireWord) - { - stringToHighlight = "\\b" + stringToHighlight + "\\b"; - currentWordHighlight.init(stringToHighlight, - true, - currentWordHighlight.isIgnoreCase(), - currentWordHighlight.getColor()); + } + else + { + currentWordHighlight.setStringToHighlight(stringToHighlight); + } + } + } + } + } + if (highlightSelection) + { + Selection selectionatOffset = textArea.getSelectionAtOffset(e.getDot()); + if (textArea.getLineLength(line) == 0 || + selectionatOffset == null || + selectionatOffset.getStartLine() != selectionatOffset.getEndLine()) + { + selectionHighlight.setEnabled(false); + } + else + { + selectionHighlight.setEnabled(true); + String stringToHighlight = textArea.getSelectedText(selectionatOffset); + textArea.getSelectedText(selectionatOffset); + selectionHighlight.setStringToHighlight(stringToHighlight); + } + } - } - else - { - currentWordHighlight.setStringToHighlight(stringToHighlight); - } - } - } - fireHighlightChangeListener(isHighlightEnable()); - } + fireHighlightChangeListener(isHighlightEnable()); } //}}} //{{{ isHighlightWordAtCaret() method @@ -650,6 +680,13 @@ return highlightWordAtCaret; } //}}} + + //{{{ isHighlightSelection() method + public boolean isHighlightSelection() + { + return highlightSelection; + } //}}} + //{{{ propertiesChanged() method public void propertiesChanged() { @@ -665,6 +702,7 @@ appendHighlight = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_APPEND); boolean changed = false; + boolean changedSelection = false; //{{{ PROP_HIGHLIGHT_WORD_AT_CARET boolean highlightWordAtCaret = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_WORD_AT_CARET); @@ -676,6 +714,16 @@ currentWordHighlight.setEnabled(false); } //}}} + //{{{ PROP_HIGHLIGHT_SELECTION + boolean highlightSelection = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_SELECTION); + if (this.highlightSelection != highlightSelection) + { + changedSelection = true; + this.highlightSelection = highlightSelection; + if (!highlightSelection) + selectionHighlight.setEnabled(false); + } //}}} + //{{{ PROP_HIGHLIGHT_WORD_AT_CARET_ENTIRE_WORD boolean entireWord = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_WORD_AT_CARET_ENTIRE_WORD); if (highlightWordAtCaretEntireWord != entireWord) @@ -712,6 +760,13 @@ changed = true; } //}}} + //{{{ PROP_HIGHLIGHT_SELECTION_IGNORE_CASE + boolean selectionIgnoreCase = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_SELECTION_IGNORE_CASE); + if (selectionHighlight.isIgnoreCase() != ignoreCase) + { + changedSelection = true; + } //}}} + //{{{ PROP_HIGHLIGHT_WORD_AT_CARET_COLOR Color newColor = jEdit.getColorProperty(HighlightOptionPane.PROP_HIGHLIGHT_WORD_AT_CARET_COLOR); if (!currentWordHighlight.getColor().equals(newColor)) @@ -719,6 +774,13 @@ changed = true; } //}}} + //{{{ PROP_HIGHLIGHT_SELECTION_COLOR + Color selectionNewColor = jEdit.getColorProperty(HighlightOptionPane.PROP_HIGHLIGHT_SELECTION_COLOR); + if (!selectionHighlight.getColor().equals(selectionNewColor)) + { + changedSelection = true; + } //}}} + //{{{ PROP_HIGHLIGHT_WORD_AT_CARET_SUBSEQUENCE if (currentWordHighlight.setHighlightSubsequence(jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_WORD_AT_CARET_SUBSEQUENCE))) { @@ -731,8 +793,13 @@ if (changed) { currentWordHighlight.init(currentWordHighlight.getStringToHighlight(), entireWord, ignoreCase, newColor); - fireHighlightChangeListener(isHighlightEnable()); } + if (changedSelection) + { + selectionHighlight.init(selectionHighlight.getStringToHighlight(), false, selectionIgnoreCase, selectionNewColor); + } + if (changed || changedSelection) + fireHighlightChangeListener(isHighlightEnable()); } //}}} //{{{ getReadLock() method Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2009-08-25 12:08:48 UTC (rev 16054) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2009-08-25 12:14:07 UTC (rev 16055) @@ -3,7 +3,7 @@ * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * -* Copyright (C) 2004, 2007 Matthieu Casanova +* Copyright (C) 2004, 2009 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -47,6 +47,11 @@ public static final String PROP_HIGHLIGHT_WORD_AT_CARET_IGNORE_CASE = "gatchan.highlight.caretHighlight.ignoreCase"; public static final String PROP_HIGHLIGHT_WORD_AT_CARET_ENTIRE_WORD = "gatchan.highlight.caretHighlight.entireWord"; public static final String PROP_HIGHLIGHT_WORD_AT_CARET_COLOR = "gatchan.highlight.caretHighlight.color"; + + public static final String PROP_HIGHLIGHT_SELECTION = "gatchan.highlight.selectionHighlight"; + public static final String PROP_HIGHLIGHT_SELECTION_IGNORE_CASE = "gatchan.highlight.selectionHighlight.ignoreCase"; + public static final String PROP_HIGHLIGHT_SELECTION_COLOR = "gatchan.highlight.selectionHighlight.color"; + public static final String PROP_HIGHLIGHT_CYCLE_COLOR = "gatchan.highlight.cycleColor"; public static final String PROP_HIGHLIGHT_APPEND = "gatchan.highlight.appendHighlight"; public static final String PROP_HIGHLIGHT_SUBSEQUENCE = "gatchan.highlight.subsequence"; @@ -76,7 +81,12 @@ private JCheckBox highlightHypersearch; private TextAreaExtensionLayerChooser layerChooser; private JSlider alphaSlider; - + + + private JCheckBox highlightSelection; + private JCheckBox selectionIgnoreCase; + private ColorWellButton selectionColor; + //{{{ HighlightOptionPane constructor public HighlightOptionPane() { @@ -126,6 +136,13 @@ }); squareColor.setEnabled(square.isSelected()); addComponent(highlightHypersearch = createCheckBox(PROP_HIGHLIGHT_HYPERSEARCH_RESULTS)); + addComponent(new JLabel(jEdit.getProperty(PROP_LAYER_PROPERTY + ".text")), + layerChooser = new TextAreaExtensionLayerChooser(jEdit.getIntegerProperty(PROP_LAYER_PROPERTY, TextAreaPainter.HIGHEST_LAYER))); + + addComponent(new JLabel(jEdit.getProperty(PROP_ALPHA + ".text")), + alphaSlider = new JSlider(0, + 100, + jEdit.getIntegerProperty(PROP_ALPHA, 50))); addSeparator(PROP_HIGHLIGHT_WORD_AT_CARET + ".text"); addComponent(highlightWordAtCaret = createCheckBox(PROP_HIGHLIGHT_WORD_AT_CARET)); @@ -136,13 +153,13 @@ addComponent(entireWord = createCheckBox(PROP_HIGHLIGHT_WORD_AT_CARET_ENTIRE_WORD)); addComponent(new JLabel(jEdit.getProperty(PROP_HIGHLIGHT_WORD_AT_CARET_COLOR + ".text")), wordAtCaretColor = new ColorWellButton(jEdit.getColorProperty(PROP_HIGHLIGHT_WORD_AT_CARET_COLOR))); - addComponent(new JLabel(jEdit.getProperty(PROP_LAYER_PROPERTY + ".text")), - layerChooser = new TextAreaExtensionLayerChooser(jEdit.getIntegerProperty(PROP_LAYER_PROPERTY, TextAreaPainter.HIGHEST_LAYER))); - - addComponent(new JLabel(jEdit.getProperty(PROP_ALPHA + ".text")), - alphaSlider = new JSlider(0, - 100, - jEdit.getIntegerProperty(PROP_ALPHA, 50))); + + + addSeparator(PROP_HIGHLIGHT_SELECTION + ".text"); + addComponent(highlightSelection = createCheckBox(PROP_HIGHLIGHT_SELECTION)); + addComponent(selectionIgnoreCase = createCheckBox(PROP_HIGHLIGHT_SELECTION_IGNORE_CASE)); + addComponent(new JLabel(jEdit.getProperty(PROP_HIGHLIGHT_SELECTION_COLOR + ".text")), + selectionColor = new ColorWellButton(jEdit.getColorProperty(PROP_HIGHLIGHT_SELECTION_COLOR))); } //}}} //{{{ _save() method @@ -172,6 +189,10 @@ } jEdit.setIntegerProperty(PROP_ALPHA, alphaSlider.getValue()); + + jEdit.setBooleanProperty(PROP_HIGHLIGHT_SELECTION, highlightSelection.isSelected()); + jEdit.setColorProperty(PROP_HIGHLIGHT_SELECTION_COLOR, selectionColor.getSelectedColor()); + jEdit.setBooleanProperty(PROP_HIGHLIGHT_SELECTION_IGNORE_CASE, selectionIgnoreCase.isSelected()); } //}}} //{{{ createCheckBox() method Modified: plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2009-08-25 12:08:48 UTC (rev 16054) +++ plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2009-08-25 12:14:07 UTC (rev 16055) @@ -82,7 +82,8 @@ fm = textArea.getPainter().getFontMetrics(); if (highlightManager.isHighlightEnable() && highlightManager.countHighlights() != 0 || - HighlightManagerTableModel.currentWordHighlight.isEnabled()) + HighlightManagerTableModel.currentWordHighlight.isEnabled() || + HighlightManagerTableModel.selectionHighlight.isEnabled()) super.paintScreenLineRange(gfx, firstLine, lastLine, physicalLines, start, end, y, lineHeight); } //}}} @@ -147,6 +148,7 @@ tempLineContent.count = lineContent.count; highlight(HighlightManagerTableModel.currentWordHighlight, buffer, gfx, screenLine, physicalLine, y, screenToPhysicalOffset); + highlight(HighlightManagerTableModel.selectionHighlight, buffer, gfx, screenLine, physicalLine, y, screenToPhysicalOffset); } //}}} //{{{ highlight() method This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2009-09-16 08:34:13
|
Revision: 16201 http://jedit.svn.sourceforge.net/jedit/?rev=16201&view=rev Author: kpouer Date: 2009-09-16 08:34:06 +0000 (Wed, 16 Sep 2009) Log Message: ----------- Fix a bug when choosing an arbirary layer value Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/TextAreaExtensionLayerChooser.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2009-09-15 20:52:33 UTC (rev 16200) +++ plugins/Highlight/trunk/Highlight.props 2009-09-16 08:34:06 UTC (rev 16201) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.6.0 +plugin.gatchan.highlight.HighlightPlugin.version=1.6.1 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2009-09-15 20:52:33 UTC (rev 16200) +++ plugins/Highlight/trunk/docs/Highlight.html 2009-09-16 08:34:06 UTC (rev 16201) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.6.0 (Aug 25, 2009)</span><br> + <span style="font-weight:bold">Version 1.6.1 (Sep 16, 2009)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,8 +42,12 @@ </p> <h2>History</h2> <ul> + <li>1.6.1 (Sep 16, 2009)</li> + <ul> + <li>Fix a bug when choosing an arbirary layer value</li> + </ul> <li>1.6.0 (Aug 25, 2009)</li> - <ul> + <ul> <li>New option to highlight the current selection that is under the caret</li> </ul> <li>1.5.3 (Mar 24, 2009)</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/TextAreaExtensionLayerChooser.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/TextAreaExtensionLayerChooser.java 2009-09-15 20:52:33 UTC (rev 16200) +++ plugins/Highlight/trunk/src/gatchan/highlight/TextAreaExtensionLayerChooser.java 2009-09-16 08:34:06 UTC (rev 16201) @@ -4,7 +4,7 @@ * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * - * Copyright (C) 2007 Matthieu Casanova + * Copyright (C) 2007, 2009 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -23,10 +23,9 @@ package gatchan.highlight; //{{{ imports -import org.gjt.sp.jedit.jEdit; import org.gjt.sp.jedit.textarea.TextAreaPainter; -import javax.swing.JComboBox; -import java.util.Arrays; + +import javax.swing.*; //}}} /** @@ -35,19 +34,19 @@ */ public class TextAreaExtensionLayerChooser extends JComboBox { - private static Object[] layers = new Object[]{ TextAreaPainter.LOWEST_LAYER + " (LOWEST_LAYER)" , - TextAreaPainter.BACKGROUND_LAYER + " (BACKGROUND_LAYER)", - TextAreaPainter.LINE_BACKGROUND_LAYER + " (LINE_BACKGROUND_LAYER)", - TextAreaPainter.BELOW_SELECTION_LAYER + " (BELOW_SELECTION_LAYER)", - TextAreaPainter.SELECTION_LAYER + " (SELECTION_LAYER)", - TextAreaPainter.WRAP_GUIDE_LAYER + " (WRAP_GUIDE_LAYER)", - TextAreaPainter.BELOW_MOST_EXTENSIONS_LAYER + " (BELOW_MOST_EXTENSIONS_LAYER)", - TextAreaPainter.DEFAULT_LAYER + " (DEFAULT_LAYER)", - TextAreaPainter.BLOCK_CARET_LAYER + " (BLOCK_CARET_LAYER)", - TextAreaPainter.BRACKET_HIGHLIGHT_LAYER + " (BRACKET_HIGHLIGHT_LAYER)", - TextAreaPainter.TEXT_LAYER + " (TEXT_LAYER)", - TextAreaPainter.CARET_LAYER + " (CARET_LAYER)", - TextAreaPainter.HIGHEST_LAYER + " (HIGHEST_LAYER)"}; + private static String[] layers = { TextAreaPainter.LOWEST_LAYER + " (LOWEST_LAYER)" , + TextAreaPainter.BACKGROUND_LAYER + " (BACKGROUND_LAYER)", + TextAreaPainter.LINE_BACKGROUND_LAYER + " (LINE_BACKGROUND_LAYER)", + TextAreaPainter.BELOW_SELECTION_LAYER + " (BELOW_SELECTION_LAYER)", + TextAreaPainter.SELECTION_LAYER + " (SELECTION_LAYER)", + TextAreaPainter.WRAP_GUIDE_LAYER + " (WRAP_GUIDE_LAYER)", + TextAreaPainter.BELOW_MOST_EXTENSIONS_LAYER + " (BELOW_MOST_EXTENSIONS_LAYER)", + TextAreaPainter.DEFAULT_LAYER + " (DEFAULT_LAYER)", + TextAreaPainter.BLOCK_CARET_LAYER + " (BLOCK_CARET_LAYER)", + TextAreaPainter.BRACKET_HIGHLIGHT_LAYER + " (BRACKET_HIGHLIGHT_LAYER)", + TextAreaPainter.TEXT_LAYER + " (TEXT_LAYER)", + TextAreaPainter.CARET_LAYER + " (CARET_LAYER)", + TextAreaPainter.HIGHEST_LAYER + " (HIGHEST_LAYER)"}; //{{{ TextAreaExtensionLayerChooser constructor /** @@ -80,12 +79,15 @@ public int getLayer() throws NumberFormatException { String value = (String) getSelectedItem(); - if (Arrays.binarySearch(layers, value) == -1) + for (String item: layers) { - int layer = Integer.parseInt(value); - return layer; + if (item.equals(value)) + { + int layer = Integer.parseInt(value.substring(0, value.indexOf(' '))); + return layer; + } } - int layer = Integer.parseInt(value.substring(0, value.indexOf(' '))); + int layer = Integer.parseInt(value); return layer; } //}}} } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2009-09-22 08:00:44
|
Revision: 16226 http://jedit.svn.sourceforge.net/jedit/?rev=16226&view=rev Author: kpouer Date: 2009-09-22 08:00:36 +0000 (Tue, 22 Sep 2009) Log Message: ----------- highlight overview Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java Added Paths: ----------- plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2009-09-21 16:21:00 UTC (rev 16225) +++ plugins/Highlight/trunk/Highlight.props 2009-09-22 08:00:36 UTC (rev 16226) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.6.1 +plugin.gatchan.highlight.HighlightPlugin.version=1.8.0 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2009-09-21 16:21:00 UTC (rev 16225) +++ plugins/Highlight/trunk/docs/Highlight.html 2009-09-22 08:00:36 UTC (rev 16226) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.6.1 (Sep 21, 2009)</span><br> + <span style="font-weight:bold">Version 1.8.0 (Sep 22, 2009)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,8 +42,9 @@ </p> <h2>History</h2> <ul> - <li>1.6.1 (Sep 16, 2009)</li> + <li>1.8.0 (Sep 22, 2009)</li> <ul> + <li>New highlight overview next to the right scrollbar (Szalai Endre)</li> <li>Fix a bug when choosing an arbirary layer value</li> <li>The cycle color options were displayed twice</li> </ul> Added: plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java (rev 0) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java 2009-09-22 08:00:36 UTC (rev 16226) @@ -0,0 +1,121 @@ +/* + * HighlightOverview.java + * :tabSize=8:indentSize=8:noTabs=false: + * :folding=explicit:collapseFolds=1: + * + * Copyright (C) 2009 Szalai Endre + * Portions Copyright (C) 2009 Matthieu Casanova + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package gatchan.highlight; + +import org.gjt.sp.jedit.buffer.JEditBuffer; +import org.gjt.sp.jedit.search.SearchMatcher; +import org.gjt.sp.jedit.textarea.TextArea; +import org.gjt.sp.util.IntegerArray; + +import javax.swing.*; +import java.awt.*; + +/** + * @author Szalai Endre + */ +public class HighlightOverview extends JPanel implements HighlightChangeListener +{ + private final IntegerArray items; + + private TextArea textArea; + + private static final int ITEM_HEIGHT = 4; + private static final int OVERVIEW_WIDTH = 12; + private static final int ITEM_BORDER = 2; + private static final int ITEM_WIDTH = OVERVIEW_WIDTH - 2 * ITEM_BORDER; + // To be in the same line as the scrollbar + private static int Y_OFFSET = 16; + private static Dimension preferredSize = new Dimension(OVERVIEW_WIDTH, 0); + + public HighlightOverview(TextArea textArea) + { + this.textArea = textArea; + items = new IntegerArray(32); + setRequestFocusEnabled(false); + } + + public void highlightUpdated(boolean highlightEnabled) + { + items.clear(); + if (!highlightEnabled) + { + return; + } + int offset = 0; + JEditBuffer buffer = textArea.getBuffer(); + int end = buffer.getLength(); + boolean endOfLine = buffer.getLineEndOffset( + buffer.getLineOfOffset(end)) - 1 == end; + SearchMatcher matcher = HighlightManagerTableModel.currentWordHighlight.getSearchMatcher(); + int lastResult = -1; + for(int counter = 0; ; counter++) + { + boolean startOfLine = buffer.getLineStartOffset( + buffer.getLineOfOffset(offset)) == offset; + + SearchMatcher.Match match = matcher.nextMatch( + buffer.getSegment(offset, end - offset), + startOfLine,endOfLine,counter == 0, + false); + if(match == null) + break; + + int newLine = buffer.getLineOfOffset( + offset + match.start); + if(lastResult != newLine) + { + items.add(newLine); + lastResult = newLine; + } + offset += match.end; + } + repaint(); + } + + + public void paintComponent(Graphics gfx) + { + super.paintComponent(gfx); + if (items.getSize() == 0) + return; + + int lineCount = textArea.getBuffer().getLineCount(); + gfx.setColor(Color.red); + + for (int i = 0;i<items.getSize();i++) + { + int y = Y_OFFSET + lineToY(items.get(i), lineCount) - ITEM_BORDER; + gfx.fillRect(ITEM_BORDER, y, ITEM_WIDTH, ITEM_HEIGHT); + } + } + + private int lineToY(int line, int lineCount) + { + return (getHeight() - 2 * Y_OFFSET) * line / lineCount; + } + + public Dimension getPreferredSize() + { + return preferredSize; + } +} Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2009-09-21 16:21:00 UTC (rev 16225) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2009-09-22 08:00:36 UTC (rev 16226) @@ -3,7 +3,7 @@ * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * - * Copyright (C) 2004, 2007 Matthieu Casanova + * Copyright (C) 2004, 2009 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -43,7 +43,6 @@ * The HighlightPlugin. This is my first plugin for jEdit, some parts of my code were inspired by the ErrorList plugin * * @author Matthieu Casanova - * @version $Id: HighlightPlugin.java,v 1.20 2006/06/21 09:40:32 kpouer Exp $ */ public class HighlightPlugin extends EBPlugin { @@ -113,6 +112,14 @@ textArea.putClientProperty(Highlighter.class, null); highlightManager.removeHighlightChangeListener(highlighter); } + HighlightOverview overview = (HighlightOverview) textArea.getClientProperty(HighlightOverview.class); + if (overview != null) + { + textArea.removeLeftOfScrollBar(overview); + textArea.putClientProperty(HighlightOverview.class, null); + highlightManager.removeHighlightChangeListener(overview); + textArea.revalidate(); + } textArea.removeCaretListener(highlightManager); } //}}} @@ -123,7 +130,7 @@ * @param textArea the textarea to initialize * @return the new highlighter for the textArea */ - private Highlighter initTextArea(JEditTextArea textArea) + private void initTextArea(JEditTextArea textArea) { Highlighter highlighter = new Highlighter(textArea); highlightManager.addHighlightChangeListener(highlighter); @@ -131,7 +138,12 @@ painter.addExtension(layer, highlighter); textArea.putClientProperty(Highlighter.class, highlighter); textArea.addCaretListener(highlightManager); - return highlighter; + + HighlightOverview overview = new HighlightOverview(textArea); + highlightManager.addHighlightChangeListener(overview); + textArea.addLeftOfScrollBar(overview); + textArea.putClientProperty(HighlightOverview.class, overview); + textArea.revalidate(); } //}}} //{{{ initView() method This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2009-09-22 08:38:43
|
Revision: 16227 http://jedit.svn.sourceforge.net/jedit/?rev=16227&view=rev Author: kpouer Date: 2009-09-22 08:38:34 +0000 (Tue, 22 Sep 2009) Log Message: ----------- added options for overview Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2009-09-22 08:00:36 UTC (rev 16226) +++ plugins/Highlight/trunk/Highlight.props 2009-09-22 08:38:34 UTC (rev 16227) @@ -95,4 +95,8 @@ gatchan.highlight.selectionHighlight.ignoreCase.text=ignore case gatchan.highlight.selectionHighlight.color=#FFFF66 gatchan.highlight.selectionHighlight.color.text=Color of the caret highlight : + + +gatchan.highlight.overview.text=Highlight overview +gatchan.highlight.overview=true #}}} \ No newline at end of file Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2009-09-22 08:00:36 UTC (rev 16226) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2009-09-22 08:38:34 UTC (rev 16227) @@ -63,7 +63,10 @@ public static final String PROP_ALPHA = "gatchan.highlight.alpha"; public static final String PROP_SQUARE = "gatchan.highlight.square"; public static final String PROP_SQUARE_COLOR = "gatchan.highlight.square.color"; - + + public static final String PROP_HIGHLIGHT_OVERVIEW = "gatchan.highlight.overview"; + public static final String PROP_HIGHLIGHT_OVERVIEW_COLOR = "gatchan.highlight.overview.color"; + private JCheckBox highlightWordAtCaret; private JCheckBox wordAtCaretIgnoreCase; private JCheckBox entireWord; @@ -86,6 +89,9 @@ private JCheckBox selectionIgnoreCase; private ColorWellButton selectionColor; + private JCheckBox highlightOverview; + private ColorWellButton highlightOverviewColor; + //{{{ HighlightOptionPane constructor public HighlightOptionPane() { @@ -149,6 +155,12 @@ addComponent(selectionIgnoreCase = createCheckBox(PROP_HIGHLIGHT_SELECTION_IGNORE_CASE)); addComponent(new JLabel(jEdit.getProperty(PROP_HIGHLIGHT_SELECTION_COLOR + ".text")), selectionColor = new ColorWellButton(jEdit.getColorProperty(PROP_HIGHLIGHT_SELECTION_COLOR))); + + addSeparator(PROP_HIGHLIGHT_OVERVIEW+".text"); + addComponent(highlightOverview = createCheckBox(PROP_HIGHLIGHT_OVERVIEW)); + addComponent(new JLabel(jEdit.getProperty(PROP_HIGHLIGHT_OVERVIEW_COLOR + ".text")), + highlightOverviewColor = new ColorWellButton(jEdit.getColorProperty(PROP_HIGHLIGHT_OVERVIEW_COLOR))); + } //}}} //{{{ _save() method @@ -169,7 +181,7 @@ jEdit.setColorProperty(PROP_DEFAULT_COLOR, defaultColor.getSelectedColor()); jEdit.setBooleanProperty(PROP_SQUARE, square.isSelected()); jEdit.setColorProperty(PROP_SQUARE_COLOR, squareColor.getSelectedColor()); - try + try { jEdit.setIntegerProperty(PROP_LAYER_PROPERTY, layerChooser.getLayer()); } @@ -179,9 +191,12 @@ jEdit.setIntegerProperty(PROP_ALPHA, alphaSlider.getValue()); - jEdit.setBooleanProperty(PROP_HIGHLIGHT_SELECTION, highlightSelection.isSelected()); - jEdit.setColorProperty(PROP_HIGHLIGHT_SELECTION_COLOR, selectionColor.getSelectedColor()); - jEdit.setBooleanProperty(PROP_HIGHLIGHT_SELECTION_IGNORE_CASE, selectionIgnoreCase.isSelected()); + jEdit.setBooleanProperty(PROP_HIGHLIGHT_SELECTION, highlightSelection.isSelected()); + jEdit.setColorProperty(PROP_HIGHLIGHT_SELECTION_COLOR, selectionColor.getSelectedColor()); + jEdit.setBooleanProperty(PROP_HIGHLIGHT_SELECTION_IGNORE_CASE, selectionIgnoreCase.isSelected()); + + jEdit.setBooleanProperty(PROP_HIGHLIGHT_OVERVIEW, highlightOverview.isSelected()); + jEdit.setColorProperty(PROP_HIGHLIGHT_OVERVIEW_COLOR, highlightOverviewColor.getSelectedColor()); } //}}} //{{{ createCheckBox() method Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java 2009-09-22 08:00:36 UTC (rev 16226) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java 2009-09-22 08:38:34 UTC (rev 16227) @@ -25,6 +25,7 @@ import org.gjt.sp.jedit.buffer.JEditBuffer; import org.gjt.sp.jedit.search.SearchMatcher; import org.gjt.sp.jedit.textarea.TextArea; +import org.gjt.sp.jedit.jEdit; import org.gjt.sp.util.IntegerArray; import javax.swing.*; @@ -36,6 +37,7 @@ public class HighlightOverview extends JPanel implements HighlightChangeListener { private final IntegerArray items; + private int count; private TextArea textArea; @@ -49,6 +51,9 @@ public HighlightOverview(TextArea textArea) { + Font ff = getFont(); + Font f = new Font(ff.getName(), Font.BOLD, 8); + setFont(f); this.textArea = textArea; items = new IntegerArray(32); setRequestFocusEnabled(false); @@ -68,7 +73,8 @@ buffer.getLineOfOffset(end)) - 1 == end; SearchMatcher matcher = HighlightManagerTableModel.currentWordHighlight.getSearchMatcher(); int lastResult = -1; - for(int counter = 0; ; counter++) + int counter; + for(counter = 0; ; counter++) { boolean startOfLine = buffer.getLineStartOffset( buffer.getLineOfOffset(offset)) == offset; @@ -89,6 +95,7 @@ } offset += match.end; } + count = counter; repaint(); } @@ -100,7 +107,9 @@ return; int lineCount = textArea.getBuffer().getLineCount(); - gfx.setColor(Color.red); + gfx.setColor(Color.black); +// gfx.drawString(String.valueOf(count), 0, 10); + gfx.setColor(jEdit.getColorProperty(HighlightOptionPane.PROP_HIGHLIGHT_OVERVIEW_COLOR)); for (int i = 0;i<items.getSize();i++) { @@ -111,6 +120,7 @@ private int lineToY(int line, int lineCount) { +// return (getHeight() - 12 * Y_OFFSET) * line / lineCount; return (getHeight() - 2 * Y_OFFSET) * line / lineCount; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2010-02-02 14:31:11
|
Revision: 17182 http://jedit.svn.sourceforge.net/jedit/?rev=17182&view=rev Author: kpouer Date: 2010-02-02 14:31:04 +0000 (Tue, 02 Feb 2010) Log Message: ----------- fixed serialisation issue Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/Highlight.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java plugins/Highlight/trunk/src/gatchan/highlight/InvalidHighlightException.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2010-02-02 09:36:51 UTC (rev 17181) +++ plugins/Highlight/trunk/Highlight.props 2010-02-02 14:31:04 UTC (rev 17182) @@ -94,7 +94,7 @@ gatchan.highlight.selectionHighlight.text=Highlight selection under caret gatchan.highlight.selectionHighlight.ignoreCase.text=ignore case gatchan.highlight.selectionHighlight.color=#FFFF66 -gatchan.highlight.selectionHighlight.color.text=Color of the caret highlight : +gatchan.highlight.selectionHighlight.color.text=Color of the selection highlight : gatchan.highlight.overview.text=Highlight overview Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2010-02-02 09:36:51 UTC (rev 17181) +++ plugins/Highlight/trunk/docs/Highlight.html 2010-02-02 14:31:04 UTC (rev 17182) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.8.0 (Sep 22, 2009)</span><br> + <span style="font-weight:bold">Version 1.8.0 (Feb 2, 2010)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,8 +42,9 @@ </p> <h2>History</h2> <ul> - <li>1.8.0 (Sep 22, 2009)</li> + <li>1.8.0 (Feb 2, 2010)</li> <ul> + <li>If the highlight serialized data are broken the plugin will not be broken anymore</li> <li>New highlight overview next to the right scrollbar (Szalai Endre)</li> <li>Fix a bug when choosing an arbirary layer value</li> <li>The cycle color options were displayed twice</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/Highlight.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/Highlight.java 2010-02-02 09:36:51 UTC (rev 17181) +++ plugins/Highlight/trunk/src/gatchan/highlight/Highlight.java 2010-02-02 14:31:04 UTC (rev 17182) @@ -3,7 +3,7 @@ * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * - * Copyright (C) 2004 Matthieu Casanova + * Copyright (C) 2004, 2010 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -52,26 +52,26 @@ * This scope will not be saved and is for one buffer only. */ public static final int BUFFER_SCOPE = 2; - + private String stringToHighlight; - + private boolean regexp; - + private boolean ignoreCase = true; - + private boolean valid; - + private SearchMatcher searchMatcher; - + private static final int HIGHLIGHT_VERSION = 1; - + private boolean highlightSubsequence = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_SUBSEQUENCE); - + /** * The default color. If null we will cycle the colors. */ private static Color defaultColor = jEdit.getColorProperty(HighlightOptionPane.PROP_DEFAULT_COLOR); - + private static final Color[] COLORS = {new Color(153, 255, 204), new Color(0x66, 0x66, 0xff), new Color(0xff, 0x66, 0x66), @@ -83,48 +83,49 @@ new Color(0x99, 0x00, 0x99), new Color(0x99, 0x99, 0x00), new Color(0x00, 0x99, 0x66)}; - + private static int colorIndex; - + private Color color; - + private boolean enabled = true; - + private int scope = PERMANENT_SCOPE; - + private JEditBuffer buffer; - + /** * The time to live in ms. */ private long duration = Long.MAX_VALUE; - + /** * The date where the highlight was last seen. */ private long lastSeen = System.currentTimeMillis(); - + public static final String HIGHLIGHTS_BUFFER_PROPS = "highlights"; + //{{{ Highlight constructor public Highlight(String stringToHighlight, boolean regexp, boolean ignoreCase, int scope) { this.scope = scope; init(stringToHighlight, regexp, ignoreCase, getNextColor()); } - + public Highlight(String stringToHighlight, boolean regexp, boolean ignoreCase) { this(stringToHighlight, regexp, ignoreCase, PERMANENT_SCOPE); } - + public Highlight(String s) { this(s, false, true, PERMANENT_SCOPE); } - + public Highlight() { } //}}} - + //{{{ init() method public void init(String s, boolean regexp, boolean ignoreCase, Color color) { @@ -156,49 +157,49 @@ this.ignoreCase = ignoreCase; this.color = color; } //}}} - + //{{{ getStringToHighlight() method public String getStringToHighlight() { return stringToHighlight; } //}}} - + //{{{ isRegexp() method public boolean isRegexp() { return regexp; } //}}} - + //{{{ isIgnoreCase() method public boolean isIgnoreCase() { return ignoreCase; } //}}} - + //{{{ setIgnoreCase() method public void setIgnoreCase(boolean ignoreCase) { this.ignoreCase = ignoreCase; } //}}} - + //{{{ isValid() method public boolean isValid() { return valid; } //}}} - + //{{{ setValid() method public void setValid(boolean valid) { this.valid = valid; } //}}} - + //{{{ getSearchMatcher() method public SearchMatcher getSearchMatcher() { return searchMatcher; } //}}} - + //{{{ getColor() method /** * Returns the color of the highlight. @@ -209,7 +210,7 @@ { return color; } //}}} - + //{{{ setColor() method /** * Set the color of the highlight. @@ -220,7 +221,7 @@ { this.color = color; } //}}} - + //{{{ equals() method public boolean equals(Object obj) { @@ -233,19 +234,19 @@ } return false; } //}}} - + //{{{ isEnabled() method public boolean isEnabled() { return enabled; } //}}} - + //{{{ setEnabled() method public void setEnabled(boolean enabled) { this.enabled = enabled; } //}}} - + //{{{ setDefaultColor() method /** * Set the default color. @@ -256,7 +257,7 @@ { Highlight.defaultColor = defaultColor; } //}}} - + //{{{ getNextColor() method public static Color getNextColor() { @@ -267,27 +268,27 @@ colorIndex = ++colorIndex % COLORS.length; return COLORS[colorIndex]; } //}}} - + //{{{ serialize() method /** - * Serialize the highlight like that : {@link #HIGHLIGHT_VERSION};regexp ignorecase color;stringToHighlight (no space - * between regexp, ignorecase and color - * - * @return the serialized string - */ - public String serialize() - { - StringBuffer buff = new StringBuffer(stringToHighlight.length() + 20); - buff.append(HIGHLIGHT_VERSION).append(';'); - serializeBoolean(buff, regexp); - serializeBoolean(buff, ignoreCase); - serializeBoolean(buff, enabled); - buff.append(color.getRGB()); - buff.append(';'); - buff.append(stringToHighlight); - return buff.toString(); + * Serialize the highlight like that : {@link #HIGHLIGHT_VERSION};regexp ignorecase color;stringToHighlight (no space + * between regexp, ignorecase and color + * + * @return the serialized string + */ + public String serialize() + { + StringBuffer buff = new StringBuffer(stringToHighlight.length() + 20); + buff.append(HIGHLIGHT_VERSION).append(';'); + serializeBoolean(buff, regexp); + serializeBoolean(buff, ignoreCase); + serializeBoolean(buff, enabled); + buff.append(color.getRGB()); + buff.append(';'); + buff.append(stringToHighlight); + return buff.toString(); } //}}} - + //{{{ serializeBoolean() method private static void serializeBoolean(StringBuffer buff, boolean bool) { @@ -300,8 +301,8 @@ buff.append(0); } } //}}} - - //{{{ unserialize() method + + //{{{ gatchan.highlight.HighlightPluginize() method /** * Unserialize the highlight. * @@ -311,22 +312,29 @@ */ public static Highlight unserialize(String s, boolean getStatus) throws InvalidHighlightException { - int index = s.indexOf(';'); - boolean regexp = s.charAt(index + 1) == '1'; - boolean ignoreCase = s.charAt(index + 2) == '1'; - boolean enabled = !getStatus || s.charAt((index + 3)) == '1'; - int i = s.indexOf(';', index + 4); - Color color = Color.decode(s.substring(index + 4, i)); - - // When using String.substring() the new String uses the same char[] so the new String is as big as the first one. - // This is minor optimization - String searchString = new String(s.substring(i + 1)); - Highlight highlight = new Highlight(); - highlight.setEnabled(enabled); - highlight.init(searchString, regexp, ignoreCase, color); - return highlight; + try + { + int index = s.indexOf(';'); + boolean regexp = s.charAt(index + 1) == '1'; + boolean ignoreCase = s.charAt(index + 2) == '1'; + boolean enabled = !getStatus || s.charAt((index + 3)) == '1'; + int i = s.indexOf(';', index + 4); + Color color = Color.decode(s.substring(index + 4, i)); + + // When using String.substring() the new String uses the same char[] so the new String is as big as the first one. + // This is minor optimization + String searchString = new String(s.substring(i + 1)); + Highlight highlight = new Highlight(); + highlight.setEnabled(enabled); + highlight.init(searchString, regexp, ignoreCase, color); + return highlight; + } + catch (Exception e) + { + throw new InvalidHighlightException(e); + } } //}}} - + //{{{ getScope() method /** * Get the scope of the highlight. @@ -337,7 +345,7 @@ { return scope; } //}}} - + //{{{ setScope() method /** * Set the scope of the highlight. @@ -348,7 +356,7 @@ { this.scope = scope; } //}}} - + //{{{ getBuffer() method /** * Returns the buffer associated to this highlight. It will be null if the scope is not {@link #BUFFER_SCOPE} @@ -359,7 +367,7 @@ { return buffer; } //}}} - + //{{{ setBuffer() method /** * Associate the highlight to a buffer. It must only be used for {@link #BUFFER_SCOPE} @@ -370,26 +378,26 @@ { if (this.buffer != null) { - java.util.List highlights = (java.util.List) this.buffer.getProperty("highlights"); + java.util.List<Highlight> highlights = (java.util.List<Highlight>) this.buffer.getProperty(HIGHLIGHTS_BUFFER_PROPS); highlights.remove(this); if (highlights.isEmpty()) { - this.buffer.unsetProperty("highlights"); + this.buffer.unsetProperty(HIGHLIGHTS_BUFFER_PROPS); } } this.buffer = buffer; if (buffer != null) { - java.util.List highlights = (java.util.List) buffer.getProperty("highlights"); + java.util.List<Highlight> highlights = (java.util.List<Highlight>) buffer.getProperty(HIGHLIGHTS_BUFFER_PROPS); if (highlights == null) { - highlights = new ArrayList(); - buffer.setProperty("highlights", highlights); + highlights = new ArrayList<Highlight>(); + buffer.setProperty(HIGHLIGHTS_BUFFER_PROPS, highlights); } highlights.add(this); } } //}}} - + //{{{ setDuration() method /** * Set the time to live of the highlight. @@ -401,7 +409,7 @@ { this.duration = duration; } //}}} - + //{{{ updateLastSeen() method /** * This method is called each time the highlight is seen. @@ -410,7 +418,7 @@ { lastSeen = System.currentTimeMillis(); } //}}} - + //{{{ isExpired() method /** * Check if the highlight is expired. @@ -422,19 +430,19 @@ { return System.currentTimeMillis() - lastSeen > duration; } //}}} - + //{{{ setStringToHighlight() method public void setStringToHighlight(String stringToHighlight) { init(stringToHighlight, regexp, ignoreCase, color); } //}}} - + //{{{ isHighlightSubsequence() method public boolean isHighlightSubsequence() { return highlightSubsequence; } //}}} - + //{{{ setHighlightSubsequence() method /** * Activate or deactivate the feature "highlight subsequence" Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2010-02-02 09:36:51 UTC (rev 17181) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2010-02-02 14:31:04 UTC (rev 17182) @@ -3,7 +3,7 @@ * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * - * Copyright (C) 2004, 2007 Matthieu Casanova + * Copyright (C) 2004, 2010 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -392,7 +392,7 @@ */ public void bufferClosed(Buffer buffer) { - List<Highlight> highlights = (List<Highlight>) buffer.getProperty("highlights"); + List<Highlight> highlights = (List<Highlight>) buffer.getProperty(Highlight.HIGHLIGHTS_BUFFER_PROPS); if (highlights != null) { for (int i = 0; i < highlights.size(); i++) @@ -440,12 +440,14 @@ { if (highlights != null) { - BufferedWriter writer = null; + PrintWriter writer = null; try { - writer = new BufferedWriter(new FileWriter(highlights)); - writer.write(FILE_VERSION); - writer.write('\n'); + File parentFile = highlights.getParentFile(); + if (!parentFile.isDirectory()) + parentFile.mkdirs(); + writer = new PrintWriter(highlights); + writer.println(FILE_VERSION); try { rwLock.getWriteLock(); @@ -455,8 +457,7 @@ Highlight highlight = listIterator.next(); if (highlight.getScope() == Highlight.PERMANENT_SCOPE) { - writer.write(highlight.serialize()); - writer.write('\n'); + writer.println(highlight.serialize()); } else { Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2010-02-02 09:36:51 UTC (rev 17181) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2010-02-02 14:31:04 UTC (rev 17182) @@ -3,7 +3,7 @@ * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * - * Copyright (C) 2004, 2009 Matthieu Casanova + * Copyright (C) 2004, 2010 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -85,7 +85,7 @@ Buffer[] buffers = jEdit.getBuffers(); for (int i = 0; i < buffers.length; i++) { - buffers[i].unsetProperty("highlights"); + buffers[i].unsetProperty(Highlight.HIGHLIGHTS_BUFFER_PROPS); } jEdit.visit(new TextAreaUninitializer()); Modified: plugins/Highlight/trunk/src/gatchan/highlight/InvalidHighlightException.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/InvalidHighlightException.java 2010-02-02 09:36:51 UTC (rev 17181) +++ plugins/Highlight/trunk/src/gatchan/highlight/InvalidHighlightException.java 2010-02-02 14:31:04 UTC (rev 17182) @@ -29,8 +29,13 @@ public class InvalidHighlightException extends Exception { - public InvalidHighlightException(String message) - { - super(message); - } + public InvalidHighlightException(String message) + { + super(message); + } + + public InvalidHighlightException(Throwable cause) + { + super(cause); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2010-03-05 13:45:46
|
Revision: 17429 http://jedit.svn.sourceforge.net/jedit/?rev=17429&view=rev Author: kpouer Date: 2010-03-05 13:45:39 +0000 (Fri, 05 Mar 2010) Log Message: ----------- performances improvement Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2010-03-05 12:39:59 UTC (rev 17428) +++ plugins/Highlight/trunk/Highlight.props 2010-03-05 13:45:39 UTC (rev 17429) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.8.0 +plugin.gatchan.highlight.HighlightPlugin.version=1.8.1 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2010-03-05 12:39:59 UTC (rev 17428) +++ plugins/Highlight/trunk/docs/Highlight.html 2010-03-05 13:45:39 UTC (rev 17429) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.8.0 (Feb 2, 2010)</span><br> + <span style="font-weight:bold">Version 1.8.1 (Mar 5, 2010)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,6 +42,12 @@ </p> <h2>History</h2> <ul> + <li>1.8.1 (Mar 5, 2010)</li> + <ul> + <li>Huge performance improvement in Highlight overview</li> + <li>Highlighter now use CharSequence, it should have lower memory footprint and lower CPU usage</li> + <li>Highlighter now highlight only in the first 10000 characters of a line for better performances</li> + </ul> <li>1.8.0 (Feb 2, 2010)</li> <ul> <li>If the highlight serialized data are broken the plugin will not be broken anymore</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java 2010-03-05 12:39:59 UTC (rev 17428) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java 2010-03-05 13:45:39 UTC (rev 17429) @@ -4,7 +4,7 @@ * :folding=explicit:collapseFolds=1: * * Copyright (C) 2009 Szalai Endre - * Portions Copyright (C) 2009 Matthieu Casanova + * Portions Copyright (C) 2009, 2010 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -43,15 +43,15 @@ private final IntegerArray items; private int count; - private TextArea textArea; + private final TextArea textArea; private static final int ITEM_HEIGHT = 4; private static final int OVERVIEW_WIDTH = 12; private static final int ITEM_BORDER = 2; private static final int ITEM_WIDTH = OVERVIEW_WIDTH - 2 * ITEM_BORDER; // To be in the same line as the scrollbar - private static int Y_OFFSET = 16; - private static Dimension preferredSize = new Dimension(OVERVIEW_WIDTH, 0); + private static final int Y_OFFSET = 16; + private static final Dimension preferredSize = new Dimension(OVERVIEW_WIDTH, 0); //{{{ HighlightOverview constructor public HighlightOverview(final TextArea textArea) @@ -109,13 +109,17 @@ items.add(newLine); lastResult = newLine; } - offset += match.end; + int nextLine = newLine + 1; + if (nextLine >= buffer.getLineCount()) + break; + offset = buffer.getLineStartOffset(nextLine); } count = counter; repaint(); } //}}} //{{{ paintComponent() method + @Override public void paintComponent(Graphics gfx) { super.paintComponent(gfx); @@ -147,6 +151,7 @@ } //}}} //{{{ getPreferredSize() method + @Override public Dimension getPreferredSize() { return preferredSize; Modified: plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2010-03-05 12:39:59 UTC (rev 17428) +++ plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2010-03-05 13:45:39 UTC (rev 17429) @@ -22,14 +22,13 @@ package gatchan.highlight; //{{{ Imports -import org.gjt.sp.jedit.jEdit; + import org.gjt.sp.jedit.buffer.JEditBuffer; +import org.gjt.sp.jedit.jEdit; import org.gjt.sp.jedit.search.SearchMatcher; import org.gjt.sp.jedit.textarea.JEditTextArea; import org.gjt.sp.jedit.textarea.TextAreaExtension; -import org.gjt.sp.util.SegmentCharSequence; -import javax.swing.text.Segment; import java.awt.*; import java.util.regex.PatternSyntaxException; //}}} @@ -43,8 +42,6 @@ class Highlighter extends TextAreaExtension implements HighlightChangeListener { private final JEditTextArea textArea; - private final Segment tempLineContent = new Segment(); - private final Segment lineContent = new Segment(); private final Point point = new Point(); private FontMetrics fm; @@ -55,6 +52,8 @@ public static Color squareColor; + public static final int MAX_LINE_LENGTH = 10000; + //{{{ Highlighter constructor Highlighter(JEditTextArea textArea) { @@ -113,41 +112,45 @@ int end, int y) { - textArea.getLineText(physicalLine, lineContent); - if (lineContent.count == 0) - return; + JEditBuffer buffer = textArea.getBuffer(); + int lineStart = buffer.getLineStartOffset(physicalLine); + int length = buffer.getLineLength(physicalLine); int startOffset = textArea.getLineStartOffset(physicalLine); int endOffset = textArea.getLineEndOffset(physicalLine); int screenToPhysicalOffset = start - startOffset; - lineContent.offset += screenToPhysicalOffset; - lineContent.count -= screenToPhysicalOffset; - lineContent.count -= endOffset - end; - JEditBuffer buffer = textArea.getBuffer(); - tempLineContent.array = lineContent.array; - tempLineContent.offset = lineContent.offset; - tempLineContent.count = lineContent.count; + + int l = length - screenToPhysicalOffset - endOffset + end; + if (l > MAX_LINE_LENGTH) + l = MAX_LINE_LENGTH; + CharSequence lineContent = buffer.getSegment(lineStart + screenToPhysicalOffset, + l); + if (lineContent.length() == 0) + return; + + CharSequence tempLineContent = lineContent; try { highlightManager.getReadLock(); for (int i = 0; i < highlightManager.countHighlights(); i++) { Highlight highlight = highlightManager.getHighlight(i); - highlight(highlight, buffer, gfx, screenLine, physicalLine, y, screenToPhysicalOffset); - tempLineContent.offset = lineContent.offset; - tempLineContent.count = lineContent.count; + highlight(highlight, buffer, gfx, screenLine, physicalLine, y, screenToPhysicalOffset, + tempLineContent); + tempLineContent = lineContent; } } finally { highlightManager.releaseLock(); } - tempLineContent.offset = lineContent.offset; - tempLineContent.count = lineContent.count; + tempLineContent = lineContent; - highlight(HighlightManagerTableModel.currentWordHighlight, buffer, gfx, screenLine, physicalLine, y, screenToPhysicalOffset); - highlight(HighlightManagerTableModel.selectionHighlight, buffer, gfx, screenLine, physicalLine, y, screenToPhysicalOffset); + highlight(HighlightManagerTableModel.currentWordHighlight, buffer, gfx, screenLine, physicalLine, y, + screenToPhysicalOffset, tempLineContent); + highlight(HighlightManagerTableModel.selectionHighlight, buffer, gfx, screenLine, physicalLine, y, + screenToPhysicalOffset, tempLineContent); } //}}} //{{{ highlight() method @@ -157,7 +160,8 @@ int screenLine, int physicalLine, int y, - int screenToPhysicalOffset) + int screenToPhysicalOffset, + CharSequence tempLineContent) { if (!highlight.isEnabled() || !highlight.isValid() || @@ -175,8 +179,8 @@ SearchMatcher.Match match = null; while (true) { - match = searchMatcher.nextMatch(new SegmentCharSequence(tempLineContent), - (i == 0), + match = searchMatcher.nextMatch(tempLineContent, + i == 0, true, match == null, false); @@ -184,22 +188,13 @@ break; _highlight(highlight.getColor(), gfx, physicalLine, match.start + i + screenToPhysicalOffset, match.end + i + screenToPhysicalOffset, y); highlight.updateLastSeen(); - if (subsequence) - { - tempLineContent.count -= match.start + 1; - tempLineContent.offset += match.start + 1; - i += match.start + 1; - } - else - { - tempLineContent.count -= match.end; - - tempLineContent.offset += match.end; - i += match.end; - } - - if (tempLineContent.count <= 0) + int skip = subsequence ? match.start + 1 : match.end; + i += skip; + int length = tempLineContent.length() - skip; + if (length <= 0) break; + tempLineContent = tempLineContent.subSequence(skip, + length + skip); } } catch (PatternSyntaxException e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2010-04-08 14:27:34
|
Revision: 17597 http://jedit.svn.sourceforge.net/jedit/?rev=17597&view=rev Author: kpouer Date: 2010-04-08 14:27:28 +0000 (Thu, 08 Apr 2010) Log Message: ----------- fixed bug 2983441 (highlight overview not removed when disabling it), and use new EBHandler annotation Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2010-04-08 12:43:35 UTC (rev 17596) +++ plugins/Highlight/trunk/Highlight.props 2010-04-08 14:27:28 UTC (rev 17597) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.8.1 +plugin.gatchan.highlight.HighlightPlugin.version=1.8.2 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2010-04-08 12:43:35 UTC (rev 17596) +++ plugins/Highlight/trunk/docs/Highlight.html 2010-04-08 14:27:28 UTC (rev 17597) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.8.1 (Mar 5, 2010)</span><br> + <span style="font-weight:bold">Version 1.8.2 (Apr 8, 2010)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,6 +42,10 @@ </p> <h2>History</h2> <ul> + <li>1.8.2 (Apr 8, 2010)</li> + <ul> + <li>Disabling highlight overview was not working (#2983441)</li> + </ul> <li>1.8.1 (Mar 5, 2010)</li> <ul> <li>Huge performance improvement in Highlight overview</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2010-04-08 12:43:35 UTC (rev 17596) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2010-04-08 14:27:28 UTC (rev 17597) @@ -23,6 +23,7 @@ //{{{ Imports import org.gjt.sp.jedit.*; +import org.gjt.sp.jedit.EditBus.EBHandler; import org.gjt.sp.jedit.visitors.JEditVisitorAdapter; import org.gjt.sp.jedit.search.SearchAndReplace; import org.gjt.sp.jedit.gui.DockableWindowManager; @@ -44,7 +45,7 @@ * * @author Matthieu Casanova */ -public class HighlightPlugin extends EBPlugin +public class HighlightPlugin extends EditPlugin { private static HighlightManager highlightManager; @@ -56,27 +57,33 @@ private int layer; private float alpha; + private boolean highlightOverview; //{{{ start() method /** * Initialize the plugin. When starting this plugin will add an Highlighter on each text area */ + @Override public void start() { layer = jEdit.getIntegerProperty(HighlightOptionPane.PROP_LAYER_PROPERTY, TextAreaPainter.HIGHEST_LAYER); + highlightOverview = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_OVERVIEW); File highlightFile = dataMigration(); highlightManager = HighlightManagerTableModel.createInstance(highlightFile); highlightManager.propertiesChanged(); jEdit.visit(new TextAreaInitializer()); jEdit.visit(new ViewInitializer()); + EditBus.addToBus(this); } //}}} //{{{ stop() method /** * uninitialize the plugin. we will remove the Highlighter on each text area */ + @Override public void stop() { + EditBus.removeFromBus(this); if (highlightManager.countHighlights() == 0 && !highlightManager.isHighlightWordAtCaret()) jEdit.setProperty("plugin.gatchan.highlight.HighlightPlugin.activate", "defer"); else @@ -100,7 +107,7 @@ * * @param textArea the textarea from wich we will remove the highlighter * @see #stop() - * @see #handleEditPaneMessage(EditPaneUpdate) + * @see #handleEditPaneUpdate(org.gjt.sp.jedit.msg.EditPaneUpdate) */ private static void uninitTextArea(JEditTextArea textArea) { @@ -112,14 +119,7 @@ textArea.putClientProperty(Highlighter.class, null); highlightManager.removeHighlightChangeListener(highlighter); } - HighlightOverview overview = (HighlightOverview) textArea.getClientProperty(HighlightOverview.class); - if (overview != null) - { - textArea.removeLeftOfScrollBar(overview); - textArea.putClientProperty(HighlightOverview.class, null); - highlightManager.removeHighlightChangeListener(overview); - textArea.revalidate(); - } + removeHighlightOverview(textArea); textArea.removeCaretListener(highlightManager); } //}}} @@ -139,13 +139,36 @@ textArea.putClientProperty(Highlighter.class, highlighter); textArea.addCaretListener(highlightManager); - HighlightOverview overview = new HighlightOverview(textArea); - highlightManager.addHighlightChangeListener(overview); - textArea.addLeftOfScrollBar(overview); - textArea.putClientProperty(HighlightOverview.class, overview); + addHighlightOverview(textArea); textArea.revalidate(); } //}}} + //{{{ addHighlightOverview() method + private void addHighlightOverview(JEditTextArea textArea) + { + HighlightOverview currentOverview = (HighlightOverview) textArea.getClientProperty(HighlightOverview.class); + if (highlightOverview && currentOverview == null) + { + HighlightOverview overview = new HighlightOverview(textArea); + highlightManager.addHighlightChangeListener(overview); + textArea.addLeftOfScrollBar(overview); + textArea.putClientProperty(HighlightOverview.class, overview); + } + } //}}} + + //{{{ addHighlightOverview() method + private static void removeHighlightOverview(JEditTextArea textArea) + { + HighlightOverview overview = (HighlightOverview) textArea.getClientProperty(HighlightOverview.class); + if (overview != null) + { + textArea.removeLeftOfScrollBar(overview); + textArea.putClientProperty(HighlightOverview.class, null); + highlightManager.removeHighlightChangeListener(overview); + textArea.revalidate(); + } + } //}}} + //{{{ initView() method /** * Initialize the view with a hypersearch results highlighter. @@ -181,69 +204,43 @@ } //}}} //{{{ handleMessage() method - public void handleMessage(EBMessage message) + @EBHandler + public void handlePropertiesChanged(PropertiesChanged propertiesChanged) { - if (message instanceof ViewUpdate) + boolean newOverview = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_OVERVIEW); + int layer = jEdit.getIntegerProperty(HighlightOptionPane.PROP_LAYER_PROPERTY, TextAreaPainter.HIGHEST_LAYER); + float alpha = ((float)jEdit.getIntegerProperty(HighlightOptionPane.PROP_ALPHA, 50)) / 100f; + if (this.layer != layer || this.alpha != alpha || newOverview != highlightOverview) { - handleViewMessage((ViewUpdate) message); - } - else if (message instanceof EditPaneUpdate) - { - handleEditPaneMessage((EditPaneUpdate) message); - } - else if (message instanceof BufferUpdate) - { - BufferUpdate bufferUpdate = (BufferUpdate) message; - if (bufferUpdate.getWhat() == BufferUpdate.CLOSED) + highlightOverview = newOverview; + this.layer = layer; + this.alpha = alpha; + jEdit.visit(new JEditVisitorAdapter() { - highlightManager.bufferClosed(bufferUpdate.getBuffer()); - } + @Override + public void visit(JEditTextArea textArea) + { + TextAreaPainter painter = textArea.getPainter(); + Highlighter highlighter = (Highlighter) textArea.getClientProperty(Highlighter.class); + highlighter.setAlphaComposite(HighlightPlugin.this.alpha); + painter.removeExtension(highlighter); + painter.addExtension(HighlightPlugin.this.layer, highlighter); + if (highlightOverview) + addHighlightOverview(textArea); + else + removeHighlightOverview(textArea); + } + }); } - else if (message instanceof DockableWindowUpdate) - { - DockableWindowUpdate dockableUpdate = (DockableWindowUpdate) message; - if (dockableUpdate.getWhat() == DockableWindowUpdate.ACTIVATED && - HighlightHypersearchResults.HYPERSEARCH.equals(dockableUpdate.getDockable())) - { - View view = ((DockableWindowManager) dockableUpdate.getSource()).getView(); - HighlightHypersearchResults highlighter = (HighlightHypersearchResults) - view.getDockableWindowManager().getClientProperty( - HighlightHypersearchResults.class); - if (highlighter == null) - initView(view); - else - highlighter.start(); - } - } - else if (message instanceof PropertiesChanged) - { - int layer = jEdit.getIntegerProperty(HighlightOptionPane.PROP_LAYER_PROPERTY, TextAreaPainter.HIGHEST_LAYER); - float alpha = ((float)jEdit.getIntegerProperty(HighlightOptionPane.PROP_ALPHA, 50)) / 100f; - if (this.layer != layer || this.alpha != alpha) - { - this.layer = layer; - this.alpha = alpha; - jEdit.visit(new JEditVisitorAdapter() - { - public void visit(JEditTextArea textArea) - { - TextAreaPainter painter = textArea.getPainter(); - Highlighter highlighter = (Highlighter) textArea.getClientProperty(Highlighter.class); - highlighter.setAlphaComposite(HighlightPlugin.this.alpha); - painter.removeExtension(highlighter); - painter.addExtension(HighlightPlugin.this.layer, highlighter); - } - }); - } - highlightManager.propertiesChanged(); - } + highlightManager.propertiesChanged(); } //}}} - //{{{ handleViewMessage() method - private void handleViewMessage(ViewUpdate message) + + @EBHandler + public void handleViewUpdate(ViewUpdate vu) { - View view = message.getView(); - Object what = message.getWhat(); + View view = vu.getView(); + Object what = vu.getWhat(); if (what == ViewUpdate.CREATED) { @@ -253,13 +250,14 @@ { uninitView(view); } - } //}}} - + } + //{{{ handleEditPaneMessage() method - private void handleEditPaneMessage(EditPaneUpdate message) + @EBHandler + public void handleEditPaneUpdate(EditPaneUpdate editPaneUpdate) { - JEditTextArea textArea = message.getEditPane().getTextArea(); - Object what = message.getWhat(); + JEditTextArea textArea = editPaneUpdate.getEditPane().getTextArea(); + Object what = editPaneUpdate.getWhat(); if (what == EditPaneUpdate.CREATED) { @@ -271,6 +269,34 @@ } } //}}} + //{{{ handleBufferPaneUpdate() method + @EBHandler + public void handleBufferPaneUpdate(BufferUpdate bufferUpdate) + { + if (bufferUpdate.getWhat() == BufferUpdate.CLOSED) + { + highlightManager.bufferClosed(bufferUpdate.getBuffer()); + } + } //}}} + + //{{{ handleBufferPaneUpdate() method + @EBHandler + public void handleDockableWindowUpdate(DockableWindowUpdate dockableUpdate) + { + if (dockableUpdate.getWhat() == DockableWindowUpdate.ACTIVATED && + HighlightHypersearchResults.HYPERSEARCH.equals(dockableUpdate.getDockable())) + { + View view = ((DockableWindowManager) dockableUpdate.getSource()).getView(); + HighlightHypersearchResults highlighter = (HighlightHypersearchResults) + view.getDockableWindowManager().getClientProperty( + HighlightHypersearchResults.class); + if (highlighter == null) + initView(view); + else + highlighter.start(); + } + } //}}} + //{{{ highlightThis() methods /** * Highlight a word in a textarea with PERMANENT_SCOPE. If a text is selected this text will be highlighted, if no This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2010-04-09 10:24:53
|
Revision: 17607 http://jedit.svn.sourceforge.net/jedit/?rev=17607&view=rev Author: kpouer Date: 2010-04-09 10:24:47 +0000 (Fri, 09 Apr 2010) Log Message: ----------- performance improvement Modified Paths: -------------- plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2010-04-09 10:14:35 UTC (rev 17606) +++ plugins/Highlight/trunk/docs/Highlight.html 2010-04-09 10:24:47 UTC (rev 17607) @@ -45,6 +45,7 @@ <li>1.8.2 (Apr 8, 2010)</li> <ul> <li>Disabling highlight overview was not working (#2983441)</li> + <li>Performance improvement when moving caret within the same word</li> </ul> <li>1.8.1 (Mar 5, 2010)</li> <ul> Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2010-04-09 10:14:35 UTC (rev 17606) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2010-04-09 10:24:47 UTC (rev 17607) @@ -594,12 +594,16 @@ { JEditTextArea textArea = (JEditTextArea) e.getSource(); int line = textArea.getCaretLine(); + boolean updated = false; if (highlightWordAtCaret) { - if (textArea.getLineLength(line) == 0 || textArea.getSelectionCount() != 0) { - currentWordHighlight.setEnabled(false); + if (currentWordHighlight.isEnabled()) + { + updated = true; + currentWordHighlight.setEnabled(false); + } } else { @@ -620,35 +624,52 @@ !Character.isLetterOrDigit(ch) && noWordSep.indexOf(ch) == -1)) { - currentWordHighlight.setEnabled(false); + if (currentWordHighlight.isEnabled()) + { + updated = true; + currentWordHighlight.setEnabled(false); + } } else { - - int wordEnd = TextUtilities.findWordEnd(lineText, offset + 1, noWordSep); if (wordEnd - wordStart < 2) { - currentWordHighlight.setEnabled(false); + if (currentWordHighlight.isEnabled()) + { + updated = true; + currentWordHighlight.setEnabled(false); + } } else { - - currentWordHighlight.setEnabled(true); + if (!currentWordHighlight.isEnabled()) + { + updated = true; + currentWordHighlight.setEnabled(true); + } String stringToHighlight = lineText.substring(wordStart, wordEnd); if (highlightWordAtCaretEntireWord) { stringToHighlight = "\\b" + stringToHighlight + "\\b"; - currentWordHighlight.init(stringToHighlight, - true, - currentWordHighlight.isIgnoreCase(), - currentWordHighlight.getColor()); + if (!stringToHighlight.equals(currentWordHighlight.getStringToHighlight())) + { + updated = true; + currentWordHighlight.init(stringToHighlight, + true, + currentWordHighlight.isIgnoreCase(), + currentWordHighlight.getColor()); + } } else { - currentWordHighlight.setStringToHighlight(stringToHighlight); + if (!stringToHighlight.equals(currentWordHighlight.getStringToHighlight())) + { + updated = true; + currentWordHighlight.setStringToHighlight(stringToHighlight); + } } } } @@ -672,8 +693,8 @@ selectionHighlight.setStringToHighlight(stringToHighlight); } } - - fireHighlightChangeListener(isHighlightEnable()); + if (updated) + fireHighlightChangeListener(isHighlightEnable()); } //}}} //{{{ isHighlightWordAtCaret() method This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2010-05-04 13:58:23
|
Revision: 17730 http://jedit.svn.sourceforge.net/jedit/?rev=17730&view=rev Author: kpouer Date: 2010-05-04 13:58:17 +0000 (Tue, 04 May 2010) Log Message: ----------- performance upgrade Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2010-05-04 13:52:09 UTC (rev 17729) +++ plugins/Highlight/trunk/Highlight.props 2010-05-04 13:58:17 UTC (rev 17730) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.8.2 +plugin.gatchan.highlight.HighlightPlugin.version=1.8.3 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2010-05-04 13:52:09 UTC (rev 17729) +++ plugins/Highlight/trunk/docs/Highlight.html 2010-05-04 13:58:17 UTC (rev 17730) @@ -42,6 +42,10 @@ </p> <h2>History</h2> <ul> + <li>1.8.3 (May 4, 2010)</li> + <ul> + <li>Performance improvement when moving the caret in the buffer</li> + </ul> <li>1.8.2 (Apr 8, 2010)</li> <ul> <li>Disabling highlight overview was not working (#2983441)</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2010-05-04 13:52:09 UTC (rev 17729) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2010-05-04 13:58:17 UTC (rev 17730) @@ -611,7 +611,7 @@ int offset = textArea.getCaretPosition() - lineStart; JEditBuffer buffer = textArea.getBuffer(); - String lineText = buffer.getLineText(line); + CharSequence lineText = buffer.getLineSegment(line); String noWordSep = buffer.getStringProperty("noWordSep"); if (offset != 0) @@ -649,7 +649,7 @@ updated = true; currentWordHighlight.setEnabled(true); } - String stringToHighlight = lineText.substring(wordStart, wordEnd); + String stringToHighlight = lineText.subSequence(wordStart, wordEnd).toString(); if (highlightWordAtCaretEntireWord) { stringToHighlight = "\\b" + stringToHighlight + "\\b"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2010-05-20 08:28:43
|
Revision: 17856 http://jedit.svn.sourceforge.net/jedit/?rev=17856&view=rev Author: kpouer Date: 2010-05-20 08:28:32 +0000 (Thu, 20 May 2010) Log Message: ----------- Applied patch 3004382 to fix selection highlight Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2010-05-19 19:05:33 UTC (rev 17855) +++ plugins/Highlight/trunk/Highlight.props 2010-05-20 08:28:32 UTC (rev 17856) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.8.2 +plugin.gatchan.highlight.HighlightPlugin.version=1.8.3 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2010-05-19 19:05:33 UTC (rev 17855) +++ plugins/Highlight/trunk/docs/Highlight.html 2010-05-20 08:28:32 UTC (rev 17856) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.8.2 (May 6, 2010)</span><br> + <span style="font-weight:bold">Version 1.8.3 (May 20, 2010)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,6 +42,10 @@ </p> <h2>History</h2> <ul> + <li>1.8.3 (May 20, 2010)</li> + <ul> + <li>Fix selection highlight not always updated (patch #3004382) (Kazutoshi Satoda)</li> + </ul> <li>1.8.2 (May 6, 2010)</li> <ul> <li>Disabling highlight overview was not working (#2983441)</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2010-05-19 19:05:33 UTC (rev 17855) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2010-05-20 08:28:32 UTC (rev 17856) @@ -683,14 +683,22 @@ selectionatOffset.getStartLine() != selectionatOffset.getEndLine() || selectionatOffset.getEnd() - selectionatOffset.getStart() == 0) { - selectionHighlight.setEnabled(false); + if (selectionHighlight.isEnabled()) + { + updated = true; + selectionHighlight.setEnabled(false); + } } else { - selectionHighlight.setEnabled(true); String stringToHighlight = textArea.getSelectedText(selectionatOffset); - textArea.getSelectedText(selectionatOffset); - selectionHighlight.setStringToHighlight(stringToHighlight); + if (!selectionHighlight.isEnabled() || + !stringToHighlight.equals(selectionHighlight.getStringToHighlight())) + { + updated = true; + selectionHighlight.setEnabled(true); + selectionHighlight.setStringToHighlight(stringToHighlight); + } } } if (updated) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2010-08-04 14:32:38
|
Revision: 18293 http://jedit.svn.sourceforge.net/jedit/?rev=18293&view=rev Author: kpouer Date: 2010-08-04 14:32:32 +0000 (Wed, 04 Aug 2010) Log Message: ----------- highlight dialog now initialize with the word under the caret Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/actions.xml plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightDialog.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightList.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightTablePanel.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2010-08-04 12:36:41 UTC (rev 18292) +++ plugins/Highlight/trunk/Highlight.props 2010-08-04 14:32:32 UTC (rev 18293) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.8.3 +plugin.gatchan.highlight.HighlightPlugin.version=1.8.4 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/actions.xml =================================================================== --- plugins/Highlight/trunk/actions.xml 2010-08-04 12:36:41 UTC (rev 18292) +++ plugins/Highlight/trunk/actions.xml 2010-08-04 14:32:32 UTC (rev 18293) @@ -58,7 +58,7 @@ <ACTION NAME="gatchan-highlight-dialog"> <CODE> textArea.requestFocus(); - gatchan.highlight.HighlightPlugin.highlightDialog(view); + gatchan.highlight.HighlightPlugin.highlightDialog(view, textArea); </CODE> </ACTION> <ACTION NAME="gatchan-removeAllHighlights"> Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2010-08-04 12:36:41 UTC (rev 18292) +++ plugins/Highlight/trunk/docs/Highlight.html 2010-08-04 14:32:32 UTC (rev 18293) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.8.3 (May 20, 2010)</span><br> + <span style="font-weight:bold">Version 1.8.4 (Aug 04, 2010)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,6 +42,10 @@ </p> <h2>History</h2> <ul> + <li>1.8.4 (Aug 4, 2010)</li> + <ul> + <li>The Highlight dialog contains the current word under caret by default</li> + </ul> <li>1.8.3 (May 20, 2010)</li> <ul> <li>Fix selection highlight not always updated (patch #3004382) (Kazutoshi Satoda)</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightDialog.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightDialog.java 2010-08-04 12:36:41 UTC (rev 18292) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightDialog.java 2010-08-04 14:32:32 UTC (rev 18293) @@ -3,7 +3,7 @@ * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * - * Copyright (C) 2004 Matthieu Casanova + * Copyright (C) 2004, 2010 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -91,6 +91,11 @@ this(owner, new Highlight()); } //}}} + public void setString(String s) + { + panel.setString(s); + } + //{{{ ok() method public void ok() { Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightList.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightList.java 2010-08-04 12:36:41 UTC (rev 18292) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightList.java 2010-08-04 14:32:32 UTC (rev 18293) @@ -3,7 +3,7 @@ * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * - * Copyright (C) 2004 Matthieu Casanova + * Copyright (C) 2004, 2010 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -265,7 +265,8 @@ } else if (newButton == source) { - HighlightPlugin.highlightDialog(jEdit.getActiveView()); + View activeView = jEdit.getActiveView(); + HighlightPlugin.highlightDialog(activeView, activeView.getTextArea()); } else if (enableHighlights == source) { Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2010-08-04 12:36:41 UTC (rev 18292) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2010-08-04 14:32:32 UTC (rev 18293) @@ -24,6 +24,7 @@ //{{{ Imports import org.gjt.sp.jedit.*; import org.gjt.sp.jedit.EditBus.EBHandler; +import org.gjt.sp.jedit.textarea.TextArea; import org.gjt.sp.jedit.visitors.JEditVisitorAdapter; import org.gjt.sp.jedit.search.SearchAndReplace; import org.gjt.sp.jedit.gui.DockableWindowManager; @@ -337,7 +338,7 @@ * @param textArea the textArea * @return the current word */ - private static String getCurrentWord(JEditTextArea textArea) + private static String getCurrentWord(TextArea textArea) { String text = textArea.getSelectedText(); if (text == null) @@ -418,9 +419,15 @@ * * @param view the current view */ - public static void highlightDialog(View view) + public static void highlightDialog(View view, TextArea textArea) { + String currentWord = getCurrentWord(textArea); HighlightDialog d = new HighlightDialog(view); + + if (currentWord.length() != 0) + { + d.setString(currentWord); + } d.setVisible(true); } //}}} Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightTablePanel.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightTablePanel.java 2010-08-04 12:36:41 UTC (rev 18292) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightTablePanel.java 2010-08-04 14:32:32 UTC (rev 18293) @@ -1,3 +1,24 @@ +/* + * HighlightTablePanel.java + * :tabSize=8:indentSize=8:noTabs=false: + * :folding=explicit:collapseFolds=1: + * + * Copyright (C) 2004, 2010 Matthieu Casanova + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ package gatchan.highlight; import org.gjt.sp.jedit.gui.ColorWellButton; @@ -15,151 +36,189 @@ * @author Matthieu Casanova * @version $Id: HighlightTablePanel.java,v 1.14 2006/06/21 09:40:32 kpouer Exp $ */ -public class HighlightTablePanel extends JPanel { - /** The field where the searched expression will be. */ - private final HistoryTextField expressionField = new HistoryTextField("gatchan-highlight.expression"); - //private final JTextField expressionField = new JTextField(40); +public class HighlightTablePanel extends JPanel +{ + /** + * The field where the searched expression will be. + */ + private final HistoryTextField expressionField = new HistoryTextField("gatchan-highlight.expression"); + //private final JTextField expressionField = new JTextField(40); - /** This checkbox indicate if highlight is a regexp. */ - private final JCheckBox regexp = new JCheckBox("regexp"); + /** + * This checkbox indicate if highlight is a regexp. + */ + private final JCheckBox regexp = new JCheckBox("regexp"); - /** This checkbox indicate if highlight is case sensitive. */ - private final JCheckBox ignoreCase = new JCheckBox("ignore case"); + /** + * This checkbox indicate if highlight is case sensitive. + */ + private final JCheckBox ignoreCase = new JCheckBox("ignore case"); - /** This button allow to choose the color of the highlight. */ - private final ColorWellButton colorBox = new ColorWellButton(Highlight.getNextColor()); - private HighlightCellEditor highlightCellEditor; + /** + * This button allow to choose the color of the highlight. + */ + private final ColorWellButton colorBox = new ColorWellButton(Highlight.getNextColor()); + private HighlightCellEditor highlightCellEditor; - private boolean initialized; + private boolean initialized; - private Color permanentScopeColor; - private static final Color SESSION_SCOPE_COLOR = new Color(0xcc, 0xcc, 0xff); - private static final Color BUFFER_SCOPE_COLOR = new Color(0xff, 0xfc, 0xc0); + private Color permanentScopeColor; + private static final Color SESSION_SCOPE_COLOR = new Color(0xcc, 0xcc, 0xff); + private static final Color BUFFER_SCOPE_COLOR = new Color(0xff, 0xfc, 0xc0); - /** Instantiate the panel. */ - public HighlightTablePanel() { - super(new GridBagLayout()); - permanentScopeColor = getBackground(); - ignoreCase.setSelected(true); - GridBagConstraints cons = new GridBagConstraints(); - cons.gridy = 0; + /** + * Instantiate the panel. + */ + public HighlightTablePanel() + { + super(new GridBagLayout()); + permanentScopeColor = getBackground(); + ignoreCase.setSelected(true); + GridBagConstraints cons = new GridBagConstraints(); + cons.gridy = 0; - cons.anchor = GridBagConstraints.WEST; - cons.fill = GridBagConstraints.HORIZONTAL; - cons.weightx = 1.0; - cons.gridwidth = GridBagConstraints.REMAINDER; - add(expressionField, cons); - cons.weightx = 0.0; - cons.fill = GridBagConstraints.NONE; - cons.gridy = 1; - cons.gridwidth = 2; - add(regexp, cons); - add(ignoreCase, cons); - cons.gridwidth = GridBagConstraints.REMAINDER; - add(colorBox, cons); - setBorder(BorderFactory.createEtchedBorder()); - } + cons.anchor = GridBagConstraints.WEST; + cons.fill = GridBagConstraints.HORIZONTAL; + cons.weightx = 1.0; + cons.gridwidth = GridBagConstraints.REMAINDER; + add(expressionField, cons); + cons.weightx = 0.0; + cons.fill = GridBagConstraints.NONE; + cons.gridy = 1; + cons.gridwidth = 2; + add(regexp, cons); + add(ignoreCase, cons); + cons.gridwidth = GridBagConstraints.REMAINDER; + add(colorBox, cons); + setBorder(BorderFactory.createEtchedBorder()); + } - public void setDialog(EnhancedDialog dialog) { - expressionField.addActionListener(new MyActionListener(dialog)); - } + public void setString(String s) + { + expressionField.setText(s); + } - /** - * Initialize the panel with an highlight. - * - * @param highlight the highlight we want to edit - */ - public void setHighlight(Highlight highlight) { - expressionField.setText(highlight.getStringToHighlight()); - regexp.setSelected(highlight.isRegexp()); - ignoreCase.setSelected(highlight.isIgnoreCase()); - colorBox.setSelectedColor(highlight.getColor()); - if (highlightCellEditor != null) { - expressionField.getDocument().addDocumentListener(highlightCellEditor); - if (!initialized) { - regexp.addActionListener(highlightCellEditor); - ignoreCase.addActionListener(highlightCellEditor); - ActionListener[] actionListeners = colorBox.getActionListeners(); - if (actionListeners.length == 1) { - ActionListener actionListener = actionListeners[0]; - colorBox.removeActionListener(actionListener); - colorBox.addActionListener(new SpecialColorWellButtonActionListener(actionListener, highlightCellEditor)); - } - initialized = true; - } - } - switch (highlight.getScope()) { - case Highlight.SESSION_SCOPE : - changeBackgroundColor(SESSION_SCOPE_COLOR); - break; - case Highlight.BUFFER_SCOPE : - changeBackgroundColor(BUFFER_SCOPE_COLOR); - break; - default: - changeBackgroundColor(permanentScopeColor); - } - } + public void setDialog(EnhancedDialog dialog) + { + expressionField.addActionListener(new MyActionListener(dialog)); + } - public void changeBackgroundColor(Color bg) { - setBackground(bg); - regexp.setBackground(bg); - ignoreCase.setBackground(bg); - } + /** + * Initialize the panel with an highlight. + * + * @param highlight the highlight we want to edit + */ + public void setHighlight(Highlight highlight) + { + expressionField.setText(highlight.getStringToHighlight()); + regexp.setSelected(highlight.isRegexp()); + ignoreCase.setSelected(highlight.isIgnoreCase()); + colorBox.setSelectedColor(highlight.getColor()); + if (highlightCellEditor != null) + { + expressionField.getDocument().addDocumentListener(highlightCellEditor); + if (!initialized) + { + regexp.addActionListener(highlightCellEditor); + ignoreCase.addActionListener(highlightCellEditor); + ActionListener[] actionListeners = colorBox.getActionListeners(); + if (actionListeners.length == 1) + { + ActionListener actionListener = actionListeners[0]; + colorBox.removeActionListener(actionListener); + colorBox.addActionListener(new SpecialColorWellButtonActionListener(actionListener, highlightCellEditor)); + } + initialized = true; + } + } + switch (highlight.getScope()) + { + case Highlight.SESSION_SCOPE: + changeBackgroundColor(SESSION_SCOPE_COLOR); + break; + case Highlight.BUFFER_SCOPE: + changeBackgroundColor(BUFFER_SCOPE_COLOR); + break; + default: + changeBackgroundColor(permanentScopeColor); + } + } - /** The panel will request focus for expressionfield. */ - public void focus() { - expressionField.requestFocus(); - } + public void changeBackgroundColor(Color bg) + { + setBackground(bg); + regexp.setBackground(bg); + ignoreCase.setBackground(bg); + } - /** - * Save the fields in the Highlight. - * - * @param highlight the highlight where we want to save - */ - public void save(Highlight highlight) throws InvalidHighlightException { - String stringToHighlight = expressionField.getText(); - if (stringToHighlight.length() == 0) { - throw new InvalidHighlightException("String cannot be empty"); - } - highlight.init(stringToHighlight, regexp.isSelected(), ignoreCase.isSelected(), colorBox.getSelectedColor()); - expressionField.addCurrentToHistory(); - } + /** + * The panel will request focus for expressionfield. + */ + public void focus() + { + expressionField.requestFocus(); + } - public void stopEdition() { - if (highlightCellEditor != null) { - expressionField.getDocument().removeDocumentListener(highlightCellEditor); - } - } + /** + * Save the fields in the Highlight. + * + * @param highlight the highlight where we want to save + */ + public void save(Highlight highlight) throws InvalidHighlightException + { + String stringToHighlight = expressionField.getText(); + if (stringToHighlight.length() == 0) + { + throw new InvalidHighlightException("String cannot be empty"); + } + highlight.init(stringToHighlight, regexp.isSelected(), ignoreCase.isSelected(), colorBox.getSelectedColor()); + expressionField.addCurrentToHistory(); + } - public void setCellEditor(HighlightCellEditor highlightCellEditor) { - this.highlightCellEditor = highlightCellEditor; - } + public void stopEdition() + { + if (highlightCellEditor != null) + { + expressionField.getDocument().removeDocumentListener(highlightCellEditor); + } + } - private static class SpecialColorWellButtonActionListener implements ActionListener { - private final ActionListener actionListener; - private final HighlightCellEditor highlightCellEditor; + public void setCellEditor(HighlightCellEditor highlightCellEditor) + { + this.highlightCellEditor = highlightCellEditor; + } - SpecialColorWellButtonActionListener(ActionListener actionListener, - HighlightCellEditor highlightCellEditor) { - this.actionListener = actionListener; - this.highlightCellEditor = highlightCellEditor; - } + private static class SpecialColorWellButtonActionListener implements ActionListener + { + private final ActionListener actionListener; + private final HighlightCellEditor highlightCellEditor; - public void actionPerformed(ActionEvent e) { - actionListener.actionPerformed(e); - highlightCellEditor.stopCellEditing(); - } - } + SpecialColorWellButtonActionListener(ActionListener actionListener, + HighlightCellEditor highlightCellEditor) + { + this.actionListener = actionListener; + this.highlightCellEditor = highlightCellEditor; + } - private static class MyActionListener implements ActionListener { - private final EnhancedDialog dialog; + public void actionPerformed(ActionEvent e) + { + actionListener.actionPerformed(e); + highlightCellEditor.stopCellEditing(); + } + } - MyActionListener(EnhancedDialog dialog) { - this.dialog = dialog; - } + private static class MyActionListener implements ActionListener + { + private final EnhancedDialog dialog; - public void actionPerformed(ActionEvent e) { - dialog.ok(); - } - } + MyActionListener(EnhancedDialog dialog) + { + this.dialog = dialog; + } + + public void actionPerformed(ActionEvent e) + { + dialog.ok(); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2010-10-12 08:25:16
|
Revision: 18763 http://jedit.svn.sourceforge.net/jedit/?rev=18763&view=rev Author: kpouer Date: 2010-10-12 08:25:06 +0000 (Tue, 12 Oct 2010) Log Message: ----------- trying to implement automatic color highlight (recognize #aa00dd) Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java Added Paths: ----------- plugins/Highlight/trunk/src/gatchan/highlight/color/ plugins/Highlight/trunk/src/gatchan/highlight/color/ColorHighlighter.java plugins/Highlight/trunk/src/gatchan/highlight/color/HexaColor.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2010-10-10 20:24:30 UTC (rev 18762) +++ plugins/Highlight/trunk/Highlight.props 2010-10-12 08:25:06 UTC (rev 18763) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.8.4 +plugin.gatchan.highlight.HighlightPlugin.version=1.9.0 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2010-10-10 20:24:30 UTC (rev 18762) +++ plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2010-10-12 08:25:06 UTC (rev 18763) @@ -22,6 +22,8 @@ package gatchan.highlight; //{{{ Imports +import gatchan.highlight.color.ColorHighlighter; +import gatchan.highlight.color.HexaColor; import org.gjt.sp.jedit.buffer.JEditBuffer; import org.gjt.sp.jedit.jEdit; import org.gjt.sp.jedit.search.SearchMatcher; @@ -29,6 +31,7 @@ import org.gjt.sp.jedit.textarea.TextAreaExtension; import java.awt.*; +import java.util.ArrayList; import java.util.regex.PatternSyntaxException; //}}} @@ -53,6 +56,8 @@ public static final int MAX_LINE_LENGTH = 10000; + private java.util.List<ColorHighlighter> colorHighlighters; + //{{{ Highlighter constructor Highlighter(JEditTextArea textArea) { @@ -60,6 +65,8 @@ blend = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha); highlightManager = HighlightManagerTableModel.getManager(); this.textArea = textArea; + colorHighlighters = new ArrayList<ColorHighlighter>(); + colorHighlighters.add(new HexaColor()); } //}}} //{{{ setAlphaComposite() method @@ -77,10 +84,10 @@ public void paintScreenLineRange(Graphics2D gfx, int firstLine, int lastLine, int[] physicalLines, int[] start, int[] end, int y, int lineHeight) { fm = textArea.getPainter().getFontMetrics(); - if (highlightManager.isHighlightEnable() && - highlightManager.countHighlights() != 0 || - HighlightManagerTableModel.currentWordHighlight.isEnabled() || - HighlightManagerTableModel.selectionHighlight.isEnabled()) +// if (highlightManager.isHighlightEnable() && +// highlightManager.countHighlights() != 0 || +// HighlightManagerTableModel.currentWordHighlight.isEnabled() || +// HighlightManagerTableModel.selectionHighlight.isEnabled()) super.paintScreenLineRange(gfx, firstLine, lastLine, physicalLines, start, end, y, lineHeight); } //}}} @@ -150,6 +157,10 @@ screenToPhysicalOffset, tempLineContent); highlight(HighlightManagerTableModel.selectionHighlight, buffer, gfx, physicalLine, y, screenToPhysicalOffset, tempLineContent); + for (ColorHighlighter colorHighlighter : colorHighlighters) + { + colorHighlighter.paintColor(textArea, gfx, physicalLine, y, lineContent, blend, fm); + } } //}}} //{{{ highlight() method @@ -184,7 +195,8 @@ false); if (match == null || match.end == match.start) break; - _highlight(highlight.getColor(), gfx, physicalLine, match.start + i + screenToPhysicalOffset, match.end + i + screenToPhysicalOffset, y); + _highlight(highlight.getColor(), gfx, physicalLine, match.start + i + + screenToPhysicalOffset, match.end + i + screenToPhysicalOffset, y); highlight.updateLastSeen(); int skip = subsequence ? match.start + 1 : match.end; i += skip; Added: plugins/Highlight/trunk/src/gatchan/highlight/color/ColorHighlighter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/color/ColorHighlighter.java (rev 0) +++ plugins/Highlight/trunk/src/gatchan/highlight/color/ColorHighlighter.java 2010-10-12 08:25:06 UTC (rev 18763) @@ -0,0 +1,34 @@ +/* + * :tabSize=8:indentSize=8:noTabs=false: + * :folding=explicit:collapseFolds=1: + * + * Copyright (C) 2010 Matthieu Casanova + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package gatchan.highlight.color; + +import org.gjt.sp.jedit.textarea.TextArea; + +import java.awt.*; + +/** + * @author Matthieu Casanova + */ +public interface ColorHighlighter +{ + void paintColor(TextArea textArea, Graphics2D gfx, int physicalLine, int y, CharSequence lineContent, AlphaComposite blend, FontMetrics fm); +} Added: plugins/Highlight/trunk/src/gatchan/highlight/color/HexaColor.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/color/HexaColor.java (rev 0) +++ plugins/Highlight/trunk/src/gatchan/highlight/color/HexaColor.java 2010-10-12 08:25:06 UTC (rev 18763) @@ -0,0 +1,106 @@ +/* + * :tabSize=8:indentSize=8:noTabs=false: + * :folding=explicit:collapseFolds=1: + * + * Copyright (C) 2010 Matthieu Casanova + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package gatchan.highlight.color; + +import org.gjt.sp.jedit.textarea.TextArea; + +import java.awt.*; + + +/** + * @author Matthieu Casanova + */ +public class HexaColor implements ColorHighlighter +{ + private Point point; + + public HexaColor() + { + point = new Point(); + } + + public void paintColor(TextArea textArea, Graphics2D gfx, int physicalLine, int y, CharSequence lineContent, AlphaComposite blend, FontMetrics fm) + { + int startColor = 0; + boolean colorPrefix = false; + char[] currentColor = new char[8]; + int j = 2; + for (int i = 0;i<lineContent.length();i++) + { + char c = lineContent.charAt(i); + if (c == '#') + { + colorPrefix = true; + startColor = i; + } + else if (colorPrefix) + { + if ((c >='0' && c <= '9') || + (c >= 'a' && c <= 'f')|| + (c >= 'A' && c <= 'F')) + { + currentColor[j++] = c; + if (j == 8) + { + currentColor[0] = '0'; + currentColor[1] = 'x'; + Color color = Color.decode(new String(currentColor)); + if (color != null) + paint(color, textArea, gfx, physicalLine, startColor, i+1, y, blend, fm); + j = 2; + colorPrefix = false; + } + } + else + { + j = 2; + colorPrefix = false; + } + } + } + } + + private void paint(Color color, TextArea textArea, Graphics2D gfx, int physicalLine, int startOffset, int endOffset, int y, AlphaComposite blend, FontMetrics fm) + { + Point p = textArea.offsetToXY(physicalLine, startOffset, point); + if (p == null) + { + // The start offset was not visible + return; + } + int startX = p.x; + + p = textArea.offsetToXY(physicalLine, endOffset, point); + if (p == null) + { + // The end offset was not visible + return; + } + int endX = p.x; + Color oldColor = gfx.getColor(); + Composite oldComposite = gfx.getComposite(); + gfx.setColor(color); + gfx.fillRect(startX, y, endX - startX, fm.getHeight() - 1); + gfx.setColor(oldColor); + gfx.setComposite(oldComposite); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2010-10-19 12:52:46
|
Revision: 18797 http://jedit.svn.sourceforge.net/jedit/?rev=18797&view=rev Author: kpouer Date: 2010-10-19 12:52:37 +0000 (Tue, 19 Oct 2010) Log Message: ----------- Modified Paths: -------------- plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java Added Paths: ----------- plugins/Highlight/trunk/src/gatchan/highlight/color/ColorToken.java plugins/Highlight/trunk/src/gatchan/highlight/color/Colors.flex plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorPainter.java plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorScanner.java Removed Paths: ------------- plugins/Highlight/trunk/src/gatchan/highlight/color/ColorHighlighter.java plugins/Highlight/trunk/src/gatchan/highlight/color/HexaColor.java Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2010-10-18 19:46:48 UTC (rev 18796) +++ plugins/Highlight/trunk/docs/Highlight.html 2010-10-19 12:52:37 UTC (rev 18797) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.8.4 (Aug 04, 2010)</span><br> + <span style="font-weight:bold">Version 1.9.0 (OCt 19, 2010)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,6 +42,10 @@ </p> <h2>History</h2> <ul> + <li>1.9.0 (Oct 19, 2010)</li> + <ul> + <li>Highlight now colors in the buffer</li> + </ul> <li>1.8.4 (Aug 4, 2010)</li> <ul> <li>The Highlight dialog contains the current word under caret by default</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2010-10-18 19:46:48 UTC (rev 18796) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2010-10-19 12:52:37 UTC (rev 18797) @@ -22,6 +22,7 @@ package gatchan.highlight; //{{{ Imports +import gatchan.highlight.color.FlexColorPainter; import org.gjt.sp.jedit.*; import org.gjt.sp.jedit.EditBus.EBHandler; import org.gjt.sp.jedit.textarea.TextArea; @@ -120,6 +121,12 @@ textArea.putClientProperty(Highlighter.class, null); highlightManager.removeHighlightChangeListener(highlighter); } + FlexColorPainter flexColorPainter = (FlexColorPainter) textArea.getClientProperty(FlexColorPainter.class); + if (flexColorPainter != null) + { + painter.removeExtension(flexColorPainter); + textArea.putClientProperty(FlexColorPainter.class, null); + } removeHighlightOverview(textArea); textArea.removeCaretListener(highlightManager); } //}}} @@ -139,7 +146,9 @@ painter.addExtension(layer, highlighter); textArea.putClientProperty(Highlighter.class, highlighter); textArea.addCaretListener(highlightManager); - + FlexColorPainter flexColorPainter = new FlexColorPainter(textArea); + textArea.putClientProperty(FlexColorPainter.class, flexColorPainter); + painter.addExtension(layer, flexColorPainter); addHighlightOverview(textArea); textArea.revalidate(); } //}}} Modified: plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2010-10-18 19:46:48 UTC (rev 18796) +++ plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2010-10-19 12:52:37 UTC (rev 18797) @@ -22,8 +22,6 @@ package gatchan.highlight; //{{{ Imports -import gatchan.highlight.color.ColorHighlighter; -import gatchan.highlight.color.HexaColor; import org.gjt.sp.jedit.buffer.JEditBuffer; import org.gjt.sp.jedit.jEdit; import org.gjt.sp.jedit.search.SearchMatcher; @@ -31,7 +29,6 @@ import org.gjt.sp.jedit.textarea.TextAreaExtension; import java.awt.*; -import java.util.ArrayList; import java.util.regex.PatternSyntaxException; //}}} @@ -56,8 +53,6 @@ public static final int MAX_LINE_LENGTH = 10000; - private java.util.List<ColorHighlighter> colorHighlighters; - //{{{ Highlighter constructor Highlighter(JEditTextArea textArea) { @@ -65,8 +60,6 @@ blend = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha); highlightManager = HighlightManagerTableModel.getManager(); this.textArea = textArea; - colorHighlighters = new ArrayList<ColorHighlighter>(); - colorHighlighters.add(new HexaColor()); } //}}} //{{{ setAlphaComposite() method @@ -84,10 +77,10 @@ public void paintScreenLineRange(Graphics2D gfx, int firstLine, int lastLine, int[] physicalLines, int[] start, int[] end, int y, int lineHeight) { fm = textArea.getPainter().getFontMetrics(); -// if (highlightManager.isHighlightEnable() && -// highlightManager.countHighlights() != 0 || -// HighlightManagerTableModel.currentWordHighlight.isEnabled() || -// HighlightManagerTableModel.selectionHighlight.isEnabled()) + if (highlightManager.isHighlightEnable() && + highlightManager.countHighlights() != 0 || + HighlightManagerTableModel.currentWordHighlight.isEnabled() || + HighlightManagerTableModel.selectionHighlight.isEnabled()) super.paintScreenLineRange(gfx, firstLine, lastLine, physicalLines, start, end, y, lineHeight); } //}}} @@ -157,10 +150,6 @@ screenToPhysicalOffset, tempLineContent); highlight(HighlightManagerTableModel.selectionHighlight, buffer, gfx, physicalLine, y, screenToPhysicalOffset, tempLineContent); - for (ColorHighlighter colorHighlighter : colorHighlighters) - { - colorHighlighter.paintColor(textArea, gfx, physicalLine, y, lineContent, blend, fm); - } } //}}} //{{{ highlight() method Deleted: plugins/Highlight/trunk/src/gatchan/highlight/color/ColorHighlighter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/color/ColorHighlighter.java 2010-10-18 19:46:48 UTC (rev 18796) +++ plugins/Highlight/trunk/src/gatchan/highlight/color/ColorHighlighter.java 2010-10-19 12:52:37 UTC (rev 18797) @@ -1,34 +0,0 @@ -/* - * :tabSize=8:indentSize=8:noTabs=false: - * :folding=explicit:collapseFolds=1: - * - * Copyright (C) 2010 Matthieu Casanova - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -package gatchan.highlight.color; - -import org.gjt.sp.jedit.textarea.TextArea; - -import java.awt.*; - -/** - * @author Matthieu Casanova - */ -public interface ColorHighlighter -{ - void paintColor(TextArea textArea, Graphics2D gfx, int physicalLine, int y, CharSequence lineContent, AlphaComposite blend, FontMetrics fm); -} Added: plugins/Highlight/trunk/src/gatchan/highlight/color/ColorToken.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/color/ColorToken.java (rev 0) +++ plugins/Highlight/trunk/src/gatchan/highlight/color/ColorToken.java 2010-10-19 12:52:37 UTC (rev 18797) @@ -0,0 +1,67 @@ +/* + * jEdit - Programmer's Text Editor + * :tabSize=8:indentSize=8:noTabs=false: + * :folding=explicit:collapseFolds=1: + * + * Copyright © 2010 Matthieu Casanova + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package gatchan.highlight.color; + +import java.awt.*; + +/** + * A color token. + * It contains the color and the offset within the line where it is. + * + * @author Matthieu Casanova + */ +public class ColorToken +{ + private final int start; + private final int end; + + private Color color; + + public ColorToken(int start, int end, String hexa) + { + System.out.println(start + " " + end + " " + hexa); + this.start = start; + this.end = end; + color = Color.decode(hexa); + } + + public int getStart() + { + return start; + } + + public int getEnd() + { + return end; + } + + public Color getColor() + { + return color; + } + + @Override + public String toString() + { + return "ColorToken[" + color + ',' + start + ',' + end + "]"; + } +} Added: plugins/Highlight/trunk/src/gatchan/highlight/color/Colors.flex =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/color/Colors.flex (rev 0) +++ plugins/Highlight/trunk/src/gatchan/highlight/color/Colors.flex 2010-10-19 12:52:37 UTC (rev 18797) @@ -0,0 +1,194 @@ +/* + * :tabSize=8:indentSize=8:noTabs=false: + * :folding=explicit:collapseFolds=1: + * + * Copyright © 2010 Matthieu Casanova + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package gatchan.highlight.color; + +%% + + +%class FlexColorScanner +%unicode +%char +%type ColorToken +%ignorecase + + +whitespace = [ \t] +ignore = [^] | whitespace + + +rgbhexa1 = #[a-fA-F0-9]{6} +rgbhexa2 = 0x[a-fA-F0-9]{6} + +rgb = rgb("0x[a-fA-F0-9]{6}") +%% + +<YYINITIAL> +{ + {ignore} { /* ignore */ } + {rgbhexa1} { return new ColorToken(yychar,yychar + yylength(), "0x"+yytext().substring(1));} + {rgbhexa2} { return new ColorToken(yychar,yychar + yylength(), yytext());} + AliceBlue { return new ColorToken(yychar,yychar + yylength(), "0xF0F8FF"); } + AntiqueWhite { return new ColorToken(yychar,yychar + yylength(), "0xFAEBD7"); } + Aqua { return new ColorToken(yychar,yychar + yylength(), "0x00FFFF"); } + Aquamarine { return new ColorToken(yychar,yychar + yylength(), "0x7FFFD4"); } + Azure { return new ColorToken(yychar,yychar + yylength(), "0xF0FFFF"); } + Beige { return new ColorToken(yychar,yychar + yylength(), "0xF5F5DC"); } + Bisque { return new ColorToken(yychar,yychar + yylength(), "0xFFE4C4"); } + Black { return new ColorToken(yychar,yychar + yylength(), "0x000000"); } + BlanchedAlmond { return new ColorToken(yychar,yychar + yylength(), "0xFFEBCD"); } + Blue { return new ColorToken(yychar,yychar + yylength(), "0x0000FF"); } + BlueViolet { return new ColorToken(yychar,yychar + yylength(), "0x8A2BE2"); } + Brown { return new ColorToken(yychar,yychar + yylength(), "0xA52A2A"); } + BurlyWood { return new ColorToken(yychar,yychar + yylength(), "0xDEB887"); } + CadetBlue { return new ColorToken(yychar,yychar + yylength(), "0x5F9EA0"); } + Chartreuse { return new ColorToken(yychar,yychar + yylength(), "0x7FFF00"); } + Chocolate { return new ColorToken(yychar,yychar + yylength(), "0xD2691E"); } + Coral { return new ColorToken(yychar,yychar + yylength(), "0xFF7F50"); } + CornflowerBlue { return new ColorToken(yychar,yychar + yylength(), "0x6495ED"); } + Cornsilk { return new ColorToken(yychar,yychar + yylength(), "0xFFF8DC"); } + Crimson { return new ColorToken(yychar,yychar + yylength(), "0xDC143C"); } + Cyan { return new ColorToken(yychar,yychar + yylength(), "0x00FFFF"); } + DarkBlue { return new ColorToken(yychar,yychar + yylength(), "0x00008B"); } + DarkCyan { return new ColorToken(yychar,yychar + yylength(), "0x008B8B"); } + DarkGoldenRod { return new ColorToken(yychar,yychar + yylength(), "0xB8860B"); } + DarkGray { return new ColorToken(yychar,yychar + yylength(), "0xA9A9A9"); } + DarkGrey { return new ColorToken(yychar,yychar + yylength(), "0xA9A9A9"); } + DarkGreen { return new ColorToken(yychar,yychar + yylength(), "0x006400"); } + DarkKhaki { return new ColorToken(yychar,yychar + yylength(), "0xBDB76B"); } + DarkMagenta { return new ColorToken(yychar,yychar + yylength(), "0x8B008B"); } + DarkOliveGreen { return new ColorToken(yychar,yychar + yylength(), "0x556B2F"); } + Darkorange { return new ColorToken(yychar,yychar + yylength(), "0xFF8C00"); } + DarkOrchid { return new ColorToken(yychar,yychar + yylength(), "0x9932CC"); } + DarkRed { return new ColorToken(yychar,yychar + yylength(), "0x8B0000"); } + DarkSalmon { return new ColorToken(yychar,yychar + yylength(), "0xE9967A"); } + DarkSeaGreen { return new ColorToken(yychar,yychar + yylength(), "0x8FBC8F"); } + DarkSlateBlue { return new ColorToken(yychar,yychar + yylength(), "0x483D8B"); } + DarkSlateGray { return new ColorToken(yychar,yychar + yylength(), "0x2F4F4F"); } + DarkSlateGrey { return new ColorToken(yychar,yychar + yylength(), "0x2F4F4F"); } + DarkTurquoise { return new ColorToken(yychar,yychar + yylength(), "0x00CED1"); } + DarkViolet { return new ColorToken(yychar,yychar + yylength(), "0x9400D3"); } + DeepPink { return new ColorToken(yychar,yychar + yylength(), "0xFF1493"); } + DeepSkyBlue { return new ColorToken(yychar,yychar + yylength(), "0x00BFFF"); } + DimGray { return new ColorToken(yychar,yychar + yylength(), "0x696969"); } + DimGrey { return new ColorToken(yychar,yychar + yylength(), "0x696969"); } + DodgerBlue { return new ColorToken(yychar,yychar + yylength(), "0x1E90FF"); } + FireBrick { return new ColorToken(yychar,yychar + yylength(), "0xB22222"); } + FloralWhite { return new ColorToken(yychar,yychar + yylength(), "0xFFFAF0"); } + ForestGreen { return new ColorToken(yychar,yychar + yylength(), "0x228B22"); } + Fuchsia { return new ColorToken(yychar,yychar + yylength(), "0xFF00FF"); } + Gainsboro { return new ColorToken(yychar,yychar + yylength(), "0xDCDCDC"); } + GhostWhite { return new ColorToken(yychar,yychar + yylength(), "0xF8F8FF"); } + Gold { return new ColorToken(yychar,yychar + yylength(), "0xFFD700"); } + GoldenRod { return new ColorToken(yychar,yychar + yylength(), "0xDAA520"); } + Gray { return new ColorToken(yychar,yychar + yylength(), "0x808080"); } + Grey { return new ColorToken(yychar,yychar + yylength(), "0x808080"); } + Green { return new ColorToken(yychar,yychar + yylength(), "0x008000"); } + GreenYellow { return new ColorToken(yychar,yychar + yylength(), "0xADFF2F"); } + HoneyDew { return new ColorToken(yychar,yychar + yylength(), "0xF0FFF0"); } + HotPink { return new ColorToken(yychar,yychar + yylength(), "0xFF69B4"); } + IndianRed { return new ColorToken(yychar,yychar + yylength(), "0xCD5C5C"); } + Indigo { return new ColorToken(yychar,yychar + yylength(), "0x4B0082"); } + Ivory { return new ColorToken(yychar,yychar + yylength(), "0xFFFFF0"); } + Khaki { return new ColorToken(yychar,yychar + yylength(), "0xF0E68C"); } + Lavender { return new ColorToken(yychar,yychar + yylength(), "0xE6E6FA"); } + LavenderBlush { return new ColorToken(yychar,yychar + yylength(), "0xFFF0F5"); } + LawnGreen { return new ColorToken(yychar,yychar + yylength(), "0x7CFC00"); } + LemonChiffon { return new ColorToken(yychar,yychar + yylength(), "0xFFFACD"); } + LightBlue { return new ColorToken(yychar,yychar + yylength(), "0xADD8E6"); } + LightCoral { return new ColorToken(yychar,yychar + yylength(), "0xF08080"); } + LightCyan { return new ColorToken(yychar,yychar + yylength(), "0xE0FFFF"); } + LightGoldenRodYellow { return new ColorToken(yychar,yychar + yylength(), "0xFAFAD2"); } + LightGray { return new ColorToken(yychar,yychar + yylength(), "0xD3D3D3"); } + LightGrey { return new ColorToken(yychar,yychar + yylength(), "0xD3D3D3"); } + LightGreen { return new ColorToken(yychar,yychar + yylength(), "0x90EE90"); } + LightPink { return new ColorToken(yychar,yychar + yylength(), "0xFFB6C1"); } + LightSalmon { return new ColorToken(yychar,yychar + yylength(), "0xFFA07A"); } + LightSeaGreen { return new ColorToken(yychar,yychar + yylength(), "0x20B2AA"); } + LightSkyBlue { return new ColorToken(yychar,yychar + yylength(), "0x87CEFA"); } + LightSlateGray { return new ColorToken(yychar,yychar + yylength(), "0x778899"); } + LightSlateGrey { return new ColorToken(yychar,yychar + yylength(), "0x778899"); } + LightSteelBlue { return new ColorToken(yychar,yychar + yylength(), "0xB0C4DE"); } + LightYellow { return new ColorToken(yychar,yychar + yylength(), "0xFFFFE0"); } + Lime { return new ColorToken(yychar,yychar + yylength(), "0x00FF00"); } + LimeGreen { return new ColorToken(yychar,yychar + yylength(), "0x32CD32"); } + Linen { return new ColorToken(yychar,yychar + yylength(), "0xFAF0E6"); } + Magenta { return new ColorToken(yychar,yychar + yylength(), "0xFF00FF"); } + Maroon { return new ColorToken(yychar,yychar + yylength(), "0x800000"); } + MediumAquaMarine { return new ColorToken(yychar,yychar + yylength(), "0x66CDAA"); } + MediumBlue { return new ColorToken(yychar,yychar + yylength(), "0x0000CD"); } + MediumOrchid { return new ColorToken(yychar,yychar + yylength(), "0xBA55D3"); } + MediumPurple { return new ColorToken(yychar,yychar + yylength(), "0x9370D8"); } + MediumSeaGreen { return new ColorToken(yychar,yychar + yylength(), "0x3CB371"); } + MediumSlateBlue { return new ColorToken(yychar,yychar + yylength(), "0x7B68EE"); } + MediumSpringGreen { return new ColorToken(yychar,yychar + yylength(), "0x00FA9A"); } + MediumTurquoise { return new ColorToken(yychar,yychar + yylength(), "0x48D1CC"); } + MediumVioletRed { return new ColorToken(yychar,yychar + yylength(), "0xC71585"); } + MidnightBlue { return new ColorToken(yychar,yychar + yylength(), "0x191970"); } + MintCream { return new ColorToken(yychar,yychar + yylength(), "0xF5FFFA"); } + MistyRose { return new ColorToken(yychar,yychar + yylength(), "0xFFE4E1"); } + Moccasin { return new ColorToken(yychar,yychar + yylength(), "0xFFE4B5"); } + NavajoWhite { return new ColorToken(yychar,yychar + yylength(), "0xFFDEAD"); } + Navy { return new ColorToken(yychar,yychar + yylength(), "0x000080"); } + OldLace { return new ColorToken(yychar,yychar + yylength(), "0xFDF5E6"); } + Olive { return new ColorToken(yychar,yychar + yylength(), "0x808000"); } + OliveDrab { return new ColorToken(yychar,yychar + yylength(), "0x6B8E23"); } + Orange { return new ColorToken(yychar,yychar + yylength(), "0xFFA500"); } + OrangeRed { return new ColorToken(yychar,yychar + yylength(), "0xFF4500"); } + Orchid { return new ColorToken(yychar,yychar + yylength(), "0xDA70D6"); } + PaleGoldenRod { return new ColorToken(yychar,yychar + yylength(), "0xEEE8AA"); } + PaleGreen { return new ColorToken(yychar,yychar + yylength(), "0x98FB98"); } + PaleTurquoise { return new ColorToken(yychar,yychar + yylength(), "0xAFEEEE"); } + PaleVioletRed { return new ColorToken(yychar,yychar + yylength(), "0xD87093"); } + PapayaWhip { return new ColorToken(yychar,yychar + yylength(), "0xFFEFD5"); } + PeachPuff { return new ColorToken(yychar,yychar + yylength(), "0xFFDAB9"); } + Peru { return new ColorToken(yychar,yychar + yylength(), "0xCD853F"); } + Pink { return new ColorToken(yychar,yychar + yylength(), "0xFFC0CB"); } + Plum { return new ColorToken(yychar,yychar + yylength(), "0xDDA0DD"); } + PowderBlue { return new ColorToken(yychar,yychar + yylength(), "0xB0E0E6"); } + Purple { return new ColorToken(yychar,yychar + yylength(), "0x800080"); } + Red { return new ColorToken(yychar,yychar + yylength(), "0xFF0000"); } + RosyBrown { return new ColorToken(yychar,yychar + yylength(), "0xBC8F8F"); } + RoyalBlue { return new ColorToken(yychar,yychar + yylength(), "0x4169E1"); } + SaddleBrown { return new ColorToken(yychar,yychar + yylength(), "0x8B4513"); } + Salmon { return new ColorToken(yychar,yychar + yylength(), "0xFA8072"); } + SandyBrown { return new ColorToken(yychar,yychar + yylength(), "0xF4A460"); } + SeaGreen { return new ColorToken(yychar,yychar + yylength(), "0x2E8B57"); } + SeaShell { return new ColorToken(yychar,yychar + yylength(), "0xFFF5EE"); } + Sienna { return new ColorToken(yychar,yychar + yylength(), "0xA0522D"); } + Silver { return new ColorToken(yychar,yychar + yylength(), "0xC0C0C0"); } + SkyBlue { return new ColorToken(yychar,yychar + yylength(), "0x87CEEB"); } + SlateBlue { return new ColorToken(yychar,yychar + yylength(), "0x6A5ACD"); } + SlateGray { return new ColorToken(yychar,yychar + yylength(), "0x708090"); } + SlateGrey { return new ColorToken(yychar,yychar + yylength(), "0x708090"); } + Snow { return new ColorToken(yychar,yychar + yylength(), "0xFFFAFA"); } + SpringGreen { return new ColorToken(yychar,yychar + yylength(), "0x00FF7F"); } + SteelBlue { return new ColorToken(yychar,yychar + yylength(), "0x4682B4"); } + Tan { return new ColorToken(yychar,yychar + yylength(), "0xD2B48C"); } + Teal { return new ColorToken(yychar,yychar + yylength(), "0x008080"); } + Thistle { return new ColorToken(yychar,yychar + yylength(), "0xD8BFD8"); } + Tomato { return new ColorToken(yychar,yychar + yylength(), "0xFF6347"); } + Turquoise { return new ColorToken(yychar,yychar + yylength(), "0x40E0D0"); } + Violet { return new ColorToken(yychar,yychar + yylength(), "0xEE82EE"); } + Wheat { return new ColorToken(yychar,yychar + yylength(), "0xF5DEB3"); } + White { return new ColorToken(yychar,yychar + yylength(), "0xFFFFFF"); } + WhiteSmoke { return new ColorToken(yychar,yychar + yylength(), "0xF5F5F5"); } + Yellow { return new ColorToken(yychar,yychar + yylength(), "0xFFFF00"); } + YellowGreen { return new ColorToken(yychar,yychar + yylength(), "0x9ACD32"); } +} Added: plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorPainter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorPainter.java (rev 0) +++ plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorPainter.java 2010-10-19 12:52:37 UTC (rev 18797) @@ -0,0 +1,126 @@ +/* + * jEdit - Programmer's Text Editor + * :tabSize=8:indentSize=8:noTabs=false: + * :folding=explicit:collapseFolds=1: + * + * Copyright © 2010 Matthieu Casanova + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package gatchan.highlight.color; + +import org.gjt.sp.jedit.buffer.JEditBuffer; +import org.gjt.sp.jedit.textarea.TextArea; +import org.gjt.sp.jedit.textarea.TextAreaExtension; +import org.gjt.sp.util.Log; + +import java.awt.*; +import java.io.IOException; +import java.io.StringReader; + +/** + * @author Matthieu Casanova + */ +public class FlexColorPainter extends TextAreaExtension +{ + public static final int MAX_LINE_LENGTH = 10000; + private final TextArea textArea; + private final Point point = new Point(); + + public FlexColorPainter(TextArea textArea) + { + this.textArea = textArea; + } + + @Override + public void paintValidLine(Graphics2D gfx, int screenLine, int physicalLine, int start, int end, int y) + { + JEditBuffer buffer = textArea.getBuffer(); + int lineStart = buffer.getLineStartOffset(physicalLine); + int length = buffer.getLineLength(physicalLine); + + int startOffset = textArea.getLineStartOffset(physicalLine); + int endOffset = textArea.getLineEndOffset(physicalLine); + int screenToPhysicalOffset = start - startOffset; + + + int l = length - screenToPhysicalOffset - endOffset + end; + if (l > MAX_LINE_LENGTH) + l = MAX_LINE_LENGTH; + String lineContent = buffer.getText(lineStart + screenToPhysicalOffset, + l); + if (lineContent.length() == 0) + return; + + + FlexColorScanner flexColor = new FlexColorScanner(new StringReader(lineContent)); + try + { + ColorToken token = flexColor.yylex(); + while (token != null) + { + paint(token, gfx, physicalLine, y); + try + { + token = flexColor.yylex(); + } + catch (IOException e) + { + Log.log(Log.ERROR, this, e); + } + } + } + catch (IOException e) + { + Log.log(Log.ERROR, this, e); + } + + } + + private void paint(ColorToken token, + Graphics2D gfx, + int physicalLine, + int y) + { + System.out.println(token); + Point p = textArea.offsetToXY(physicalLine, token.getStart(), point); + if (p == null) + { + System.out.println("error"); + // The start offset was not visible + return; + } + int startX = p.x; + + p = textArea.offsetToXY(physicalLine, token.getEnd(), point); + if (p == null) + { + System.out.println("error"); + // The end offset was not visible + return; + } + int endX = p.x; + Color oldColor = gfx.getColor(); + Composite oldComposite = gfx.getComposite(); + gfx.setColor(token.getColor()); + FontMetrics fm = textArea.getPainter().getFontMetrics(); + gfx.fillRect(startX, y, endX - startX, fm.getHeight() - 1); + + + + gfx.setColor(oldColor); + gfx.setComposite(oldComposite); + } //}}} +} Added: plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorScanner.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorScanner.java (rev 0) +++ plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorScanner.java 2010-10-19 12:52:37 UTC (rev 18797) @@ -0,0 +1,1503 @@ +/* The following code was generated by JFlex 1.4.3 on 19/10/10 14:36 */ + +package gatchan.highlight.color; + + +/** + * This class is a scanner generated by + * <a href="http://www.jflex.de/">JFlex</a> 1.4.3 + * on 19/10/10 14:36 from the specification file + * <tt>Colors.flex</tt> + */ +class FlexColorScanner { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int YYINITIAL = 0; + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0 + }; + + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED = + "\11\0\1\0\26\0\1\0\2\0\1\12\14\0\1\14\11\13\7\0"+ + "\1\10\1\17\1\11\1\30\1\5\1\34\1\26\1\2\1\3\1\35"+ + "\1\27\1\16\1\23\1\21\1\31\1\7\1\22\1\24\1\6\1\4"+ + "\1\20\1\32\1\1\1\15\1\33\1\25\6\0\1\10\1\17\1\11"+ + "\1\30\1\5\1\34\1\26\1\2\1\3\1\35\1\27\1\16\1\23"+ + "\1\21\1\31\1\7\1\22\1\24\1\6\1\4\1\20\1\32\1\1"+ + "\1\15\1\33\1\25\uff85\0"; + + /** + * Translates characters to character classes + */ + private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\1\0\27\1\112\0\1\2\65\0\1\3\35\0\1\4"+ + "\14\0\1\5\1\0\1\6\1\0\1\7\2\0\1\10"+ + "\4\0\1\11\7\0\1\11\3\0\1\12\10\0\1\13"+ + "\3\0\1\14\14\0\1\15\1\16\17\0\1\17\1\20"+ + "\4\0\1\21\30\0\1\22\4\0\1\23\4\0\1\24"+ + "\6\0\1\25\1\26\3\0\1\27\14\0\1\30\1\0"+ + "\1\31\16\0\1\32\15\0\1\33\2\0\1\34\1\35"+ + "\1\36\4\0\1\37\13\0\1\40\26\0\1\41\10\0"+ + "\1\42\34\0\1\43\1\44\1\45\1\46\5\0\1\47"+ + "\2\0\1\50\11\0\1\51\15\0\1\52\2\0\1\53"+ + "\37\0\1\54\7\0\1\55\11\0\1\56\12\0\1\57"+ + "\7\0\1\60\3\0\1\61\1\62\22\0\1\63\1\0"+ + "\1\64\20\0\1\65\20\0\1\66\7\0\1\67\4\0"+ + "\1\70\1\71\2\0\1\72\17\0\1\73\1\74\1\75"+ + "\3\0\1\76\1\77\1\100\2\0\1\101\3\0\1\102"+ + "\3\0\1\103\1\104\1\0\1\105\5\0\1\106\1\0"+ + "\1\107\1\110\1\0\1\111\3\0\1\112\3\0\1\113"+ + "\1\0\1\114\1\115\12\0\1\116\1\117\1\0\1\120"+ + "\1\0\1\121\6\0\1\122\1\0\1\123\5\0\1\124"+ + "\1\125\1\0\1\126\2\0\1\127\1\0\1\130\1\0"+ + "\1\131\3\0\1\132\1\0\1\133\1\134\6\0\1\135"+ + "\1\136\5\0\1\137\10\0\1\140\2\0\1\141\4\0"+ + "\1\142\5\0\1\143\1\144\1\145\1\146\3\0\1\147"+ + "\1\150\7\0\1\151\3\0\1\152\3\0\1\153\11\0"+ + "\1\154\1\155\4\0\1\156\2\0\1\157\1\160\1\161"+ + "\3\0\1\162\4\0\1\163\1\0\1\164\2\0\1\165"+ + "\4\0\1\166\1\0\1\167\2\0\1\170\4\0\1\171"+ + "\1\172\1\173\2\0\1\174\2\0\1\175\7\0\1\176"+ + "\1\177\1\200\1\201\1\0\1\202\1\203\1\204\1\0"+ + "\1\205\1\0\1\206\4\0\1\207\1\0\1\210\1\0"+ + "\1\211\1\0\1\212\2\0\1\213\1\0\1\214\2\0"+ + "\1\215"; + + private static int [] zzUnpackAction() { + int [] result = new int[893]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /** + * Translates a state to a row index in the transition table + */ + private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); + + private static final String ZZ_ROWMAP_PACKED_0 = + "\0\0\0\36\0\74\0\132\0\170\0\226\0\264\0\322"+ + "\0\360\0\u010e\0\u012c\0\u014a\0\u0168\0\u0186\0\u01a4\0\u01c2"+ + "\0\u01e0\0\u01fe\0\u021c\0\u023a\0\u0258\0\u0276\0\u0294\0\u02b2"+ + "\0\u02d0\0\u02ee\0\u030c\0\u032a\0\u0348\0\u0366\0\u0384\0\u03a2"+ + "\0\u03c0\0\u03de\0\u03fc\0\u041a\0\u0438\0\u0456\0\u0474\0\u0492"+ + "\0\u04b0\0\u04ce\0\u04ec\0\u050a\0\u0528\0\u0546\0\u0564\0\u0582"+ + "\0\u05a0\0\u05be\0\u05dc\0\u05fa\0\u0618\0\u0636\0\u0654\0\u0672"+ + "\0\u0690\0\u06ae\0\u06cc\0\u06ea\0\u0708\0\u0726\0\u0744\0\u0762"+ + "\0\u0780\0\u079e\0\u07bc\0\u07da\0\u07f8\0\u0816\0\u0834\0\u0852"+ + "\0\u0870\0\u088e\0\u08ac\0\u08ca\0\u08e8\0\u0906\0\u0924\0\u0942"+ + "\0\u0960\0\u097e\0\u099c\0\u09ba\0\u09d8\0\u09f6\0\u0a14\0\u0a32"+ + "\0\u0a50\0\u0a6e\0\u0a8c\0\u0aaa\0\u0ac8\0\u0ae6\0\u0b04\0\u0b22"+ + "\0\u0b40\0\u0b5e\0\36\0\u0b7c\0\u0b9a\0\u0bb8\0\u0bd6\0\u0bf4"+ + "\0\u0c12\0\u0c30\0\u0c4e\0\u0c6c\0\u0c8a\0\u0ca8\0\u0cc6\0\u0ce4"+ + "\0\u0d02\0\u0d20\0\u0d3e\0\u0d5c\0\u0d7a\0\u0d98\0\u0db6\0\u0dd4"+ + "\0\u0df2\0\u0e10\0\u0e2e\0\u0e4c\0\u0e6a\0\u0e88\0\u0ea6\0\u0ec4"+ + "\0\u0ee2\0\u0f00\0\u0f1e\0\u0f3c\0\u0f5a\0\u0f78\0\u0f96\0\u0fb4"+ + "\0\u0fd2\0\u0ff0\0\u100e\0\u102c\0\u104a\0\u1068\0\u1086\0\u10a4"+ + "\0\u10c2\0\u10e0\0\u10fe\0\u111c\0\u113a\0\u1158\0\u1176\0\u1194"+ + "\0\36\0\u11b2\0\u11d0\0\u11ee\0\u120c\0\u122a\0\u1248\0\u1266"+ + "\0\u1284\0\u12a2\0\u12c0\0\u12de\0\u12fc\0\u131a\0\u1338\0\u1356"+ + "\0\u1374\0\u1392\0\u13b0\0\u13ce\0\u13ec\0\u140a\0\u1428\0\u1446"+ + "\0\u1464\0\u1482\0\u14a0\0\u14be\0\u14dc\0\u14fa\0\36\0\u1518"+ + "\0\u1536\0\u1554\0\u1572\0\u1590\0\u15ae\0\u15cc\0\u15ea\0\u1608"+ + "\0\u1626\0\u1644\0\u1662\0\36\0\u1680\0\36\0\u169e\0\36"+ + "\0\u16bc\0\u16da\0\36\0\u16f8\0\u1716\0\u1734\0\u1752\0\u1770"+ + "\0\u178e\0\u17ac\0\u17ca\0\u17e8\0\u1806\0\u1824\0\u1842\0\36"+ + "\0\u1860\0\u187e\0\u189c\0\u18ba\0\u18d8\0\u18f6\0\u1914\0\u1932"+ + "\0\u1950\0\u196e\0\u198c\0\u19aa\0\u19c8\0\u19e6\0\u1a04\0\u1a22"+ + "\0\36\0\u1a40\0\u1a5e\0\u1a7c\0\u1a9a\0\u1ab8\0\u1ad6\0\u1af4"+ + "\0\u1b12\0\u1b30\0\u1b4e\0\u1b6c\0\u1b8a\0\36\0\u1ba8\0\u1bc6"+ + "\0\u1be4\0\u1c02\0\u1c20\0\u1c3e\0\u1c5c\0\u1c7a\0\u1c98\0\u1cb6"+ + "\0\u1cd4\0\u1cf2\0\u1d10\0\u1d2e\0\u1d4c\0\u1d6a\0\u1d88\0\36"+ + "\0\u1da6\0\u1dc4\0\u1de2\0\u1e00\0\36\0\u1e1e\0\u1e3c\0\u1e5a"+ + "\0\u1e78\0\u1e96\0\u1eb4\0\u1ed2\0\u1ef0\0\u1f0e\0\u1f2c\0\u1f4a"+ + "\0\u1f68\0\u1f86\0\u1fa4\0\u1fc2\0\u1fe0\0\u1ffe\0\u201c\0\u203a"+ + "\0\u2058\0\u2076\0\u2094\0\u20b2\0\u20d0\0\36\0\u20ee\0\u210c"+ + "\0\u212a\0\u2148\0\36\0\u2166\0\u2184\0\u21a2\0\u21c0\0\36"+ + "\0\u21de\0\u21fc\0\u221a\0\u2238\0\u2256\0\u2274\0\36\0\36"+ + "\0\u2292\0\u22b0\0\u22ce\0\36\0\u22ec\0\u230a\0\u2328\0\u2346"+ + "\0\u2364\0\u2382\0\u23a0\0\u23be\0\u23dc\0\u23fa\0\u2418\0\u2436"+ + "\0\u2454\0\u2472\0\36\0\u2490\0\u24ae\0\u24cc\0\u24ea\0\u2508"+ + "\0\u2526\0\u2544\0\u2562\0\u2580\0\u259e\0\u25bc\0\u25da\0\u25f8"+ + "\0\u2616\0\u2634\0\u2652\0\u2670\0\u268e\0\u26ac\0\u26ca\0\u26e8"+ + "\0\u2706\0\u2724\0\u2742\0\u2760\0\u277e\0\u279c\0\u27ba\0\36"+ + "\0\u27d8\0\u27f6\0\36\0\36\0\36\0\u2814\0\u2832\0\u2850"+ + "\0\u286e\0\36\0\u288c\0\u28aa\0\u28c8\0\u28e6\0\u2904\0\u2922"+ + "\0\u2940\0\u295e\0\u297c\0\u299a\0\u29b8\0\36\0\u29d6\0\u29f4"+ + "\0\u2a12\0\u2a30\0\u2a4e\0\u2a6c\0\u2a8a\0\u2aa8\0\u2ac6\0\u2ae4"+ + "\0\u2b02\0\u2b20\0\u2b3e\0\u2b5c\0\u2b7a\0\u2b98\0\u2bb6\0\u2bd4"+ + "\0\u2bf2\0\u2c10\0\u2c2e\0\u2c4c\0\36\0\u2c6a\0\u2c88\0\u2ca6"+ + "\0\u2cc4\0\u2ce2\0\u2d00\0\u2d1e\0\u2d3c\0\36\0\u2d5a\0\u2d78"+ + "\0\u2d96\0\u2db4\0\u2dd2\0\u2df0\0\u2e0e\0\u2e2c\0\u2e4a\0\u2e68"+ + "\0\u2e86\0\u2ea4\0\u2ec2\0\u2ee0\0\u2efe\0\u2f1c\0\u2f3a\0\u2f58"+ + "\0\u2f76\0\u2f94\0\u2fb2\0\u2fd0\0\u2fee\0\u300c\0\u302a\0\u3048"+ + "\0\u3066\0\u3084\0\u30a2\0\36\0\36\0\u30c0\0\u30de\0\u30fc"+ + "\0\u311a\0\u3138\0\u3156\0\36\0\u3174\0\u3192\0\36\0\u31b0"+ + "\0\u31ce\0\u31ec\0\u320a\0\u3228\0\u3246\0\u3264\0\u3282\0\u32a0"+ + "\0\36\0\u32be\0\u32dc\0\u32fa\0\u3318\0\u3336\0\u3354\0\u3372"+ + "\0\u3390\0\u33ae\0\u33cc\0\u33ea\0\u3408\0\u3426\0\36\0\u3444"+ + "\0\u3462\0\36\0\u3480\0\u349e\0\u34bc\0\u34da\0\u34f8\0\u3516"+ + "\0\u3534\0\u3552\0\u3570\0\u358e\0\u35ac\0\u35ca\0\u35e8\0\u3606"+ + "\0\u3624\0\u3642\0\u3660\0\u367e\0\u369c\0\u36ba\0\u36d8\0\u36f6"+ + "\0\u3714\0\u3732\0\u3750\0\u376e\0\u378c\0\u37aa\0\u37c8\0\u37e6"+ + "\0\u3804\0\36\0\u3822\0\u3840\0\u385e\0\u387c\0\u389a\0\u38b8"+ + "\0\u38d6\0\36\0\u38f4\0\u3912\0\u3930\0\u394e\0\u396c\0\u398a"+ + "\0\u39a8\0\u39c6\0\u39e4\0\36\0\u3a02\0\u3a20\0\u3a3e\0\u3a5c"+ + "\0\u3a7a\0\u3a98\0\u3ab6\0\u3ad4\0\u3af2\0\u3b10\0\36\0\u3b2e"+ + "\0\u3b4c\0\u3b6a\0\u3b88\0\u3ba6\0\u3bc4\0\u3be2\0\36\0\u3c00"+ + "\0\u3c1e\0\u3c3c\0\36\0\36\0\u3c5a\0\u3c78\0\u3c96\0\u3cb4"+ + "\0\u3cd2\0\u3cf0\0\u3d0e\0\u3d2c\0\u3d4a\0\u3d68\0\u3d86\0\u3da4"+ + "\0\u3dc2\0\u3de0\0\u3dfe\0\u3e1c\0\u3e3a\0\u3e58\0\36\0\u3e76"+ + "\0\36\0\u3e94\0\u3eb2\0\u3ed0\0\u3eee\0\u3f0c\0\u3f2a\0\u3f48"+ + "\0\u3f66\0\u3f84\0\u3fa2\0\u3fc0\0\u3fde\0\u3ffc\0\u401a\0\u4038"+ + "\0\u4056\0\u4074\0\u4092\0\u40b0\0\u40ce\0\u40ec\0\u410a\0\u4128"+ + "\0\u4146\0\u4164\0\u4182\0\u41a0\0\u41be\0\u41dc\0\u41fa\0\u4218"+ + "\0\u4236\0\u4254\0\36\0\u4272\0\u4290\0\u42ae\0\u42cc\0\u42ea"+ + "\0\u4308\0\u4326\0\36\0\u4344\0\u4362\0\u4380\0\u439e\0\36"+ + "\0\36\0\u43bc\0\u43da\0\36\0\u43f8\0\u4416\0\u4434\0\u4452"+ + "\0\u4470\0\u448e\0\u44ac\0\u44ca\0\u44e8\0\u4506\0\u4524\0\u4542"+ + "\0\u4560\0\u457e\0\u459c\0\36\0\36\0\36\0\u45ba\0\u45d8"+ + "\0\u45f6\0\36\0\36\0\36\0\u4614\0\u4632\0\36\0\u4650"+ + "\0\u466e\0\u468c\0\36\0\u46aa\0\u46c8\0\u46e6\0\36\0\36"+ + "\0\u4704\0\36\0\u4722\0\u4740\0\u475e\0\u477c\0\u479a\0\36"+ + "\0\u47b8\0\36\0\36\0\u47d6\0\36\0\u47f4\0\u4812\0\u4830"+ + "\0\36\0\u484e\0\u486c\0\u488a\0\36\0\u48a8\0\36\0\36"+ + "\0\u48c6\0\u48e4\0\u4902\0\u4920\0\u493e\0\u495c\0\u497a\0\u4998"+ + "\0\u49b6\0\u49d4\0\36\0\36\0\u49f2\0\36\0\u4a10\0\36"+ + "\0\u4a2e\0\u4a4c\0\u4a6a\0\u4a88\0\u4aa6\0\u4ac4\0\36\0\u4ae2"+ + "\0\36\0\u4b00\0\u4b1e\0\u4b3c\0\u4b5a\0\u4b78\0\36\0\36"+ + "\0\u4b96\0\36\0\u4bb4\0\u4bd2\0\36\0\u4bf0\0\36\0\u4c0e"+ + "\0\36\0\u4c2c\0\u4c4a\0\u4c68\0\36\0\u4c86\0\36\0\36"+ + "\0\u4ca4\0\u4cc2\0\u4ce0\0\u4cfe\0\u4d1c\0\u4d3a\0\36\0\36"+ + "\0\u4d58\0\u4d76\0\u4d94\0\u4db2\0\u4dd0\0\36\0\u4dee\0\u4e0c"+ + "\0\u4e2a\0\u4e48\0\u4e66\0\u4e84\0\u4ea2\0\u4ec0\0\36\0\u4ede"+ + "\0\u4efc\0\36\0\u4f1a\0\u4f38\0\u4f56\0\u4f74\0\36\0\u4f92"+ + "\0\u4fb0\0\u4fce\0\u4fec\0\u500a\0\36\0\36\0\36\0\36"+ + "\0\u5028\0\u5046\0\u5064\0\36\0\36\0\u5082\0\u50a0\0\u50be"+ + "\0\u50dc\0\u50fa\0\u5118\0\u5136\0\36\0\u5154\0\u5172\0\u5190"+ + "\0\36\0\u51ae\0\u51cc\0\u51ea\0\36\0\u5208\0\u5226\0\u5244"+ + "\0\u5262\0\u5280\0\u529e\0\u52bc\0\u52da\0\u52f8\0\36\0\36"+ + "\0\u5316\0\u5334\0\u5352\0\u5370\0\36\0\u538e\0\u53ac\0\36"+ + "\0\36\0\36\0\u53ca\0\u53e8\0\u5406\0\36\0\u5424\0\u5442"+ + "\0\u5460\0\u547e\0\36\0\u549c\0\36\0\u54ba\0\u54d8\0\36"+ + "\0\u54f6\0\u5514\0\u5532\0\u5550\0\36\0\u556e\0\36\0\u558c"+ + "\0\u55aa\0\36\0\u55c8\0\u55e6\0\u5604\0\u5622\0\36\0\36"+ + "\0\36\0\u5640\0\u565e\0\36\0\u567c\0\u569a\0\36\0\u56b8"+ + "\0\u56d6\0\u56f4\0\u5712\0\u5730\0\u574e\0\u576c\0\36\0\36"+ + "\0\36\0\36\0\u578a\0\36\0\36\0\36\0\u57a8\0\36"+ + "\0\u57c6\0\36\0\u57e4\0\u5802\0\u5820\0\u583e\0\36\0\u585c"+ + "\0\36\0\u587a\0\36\0\u5898\0\36\0\u58b6\0\u58d4\0\36"+ + "\0\u58f2\0\36\0\u5910\0\u592e\0\36"; + + private static int [] zzUnpackRowMap() { + int [] result = new int[893]; + int offset = 0; + offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackRowMap(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int high = packed.charAt(i++) << 16; + result[j++] = high | packed.charAt(i++); + } + return j; + } + + /** + * The transition table of the DFA + */ + private static final int [] ZZ_TRANS = zzUnpackTrans(); + + private static final String ZZ_TRANS_PACKED_0 = + "\1\2\1\3\1\4\1\5\1\6\1\2\1\7\1\10"+ + "\1\11\1\12\1\13\1\2\1\14\1\2\1\15\1\16"+ + "\1\2\1\17\1\2\1\20\1\21\1\2\1\22\1\23"+ + "\1\24\1\25\1\26\1\27\1\30\1\2\40\0\1\31"+ + "\64\0\1\32\25\0\1\33\10\0\1\34\5\0\1\35"+ + "\2\0\1\36\2\0\1\37\7\0\1\40\10\0\1\41"+ + "\7\0\1\42\1\43\1\44\1\0\1\45\1\46\5\0"+ + "\1\47\2\0\1\50\5\0\1\51\11\0\1\52\1\0"+ + "\1\53\2\0\1\54\5\0\1\55\1\0\1\56\10\0"+ + "\1\57\22\0\1\60\2\0\1\61\1\62\2\0\1\63"+ + "\12\0\1\64\5\0\1\65\13\0\1\66\4\0\1\67"+ + "\1\0\1\70\7\0\1\71\2\0\2\71\1\0\2\71"+ + "\2\0\1\71\10\0\1\71\3\0\1\71\16\0\1\72"+ + "\23\0\1\73\1\0\1\74\2\0\1\75\30\0\1\76"+ + "\1\0\1\77\10\0\1\100\1\0\1\101\3\0\1\102"+ + "\21\0\1\103\30\0\1\104\1\0\1\105\2\0\1\106"+ + "\20\0\1\107\11\0\1\110\23\0\1\111\6\0\1\112"+ + "\5\0\1\113\13\0\1\114\4\0\1\115\6\0\1\116"+ + "\36\0\1\117\1\0\1\120\2\0\1\121\20\0\1\122"+ + "\22\0\1\123\5\0\1\124\14\0\1\125\37\0\1\126"+ + "\33\0\1\127\12\0\1\130\1\0\1\131\10\0\1\132"+ + "\7\0\1\133\1\0\1\134\34\0\1\135\14\0\1\136"+ + "\44\0\1\137\36\0\1\140\7\0\1\141\42\0\1\142"+ + "\46\0\1\143\40\0\1\144\34\0\1\145\17\0\1\146"+ + "\10\0\1\147\24\0\1\150\40\0\1\151\51\0\1\152"+ + "\27\0\1\153\2\0\1\154\6\0\1\155\15\0\1\156"+ + "\56\0\1\157\37\0\1\160\23\0\1\161\24\0\1\162"+ + "\13\0\1\163\20\0\1\164\6\0\1\165\37\0\1\166"+ + "\41\0\1\167\12\0\1\170\37\0\1\171\36\0\1\172"+ + "\51\0\1\173\35\0\1\174\25\0\1\175\20\0\1\176"+ + "\34\0\1\177\10\0\1\200\56\0\1\201\21\0\1\202"+ + "\32\0\1\203\2\0\2\203\1\0\2\203\2\0\1\203"+ + "\10\0\1\203\3\0\1\203\6\0\1\204\2\0\2\204"+ + "\1\0\2\204\2\0\1\204\10\0\1\204\3\0\1\204"+ + "\22\0\1\205\1\0\1\206\2\0\1\207\32\0\1\210"+ + "\13\0\1\211\30\0\1\212\11\0\1\213\32\0\1\214"+ + "\42\0\1\215\7\0\1\216\41\0\1\217\42\0\1\220"+ + "\36\0\1\221\11\0\1\222\12\0\1\223\6\0\1\224"+ + "\35\0\1\225\31\0\1\226\1\0\1\227\20\0\1\230"+ + "\54\0\1\231\13\0\1\232\24\0\1\233\33\0\1\234"+ + "\7\0\1\235\37\0\1\236\2\0\1\237\43\0\1\240"+ + "\27\0\1\241\50\0\1\242\17\0\1\243\54\0\1\244"+ + "\41\0\1\245\10\0\1\246\24\0\1\247\15\0\1\250"+ + "\1\251\55\0\1\252\22\0\1\253\43\0\1\254\42\0"+ + "\1\255\15\0\1\256\50\0\1\257\15\0\1\260\41\0"+ + "\1\261\34\0\1\262\33\0\1\263\33\0\1\264\56\0"+ + "\1\265\17\0\1\266\45\0\1\267\41\0\1\270\23\0"+ + "\1\271\46\0\1\272\46\0\1\273\10\0\1\274\36\0"+ + "\1\275\17\0\1\276\12\0\1\277\55\0\1\300\42\0"+ + "\1\301\35\0\1\302\11\0\1\303\32\0\1\304\53\0"+ + "\1\305\45\0\1\306\17\0\1\307\44\0\1\310\25\0"+ + "\1\311\32\0\1\312\53\0\1\313\21\0\1\314\56\0"+ + "\1\315\16\0\1\316\27\0\1\317\42\0\1\320\51\0"+ + "\1\321\35\0\1\322\22\0\1\323\31\0\1\324\53\0"+ + "\1\325\22\0\1\326\10\0\1\327\35\0\1\330\21\0"+ + "\1\331\2\0\2\331\1\0\2\331\2\0\1\331\10\0"+ + "\1\331\3\0\1\331\6\0\1\332\2\0\2\332\1\0"+ + "\2\332\2\0\1\332\10\0\1\332\3\0\1\332\6\0"+ + "\1\333\35\0\1\334\32\0\1\335\64\0\1\336\25\0"+ + "\1\337\21\0\1\340\52\0\1\341\41\0\1\342\20\0"+ + "\1\343\7\0\1\344\21\0\1\345\46\0\1\346\20\0"+ + "\1\347\44\0\1\350\22\0\1\351\6\0\1\352\35\0"+ + "\1\353\52\0\1\354\17\0\1\355\63\0\1\356\11\0"+ + "\1\357\41\0\1\360\57\0\1\361\12\0\1\362\33\0"+ + "\1\363\50\0\1\364\21\0\1\365\25\0\1\366\35\0"+ + "\1\366\32\0\1\367\34\0\1\370\34\0\1\371\16\0"+ + "\1\372\55\0\1\373\34\0\1\374\41\0\1\375\21\0"+ + "\1\376\40\0\1\377\16\0\1\u0100\51\0\1\u0101\35\0"+ + "\1\u0102\24\0\1\u0103\54\0\1\u0104\13\0\1\u0105\40\0"+ + "\1\u0106\35\0\1\u0107\34\0\1\u0108\34\0\1\u0109\65\0"+ + "\1\u010a\12\0\1\u010b\15\0\1\u010c\42\0\1\u010d\6\0"+ + "\1\u010e\51\0\1\u010f\21\0\1\u0110\52\0\1\u0111\21\0"+ + "\1\u0112\46\0\1\u0113\21\0\1\u0114\57\0\1\u0115\32\0"+ + "\1\u0116\45\0\1\u0117\37\0\1\u0118\20\0\1\u0119\24\0"+ + "\1\u011a\46\0\1\u011b\21\0\1\u011c\66\0\1\u011d\6\0"+ + "\1\u011e\21\0\1\u011f\3\0\1\u0120\21\0\1\u0121\24\0"+ + "\1\u0122\35\0\1\u0123\52\0\1\u0124\36\0\1\u0125\17\0"+ + "\1\u0126\34\0\1\u0127\62\0\1\u0128\10\0\1\u0129\37\0"+ + "\1\u012a\45\0\1\u012b\25\0\1\u012c\25\0\1\u012d\6\0"+ + "\1\u012e\2\0\2\u012e\1\0\2\u012e\2\0\1\u012e\10\0"+ + "\1\u012e\3\0\1\u012e\6\0\1\u012f\2\0\2\u012f\1\0"+ + "\2\u012f\2\0\1\u012f\10\0\1\u012f\3\0\1\u012f\22\0"+ + "\1\u0130\42\0\1\u0131\13\0\1\u0132\52\0\1\u0133\42\0"+ + "\1\u0134\30\0\1\u0135\34\0\1\u0136\22\0\1\u0137\57\0"+ + "\1\u0138\17\0\1\u0139\56\0\1\u013a\36\0\1\u013b\23\0"+ + "\1\u013c\51\0\1\u013d\33\0\1\u013e\13\0\1\u013f\27\0"+ + "\1\u0140\52\0\1\u0141\46\0\1\u0142\25\0\1\u0143\24\0"+ + "\1\u0144\44\0\1\u0145\34\0\1\u0146\23\0\1\u0147\37\0"+ + "\1\u0148\50\0\1\u0149\21\0\1\u014a\33\0\1\u014b\56\0"+ + "\1\u014c\17\0\1\u014d\1\u014e\32\0\1\u014f\1\0\1\u0150"+ + "\2\0\1\u0151\5\0\1\u0152\3\0\1\u0153\1\u0154\1\0"+ + "\1\u0155\1\u0156\1\0\1\u0157\1\u0158\10\0\1\u0159\35\0"+ + "\1\u015a\40\0\1\u015b\53\0\1\u015c\12\0\1\u015d\37\0"+ + "\1\u015e\61\0\1\u015f\23\0\1\u0160\26\0\1\u0161\33\0"+ + "\1\u0162\35\0\1\u0163\35\0\1\u0164\50\0\1\u0165\44\0"+ + "\1\u0166\26\0\1\u0167\45\0\1\u0168\22\0\1\u0169\50\0"+ + "\1\u016a\35\0\1\u016b\14\0\1\u016c\51\0\1\u016d\30\0"+ + "\1\u016e\23\0\1\u016f\35\0\1\u0170\56\0\1\u0171\30\0"+ + "\1\u0172\33\0\1\u0173\23\0\1\u0174\47\0\1\u0175\6\0"+ + "\1\u0176\27\0\1\u0177\24\0\1\u0178\36\0\1\u0179\45\0"+ + "\1\u017a\41\0\1\u017b\4\0\1\u017c\7\0\1\u017d\37\0"+ + "\1\u017e\54\0\1\u017f\30\0\1\u0180\36\0\1\u0181\25\0"+ + "\1\u0182\51\0\1\u0183\27\0\1\u0184\36\0\1\u0185\47\0"+ + "\1\u0186\7\0\1\u0187\50\0\1\u0188\24\0\1\u0189\2\0"+ + "\2\u0189\1\0\2\u0189\2\0\1\u0189\10\0\1\u0189\3\0"+ + "\1\u0189\6\0\1\u018a\2\0\2\u018a\1\0\2\u018a\2\0"+ + "\1\u018a\10\0\1\u018a\3\0\1\u018a\25\0\1\u018b\17\0"+ + "\1\u018c\1\u018d\1\0\1\u018e\5\0\1\u018f\6\0\1\u0190"+ + "\4\0\1\u0191\13\0\1\u0192\50\0\1\u0193\41\0\1\u0194"+ + "\12\0\1\u0195\32\0\1\u0196\36\0\1\u0197\33\0\1\u0198"+ + "\65\0\1\u0199\30\0\1\u019a\35\0\1\u019b\37\0\1\u019c"+ + "\32\0\1\u019d\33\0\1\u019e\20\0\1\u019f\37\0\1\u01a0"+ + "\53\0\1\u01a1\30\0\1\u01a2\17\0\1\u01a3\53\0\1\u01a4"+ + "\51\0\1\u01a5\23\0\1\u01a6\21\0\1\u01a7\2\0\1\u01a7"+ + "\54\0\1\u01a8\11\0\1\u01a9\52\0\1\u01aa\22\0\1\u01ab"+ + "\2\0\1\u01ac\5\0\1\u01ad\52\0\1\u01ae\20\0\1\u01af"+ + "\27\0\1\u01b0\32\0\1\u01b1\54\0\1\u01b2\4\0\1\u01b3"+ + "\6\0\1\u01b4\51\0\1\u01b5\5\0\1\u01b6\14\0\1\u01b7"+ + "\56\0\1\u01b8\41\0\1\u01b9\16\0\1\u01ba\31\0\1\u01bb"+ + "\60\0\1\u01bc\11\0\1\u01bd\32\0\1\u01be\60\0\1\u01bf"+ + "\27\0\1\u01c0\22\0\1\u019f\36\0\1\u01c1\40\0\1\u01c2"+ + "\13\0\1\u01c3\41\0\1\u01c4\13\0\1\u01c5\54\0\1\u01c6"+ + "\16\0\1\u01c7\33\0\1\u01c8\50\0\1\u01c9\35\0\1\u01ca"+ + "\24\0\1\u01cb\56\0\1\u01cc\33\0\1\u01cd\30\0\1\u01ce"+ + "\34\0\1\u01cf\43\0\1\u01d0\16\0\1\u01d1\50\0\1\u01d2"+ + "\16\0\1\u01d3\60\0\1\u01d4\16\0\1\u01d5\46\0\1\u01d6"+ + "\50\0\1\u01d7\23\0\1\u01d8\34\0\1\u01d9\24\0\1\u01da"+ + "\54\0\1\u01db\16\0\1\u01dc\40\0\1\u01dd\43\0\1\u01de"+ + "\40\0\1\u01df\32\0\1\u01e0\50\0\1\u01e1\11\0\1\u01e2"+ + "\2\0\2\u01e2\1\0\2\u01e2\2\0\1\u01e2\10\0\1\u01e2"+ + "\3\0\1\u01e2\6\0\1\u01e3\2\0\2\u01e3\1\0\2\u01e3"+ + "\2\0\1\u01e3\10\0\1\u01e3\3\0\1\u01e3\6\0\1\u01e4"+ + "\34\0\1\u01e5\1\u01e6\2\0\1\u01e7\5\0\1\u01e8\10\0"+ + "\1\u01e9\11\0\1\u01ea\63\0\1\u01eb\1\0\1\u01ec\20\0"+ + "\1\u01ed\43\0\1\u01ee\4\0\1\u01ef\11\0\1\u01f0\32\0"+ + "\1\u01f1\40\0\1\u01f2\35\0\1\u01f3\35\0\1\u01f4\61\0"+ + "\1\u01f5\35\0\1\u01f6\5\0\1\u01f7\65\0\1\u01f8\11\0"+ + "\1\u01f9\32\0\1\u01fa\37\0\1\u01fb\1\0\1\u01fc\1\u01fd"+ + "\1\u01fe\6\0\1\u01ff\11\0\1\u0200\1\u0201\13\0\1\u0202"+ + "\30\0\1\u0203\63\0\1\u0204\22\0\1\u0205\21\0\1\u0206"+ + "\64\0\1\u0207\11\0\1\u0208\54\0\1\u0209\44\0\1\u020a"+ + "\35\0\1\u020b\23\0\1\u020c\40\0\1\u020d\21\0\1\u020e"+ + "\43\0\1\u020f\27\0\1\u0210\35\0\1\u0211\45\0\1\u0212"+ + "\43\0\1\u0213\37\0\1\u0214\12\0\1\u0215\2\0\1\u0216"+ + "\43\0\1\u0217\27\0\1\u0218\30\0\1\u0219\42\0\1\u021a"+ + "\1\u021b\55\0\1\u021c\23\0\1\u021d\42\0\1\u021e\16\0"+ + "\1\u021f\54\0\1\u0220\37\0\1\u0221\12\0\1\u0222\33\0"+ + "\1\u0223\62\0\1\u0224\17\0\1\u0225\56\0\1\u0226\5\0"+ + "\1\u0227\41\0\1\u0228\36\0\1\u0229\47\0\1\u022a\33\0"+ + "\1\u022b\40\0\1\u022c\40\0\1\u022d\42\0\1\u022e\30\0"+ + "\1\u022f\31\0\1\u0230\22\0\1\u0231\2\0\1\u0231\61\0"+ + "\1\u0232\3\0\1\u0233\55\0\1\u0234\20\0\1\u0235\60\0"+ + "\1\u0236\23\0\1\u0237\35\0\1\u0238\37\0\1\u0239\16\0"+ + "\1\u023a\37\0\1\u023b\52\0\1\u023c\21\0\1\u023d\51\0"+ + "\1\u023e\44\0\1\u023f\7\0\1\u0240\41\0\1\u0241\2\0"+ + "\2\u0241\1\0\2\u0241\2\0\1\u0241\10\0\1\u0241\3\0"+ + "\1\u0241\6\0\1\u0242\35\0\1\u0243\40\0\1\u0244\43\0"+ + "\1\u0245\27\0\1\u0246\60\0\1\u0247\23\0\1\u0248\40\0"+ + "\1\u0249\21\0\1\u024a\45\0\1\u024b\22\0\1\u024c\2\0"+ + "\1\u024d\43\0\1\u024e\35\0\1\u024f\22\0\1\u0250\37\0"+ + "\1\u0251\54\0\1\u0252\41\0\1\u0253\23\0\1\u0254\50\0"+ + "\1\u0255\6\0\1\u0256\41\0\1\u0257\37\0\1\u0258\31\0"+ + "\1\u0259\51\0\1\u025a\22\0\1\u025b\1\0\1\u025c\6\0"+ + "\1\u025d\37\0\1\u025e\37\0\1\u025f\31\0\1\u0260\43\0"+ + "\1\u0261\14\0\1\u0262\53\0\1\u0263\15\0\1\u0264\54\0"+ + "\1\u0265\20\0\1\u0266\56\0\1\u0267\27\0\1\u0268\50\0"+ + "\1\u0269\23\0\1\u026a\45\0\1\u026b\30\0\1\u026c\41\0"+ + "\1\u026d\32\0\1\u026e\16\0\1\u026f\52\0\1\u0270\21\0"+ + "\1\u0271\35\0\1\u0272\35\0\1\u0273\25\0\1\u0274\35\0"+ + "\1\u0274\32\0\1\u0275\34\0\1\u0276\40\0\1\u0277\24\0"+ + "\1\u0278\16\0\1\u0279\51\0\1\u027a\35\0\1\u027b\27\0"+ + "\1\u027c\32\0\1\u027d\54\0\1\u027e\22\0\1\u027f\26\0"+ + "\1\u0280\57\0\1\u0281\22\0\1\u0282\53\0\1\u0283\36\0"+ + "\1\u0284\12\0\1\u0285\35\0\1\u0286\35\0\1\u0287\31\0"+ + "\1\u0288\65\0\1\u0289\11\0\1\u028a\63\0\1\u028b\36\0"+ + "\1\u028c\4\0\1\u028d\52\0\1\u028e\36\0\1\u028f\21\0"+ + "\1\u0290\35\0\1\u0291\50\0\1\u0292\22\0\1\u0293\32\0"+ + "\1\u0294\54\0\1\u0295\22\0\1\u0296\34\0\1\u0297\35\0"+ + "\1\u0298\35\0\1\u0299\51\0\1\u029a\21\0\1\u029b\56\0"+ + "\1\u029c\32\0\1\u029d\16\0\1\u029e\50\0\1\u029f\45\0"+ + "\1\u02a0\16\0\1\u02a1\46\0\1\u02a2\21\0\1\u02a3\35\0"+ + "\1\u02a4\25\0\1\u02a5\35\0\1\u02a5\32\0\1\u02a6\23\0"+ + "\1\u02a7\53\0\1\u02a8\22\0\1\u02a9\33\0\1\u02aa\26\0"+ + "\1\u02ab\32\0\1\u02ac\60\0\1\u02ad\10\0\1\u02ae\37\0"+ + "\1\u02af\53\0\1\u02b0\31\0\1\u02b1\42\0\1\u02b2\21\0"+ + "\1\u02b3\51\0\1\u02b4\21\0\1\u02b5\51\0\1\u02b6\31\0"+ + "\1\u02b7\35\0\1\u02b8\26\0\1\u02b9\55\0\1\u02ba\25\0"+ + "\1\u02bb\21\0\1\u02bc\34\0\1\u02bd\62\0\1\u02be\22\0"+ + "\1\u02bf\47\0\1\u02c0\23\0\1\u02c1\37\0\1\u02c2\41\0"+ + "\1\u02c3\42\0\1\u02c4\11\0\1\u02c5\51\0\1\u02c6\35\0"+ + "\1\u02c7\21\0\1\u02c8\33\0\1\u02c9\37\0\1\u02ca\56\0"+ + "\1\u02cb\12\0\1\u02cc\37\0\1\u02cd\50\0\1\u02ce\34\0"+ + "\1\u02cf\46\0\1\u02d0\12\0\1\u02d1\57\0\1\u02d2\11\0"+ + "\1\u02d3\37\0\1\u02d4\35\0\1\2\35\0\1\u02d5\35\0"+ + "\1\u02d6\51\0\1\u02d7\15\0\1\u02d8\43\0\1\u02d9\57\0"+ + "\1\u02da\25\0\1\u02db\20\0\1\u02dc\36\0\1\u02dd\33\0"+ + "\1\u02de\37\0\1\u02df\35\0\1\u02e0\54\0\1\u02e1\27\0"+ + "\1\u02e2\43\0\1\u02e3\42\0\1\u02e4\11\0\1\u02e5\46\0"+ + "\1\u02e6\35\0\1\u02e7\40\0\1\u02e8\21\0\1\u02e9\61\0"+ + "\1\u02ea\40\0\1\u02eb\17\0\1\u02ec\35\0\1\u02ed\23\0"+ + "\1\u02ee\35\0\1\u02ef\47\0\1\u02f0\41\0\1\u02f1\41\0"+ + "\1\u02f2\12\0\1\u02f3\36\0\1\u02f4\40\0\1\u02f5\36\0"+ + "\1\u02f6\32\0\1\u02f7\32\0\1\u02f8\51\0\1\u02f9\24\0"+ + "\1\u02fa\61\0\1\u02fb\24\0\1\u02fc\46\0\1\u02fd\11\0"+ + "\1\u02fe\51\0\1\u02ff\33\0\1\u0300\6\0\1\u0301\13\0"+ + "\1\u0302\52\0\1\u0303\42\0\1\u0304\14\0\1\u0305\60\0"+ + "\1\u0306\11\0\1\u0307\36\0\1\u0308\35\0\1\u0309\34\0"+ + "\1\u030a\36\0\1\u030b\51\0\1\u030c\35\0\1\u030d\17\0"+ + "\1\u030e\56\0\1\u030f\35\0\1\u0310\15\0\1\u0311\50\0"+ + "\1\u0312\35\0\1\u0313\23\0\1\u0314\51\0\1\u0315\42\0"+ + "\1\u0316\27\0\1\u0317\36\0\1\u0318\15\0\1\u0319\65\0"+ + "\1\u031a\24\0\1\u031b\40\0\1\u031c\17\0\1\u031d\50\0"+ + "\1\u031e\35\0\1\u031f\41\0\1\u0320\32\0\1\u0321\21\0"+ + "\1\u0322\46\0\1\u0323\42\0\1\u0324\15\0\1\u0325\37\0"+ + "\1\u0326\31\0\1\u0327\41\0\1\u0328\33\0\1\u0329\37\0"+ + "\1\u032a\46\0\1\u032b\43\0\1\u032c\21\0\1\u032d\51\0"+ + "\1\u032e\35\0\1\u032f\32\0\1\u0330\21\0\1\u0331\51\0"+ + "\1\u0332\22\0\1\u0333\60\0\1\u0334\11\0\1\u0335\35\0"+ + "\1\u0336\46\0\1\u0337\35\0\1\u0338\24\0\1\u0339\54\0"+ + "\1\u033a\16\0\1\u033b\54\0\1\u033c\32\0\1\u033d\22\0"+ + "\1\u033e\60\0\1\u033f\11\0\1\u0340\61\0\1\u0341\11\0"+ + "\1\u0342\56\0\1\u0343\26\0\1\u0344\23\0\1\u0345\40\0"+ + "\1\u0346\55\0\1\u0347\11\0\1\u0348\37\0\1\u0349\50\0"+ + "\1\u034a\34\0\1\u034b\22\0\1\u034c\2\0\1\u034c\56\0"+ + "\1\u034d\11\0\1\u034e\35\0\1\u034f\60\0\1\u0350\35\0"+ + "\1\u0351\25\0\1\u0352\35\0\1\u0353\36\0\1\u0354\21\0"+ + "\1\u0355\2\0\1\u0355\56\0\1\u0356\6\0\1\u0357\54\0"+ + "\1\u0358\17\0\1\u0359\37\0\1\u035a\56\0\1\u035b\25\0"+ + "\1\u035c\43\0\1\u035d\35\0\1\u035e\16\0\1\u035f\35\0"+ + "\1\u0360\63\0\1\u0361\32\0\1\u0362\12\0\1\u0363\35\0"+ + "\1\u0364\35\0\1\u0365\63\0\1\u0366\32\0\1\u0367\35\0"+ + "\1\u0368\13\0\1\u0369\50\0\1\u036a\40\0\1\u036b\31\0"+ + "\1\u036c\20\0\1\u036d\37\0\1\u036e\51\0\1\u036f\47\0"+ + "\1\u0370\7\0\1\u0371\35\0\1\u0372\35\0\1\u0373\51\0"+ + "\1\u0374\44\0\1\u0375\12\0\1\u0376\35\0\1\u0377\35\0"+ + "\1\u0378\46\0\1\u0379\40\0\1\u037a\32\0\1\u037b\50\0"+ + "\1\u037c\5\0\1\u037d\34\0"; + + private static int [] zzUnpackTrans() { + int [] result = new int[22860]; + int offset = 0; + offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackTrans(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + value--; + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** + * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code> + */ + private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); + + private static final String ZZ_ATTRIBUTE_PACKED_0 = + "\1\0\1\11\26\1\112\0\1\11\65\0\1\11\35\0"+ + "\1\11\14\0\1\11\1\0\1\11\1\0\1\11\2\0"+ + "\1\11\4\0\1\1\7\0\1\11\3\0\1\1\10\0"+ + "\1\1\3\0\1\11\14\0\1\11\1\1\17\0\1\1"+ + "\1\11\4\0\1\11\30\0\1\11\4\0\1\11\4\0"+ + "\1\11\6\0\2\11\3\0\1\11\14\0\1\1\1\0"+ + "\1\11\16\0\1\1\15\0\1\11\2\0\3\11\4\0"+ + "\1\11\13\0\1\11\26\0\1\11\10\0\1\11\34\0"+ + "\1\1\2\11\1\1\5\0\1\11\2\0\1\11\11\0"+ + "\1\11\15\0\1\11\2\0\1\11\37\0\1\11\7\0"+ + "\1\11\11\0\1\11\12\0\1\11\7\0\1\11\3\0"+ + "\2\11\22\0\1\11\1\0\1\11\20\0\1\1\20\0"+ + "\1\11\7\0\1\11\4\0\2\11\2\0\1\11\17\0"+ + "\3\11\3\0\3\11\2\0\1\11\3\0\1\11\3\0"+ + "\2\11\1\0\1\11\5\0\1\11\1\0\2\11\1\0"+ + "\1\11\3\0\1\11\3\0\1\11\1\0\2\11\12\0"+ + "\2\11\1\0\1\11\1\0\1\11\6\0\1\11\1\0"+ + "\1\11\5\0\2\11\1\0\1\11\2\0\1\11\1\0"+ + "\1\11\1\0\1\11\3\0\1\11\1\0\2\11\6\0"+ + "\2\11\5\0\1\11\10\0\1\11\2\0\1\11\4\0"+ + "\1\11\5\0\4\11\3\0\2\11\7\0\1\11\3\0"+ + "\1\11\3\0\1\11\11\0\2\11\4\0\1\11\2\0"+ + "\3\11\3\0\1\11\4\0\1\11\1\0\1\11\2\0"+ + "\1\11\4\0\1\11\1\0\1\11\2\0\1\11\4\0"+ + "\3\11\2\0\1\11\2\0\1\11\7\0\4\11\1\0"+ + "\3\11\1\0\1\11\1\0\1\11\4\0\1\11\1\0"+ + "\1\11\1\0\1\11\1\0\1\11\2\0\1\11\1\0"+ + "\1\11\2\0\1\11"; + + private static int [] zzUnpackAttribute() { + int [] result = new int[893]; + int offset = 0; + offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAttribute(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + /** the input device */ + private java.io.Reader zzReader; + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** number of newlines encountered up to the start of the matched text */ + private int yyline; + + /** the number of characters up to the start of the matched text */ + private int yychar; + + /** + * the number of characters from the last newline up to the start of the + * matched text + */ + private int yycolumn; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + + /** + * Creates a new scanner + * There is also a java.io.InputStream version of this constructor. + * + * @param in the java.io.Reader to read input from. + */ + FlexColorScanner(java.io.Reader in) { + this.zzReader = in; + } + + /** + * Creates a new scanner. + * There is also java.io.Reader version of this constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + FlexColorScanner(java.io.InputStream in) { + this(new java.io.InputStreamReader(in)); + } + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + char [] map = new char[0x10000]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < 128) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do map[j++] = value; while (--count > 0); + } + return map; + } + + + /** + * Refills the input buffer. + * + * @return <code>false</code>, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + + /* first: make room (if you can) */ + if (zzStartRead > 0) { + System.arraycopy(zzBuffer, zzStartRead, + zzBuffer, 0, + zzEndRead-zzStartRead); + + /* translate stored positions */ + zzEndRead-= zzStartRead; + zzCurrentPos-= zzStartRead; + zzMarkedPos-= zzStartRead; + zzStartRead = 0; + } + + /* is the buffer big enough? */ + if (zzCurrentPos >= zzBuffer.length) { + /* if not: blow it up */ + char newBuffer[] = new char[zzCurrentPos*2]; + System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); + zzBuffer = newBuffer; + } + + /* finally: fill the buffer with new input */ + int numRead = zzReader.read(zzBuffer, zzEndRead, + zzBuffer.length-zzEndRead); + + if (numRead > 0) { + zzEndRead+= numRead; + return false; + } + // unlikely but not impossible: read 0 characters, but not at end of stream + if (numRead == 0) { + int c = zzReader.read(); + if (c == -1) { + return true; + } else { + zzBuffer[zzEndRead++] = (char) c; + return false; + } + } + + // numRead < 0 + return true; + } + + + /** + * Closes the input stream. + */ + public final void yyclose() throws java.io.IOException { + zzAtEOF = true; /* indicate end of file */ + zzEndRead = zzStartRead; /* invalidate buffer */ + + if (zzReader != null) + zzReader.close(); + } + + + /** + * Resets the scanner to read from a new inp... [truncated message content] |
From: <kp...@us...> - 2010-10-19 14:01:05
|
Revision: 18798 http://jedit.svn.sourceforge.net/jedit/?rev=18798&view=rev Author: kpouer Date: 2010-10-19 14:00:59 +0000 (Tue, 19 Oct 2010) Log Message: ----------- added an option for color highlight Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorPainter.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2010-10-19 12:52:37 UTC (rev 18797) +++ plugins/Highlight/trunk/Highlight.props 2010-10-19 14:00:59 UTC (rev 18798) @@ -95,8 +95,8 @@ gatchan.highlight.selectionHighlight.ignoreCase.text=ignore case gatchan.highlight.selectionHighlight.color=#FFFF66 gatchan.highlight.selectionHighlight.color.text=Color of the selection highlight : +gatchan.highlight.colorsenabled.text=Highlight colors in the buffer - gatchan.highlight.overview.text=Highlight overview gatchan.highlight.overview=true #}}} \ No newline at end of file Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2010-10-19 12:52:37 UTC (rev 18797) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2010-10-19 14:00:59 UTC (rev 18798) @@ -67,6 +67,8 @@ public static final String PROP_HIGHLIGHT_OVERVIEW = "gatchan.highlight.overview"; public static final String PROP_HIGHLIGHT_OVERVIEW_COLOR = "gatchan.highlight.overview.color"; + public static final String PROP_HIGHLIGHT_COLORS = "gatchan.highlight.colorsenabled"; + private JCheckBox highlightWordAtCaret; private JCheckBox wordAtCaretIgnoreCase; private JCheckBox entireWord; @@ -90,6 +92,7 @@ private ColorWellButton selectionColor; private JCheckBox highlightOverview; + private JCheckBox highlightColorEnabled; private ColorWellButton highlightOverviewColor; //{{{ HighlightOptionPane constructor @@ -160,6 +163,8 @@ addComponent(highlightOverview = createCheckBox(PROP_HIGHLIGHT_OVERVIEW)); addComponent(new JLabel(jEdit.getProperty(PROP_HIGHLIGHT_OVERVIEW_COLOR + ".text")), highlightOverviewColor = new ColorWellButton(jEdit.getColorProperty(PROP_HIGHLIGHT_OVERVIEW_COLOR))); + addSeparator(PROP_HIGHLIGHT_COLORS+".text"); + addComponent(highlightColorEnabled = createCheckBox(PROP_HIGHLIGHT_COLORS)); } //}}} @@ -197,6 +202,7 @@ jEdit.setBooleanProperty(PROP_HIGHLIGHT_OVERVIEW, highlightOverview.isSelected()); jEdit.setColorProperty(PROP_HIGHLIGHT_OVERVIEW_COLOR, highlightOverviewColor.getSelectedColor()); + jEdit.setBooleanProperty(PROP_HIGHLIGHT_COLORS, highlightColorEnabled.isSelected()); } //}}} //{{{ createCheckBox() method Modified: plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorPainter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorPainter.java 2010-10-19 12:52:37 UTC (rev 18797) +++ plugins/Highlight/trunk/src/gatchan/highlight/color/FlexColorPainter.java 2010-10-19 14:00:59 UTC (rev 18798) @@ -21,7 +21,12 @@ package gatchan.highlight.color; +import gatchan.highlight.HighlightManager; +import gatchan.highlight.HighlightManagerTableModel; +import gatchan.highlight.HighlightOptionPane; +import gatchan.highlight.HighlightPlugin; import org.gjt.sp.jedit.buffer.JEditBuffer; +import org.gjt.sp.jedit.jEdit; import org.gjt.sp.jedit.textarea.TextArea; import org.gjt.sp.jedit.textarea.TextAreaExtension; import org.gjt.sp.util.Log; @@ -38,13 +43,23 @@ public static final int MAX_LINE_LENGTH = 10000; private final TextArea textArea; private final Point point = new Point(); + private final HighlightManager highlightManager; public FlexColorPainter(TextArea textArea) { this.textArea = textArea; + highlightManager = HighlightManagerTableModel.getManager(); } + //{{{ paintScreenLineRange() method @Override + public void paintScreenLineRange(Graphics2D gfx, int firstLine, int lastLine, int[] physicalLines, int[] start, int[] end, int y, int lineHeight) + { + if (jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_COLORS)) + super.paintScreenLineRange(gfx, firstLine, lastLine, physicalLines, start, end, y, lineHeight); + } //}}} + + @Override public void paintValidLine(Graphics2D gfx, int screenLine, int physicalLine, int start, int end, int y) { JEditBuffer buffer = textArea.getBuffer(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2011-01-29 16:33:14
|
Revision: 19313 http://jedit.svn.sourceforge.net/jedit/?rev=19313&view=rev Author: kpouer Date: 2011-01-29 16:33:08 +0000 (Sat, 29 Jan 2011) Log Message: ----------- If the buffer is empty, opening highlight dialog give a NPE (bug #3160075) Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2011-01-29 16:22:48 UTC (rev 19312) +++ plugins/Highlight/trunk/Highlight.props 2011-01-29 16:33:08 UTC (rev 19313) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.9.0 +plugin.gatchan.highlight.HighlightPlugin.version=1.9.1 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2011-01-29 16:22:48 UTC (rev 19312) +++ plugins/Highlight/trunk/docs/Highlight.html 2011-01-29 16:33:08 UTC (rev 19313) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.9.0 (Nov 22, 2010)</span><br> + <span style="font-weight:bold">Version 1.9.1 (Jan 29, 2011)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,8 +42,12 @@ </p> <h2>History</h2> <ul> - <li>1.9.0 (Nov 22, 2010)</li> + <li>1.9.1 (Jan 29, 2011)</li> <ul> + <li>If the buffer is empty, opening highlight dialog give a NPE (bug #3160075)</li> + </ul> + <li>1.9.0 (Oct 19, 2010)</li> + <ul> <li>Highlight now colors in the buffer</li> </ul> <li>1.8.4 (Aug 4, 2010)</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2011-01-29 16:22:48 UTC (rev 19312) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2011-01-29 16:33:08 UTC (rev 19313) @@ -3,7 +3,7 @@ * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * - * Copyright (C) 2004, 2010 Matthieu Casanova + * Copyright (C) 2004, 2011 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -433,7 +433,7 @@ String currentWord = getCurrentWord(textArea); HighlightDialog d = new HighlightDialog(view); - if (currentWord.length() != 0) + if (currentWord != null && currentWord.length() != 0) { d.setString(currentWord); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2011-08-09 17:32:56
|
Revision: 19772 http://jedit.svn.sourceforge.net/jedit/?rev=19772&view=rev Author: kpouer Date: 2011-08-09 17:32:49 +0000 (Tue, 09 Aug 2011) Log Message: ----------- Removed the highlight subsequence option, too complex for not a good result. The selection highlight do not highlight the current selection anymore so it is easier to see where the caret is. Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/Highlight.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2011-08-09 16:56:14 UTC (rev 19771) +++ plugins/Highlight/trunk/Highlight.props 2011-08-09 17:32:49 UTC (rev 19772) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.9.1 +plugin.gatchan.highlight.HighlightPlugin.version=1.9.5 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 @@ -66,15 +66,12 @@ #{{{ properties for option pane gatchan.highlight.option-pane.commonProperties.text=Common properties -gatchan.highlight.subsequence.text=Highlight subsequences (if checked, the same highlight can be found several times inside the same word. This will not change previous highlights) -gatchan.highlight.subsequence=true gatchan.highlight.cycleColor.text=Cycle the color when creating highlights : gatchan.highlight.defaultColor=#66FFFF gatchan.highlight.defaultColor.text=Choose the color of the highlights gatchan.highlight.appendHighlight=true gatchan.highlight.appendHighlight.text=Append highlights (if not checked an highlight will replace the previous one) -gatchan.highlight.caretHighlight.subsequence.text=Highlight subsequences (if checked, the same highlight can be found several times inside the same word) gatchan.highlight.caretHighlight.whitespace.text=Highlight whitespace words gatchan.highlight.caretHighlight.onlyWords.text=Highlight only words gatchan.highlight.hyperSearchResults.text=Highlight hypersearch results Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2011-08-09 16:56:14 UTC (rev 19771) +++ plugins/Highlight/trunk/docs/Highlight.html 2011-08-09 17:32:49 UTC (rev 19772) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.9.1 (Jan 29, 2011)</span><br> + <span style="font-weight:bold">Version 1.9.5 (Aug 09, 2011)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,6 +42,12 @@ </p> <h2>History</h2> <ul> + <li>1.9.5 (Aug 09, 2011)</li> + <ul> + <li>Removed the highlight subsequence option, too complex for not a good result.</li> + <li>The selection highlight do not highlight the current selection anymore so it is easier to see where the + caret is.</li> + </ul> <li>1.9.1 (Jan 29, 2011)</li> <ul> <li>If the buffer is empty, opening highlight dialog give a NPE (bug #3160075)</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/Highlight.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/Highlight.java 2011-08-09 16:56:14 UTC (rev 19771) +++ plugins/Highlight/trunk/src/gatchan/highlight/Highlight.java 2011-08-09 17:32:49 UTC (rev 19772) @@ -65,8 +65,6 @@ private static final int HIGHLIGHT_VERSION = 1; - private boolean highlightSubsequence = jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_SUBSEQUENCE); - /** * The default color. If null we will cycle the colors. */ @@ -436,28 +434,4 @@ { init(stringToHighlight, regexp, ignoreCase, color); } //}}} - - //{{{ isHighlightSubsequence() method - public boolean isHighlightSubsequence() - { - return highlightSubsequence; - } //}}} - - //{{{ setHighlightSubsequence() method - /** - * Activate or deactivate the feature "highlight subsequence" - * Highlight subsequences (if checked, the same highlight can be found several times inside the same word) - * - * @param highlightSubsequence true to activate the feature, false otherwise - * @return <code>true</code> if the value was changed - */ - public boolean setHighlightSubsequence(boolean highlightSubsequence) - { - if (this.highlightSubsequence != highlightSubsequence) - { - this.highlightSubsequence = highlightSubsequence; - return true; - } - return false; - } //}}} } Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2011-08-09 16:56:14 UTC (rev 19771) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightManagerTableModel.java 2011-08-09 17:32:49 UTC (rev 19772) @@ -812,12 +812,6 @@ changedSelection = true; } //}}} - //{{{ PROP_HIGHLIGHT_WORD_AT_CARET_SUBSEQUENCE - if (currentWordHighlight.setHighlightSubsequence(jEdit.getBooleanProperty(HighlightOptionPane.PROP_HIGHLIGHT_WORD_AT_CARET_SUBSEQUENCE))) - { - changed = true; - } //}}} - Highlighter.square = jEdit.getBooleanProperty(HighlightOptionPane.PROP_SQUARE); Highlighter.squareColor = jEdit.getColorProperty(HighlightOptionPane.PROP_SQUARE_COLOR); Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2011-08-09 16:56:14 UTC (rev 19771) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2011-08-09 17:32:49 UTC (rev 19772) @@ -53,8 +53,6 @@ public static final String PROP_HIGHLIGHT_CYCLE_COLOR = "gatchan.highlight.cycleColor"; public static final String PROP_HIGHLIGHT_APPEND = "gatchan.highlight.appendHighlight"; - public static final String PROP_HIGHLIGHT_SUBSEQUENCE = "gatchan.highlight.subsequence"; - public static final String PROP_HIGHLIGHT_WORD_AT_CARET_SUBSEQUENCE = "gatchan.highlight.caretHighlight.subsequence"; public static final String PROP_HIGHLIGHT_WORD_AT_CARET_WHITESPACE = "gatchan.highlight.caretHighlight.whitespace"; public static final String PROP_HIGHLIGHT_WORD_AT_CARET_ONLYWORDS = "gatchan.highlight.caretHighlight.onlyWords"; public static final String PROP_HIGHLIGHT_HYPERSEARCH_RESULTS = "gatchan.highlight.hyperSearchResults"; @@ -77,9 +75,7 @@ private ColorWellButton squareColor; private JCheckBox cycleColor; private JCheckBox highlightAppend; - private JCheckBox highlightSubsequence; private ColorWellButton defaultColor; - private JCheckBox caretHighlightSubsequence; private JCheckBox wordAtCaretWhitespace; private JCheckBox wordAtCaretOnlyWords; private JCheckBox highlightHypersearch; @@ -105,7 +101,6 @@ protected void _init() { addSeparator(PROP_COMMON_PROPERTIES); - addComponent(highlightSubsequence = createCheckBox(PROP_HIGHLIGHT_SUBSEQUENCE)); addComponent(highlightAppend = createCheckBox(PROP_HIGHLIGHT_APPEND)); addComponent(cycleColor = createCheckBox(PROP_HIGHLIGHT_CYCLE_COLOR)); addComponent(new JLabel(jEdit.getProperty(PROP_DEFAULT_COLOR + ".text")), @@ -144,7 +139,6 @@ addSeparator(PROP_HIGHLIGHT_WORD_AT_CARET + ".text"); addComponent(highlightWordAtCaret = createCheckBox(PROP_HIGHLIGHT_WORD_AT_CARET)); - addComponent(caretHighlightSubsequence = createCheckBox(PROP_HIGHLIGHT_WORD_AT_CARET_SUBSEQUENCE)); addComponent(wordAtCaretIgnoreCase = createCheckBox(PROP_HIGHLIGHT_WORD_AT_CARET_IGNORE_CASE)); addComponent(wordAtCaretWhitespace = createCheckBox(PROP_HIGHLIGHT_WORD_AT_CARET_WHITESPACE)); addComponent(wordAtCaretOnlyWords = createCheckBox(PROP_HIGHLIGHT_WORD_AT_CARET_ONLYWORDS)); @@ -172,14 +166,12 @@ protected void _save() { jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET, highlightWordAtCaret.isSelected()); - jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET_SUBSEQUENCE, caretHighlightSubsequence.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET_IGNORE_CASE, wordAtCaretIgnoreCase.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET_ENTIRE_WORD, entireWord.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET_WHITESPACE, wordAtCaretWhitespace.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET_ONLYWORDS, wordAtCaretOnlyWords.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_HYPERSEARCH_RESULTS, highlightHypersearch.isSelected()); - jEdit.setBooleanProperty(PROP_HIGHLIGHT_SUBSEQUENCE, highlightSubsequence.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_CYCLE_COLOR, cycleColor.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_APPEND, highlightAppend.isSelected()); jEdit.setColorProperty(PROP_HIGHLIGHT_WORD_AT_CARET_COLOR, wordAtCaretColor.getSelectedColor()); Modified: plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2011-08-09 16:56:14 UTC (rev 19771) +++ plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2011-08-09 17:32:49 UTC (rev 19772) @@ -26,6 +26,7 @@ import org.gjt.sp.jedit.jEdit; import org.gjt.sp.jedit.search.SearchMatcher; import org.gjt.sp.jedit.textarea.JEditTextArea; +import org.gjt.sp.jedit.textarea.Selection; import org.gjt.sp.jedit.textarea.TextAreaExtension; import java.awt.*; @@ -112,18 +113,17 @@ int y) { JEditBuffer buffer = textArea.getBuffer(); - int lineStart = buffer.getLineStartOffset(physicalLine); + int lineStartOffset = buffer.getLineStartOffset(physicalLine); + int lineEndOffset = buffer.getLineEndOffset(physicalLine); int length = buffer.getLineLength(physicalLine); - int startOffset = textArea.getLineStartOffset(physicalLine); - int endOffset = textArea.getLineEndOffset(physicalLine); - int screenToPhysicalOffset = start - startOffset; + int screenToPhysicalOffset = start - lineStartOffset; - int l = length - screenToPhysicalOffset - endOffset + end; + int l = length - screenToPhysicalOffset - lineEndOffset + end; if (l > MAX_LINE_LENGTH) l = MAX_LINE_LENGTH; - CharSequence lineContent = buffer.getSegment(lineStart + screenToPhysicalOffset, + CharSequence lineContent = buffer.getSegment(lineStartOffset + screenToPhysicalOffset, l); if (lineContent.length() == 0) return; @@ -145,11 +145,16 @@ highlightManager.releaseLock(); } tempLineContent = lineContent; - - highlight(HighlightManagerTableModel.currentWordHighlight, buffer, gfx, physicalLine, y, - screenToPhysicalOffset, tempLineContent); - highlight(HighlightManagerTableModel.selectionHighlight, buffer, gfx, physicalLine, y, - screenToPhysicalOffset, tempLineContent); + if (textArea.getSelectionCount() == 0) + { + highlight(HighlightManagerTableModel.currentWordHighlight, buffer, gfx, physicalLine, y, + screenToPhysicalOffset, tempLineContent); + } + else + { + highlight(HighlightManagerTableModel.selectionHighlight, buffer, gfx, physicalLine, y, + screenToPhysicalOffset, tempLineContent); + } } //}}} //{{{ highlight() method @@ -170,7 +175,6 @@ } SearchMatcher searchMatcher = highlight.getSearchMatcher(); - boolean subsequence = highlight.isHighlightSubsequence(); try { int i = 0; @@ -184,16 +188,20 @@ false); if (match == null || match.end == match.start) break; - _highlight(highlight.getColor(), gfx, physicalLine, match.start + i + - screenToPhysicalOffset, match.end + i + screenToPhysicalOffset, y); + Selection selectionAtOffset = textArea.getSelectionAtOffset(match.start + i + + screenToPhysicalOffset); + if (selectionAtOffset == null) + { + _highlight(highlight.getColor(), gfx, physicalLine, match.start + i + + screenToPhysicalOffset, match.end + i + screenToPhysicalOffset, y); + } highlight.updateLastSeen(); - int skip = subsequence ? match.start + 1 : match.end; - i += skip; - int length = tempLineContent.length() - skip; + i += match.end; + int length = tempLineContent.length() - match.end; if (length <= 0) break; - tempLineContent = tempLineContent.subSequence(skip, - length + skip); + tempLineContent = tempLineContent.subSequence(match.end, + length + match.end); } } catch (PatternSyntaxException e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2011-08-09 18:05:24
|
Revision: 19773 http://jedit.svn.sourceforge.net/jedit/?rev=19773&view=rev Author: kpouer Date: 2011-08-09 18:05:18 +0000 (Tue, 09 Aug 2011) Log Message: ----------- Fixed ' changed into &apos in Hypersearch results highlight (#3310376) Modified Paths: -------------- plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2011-08-09 17:32:49 UTC (rev 19772) +++ plugins/Highlight/trunk/docs/Highlight.html 2011-08-09 18:05:18 UTC (rev 19773) @@ -44,6 +44,7 @@ <ul> <li>1.9.5 (Aug 09, 2011)</li> <ul> + <li>Fixed ' changed into &apos in Hypersearch results highlight (#3310376)</li> <li>Removed the highlight subsequence option, too complex for not a good result.</li> <li>The selection highlight do not highlight the current selection anymore so it is easier to see where the caret is.</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java 2011-08-09 17:32:49 UTC (rev 19772) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightHypersearchResults.java 2011-08-09 18:05:18 UTC (rev 19773) @@ -129,7 +129,6 @@ Collections.sort(highlights); StringBuilder sb = new StringBuilder("<html><body>"); int i = 0; - Vector<Highlight> stack = new Vector<Highlight>(); for (HighlightPosition hlPos : highlights) { appendString2html(sb, s.substring(i, hlPos.pos)); @@ -138,23 +137,11 @@ sb.append("<font style bgcolor=\"#"); Color c = hlPos.highlight.getColor(); sb.append(Integer.toHexString(c.getRGB()).substring(2)); - sb.append("\"/>"); - stack.add(hlPos.highlight); + sb.append("\">"); } else { sb.append("</font>"); - stack.remove(hlPos.highlight); - if (!stack.isEmpty()) - { - // Intersecting highlights - need to end both, then put back - // the effective one. - Highlight h = stack.lastElement(); - sb.append("</font><font style bgcolor=\"#"); - Color c = h.getColor(); - sb.append(Integer.toHexString(c.getRGB()).substring(2)); - sb.append("\"/>"); - } } i = hlPos.pos; } @@ -188,9 +175,9 @@ case '"': r = """; break; - case '\'': + /*case '\'': r = "'"; - break; + break; */ case '&': r = "&"; break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2011-08-19 08:58:44
|
Revision: 19811 http://jedit.svn.sourceforge.net/jedit/?rev=19811&view=rev Author: kpouer Date: 2011-08-19 08:58:38 +0000 (Fri, 19 Aug 2011) Log Message: ----------- moved color painter to a lower level Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2011-08-18 21:40:08 UTC (rev 19810) +++ plugins/Highlight/trunk/Highlight.props 2011-08-19 08:58:38 UTC (rev 19811) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.9.5 +plugin.gatchan.highlight.HighlightPlugin.version=1.9.6 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2011-08-18 21:40:08 UTC (rev 19810) +++ plugins/Highlight/trunk/docs/Highlight.html 2011-08-19 08:58:38 UTC (rev 19811) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.9.5 (Aug 09, 2011)</span><br> + <span style="font-weight:bold">Version 1.9.6 (Aug 19, 2011)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,6 +42,10 @@ </p> <h2>History</h2> <ul> + <li>1.9.6 (Aug 19, 2011)</li> + <ul> + <li>Moved the color painter to a lower layer so the caret highlight is on top of it.</li> + </ul> <li>1.9.5 (Aug 09, 2011)</li> <ul> <li>Fixed ' changed into &apos in Hypersearch results highlight (#3310376)</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2011-08-18 21:40:08 UTC (rev 19810) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightPlugin.java 2011-08-19 08:58:38 UTC (rev 19811) @@ -148,7 +148,7 @@ textArea.addCaretListener(highlightManager); FlexColorPainter flexColorPainter = new FlexColorPainter(textArea); textArea.putClientProperty(FlexColorPainter.class, flexColorPainter); - painter.addExtension(layer, flexColorPainter); + painter.addExtension(layer-1, flexColorPainter); addHighlightOverview(textArea); textArea.revalidate(); } //}}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2011-11-17 17:17:13
|
Revision: 20365 http://jedit.svn.sourceforge.net/jedit/?rev=20365&view=rev Author: kpouer Date: 2011-11-17 17:17:07 +0000 (Thu, 17 Nov 2011) Log Message: ----------- Highlight are now round rect making distinction between selection and highlight easier to see. Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2011-11-17 16:46:08 UTC (rev 20364) +++ plugins/Highlight/trunk/Highlight.props 2011-11-17 17:17:07 UTC (rev 20365) @@ -28,7 +28,7 @@ gatchan-disableHighlights \ gatchan-toggleHighlights \ - \ - highlighter-panel \ + highlighter-panel gatchan-highlight.label=Highlight gatchan-highlight-session.label=Highlight (session scope) Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2011-11-17 16:46:08 UTC (rev 20364) +++ plugins/Highlight/trunk/docs/Highlight.html 2011-11-17 17:17:07 UTC (rev 20365) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.9.6 (Aug 19, 2011)</span><br> + <span style="font-weight:bold">Version 1.9.7 (Nov 17, 2011)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,7 +42,12 @@ </p> <h2>History</h2> <ul> - <li>1.9.6 (Aug 19, 2011)</li> + <li>1.9.7 (Nov 17, 2011)</li> + <ul> + <li>Fixed jEdit not remembering when the Highlight option pane was last selected</li> + <li>Highlight are now round rect making distinction between selection and highlight easier to see.</li> + </ul> + <li>1.9.6 (Aug 19, 2011)</li> <ul> <li>Moved the color painter to a lower layer so the caret highlight is on top of it.</li> </ul> Modified: plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2011-11-17 16:46:08 UTC (rev 20364) +++ plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2011-11-17 17:17:07 UTC (rev 20365) @@ -238,6 +238,45 @@ Composite oldComposite = gfx.getComposite(); gfx.setColor(highlightColor); gfx.setComposite(blend); + gfx.fillRoundRect(startX, y, endX - startX, fm.getHeight() - 1, 5, 5); + + if (square) + { + gfx.setColor(squareColor); + gfx.drawRoundRect(startX, y, endX - startX, fm.getHeight() - 1,5,5); + } + + gfx.setColor(oldColor); + gfx.setComposite(oldComposite); + } //}}} + + //{{{ _highlight() method + /*private void _highlight(Color highlightColor, + Graphics2D gfx, + int physicalLine, + int startOffset, + int endOffset, + int y) + { + Point p = textArea.offsetToXY(physicalLine, startOffset, point); + if (p == null) + { + // The start offset was not visible + return; + } + int startX = p.x; + + p = textArea.offsetToXY(physicalLine, endOffset, point); + if (p == null) + { + // The end offset was not visible + return; + } + int endX = p.x; + Color oldColor = gfx.getColor(); + Composite oldComposite = gfx.getComposite(); + gfx.setColor(highlightColor); + gfx.setComposite(blend); gfx.fillRect(startX, y, endX - startX, fm.getHeight() - 1); if (square) @@ -248,7 +287,7 @@ gfx.setColor(oldColor); gfx.setComposite(oldComposite); - } //}}} + } *///}}} //{{{ highlightUpdated() method public void highlightUpdated(boolean highlightEnabled) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kp...@us...> - 2011-11-18 11:16:17
|
Revision: 20368 http://jedit.svn.sourceforge.net/jedit/?rev=20368&view=rev Author: kpouer Date: 2011-11-18 11:16:10 +0000 (Fri, 18 Nov 2011) Log Message: ----------- Fixed Highlight overview not updated when there is no word to highlight Highlight overview now use the color of the current word highlight Modified Paths: -------------- plugins/Highlight/trunk/Highlight.props plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java Modified: plugins/Highlight/trunk/Highlight.props =================================================================== --- plugins/Highlight/trunk/Highlight.props 2011-11-17 22:29:08 UTC (rev 20367) +++ plugins/Highlight/trunk/Highlight.props 2011-11-18 11:16:10 UTC (rev 20368) @@ -4,7 +4,7 @@ plugin.gatchan.highlight.HighlightPlugin.activate=startup plugin.gatchan.highlight.HighlightPlugin.name=Highlight plugin.gatchan.highlight.HighlightPlugin.author=Matthieu Casanova -plugin.gatchan.highlight.HighlightPlugin.version=1.9.6 +plugin.gatchan.highlight.HighlightPlugin.version=1.9.7 plugin.gatchan.highlight.HighlightPlugin.docs=docs/Highlight.html plugin.gatchan.highlight.HighlightPlugin.description=Highlight is a visual plugin that will highlight words (or matched regexp) with different colors. plugin.gatchan.highlight.HighlightPlugin.depend.0=jdk 1.5 @@ -94,6 +94,7 @@ gatchan.highlight.selectionHighlight.color.text=Color of the selection highlight : gatchan.highlight.colorsenabled.text=Highlight colors in the buffer +gatchan.highlight.misc.text=Highlight misc options gatchan.highlight.overview.text=Highlight overview gatchan.highlight.overview=true #}}} \ No newline at end of file Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2011-11-17 22:29:08 UTC (rev 20367) +++ plugins/Highlight/trunk/docs/Highlight.html 2011-11-18 11:16:10 UTC (rev 20368) @@ -45,6 +45,8 @@ <li>1.9.7 (Nov 17, 2011)</li> <ul> <li>Fixed jEdit not remembering when the Highlight option pane was last selected</li> + <li>Fixed Highlight overview not updated when there is no word to highlight</li> + <li>Highlight overview now use the color of the current word highlight</li> <li>Highlight are now round rect making distinction between selection and highlight easier to see.</li> </ul> <li>1.9.6 (Aug 19, 2011)</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2011-11-17 22:29:08 UTC (rev 20367) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightOptionPane.java 2011-11-18 11:16:10 UTC (rev 20368) @@ -3,7 +3,7 @@ * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * -* Copyright (C) 2004, 2009 Matthieu Casanova +* Copyright (C) 2004, 201 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -37,9 +37,9 @@ * * @author Matthieu Casanova */ -public class HighlightOptionPane extends AbstractOptionPane +public class HighlightOptionPane extends AbstractOptionPane { - + public static final String PROP_COMMON_PROPERTIES = "gatchan.highlight.option-pane.commonProperties.text"; public static final String PROP_DEFAULT_COLOR = "gatchan.highlight.defaultColor"; public static final String PROP_HIGHLIGHT_WORD_AT_CARET = "gatchan.highlight.caretHighlight"; @@ -56,14 +56,13 @@ public static final String PROP_HIGHLIGHT_WORD_AT_CARET_WHITESPACE = "gatchan.highlight.caretHighlight.whitespace"; public static final String PROP_HIGHLIGHT_WORD_AT_CARET_ONLYWORDS = "gatchan.highlight.caretHighlight.onlyWords"; public static final String PROP_HIGHLIGHT_HYPERSEARCH_RESULTS = "gatchan.highlight.hyperSearchResults"; - + public static final String PROP_LAYER_PROPERTY = "gatchan.highlight.layer"; public static final String PROP_ALPHA = "gatchan.highlight.alpha"; public static final String PROP_SQUARE = "gatchan.highlight.square"; public static final String PROP_SQUARE_COLOR = "gatchan.highlight.square.color"; public static final String PROP_HIGHLIGHT_OVERVIEW = "gatchan.highlight.overview"; - public static final String PROP_HIGHLIGHT_OVERVIEW_COLOR = "gatchan.highlight.overview.color"; public static final String PROP_HIGHLIGHT_COLORS = "gatchan.highlight.colorsenabled"; @@ -89,44 +88,44 @@ private JCheckBox highlightOverview; private JCheckBox highlightColorEnabled; - private ColorWellButton highlightOverviewColor; //{{{ HighlightOptionPane constructor - public HighlightOptionPane() + public HighlightOptionPane() { super("gatchan.highlight.option-pane"); } //}}} - + //{{{ _init() method - protected void _init() + @Override + protected void _init() { addSeparator(PROP_COMMON_PROPERTIES); addComponent(highlightAppend = createCheckBox(PROP_HIGHLIGHT_APPEND)); addComponent(cycleColor = createCheckBox(PROP_HIGHLIGHT_CYCLE_COLOR)); addComponent(new JLabel(jEdit.getProperty(PROP_DEFAULT_COLOR + ".text")), defaultColor = new ColorWellButton(jEdit.getColorProperty(PROP_DEFAULT_COLOR))); - cycleColor.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - defaultColor.setEnabled(!cycleColor.isSelected()); - } - }); + cycleColor.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + defaultColor.setEnabled(!cycleColor.isSelected()); + } + }); if (cycleColor.isSelected()) defaultColor.setEnabled(false); - + addComponent(square = createCheckBox(PROP_SQUARE)); - + addComponent(new JLabel(jEdit.getProperty(PROP_SQUARE_COLOR + ".text")), squareColor = new ColorWellButton(jEdit.getColorProperty(PROP_SQUARE_COLOR))); - square.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - squareColor.setEnabled(square.isSelected()); - } - }); + square.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + squareColor.setEnabled(square.isSelected()); + } + }); squareColor.setEnabled(square.isSelected()); addComponent(highlightHypersearch = createCheckBox(PROP_HIGHLIGHT_HYPERSEARCH_RESULTS)); addComponent(new JLabel(jEdit.getProperty(PROP_LAYER_PROPERTY + ".text")), @@ -136,7 +135,7 @@ alphaSlider = new JSlider(0, 100, jEdit.getIntegerProperty(PROP_ALPHA, 50))); - + addSeparator(PROP_HIGHLIGHT_WORD_AT_CARET + ".text"); addComponent(highlightWordAtCaret = createCheckBox(PROP_HIGHLIGHT_WORD_AT_CARET)); addComponent(wordAtCaretIgnoreCase = createCheckBox(PROP_HIGHLIGHT_WORD_AT_CARET_IGNORE_CASE)); @@ -153,17 +152,15 @@ addComponent(new JLabel(jEdit.getProperty(PROP_HIGHLIGHT_SELECTION_COLOR + ".text")), selectionColor = new ColorWellButton(jEdit.getColorProperty(PROP_HIGHLIGHT_SELECTION_COLOR))); - addSeparator(PROP_HIGHLIGHT_OVERVIEW+".text"); + addSeparator("gatchan.highlight.misc.text"); addComponent(highlightOverview = createCheckBox(PROP_HIGHLIGHT_OVERVIEW)); - addComponent(new JLabel(jEdit.getProperty(PROP_HIGHLIGHT_OVERVIEW_COLOR + ".text")), - highlightOverviewColor = new ColorWellButton(jEdit.getColorProperty(PROP_HIGHLIGHT_OVERVIEW_COLOR))); - addSeparator(PROP_HIGHLIGHT_COLORS+".text"); addComponent(highlightColorEnabled = createCheckBox(PROP_HIGHLIGHT_COLORS)); } //}}} - + //{{{ _save() method - protected void _save() + @Override + protected void _save() { jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET, highlightWordAtCaret.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET_IGNORE_CASE, wordAtCaretIgnoreCase.isSelected()); @@ -171,7 +168,7 @@ jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET_WHITESPACE, wordAtCaretWhitespace.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_WORD_AT_CARET_ONLYWORDS, wordAtCaretOnlyWords.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_HYPERSEARCH_RESULTS, highlightHypersearch.isSelected()); - + jEdit.setBooleanProperty(PROP_HIGHLIGHT_CYCLE_COLOR, cycleColor.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_APPEND, highlightAppend.isSelected()); jEdit.setColorProperty(PROP_HIGHLIGHT_WORD_AT_CARET_COLOR, wordAtCaretColor.getSelectedColor()); @@ -181,11 +178,11 @@ try { jEdit.setIntegerProperty(PROP_LAYER_PROPERTY, layerChooser.getLayer()); - } + } catch(NumberFormatException e) { } - + jEdit.setIntegerProperty(PROP_ALPHA, alphaSlider.getValue()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_SELECTION, highlightSelection.isSelected()); @@ -193,12 +190,11 @@ jEdit.setBooleanProperty(PROP_HIGHLIGHT_SELECTION_IGNORE_CASE, selectionIgnoreCase.isSelected()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_OVERVIEW, highlightOverview.isSelected()); - jEdit.setColorProperty(PROP_HIGHLIGHT_OVERVIEW_COLOR, highlightOverviewColor.getSelectedColor()); jEdit.setBooleanProperty(PROP_HIGHLIGHT_COLORS, highlightColorEnabled.isSelected()); } //}}} //{{{ createCheckBox() method - private static JCheckBox createCheckBox(String property) + private static JCheckBox createCheckBox(String property) { JCheckBox checkbox = new JCheckBox(jEdit.getProperty(property + ".text")); checkbox.setSelected(jEdit.getBooleanProperty(property)); Modified: plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java 2011-11-17 22:29:08 UTC (rev 20367) +++ plugins/Highlight/trunk/src/gatchan/highlight/HighlightOverview.java 2011-11-18 11:16:10 UTC (rev 20368) @@ -4,7 +4,7 @@ * :folding=explicit:collapseFolds=1: * * Copyright (C) 2009 Szalai Endre - * Portions Copyright (C) 2009, 2010 Matthieu Casanova + * Portions Copyright (C) 2009, 2011 Matthieu Casanova * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,7 +26,6 @@ import org.gjt.sp.jedit.buffer.JEditBuffer; import org.gjt.sp.jedit.search.SearchMatcher; import org.gjt.sp.jedit.textarea.TextArea; -import org.gjt.sp.jedit.jEdit; import org.gjt.sp.util.IntegerArray; import javax.swing.*; @@ -80,7 +79,10 @@ items.clear(); if (!highlightEnabled || !HighlightManagerTableModel.currentWordHighlight.isEnabled() || textArea.getSelectionCount() != 0) + { + repaint(); return; + } int offset = 0; JEditBuffer buffer = textArea.getBuffer(); @@ -129,7 +131,7 @@ int lineCount = textArea.getLineCount(); // gfx.setColor(Color.black); // gfx.drawString(String.valueOf(count), 0, 10); - gfx.setColor(jEdit.getColorProperty(HighlightOptionPane.PROP_HIGHLIGHT_OVERVIEW_COLOR)); + gfx.setColor(HighlightManagerTableModel.currentWordHighlight.getColor()); for (int i = 0;i<items.getSize();i++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |