mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-25 22:03:45 -06:00
developing navigator
This commit is contained in:
parent
8675efb4d2
commit
116a01ebb8
9 changed files with 58 additions and 40 deletions
|
|
@ -296,7 +296,6 @@ Color EditField::GetPaper()
|
|||
{
|
||||
bool enabled = IsShowEnabled();
|
||||
Color paper = GetColorAttr(ATTR_BACKGROUND);
|
||||
DDUMP(paper);
|
||||
if(IsNull(paper))
|
||||
paper = enabled && !IsReadOnly() ? (HasFocus() ? style->focus
|
||||
: style->paper)
|
||||
|
|
@ -1081,7 +1080,6 @@ EditField& EditField::SetColor(Color c)
|
|||
|
||||
EditField& EditField::SetBackground(Color c)
|
||||
{
|
||||
DDUMP(c);
|
||||
if(GetColorAttr(ATTR_BACKGROUND) != c) {
|
||||
SetColorAttr(ATTR_BACKGROUND, c);
|
||||
Refresh();
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ void Hdepend::AddDependency(const String& file, const String& dep)
|
|||
}
|
||||
|
||||
void Hdepend::Include(const char *s, Hdepend::Info& info, const String& filedir, bool bydefine) {
|
||||
DLOG("#include " << s);
|
||||
while(*s == ' ' || *s == '\t')
|
||||
s++;
|
||||
if(iscib(*s)) { // #include MACRO
|
||||
|
|
@ -62,7 +61,6 @@ void Hdepend::Include(const char *s, Hdepend::Info& info, const String& filedir,
|
|||
}
|
||||
else { // normal include
|
||||
String fn = FindIncludeFile(s, filedir);
|
||||
DDUMP(fn);
|
||||
if(!IsNull(fn)) {
|
||||
info.depend.Add(File(fn));
|
||||
info.bydefine.Add(bydefine);
|
||||
|
|
@ -87,7 +85,6 @@ static const char *SkipComment(const char *s) {
|
|||
|
||||
void Hdepend::ScanFile(const String& path, int map_index)
|
||||
{
|
||||
DDUMP(path);
|
||||
Info& info = map[map_index];
|
||||
info.depend.Clear();
|
||||
info.bydefine.Clear();
|
||||
|
|
|
|||
|
|
@ -67,8 +67,6 @@ void DrawFileName(Draw& w, const Rect& r, const String& h, Color ink)
|
|||
|
||||
int PaintFileName(Draw& w, const Rect& r, String h, Color ink)
|
||||
{
|
||||
if(*h == '\xff')
|
||||
h.Remove(0, 1);
|
||||
return DrawFileName0(w, r, h, ink, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -352,9 +352,9 @@ void Navigator::NavigatorDisplay::PaintBackground(Draw& w, const Rect& r, const
|
|||
return;
|
||||
const NavItem& m = *item[ii];
|
||||
bool focuscursor = (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT);
|
||||
if(findarg(m.kind, KIND_FILE, KIND_NEST) >= 0)
|
||||
w.DrawRect(r, focuscursor ? paper : m.kind == KIND_NEST ? Blend(SColorMark, SColorPaper, 220)
|
||||
: SColorFace);
|
||||
if(findarg(m.kind, KIND_NEST) >= 0)
|
||||
w.DrawRect(r, focuscursor ? paper : m.pretty.Find('\xff') >= 0 ? SColorFace()
|
||||
: Blend(SColorMark, SColorPaper, 220));
|
||||
else
|
||||
w.DrawRect(r, paper);
|
||||
}
|
||||
|
|
@ -369,16 +369,16 @@ int Navigator::NavigatorDisplay::DoPaint(Draw& w, const Rect& r, const Value& q,
|
|||
bool focuscursor = (style & (FOCUS|CURSOR)) == (FOCUS|CURSOR) || (style & SELECT);
|
||||
|
||||
int x = r.left;
|
||||
int y = (r.GetHeight() - Draw::GetStdFontCy()) / 2;
|
||||
|
||||
if(findarg(m.kind, KIND_FILE, KIND_NEST) >= 0) {
|
||||
w.DrawRect(r, focuscursor ? paper : m.kind == KIND_NEST ? Blend(SColorMark, SColorPaper, 220)
|
||||
: SColorFace);
|
||||
if(findarg(m.kind, KIND_FILE) >= 0)
|
||||
int y = r.top + (r.GetHeight() - Draw::GetStdFontCy()) / 2;
|
||||
|
||||
if(m.kind == KIND_NEST) {
|
||||
bool fn = m.pretty.Find('\xff') >= 0;
|
||||
w.DrawRect(r, focuscursor ? paper : fn ? SColorFace()
|
||||
: Blend(SColorMark(), SColorPaper(), 220));
|
||||
if(fn)
|
||||
return PaintFileName(w, r, m.pretty, ink);
|
||||
String h = FormatNest(m.pretty);
|
||||
w.DrawText(x, y, h, StdFont().Bold(), ink);
|
||||
return GetTextSize(h, StdFont().Bold()).cx;
|
||||
w.DrawText(x, y, m.pretty, StdFont().Bold(), ink);
|
||||
return GetTextSize(m.pretty, StdFont().Bold()).cx;
|
||||
}
|
||||
|
||||
w.DrawRect(r, paper);
|
||||
|
|
@ -439,15 +439,18 @@ void Navigator::Search()
|
|||
int lineno = StrInt(s);
|
||||
nitem.Clear();
|
||||
Index<String> nests;
|
||||
if(IsNull(theide->editfile))
|
||||
return;
|
||||
int fileii = GetSourceFileIndex(theide->editfile);
|
||||
auto Nest = [&](const AnnotationItem& m, const String& path) {
|
||||
if(m.nspace == m.nest)
|
||||
return m.nest + "\xff" + path;
|
||||
return m.nest;
|
||||
};
|
||||
nests.Add(Null);
|
||||
if(!IsNull(lineno)) {
|
||||
NavItem& m = nitem.Add();
|
||||
m.pretty = "Go to line " + AsString(lineno);
|
||||
m.kind = KIND_LINE;
|
||||
m.line = lineno;
|
||||
nests.Add(Null);
|
||||
}
|
||||
else
|
||||
if(IsNull(s) && !sorting) {
|
||||
|
|
@ -457,7 +460,7 @@ void Navigator::Search()
|
|||
for(const AnnotationItem& m : theide->editor.annotations) {
|
||||
NavItem& n = nitem.Add();
|
||||
(AnnotationItem&)n = m;
|
||||
nests.FindAdd(n.nest);
|
||||
nests.FindAdd(n.nest = Nest(m, theide->editfile));
|
||||
}
|
||||
SortIndex(nests);
|
||||
}
|
||||
|
|
@ -482,7 +485,7 @@ void Navigator::Search()
|
|||
visited.Add(m.id);
|
||||
NavItem& n = nitem.Add();
|
||||
(AnnotationItem&)n = m;
|
||||
nests.FindAdd(n.nest);
|
||||
nests.FindAdd(n.nest = Nest(m, theide->editfile));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -498,13 +501,13 @@ void Navigator::Search()
|
|||
m.pretty = wspc[i] + "/" + p[j];
|
||||
m.id = SourcePath(wspc[i], p[j]);
|
||||
m.line = 0;
|
||||
nests.FindAdd("<files>");
|
||||
m.nest = "<files>";
|
||||
nests.FindAdd(m.nest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
scope.Clear();
|
||||
scope.Add(Null);
|
||||
for(String n : nests)
|
||||
scope.Add(n);
|
||||
scope.ScrollTo(sc);
|
||||
|
|
@ -533,7 +536,7 @@ int Navigator::ScopeDisplay::DoPaint(Draw& w, const Rect& r, const Value& q, Col
|
|||
return x;
|
||||
}
|
||||
String h = q;
|
||||
if(*h == '\xff') // TODO
|
||||
if(h.Find('\xff') >= 0) // TODO
|
||||
return PaintFileName(w, r, h, ink);
|
||||
else
|
||||
h = FormatNest(h);
|
||||
|
|
@ -560,17 +563,17 @@ void Navigator::Scope()
|
|||
linefo.Clear();
|
||||
String sc = scope.GetKey();
|
||||
String nest;
|
||||
for(const NavItem& n : nitem) {
|
||||
for(const NavItem& n : nitem)
|
||||
if(IsNull(sc) || n.nest == sc) {
|
||||
if(!sorting && n.nest != nest) {
|
||||
NavItem& m = nest_item.Add();
|
||||
m.kind = KIND_NEST; // TODO: KIND_FILE
|
||||
m.kind = KIND_NEST;
|
||||
nest = m.pretty = n.nest;
|
||||
DDUMP(n.nest);
|
||||
litem.Add(&m);
|
||||
}
|
||||
litem.Add(&n);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO sorting
|
||||
|
||||
|
|
@ -584,7 +587,7 @@ void Navigator::ListLineEnabled(int i, bool& b)
|
|||
{
|
||||
if(i >= 0 && i < litem.GetCount()) {
|
||||
int kind = litem[i]->kind;
|
||||
if(findarg(kind, KIND_FILE, KIND_NEST) >= 0)
|
||||
if(findarg(kind, KIND_NEST) >= 0)
|
||||
b = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,21 @@
|
|||
#define LTIMESTOP(x)
|
||||
#define LLOG(x)
|
||||
|
||||
void AnnotationItem::Serialize(Stream& s)
|
||||
{
|
||||
s % kind
|
||||
% line
|
||||
% definition
|
||||
% name
|
||||
% id
|
||||
% pretty
|
||||
% nspace
|
||||
% uname
|
||||
% nest
|
||||
% unest;
|
||||
|
||||
}
|
||||
|
||||
struct BlitzMaker {
|
||||
Time time;
|
||||
String blitz;
|
||||
|
|
|
|||
|
|
@ -84,8 +84,6 @@ bool Clang::Parse(const String& filename, const String& content, const String& i
|
|||
|
||||
cmdline << filename << " -DflagDEBUG -DflagDEBUG_FULL -DflagMAIN -xc++ -std=c++17 ";
|
||||
|
||||
DDUMP(cmdline);
|
||||
|
||||
cmdline << RedefineMacros();
|
||||
|
||||
String includes = includes_;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ struct AnnotationItem : Moveable<AnnotationItem> {
|
|||
String nest; // Upp::Class
|
||||
String unest; // UPP::CLASS
|
||||
|
||||
~AnnotationItem() { DHITCOUNT("AnnotationItem"); }
|
||||
void Serialize(Stream& s);
|
||||
};
|
||||
|
||||
struct CurrentFileContext {
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
- QTF :\1label\1:
|
||||
|
||||
- autocomplete templates ?
|
||||
|
||||
- recognized headers slow
|
||||
|
||||
- unrecognized headers slow
|
||||
|
|
@ -66,6 +64,17 @@
|
|||
|
||||
- immediate reparse (probably Update?)
|
||||
|
||||
- Navigator -> (constructor does not have return value)
|
||||
|
||||
- local file navigation off by 1 line
|
||||
|
||||
- global navigation not working
|
||||
|
||||
- operator bool - wrong nest (Core/Speller.cpp)
|
||||
|
||||
- constructor - worng nest(Core/Speller.cpp)
|
||||
|
||||
|
||||
LATER:
|
||||
|
||||
- slow .txt
|
||||
|
|
@ -94,3 +103,7 @@ DONE:
|
|||
|
||||
- ide/Core.h - no annotations
|
||||
|
||||
REJECTED:
|
||||
|
||||
- autocomplete templates ?
|
||||
|
||||
|
|
|
|||
|
|
@ -659,7 +659,6 @@ void Ide::SyncClang()
|
|||
animator = 20;
|
||||
else
|
||||
animator -= 3;
|
||||
DDUMP(animator);
|
||||
return Blend(IsDarkTheme() ? GrayColor(70) : SColorLtFace(), Color(198, 170, 0), animator);
|
||||
};
|
||||
Color bg = Animate(animate_current_file, animate_current_file_dir, editor.annotating || IsCurrentFileParsing());
|
||||
|
|
@ -669,9 +668,6 @@ void Ide::SyncClang()
|
|||
a.Add(i > cx - DPI(6) ? bg : Null);
|
||||
}
|
||||
editor.AnimateBar(pick(a));
|
||||
DDUMP(IsIndexing());
|
||||
DDUMP(Animate(animate_indexer, animate_indexer_dir, IsIndexing()));
|
||||
DDUMP(Animate(animate_autocomplete, animate_autocomplete_dir, IsAutocompleteParsing()));
|
||||
editor.search.SetBackground(Animate(animate_indexer, animate_indexer_dir, IsIndexing()));
|
||||
display.Animate(Animate(animate_autocomplete, animate_autocomplete_dir, IsAutocompleteParsing()));
|
||||
animate_phase = phase;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue