123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675 |
- MODULE WMDiagnostics; (** AUTHOR "staubesv"; PURPOSE "Visual Component for Diagnostics Interface"; *)
- IMPORT
- Locks, Strings, Diagnostics, Files, Streams,
- WMRectangles, WMGraphics, WMGraphicUtilities, WMBitmapFont,
- WMEvents, WMProperties, WMGrids, WMTextView;
- CONST
- TypeInformation* = Diagnostics.TypeInformation;
- TypeWarning* = Diagnostics.TypeWarning;
- TypeError* = Diagnostics.TypeError;
- (* Error grid colors *)
- ColorError = LONGINT(0FF3030A0H);
- ColorWarning = LONGINT(0D0D040C0H);
- ColorPCPosition = 0007F00A0H;
- (* Textview position marker pictures *)
- PictureError = "PETIcons.tar://errorpos.png";
- PictureWarning = "PETIcons.tar://warningpos.png";
- PicturePCPosition = "PETIcons.tar://pcpos.png";
- InitialArraySize = 16;
- Less = -1;
- Equal = 0;
- Greater = 1;
- SortByTypeAscending* = 0;
- SortByTypeDescending* = 1;
- SortByPositionAscending* = 2;
- SortByPositionDescending* = 3;
- TYPE
- Entry* = RECORD
- type- : LONGINT;
- source- : Files.FileName;
- position-: Streams.Position;
- message- : ARRAY 256 OF CHAR;
- END;
- EntryArray = POINTER TO ARRAY OF Entry;
- TYPE
- Model* = OBJECT(Diagnostics.Diagnostics)
- VAR
- entries : EntryArray;
- nofEntries- : LONGINT;
- nofInformations: LONGINT;
- nofWarnings : LONGINT;
- nofErrors : LONGINT;
- lock : Locks.RWLock;
- onChanged- : WMEvents.EventSource;
- changed : BOOLEAN;
- notificationEnabled : BOOLEAN;
- PROCEDURE &Init*; (** proctected *)
- BEGIN
- entries := NIL;
- nofEntries := 0;
- nofErrors := 0; nofWarnings := 0; nofInformations := 0;
- NEW(lock);
- NEW(onChanged, NIL, NIL, NIL, NIL);
- changed := FALSE;
- notificationEnabled := TRUE;
- END Init;
- (** Inform views about updates *)
- PROCEDURE EnableNotification*;
- BEGIN
- AcquireWrite;
- notificationEnabled := TRUE;
- ReleaseWrite;
- END EnableNotification;
- (** Don't inform views about updates *)
- PROCEDURE DisableNotification*;
- BEGIN
- AcquireWrite;
- notificationEnabled := FALSE;
- ReleaseWrite;
- END DisableNotification;
- (** Acquire read lock. *)
- PROCEDURE AcquireRead*;
- BEGIN
- lock.AcquireRead;
- END AcquireRead;
- (** Release read lock *)
- PROCEDURE ReleaseRead*;
- BEGIN
- lock.ReleaseRead;
- END ReleaseRead;
- (** Acquire write lock *)
- PROCEDURE AcquireWrite*;
- BEGIN
- lock.AcquireWrite;
- END AcquireWrite;
- (** Release write lock. If the data has changed, all listeners will be notified when the last
- writer releases its lock *)
- PROCEDURE ReleaseWrite*;
- VAR notifyListeners : BOOLEAN;
- BEGIN
- (* If the last writer releases the lock and the model data has changed, we have to notify interested listeners *)
- notifyListeners := notificationEnabled & (lock.GetWLockLevel() = 1) & changed;
- IF notificationEnabled THEN changed := FALSE; END;
- lock.ReleaseWrite;
- IF notifyListeners THEN
- onChanged.Call(SELF);
- END;
- END ReleaseWrite;
- (** Dispose all entries *)
- PROCEDURE Clear*;
- BEGIN
- AcquireWrite;
- changed := changed OR (entries # NIL) OR (nofEntries # 0) OR (nofErrors # 0) OR (nofWarnings # 0) OR (nofInformations # 0);
- entries := NIL;
- nofEntries := 0;
- nofErrors := 0; nofWarnings := 0; nofInformations := 0;
- ReleaseWrite;
- END Clear;
- (* Make sure that <entries> cannot hold at least one more entry *)
- PROCEDURE CheckEntriesSize;
- VAR newEntries : EntryArray; i : LONGINT;
- BEGIN
- ASSERT(lock.HasWriteLock());
- IF (entries = NIL) THEN
- NEW(entries, InitialArraySize);
- ELSIF (nofEntries >= LEN(entries)) THEN
- NEW(newEntries, 2 * LEN(entries));
- FOR i := 0 TO nofEntries - 1 DO
- newEntries[i] := entries[i];
- END;
- entries := newEntries;
- END;
- END CheckEntriesSize;
- PROCEDURE Error*(CONST source : ARRAY OF CHAR; position : Streams.Position; CONST message : ARRAY OF CHAR);
- BEGIN
- Add(TypeError, source, position, message, nofErrors)
- END Error;
- PROCEDURE Warning*(CONST source : ARRAY OF CHAR; position : Streams.Position; CONST message : ARRAY OF CHAR);
- BEGIN
- Add(TypeWarning, source, position, message, nofWarnings);
- END Warning;
- PROCEDURE Information*(CONST source : ARRAY OF CHAR; position : Streams.Position; CONST message : ARRAY OF CHAR);
- BEGIN
- Add(TypeInformation, source, position, message, nofInformations);
- END Information;
- PROCEDURE Exists(type: WORD; position : Streams.Position; CONST message: ARRAY OF CHAR) : BOOLEAN;
- VAR i : LONGINT;
- BEGIN
- i := 0;
- WHILE (i < nofEntries) & ((entries[i].type # type) OR (entries[i].position # position) OR (entries[i].message # message)) DO
- INC(i);
- END;
- RETURN (nofEntries > 0) & (i < nofEntries);
- END Exists;
- PROCEDURE Add(type: WORD; CONST source : ARRAY OF CHAR; position : Streams.Position; CONST message : ARRAY OF CHAR; VAR counter: LONGINT);
- BEGIN
- AcquireWrite;
- IF ~Exists(type, position, message) THEN
- CheckEntriesSize;
- entries[nofEntries].type := type;
- COPY(source, entries[nofEntries].source);
- entries[nofEntries].position := position;
- COPY(message, entries[nofEntries].message);
- INC(nofEntries); INC(counter);
- changed := TRUE;
- END;
- ReleaseWrite;
- END Add;
- (* Returns a string summarizing the number of errors and warnings *)
- PROCEDURE GetSummary(VAR summary : ARRAY OF CHAR);
- VAR nbr : ARRAY 8 OF CHAR;
- BEGIN
- AcquireRead;
- summary := "";
- IF (nofErrors > 0) THEN
- Strings.IntToStr(nofErrors, nbr); Strings.Append(summary, nbr);
- Strings.Append(summary, " error");
- IF (nofErrors > 1) THEN
- Strings.Append(summary, "s");
- END;
- ELSE
- summary := "no errors";
- END;
- IF (nofWarnings > 0) THEN
- Strings.Append(summary, ", "); Strings.IntToStr(nofWarnings, nbr);
- Strings.Append(summary, nbr);
- Strings.Append(summary, " warning");
- IF (nofWarnings > 1) THEN
- Strings.Append(summary, "s");
- END;
- END;
- ReleaseRead;
- END GetSummary;
- PROCEDURE Synchronize(VAR entries : ViewEntryArray; VAR nofEntries : LONGINT);
- VAR dest : LONGINT;
- PROCEDURE Insert(type: LONGINT);
- VAR i: LONGINT;
- BEGIN
- FOR i := 0 TO nofEntries - 1 DO
- IF SELF.entries[i].type = type THEN
- entries[dest].type := SELF.entries[i].type;
- entries[dest].position := SELF.entries[i].position;
- entries[dest].source := SELF.entries[i].source;
- entries[dest].message := SELF.entries[i].message;
- INC(dest);
- END;
- END;
- END Insert;
- BEGIN
- AcquireRead;
- IF (SELF.entries = NIL) THEN
- nofEntries := 0;
- ELSE
- IF (entries = NIL) OR (LEN(SELF.entries) > LEN(entries)) THEN NEW(entries, LEN(SELF.entries)); END;
- nofEntries := SELF.nofEntries;
- Insert(Diagnostics.TypeError);
- Insert(Diagnostics.TypeWarning);
- Insert(Diagnostics.TypeInformation);
- END;
- ReleaseRead;
- END Synchronize;
- END Model;
- TYPE
- CompareProcedure = PROCEDURE(CONST entry1, entry2 : Entry) : LONGINT;
- ViewEntry* = RECORD (Entry)
- pos- : POINTER TO ARRAY OF WMTextView.PositionMarker;
- END;
- ViewEntryArray = POINTER TO ARRAY OF ViewEntry;
- CellInfo* = OBJECT(WMGrids.CellPositionInfo)
- VAR
- entryValid- : BOOLEAN;
- entry- : ViewEntry;
- PROCEDURE &Init(entryValid : BOOLEAN; CONST entry : ViewEntry; column, row : LONGINT);
- BEGIN
- SELF.entryValid := entryValid;
- SELF.entry := entry;
- pos.col := column;
- pos.row := row;
- END Init;
- END CellInfo;
- TYPE
- DiagnosticsView* = OBJECT(WMGrids.GenericGrid)
- VAR
- showMarkers- : WMProperties.BooleanProperty;
- showMarkersI : BOOLEAN;
- sortBy- : WMProperties.Int32Property;
- sortByI : LONGINT;
- entries : ViewEntryArray;
- nofEntries : LONGINT;
- model : Model;
- textViews : POINTER TO ARRAY OF WMTextView.TextView;
- summary : ARRAY 256 OF CHAR;
- PROCEDURE &Init*;
- BEGIN
- Init^;
- SetNameAsString(StrDiagnosticsView);
- SetDrawCellProc(DrawCell);
- NEW(showMarkers, PrototypeShowMarkers, NIL, NIL); properties.Add(showMarkers);
- showMarkersI := showMarkers.Get();
- NEW(sortBy, PrototypeSortBy, NIL, NIL); properties.Add(sortBy);
- sortByI := sortBy.Get();
- entries := NIL;
- nofEntries := 0;
- model := NIL;
- textViews := NIL;
- summary := "";
- nofCols.Set(3);
- nofRows.Set(1);
- onClick.Add(OnClickHandler);
- END Init;
- PROCEDURE PropertyChanged*(sender, property : ANY);
- BEGIN
- IF (property = showMarkers) THEN
- ShowMarkers(showMarkers.Get());
- ELSIF (property = sortBy) THEN
- SortBy(sortBy.Get());
- ELSE
- PropertyChanged^(sender, property);
- END
- END PropertyChanged;
- PROCEDURE RecacheProperties*;
- BEGIN
- RecacheProperties^;
- ShowMarkers(showMarkers.Get());
- SortBy(sortBy.Get());
- END RecacheProperties;
- PROCEDURE OnClickHandler(sender, data : ANY);
- CONST Position = 0;
- VAR column, row, newMode : LONGINT;
- BEGIN
- IF ~IsCallFromSequencer() THEN sequencer.ScheduleEvent(SELF.OnClickHandler, sender, data)
- ELSE
- IF (data # NIL) & (data IS CellInfo) & ~(data(CellInfo).entryValid) THEN
- column := data(CellInfo).pos.col;
- row := data(CellInfo).pos.row;
- IF (row = 0) THEN
- CASE sortByI OF
- |SortByTypeAscending:
- IF (column = Position) THEN
- newMode := SortByTypeDescending;
- END;
- |SortByTypeDescending:
- IF (column = Position) THEN
- newMode := SortByTypeAscending;
- END;
- |SortByPositionAscending:
- IF (column = Position) THEN
- newMode := SortByPositionDescending;
- END;
- |SortByPositionDescending:
- IF (column = Position) THEN
- newMode := SortByPositionAscending;
- END;
- ELSE
- newMode := sortByI; (* don't change *)
- END;
- sortBy.Set(newMode);
- END;
- END;
- END;
- END OnClickHandler;
- PROCEDURE ShowMarkers(enable : BOOLEAN);
- VAR i, j : LONGINT;
- BEGIN
- Acquire;
- IF (enable # showMarkersI) THEN
- showMarkersI := enable;
- IF (textViews # NIL) THEN
- FOR i := 0 TO nofEntries - 1 DO
- FOR j := 0 TO LEN(textViews) - 1 DO
- IF (entries[i].pos[j] # NIL) THEN
- entries[i].pos[j].SetVisible(showMarkersI);
- END;
- END;
- END;
- END;
- Invalidate;
- END;
- Release;
- END ShowMarkers;
- PROCEDURE SortBy(mode : LONGINT);
- BEGIN
- ASSERT(
- (mode = SortByTypeAscending) OR (mode = SortByTypeDescending) OR
- (mode = SortByPositionAscending) OR (mode = SortByPositionDescending)
- );
- Acquire;
- IF (mode # sortByI) THEN
- sortByI := mode;
- CASE sortByI OF
- |SortByTypeAscending: SortEntries(CompareByType, TRUE);
- |SortByTypeDescending: SortEntries(CompareByType, FALSE);
- |SortByPositionAscending: SortEntries(CompareByPosition, TRUE);
- |SortByPositionDescending: SortEntries(CompareByPosition, FALSE);
- END;
- Invalidate;
- END;
- Release;
- END SortBy;
- PROCEDURE GetCellData*(column, row : LONGINT) : ANY; (* override *)
- VAR info : CellInfo; entryValid : BOOLEAN; entry : ViewEntry;
- BEGIN
- Acquire;
- IF (0 <= row - 1) & (row - 1 < nofEntries) THEN
- entryValid := TRUE;
- entry := entries[row - 1];
- ELSE
- entryValid := FALSE;
- END;
- NEW(info, entryValid, entry, column, row);
- Release;
- RETURN info;
- END GetCellData;
- PROCEDURE AddPositionMarkers;
- VAR picture : Files.FileName; i, j : LONGINT;
- BEGIN (* caller holds lock *)
- IF (textViews # NIL) THEN
- FOR i := 0 TO nofEntries - 1 DO
- IF (entries[i].type = Diagnostics.TypeError) THEN
- picture := PictureError;
- ELSIF (entries[i].type = Diagnostics.TypeWarning) THEN
- picture := PictureWarning;
- ELSE
- picture := "";
- END;
- IF (entries[i].position # Streams.Invalid) & (textViews # NIL) THEN
- NEW(entries[i].pos, LEN(textViews));
- FOR j := 0 TO LEN(textViews) - 1 DO
- entries[i].pos[j] := textViews[j].CreatePositionMarker();
- IF (picture # "") THEN entries[i].pos[j].Load(picture); END;
- entries[i].pos[j].SetPosition(entries[i].position);
- END;
- END;
- END;
- END;
- END AddPositionMarkers;
- PROCEDURE RemovePositionMarkers;
- VAR i, j : LONGINT;
- BEGIN (* caller holds lock *)
- IF (textViews # NIL) THEN
- FOR i := 0 TO nofEntries-1 DO
- FOR j := 0 TO LEN(textViews)-1 DO
- IF (entries[i].pos # NIL) & (entries[i].pos[j] # NIL) THEN
- textViews[j].RemovePositionMarker(entries[i].pos[j]);
- entries[i].pos[j] := NIL;
- END;
- END;
- END;
- END;
- END RemovePositionMarkers;
- PROCEDURE GetFirstPosition*(VAR positions : ARRAY OF LONGINT; VAR type: LONGINT);
- VAR i : LONGINT;
- BEGIN
- Acquire;
- ASSERT((textViews # NIL) & (LEN(textViews) = LEN(positions)));
- IF (nofEntries > 0) THEN
- FOR i := 0 TO LEN(textViews)-1 DO
- IF (entries[0].pos # NIL) & (entries[0].pos[i] # NIL) THEN
- positions[i] := entries[0].pos[i].GetPosition();
- ELSE
- positions[i] := Streams.Invalid;
- END;
- type := entries[0].type;
- END;
- ELSE
- FOR i := 0 TO LEN(positions)-1 DO positions[i] := Streams.Invalid; END;
- END;
- Release;
- END GetFirstPosition;
- PROCEDURE GetNearestPosition*(cursorPosition, editorIndex : LONGINT; forward : BOOLEAN; VAR nearestPosition : LONGINT; VAR number : LONGINT);
- VAR pos, i : LONGINT;
- BEGIN
- Acquire;
- ASSERT((textViews # NIL) & (0 <= editorIndex) & (editorIndex < LEN(textViews)));
- nearestPosition := -1; number := 1; (* row 0 is grid title *)
- i := 0;
- LOOP
- IF (i >= nofEntries) OR (entries[i].pos = NIL) OR (entries[i].pos[editorIndex] = NIL) THEN EXIT; END;
- pos := entries[i].pos[editorIndex].GetPosition();
- IF forward & (pos > cursorPosition) THEN
- IF (nearestPosition = -1) OR (pos < nearestPosition) THEN nearestPosition := pos; number := i+1; END;
- ELSIF ~forward & (pos < cursorPosition) THEN
- IF (nearestPosition = -1) OR (pos > nearestPosition) THEN nearestPosition := pos; number := i+1; END;
- END;
- INC(i);
- END;
- IF (nearestPosition = -1) THEN
- nearestPosition := cursorPosition;
- IF forward & (i > 1) THEN (* select maximum row *) number := i; END;
- END;
- Release;
- END GetNearestPosition;
- PROCEDURE SelectEntry*(number : LONGINT; moveTo : BOOLEAN);
- BEGIN
- Acquire;
- IF (0 <= number) & (number <= nofEntries) THEN
- SetSelection(0, number, 2, number);
- IF moveTo THEN
- SetTopPosition(0, number, TRUE);
- END;
- END;
- Release;
- END SelectEntry;
- PROCEDURE SortEntries(compare : CompareProcedure; ascending : BOOLEAN);
- VAR result, i, j : LONGINT; temp : ViewEntry;
- BEGIN
- (* caller must hold lock *)
- ASSERT(compare # NIL);
- IF (nofEntries > 1) THEN
- (* bubble sort *)
- FOR i := 0 TO nofEntries - 1 DO
- FOR j := 1 TO nofEntries - 1 DO
- result := compare(entries[j-1], entries[j]);
- IF (ascending & (result = Greater)) OR (~ascending & (result = Less)) THEN
- temp := entries[j - 1];
- entries[j - 1] := entries[j];
- entries[j] := temp;
- END;
- END;
- END;
- END;
- END SortEntries;
- PROCEDURE SetTextViews*(CONST textViews : ARRAY OF WMTextView.TextView);
- VAR i : LONGINT;
- BEGIN
- Acquire;
- RemovePositionMarkers;
- NEW(SELF.textViews, LEN(textViews));
- FOR i := 0 TO LEN(textViews)-1 DO
- ASSERT(textViews[i] # NIL);
- SELF.textViews[i]:= textViews[i];
- END;
- AddPositionMarkers;
- Release;
- END SetTextViews;
- PROCEDURE SetModel*(model : Model);
- BEGIN
- Acquire;
- IF (SELF.model # NIL) THEN SELF.model.onChanged.Remove(ModelChanged); END;
- SELF.model := model;
- IF (SELF.model # NIL) THEN SELF.model.onChanged.Add(ModelChanged); END;
- Release;
- Invalidate;
- END SetModel;
- PROCEDURE ModelChanged(sender, data : ANY);
- BEGIN
- IF ~IsCallFromSequencer() THEN sequencer.ScheduleEvent(SELF.ModelChanged, sender, data);
- ELSE
- RemovePositionMarkers;
- model.AcquireRead;
- model.Synchronize(entries, nofEntries);
- model.GetSummary(summary);
- model.ReleaseRead;
- nofRows.Set(nofEntries + 1); (* 1 for title row *)
- AddPositionMarkers;
- SetTopPosition(0, 0, TRUE);
- Invalidate;
- END;
- END ModelChanged;
- PROCEDURE DrawCell(canvas : WMGraphics.Canvas; w, h : LONGINT; state : SET; x, y : LONGINT);
- VAR color: LONGINT; str : ARRAY 128 OF CHAR;
- BEGIN
- color := WMGraphics.RGBAToColor(255, 255, 255, 255);
- IF state * {WMGrids.CellFixed, WMGrids.CellSelected} = {WMGrids.CellFixed, WMGrids.CellSelected} THEN
- color := WMGraphics.RGBAToColor(0, 128, 255, 255)
- ELSIF WMGrids.CellFixed IN state THEN
- color := WMGraphics.RGBAToColor(196, 196, 196, 255)
- ELSIF WMGrids.CellSelected IN state THEN
- color := WMGraphics.RGBAToColor(196, 196, 255, 255)
- END;
- canvas.SetColor(WMGraphics.RGBAToColor(0, 0, 0, 255));
- canvas.SetFont(WMBitmapFont.bimbofont);
- canvas.Fill(WMRectangles.MakeRect(0, 0, w, h), color, WMGraphics.ModeCopy);
- IF (WMGrids.CellFocused IN state) & ~(WMGrids.CellHighlighted IN state) THEN
- WMGraphicUtilities.DrawBevel(canvas, WMRectangles.MakeRect(0, 0, w, h), 1, TRUE, WMGraphics.RGBAToColor(0, 0, 0, 196),
- WMGraphics.ModeSrcOverDst)
- END;
- IF y = 0 THEN
- CASE x OF
- | 0 : str := "pos"
- | 1 : str := "err"
- | 2 :
- str := "Error Str";
- Strings.Append(str, " ("); Strings.Append(str, summary); Strings.Append(str, ")");
- ELSE
- END;
- canvas.DrawString(4, h - 4, str);
- ELSIF (0 <= y - 1) & (y - 1 < nofEntries) THEN
- CASE x OF
- | 0 :
- IF (entries[y - 1].pos # NIL) & (entries[y - 1].pos[0] # NIL) THEN Strings.IntToStr(entries[y - 1].pos[0].GetPosition(), str) END;
- IF entries[y - 1].type = TypeError THEN
- canvas.Fill(WMRectangles.MakeRect(0, 0, w, h), ColorError, WMGraphics.ModeSrcOverDst);
- ELSIF entries[y - 1].type = TypeWarning THEN
- canvas.Fill(WMRectangles.MakeRect(0, 0, w, h), ColorWarning, WMGraphics.ModeSrcOverDst);
- ELSIF entries[y - 1].type = TypeInformation THEN
- canvas.Fill(WMRectangles.MakeRect(0, 0, w, h), ColorPCPosition, WMGraphics.ModeSrcOverDst);
- ELSIF entries[y - 1].type = TypeInformation THEN
- (* do nothing *)
- END;
- | 2 : COPY(entries[y - 1].message, str)
- ELSE
- END;
- canvas.DrawString(4, h - 4, str);
- END;
- END DrawCell;
- END DiagnosticsView;
- VAR
- StrDiagnosticsView : Strings.String;
- PrototypeShowMarkers : WMProperties.BooleanProperty;
- PrototypeSortBy : WMProperties.Int32Property;
- PROCEDURE CompareByPosition(CONST e1, e2 : Entry) : LONGINT;
- VAR result : LONGINT;
- BEGIN
- IF (e1.position < e2.position) THEN result := Less;
- ELSIF (e1.position > e2.position) THEN result := Greater;
- ELSE
- result := Equal;
- END;
- RETURN result;
- END CompareByPosition;
- PROCEDURE CompareByType(CONST e1, e2 : Entry) : LONGINT;
- VAR result : LONGINT;
- BEGIN
- IF (e1.type < e2.type) THEN result := Less;
- ELSIF (e1.type > e2.type) THEN result := Greater;
- ELSE
- result := CompareByPosition(e1, e2);
- END;
- RETURN result;
- END CompareByType;
- PROCEDURE InitStrings;
- BEGIN
- StrDiagnosticsView := Strings.NewString("DiagnosticsView");
- END InitStrings;
- PROCEDURE InitPrototypes;
- BEGIN
- NEW(PrototypeShowMarkers, NIL, Strings.NewString("ShowMarkers"), Strings.NewString("Highlight errors in TextView?"));
- PrototypeShowMarkers.Set(TRUE);
- NEW(PrototypeSortBy, NIL, Strings.NewString("SortBy"), Strings.NewString("Sort grid by 0=type | 1=position | 2=errorCode"));
- PrototypeSortBy.Set(SortByTypeDescending);
- END InitPrototypes;
- BEGIN
- InitStrings;
- InitPrototypes;
- END WMDiagnostics.
|