mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 10:37:58 +02:00
* Added editing of eelement link attribute
git-svn-id: trunk@28541 -
This commit is contained in:
parent
1697ac1990
commit
6492775a40
@ -106,10 +106,13 @@ Type
|
||||
BAddSeeAlso,
|
||||
BEditSeeAlso,
|
||||
BDeleteSeeAlso : TToolButton;
|
||||
TBLink : TToolbar;
|
||||
TBEditLink : TToolbutton;
|
||||
//ILElements : TImageList;
|
||||
FSeeAlso,
|
||||
FExamples : TListBox;
|
||||
FCurrentEditable : TWinControl;
|
||||
FElementLink : String;
|
||||
Procedure GetNodes;
|
||||
Function CurrentEditable : TWinControl;
|
||||
procedure OnEnterControl(Sender : TObject);
|
||||
@ -120,7 +123,9 @@ Type
|
||||
Procedure DoAddSeeAlso(Sender : TObject);
|
||||
Procedure DoEditSeeAlso(Sender : TObject);
|
||||
Procedure DoDeleteSeeAlso(Sender : TObject);
|
||||
Procedure DoEditElementLink(Sender : TObject);
|
||||
Function EditLink(Var Value,ALinkText : String) : Boolean;
|
||||
procedure ShowElementCaption;
|
||||
Public
|
||||
Constructor Create (AOwner : TComponent); override;
|
||||
Destructor Destroy; override;
|
||||
@ -235,17 +240,42 @@ begin
|
||||
BevelOuter:=bvNone;
|
||||
AutoSize:=true;
|
||||
end;
|
||||
P1:=TPanel.Create(Self);
|
||||
with P1 do
|
||||
begin
|
||||
Parent:=P0;
|
||||
Align:=alClient;
|
||||
BevelOuter:=bvNone;
|
||||
AutoSize:=true;
|
||||
end;
|
||||
FLabel:=TLabel.Create(Self);
|
||||
With FLabel do
|
||||
begin
|
||||
parent:=P0;
|
||||
parent:=P1;
|
||||
Caption:='<New element>';
|
||||
Align:=alTop;
|
||||
end;
|
||||
TBLink:=TToolbar.Create(Self);
|
||||
With TBLink do
|
||||
begin
|
||||
PArent:=P0;
|
||||
Align:=alRight;
|
||||
Width:=50;
|
||||
Transparent := True;
|
||||
Images:=MainForm.ILElements; //ILElements;
|
||||
end;
|
||||
TBEditLink:=TToolbutton.Create(Self);
|
||||
With TBEditLink do
|
||||
begin
|
||||
Parent:=TBLink;
|
||||
OnClick:=@DoEditElementLink;
|
||||
ImageIndex:=1;
|
||||
Hint := SHintEditElementLink;
|
||||
end;
|
||||
L:=TLabel.Create(self);
|
||||
With L do
|
||||
begin
|
||||
L.Parent:=P0;
|
||||
L.Parent:=P1;
|
||||
Top := 15;
|
||||
L.Align:=alTop;
|
||||
L.Caption:=SShortDescription;
|
||||
@ -253,7 +283,7 @@ begin
|
||||
FShortEntry:=TEdit.Create(Self);
|
||||
With FShortEntry do
|
||||
begin
|
||||
Parent:=P0;
|
||||
Parent:=P1;
|
||||
Top := 35;
|
||||
Align:=alTop;
|
||||
height:=24;
|
||||
@ -485,6 +515,24 @@ begin
|
||||
Element:=Nil;
|
||||
end;
|
||||
|
||||
Procedure TElementEditor.ShowElementCaption;
|
||||
|
||||
|
||||
Var
|
||||
ST : String;
|
||||
|
||||
begin
|
||||
If Assigned(Felement) then
|
||||
begin
|
||||
ST:=Format(SDataForElement,[FElement['name']]);
|
||||
If (FElementLink<>'') then
|
||||
ST:=ST+SLinksTo+FElementLink;
|
||||
end
|
||||
else
|
||||
ST := SNoElement;
|
||||
FLabel.Caption:=ST;
|
||||
end;
|
||||
|
||||
Procedure TElementEditor.Refresh;
|
||||
|
||||
function RemoveLFAfterTags(S : String) : String;
|
||||
@ -559,10 +607,7 @@ Var
|
||||
|
||||
begin
|
||||
GetNodes;
|
||||
If Assigned(Felement) then
|
||||
FLabel.Caption := Format(SDataForElement,[FElement['name']])
|
||||
else
|
||||
FLabel.Caption := SNoElement;
|
||||
ShowElementCaption;
|
||||
S := TStringStream.Create('');
|
||||
LockOnChange;
|
||||
Try
|
||||
@ -700,6 +745,8 @@ begin
|
||||
SS.Seek(0,soFromBeginning);
|
||||
ReadXMLFragment(FElement,SS);
|
||||
FModified:=False;
|
||||
If (FElementLink<>'') then
|
||||
FElement['link']:=FElementLink;
|
||||
// We must get the nodes back, because they were deleted !
|
||||
GetNodes;
|
||||
Result:=True;
|
||||
@ -814,6 +861,7 @@ begin
|
||||
FExampleNodes.Clear;
|
||||
If Assigned(FElement) then
|
||||
begin
|
||||
FElementLink:=FElement['link'];
|
||||
Node:=FElement.FirstChild;
|
||||
While Assigned(Node) do
|
||||
begin
|
||||
@ -1001,6 +1049,32 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TElementEditor.DoEditElementLink(Sender: TObject);
|
||||
begin
|
||||
With TLinkForm.Create(Self) do
|
||||
try
|
||||
Caption:=SHintEditElementLink;
|
||||
If Assigned(OnGetElementList) then
|
||||
begin
|
||||
Links.BeginUpdate;
|
||||
Try
|
||||
OnGetElementList(Links);
|
||||
Finally
|
||||
Links.EndUpdate;
|
||||
end;
|
||||
end;
|
||||
Link:=FElementLink;
|
||||
EnableLinkText:=False;
|
||||
If ShowModal=mrOK then
|
||||
begin
|
||||
FElementLink:=Link;
|
||||
ShowElementCaption;
|
||||
end;
|
||||
Finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
Function TElementEditor.GetCurrentSelection : String;
|
||||
|
||||
begin
|
||||
|
@ -40,9 +40,11 @@ type
|
||||
LLinkTarget: TLabel;
|
||||
LELinkText: TLabel;
|
||||
private
|
||||
function GetELT: Boolean;
|
||||
function GetL: TStrings;
|
||||
function GetLL: String;
|
||||
function GetLT: String;
|
||||
procedure SetELT(const AValue: Boolean);
|
||||
procedure SetL(const AValue: TStrings);
|
||||
procedure SetLL(const AValue: String);
|
||||
procedure SetLT(const AValue: String);
|
||||
@ -52,6 +54,7 @@ type
|
||||
Property Links : TStrings Read GetL Write SetL;
|
||||
property Link : String Read GetLL Write SetLL;
|
||||
Property LinkText : String Read GetLT Write SetLT;
|
||||
Property EnableLinkText : Boolean Read GetELT Write SetELT;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -63,6 +66,11 @@ implementation
|
||||
|
||||
{ TLinkForm }
|
||||
|
||||
function TLinkForm.GetELT: Boolean;
|
||||
begin
|
||||
Result:=ELinkText.Enabled;
|
||||
end;
|
||||
|
||||
function TLinkForm.GetL: TStrings;
|
||||
begin
|
||||
Result:=CBTarget.Items;
|
||||
@ -78,6 +86,11 @@ begin
|
||||
Result:=ELinkText.Text;
|
||||
end;
|
||||
|
||||
procedure TLinkForm.SetELT(const AValue: Boolean);
|
||||
begin
|
||||
ELinkText.Enabled:=AValue
|
||||
end;
|
||||
|
||||
procedure TLinkForm.SetL(const AValue: TStrings);
|
||||
begin
|
||||
CBTarget.Items.Assign(AValue);
|
||||
|
@ -1065,7 +1065,7 @@
|
||||
</element>
|
||||
|
||||
<!-- variable Visibility: default -->
|
||||
<element name="MainForm">
|
||||
<element name="MainForm" link="otherform">
|
||||
<short></short>
|
||||
<descr>
|
||||
</descr>
|
||||
|
@ -8,7 +8,7 @@
|
||||
</Flags>
|
||||
<SessionStorage Value="InIDEConfig"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="LazDocEditor"/>
|
||||
<Title Value="Lazarus documentation editor."/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
@ -184,6 +184,9 @@
|
||||
<ConfigFile>
|
||||
<StopAfterErrCount Value="10"/>
|
||||
</ConfigFile>
|
||||
<CompilerMessages>
|
||||
<UseMsgFile Value="True"/>
|
||||
</CompilerMessages>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
|
@ -25,7 +25,7 @@ uses
|
||||
{$R lazde.res}
|
||||
|
||||
begin
|
||||
Application.Title:='LazDocEditor';
|
||||
Application.Title:='Lazarus documentation editor.';
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.Run;
|
||||
|
@ -76,6 +76,8 @@ ResourceString
|
||||
SMakeSkelFromSource = 'Make new document from source file';
|
||||
SSkelErrorWithFile = 'makeskel reported an error (%d). Try to load produced file anyway ?';
|
||||
SSkelErrorWithoutFile = 'makeskel reported an error (%d) and produced no file.';
|
||||
SLinksTo = ' links to ';
|
||||
SHintEditElementLink = 'Edit element link';
|
||||
//SOptConfirmDelete = 'Confirm node deletion';
|
||||
//SOptCreateBackup = 'Backup existing files';
|
||||
//SOptSkipEmptyNodes = 'Do not create empty nodes';
|
||||
|
Loading…
Reference in New Issue
Block a user