mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-21 22:04:56 -06:00
Code navigator: Find in all scopes
git-svn-id: svn://ultimatepp.org/upp/trunk@517 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
dcca247438
commit
2ff4ba43b4
5 changed files with 47 additions and 7 deletions
|
|
@ -217,6 +217,7 @@ struct CppItem {
|
|||
String qitem;
|
||||
String item;
|
||||
String name;
|
||||
String uname;
|
||||
String natural;
|
||||
String type;
|
||||
String qtype;
|
||||
|
|
|
|||
|
|
@ -241,6 +241,8 @@ void QualifyPass2(CppBase& base)
|
|||
bool sort = false;
|
||||
for(int i = 0; i < n.GetCount(); i++) {
|
||||
CppItem& m = n[i];
|
||||
if(m.uname.GetCount() == 0 && m.name.GetCount())
|
||||
m.uname = ToUpper(m.name);
|
||||
if(m.serial != base.serial && !m.IsType()) {
|
||||
sort = true;
|
||||
m.serial = base.serial;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ AssistEditor::AssistEditor()
|
|||
scopepane.Add(browser.search_scope.HSizePos().TopPos(0, cy));
|
||||
scopepane.Add(browser.scope.HSizePos().VSizePos(cy + 2, 0));
|
||||
itempane.Add(browser.search_item.HSizePos().TopPos(0, cy));
|
||||
itempane.Add(browser.item.HSizePos().VSizePos(cy + 2, 0));
|
||||
itempane.Add(browser.item.HSizePos().VSizePos(cy + 2, cy + 2));
|
||||
itempane.Add(browser.search.HSizePos().BottomPos(0, cy));
|
||||
scope_item.Vert(scopepane, itempane);
|
||||
scope_item.SetPos(3000);
|
||||
navigatorpane.Add(scope_item);
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ public:
|
|||
ArrayCtrl item;
|
||||
EditString search_scope;
|
||||
EditString search_item;
|
||||
EditString search;
|
||||
|
||||
void Load();
|
||||
void LoadScope();
|
||||
|
|
|
|||
|
|
@ -1,21 +1,52 @@
|
|||
#include "Browser.h"
|
||||
|
||||
bool MatchCib(const String& s, const String& match)
|
||||
{
|
||||
int q = ToUpper(s).Find(match);
|
||||
return q > 0 && !iscid(s[q - 1]) || q == 0;
|
||||
}
|
||||
|
||||
bool HasItem(const Array<CppItem>& n, const String& m)
|
||||
{
|
||||
if(IsNull(m))
|
||||
return true;
|
||||
for(int i = 0; i < n.GetCount(); i++)
|
||||
if(n[i].uname.StartsWith(m))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HasItem(int file, const String& m)
|
||||
{
|
||||
if(IsNull(m))
|
||||
return true;
|
||||
int q = BrowserBase().Find("");
|
||||
if(q < 0)
|
||||
return false;
|
||||
const Array<CppItem>& n = BrowserBase()[q];
|
||||
for(int i = 0; i < n.GetCount(); i++)
|
||||
if(n[i].file == file && n[i].uname.StartsWith(m))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void CodeBrowser::Load()
|
||||
{
|
||||
String find = ToUpper((String)~search);
|
||||
String match = ToUpper((String)~search_scope);
|
||||
Vector<String> txt;
|
||||
Vector<Value> ndx;
|
||||
Index<int> fi;
|
||||
for(int i = 0; i < BrowserBase().GetCount(); i++) {
|
||||
String s = BrowserBase().GetKey(i);
|
||||
const Array<CppItem>& n = BrowserBase()[i];
|
||||
if(s.GetCount()) {
|
||||
if(ToUpper(s).Find(match) >= 0) {
|
||||
if(MatchCib(s, match) && HasItem(n, find)) {
|
||||
txt.Add(s);
|
||||
ndx.Add(s);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const Array<CppItem>& n = BrowserBase()[i];
|
||||
int i = 0;
|
||||
while(i < n.GetCount()) {
|
||||
fi.FindAdd(n[i].file);
|
||||
|
|
@ -26,7 +57,7 @@ void CodeBrowser::Load()
|
|||
for(int i = 0; i < fi.GetCount(); i++) {
|
||||
String s = GetCppFile(fi[i]);
|
||||
s = '<' + GetFileName(GetFileFolder(s)) + '/' + GetFileName(s) + '>';
|
||||
if(ToUpper(s).Find(match) >= 0) {
|
||||
if(MatchCib(s, match) && HasItem(fi[i], find)) {
|
||||
txt.Add(s);
|
||||
ndx.Add(fi[i]);
|
||||
}
|
||||
|
|
@ -72,7 +103,8 @@ void GatherMethods(const String& type, VectorMap<String, bool>& inherited, bool
|
|||
|
||||
void CodeBrowser::LoadScope()
|
||||
{
|
||||
String match = ~search_item;
|
||||
String find = ToUpper((String)~search);
|
||||
String match = ToUpper((String)~search_item);
|
||||
Value key = item.GetKey();
|
||||
int sc = item.GetCursorSc();
|
||||
item.Clear();
|
||||
|
|
@ -90,7 +122,7 @@ void CodeBrowser::LoadScope()
|
|||
for(int i = 0; i < n.GetCount(); i = FindNext(n, i)) {
|
||||
CppItemInfo m;
|
||||
(CppItem&) m = n[i];
|
||||
if((file < 0 || m.file == file) && ToUpper(m.name).Find(match) >= 0) {
|
||||
if((file < 0 || m.file == file) && m.uname.StartsWith(match) && m.uname.StartsWith(find)) {
|
||||
int q = inherited.Find(m.qitem);
|
||||
if(q >= 0) {
|
||||
m.over = true;
|
||||
|
|
@ -163,6 +195,9 @@ CodeBrowser::CodeBrowser()
|
|||
item.NoHeader();
|
||||
item.SetLineCy(BrowserFont().Info().GetHeight() + 3);
|
||||
search_item.SetFilter(SearchItemFilter);
|
||||
search_item.NullText("Search id ");
|
||||
search_item.NullText("Search in scope ");
|
||||
search_item <<= THISBACK(LoadScope);
|
||||
search.NullText("Find ");
|
||||
search.SetFilter(SearchItemFilter);
|
||||
search <<= THISBACK(Load);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue