📄 umfunknownidents.pas
字号:
{ JADD - Just Another DelphiDoc: Documentation from Delphi Source Code
Copyright (C) 2002-2008 Gerold Veith
This file is part of JADD - Just Another DelphiDoc.
DelphiDoc is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
DelphiDoc is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
}
unit UMFUnknownIdents;
{Contains a page to show the unknown identifiers in the parsed files. }
interface
uses Classes, Forms, Controls, StdCtrls, ExtCtrls,
UMainFormFrame,
UJADDState;
type
{A page to show the unknown identifiers in the parsed files. }
TMFUnknownIdents = class(TMainFormFrame)
CheckBoxTypes: TCheckBox;
ComboBoxFile: TComboBox;
MemoUnknownIdents: TMemo;
procedure ComboBoxFileTypesChange(Sender: TObject);
private
protected
//Called when the list of parsed file changes.
procedure StateFileListChanged(State: TJADDState); override;
public
end;
implementation
{$R *.dfm}
uses SysUtils,
UBaseIdents;
{Called when the list of parsed file changes.
~param State the state that has been changed }
procedure TMFUnknownIdents.StateFileListChanged(State: TJADDState);
var i :Integer; //counter through files
begin
//enable/disable the components depending on whether files are available
CheckBoxTypes.Enabled := assigned(State.FileList) and
not State.FileList.IsEmpty;
ComboBoxFile.Enabled := CheckBoxTypes.Enabled;
MemoUnknownIdents.Clear; //clear list of unknown identifiers
ComboBoxFile.Clear; //clear list of files
if ComboBoxFile.Enabled then //files available?
begin
for i := 0 to State.FileList.Count - 1 do //add all files
ComboBoxFile.Items.Append(State.FileList[i].InternalFileName);
ComboBoxFile.ItemIndex := 0; //select the first one
ComboBoxFileTypesChange(Self); //cope with the new selection
end;
end;
{Called when the file to show the unknown identifiers or types of or the check
box to toggle between general unknown identifiers and types is changed.
~param Sender the sender of the event, ~[link ComboBoxFile] or
~[link CheckBoxTypes] }
procedure TMFUnknownIdents.ComboBoxFileTypesChange(Sender: TObject);
var TheFile :TPascalFile; //the selected file
i :Integer; //counter through the unknown identifiers
Position :Cardinal; //position where the identifiers are used
begin
//some files available?
if assigned(State.FileList) and not State.FileList.IsEmpty then
begin
MemoUnknownIdents.Lines.BeginUpdate;
try
//get the selected file
TheFile := State.FileList[ComboBoxFile.ItemIndex];
MemoUnknownIdents.Clear; //clear the list
if CheckBoxTypes.Checked then //only unknown types?
begin
MemoUnknownIdents.Lines.Append('Unknown Types:'); //write heading
//just add the list of unknown type identifiers
MemoUnknownIdents.Lines.AddStrings(TheFile.UnknownTypeIdents);
end
else
begin
//write the header for the unknown identifiers
MemoUnknownIdents.Lines.Append('Unknown Identifiers (Line:Column):');
//for each unknown identifier
for i := 0 to TheFile.UnknownIdents.Count - 1 do
begin
//extract the position of the usage of the unknown identifier
Position := Cardinal(TheFile.UnknownIdents.Objects[i]);
//add the name of the unknown identifier and its position
MemoUnknownIdents.Lines.Append(Format('%s (%u:%u)',
[TheFile.UnknownIdents[i],
Position and $003FFFFF,
Position shr 22]));
end;
end; //else CheckBoxUnknownTypes.Checked
MemoUnknownIdents.SelStart := 0; //move to top of the list
finally
MemoUnknownIdents.Lines.EndUpdate;
end;
end; //if assigned(State.FileList) and not State.FileList.IsEmpty
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -