summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jeff2014-08-22 01:41:41 -0400
committerGravatar jeff2014-08-22 01:41:41 -0400
commitb4b9f296e9bcdbfcabb1cf49885a1747ce094c61 (patch)
treeb7fe7a44d521c0f8c5a20a3f4965f22b0b8edf6a
parentadded show token effects (diff)
downloadenigma-fork-b4b9f296e9bcdbfcabb1cf49885a1747ce094c61.tar.gz
enigma-fork-b4b9f296e9bcdbfcabb1cf49885a1747ce094c61.tar.xz
enigma-fork-b4b9f296e9bcdbfcabb1cf49885a1747ce094c61.zip
fixed recursion of field reference nodes
tweaked scroll into view for showing tokens
-rw-r--r--src/cuchaz/enigma/analysis/FieldReferenceTreeNode.java4
-rw-r--r--src/cuchaz/enigma/gui/BoxHighlightPainter.java3
-rw-r--r--src/cuchaz/enigma/gui/Gui.java16
3 files changed, 19 insertions, 4 deletions
diff --git a/src/cuchaz/enigma/analysis/FieldReferenceTreeNode.java b/src/cuchaz/enigma/analysis/FieldReferenceTreeNode.java
index 645e682..94d0da7 100644
--- a/src/cuchaz/enigma/analysis/FieldReferenceTreeNode.java
+++ b/src/cuchaz/enigma/analysis/FieldReferenceTreeNode.java
@@ -86,6 +86,10 @@ public class FieldReferenceTreeNode extends DefaultMutableTreeNode implements Re
86 { 86 {
87 ((BehaviorReferenceTreeNode)node).load( index, true ); 87 ((BehaviorReferenceTreeNode)node).load( index, true );
88 } 88 }
89 else if( node instanceof FieldReferenceTreeNode )
90 {
91 ((FieldReferenceTreeNode)node).load( index, true );
92 }
89 } 93 }
90 } 94 }
91 } 95 }
diff --git a/src/cuchaz/enigma/gui/BoxHighlightPainter.java b/src/cuchaz/enigma/gui/BoxHighlightPainter.java
index 2c11834..30b2b02 100644
--- a/src/cuchaz/enigma/gui/BoxHighlightPainter.java
+++ b/src/cuchaz/enigma/gui/BoxHighlightPainter.java
@@ -61,7 +61,8 @@ public abstract class BoxHighlightPainter implements Highlighter.HighlightPainte
61 } 61 }
62 catch( BadLocationException ex ) 62 catch( BadLocationException ex )
63 { 63 {
64 throw new Error( ex ); 64 // don't care... just return something
65 return new Rectangle( 0, 0, 0, 0 );
65 } 66 }
66 } 67 }
67} 68}
diff --git a/src/cuchaz/enigma/gui/Gui.java b/src/cuchaz/enigma/gui/Gui.java
index 914359b..dd82b8e 100644
--- a/src/cuchaz/enigma/gui/Gui.java
+++ b/src/cuchaz/enigma/gui/Gui.java
@@ -54,6 +54,7 @@ import javax.swing.JTextField;
54import javax.swing.JTree; 54import javax.swing.JTree;
55import javax.swing.KeyStroke; 55import javax.swing.KeyStroke;
56import javax.swing.ListSelectionModel; 56import javax.swing.ListSelectionModel;
57import javax.swing.SwingUtilities;
57import javax.swing.Timer; 58import javax.swing.Timer;
58import javax.swing.WindowConstants; 59import javax.swing.WindowConstants;
59import javax.swing.event.CaretEvent; 60import javax.swing.event.CaretEvent;
@@ -776,9 +777,16 @@ public class Gui
776 // make sure the token is visible in the scroll window 777 // make sure the token is visible in the scroll window
777 Rectangle start = m_editor.modelToView( token.start ); 778 Rectangle start = m_editor.modelToView( token.start );
778 Rectangle end = m_editor.modelToView( token.end ); 779 Rectangle end = m_editor.modelToView( token.end );
779 Rectangle show = start.union( end ); 780 final Rectangle show = start.union( end );
780 show.grow( 0, start.height*6 ); 781 show.grow( start.width*10, start.height*6 );
781 m_editor.scrollRectToVisible( show ); 782 SwingUtilities.invokeLater( new Runnable( )
783 {
784 @Override
785 public void run( )
786 {
787 m_editor.scrollRectToVisible( show );
788 }
789 } );
782 } 790 }
783 catch( BadLocationException ex ) 791 catch( BadLocationException ex )
784 { 792 {
@@ -818,6 +826,8 @@ public class Gui
818 } 826 }
819 } ); 827 } );
820 timer.start(); 828 timer.start();
829
830 redraw();
821 } 831 }
822 832
823 public void showTokens( Collection<Token> tokens ) 833 public void showTokens( Collection<Token> tokens )