(textPtr, line, pickPlace)
| 1789 | *---------------------------------------------------------------------- |
| 1790 | * |
| 1791 | * TkTextSetView -- |
| 1792 | * |
| 1793 | * This procedure is called to specify what lines are to be |
| 1794 | * displayed in a text widget. |
| 1795 | * |
| 1796 | * Results: |
| 1797 | * None. |
| 1798 | * |
| 1799 | * Side effects: |
| 1800 | * The display will (eventually) be updated so that the line |
| 1801 | * given by "line" is visible on the screen at the position |
| 1802 | * determined by "pickPlace". |
| 1803 | * |
| 1804 | *---------------------------------------------------------------------- |
| 1805 | */ |
| 1806 | |
| 1807 | void |
| 1808 | TkTextSetView(textPtr, line, pickPlace) |
| 1809 | TkText *textPtr; /* Widget record for text widget. */ |
| 1810 | int line; /* Number of line that is to appear somewhere |
| 1811 | * in the window. This line number must |
| 1812 | * be a valid one in the file. */ |
| 1813 | int pickPlace; /* 0 means topLine must appear at top of |
| 1814 | * screen. 1 means we get to pick where it |
| 1815 | * appears: minimize screen motion or else |
| 1816 | * display line at center of screen. */ |
| 1817 | { |
| 1818 | DInfo *dInfoPtr = textPtr->dInfoPtr; |
| 1819 | register DLine *dlPtr, *dlPtr2; |
| 1820 | TkTextLine *linePtr; |
| 1821 | int curTopLine, curBotLine; |
| 1822 | int bottomY; |
| 1823 | TagInfo tagInfo; |
| 1824 | #define CLOSE_LINES 5 |
| 1825 | |
| 1826 | if (!pickPlace) { |
| 1827 | /* |
| 1828 | * The line must go at the top of the screen. See if the new |
| 1829 | * topmost line is already somewhere on the screen. If so then |
| 1830 | * delete all the DLine structures ahead of it. Otherwise just |
| 1831 | * leave all the DLine's alone (if the new topmost line is above |
| 1832 | * the top of the current window, i.e. we're scrolling back towards |
| 1833 | * the beginning of the file we may be able to reuse some of the |
| 1834 | * information that's currently on the screen without redisplaying |
| 1835 | * it all. |
| 1836 | */ |
| 1837 | |
| 1838 | dlPtr = FindDLine(dInfoPtr->dLinePtr, line); |
| 1839 | if ((dlPtr != NULL) && (dlPtr != dInfoPtr->dLinePtr)) { |
| 1840 | FreeDLines(textPtr, dInfoPtr->dLinePtr, dlPtr, 1); |
| 1841 | } |
| 1842 | |
| 1843 | textPtr->topLinePtr = TkBTreeFindLine(textPtr->tree, line); |
| 1844 | goto scheduleUpdate; |
| 1845 | } |
| 1846 | |
| 1847 | /* |
| 1848 | * We have to pick where to display the given line. First, bring |
no test coverage detected