String CreateQtf(const String& item, const String& name, const CppItem& m, const String& lang, bool onlyhdr = false) { String qtf; bool str = m.kind == STRUCT || m.kind == STRUCTTEMPLATE; if(!str) qtf << "[s4 &]"; String st = str ? "[s2;" : "[s1;"; String k = st + ':' + DeQtf(item) + ": "; if(m.IsTemplate() && str) { int q = 0; int w = 0; while(q < m.natural.GetLength()) { if(m.natural[q] == '<') w++; if(m.natural[q] == '>') { w--; if(w == 0) { q++; break; } } q++; } qtf << "[s2:noref: " << DecoratedItem(name, m, m.natural.Mid(0, q)) << "&][s2 " << k; if(q < m.natural.GetLength()) { while((byte)m.natural[q] <= 32) q++; qtf << DecoratedItem(name, m, m.natural.Mid(q)); } } else qtf << k << DecoratedItem(name, m, m.natural); qtf << "&]"; if(onlyhdr) return qtf; qtf << "[s3%" << lang << " "; String d; Vector<String> t = Split(m.tname, ';'); for(int i = 0; i < t.GetCount(); i++) { if(i) d << ' '; d << "[%-*@g " << DeQtf(t[i]) << "]"; } d.Clear(); d << "[%" << lang << " "; Vector<String> p = Split(m.pname, ';'); if(!str) for(int i = 0; i < p.GetCount(); i++) d << " [%-*@r " << DeQtf(p[i]) << "]"; if(!str && p.GetCount()) qtf << d << " ."; qtf << "&]"; qtf << "[s7 &]"; return qtf; }
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); } } }