summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cuchaz/enigma/analysis/SourceIndex.java3
-rw-r--r--src/cuchaz/enigma/gui/BoxHighlightPainter.java7
-rw-r--r--src/cuchaz/enigma/gui/Gui.java9
-rw-r--r--src/cuchaz/enigma/gui/GuiController.java7
-rw-r--r--src/cuchaz/enigma/gui/OtherHighlightPainter.java22
5 files changed, 42 insertions, 6 deletions
diff --git a/src/cuchaz/enigma/analysis/SourceIndex.java b/src/cuchaz/enigma/analysis/SourceIndex.java
index b777f9fd..fb5cc655 100644
--- a/src/cuchaz/enigma/analysis/SourceIndex.java
+++ b/src/cuchaz/enigma/analysis/SourceIndex.java
@@ -77,7 +77,7 @@ public class SourceIndex
77 token.end -= pos + 1; 77 token.end -= pos + 1;
78 } 78 }
79 79
80 // HACKHACK: sometimes node regions are off by one 80 /* HACKHACK: sometimes node regions are off by one
81 // I think this is a bug in Procyon, but it's easy to work around 81 // I think this is a bug in Procyon, but it's easy to work around
82 if( !Character.isJavaIdentifierStart( m_source.charAt( token.start ) ) ) 82 if( !Character.isJavaIdentifierStart( m_source.charAt( token.start ) ) )
83 { 83 {
@@ -88,6 +88,7 @@ public class SourceIndex
88 throw new IllegalArgumentException( "Region " + region + " does not describe valid token: '" + m_source.substring( token.start, token.end ) + "'" ); 88 throw new IllegalArgumentException( "Region " + region + " does not describe valid token: '" + m_source.substring( token.start, token.end ) + "'" );
89 } 89 }
90 } 90 }
91 */
91 92
92 return token; 93 return token;
93 } 94 }
diff --git a/src/cuchaz/enigma/gui/BoxHighlightPainter.java b/src/cuchaz/enigma/gui/BoxHighlightPainter.java
index 30b2b021..df63f5a8 100644
--- a/src/cuchaz/enigma/gui/BoxHighlightPainter.java
+++ b/src/cuchaz/enigma/gui/BoxHighlightPainter.java
@@ -36,8 +36,11 @@ public abstract class BoxHighlightPainter implements Highlighter.HighlightPainte
36 Rectangle bounds = getBounds( text, start, end ); 36 Rectangle bounds = getBounds( text, start, end );
37 37
38 // fill the area 38 // fill the area
39 g.setColor( m_fillColor ); 39 if( m_fillColor != null )
40 g.fillRoundRect( bounds.x, bounds.y, bounds.width, bounds.height, 4, 4 ); 40 {
41 g.setColor( m_fillColor );
42 g.fillRoundRect( bounds.x, bounds.y, bounds.width, bounds.height, 4, 4 );
43 }
41 44
42 // draw a box around the area 45 // draw a box around the area
43 g.setColor( m_borderColor ); 46 g.setColor( m_borderColor );
diff --git a/src/cuchaz/enigma/gui/Gui.java b/src/cuchaz/enigma/gui/Gui.java
index 1995cb80..5eed728a 100644
--- a/src/cuchaz/enigma/gui/Gui.java
+++ b/src/cuchaz/enigma/gui/Gui.java
@@ -102,6 +102,7 @@ public class Gui
102 private JPanel m_infoPanel; 102 private JPanel m_infoPanel;
103 private ObfuscatedHighlightPainter m_obfuscatedHighlightPainter; 103 private ObfuscatedHighlightPainter m_obfuscatedHighlightPainter;
104 private DeobfuscatedHighlightPainter m_deobfuscatedHighlightPainter; 104 private DeobfuscatedHighlightPainter m_deobfuscatedHighlightPainter;
105 private OtherHighlightPainter m_otherHighlightPainter;
105 private SelectionHighlightPainter m_selectionHighlightPainter; 106 private SelectionHighlightPainter m_selectionHighlightPainter;
106 private JTree m_inheritanceTree; 107 private JTree m_inheritanceTree;
107 private JTree m_implementationsTree; 108 private JTree m_implementationsTree;
@@ -205,6 +206,7 @@ public class Gui
205 DefaultSyntaxKit.initKit(); 206 DefaultSyntaxKit.initKit();
206 m_obfuscatedHighlightPainter = new ObfuscatedHighlightPainter(); 207 m_obfuscatedHighlightPainter = new ObfuscatedHighlightPainter();
207 m_deobfuscatedHighlightPainter = new DeobfuscatedHighlightPainter(); 208 m_deobfuscatedHighlightPainter = new DeobfuscatedHighlightPainter();
209 m_otherHighlightPainter = new OtherHighlightPainter();
208 m_selectionHighlightPainter = new SelectionHighlightPainter(); 210 m_selectionHighlightPainter = new SelectionHighlightPainter();
209 m_editor = new JEditorPane(); 211 m_editor = new JEditorPane();
210 m_editor.setEditable( false ); 212 m_editor.setEditable( false );
@@ -870,12 +872,11 @@ public class Gui
870 showToken( sortedTokens.get( 0 ) ); 872 showToken( sortedTokens.get( 0 ) );
871 } 873 }
872 874
873 public void setHighlightedTokens( Iterable<Token> obfuscatedTokens, Iterable<Token> deobfuscatedTokens ) 875 public void setHighlightedTokens( Iterable<Token> obfuscatedTokens, Iterable<Token> deobfuscatedTokens, Iterable<Token> otherTokens )
874 { 876 {
875 // remove any old highlighters 877 // remove any old highlighters
876 m_editor.getHighlighter().removeAllHighlights(); 878 m_editor.getHighlighter().removeAllHighlights();
877 879
878
879 // color things based on the index 880 // color things based on the index
880 if( obfuscatedTokens != null ) 881 if( obfuscatedTokens != null )
881 { 882 {
@@ -885,6 +886,10 @@ public class Gui
885 { 886 {
886 setHighlightedTokens( deobfuscatedTokens, m_deobfuscatedHighlightPainter ); 887 setHighlightedTokens( deobfuscatedTokens, m_deobfuscatedHighlightPainter );
887 } 888 }
889 if( otherTokens != null )
890 {
891 setHighlightedTokens( otherTokens, m_otherHighlightPainter );
892 }
888 893
889 redraw(); 894 redraw();
890 } 895 }
diff --git a/src/cuchaz/enigma/gui/GuiController.java b/src/cuchaz/enigma/gui/GuiController.java
index 3f54ecd4..bbefe606 100644
--- a/src/cuchaz/enigma/gui/GuiController.java
+++ b/src/cuchaz/enigma/gui/GuiController.java
@@ -367,6 +367,7 @@ public class GuiController
367 // set the highlighted tokens 367 // set the highlighted tokens
368 List<Token> obfuscatedTokens = Lists.newArrayList(); 368 List<Token> obfuscatedTokens = Lists.newArrayList();
369 List<Token> deobfuscatedTokens = Lists.newArrayList(); 369 List<Token> deobfuscatedTokens = Lists.newArrayList();
370 List<Token> otherTokens = Lists.newArrayList();
370 for( Token token : m_index.referenceTokens() ) 371 for( Token token : m_index.referenceTokens() )
371 { 372 {
372 EntryReference<Entry,Entry> reference = m_index.getDeobfReference( token ); 373 EntryReference<Entry,Entry> reference = m_index.getDeobfReference( token );
@@ -378,8 +379,12 @@ public class GuiController
378 { 379 {
379 obfuscatedTokens.add( token ); 380 obfuscatedTokens.add( token );
380 } 381 }
382 else
383 {
384 otherTokens.add( token );
385 }
381 } 386 }
382 m_gui.setHighlightedTokens( obfuscatedTokens, deobfuscatedTokens ); 387 m_gui.setHighlightedTokens( obfuscatedTokens, deobfuscatedTokens, otherTokens );
383 } 388 }
384 }.start(); 389 }.start();
385 } 390 }
diff --git a/src/cuchaz/enigma/gui/OtherHighlightPainter.java b/src/cuchaz/enigma/gui/OtherHighlightPainter.java
new file mode 100644
index 00000000..78de7325
--- /dev/null
+++ b/src/cuchaz/enigma/gui/OtherHighlightPainter.java
@@ -0,0 +1,22 @@
1/*******************************************************************************
2 * Copyright (c) 2014 Jeff Martin.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Public License v3.0
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/gpl.html
7 *
8 * Contributors:
9 * Jeff Martin - initial API and implementation
10 ******************************************************************************/
11package cuchaz.enigma.gui;
12
13import java.awt.Color;
14
15public class OtherHighlightPainter extends BoxHighlightPainter
16{
17 public OtherHighlightPainter( )
18 {
19 // grey
20 super( null, new Color( 180, 180, 180 ) );
21 }
22}