📄 ueditguitopics.pas
字号:
{ JADD - Just Another DelphiDoc: Documentation from Delphi Source Code
Copyright (C) 2007-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 UEditGUITopics;
{Contains a dialog, ~[link TFormGUITopics], to edit the alternative content of
the main index topic for the help on a GUI. May also be used for the other
kinds of documentation in the future. The only interface to the outside of the
unit is the procedure ~[link EditGUIHelpMainIndex].
}
interface
uses
Windows, SysUtils, Classes,
{$IFNDEF LINUX}
Forms, Dialogs, ComCtrls,
Controls, Buttons, StdCtrls, ExtCtrls, ImgList,
{$ELSE}
QForms, QDialogs, QComCtrls,
QControls, QButtons, QStdCtrls, QExtCtrls, QImgList,
{$ENDIF}
UILComment, UICGUIHelpData, UGUIHelpIndexContent;
type
{The enumeration of the images in the image list. }
TImages = (
//the overlay image to use when the node and all child nodes are
//have correct links (also used as TOverlay index)
iOverlayOK,
//the overlay image to use when the node or at least one child
//node has an incorrect link (also used as TOverlay index)
iOverlayError,
//the image to use for simple text nodes without links
iText,
//the image to use for text nodes with an external link
iExtern,
//the image to use for text nodes with a link into the help on a
//GUI when the comments of the GUI is unknown
iGUI,
//the image to use for text nodes with a link into the additional
//user documentation when it has not been read
iUserDoc,
//the image to use for text nodes with a link into the help on a
//GUI when it has been parsed and the target of the link exists
iGUIKnown,
//the image to use for text nodes with a link into the additional
//user documentation when it has been parsed and the target page
//of the link exists
iUserDocKnown,
//the image to use for text nodes with a link into the help on a
//GUI when it has been parsed and the target of the link does not
//exist
iGUIUnknown,
//the image to use for text nodes with a link into the additional
//user documentation when it has been parsed and the target page
//of the link does not exist
iUserDocUnknown);
{A dialog to edit the alternative content of the main index topic for the
help on a GUI. May also be used for the other kinds of documentation in the
future. }
TFormGUITopics = class(TForm)
LabelNodeCaptions: TLabel;
ComboBoxNodeCaptions: TComboBox;
ButtonLeft: TBitBtn;
ButtonRight: TBitBtn;
ButtonUp: TBitBtn;
ButtonDown: TBitBtn;
ButtonNew: TBitBtn;
ButtonRemove: TBitBtn;
ButtonClearTree: TBitBtn;
BitBtnClose: TBitBtn;
GroupBoxEntry: TGroupBox;
LabelText: TLabel;
EditText: TEdit;
RadioGroupLinkType: TRadioGroup;
LabelLinkTarget: TLabel;
ComboBoxLinkTarget: TComboBox;
LabelComment: TLabel;
ComboBoxComment: TComboBox;
ImageList: TImageList;
procedure ComboBoxNodeCaptionsChange(Sender: TObject);
procedure TreeViewChange(Sender: TObject; Node: TTreeNode);
procedure TreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
procedure TreeViewDragDrop(Sender, Source: TObject; X, Y: Integer);
procedure ButtonLeftClick(Sender: TObject);
procedure ButtonRightClick(Sender: TObject);
procedure ButtonUpClick(Sender: TObject);
procedure ButtonDownClick(Sender: TObject);
procedure ButtonNewClick(Sender: TObject);
procedure ButtonRemoveClick(Sender: TObject);
procedure ButtonClearTreeClick(Sender: TObject);
procedure RadioGroupLinkTypeClick(Sender: TObject);
procedure ComboBoxLinkTargetChange(Sender: TObject);
procedure EntryValuesChanged(Sender: TObject);
private
//the root of the alternative content of the main index to edit
FGUIMainIndexRoot: TGUIMainIndexEntry;
//data of the most recent generated help on GUI, used to look up targets
//for links, may be nil
FGUIHelpData: TICGUIHelpList;
//the user documentation of the most recent generation, used to look up
//targets for links, may be nil
FUserComments: TICUserDocComments;
//the component to show and edit the alternative content of the main index
TreeView: TTreeView;
//the currently edited node in the ~[link TreeView]
FEditNode: TTreeNode;
//Clears the tree and shows the internal nodes again.
procedure ReloadTree;
//Shows the internal nodes in the tree.
procedure FillTree;
//Shows the values of the entry represented by the node so they can be
//edited.
procedure StartEditing(Node: TTreeNode);
//Saves the data from the GUI to the currently edited entry.
procedure SaveData;
//Sets whether a node is currently being edited.
procedure SetEditing(Editing: Boolean);
//Updates the states of the buttons.
procedure UpdateButtonState;
//Sets the caption of the node.
procedure SetNodeText(Node: TTreeNode);
//Sets the image/icon of the node.
procedure SetNodeImage(Node: TTreeNode);
//Sets the caption and image of the node and recalculates inherited states.
procedure UpdateNode(Node: TTreeNode);
//Sets the overlay image of the node indicating the state of its child
//nodes.
procedure SetOverlay(Node: TTreeNode);
//Sets the overlay images of the parts of the tree containing the nodes.
procedure SetOverlays(Node1, Node2: TTreeNode);
//Loads the base names of all read logs files of GUIs into the combo box
//so one can be chosen.
procedure LoadGUIBaseNames(Items: TStrings);
//Loads all comments of the currently selected base names of a GUI into the
//other combo box so one can be chosen.
procedure LoadGUIComments(Items: TStrings; BaseName: String);
//Loads the names of all parsed pages of additional user documentation into
//the combo box so one can be chosen.
procedure LoadUserDocPages(Items: TStrings);
public
//Creates the dialog to edit the content of the main index.
constructor Create(GUIMainIndexRoot: TGUIMainIndexEntry;
GUIHelpData: TICGUIHelpList;
UserComments: TICUserDocComments); reintroduce;
//Frees the dialog after saving its current state.
destructor Destroy; override;
end;
//Allows the user to edit the alternative content of the main index of the
//documentation to be generated.
procedure EditGUIHelpMainIndex(GUIMainIndexRoot: TGUIMainIndexEntry;
GUIHelpData: TICGUIHelpList;
UserComments: TICUserDocComments);
implementation
{$R *.dfm}
uses IniFiles,
GeneralVCL,
USettingsKeeper;
{Allows the user to edit the alternative content of the main index of the
documentation to be generated.
~param GUIMainIndexRoot the root of the entries to be edited
~param GUIHelpData if available the parsed comments on a GUI to allow
easier selection of a link target, may be nil
~param UserComments if available the parses user documentation on the GUI
to allow easier selection of a page as a link target,
may be nil }
procedure EditGUIHelpMainIndex(GUIMainIndexRoot: TGUIMainIndexEntry;
GUIHelpData: TICGUIHelpList;
UserComments: TICUserDocComments);
begin
//create the dialog to edit the alternative content
with TFormGUITopics.Create(GUIMainIndexRoot, GUIHelpData, UserComments) do
try
ShowModal; //show it
finally
Free; //and free it when not used anymore
end;
end;
type
{Loads and saves the settings of the form to edit the alternative content of
the main index. }
TMainIndexContentFormSettings = class(TFormSettings)
private
//the selection what should be shown as the caption of the nodes
FNodeCaptionStyle: 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: TFormGUITopics);
property NodeCaptionStyle: Integer read FNodeCaptionStyle;
end;
{Loads the settings from the ini file.
~param Ini the ini file to load the settings from }
procedure TMainIndexContentFormSettings.LoadFromIni(Ini: TCustomIniFile);
begin
inherited LoadFromIni(Ini); //read general form settings
//read selected content of the nodes
FNodeCaptionStyle := Ini.ReadInteger(Name, 'NodeCaptionStyle',
FNodeCaptionStyle);
end;
{Saves the settings to the ini file.
~param Ini the ini file to save the settings to }
procedure TMainIndexContentFormSettings.SaveToIni(Ini: TCustomIniFile);
begin
inherited SaveToIni(Ini); //write general form settings
//write selected content of the nodes
Ini.WriteInteger(Name, 'NodeCaptionStyle', FNodeCaptionStyle);
end;
{Gets the settings from the form.
~param Form the form to read the values from }
procedure TMainIndexContentFormSettings.ReadValues(Form: TFormGUITopics);
begin
GetValuesFromForm(Form); //get general values of the form
//get selected content of the nodes
FNodeCaptionStyle := Form.ComboBoxNodeCaptions.ItemIndex;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -