CtrlLib: RichTextView improvements

This commit is contained in:
Mirek Fidler 2023-01-13 16:33:29 +01:00
parent 1916613d17
commit 7985ea5c10
5 changed files with 23 additions and 3 deletions

View file

@ -33,6 +33,7 @@ private:
int cursor, anchor;
bool lazy;
bool shrink_oversized_objects;
bool icursor = true;
void EndSizeTracking();
void SetSb();
@ -115,6 +116,8 @@ public:
RichTextView& NoLazy() { return Lazy(false); }
RichTextView& ShrinkOversizedObjects(bool b = true) { shrink_oversized_objects = b; Refresh(); return *this; }
RichTextView& NoShrinkOversizedObjects() { return ShrinkOversizedObjects(false); }
RichTextView& ICursor(bool b) { icursor = b; return *this; }
RichTextView& NoICursor() { return ICursor(false); }
void operator=(const char *qtf) { SetQTF(qtf); }

View file

@ -99,7 +99,7 @@ Image RichTextView::CursorImage(Point p, dword keyflags)
int pos = GetPointPos(p);
if(WhenLink && pos >= 0 && !IsNull(GetLink(pos, p)))
return Image::Hand();
if(HasCapture())
if(HasCapture() && icursor)
return Image::IBeam();
return Image::Arrow();
}
@ -235,8 +235,8 @@ void RichTextView::LeftDown(Point p, dword keyflags)
RefreshSel();
SetFocus();
SetCapture();
WhenLeftClick();
}
WhenLeftClick();
}
void RichTextView::LeftDouble(Point p, dword keyflags)

View file

@ -592,7 +592,7 @@ void RichPara::GatherIndexes(Vector<RichValPos>& info, RichContext rc, int pos)
void FontHeightRound(Font& fnt, Zoom z)
{
fnt.Height((fnt.GetHeight() * z.m + (z.d >> 1)) / z.d);
fnt.Height(max((fnt.GetHeight() * z.m + (z.d >> 1)) / z.d, 1)); // do not allow to fall to zero (that is default font height)
}
void operator*=(RichPara::Format& format, Zoom z)

9
upptst/H11/H11.upp Normal file
View file

@ -0,0 +1,9 @@
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI";

8
upptst/H11/main.cpp Normal file
View file

@ -0,0 +1,8 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
GUI_APP_MAIN
{
PromptOK("[H1+1 &&&&&]");
}