mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-30 06:12:22 -06:00
ide: Now showing C++ access (public/protected/private) in the header line
This commit is contained in:
parent
1f8b3945a6
commit
74a3b4574e
3 changed files with 968 additions and 946 deletions
|
|
@ -119,6 +119,7 @@ void CodeEditor::Paint(Draw& w)
|
|||
return;
|
||||
|
||||
int line0 = -1;
|
||||
int access = -1; // 0 public, 1 protected, 2 private
|
||||
for(int i = IsNull(end) ? 0 : end.y + 1; i <= start.y; i++) {
|
||||
String l = GetUtf8Line(i);
|
||||
bool hdr = false;
|
||||
|
|
@ -136,6 +137,25 @@ void CodeEditor::Paint(Draw& w)
|
|||
catch(CParser::Error) {}
|
||||
if(hdr) {
|
||||
line0 = i;
|
||||
while(i < GetScrollPos().y + 1) {
|
||||
String l = GetUtf8Line(i);
|
||||
CParser p(l);
|
||||
try {
|
||||
while(!p.IsEof())
|
||||
if(p.Id("public"))
|
||||
access = 0;
|
||||
else
|
||||
if(p.Id("protected"))
|
||||
access = 1;
|
||||
else
|
||||
if(p.Id("private"))
|
||||
access = 2;
|
||||
else
|
||||
p.Skip();
|
||||
}
|
||||
catch(CParser::Error) {}
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(!empty && line0 < 0)
|
||||
|
|
@ -199,6 +219,13 @@ void CodeEditor::Paint(Draw& w)
|
|||
x += GetTextSize(~r + ii, hln[ii].font, n).cx;
|
||||
ii += n;
|
||||
}
|
||||
if(access >= 0) {
|
||||
Font fnt = GetFont().Bold();
|
||||
String atext = get_i(access, " public: ", " protected: ", " private: ");
|
||||
Size asz = GetTextSize(atext, fnt);
|
||||
w.DrawRect(x, 0, asz.cx, fnt.GetCy(), Blend(SColorPaper(), get_i(access, SLtGreen(), SYellow(), SLtRed()), 50));
|
||||
w.DrawText(x, 0, atext, fnt, SColorText());
|
||||
}
|
||||
}
|
||||
|
||||
void CodeEditor::RefreshBlkHeader()
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -338,8 +338,6 @@ protected:
|
|||
ScrollBars sb;
|
||||
int gcolumn;
|
||||
int64 mpos;
|
||||
|
||||
|
||||
Font font;
|
||||
Size fsz;
|
||||
CharFilter filter;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue