Re: setting view positions?

Shaw Terwilliger (sterwill@postman.sourcegear.com)
Mon, 20 Sep 1999 09:54:37 -0500


Jeff Hostetler wrote:
> Justin Bradford wrote:
> > How can I make it show a specific part of a document?
> > For example, I want to select a word in the document and then have that
> > text centered in the user's display.
>
> i'm not exactly sure what you need or what exactly you want
> to do, but you might look at the find/replace code and see
> how the find-next button scrolls the text into view and
> highlights it.

There's also the new zoom code, which has a small chunk of code
(in each platform's frame) to handle finding the cursor position
and centering on it when the zoom is complete (so you don't
wrap back to page 1 each time you change magnification).

The Find & Replace algorithm is simple... you set the string (in the
view) and call findNext() and it does:

if (!isSelectionEmpty())
{
_clearSelection();
}
else
{
_eraseInsertionPoint();
}

UT_Bool bRes = _findNext(find, matchCase, bDoneEntireDocument);

if (isSelectionEmpty())
{
if (!_ensureThatInsertionPointIsOnScreen())
{
_fixInsertionPointCoords();
_drawInsertionPoint();
}
}
else
{
_ensureThatInsertionPointIsOnScreen();
_drawSelection();
}

Most of those functions are members of FV_View. Find them in
abi/src/text/fmt/xp/fv_View.cpp.

-- 
Shaw Terwilliger


This archive was generated by hypermail 1.03b2.