jcs
/amend
/amendments
/95
util: In UpdateScrollbarForTE, update the control after adjusting
This requires passing in the window the control is on.
jcs made amendment 95 over 2 years ago
--- util.c Wed Aug 31 22:54:33 2022
+++ util.c Tue Sep 6 14:15:09 2022
@@ -1179,12 +1179,14 @@ TEGetWidth(short off, TEHandle te)
#define ceildiv(a,b) ((a / b) + (!!(a % b)))
void
-UpdateScrollbarForTE(ControlHandle control, TEHandle te, bool reset)
+UpdateScrollbarForTE(GrafPtr win, ControlHandle control, TEHandle te, bool reset)
{
size_t vlines, telines;
TERec *ter;
+ RgnHandle rgn;
short fheight, fwidth, max, val, per_line, horiz, max_chars, n;
+ HLock(control);
HLock(te);
ter = *te;
@@ -1254,7 +1256,13 @@ UpdateScrollbarForTE(ControlHandle control, TEHandle t
(*control)->contrlMax = max;
SetCtlValue(control, val);
+ rgn = NewRgn();
+ RectRgn(rgn, &(*control)->contrlRect);
+ UpdtControl(win, rgn);
+ CloseRgn(rgn);
+
HUnlock(te);
+ HUnlock(control);
}
void
--- util.h Wed Aug 31 22:47:04 2022
+++ util.h Tue Sep 6 14:11:43 2022
@@ -139,7 +139,8 @@ char * get_version(bool long_version);
short FontHeight(short font_id, short size);
void DrawGrowIconOnly(WindowPtr win);
short TEGetWidth(short off, TEHandle te);
-void UpdateScrollbarForTE(ControlHandle scroller, TEHandle te, bool reset);
+void UpdateScrollbarForTE(GrafPtr win, ControlHandle scroller, TEHandle te,
+ bool reset);
void SetTrackControlTE(TEHandle te);
pascal void TrackMouseDownInControl(ControlHandle control, short part);
pascal bool ModalDialogFilter(DialogPtr dlg, EventRecord *event,