CtrlCore: Fixed DHCtrl related Refresh issue, CtrlLib: Fixed margin issue in RichTextView

git-svn-id: svn://ultimatepp.org/upp/trunk@12429 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2018-10-30 11:27:00 +00:00
parent 963810235e
commit d87f3accaa
8 changed files with 13 additions and 35 deletions

View file

@ -594,7 +594,6 @@ Ctrl::Ctrl() {
popupgrab = false;
fullrefresh = false;
akv = false;
hasdhctrl = false;
}
void KillTimeCallbacks(void *id, void *idlim);

View file

@ -4,25 +4,11 @@ namespace Upp {
#define LLOG(x) // DLOG(x)
bool Ctrl::HasDHCtrl() const
{
GuiLock __;
if(dynamic_cast<const DHCtrl *>(this))
return true;
for(Ctrl *q = GetFirstChild(); q; q = q->next)
if(q->HasDHCtrl())
return true;
return false;
bool Ctrl::IsDHCtrl() const {
return dynamic_cast<const DHCtrl *>(this);
}
void Ctrl::SyncDHCtrl()
{
GuiLock __;
Ctrl *p = GetTopCtrl();
p->hasdhctrl = p->HasDHCtrl();
}
void Ctrl::AddChild(Ctrl *q, Ctrl *p)
void Ctrl::AddChild(Ctrl *q, Ctrl *p)
{
GuiLock __;
ASSERT(q);
@ -68,8 +54,6 @@ void Ctrl::AddChild(Ctrl *q, Ctrl *p)
q->ParentChange();
if(updaterect && GetTopCtrl()->IsOpen())
q->StateH(OPEN);
if(dynamic_cast<DHCtrl *>(q))
SyncDHCtrl();
}
void Ctrl::AddChild(Ctrl *child)
@ -100,8 +84,6 @@ void Ctrl::RemoveChild0(Ctrl *q)
if(q->next)
q->next->prev = q->prev;
q->next = q->prev = NULL;
if(dynamic_cast<DHCtrl *>(q))
SyncDHCtrl();
}
void Ctrl::RemoveChild(Ctrl *q)

View file

@ -507,7 +507,6 @@ private:
bool popup:1;
bool popupgrab:1;
byte backpaint:2;//2
bool hasdhctrl:1;
bool akv:1;
bool destroying:1;
@ -635,8 +634,6 @@ private:
void UpdateArea(SystemDraw& draw, const Rect& clip);
Ctrl *GetTopRect(Rect& r, bool inframe, bool clip = true);
void DoSync(Ctrl *q, Rect r, bool inframe);
bool HasDHCtrl() const;
void SyncDHCtrl();
void SetInfoPart(int i, const char *txt);
String GetInfoPart(int i) const;
@ -725,6 +722,8 @@ private:
#endif
static void InstallPanicBox();
bool IsDHCtrl() const;
private:
void DoRemove();

View file

@ -21,7 +21,7 @@ void Ctrl::RefreshFrame(const Rect& r) {
LLOG("RefreshRect " << Name() << ' ' << r);
if(GuiPlatformRefreshFrameSpecial(r))
return;
if(!top && !hasdhctrl) {
if(!top && !IsDHCtrl()) {
if(InFrame())
parent->RefreshFrame(r + GetRect().TopLeft());
else
@ -168,7 +168,7 @@ void Ctrl::ScrollView(const Rect& _r, int dx, int dy)
#else
if(IsFullRefresh() || !IsVisible())
return;
if(hasdhctrl) {
if(IsDHCtrl()) {
Refresh(_r);
return;
}
@ -603,7 +603,7 @@ void Ctrl::UpdateArea0(SystemDraw& draw, const Rect& clip, int backpaint)
LLOG("========== END (TARGET IS BACKBUFFER)");
return;
}
if(backpaint == FULLBACKPAINT || globalbackpaint/* && !hasdhctrl && !dynamic_cast<DHCtrl *>(this)*/) {
if(backpaint == FULLBACKPAINT || globalbackpaint) {
ShowRepaintRect(draw, clip, LtRed());
BackDraw bw;
bw.Create(draw, clip.GetSize());

View file

@ -188,7 +188,7 @@ void Ctrl::SetPos0(LogPos p, bool _inframe)
{
GuiLock __;
if(p == pos && inframe == _inframe) return;
if(parent && !hasdhctrl) {
if(parent && !IsDHCtrl()) {
if(!globalbackbuffer) {
Rect from = GetRect().Size();
Top *top = GetTopRect(from, true)->top;

View file

@ -161,9 +161,7 @@ void TopWindow::SyncCaption()
else style = exstyle = 0;
style &= ~(WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU|WS_POPUP|WS_DLGFRAME);
exstyle &= ~(WS_EX_TOOLWINDOW|WS_EX_DLGMODALFRAME);
style |= WS_CAPTION;
if(hasdhctrl)
style |= WS_CLIPSIBLINGS|WS_CLIPCHILDREN;
style |= WS_CAPTION|WS_CLIPSIBLINGS|WS_CLIPCHILDREN;
if(minimizebox && !GetOwner())
style |= WS_MINIMIZEBOX;
if(maximizebox)

View file

@ -171,8 +171,8 @@ void RichTextView::RefreshRange(int a, int b)
int h = min(max(a, b) + 1, GetLength());
if(l == h)
return;
Rect r1 = text.GetCaret(l, GetPage());
Rect r2 = text.GetCaret(h, GetPage());
Rect r1 = text.GetCaret(l, GetPage()) + margin.TopLeft();
Rect r2 = text.GetCaret(h, GetPage()) + margin.TopLeft();
Zoom zoom = GetZoom();
Refresh(Rect(0, zoom * (r1.top - sb), GetSize().cx, zoom * (r2.bottom - sb + zoom.d - 1)));
}

View file

@ -160,7 +160,7 @@ DirDiffDlg::DirDiffDlg()
clearFind.RightPosZ(1, 16).VSizePosZ(1, 1);
find.AddChild(&clearFind);
files_pane.Add(info.SetAlign(ALIGN_RIGHT).TopPos(3 * cy + 3 * div, bcy).RightPos(1, 70));
files_pane.Add(info.SetAlign(ALIGN_RIGHT).TopPos(3 * cy + 3 * div, bcy).RightPos(1, Zx(70)));
files_pane.Add(compare.TopPos(2 * cy + 2 * div, bcy).RightPos(0, bcx));
files_pane.Add(files.VSizePos(3 * cy + bcy + 4 * div, 22).HSizePos());
files_pane.Add(find.HSizePosZ(4, 4).BottomPosZ(4, 19));