ide: Alt+C (copy declaration/definition) refactored, CtrlLib: DisplayPopUp issues

This commit is contained in:
Mirek Fidler 2025-10-18 14:33:28 +02:00
commit 27c4cdef51
9 changed files with 213 additions and 22 deletions

View file

@ -199,7 +199,7 @@ void DisplayPopup::PopUp::Set(Ctrl *_ctrl, const Rect& _item,
void DisplayPopup::Set(Ctrl *ctrl, const Rect& item, const Value& v, const Display *display, Color ink, Color paper, dword style, int margin)
{
if(IsNull(Check(ctrl, item, v, display, margin)))
if(IsNull(Check(ctrl, item, v, display, margin)) && !(popup && popup->IsOpen()))
return; // precheck to avoid creating / deleting popup too often, avoid flooding timer with PostCallback
if(!popup) {
popup.Create();

View file

@ -496,7 +496,7 @@ void TreeCtrl::SyncCtrls(bool add, Ctrl *restorefocus)
AddChildBefore(m.ctrl, GetLastChild());
if(m.ctrl == restorefocus || m.ctrl->HasChildDeep(restorefocus))
restorefocus->SetFocus();
int yy = l.y - org.y;
if(yy + mcy < 0 || yy > sz.cy) // not in view, no need to evaluate precisely
m.ctrl->SetRect(levelcx + l.level * levelcx + m.margin - org.x,
@ -705,6 +705,7 @@ void TreeCtrl::SetCursorLine(int i, bool sc, bool sel, bool cb)
if(!multiselect) WhenSel();
}
}
SyncInfo();
}
void TreeCtrl::SetCursorLine(int i)
@ -988,19 +989,13 @@ void TreeCtrl::SyncInfo()
if(i < line.GetCount()) {
const Line& l = line[i];
const Item& m = item[l.itemi];
Size sz = GetSize();
int x = levelcx + l.level * levelcx - org.x + m.image.GetSize().cx;
Size csz = m.GetCtrlSize();
if(m.ctrl && !highlight_ctrl)
x += csz.cx;
Rect r = RectC(x, l.y - org.y, sz.cx - x, m.GetValueSize(display).cy + 2 * m.margin);
// Rect r = GetValueRect(l);
Rect r = GetValueRect(l) & GetSize();
if(r.Contains(p)) {
Color fg, bg;
dword st;
const Display *d = GetStyle(i, fg, bg, st);
info.UseDisplayStdSize();
info.Set(this, r, m.value, d, fg, bg, st, m.margin);
info.Set(this, r, m.value, d, fg, bg, st, 0);
return;
}
}
@ -1916,4 +1911,4 @@ int Copy(TreeCtrl& dst, int did, int i, const TreeCtrl& src, int id)
return did;
}
}
}