author | wenzelm |
Fri, 01 Apr 2022 17:06:10 +0200 | |
changeset 75393 | 87ebf5a50283 |
parent 73367 | 77ef8bef0593 |
child 75394 | 42267c650205 |
permissions | -rw-r--r-- |
46572 | 1 |
/* Title: Tools/jEdit/src/text_overview.scala |
2 |
Author: Makarius |
|
3 |
||
57613 | 4 |
GUI component for text status overview. |
46572 | 5 |
*/ |
6 |
||
7 |
package isabelle.jedit |
|
8 |
||
9 |
||
10 |
import isabelle._ |
|
11 |
||
12 |
import scala.annotation.tailrec |
|
13 |
||
49346 | 14 |
import java.awt.{Graphics, Graphics2D, BorderLayout, Dimension, Color} |
46572 | 15 |
import java.awt.event.{MouseAdapter, MouseEvent} |
16 |
import javax.swing.{JPanel, ToolTipManager} |
|
17 |
||
18 |
||
75393 | 19 |
class Text_Overview(doc_view: Document_View) extends JPanel(new BorderLayout) { |
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
20 |
/* GUI components */ |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
21 |
|
46572 | 22 |
private val text_area = doc_view.text_area |
23 |
private val buffer = doc_view.model.buffer |
|
24 |
||
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
25 |
private def lines(): Int = buffer.getLineCount max text_area.getVisibleLines |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
26 |
|
61747 | 27 |
private val WIDTH = text_area.getPainter.getFontMetrics.stringWidth("A") max 10 |
50895 | 28 |
private val HEIGHT = 4 |
46572 | 29 |
|
30 |
setPreferredSize(new Dimension(WIDTH, 0)) |
|
31 |
||
32 |
setRequestFocusEnabled(false) |
|
33 |
||
34 |
addMouseListener(new MouseAdapter { |
|
75393 | 35 |
override def mousePressed(event: MouseEvent): Unit = { |
46572 | 36 |
val line = (event.getY * lines()) / getHeight |
37 |
if (line >= 0 && line < text_area.getLineCount) |
|
38 |
text_area.setCaretPosition(text_area.getLineStartOffset(line)) |
|
39 |
} |
|
40 |
}) |
|
41 |
||
75393 | 42 |
override def addNotify(): Unit = { |
46572 | 43 |
super.addNotify() |
44 |
ToolTipManager.sharedInstance.registerComponent(this) |
|
45 |
} |
|
46 |
||
75393 | 47 |
override def removeNotify(): Unit = { |
46572 | 48 |
ToolTipManager.sharedInstance.unregisterComponent(this) |
49 |
super.removeNotify |
|
50 |
} |
|
51 |
||
49346 | 52 |
|
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
53 |
/* overview */ |
49346 | 54 |
|
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
55 |
private case class Overview( |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
56 |
line_count: Int = 0, |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
57 |
char_count: Int = 0, |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
58 |
L: Int = 0, |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
59 |
H: Int = 0) |
49346 | 60 |
|
61196 | 61 |
private def get_overview(): Overview = |
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
62 |
Overview( |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
63 |
line_count = buffer.getLineCount, |
61196 | 64 |
char_count = buffer.getLength, |
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
65 |
L = lines(), |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
66 |
H = getHeight()) |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
67 |
|
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
68 |
|
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
69 |
/* synchronous painting */ |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
70 |
|
65911 | 71 |
type Color_Info = (Rendering.Color.Value, Int, Int) |
72 |
||
73 |
private var current_colors: List[Color_Info] = Nil |
|
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
74 |
private var current_overview = Overview() |
49346 | 75 |
|
62262
8bf765c9c2e5
separate delay_repaint to ensure reactivity, indepently of future_refresh status;
wenzelm
parents:
62092
diff
changeset
|
76 |
private val delay_repaint = |
71704 | 77 |
Delay.first(PIDE.options.seconds("editor_update_delay"), gui = true) { repaint() } |
62262
8bf765c9c2e5
separate delay_repaint to ensure reactivity, indepently of future_refresh status;
wenzelm
parents:
62092
diff
changeset
|
78 |
|
75393 | 79 |
override def paintComponent(gfx: Graphics): Unit = { |
46572 | 80 |
super.paintComponent(gfx) |
57612
990ffb84489b
clarified module name: facilitate alternative GUI frameworks;
wenzelm
parents:
56662
diff
changeset
|
81 |
GUI_Thread.assert {} |
46572 | 82 |
|
49411 | 83 |
doc_view.rich_text_area.robust_body(()) { |
49406 | 84 |
JEdit_Lib.buffer_lock(buffer) { |
49969
72216713733a
further attempts to cope with large files via option jedit_text_overview_limit;
wenzelm
parents:
49697
diff
changeset
|
85 |
val rendering = doc_view.get_rendering() |
61196 | 86 |
val overview = get_overview() |
46572 | 87 |
|
62092 | 88 |
if (rendering.snapshot.is_outdated || overview != current_overview) { |
63774
749794930d61
make double-sure that refresh happens eventually, even without edits (e.g. height change) -- amending 8bf765c9c2e5;
wenzelm
parents:
62262
diff
changeset
|
89 |
invoke() |
62262
8bf765c9c2e5
separate delay_repaint to ensure reactivity, indepently of future_refresh status;
wenzelm
parents:
62092
diff
changeset
|
90 |
delay_repaint.invoke() |
62092 | 91 |
|
92 |
gfx.setColor(rendering.outdated_color) |
|
93 |
gfx.asInstanceOf[Graphics2D].fill(gfx.getClipBounds) |
|
94 |
} |
|
95 |
else { |
|
49346 | 96 |
gfx.setColor(getBackground) |
97 |
gfx.asInstanceOf[Graphics2D].fill(gfx.getClipBounds) |
|
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
98 |
for ((color, h, h1) <- current_colors) { |
65911 | 99 |
gfx.setColor(rendering.color(color)) |
49346 | 100 |
gfx.fillRect(0, h, getWidth, h1 - h) |
46572 | 101 |
} |
102 |
} |
|
103 |
} |
|
104 |
} |
|
105 |
} |
|
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
106 |
|
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
107 |
|
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
108 |
/* asynchronous refresh */ |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
109 |
|
62262
8bf765c9c2e5
separate delay_repaint to ensure reactivity, indepently of future_refresh status;
wenzelm
parents:
62092
diff
changeset
|
110 |
private val future_refresh = Synchronized(Future.value(())) |
8bf765c9c2e5
separate delay_repaint to ensure reactivity, indepently of future_refresh status;
wenzelm
parents:
62092
diff
changeset
|
111 |
private def is_running(): Boolean = !future_refresh.value.is_finished |
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
112 |
|
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
113 |
def invoke(): Unit = delay_refresh.invoke() |
73367 | 114 |
def revoke(): Unit = { delay_refresh.revoke(); future_refresh.change(x => { x.cancel(); x }) } |
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
115 |
|
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
116 |
private val delay_refresh = |
71704 | 117 |
Delay.first(PIDE.options.seconds("editor_update_delay"), gui = true) { |
64884
b2e78c0ce537
more robust: delay switches thread context from timer to GUI and may get out of sync with revoke operation;
wenzelm
parents:
63774
diff
changeset
|
118 |
if (!doc_view.rich_text_area.check_robust_body) invoke() |
b2e78c0ce537
more robust: delay switches thread context from timer to GUI and may get out of sync with revoke operation;
wenzelm
parents:
63774
diff
changeset
|
119 |
else { |
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
120 |
JEdit_Lib.buffer_lock(buffer) { |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
121 |
val rendering = doc_view.get_rendering() |
61196 | 122 |
val overview = get_overview() |
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
123 |
|
62262
8bf765c9c2e5
separate delay_repaint to ensure reactivity, indepently of future_refresh status;
wenzelm
parents:
62092
diff
changeset
|
124 |
if (rendering.snapshot.is_outdated || is_running()) invoke() |
61904 | 125 |
else { |
75393 | 126 |
val line_offsets = { |
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
127 |
val line_manager = JEdit_Lib.buffer_line_manager(buffer) |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
128 |
val a = new Array[Int](line_manager.getLineCount) |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
129 |
for (i <- 1 until a.length) a(i) = line_manager.getLineEndOffset(i - 1) |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
130 |
a |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
131 |
} |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
132 |
|
62262
8bf765c9c2e5
separate delay_repaint to ensure reactivity, indepently of future_refresh status;
wenzelm
parents:
62092
diff
changeset
|
133 |
future_refresh.change(_ => |
8bf765c9c2e5
separate delay_repaint to ensure reactivity, indepently of future_refresh status;
wenzelm
parents:
62092
diff
changeset
|
134 |
Future.fork { |
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
135 |
val line_count = overview.line_count |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
136 |
val char_count = overview.char_count |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
137 |
val L = overview.L |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
138 |
val H = overview.H |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
139 |
|
75393 | 140 |
@tailrec def loop( |
141 |
l: Int, |
|
142 |
h: Int, |
|
143 |
p: Int, |
|
144 |
q: Int, |
|
145 |
colors: List[Color_Info] |
|
146 |
): List[Color_Info] = { |
|
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
147 |
Exn.Interrupt.expose() |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
148 |
|
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
149 |
if (l < line_count && h < H) { |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
150 |
val p1 = p + H |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
151 |
val q1 = q + HEIGHT * L |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
152 |
val (l1, h1) = |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
153 |
if (p1 >= q1) (l + 1, h + (p1 - q) / L) |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
154 |
else (l + (q1 - p) / H, h + HEIGHT) |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
155 |
|
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
156 |
val start = line_offsets(l) |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
157 |
val end = |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
158 |
if (l1 < line_count) line_offsets(l1) |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
159 |
else char_count |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
160 |
|
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
161 |
val colors1 = |
61196 | 162 |
(rendering.overview_color(Text.Range(start, end)), colors) match { |
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
163 |
case (Some(color), (old_color, old_h, old_h1) :: rest) |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
164 |
if color == old_color && old_h1 == h => (color, old_h, h1) :: rest |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
165 |
case (Some(color), _) => (color, h, h1) :: colors |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
166 |
case (None, _) => colors |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
167 |
} |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
168 |
loop(l1, h1, p + (l1 - l) * H, q + (h1 - h) * L, colors1) |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
169 |
} |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
170 |
else colors.reverse |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
171 |
} |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
172 |
val new_colors = loop(0, 0, 0, 0, Nil) |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
173 |
|
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
174 |
GUI_Thread.later { |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
175 |
current_overview = overview |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
176 |
current_colors = new_colors |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
177 |
repaint() |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
178 |
} |
62262
8bf765c9c2e5
separate delay_repaint to ensure reactivity, indepently of future_refresh status;
wenzelm
parents:
62092
diff
changeset
|
179 |
} |
8bf765c9c2e5
separate delay_repaint to ensure reactivity, indepently of future_refresh status;
wenzelm
parents:
62092
diff
changeset
|
180 |
) |
61195
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
181 |
} |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
182 |
} |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
183 |
} |
42419fe6f660
fast synchronous painting and asynchronous refresh of text overview, reduces GUI thread latency from 100ms to 1ms for big files like src/HOL/Multivariate_Analsyis/Integration.thy;
wenzelm
parents:
57613
diff
changeset
|
184 |
} |
46572 | 185 |
} |