From 6443f4fa99837e1f30650fa0e347c84e67bf201c Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 6 Nov 2008 18:29:42 +0000 Subject: [PATCH] A++ navigator range button git-svn-id: svn://ultimatepp.org/upp/trunk@614 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Annotations.cpp | 10 +-- uppsrc/ide/Assist.cpp | 32 +++++++--- uppsrc/ide/Browser/Browser.h | 9 ++- uppsrc/ide/Browser/Browser.iml | 99 +++++++++++++++++------------ uppsrc/ide/Browser/CodeBrowser.cpp | 65 +++++++++++++++++-- uppsrc/ide/Browser/Reference.cpp | 2 +- uppsrc/ide/Browser/Util.cpp | 27 +++++++- uppsrc/ide/Browser/init | 2 +- uppsrc/ide/Common/Common.h | 2 + uppsrc/ide/Navigator.cpp | 4 +- uppsrc/ide/icon.ico | Bin 2862 -> 2862 bytes uppsrc/ide/ide.h | 3 + uppsrc/ide/idebar.cpp | 4 +- uppsrc/ide/idefile.cpp | 14 ++++ uppsrc/ide/version.h | 2 +- 15 files changed, 203 insertions(+), 72 deletions(-) diff --git a/uppsrc/ide/Annotations.cpp b/uppsrc/ide/Annotations.cpp index 88f87165a..1ee2f4b76 100644 --- a/uppsrc/ide/Annotations.cpp +++ b/uppsrc/ide/Annotations.cpp @@ -56,14 +56,6 @@ bool AssistEditor::GetAnnotationRefs(Vector& tl, String& coderef, int q) return true; } -int BestMatch(const char *s, const char *t) -{ - int i = 0; - while(s[i] == t[i] && *s) - i++; - return i; -} - bool AssistEditor::GetAnnotationRef(String& t, String& coderef, int q) { Vector tl; @@ -75,7 +67,7 @@ bool AssistEditor::GetAnnotationRef(String& t, String& coderef, int q) int mi = 0; int m = 0; for(int i = 0; i < tl.GetCount(); i++) { - int mm = BestMatch(tl[i], path); + int mm = GetMatchLen(tl[i], path); if(mm > m) { mi = i; m = mm; diff --git a/uppsrc/ide/Assist.cpp b/uppsrc/ide/Assist.cpp index b58ae71be..6e5423fe8 100644 --- a/uppsrc/ide/Assist.cpp +++ b/uppsrc/ide/Assist.cpp @@ -50,10 +50,13 @@ AssistEditor::AssistEditor() searchindex <<= THISBACK(SearchIndex); navigatorpane.Add(indexpane.SizePos()); - scopepane.Add(browser.search_scope.HSizePos().TopPos(0, cy)); - scopepane.Add(browser.scope.HSizePos().VSizePos(cy + 2, 0)); + int c2 = cy + 2; + scopepane.Add(browser.search_scope.HSizePos(0, 4 * cy + 2).TopPos(0, cy)); + for(int i = 0; i < 4; i++) + scopepane.Add(browser.rangebutton[i].RightPos((3 - i) * cy, cy).TopPos(0, cy)); + scopepane.Add(browser.scope.HSizePos().VSizePos(c2, 0)); itempane.Add(browser.search_item.HSizePos().TopPos(0, cy)); - itempane.Add(browser.item.HSizePos().VSizePos(cy + 2, cy + 2)); + itempane.Add(browser.item.HSizePos().VSizePos(c2, c2)); itempane.Add(browser.search.HSizePos().BottomPos(0, cy)); scope_item.Vert(scopepane, itempane); scope_item.SetPos(3000); @@ -953,17 +956,30 @@ void Ide::JumpToDefinition(const Array& n, int q) { String qitem = n[q].qitem; int i = q; + int qml = 0; + int qcpp = -1; + int qcppml = 0; + int qimpl = -1; + int qimplml = 0; + String currentfile = editfile; while(i < n.GetCount() && n[i].qitem == qitem) { const CppItem& m = n[i]; - if(m.impl) { - GotoCpp(m); - return; + int ml = GetMatchLen(editfile, GetCppFile(m.file)); + if(m.impl && ml > qimplml) { + qimplml = ml; + qimpl = i; } - if(m.filetype == FILE_CPP || m.filetype == FILE_C) + if((m.filetype == FILE_CPP || m.filetype == FILE_C) && ml > qcppml) { + qcpp = i; + qcppml = ml; + } + if(ml > qml) { q = i; + qml = ml; + } i++; } - GotoCpp(n[q]); + GotoCpp(n[qimpl >= 0 ? qimpl : qcpp >= 0 ? qcpp : q]); } void Ide::IdeGotoCodeRef(String coderef) diff --git a/uppsrc/ide/Browser/Browser.h b/uppsrc/ide/Browser/Browser.h index e512b6b6c..eaf35397a 100644 --- a/uppsrc/ide/Browser/Browser.h +++ b/uppsrc/ide/Browser/Browser.h @@ -34,8 +34,11 @@ void ScanLayFile(const char *fn); String MakeCodeRef(const String& scope, const String& item); void SplitCodeRef(const String& ref, String& scope, String& item); +const CppItem *GetCodeRefItem(const String& ref, const String& rfile); const CppItem *GetCodeRefItem(const String& ref); +int GetMatchLen(const char *s, const char *t); + enum { WITHBODY = 33 }; inline Font BrowserFont() @@ -118,12 +121,15 @@ public: EditString search_item; EditString search; FrameRight