📄 generatormessagesutilities.pas
字号:
F2 := P2.Identifier.InFile
else
F2 := P2.TheFile;
Result := CompareText(F1.InternalFileName, F2.InternalFileName);
if Result = 0 then //files with the same name?
if F1 <> F2 then //same name but different files?
Result := CompareText(F1.FilePath, F2.FilePath) //compare paths
else
begin
//message is for identifiers?
Result := Ord(assigned(P1.Identifier)) - Ord(assigned(P2.Identifier));
if Result = 0 then
if assigned(P1.Identifier) then //both messages for identifiers?
begin //compare them
Result := CompareMembers(P1.Identifier, P2.Identifier, nil, nil);
if Result = 0 then //both are the same?
Result := P1.Identifier.InternalNameIndex - //check for overloaded
P2.Identifier.InternalNameIndex; //functions
end
else
begin //compare position line
Result := P1.Position.Row - P2.Position.Row;
if Result = 0 then //both are in the same line?
Result := P1.Position.Column - P2.Position.Column; //check columns
end;
end;
end;
if Result = 0 then //not in (different) source files?
begin //maybe in user documentation?
Result := Ord(P1.UserDocFile <> '') - Ord(P2.UserDocFile <> '');
if (Result = 0) and (P1.UserDocFile <> '') then //in user documentation?
begin
Result := CompareText(P1.UserDocFile, P2.UserDocFile); //compare files
if Result = 0 then //same files?
Result := CompareText(P1.UserDocPage, P2.UserDocPage); //then pages
end;
end;
if Result = 0 then //should be in help of GUI
begin //maybe in help for GUI?
Result := Ord(P1.GUIPageFile <> '') - Ord(P2.GUIPageFile <> '');
if (Result = 0) and (P1.GUIPageFile <> '') then //in help of GUI?
begin
Result := CompareText(P1.GUIPageFile, P2.GUIPageFile); //compare forms
if Result = 0 then //same forms?
Result := CompareText(P1.GUIPageTopic, P2.GUIPageTopic); //components!
end;
end;
end;
begin
Result := ComparePos(M1.Position, M2.Position); //compare positions
end;
{Compares the kinds of positions of the messages.
~param Message the message whose kind of position should be returned
~result the relation between the kinds of positions, either equal zero, or
less or more }
function CompareMessagePositionKind: Integer;
{Returns the "value" of the kind of position.
~param Position the position whose value should be returned
~return a value for the kind of position }
function GetPositionValue(const Position: TDocumentationPosition): Integer;
begin
if assigned(Position.Identifier) then //at an identifier?
Result := 0 //has the highest kind
else
if assigned(Position.TheFile) then //in a file?
Result := 1 //has the next highest kind
else
if (Position.UserDocPage <> '') or //in user documentation?
(Position.UserDocFile <> '') then
Result := 2
else
if (Position.GUIPageFile <> '') or //in help of a GUI?
(Position.GUIPageTopic <> '') then
Result := 3
else
Result := 4; //no position for message known
end;
begin //compare both kinds of positions
Result := GetPositionValue(M2.Position) - GetPositionValue(M1.Position);
end;
{Compares the source file the message was generated in.
~result the relation between the files, either equal zero, or less or more }
function CompareAnyFile: Integer;
{Returns the name of the file the message was generated in.
~param Message the message to return the name of the file of
~result the name of the file the message was generated in }
function GetName(const Message: TGeneratorMessage): String;
begin
if Assigned(Message.Position.TheFile) then //generated in a file?
Result := Message.Position.TheFile.InternalFileName //return its name
else
if Assigned(Message.Position.Identifier) then //at an identifier?
//return the name of the file the identifier is defined in
Result := Message.Position.Identifier.InFile.InternalFileName;
end;
begin
//message one is defined in a source file?
if Assigned(M1.Position.TheFile) or Assigned(M1.Position.Identifier) then
//message two is also defined in a source file
if Assigned(M2.Position.TheFile) or Assigned(M2.Position.Identifier) then
Result := CompareText(GetName(M1), GetName(M2)) //compare the two files
else
Result := -1 //message two ist less
else
//message two is defined in a source file?
if Assigned(M2.Position.TheFile) or Assigned(M2.Position.Identifier) then
Result := 1 //message two is bigger
else
Result := 0 //both not in file, equal
end;
begin
case Field of //compare the field of the messages
gmfwMessageID:
Result := M1.MessageID - M2.MessageID;
gmfwMessageIDTitle:
Result := CompareText(Descriptions[M1.MessageID].Title,
Descriptions[M2.MessageID].Title);
gmfwMessageNumber:
Result := M1.MessageNumber - M2.MessageNumber;
gmfwMessageNumberText:
Result := CompareText(Descriptions[M1.MessageID][M1.MessageNumber].Text,
Descriptions[M2.MessageID][M2.MessageNumber].
Text);
gmfwMessageNumberHelpText:
Result := CompareText(Descriptions[M1.MessageID][M1.MessageNumber].
HelpText,
Descriptions[M2.MessageID][M2.MessageNumber].
HelpText);
gmfwMessageNumberSeriousness:
Result := Ord(Descriptions[M1.MessageID][M1.MessageNumber].Seriousness)
- Ord(Descriptions[M2.MessageID][M2.MessageNumber].Seriousness);
gmfwMessageText:
Result := CompareText(M1.Message, M2.Message);
gmfwPositionAll:
Result := CompareMessagePosition;
gmfwPositionKind:
Result := CompareMessagePositionKind;
gmfwPositionFile:
if Assigned(M1.Position.TheFile) then
if Assigned(M2.Position.TheFile) then
Result := CompareText(M1.Position.TheFile.InternalFileName,
M2.Position.TheFile.InternalFileName)
else
Result := -1
else
if Assigned(M2.Position.TheFile) then
Result := 1
else
Result := 0;
gmfwPositionRowColumn:
if Assigned(M1.Position.TheFile) and (M1.Position.Position.Row > 0) then
if Assigned(M2.Position.TheFile) and
(M2.Position.Position.Row > 0) then
Result := M1.Position.Position.Row - M2.Position.Position.Row
else
Result := -1
else
if Assigned(M2.Position.TheFile) and
(M2.Position.Position.Row > 0) then
Result := 1
else
Result := 0;
gmfwPositionRow:
if Assigned(M1.Position.TheFile) and (M1.Position.Position.Row > 0) then
if Assigned(M2.Position.TheFile) and
(M2.Position.Position.Row > 0) then
begin
Result := M1.Position.Position.Row - M2.Position.Position.Row;
if Result = 0 then
if M1.Position.Position.Column > 0 then
if M2.Position.Position.Column > 0 then
Result := M1.Position.Position.Row - M2.Position.Position.Row
else
Result := -1
else
if M2.Position.Position.Column > 0 then
Result := 1
else
Result := 0;
end
else
Result := -1
else
if Assigned(M2.Position.TheFile) and
(M2.Position.Position.Row > 0) then
Result := 1
else
Result := 0;
gmfwPositionColumn:
if Assigned(M1.Position.TheFile) and
(M1.Position.Position.Column > 0) then
if Assigned(M2.Position.TheFile) and
(M2.Position.Position.Column > 0) then
Result := M1.Position.Position.Row - M2.Position.Position.Row
else
Result := -1
else
if Assigned(M2.Position.TheFile) and
(M2.Position.Position.Column > 0) then
Result := 1
else
Result := 0;
gmfwPositionIdentifier:
if Assigned(M1.Position.Identifier) then
if Assigned(M2.Position.Identifier) then
Result := CompareText(M1.Position.Identifier.Name,
M2.Position.Identifier.Name)
else
Result := -1
else
if Assigned(M2.Position.Identifier) then
Result := 1
else
Result := 0;
gmfwPositionMemberOf:
if Assigned(M1.Position.Identifier) and
Assigned(M1.Position.Identifier.MemberOf) then
if Assigned(M2.Position.Identifier) and
Assigned(M2.Position.Identifier.MemberOf) then
Result := CompareText(M1.Position.Identifier.MemberOf.Name,
M2.Position.Identifier.MemberOf.Name)
else
Result := -1
else
if Assigned(M2.Position.Identifier) and
Assigned(M2.Position.Identifier.MemberOf) then
Result := 1
else
Result := 0;
gmfwPositionAnyFile:
Result := CompareAnyFile;
gmfwPositionUserDoc:
if (M1.Position.UserDocPage <> '') or
(M1.Position.UserDocFile <> '') then
if (M2.Position.UserDocPage <> '') or
(M2.Position.UserDocFile <> '') then
begin
Result := CompareText(M1.Position.UserDocFile,
M2.Position.UserDocFile);
if Result = 0 then
Result := CompareText(M1.Position.UserDocPage,
M2.Position.UserDocPage);
end
else
Result := -1
else
if (M2.Position.UserDocPage <> '') or
(M2.Position.UserDocFile <> '') then
Result := 1
else
Result := 0;
gmfwPositionUserDocFile:
if (M1.Position.UserDocPage <> '') or
(M1.Position.UserDocFile <> '') then
if (M2.Position.UserDocPage <> '') or
(M2.Position.UserDocFile <> '') then
Result := CompareText(M1.Position.UserDocFile,
M2.Position.UserDocFile)
else
Result := -1
else
if (M2.Position.UserDocPage <> '') or
(M2.Position.UserDocFile <> '') then
Result := 1
else
Result := 0;
gmfwPositionUserDocPage:
if (M1.Position.UserDocPage <> '') or
(M1.Position.UserDocFile <> '') then
if (M2.Position.UserDocPage <> '') or
(M2.Position.UserDocFile <> '') then
Result := CompareText(M1.Position.UserDocPage,
M2.Position.UserDocPage)
else
Result := -1
else
if (M2.Position.UserDocPage <> '') or
(M2.Position.UserDocFile <> '') then
Result := 1
else
Result := 0;
gmfwPositionGUI:
if (M1.Position.GUIPageTopic <> '') or
(M1.Position.GUIPageFile <> '') then
if (M2.Position.GUIPageTopic <> '') or
(M2.Position.GUIPageFile <> '') then
begin
Result := CompareText(M1.Position.GUIPageFile,
M2.Position.GUIPageFile);
if Result = 0 then
Result := CompareText(M1.Position.GUIPageTopic,
M2.Position.GUIPageTopic);
end
else
Result := -1
else
if (M2.Position.GUIPageTopic <> '') or
(M2.Position.GUIPageFile <> '') then
Result := 1
else
Result := 0;
gmfwPositionGUIFile:
if (M1.Position.GUIPageTopic <> '') or
(M1.Position.GUIPageFile <> '') then
if (M2.Position.GUIPageTopic <> '') or
(M2.Position.GUIPageFile <> '') then
Result := CompareText(M1.Position.GUIPageFile,
M2.Position.GUIPageFile)
else
Result := -1
else
if (M2.Position.GUIPageTopic <> '') or
(M2.Position.GUIPageFile <> '') then
Result := 1
else
Result := 0;
gmfwPositionGUITopic:
if (M1.Position.GUIPageTopic <> '') or
(M1.Position.GUIPageFile <> '') then
if (M2.Position.GUIPageTopic <> '') or
(M2.Position.GUIPageFile <> '') then
Result := CompareText(M1.Position.GUIPageTopic,
M2.Position.GUIPageTopic)
else
Result := -1
else
if (M2.Position.GUIPageTopic <> '') or
(M2.Position.GUIPageFile <> '') then
Result := 1
else
Result := 0;
else
Assert(False);
Result := 0;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -