1173 ] |
1175 ] |
1174 |
1176 |
1175 "Modified: 14.2.1997 / 17:35:24 / cg" |
1177 "Modified: 14.2.1997 / 17:35:24 / cg" |
1176 ! |
1178 ! |
1177 |
1179 |
|
1180 generateTextAfterEndHook:aBlock |
|
1181 "some applications may want to dynamically generate lines below the bottom line, |
|
1182 when the cursor is moved there. |
|
1183 For example, disassembly views or memory dumps (hex-dumps), |
|
1184 which want to automatically generate additional lines lazily, |
|
1185 but which cannot afford to generate the whole text in advance |
|
1186 (eg: who wants to disassemble gigabytes?). |
|
1187 If set, this hook is called whenever the cursor is about to be moved below the |
|
1188 last line, getting the new lineNr (i.e > contents size) as argument. |
|
1189 It may generate more text (by setting my contents) and return a new cursor line |
|
1190 number, into which the cursor should be moved |
|
1191 (eg. if 10 additional lines are generated, it may want to return oldSize+1, |
|
1192 to make the cursor end in the last line which was inserted)" |
|
1193 |
|
1194 self setAttribute:#generateTextAfterEndHook to:aBlock |
|
1195 ! |
|
1196 |
|
1197 generateTextBeforeStartHook:aBlock |
|
1198 "some applications may want to dynamically generate lines above the top |
|
1199 line, when the cursor is moved there. |
|
1200 For example, disassembly views or memory dumps (hex-dumps), |
|
1201 which want to automatically generate additional lines lazily, |
|
1202 but which cannot afford to generate the whole text in advance |
|
1203 (eg: who wants to disassemble gigabytes?). |
|
1204 If set, this hook is called whenever the cursor is about to be moved above the |
|
1205 top, getting the new lineNr (i.e < 1) as argument. |
|
1206 It may generate more text (by setting my contents) and return a new cursor line |
|
1207 number, into which the cursor should be moved |
|
1208 (eg. if 10 additional lines are generated, it may want to return 10, to make the |
|
1209 cursor end in the last line which was inserted)" |
|
1210 |
|
1211 self setAttribute:#generateTextBeforeStartHook to:aBlock |
|
1212 ! |
|
1213 |
1178 insertMode:aBoolean |
1214 insertMode:aBoolean |
1179 editMode value:(aBoolean ifTrue:[EditMode insertMode] ifFalse:[EditMode overwriteMode]) |
1215 editMode value:(aBoolean ifTrue:[EditMode insertMode] ifFalse:[EditMode overwriteMode]) |
1180 |
1216 |
1181 "Created: 6.3.1996 / 12:24:05 / cg" |
1217 "Created: 6.3.1996 / 12:24:05 / cg" |
1182 ! |
1218 ! |
1767 ! |
1803 ! |
1768 |
1804 |
1769 cursorDown:n |
1805 cursorDown:n |
1770 "move cursor down by n lines; scroll if at end of visible text" |
1806 "move cursor down by n lines; scroll if at end of visible text" |
1771 |
1807 |
1772 |wasOn nv nL| |
1808 |inLastLine wasOn nv nL cursorColBefore| |
1773 |
1809 |
1774 (nL := cursorLine) isNil ifTrue:[ |
1810 (nL := cursorLine) isNil ifTrue:[ |
1775 nL := firstLineShown |
1811 nL := firstLineShown |
|
1812 ]. |
|
1813 |
|
1814 inLastLine := (nL == list size). |
|
1815 |
|
1816 inLastLine ifTrue:[ |
|
1817 |generateTextAfterEndHook| |
|
1818 |
|
1819 cursorColBefore := cursorCol. |
|
1820 (generateTextAfterEndHook := self getAttribute:#generateTextAfterEndHook) notNil ifTrue:[ |
|
1821 wasOn := self hideCursor. |
|
1822 nL := generateTextAfterEndHook value:(nL + n). |
|
1823 self setValidatedCursorLine:nL col:cursorColBefore. |
|
1824 self makeCursorVisibleAndShowCursor:wasOn. |
|
1825 ^ self. |
|
1826 ]. |
1776 ]. |
1827 ]. |
1777 |
1828 |
1778 self st80EditMode ifTrue:[ |
1829 self st80EditMode ifTrue:[ |
1779 nL == list size ifTrue:[ |
1830 nL == list size ifTrue:[ |
1780 wasOn := self hideCursor. |
1831 wasOn := self hideCursor. |
1781 self setValidatedCursorLine:(list size) col:(self listAt:list size) size + 1. |
1832 self setValidatedCursorLine:nL col:(self listAt:nL) size + 1. |
1782 self makeCursorVisibleAndShowCursor:wasOn. |
1833 self makeCursorVisibleAndShowCursor:wasOn. |
1783 self beep. |
1834 self beep. |
1784 ^ self. |
1835 ^ self. |
1785 ] |
1836 ] |
1786 ]. |
1837 ]. |
1789 wasOn := self hideCursor. |
1840 wasOn := self hideCursor. |
1790 nv := cursorVisibleLine + n - 1. |
1841 nv := cursorVisibleLine + n - 1. |
1791 (nv >= nFullLinesShown) ifTrue:[ |
1842 (nv >= nFullLinesShown) ifTrue:[ |
1792 self scrollDown:(nv - nFullLinesShown + 1) |
1843 self scrollDown:(nv - nFullLinesShown + 1) |
1793 ]. |
1844 ]. |
1794 self setValidatedCursorLine:(cursorLine + n) col:cursorCol. |
1845 self setValidatedCursorLine:(cursorLine + n) col:(cursorColBefore ? cursorCol). |
1795 self makeCursorVisibleAndShowCursor:wasOn. |
1846 self makeCursorVisibleAndShowCursor:wasOn. |
1796 ] ifFalse:[ |
1847 ] ifFalse:[ |
1797 self setValidatedCursorLine:(nL + n) col:cursorCol. |
1848 self setValidatedCursorLine:(nL + n) col:(cursorColBefore ? cursorCol). |
1798 self makeCursorVisible. |
1849 self makeCursorVisible. |
1799 ]. |
1850 ]. |
1800 |
1851 |
1801 "Modified: / 10.6.1998 / 16:59:17 / cg" |
1852 "Modified: / 10.6.1998 / 16:59:17 / cg" |
1802 ! |
1853 ! |
2204 ! |
2255 ! |
2205 |
2256 |
2206 cursorUp:n |
2257 cursorUp:n |
2207 "move cursor up n lines; scroll if at start of visible text" |
2258 "move cursor up n lines; scroll if at start of visible text" |
2208 |
2259 |
2209 |wasOn nv nl| |
2260 |wasOn nv nl cursorColBefore| |
2210 |
2261 |
2211 cursorLine isNil ifTrue:[ |
2262 cursorLine isNil ifTrue:[ |
2212 self setCursorLine:(firstLineShown + nFullLinesShown - 1). |
2263 self setCursorLine:(firstLineShown + nFullLinesShown - 1). |
2213 ]. |
2264 ]. |
2214 nl := cursorLine - n. |
2265 nl := cursorLine - n. |
2215 nl < 1 ifTrue:[ |
2266 nl < 1 ifTrue:[ |
2216 |scrollAboveTopHandler| |
2267 |generateTextBeforeStartHook| |
2217 |
2268 |
2218 (scrollAboveTopHandler := self getAttribute:#scrollAboveTopHandler) notNil ifTrue:[ |
2269 cursorColBefore := cursorCol. |
2219 nl := scrollAboveTopHandler value:nl |
2270 (generateTextBeforeStartHook := self getAttribute:#generateTextBeforeStartHook) notNil ifTrue:[ |
|
2271 nl := generateTextBeforeStartHook value:nl |
2220 ]. |
2272 ]. |
2221 nl := nl max:1 |
2273 nl := nl max:1 |
2222 ]. |
2274 ]. |
2223 |
2275 |
2224 (nl ~~ cursorLine) ifTrue: [ |
2276 (nl ~~ cursorLine) ifTrue: [ |
2227 nv := cursorVisibleLine - n. |
2279 nv := cursorVisibleLine - n. |
2228 nv < 1 ifTrue:[ |
2280 nv < 1 ifTrue:[ |
2229 self scrollUp:(nv negated + 1) |
2281 self scrollUp:(nv negated + 1) |
2230 ]. |
2282 ]. |
2231 ]. |
2283 ]. |
2232 self setValidatedCursorLine:nl col:cursorCol. |
2284 self setValidatedCursorLine:nl col:(cursorColBefore ? cursorCol). |
2233 "/ wasOn ifTrue:[self showCursor]. |
2285 "/ wasOn ifTrue:[self showCursor]. |
2234 self makeCursorVisibleAndShowCursor:wasOn. |
2286 self makeCursorVisibleAndShowCursor:wasOn. |
2235 ] |
2287 ] |
2236 |
2288 |
2237 "Modified: 22.5.1996 / 18:28:11 / cg" |
2289 "Modified: 22.5.1996 / 18:28:11 / cg" |