📄 umain.pas
字号:
{ JADD - Just Another DelphiDoc: Documentation from Delphi Source Code
Copyright (C) 2003-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 UMain;
{This is the main unit of the program containing the main form of the
application, ~[link TFormMain]. The program parameters are also handled in the
on its creation.~[br]
The form is partitioned in two parts, one region to show different pages, and
a tree view to select the pages to be shown. The many different pages are
forms (Frames were only introduced in Delphi 5, JADD is developed with
Delphi 4) in the units in the subdirectory ~[code \GUI\MainForm], the base
class is ~[linkClass TMainFormFrame] in unit ~[linkUnit UMainFormFrame]. }
interface
uses
Windows, SysUtils, Classes, Graphics,
Forms, Controls, StdCtrls, Buttons, ExtCtrls, ComCtrls, Menus,
{$IFNDEF LINUX}
Messages,
{$ELSE}
QTypes, QGraphics,
{$ENDIF}
UMainFormFrame,
UShowSourceForm,
UPascalConsts,
UBaseIdents,
UJADDState;
{$IFDEF LINUX}
{$DEFINE DONT_USE_MESSAGEGRID}
{$ENDIF}
type
{The main form of the application. The program parameters are also handled on
its creation.~[br]
The form is partitioned in two parts, one region to show different pages,
and a tree view to select the pages to be shown. The many different pages
are forms (Frames were only introduced in Delphi 5, JADD is developed with
Delphi 4) in the units in the subdirectory ~[code \GUI\MainForm], the base
class is ~[linkClass TMainFormFrame] in unit ~[linkUnit UMainFormFrame]. }
TFormMain = class(TForm)
TreeView: TTreeView;
PanelSplitter: TPanel;
GroupBox: TGroupBox;
PanelButtons: TPanel;
BitBtnNext: TBitBtn;
BitBtnPrevious: TBitBtn;
StatusBar: TStatusBar;
MainMenu: TMainMenu;
MenuItemMenuFile: TMenuItem;
MenuItemShowOptions: TMenuItem;
MenuItemFileSeparator1: TMenuItem;
MenuItemClose: TMenuItem;
MenuItemMenuView: TMenuItem;
MenuItemStatusBar: TMenuItem;
MenuItemTreeView: TMenuItem;
MenuItemHints: TMenuItem;
MenuItemViewSeparator1: TMenuItem;
MenuItemSourceCode: TMenuItem;
MenuItemMenuHelp: TMenuItem;
MenuItemContext: TMenuItem;
MenuItemIndex: TMenuItem;
MenuItemDocumentation: TMenuItem;
MenuItemHelpSeparator1: TMenuItem;
MenuItemCommandLineSwitches: TMenuItem;
MenuItemHelpSeparator2: TMenuItem;
MenuItemVisitHomePage: TMenuItem;
MenuItemHelpSeparator3: TMenuItem;
MenuItemAbout: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure PanelSplitterMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure PanelSplitterMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure PanelSplitterDblClick(Sender: TObject);
procedure TreeViewChange(Sender: TObject; Node: TTreeNode);
procedure TreeViewDblClick(Sender: TObject);
procedure BitBtnPreviousClick(Sender: TObject);
procedure BitBtnNextClick(Sender: TObject);
procedure StatusBarDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
procedure MenuItemShowOptionsClick(Sender: TObject);
procedure MenuItemCloseClick(Sender: TObject);
procedure MenuItemMenuViewClick(Sender: TObject);
procedure MenuItemStatusBarClick(Sender: TObject);
procedure MenuItemTreeViewClick(Sender: TObject);
procedure MenuItemHintsClick(Sender: TObject);
procedure MenuItemSourceCodeClick(Sender: TObject);
procedure MenuItemContextClick(Sender: TObject);
procedure MenuItemIndexClick(Sender: TObject);
procedure MenuItemDocumentationClick(Sender: TObject);
procedure MenuItemCommandLineSwitchesClick(Sender: TObject);
procedure MenuItemVisitHomePageClick(Sender: TObject);
procedure MenuItemAboutClick(Sender: TObject);
private
//the state of the program to be used to parse source code and generate
//documentation
FState: TJADDState;
//the currently shown frame
FFrame: TMainFormFrame;
//the form to show parsed source code
FShowSource: TFormShowSource;
{$IFNDEF LINUX}
//Notifies the current frame with the list of dropped files.
procedure FileDropped(var Msg: TWMDropFiles); message WM_DropFiles;
{$ENDIF}
{$IFNDEF LINUX}
//Called whenever a node in the ~[link TreeView] has to be drawn.
procedure TreeViewCustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState;
var DefaultDraw: Boolean);
{$ENDIF}
//Call back method to show some source code.
procedure ShowSourceCodeCallBack(Sender: TMainFormFrame;
Ident: TIdentifier;
TheFile: TPascalFile;
Position: TPosition;
EffectiveFile: TPascalFile;
EffectivePosition: TPosition);
//Initializes the program from its ini file.
procedure ReadDefaultIni;
//Writes the options of the program to its ini file.
procedure WriteDefaultIni;
//Makes sure generator, extractor and evaluator of comments are assigned.
procedure CheckGeneratorClasses;
//Handles the program parameters.
procedure HandleParameters;
//Create a new page of the selected class and shows it.
procedure ShowFrame(FrameClass: TMainFormFrameClass);
//Returns the class of page to be shown for the selected node.
function GetMainFrames(Node: TTreeNode): TMainFormFrameClass;
//Returns the class of page to be shown for the selected node to acquire
//parsed data.
function GetParseFrames(Node: TTreeNode): TMainFormFrameClass;
//Returns the class of page to be shown for the selected node to parse
//source code files.
function GetParseSubFrames(Node: TTreeNode): TMainFormFrameClass;
//Returns the class of page to be shown for the selected node to generate
//documentation.
function GetGenerateFrames(Node: TTreeNode): TMainFormFrameClass;
//Shows the page of the selcted node unless overridden by the current page.
procedure SelectOtherNode(NewNode: TTreeNode; IsNext: Boolean);
public
//Parses data if needed by the parameters of the program.
function AutoParse: Boolean;
property State: TJADDState read FState;
end;
implementation
{$R *.dfm}
uses Math,
{$IFDEF VER120}
FileCtrl,
{$ENDIF}
Dialogs,
{$IFNDEF LINUX}
ShellApi,
{$ELSE}
QClipbrd,
{$ENDIF}
IniFiles,
UOptions,
{$IFDEF DOSOMEPASCALCHECKS}
// UFilePaths,
UProgress,
{$ENDIF}
// UJADDState, UGenerate,
UCommandParameters,
UParametersToState,
UParse,
UTokenParser,
UDocumentationTexts,
UMakeDoc, UCommentDoc,
USettingsKeeper,
//not directly used here, but units have to be included in the project
//somewhere
UJADDComments,
//not directly used here, but units have to be included in the project
//somewhere
UDiagramCreator, UExtractSourceDoc, USaveDataDoc, UUMLXMIExportDoc,
//these are deprecated:
UHTMLDoc, UWinHelpDoc, ULaTeXDoc, UPDFDoc, UHTMLHelpDoc,
//these are the new, better, more powerful (although also somehow slower
//and more memory-intensive) variants:
UICWinHelpDoc, UICHTMLDoc, UICHTMLHelpDoc, UICPDFDoc, UICLaTeXDoc,
//not a real generator, just makes localization easier
USaveTranslation,
UCommentExtraction,
//not directly used here, but units have to be included in the project
//somewhere
USourceCommentExtraction,
//not directly used here, but units have to be included in the project
//somewhere
UInlineCommand,
//this unit is not used in this file, just for testing unit-aliases:
GeneralAlias, //if you have problems here, just use "General" instead
GeneralVCL,
//the pages to be shown in this form:
// UMainFormFrame //the common base class of the pages
UMFWelcome,
UMFAcquireParsedData,
UMFLoadParsedData,
UMFParseMain,
UMFSelectFiles,
UMFExcludeFromParsing,
UMFSelectLibraryFiles,
UMFCompilerOptions,
UMFLoadProject,
UMFParse,
UMFParseMessages,
UMFUnknownIdents,
UMFShowSource,
UMFKeepSelectData,
UMFGenerateMain,
UMFGenerator,
UMFExtractor,
UMFEvaluator,
UMFLocalization,
UMFUserDoc,
UMFGenerate,
UMFStatusText,
{$IFDEF DONT_USE_MESSAGEGRID}
UMFGenerateMessages_kyl,
{$ELSE}
UMFGenerateMessages,
{$ENDIF}
UMFGUIHelpFiles,
UMFGUIHelp,
UMFDiagrams,
UMFCompare,
UMFProgramOptions,
//the other forms of this program:
UAbout,
// UShowSourceForm,
UWorkProgress
{
UEditDefines, UAddInteractively, UComparison, UDiagramForm,
UExpert, UCatExpert,
UMessageFilterForm,
UWizard, UOptionsWizard
}
// , UFormHelp //only to generate help for GUI
// , SetHelp //only to test access to generated help
;
//see also: UProgress
//{$DEFINE DOSOMEPASCALCHECKS} {
{$UNDEF DOSOMEPASCALCHECKS}
{$IFDEF DOSOMEPASCALCHECKS}
//test
function _Abcd(Input: Integer): DWORD; overload; forward;
function Abcd(Input: String): DWORD; overload; forward;
function Abcd(Input: String): DWORD; overload;
begin
Result := StrToInt(Input);
end;
function _Abcd(Input: LongInt): LongWord;
// function Abcd(Input: Integer): DWORD;
begin
Result := Input;
end;
type IAnotherUnknown = interface(IUnknown)
end;
dsd_pre = class(TObject, IAnotherUnknown, uprogress.IAnotherUnknown)
private
fimpl_pre: TInterfacedObject;
public
function DoAddRef: Integer; stdcall;
function DoRelease: Integer; virtual; abstract; //stdcall;
function IAnotherUnknown._AddRef = DoAddRef;
// function uprogress.IAnotherUnknown._Release = DoRelease;
property impl_pre: TInterfacedObject read fimpl_pre
implements IAnotherUnknown,
uprogress.IAnotherUnknown;
end;
function dsd_pre.DoAddRef;
begin
end;
type
dsd = class(dsd_pre, UProgress.IAnotherUnknown)
private
fimpl: TInterfacedObject;
public
property impl: TInterfacedObject read fimpl
implements uprogress.IAnotherUnknown;
end;
type dsd_past = class(TObject, IUnknown)
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function _Release: Integer; stdcall;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -