1 /* |
|
2 * ErrorOverview.java - Error overview component |
|
3 * :tabSize=8:indentSize=8:noTabs=false: |
|
4 * :folding=explicit:collapseFolds=1: |
|
5 * |
|
6 * Copyright (C) 2003 Slava Pestov |
|
7 * |
|
8 * This program is free software; you can redistribute it and/or |
|
9 * modify it under the terms of the GNU General Public License |
|
10 * as published by the Free Software Foundation; either version 2 |
|
11 * of the License, or any later version. |
|
12 * |
|
13 * This program is distributed in the hope that it will be useful, |
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 * GNU General Public License for more details. |
|
17 * |
|
18 * You should have received a copy of the GNU General Public License |
|
19 * along with this program; if not, write to the Free Software |
|
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
21 */ |
|
22 |
|
23 package isabelle.jedit |
1 package isabelle.jedit |
24 |
2 |
25 import isabelle.prover.Command |
3 import isabelle.prover.Command |
26 import isabelle.utils.Delay |
4 import isabelle.utils.Delay |
27 |
5 |
31 import org.gjt.sp.jedit.gui.RolloverButton; |
9 import org.gjt.sp.jedit.gui.RolloverButton; |
32 import org.gjt.sp.jedit.textarea.JEditTextArea; |
10 import org.gjt.sp.jedit.textarea.JEditTextArea; |
33 import org.gjt.sp.jedit.buffer.JEditBuffer; |
11 import org.gjt.sp.jedit.buffer.JEditBuffer; |
34 import org.gjt.sp.jedit._ |
12 import org.gjt.sp.jedit._ |
35 |
13 |
36 class PhaseOverviewPanel(textarea : JEditTextArea) extends JPanel(new BorderLayout) { |
14 class PhaseOverviewPanel(prover : isabelle.prover.Prover) extends JPanel(new BorderLayout) { |
37 |
15 |
38 private val WIDTH = 10 |
16 private val WIDTH = 10 |
39 private val HILITE_HEIGHT = 2 |
17 private val HILITE_HEIGHT = 2 |
|
18 var textarea : JEditTextArea = null |
40 |
19 |
41 Plugin.plugin.prover.commandInfo.add(cc => { |
20 val repaint_delay = new isabelle.utils.Delay(100, () => repaint()) |
42 paintCommand(cc.command,textarea.getBuffer, getGraphics) |
21 prover.commandInfo.add(cc => repaint_delay.delay_or_ignore()) |
43 }) |
22 |
44 setRequestFocusEnabled(false); |
23 setRequestFocusEnabled(false); |
45 |
24 |
46 addMouseListener(new MouseAdapter { |
25 addMouseListener(new MouseAdapter { |
47 override def mousePressed(evt : MouseEvent) { |
26 override def mousePressed(evt : MouseEvent) { |
48 val line = yToLine(evt.getY) |
27 val line = yToLine(evt.getY) |
95 |
74 |
96 override def paintComponent(gfx : Graphics) { |
75 override def paintComponent(gfx : Graphics) { |
97 super.paintComponent(gfx) |
76 super.paintComponent(gfx) |
98 |
77 |
99 val buffer = textarea.getBuffer |
78 val buffer = textarea.getBuffer |
100 |
79 for(c <- prover.document.commands) |
101 for(c <- Plugin.plugin.prover.document.commands) |
|
102 paintCommand(c, buffer, gfx) |
80 paintCommand(c, buffer, gfx) |
|
81 |
103 } |
82 } |
104 |
83 |
105 override def getPreferredSize : Dimension = |
84 override def getPreferredSize : Dimension = |
106 { |
85 { |
107 new Dimension(10,0) |
86 new Dimension(10,0) |