diff --git a/uppsrc/Core/SplitMerge.cpp b/uppsrc/Core/SplitMerge.cpp index d4b20ec86..4e2e18c2c 100644 --- a/uppsrc/Core/SplitMerge.cpp +++ b/uppsrc/Core/SplitMerge.cpp @@ -245,7 +245,7 @@ void MergeWith(String& dest, const char *delim, __List##I(E__NFSValue)) \ __List##I(E__Merge); \ } \ -__Expand8(E__NFBody) +__Expand12(E__NFBody) #undef E__TL #undef E__NFIf @@ -315,7 +315,7 @@ void MergeWith(WString& dest, const wchar *delim, __List##I(E__NFSValue)) \ __List##I(E__Merge); \ } \ -__Expand8(E__NFBody) +__Expand12(E__NFBody) #undef E__TL #undef E__NFIf diff --git a/uppsrc/Core/SplitMerge.h b/uppsrc/Core/SplitMerge.h index a68f0639f..88f649847 100644 --- a/uppsrc/Core/SplitMerge.h +++ b/uppsrc/Core/SplitMerge.h @@ -33,7 +33,7 @@ bool SplitTo(const char *s, const char *delim, __List##I(E__NFValue)); \ String Merge(const char *delim, __List##I(E__NFSValue)); \ void MergeWith(String& dest, const char *delim, __List##I(E__NFSValue)); \ -__Expand8(E__NFBody) +__Expand12(E__NFBody) #undef E__NFBody #undef E__NFValue @@ -52,7 +52,7 @@ bool SplitTo(const wchar *s, const char *delim, __List##I(E__NFValue)); \ WString Merge(const wchar *delim, __List##I(E__NFSValue)); \ void MergeWith(WString& dest, const wchar *delim, __List##I(E__NFSValue)); \ -__Expand8(E__NFBody) +__Expand12(E__NFBody) #undef E__NFBody #undef E__NFValue diff --git a/uppsrc/ide/Browser/Browser.h b/uppsrc/ide/Browser/Browser.h index a6997d50d..ea2ddcc63 100644 --- a/uppsrc/ide/Browser/Browser.h +++ b/uppsrc/ide/Browser/Browser.h @@ -85,6 +85,9 @@ struct ItemTextPart : Moveable { int pari; }; +Vector ParseItemNatural(const String& name, const String& natural, const String& ptype, + const String& pname, const String& type, const String& tname, + const String& ctname, const char *s); Vector ParseItemNatural(const String& name, const CppItem& m, const char *natural); Vector ParseItemNatural(const CppItemInfo& m); Vector ParseItemNatural(const CppItemInfo& m); @@ -107,6 +110,11 @@ enum AdditionalKinds { KIND_INCLUDEFOLDER, }; +void PaintText(Draw& w, int& x, int y, const char *text, + const Vector& n, int starti, int count, bool focuscursor, + Color _ink, bool italic); +void PaintCppItemImage(Draw& w, int& x, int ry, int access, int kind, bool focuscursor); + struct CppItemInfoDisplay : public Display { bool namestart; diff --git a/uppsrc/ide/Browser/ItemDisplay.cpp b/uppsrc/ide/Browser/ItemDisplay.cpp index cc91cc9ab..10cc80f69 100644 --- a/uppsrc/ide/Browser/ItemDisplay.cpp +++ b/uppsrc/ide/Browser/ItemDisplay.cpp @@ -1,7 +1,7 @@ #include "Browser.h" -void PaintText(Draw& w, int& x, int y, const CppItemInfo& m, const Vector& n, - int starti, int count, bool focuscursor, Color _ink) +void PaintText(Draw& w, int& x, int y, const char *text, const Vector& n, + int starti, int count, bool focuscursor, Color _ink, bool italic) { for(int i = starti; i < count; i++) { const ItemTextPart& p = n[i]; @@ -23,20 +23,24 @@ void PaintText(Draw& w, int& x, int y, const CppItemInfo& m, const Vector& n, + int starti, int count, bool focuscursor, Color _ink) +{ + PaintText(w, x, y, ~m.natural, n, starti, count, focuscursor, _ink, m.overed); +} + void PaintCppItemImage(Draw& w, int& x, int ry, int access, int kind, bool focuscursor) { Image img = decode(access, PROTECTED, BrowserImg::mprotected(), diff --git a/uppsrc/ide/CodeBrowser.cpp b/uppsrc/ide/CodeBrowser.cpp index e3f643c37..63c5a1684 100644 --- a/uppsrc/ide/CodeBrowser.cpp +++ b/uppsrc/ide/CodeBrowser.cpp @@ -13,21 +13,68 @@ struct Navigator : TopWindow { Navigator(); }; +struct NavigatorDisplay : Display { + virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const + { + CppItem m; + LoadFromString(m, q); + w.DrawRect(r, paper); + bool focuscursor = (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT); + if(IsNull(q)) return; + int x = r.left; + int fcy = Draw::GetStdFontCy(); + int y = r.top + r.GetHeight() / 2 - fcy; + int x0 = x; + Vector n = ParseItemNatural(m.name, m, ~m.natural + m.at); + int starti = 0; + for(int i = 0; i < n.GetCount(); i++) + if(n[i].type == ITEM_NAME) { + starti = i; + break; + } + PaintText(w, x, y, ~m.natural, n, 0, starti, focuscursor, ink, false); + if(m.item.GetCount()) { + String h = ' ' + m.item; + h.Cat("::"); + w.DrawText(x, y, h, StdFont().Bold(), Magenta()); + x += GetTextSize(h, StdFont()).cx; + } + int x1 = r.left; + PaintText(w, x1, y + fcy, ~m.natural, n, starti, n.GetCount(), focuscursor, ink, false); + } +}; + void Navigator::Search() { String s = ~search; list.Clear(); - const CppBase& b = CodeBase(); + // TODO: Be smarter with '::' + CppBase& b = CodeBase(); for(int i = 0; i < b.GetCount(); i++) { String nest = b.GetKey(i); String unest = ToUpper(nest); - const Array& item = b[i]; + Array& item = b[i]; for(int j = 0; j < item.GetCount(); j++) { - const CppItem& m = item[j]; + CppItem m; + + { DTIMING("Copy"); + m = item[j]; } + m.item = nest; // Ugly trick... String h = unest; - h << "::" << m.uname; - if(h.Find(s) >= 0) - list.Add(nest, m.natural, h); + { DTIMING("CAT"); + h << "::" << m.uname; } + int q; + { DTIMING("FIND"); + q = h.Find(s); + } + if(h.Find(s) >= 0) { + String sh; + { DTIMING("StoreAsString"); + sh = StoreAsString(m); + } + DTIMING("Add"); + list.Add(nest, sh, h); + } } } } @@ -44,7 +91,7 @@ Navigator::Navigator() Add(list.VSizePos(cy, 0).HSizePos()); list.NoHeader(); list.AddColumn(); - list.AddColumn(); + list.AddColumn().SetDisplay(Single()); list.AddColumn(); list.SetLineCy(2 * GetStdFontCy());