void DisplayPopup::Sync() { if(display && ctrl && !ctrl->IsDragAndDropTarget() && !IsDragAndDropTarget()) { Ctrl *top = ctrl->GetTopCtrl(); if(top && top->HasFocusDeep()) { Size sz = display->GetStdSize(value); if(sz.cx + 2 * margin > item.GetWidth() || sz.cy > item.GetHeight()) { slim = item + ctrl->GetScreenView().TopLeft(); if(slim.Contains(GetMousePos())) { // Rect wa = GetWorkArea(); Rect r = item; r.right = max(r.right, r.left + sz.cx + 2 * margin); r.bottom = max(r.bottom, r.top + sz.cy); r.Inflate(1, 1); r.Offset(ctrl->GetScreenView().TopLeft()); SetRect(r); if(!IsOpen()) Ctrl::PopUp(ctrl, true, false, false); Refresh(); return; } } } } if(IsOpen()) Close(); }
void AssistEditor::SyncParamInfo() { String qtf; Ctrl *p = GetTopCtrl(); int mpar = INT_MAX; int pos = 0; if(p && p->HasFocusDeep()) { for(int q = 0; q < PARAMN; q++) { ParamInfo& m = param[q]; int i = GetCursorLine(); if(m.line >= 0 && m.line < GetLineCount() && i >= m.line && i < m.line + 10 && m.editfile == theide->editfile && GetWLine(m.line).StartsWith(m.test)) { int c = GetCursor(); i = GetPos(m.line) + m.test.GetCount(); if(c >= i) { int par = 0; int pari = 0; for(;;) { int ch = Ch(i++); if(i > c) { if(par < mpar) { qtf = "[A1 " + DecoratedItem(m.item.name, m.item, m.item.natural, pari); mpar = par; pos = m.pos; } break; } if(ch == ')') { if(par <= 0) break; par--; } if(ch == '(') par++; if(ch == ',' && par == 0) pari++; } } } } } if(param_qtf != qtf) param_info.SetQTF(qtf); Rect r = GetLineScreenRect(GetCursorLine()); int cx = max(GetSize().cx - 30, 300); int h = param_info.GetHeight(cx); h = min(h, 550); int y = r.top - h - 6; if(y < GetWorkArea().top) y = r.bottom; r = RectC(r.left, y, min(param_info.GetWidth(), cx) + 8, h + 6); r.OffsetHorz(GetColumnLine(pos).x * GetFontSize().cx); r.OffsetHorz(min(GetWorkArea().right - r.right, 0)); if(param_qtf != qtf || r != param_info.GetRect()) { param_qtf = qtf; if(IsNull(qtf)) { if(param_info.IsOpen()) param_info.Close(); } else { param_info.SetRect(r); if(!param_info.IsOpen() && !IsSelection()) param_info.Ctrl::PopUp(this, false, false, false); } } }