mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
RichTextView: Fixed issue with links #848
git-svn-id: svn://ultimatepp.org/upp/trunk@7644 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
7316049bb3
commit
4b272a3850
2 changed files with 17 additions and 5 deletions
|
|
@ -128,15 +128,21 @@ void RichTextView::RightDown(Point p, dword keyflags)
|
|||
b.Execute();
|
||||
}
|
||||
|
||||
Point RichTextView::GetTextPoint(Point p) const
|
||||
{
|
||||
p -= margin.TopLeft();
|
||||
Zoom zoom = GetZoom();
|
||||
p.y += sb * zoom;
|
||||
return Point(p.x / zoom, p.y / zoom);
|
||||
}
|
||||
|
||||
int RichTextView::GetPointPos(Point p) const
|
||||
{
|
||||
Size sz = GetSize();
|
||||
sz.cx -= margin.left + margin.right;
|
||||
sz.cy -= margin.top + margin.bottom;
|
||||
p -= margin.TopLeft();
|
||||
Zoom zoom = GetZoom();
|
||||
p.y += sb * zoom;
|
||||
return text.GetPos(p.x / zoom, PageY(0, p.y / zoom), GetPage());
|
||||
p = GetTextPoint(p);
|
||||
return text.GetPos(p.x, PageY(0, p.y), GetPage());
|
||||
}
|
||||
|
||||
String RichTextView::GetLink(int pos, Point p) const
|
||||
|
|
@ -145,12 +151,17 @@ String RichTextView::GetLink(int pos, Point p) const
|
|||
RichObject object = text.GetRichPos(pos).object;
|
||||
if(object) {
|
||||
Rect rc = text.GetCaret(pos, GetPage());
|
||||
//TODO: Perhaps use GetTextPoint here?
|
||||
link = object.GetLink(p - rc.TopLeft(), rc.Size());
|
||||
}
|
||||
|
||||
if(IsNull(link)) {
|
||||
RichPos richpos = text.GetRichPos(pos);
|
||||
if(richpos.chr != '\n')
|
||||
Rect rc = text.GetCaret(pos, GetPage());
|
||||
DDUMP(rc);
|
||||
DDUMP(p);
|
||||
DDUMP(GetTextPoint(p));
|
||||
if(richpos.chr != '\n' && rc.Contains(GetTextPoint(p)))
|
||||
link = Nvl(richpos.fieldformat.link, richpos.format.link);
|
||||
}
|
||||
return link;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue