Index: CodeEditor/CodeEditor.cpp =================================================================== --- CodeEditor/CodeEditor.cpp (revision 57) +++ CodeEditor/CodeEditor.cpp (working copy) @@ -14,6 +14,11 @@ for(int i = 0; i < 4; i++) if(scache[i].line >= line) scache[i].Clear(); + if (checkEdited) { + bar.ClearErrors(line); + bar.SetEdited(line, 1); + bar.Refresh(); + } } inline bool IsComment(int a, int b) { @@ -67,6 +72,8 @@ void CodeEditor::InsertLines(int line, int count) { bar.InsertLines(line, count); + for (int i = 0; i < count; i++) + bar.SetEdited(line + i, 1); } void CodeEditor::RemoveLines(int line, int count) { Index: CodeEditor/CodeEditor.h =================================================================== --- CodeEditor/CodeEditor.h (revision 57) +++ CodeEditor/CodeEditor.h (working copy) @@ -21,6 +21,10 @@ int lineno; String breakpoint; int count; + int error; + int edited; + + LineInfoRecord() { error = 0; edited = 0; } }; typedef Array LineInfo; @@ -43,8 +47,10 @@ struct LnInfo : Moveable { int lineno; String breakpoint; + int error; + int edited; - LnInfo() { lineno = -1; } + LnInfo() { lineno = -1; error = 0; edited = 0; } }; Vector li; int sy; @@ -74,6 +80,10 @@ String GetBreakpoint(int ln); void SetBreakpoint(int ln, const String& s); + void SetEdited(int ln, int edit); + void SetError(int ln, int err); + void ClearErrors(int ln); + void SetEditor(CodeEditor *e) { editor = e; } LineInfo GetLineInfo() const; @@ -118,6 +128,7 @@ virtual void LeftDouble(Point p, dword keyflags); virtual void MouseMove(Point p, dword keyflags); virtual void Serialize(Stream& s); + void CheckEdited(bool e = true) { checkEdited = e; } protected: virtual void HighlightLine(int line, Vector& h, int pos); @@ -212,7 +223,9 @@ Time last_key_time; bool auto_enclose; - + + bool checkEdited; + struct FindReplace : WithIDEFindReplaceLayout { WString itext; virtual bool Key(dword key, int count); @@ -390,6 +403,8 @@ void HidePtr() { bar.HidePtr(); } String GetBreakpoint(int line) { return bar.GetBreakpoint(line); } void SetBreakpoint(int line, const String& b) { bar.SetBreakpoint(line, b); } + void SetError(int line, int err) { bar.SetError(line, err); } + void ClearErrors(int line = -1) { bar.ClearErrors(line); } void GotoLine(int line); void EnableBreakpointing() { bar.EnableBreakpointing(true); } void DisableBreakpointing() { bar.EnableBreakpointing(false); } Index: CodeEditor/EditorBar.cpp =================================================================== --- CodeEditor/EditorBar.cpp (revision 57) +++ CodeEditor/EditorBar.cpp (working copy) @@ -3,6 +3,7 @@ NAMESPACE_UPP void Renumber(LineInfo& lf) { + LineInfo tf; int l = 0; if(lf.GetCount()) { @@ -10,15 +11,20 @@ t.breakpoint = lf[0].breakpoint; t.lineno = 0; t.count = lf[0].count; + t.error = lf[0].error; + t.edited = lf[0].edited; l += t.count; } for(int i = 1; i < lf.GetCount(); i++) { LineInfoRecord& r = lf[i]; - if(r.breakpoint.IsEmpty() && tf.Top().breakpoint.IsEmpty()) + if(r.breakpoint.IsEmpty() && r.error == 0 && r.edited == 0 && + tf.Top().breakpoint.IsEmpty() && tf.Top().error == 0 && tf.Top().edited == 0) tf.Top().count += r.count; else { LineInfoRecord& t = tf.Add(); t.breakpoint = r.breakpoint; + t.error = r.error; + t.edited = r.edited; t.count = r.count; t.lineno = l; } @@ -64,9 +70,13 @@ previf <<= editor->ScanSyntax(i).ifstack; while(y < cy) { String b; + int err = 0; + int edit = 0; if(i < li.GetCount()) { const LnInfo& l = li[i]; - b = li[i].breakpoint; + b = l.breakpoint; + err = l.error; + edit = l.edited; if(l.lineno >= 0) lno = l.lineno; } @@ -111,6 +121,14 @@ previf = nextif; } + if(edit > 0) { + int width = CodeEditorImg::Breakpoint().GetWidth() >> 1; + w.DrawRect(0, y, width, fy, LtBlue); + } + if(err > 0) { + int width = CodeEditorImg::Breakpoint().GetWidth() >> 1; + w.DrawRect(width, y, width, fy, err == 1 ? LtRed : Color(255, 175, 0)); + } if(!b.IsEmpty()) sPaintImage(w, y, fy, b == "1" ? CodeEditorImg::Breakpoint() : b == "\xe" ? CodeEditorImg::InvalidBreakpoint() : @@ -182,11 +200,13 @@ int l = -2; for(int i = 0; i < li.GetCount(); i++) { const LnInfo& ln = li[i]; - if(!ln.breakpoint.IsEmpty()) { + if(!ln.breakpoint.IsEmpty() || ln.error || ln.edited) { LineInfoRecord& r = lf.Add(); r.lineno = ln.lineno; r.count = 1; r.breakpoint = ln.breakpoint; + r.error = ln.error; + r.edited = ln.edited; l = -2; } else @@ -216,6 +236,8 @@ LnInfo& ln = li.Add(); ln.lineno = l; ln.breakpoint = r.breakpoint; + ln.error = r.error; + ln.edited = r.edited; if(l >= 0) l++; } } @@ -252,9 +274,28 @@ void EditorBar::SetBreakpoint(int ln, const String& s) { li.At(ln).breakpoint = s; - WhenBreakpoint(ln); + WhenBreakpoint(ln); } +void EditorBar::SetEdited(int ln, int edit) +{ + li.At(ln).edited = edit; +} + +void EditorBar::SetError(int ln, int err) +{ + li.At(ln).error = err; +} + +void EditorBar::ClearErrors(int line) +{ + for (int i = 0; i < li.GetCount(); i++) { + if (li[i].error && (line < 0 || li[i].lineno == line)) { + li[i].error = 0; + } + } +} + int EditorBar::GetLineNo(int lineno) const { for(int i = 0; i < li.GetCount(); i++) { if(lineno <= li[i].lineno) Index: ide/Build.cpp =================================================================== --- ide/Build.cpp (revision 57) +++ ide/Build.cpp (working copy) @@ -525,6 +525,7 @@ bool Ide::Build(const Workspace& wspc, String mainparam, String outfile, bool clear_console) { + ClearErrorEditor(); BeginBuilding(true, clear_console); bool ok = true; if(wspc.GetCount()) { @@ -576,6 +577,7 @@ } EndBuilding(ok); ReQualifyBrowserBase(); + SetErrorEditor(); return ok; } @@ -687,6 +689,7 @@ { if(editfile.IsEmpty()) return; + ClearErrorEditor(editfile); SwitchHeader(); BeginBuilding(); const Workspace& wspc = IdeWorkspace(); @@ -700,6 +703,7 @@ } onefile.Clear(); EndBuilding(ok); + SetErrorEditor(); } void Ide::Preprocess() { Index: ide/ide.cpp =================================================================== --- ide/ide.cpp (revision 57) +++ ide/ide.cpp (working copy) @@ -314,12 +314,30 @@ } bool Ide::FindLineError(int l, Host& host) { + String file; + int lineno; + int error; + if (FindLineError(console.GetUtf8Line(l), host, file, lineno, error)) { + file = NormalizePath(file); + editastext.FindAdd(file); + EditFile(file); + editor.SetCursor(editor.GetPos(editor.GetLineNo(lineno - 1))); + editor.CenterCursor(); + editor.SetFocus(); + Sync(); + console.SetSelection(console.GetPos(l), console.GetPos(l + 1)); + ShowConsole(); + return true; + } + return false; +} + +bool Ide::FindLineError(String ln, Host& host, String &file, int &lineno, int &error) { Vector wspc_paths; VectorMap bm = GetMethodVars(method); bool is_java = (bm.Get("BUILDER", Null) == "JDK"); - String ln = console.GetUtf8Line(l); - String file; const char *s = ln; + error = ln.Find("arning", 0) > 0 ? 2 : 1; while(*s == ' ' || *s == '\t') s++; for(; *s; s++) { @@ -365,7 +383,7 @@ if(IsFullPath(file) && FileExists(file) && IsTextFile(file)) { while(*s && !IsDigit(*s)) s++; - int lineno = 0; + lineno = 0; if(IsDigit(*s)) lineno = stou(s); Vector conf = SplitFlags(mainconfigparam, true); @@ -424,15 +442,6 @@ } } if(lineno > 0) { - file = NormalizePath(file); - editastext.FindAdd(file); - EditFile(file); - editor.SetCursor(editor.GetPos(editor.GetLineNo(lineno - 1))); - editor.CenterCursor(); - editor.SetFocus(); - Sync(); - console.SetSelection(console.GetPos(l), console.GetPos(l + 1)); - ShowConsole(); return true; } } @@ -468,6 +477,55 @@ if(FindLineError(l, *host)) return; } +void Ide::ClearErrorEditor() +{ + for (int i = 0; i < filedata.GetCount(); i++) { + ClearErrorEditor(filedata.GetKey(i)); + } +} + +void Ide::ClearErrorEditor(String file) +{ + if (file == editfile) + editor.ClearErrors(); + else { + LineInfo li = editor.GetLineInfo(); + FileData& fd = Filedata(file); + editor.SetLineInfo(fd.lineinfo); + editor.ClearErrors(); + fd.lineinfo = editor.GetLineInfo(); + editor.SetLineInfo(li); + } +} + +void Ide::SetErrorEditor() +{ + bool refresh = false; + String file; + int lineno; + int error; + One host = CreateHost(false); + for (int i = 0; i < console.GetLineCount(); i++) { + if (FindLineError(console.GetUtf8Line(i), *host, file, lineno, error)) { + if (editfile == file) { + editor.SetError(lineno - 1, error); + refresh = true; + } + else + { + LineInfo li = editor.GetLineInfo(); + FileData& fd = Filedata(file); + editor.SetLineInfo(fd.lineinfo); + editor.SetError(lineno - 1, error); + fd.lineinfo = editor.GetLineInfo(); + editor.SetLineInfo(li); + } + } + } + if (refresh) + editor.RefreshFrame(); +} + void Ide::Renumber() { for(int i = 0; i < filedata.GetCount(); i++) ::Renumber(filedata[i].lineinfo); Index: ide/ide.h =================================================================== --- ide/ide.h (revision 57) +++ ide/ide.h (working copy) @@ -900,8 +900,13 @@ void Renumber(); bool FindLineError(int l, Host& host); + bool FindLineError(String ln, Host& host, String& file, int& lineno, int& error); void FindError(); + void ClearErrorEditor(); + void ClearErrorEditor(String file); + void SetErrorEditor(); + void FindWildcard(); void FindFolder(); void FindSetStdDir(String n); Index: ide/idefile.cpp =================================================================== --- ide/idefile.cpp (revision 57) +++ ide/idefile.cpp (working copy) @@ -344,6 +344,7 @@ } void Ide::EditFile0(const String& path, byte charset, bool astext, const String& headername) { + editor.CheckEdited(false); editor.CloseAssist(); if(path.IsEmpty()) return; FlushFile(); @@ -420,6 +421,7 @@ PosSync(); SetBar(); editor.assist_active = IsProjectFile(editfile) && (IsCSourceFile(editfile) || IsCHeaderFile(editfile)); + editor.CheckEdited(true); } void Ide::EditAsText()