jcs
/textview
/amendments
/59
TVBigRectToLocalRect: Add a GlobalToLocal-like function
jcs made amendment 59 about 1 year ago
--- textview.c Sun Dec 15 15:25:16 2024
+++ textview.c Sun Dec 15 16:22:46 2024
@@ -540,6 +540,21 @@ TVGetTextOffset(TVHandle tvh, Point p)
return off;
}
+void
+TVBigRectToLocalRect(TVHandle tvh, BigRect *bigrect, Rect *rect)
+{
+ struct TVRec *tv;
+
+ tv = TVLock(tvh);
+
+ rect->left = bigrect->left + tv->scrolled.left + tv->view.left;
+ rect->top = bigrect->top + tv->scrolled.top + tv->view.top;
+ rect->right = bigrect->right + tv->scrolled.left + tv->view.left;
+ rect->bottom = bigrect->bottom + tv->scrolled.top + tv->view.top;
+
+ TVUnlock(tv);
+}
+
static TVHandle tv_track_control = NULL;
void
TVSetTrackScrollControl(TVHandle tvh)
--- textview.h Sun Dec 15 15:25:27 2024
+++ textview.h Sun Dec 15 16:22:12 2024
@@ -205,6 +205,7 @@ void TVClick(TVHandle tvh, Point p, Boolean extend);
unsigned long TVGetText(TVHandle tvh, char *dst, unsigned long start,
unsigned long end);
long TVGetTextOffset(TVHandle tvh, Point p);
+void TVBigRectToLocalRect(TVHandle tvh, BigRect *bigrect, Rect *rect);
void TVScroll(TVHandle tvh, long horiz, long vert);
void TVCopy(TVHandle tvh);
void TVSetSelect(TVHandle tvh, unsigned long start, unsigned long end);