📄 umain.pas
字号:
function DoAddRef: Integer; overload; stdcall;
procedure DoAddRef(d: Integer); overload;
function IUnknown._AddRef = DoAddRef;
end;
function dsd_past.QueryInterface(const IID: TGUID; out Obj): HResult; begin end;
function dsd_past.DoAddRef: Integer; begin end;
procedure dsd_past.DoAddRef(d: Integer); begin end;
function dsd_past._Release: Integer; begin end;
{$ENDIF}
//{$i onefunc.inc} //just another test
{$IFDEF DOSOMEPASCALCHECKS}
//{$include onefunc.inc} //just another test
{$i onefunc.inc} //just another test
//another test
var AnExportedVariable: Integer = 5;
//another test
exports //TInt,
// abcd@integer@DWORD index 4 name 'fgfdgd',
abc index 4 name 'fgfdgd',
{$IFNDEF LINUX}
AnExportedVariable index 8 name 'Variables',
UProgress.TVerboseCommandLineProgress,
TVerboseCommandLineProgress,
IniFiles.TCustomIniFile,
TCustomIniFile,
UProgress.TProgressAdapter,
{$ENDIF}
abc,
UJADDState.GetDelphiVersion,
abc;
{$IFNDEF LINUX}
exports Integer index 4 name 'd' resident,
TMakeDoc;
{$ENDIF}
type
TPropData = packed record
PropCount: Word;
PropList: record end;
{PropList: array[1..PropCount] of TPropInfo}
end;
TPropDataList = record end;
type
TInt = class
procedure Say(i: Cardinal); overload;
end;
TExt = class(TInt)
procedure Say(e: Extended); overload;
end;
procedure TInt.Say(i: Cardinal);
begin
MessageDlg(Format('Integer: %u', [i]), mtInformation, [mbOK], 0);
end;
procedure TExt.Say(e: Extended);
begin
MessageDlg(Format('Extended: %g', [e]), mtInformation, [mbOK], 0);
end;
function CompareText(const S1: string; const i2: Integer): Integer; overload;
begin
SysUtils.CompareText(S1, IntToStr(i2));
end;
procedure TestSay;
var i :TInt;
e :TExt;
iv :Integer;
ev :Extended;
cv :Cardinal;
i64 :Int64;
S :String;
begin
i := TInt.Create;
i.Say(45);
i.Free;
e := TExt.Create;
// e.Say(56);
e.Say(High(Int64));
iv := -44;
ev := 5.5;
cv := 66;
i64 := Int64(High(Cardinal)) + Int64(High(Cardinal)) div 2;
S := 's';
// CompareText(S, S);
MessageDlg('String: ' + S, mtInformation, [mbOK], 0);
UProgress.CompareText(S, iv);
MessageDlg('String: ' + S, mtInformation, [mbOK], 0);
e.say(iv);
e.say(ev);
// e.say(cv);
e.say(i64);
e.Free;
end;
{$ENDIF}
type
{Handles the parameters of the program for this GUI version. }
TGUIParameterOptions = class(TJADDParameterOptions)
private
//the main form this object will handle the parameters for
FForm: TFormMain;
protected
//Parses the selected files with source code.
function DoParse: Boolean; override;
//Generates the documentation with the current settings.
function DoGenerate: Boolean; override;
public
property Form: TFormMain read FForm write FForm;
end;
{Parses the selected files with source code.
~result whether the selected files were successfully parsed }
function TGUIParameterOptions.DoParse: Boolean;
begin
Result := Form.AutoParse; //let the form handle the parsing
end;
{Generates the documentation with the current settings.
~result whether the documentation was successfully generated }
function TGUIParameterOptions.DoGenerate: Boolean;
begin
//generate documentation in the selected kind
case GenerationKind of
dgkDelphiDoc: Result := Form.State.GenerateDocumentation(False);
dgkUserDoc: Result := Form.State.GenerateDocumentation(True);
dgkGUIHelp: Result := Form.State.GenerateGUIHelp;
else
Assert(False);
Result := False;
end;
end;
type
{---------------------------------
Loads and saves the settings of the main form.
This comment (the minus signs) are a test for using reqular expressions to
extract the actual comment without markers.
------------------------------------}
TMainFormSettings = class(TFormSettings)
private
//whether hints should be shown
FShowHint: Boolean;
//whether status bar should be shown
FStatusBar: Boolean;
//whether tree view should be shown
FTreeView: Boolean;
//width of the tree view
FTreeViewWidth: Integer;
protected
public
//Loads the settings from the ini file.
procedure LoadFromIni(Ini: TCustomIniFile); override;
//Saves the settings to the ini file.
procedure SaveToIni(Ini: TCustomIniFile); override;
//Gets the settings from the form.
procedure ReadValues(Form: TFormMain);
property ShowHint: Boolean read FShowHint;
property StatusBar: Boolean read FStatusBar;
property TreeView: Boolean read FTreeView;
property TreeViewWidth: Integer read FTreeViewWidth;
end;
{Loads the settings from the ini file.
~param Ini the ini file to load the settings from }
procedure TMainFormSettings.LoadFromIni(Ini: TCustomIniFile);
begin
inherited LoadFromIni(Ini); //read general form settings
//read if hints should be shown
FShowHint := Ini.ReadBool(Name, 'ShowHint', FShowHint);
//read if status bar should be shown
FStatusBar := Ini.ReadBool(Name, 'StatusBar', FStatusBar);
//read if tree view should be shown
FTreeView := Ini.ReadBool(Name, 'TreeView', FTreeView);
//read width of the tree view
FTreeViewWidth := Ini.ReadInteger(Name, 'TreeViewWidth', FTreeViewWidth);
//read whether memos should be optimized
OptimizeMemoScrollBars := Ini.ReadBool(Name, 'OptimizeMemoScrollBars',
OptimizeMemoScrollBars);
end;
{Saves the settings to the ini file.
~param Ini the ini file to save the settings to }
procedure TMainFormSettings.SaveToIni(Ini: TCustomIniFile);
begin
inherited SaveToIni(Ini); //write general form settings
//write if hints should be shown
Ini.WriteBool(Name, 'ShowHint', FShowHint);
//write if status bar should be shown
Ini.WriteBool(Name, 'StatusBar', FStatusBar);
//write whether tree view should be shown
Ini.WriteBool(Name, 'TreeView', FTreeView);
if FTreeView then //if visible write width of the tree view
Ini.WriteInteger(Name, 'TreeViewWidth', FTreeViewWidth);
end;
{Gets the settings from the form.
~param Form the form to read the values from }
procedure TMainFormSettings.ReadValues(Form: TFormMain);
begin
GetValuesFromForm(Form); //get general values of the form
FShowHint := Form.ShowHint; //get further options
FStatusBar := Form.StatusBar.Visible;
FTreeView := Form.TreeView.Visible;
FTreeViewWidth := Form.TreeView.Width;
end;
//section of the initialization data of this window in the ini file
const TFormMainIniSection = 'MainForm';
{$IFNDEF LINUX}
{Called when the user drops some files on the form. The list of dropped files
is passed on to the current page.
~param Msg the window message of the dropping of some files }
procedure TFormMain.FileDropped(var Msg: TWMDropFiles);
var Files :TStringList; //list for the dropped files
i :Integer; //counter through the dropped files
Size :UINT; //length of the names of the files
FileName :String; //names of the dropped files
begin
try
Files := TStringList.Create; //create list for the dropped files
try
//for all dropped files
for i := 0 to DragQueryFile(Msg.Drop, $FFFFFFFF, nil, 0) - 1 do
begin
Size := DragQueryFile(Msg.Drop, i, nil, 0);
SetLength(FileName, Size);
if (Size = DragQueryFile(Msg.Drop, i, //get name of dropped file
PChar(FileName), Size + 1)) then
Files.Append(FileName); //and add it to the list
end;
if Files.Count > 0 then //some files dropped?
FFrame.FilesDropped(Files); //pass them to the current page
finally
Files.Free; //free list of files
end
finally
DragFinish(Msg.Drop); //finish the dropping
Msg.Result := 0; //dropping of files has been handled
end;
end;
{$ENDIF}
{$IFNDEF LINUX}
{Called whenever a node in the ~[link TreeView] has to be drawn.
~param Sender the sender of the event, ~[link TreeView]
~param Node the node to be drawn
~param State the state of the node
~param DefaultDraw out: if the node should be drawn by the tree view }
procedure TFormMain.TreeViewCustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode;
State: TCustomDrawState;
var DefaultDraw: Boolean);
begin
with TreeView.Canvas.Font do
begin
//no +/- there so indicate expandable nodes with an underlined caption
if Node.HasChildren and not Node.Expanded then
Style := Style + [fsUnderline];
{$IFDEF VER120}
//set Font.Color, so it changed, so it does not "flicker" on a click with
if Node = TreeView.Selected then //the right mouse button
begin
Color := clWindowText;
Color := clHighlightText;
end
else
begin
Color := clHighlightText;
Color := clWindowText;
end;
{$ENDIF}
end;
end;
{$ENDIF}
{Call back method to show some source code.
~param Sender the sender, the requester to show the source code
~param Ident nil, or the identifier whose declaration should be
shown
~param TheFile if ident is nil, the file to show the source code of
~param Position the position in TheFile to show
~param EffectiveFile if different than TheFile, this file has been
included (maybe indirectly) by TheFile, show source
of this file instead
~param EffectivePosition the position in EffectiveFile to show }
procedure TFormMain.ShowSourceCodeCallBack(Sender: TMainFormFrame;
Ident: TIdentifier;
TheFile: TPascalFile;
Position: TPosition;
EffectiveFile: TPascalFile;
EffectivePosition: TPosition);
begin
//go to the position in the source code
FShowSource.ShowSourceCode(Ident, TheFile, Position,
EffectiveFile, EffectivePosition);
if not FShowSource.Visible then //source code not currently shown?
FShowSource.Show //show the window
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -