ide: Error messages improved

git-svn-id: svn://ultimatepp.org/upp/trunk@7824 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-10-24 16:34:08 +00:00
parent 00681583a2
commit 49ac9818dd
6 changed files with 39 additions and 24 deletions

View file

@ -168,7 +168,7 @@ void Ide::SyncBottom()
if(editor_bottom.GetZoom() >= 0)
editor_bottom.NoZoom();
console.Show(q == BCONSOLE);
errors.Show(q == BERRORS);
error.Show(q == BERRORS);
ffound.Show(q == BFINDINFILES);
calc.Show(q == BCALC);
if(bottomctrl)

View file

@ -48,7 +48,6 @@ void Ide::BeginBuilding(bool sync_files, bool clear_console)
SyncErrorsMessage();
error_count = 0;
warning_count = 0;
notes.Clear();
if(clear_console)
console.Clear();
build_time = GetTickCount();

View file

@ -416,31 +416,49 @@ void Ide::AddNote(const ErrorInfo& f)
error.Set(cnt - 1, "NOTES", n);
}
void Ide::ShowNote()
{
if(notes.IsCursor())
GoToError(notes);
}
void Ide::ShowFound()
{
if(ffound.IsCursor())
GoToError(ffound);
}
void Ide::ShowError()
void Ide::SelError()
{
notes.Clear();
if(removing_notes)
return;
if(error.IsCursor()) {
ValueArray n = error.Get("NOTES");
for(int i = 0; i < n.GetCount(); i++) {
const ErrorInfo& f = ValueTo<ErrorInfo>(n[i]);
notes.Add(f.file, f.lineno, f.message, n[i]);
Value v = error.Get("NOTES");
if(v != "0") {
int sc = error.GetScroll();
removing_notes = true;
for(int i = error.GetCount() - 1; i >= 0; i--)
if(error.Get(i, "NOTES") == "0")
error.Remove(i);
removing_notes = false;
error.ScrollTo(sc);
error.ScrollIntoCursor();
ValueArray n = v;
int ii = error.GetCursor();
for(int i = 0; i < n.GetCount(); i++) {
const ErrorInfo& f = ValueTo<ErrorInfo>(n[i]);
error.Insert(++ii);
error.Set(ii, 0, f.file);
error.Set(ii, 1, f.lineno);
error.Set(ii, 2, f.message);
error.Set(ii, "INFO", n[i]);
error.Set(ii, "NOTES", "0");
}
}
GoToError(error);
}
}
void Ide::ShowError()
{
if(error.IsCursor())
GoToError(error);
}
void Ide::FoundDisplay::Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
String s = q;

View file

@ -650,14 +650,13 @@ public:
ArrayCtrl ffound;
Splitter errors;
ArrayCtrl error;
int error_count;
int warning_count;
ArrayCtrl notes;
bool addnotes;
bool linking;
Vector<String> linking_line;
bool removing_notes;
IdeCalc calc;
Ptr<Ctrl> bottomctrl;
@ -1162,9 +1161,9 @@ public:
void ConsoleRunEnd();
void AddNote(const ErrorInfo& f);
void SyncErrorsMessage();
void ShowNote();
void ShowError();
void ShowFound();
void SelError();
struct FoundDisplay : Display {
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const;

View file

@ -491,7 +491,7 @@ void Ide::BuildMenu(Bar& menu) {
bool ff = btabs.GetCursor() == BFINDINFILES;
String hh = ff ? "position" : "error line";
bool ffb = ff ? ffound.GetCount() : errors.GetCount();
bool ffb = ff ? ffound.GetCount() : error.GetCount();
menu.Add(ffb, AK_FINDNEXTERROR, THISBACK(FindNextError))
.Help("Find next " + hh + "according to console pane");
menu.Add(ffb, AK_FINDPREVERROR, THISBACK(FindPrevError))

View file

@ -385,29 +385,28 @@ Ide::Ide()
SetupError(error, "Message");
error.AddIndex("NOTES");
error.ColumnWidths("207 41 834");
SetupError(notes, "Note");
SetupError(ffound, "Source");
ffound.ColumnWidths("207 41 834");
ffound.ColumnAt(0).SetDisplay(Single<FoundFileDisplay>());
ffound.ColumnAt(2).SetDisplay(Single<FoundDisplay>());
errors.Horz(error, notes);
error.WhenSel = error.WhenLeftClick = THISBACK(ShowError);
notes.WhenSel = notes.WhenLeftClick = THISBACK(ShowNote);
error.WhenSel = THISBACK(SelError);
error.WhenLeftClick = THISBACK(ShowError);
ffound.WhenSel = ffound.WhenLeftClick = THISBACK(ShowFound);
console.WhenLine = THISBACK(ConsoleLine);
console.WhenRunEnd = THISBACK(ConsoleRunEnd);
addnotes = false;
removing_notes = false;
editor_bottom.Vert(right_split, bottom);
console.WhenBar = THISBACK(ConsoleMenu);
editor_bottom.SetPos(8000);
bottom.SetFrame(btabs);
bottom.Add(console.SizePos().SetFrame(NullFrame()));
bottom.Add(errors.SizePos().SetFrame(NullFrame()));
bottom.Add(error.SizePos().SetFrame(NullFrame()));
bottom.Add(ffound.SizePos().SetFrame(NullFrame()));
bottom.Add(calc.SizePos().SetFrame(NullFrame()));
btabs <<= THISBACK(SyncBottom);