From fe9f11aa369edbe85cfdd965d8b6bb6f1cb5eaba Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 16 Nov 2009 19:51:10 +0000 Subject: [PATCH] IDE, FPDoc-editor: added feature to edit topics git-svn-id: trunk@22629 - --- ide/codehelp.pas | 66 ++++++++++++ ide/fpdoceditwindow.lfm | 188 ++++++++++++++++++++++++-------- ide/fpdoceditwindow.lrs | 233 ++++++++++++++++++++++------------------ ide/fpdoceditwindow.pas | 163 ++++++++++++++++++++++++++-- 4 files changed, 492 insertions(+), 158 deletions(-) diff --git a/ide/codehelp.pas b/ide/codehelp.pas index f87993a0f4..7d9e12fd35 100644 --- a/ide/codehelp.pas +++ b/ide/codehelp.pas @@ -100,6 +100,10 @@ type function GetPackageName: string; function GetModuleNode: TDOMNode; // the unit function GetModuleName: string; + function GetModuleTopicCount: Integer; + function GetModuleTopicName(Index: Integer): String; + function GetModuleTopic(Name: String): TDOMNode; + function CreateModuleTopic(Name: String): TDOMNode; function GetFirstElement: TDOMNode; function GetElementWithName(const ElementName: string; CreateIfNotExists: boolean = false): TDOMNode; @@ -475,6 +479,68 @@ begin Result:=''; end; +function TLazFPDocFile.GetModuleTopicCount: Integer; +var + n: TDOMNode; +begin + Result := 0; + n := GetModuleNode; + if n = nil then exit; + n := n.FirstChild; + while (n <> nil) do begin + if (n.NodeName = 'topic') then inc(result); + n := n.NextSibling; + end; +end; + +function TLazFPDocFile.GetModuleTopicName(Index: Integer): String; +var + n: TDOMNode; +begin + Result := ''; + n := GetModuleNode; + if n = nil then exit; + n := n.FirstChild; + while (n <> nil) and (Index >= 0) do begin + if (n.NodeName = 'topic') and (n is TDomElement) then begin + if Index = 0 then begin + Result := TDomElement(n).GetAttribute('name'); + exit; + end; + dec(Index); + end; + n := n.NextSibling; + end; +end; + +function TLazFPDocFile.GetModuleTopic(Name: String): TDOMNode; +begin + Result := GetModuleNode; + if Result = nil then exit; + Result := Result.FirstChild; + while (Result <> nil) do begin + if (Result.NodeName = 'topic') and (Result is TDomElement) and + (SysUtils.CompareText(TDomElement(Result).GetAttribute('name'), Name) = 0) + then + exit; + Result := Result.NextSibling; + end; +end; + +function TLazFPDocFile.CreateModuleTopic(Name: String): TDOMNode; +var + ModuleNode: TDOMNode; +begin + ModuleNode := GetModuleNode; + if ModuleNode = nil then exit; + + Result:=Doc.CreateElement('topic'); + DocChanging; + TDOMElement(Result).SetAttribute('name', Name); + ModuleNode.AppendChild(Result); + DocChanged; +end; + function TLazFPDocFile.GetFirstElement: TDOMNode; begin //get first module node diff --git a/ide/fpdoceditwindow.lfm b/ide/fpdoceditwindow.lfm index 9086da9075..4dd9a38351 100644 --- a/ide/fpdoceditwindow.lfm +++ b/ide/fpdoceditwindow.lfm @@ -1,9 +1,8 @@ object FPDocEditor: TFPDocEditor - Left = 514 + Left = 2054 Height = 126 Top = 761 Width = 753 - ActiveControl = ExampleEdit Caption = 'FPDoc editor' ClientHeight = 126 ClientWidth = 753 @@ -17,24 +16,24 @@ object FPDocEditor: TFPDocEditor Height = 126 Top = 0 Width = 690 - ActivePage = ShortTabSheet + ActivePage = TopicSheet Align = alClient - TabIndex = 0 + TabIndex = 6 TabOrder = 0 TabPosition = tpBottom OnChange = PageControlChange OnPageChanged = PageControlChange object ShortTabSheet: TTabSheet Caption = 'ShortTabSheet' - ClientHeight = 100 + ClientHeight = 98 ClientWidth = 682 object LinkLabel: TLabel AnchorSideTop.Control = LinkEdit AnchorSideTop.Side = asrCenter Left = 6 - Height = 14 - Top = 26 - Width = 44 + Height = 16 + Top = 28 + Width = 51 BorderSpacing.Top = 6 Caption = 'LinkLabel' ParentColor = False @@ -44,9 +43,9 @@ object FPDocEditor: TFPDocEditor AnchorSideTop.Control = ShortEdit AnchorSideTop.Side = asrCenter Left = 6 - Height = 14 + Height = 16 Top = 3 - Width = 52 + Width = 57 BorderSpacing.Left = 6 Caption = 'ShortLabel' ParentColor = False @@ -56,10 +55,10 @@ object FPDocEditor: TFPDocEditor AnchorSideLeft.Side = asrBottom AnchorSideRight.Control = ShortTabSheet AnchorSideRight.Side = asrBottom - Left = 64 - Height = 21 + Left = 69 + Height = 23 Top = 0 - Width = 616 + Width = 611 Anchors = [akTop, akLeft, akRight] AutoSelect = False BorderSpacing.Left = 6 @@ -73,9 +72,9 @@ object FPDocEditor: TFPDocEditor AnchorSideTop.Control = LinkEdit AnchorSideTop.Side = asrBottom Left = 6 - Height = 23 - Top = 50 - Width = 91 + Height = 25 + Top = 54 + Width = 96 AutoSize = True BorderSpacing.Around = 6 Caption = 'CreateButton' @@ -89,10 +88,10 @@ object FPDocEditor: TFPDocEditor AnchorSideTop.Side = asrBottom AnchorSideRight.Control = ShortTabSheet AnchorSideRight.Side = asrBottom - Left = 56 - Height = 21 - Top = 23 - Width = 624 + Left = 63 + Height = 23 + Top = 25 + Width = 617 Anchors = [akTop, akLeft, akRight] AutoSelect = False BorderSpacing.Left = 6 @@ -106,11 +105,11 @@ object FPDocEditor: TFPDocEditor end object InheritedTabSheet: TTabSheet Caption = 'InheritedTabSheet' - ClientHeight = 100 + ClientHeight = 98 ClientWidth = 682 object InheritedShortLabel: TLabel Left = 0 - Height = 18 + Height = 16 Top = 2 Width = 682 Align = alTop @@ -125,8 +124,8 @@ object FPDocEditor: TFPDocEditor AnchorSideRight.Control = InheritedTabSheet AnchorSideRight.Side = asrBottom Left = 0 - Height = 27 - Top = 22 + Height = 23 + Top = 20 Width = 682 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 2 @@ -138,9 +137,9 @@ object FPDocEditor: TFPDocEditor AnchorSideTop.Control = InheritedShortEdit AnchorSideTop.Side = asrBottom Left = 0 - Height = 29 - Top = 55 - Width = 158 + Height = 25 + Top = 49 + Width = 153 AutoSize = True BorderSpacing.Around = 6 Caption = 'MoveToInheritedButton' @@ -152,10 +151,10 @@ object FPDocEditor: TFPDocEditor AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = MoveToInheritedButton AnchorSideTop.Side = asrCenter - Left = 168 - Height = 29 - Top = 55 - Width = 175 + Left = 163 + Height = 25 + Top = 49 + Width = 165 AutoSize = True BorderSpacing.Left = 10 Caption = 'CopyFromInheritedButton' @@ -166,10 +165,10 @@ object FPDocEditor: TFPDocEditor AnchorSideLeft.Control = CopyFromInheritedButton AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = CopyFromInheritedButton - Left = 353 - Height = 29 - Top = 55 - Width = 174 + Left = 338 + Height = 25 + Top = 49 + Width = 167 AutoSize = True BorderSpacing.Left = 10 Caption = 'AddLinkToInheritedButton' @@ -179,11 +178,11 @@ object FPDocEditor: TFPDocEditor end object DescrTabSheet: TTabSheet Caption = 'DescrTabSheet' - ClientHeight = 100 + ClientHeight = 98 ClientWidth = 682 object DescrMemo: TMemo Left = 0 - Height = 96 + Height = 94 Top = 0 Width = 680 Align = alClient @@ -199,11 +198,11 @@ object FPDocEditor: TFPDocEditor end object ErrorsTabSheet: TTabSheet Caption = 'ErrorsTabSheet' - ClientHeight = 100 + ClientHeight = 98 ClientWidth = 682 object ErrorsMemo: TMemo Left = 0 - Height = 96 + Height = 94 Top = 0 Width = 680 Align = alClient @@ -219,11 +218,11 @@ object FPDocEditor: TFPDocEditor end object SeeAlsoTabSheet: TTabSheet Caption = 'SeeAlsoTabSheet' - ClientHeight = 100 + ClientHeight = 98 ClientWidth = 682 object SeeAlsoMemo: TMemo Left = 0 - Height = 100 + Height = 98 Top = 0 Width = 682 Align = alClient @@ -237,11 +236,11 @@ object FPDocEditor: TFPDocEditor end object ExampleTabSheet: TTabSheet Caption = 'ExampleTabSheet' - ClientHeight = 100 + ClientHeight = 98 ClientWidth = 682 object ExampleEdit: TEdit Left = 0 - Height = 21 + Height = 23 Top = 0 Width = 680 Align = alTop @@ -257,10 +256,10 @@ object FPDocEditor: TFPDocEditor AnchorSideTop.Side = asrBottom AnchorSideRight.Control = ExampleTabSheet AnchorSideRight.Side = asrBottom - Left = 543 - Height = 23 - Top = 27 - Width = 133 + Left = 532 + Height = 25 + Top = 29 + Width = 144 Anchors = [akTop, akRight] AutoSize = True BorderSpacing.Around = 6 @@ -269,6 +268,101 @@ object FPDocEditor: TFPDocEditor TabOrder = 1 end end + object TopicSheet: TTabSheet + Caption = 'Topics' + ClientHeight = 98 + ClientWidth = 682 + object Panel1: TPanel + Left = 512 + Height = 98 + Top = 0 + Width = 170 + Align = alRight + BorderSpacing.Left = 5 + BevelOuter = bvNone + ClientHeight = 98 + ClientWidth = 170 + TabOrder = 0 + object Panel2: TPanel + Left = 0 + Height = 25 + Top = 0 + Width = 170 + Align = alTop + AutoSize = True + BevelOuter = bvNone + ClientHeight = 25 + ClientWidth = 170 + TabOrder = 0 + object NewTopicButton: TButton + Left = 120 + Height = 25 + Top = 0 + Width = 50 + Align = alRight + AutoSize = True + Caption = 'New' + OnClick = NewTopicButtonClick + TabOrder = 0 + end + object NewTopicNameEdit: TEdit + Left = 0 + Height = 25 + Top = 0 + Width = 115 + Align = alClient + BorderSpacing.Right = 5 + OnEnter = TopicControlEnter + TabOrder = 1 + end + end + object TopicListBox: TListBox + Left = 0 + Height = 68 + Top = 30 + Width = 170 + Align = alClient + BorderSpacing.Top = 5 + ItemHeight = 0 + OnClick = TopicListBoxClick + OnEnter = TopicControlEnter + TabOrder = 1 + end + end + object Panel3: TPanel + Left = 0 + Height = 98 + Top = 0 + Width = 507 + Align = alClient + BevelOuter = bvNone + ClientHeight = 98 + ClientWidth = 507 + TabOrder = 1 + object TopicShort: TEdit + Left = 0 + Height = 23 + Top = 0 + Width = 507 + Align = alTop + AutoSelect = False + OnChange = TopicDescrChange + OnEnter = TopicControlEnter + TabOrder = 0 + end + object TopicDescr: TMemo + Left = 0 + Height = 70 + Top = 28 + Width = 507 + Align = alClient + BorderSpacing.Top = 5 + OnChange = TopicDescrChange + OnEnter = TopicControlEnter + TabOrder = 1 + end + end + end end object LeftBtnPanel: TPanel Left = 0 diff --git a/ide/fpdoceditwindow.lrs b/ide/fpdoceditwindow.lrs index af97a95681..f498940a56 100644 --- a/ide/fpdoceditwindow.lrs +++ b/ide/fpdoceditwindow.lrs @@ -1,112 +1,135 @@ { This is an automatically generated lazarus resource file } LazarusResources.Add('TFPDocEditor','FORMDATA',[ - 'TPF0'#12'TFPDocEditor'#11'FPDocEditor'#4'Left'#3#2#2#6'Height'#2'~'#3'Top'#3 - +#249#2#5'Width'#3#241#2#13'ActiveControl'#7#11'ExampleEdit'#7'Caption'#6#12 - +'FPDoc editor'#12'ClientHeight'#2'~'#11'ClientWidth'#3#241#2#10'KeyPreview'#9 - +#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#9'OnKeyDown'#7 - +#11'FormKeyDown'#10'LCLVersion'#6#6'0.9.29'#0#12'TPageControl'#11'PageContro' - +'l'#4'Left'#2'?'#6'Height'#2'~'#3'Top'#2#0#5'Width'#3#178#2#10'ActivePage'#7 - +#13'ShortTabSheet'#5'Align'#7#8'alClient'#8'TabIndex'#2#0#8'TabOrder'#2#0#11 - +'TabPosition'#7#8'tpBottom'#8'OnChange'#7#17'PageControlChange'#13'OnPageCha' - +'nged'#7#17'PageControlChange'#0#9'TTabSheet'#13'ShortTabSheet'#7'Caption'#6 - +#13'ShortTabSheet'#12'ClientHeight'#2'd'#11'ClientWidth'#3#170#2#0#6'TLabel' - +#9'LinkLabel'#21'AnchorSideTop.Control'#7#8'LinkEdit'#18'AnchorSideTop.Side' - +#7#9'asrCenter'#4'Left'#2#6#6'Height'#2#14#3'Top'#2#26#5'Width'#2','#17'Bord' - +'erSpacing.Top'#2#6#7'Caption'#6#9'LinkLabel'#11'ParentColor'#8#0#0#6'TLabel' - +#10'ShortLabel'#22'AnchorSideLeft.Control'#7#13'ShortTabSheet'#21'AnchorSide' - +'Top.Control'#7#9'ShortEdit'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2 - +#6#6'Height'#2#14#3'Top'#2#3#5'Width'#2'4'#18'BorderSpacing.Left'#2#6#7'Capt' - +'ion'#6#10'ShortLabel'#11'ParentColor'#8#0#0#5'TEdit'#9'ShortEdit'#22'Anchor' - +'SideLeft.Control'#7#10'ShortLabel'#19'AnchorSideLeft.Side'#7#9'asrBottom'#23 - +'AnchorSideRight.Control'#7#13'ShortTabSheet'#20'AnchorSideRight.Side'#7#9'a' - +'srBottom'#4'Left'#2'@'#6'Height'#2#21#3'Top'#2#0#5'Width'#3'h'#2#7'Anchors' - +#11#5'akTop'#6'akLeft'#7'akRight'#0#10'AutoSelect'#8#18'BorderSpacing.Left'#2 - +#6#19'BorderSpacing.Right'#2#2#8'OnChange'#7#15'ShortEditChange'#13'OnEditin' - +'gDone'#7#20'ShortEditEditingDone'#8'TabOrder'#2#0#4'Text'#6#9'ShortEdit'#0#0 - +#7'TButton'#12'CreateButton'#21'AnchorSideTop.Control'#7#8'LinkEdit'#18'Anch' - +'orSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#23#3'Top'#2'2'#5'Wid' - +'th'#2'['#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6#12'CreateB' - +'utton'#7'OnClick'#7#17'CreateButtonClick'#8'TabOrder'#2#1#0#0#5'TEdit'#8'Li' - +'nkEdit'#22'AnchorSideLeft.Control'#7#9'LinkLabel'#19'AnchorSideLeft.Side'#7 - +#9'asrBottom'#21'AnchorSideTop.Control'#7#9'ShortEdit'#18'AnchorSideTop.Side' - +#7#9'asrBottom'#23'AnchorSideRight.Control'#7#13'ShortTabSheet'#20'AnchorSid' - +'eRight.Side'#7#9'asrBottom'#4'Left'#2'8'#6'Height'#2#21#3'Top'#2#23#5'Width' - +#3'p'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#10'AutoSelect'#8#18'Bo' - +'rderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#2#19'BorderSpacing.Right'#2#2 - +#8'OnChange'#7#14'LinkEditChange'#13'OnEditingDone'#7#19'LinkEditEditingDone' - +#8'TabOrder'#2#2#4'Text'#6#8'LinkEdit'#0#0#0#9'TTabSheet'#17'InheritedTabShe' - +'et'#7'Caption'#6#17'InheritedTabSheet'#12'ClientHeight'#2'd'#11'ClientWidth' - +#3#170#2#0#6'TLabel'#19'InheritedShortLabel'#4'Left'#2#0#6'Height'#2#18#3'To' - +'p'#2#2#5'Width'#3#170#2#5'Align'#7#5'alTop'#17'BorderSpacing.Top'#2#2#7'Cap' - +'tion'#6#19'InheritedShortLabel'#11'ParentColor'#8#0#0#5'TEdit'#18'Inherited' - +'ShortEdit'#22'AnchorSideLeft.Control'#7#17'InheritedTabSheet'#21'AnchorSide' - +'Top.Control'#7#19'InheritedShortLabel'#18'AnchorSideTop.Side'#7#9'asrBottom' - +#23'AnchorSideRight.Control'#7#17'InheritedTabSheet'#20'AnchorSideRight.Side' - +#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#27#3'Top'#2#22#5'Width'#3#170#2#7'An' - +'chors'#11#5'akTop'#6'akLeft'#7'akRight'#0#17'BorderSpacing.Top'#2#2#8'ReadO' - +'nly'#9#8'TabOrder'#2#0#4'Text'#6#18'InheritedShortEdit'#0#0#7'TButton'#21'M' - +'oveToInheritedButton'#21'AnchorSideTop.Control'#7#18'InheritedShortEdit'#18 - +'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#29#3'Top'#2'7'#5 - +'Width'#3#158#0#8'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6#21'M' - +'oveToInheritedButton'#7'OnClick'#7#26'MoveToInheritedButtonClick'#8'TabOrde' - +'r'#2#1#0#0#7'TButton'#23'CopyFromInheritedButton'#22'AnchorSideLeft.Control' - +#7#21'MoveToInheritedButton'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'Ancho' - +'rSideTop.Control'#7#21'MoveToInheritedButton'#18'AnchorSideTop.Side'#7#9'as' - +'rCenter'#4'Left'#3#168#0#6'Height'#2#29#3'Top'#2'7'#5'Width'#3#175#0#8'Auto' - +'Size'#9#18'BorderSpacing.Left'#2#10#7'Caption'#6#23'CopyFromInheritedButton' - +#7'OnClick'#7#28'CopyFromInheritedButtonClick'#8'TabOrder'#2#2#0#0#7'TButton' - +#24'AddLinkToInheritedButton'#22'AnchorSideLeft.Control'#7#23'CopyFromInheri' - +'tedButton'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control' - +#7#23'CopyFromInheritedButton'#4'Left'#3'a'#1#6'Height'#2#29#3'Top'#2'7'#5'W' - +'idth'#3#174#0#8'AutoSize'#9#18'BorderSpacing.Left'#2#10#7'Caption'#6#24'Add' - +'LinkToInheritedButton'#7'OnClick'#7#29'AddLinkToInheritedButtonClick'#8'Tab' - +'Order'#2#3#0#0#0#9'TTabSheet'#13'DescrTabSheet'#7'Caption'#6#13'DescrTabShe' - +'et'#12'ClientHeight'#2'd'#11'ClientWidth'#3#170#2#0#5'TMemo'#9'DescrMemo'#4 - +'Left'#2#0#6'Height'#2'`'#3'Top'#2#0#5'Width'#3#168#2#5'Align'#7#8'alClient' - +#19'BorderSpacing.Right'#2#2#20'BorderSpacing.Bottom'#2#4#13'Lines.Strings'#1 - ,#6#9'DescrMemo'#0#8'OnChange'#7#15'DescrMemoChange'#13'OnEditingDone'#7#20'D' - +'escrMemoEditingDone'#8'TabOrder'#2#0#0#0#0#9'TTabSheet'#14'ErrorsTabSheet'#7 - +'Caption'#6#14'ErrorsTabSheet'#12'ClientHeight'#2'd'#11'ClientWidth'#3#170#2 - +#0#5'TMemo'#10'ErrorsMemo'#4'Left'#2#0#6'Height'#2'`'#3'Top'#2#0#5'Width'#3 - +#168#2#5'Align'#7#8'alClient'#19'BorderSpacing.Right'#2#2#20'BorderSpacing.B' - +'ottom'#2#4#13'Lines.Strings'#1#6#10'ErrorsMemo'#0#8'OnChange'#7#16'ErrorsMe' - +'moChange'#13'OnEditingDone'#7#21'ErrorsMemoEditingDone'#8'TabOrder'#2#0#0#0 - +#0#9'TTabSheet'#15'SeeAlsoTabSheet'#7'Caption'#6#15'SeeAlsoTabSheet'#12'Clie' - +'ntHeight'#2'd'#11'ClientWidth'#3#170#2#0#5'TMemo'#11'SeeAlsoMemo'#4'Left'#2 - +#0#6'Height'#2'd'#3'Top'#2#0#5'Width'#3#170#2#5'Align'#7#8'alClient'#13'Line' - +'s.Strings'#1#6#11'SeeAlsoMemo'#0#8'OnChange'#7#17'SeeAlsoMemoChange'#13'OnE' - +'ditingDone'#7#22'SeeAlsoMemoEditingDone'#8'TabOrder'#2#0#0#0#0#9'TTabSheet' - +#15'ExampleTabSheet'#7'Caption'#6#15'ExampleTabSheet'#12'ClientHeight'#2'd' - +#11'ClientWidth'#3#170#2#0#5'TEdit'#11'ExampleEdit'#4'Left'#2#0#6'Height'#2 - +#21#3'Top'#2#0#5'Width'#3#168#2#5'Align'#7#5'alTop'#10'AutoSelect'#8#19'Bord' - +'erSpacing.Right'#2#2#8'OnChange'#7#17'ExampleEditChange'#13'OnEditingDone'#7 - +#22'ExampleEditEditingDone'#8'TabOrder'#2#0#4'Text'#6#11'ExampleEdit'#0#0#7 - +'TButton'#19'BrowseExampleButton'#21'AnchorSideTop.Control'#7#11'ExampleEdit' - +#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#15'Exam' - +'pleTabSheet'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#3#31#2#6'Heigh' - +'t'#2#23#3'Top'#2#27#5'Width'#3#133#0#7'Anchors'#11#5'akTop'#7'akRight'#0#8 - +'AutoSize'#9#20'BorderSpacing.Around'#2#6#7'Caption'#6#19'BrowseExampleButto' - +'n'#7'OnClick'#7#24'BrowseExampleButtonClick'#8'TabOrder'#2#1#0#0#0#0#6'TPan' - +'el'#12'LeftBtnPanel'#4'Left'#2#0#6'Height'#2'~'#3'Top'#2#0#5'Width'#2'?'#5 - +'Align'#7#6'alLeft'#8'AutoSize'#9#10'BevelOuter'#7#6'bvNone'#18'ChildSizing.' - +'Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLine' - +#2#3#12'ClientHeight'#2'~'#11'ClientWidth'#2'?'#11'FullRepaint'#8#14'ParentS' - +'howHint'#8#8'ShowHint'#9#8'TabOrder'#2#1#0#12'TSpeedButton'#16'BoldFormatBu' - +'tton'#4'Left'#2#0#6'Height'#2#23#3'Top'#2#0#5'Width'#2#20#21'Constraints.Ma' - +'xHeight'#2#23#20'Constraints.MaxWidth'#2#20#5'Color'#7#9'clBtnFace'#9'NumGl' - +'yphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#0#0#12'TSpeedButton'#18'Italic' - +'FormatButton'#3'Tag'#2#1#4'Left'#2#20#6'Height'#2#23#3'Top'#2#0#5'Width'#2 - +#20#21'Constraints.MaxHeight'#2#23#20'Constraints.MaxWidth'#2#20#5'Color'#7#9 - +'clBtnFace'#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#0#0#12'TSpee' - +'dButton'#21'UnderlineFormatButton'#3'Tag'#2#2#4'Left'#2'('#6'Height'#2#23#3 - +'Top'#2#0#5'Width'#2#20#21'Constraints.MaxHeight'#2#23#20'Constraints.MaxWid' - +'th'#2#20#5'Color'#7#9'clBtnFace'#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatBut' - +'tonClick'#0#0#12'TSpeedButton'#18'InsertVarTagButton'#3'Tag'#2#5#4'Left'#2#0 - +#6'Height'#2#23#3'Top'#2#23#5'Width'#2#20#21'Constraints.MaxHeight'#2#23#20 + 'TPF0'#12'TFPDocEditor'#11'FPDocEditor'#4'Left'#3#6#8#6'Height'#2'~'#3'Top'#3 + +#249#2#5'Width'#3#241#2#7'Caption'#6#12'FPDoc editor'#12'ClientHeight'#2'~' + +#11'ClientWidth'#3#241#2#10'KeyPreview'#9#8'OnCreate'#7#10'FormCreate'#9'OnD' + +'estroy'#7#11'FormDestroy'#9'OnKeyDown'#7#11'FormKeyDown'#10'LCLVersion'#6#6 + +'0.9.29'#0#12'TPageControl'#11'PageControl'#4'Left'#2'?'#6'Height'#2'~'#3'To' + +'p'#2#0#5'Width'#3#178#2#10'ActivePage'#7#10'TopicSheet'#5'Align'#7#8'alClie' + +'nt'#8'TabIndex'#2#6#8'TabOrder'#2#0#11'TabPosition'#7#8'tpBottom'#8'OnChang' + +'e'#7#17'PageControlChange'#13'OnPageChanged'#7#17'PageControlChange'#0#9'TT' + +'abSheet'#13'ShortTabSheet'#7'Caption'#6#13'ShortTabSheet'#12'ClientHeight'#2 + +'b'#11'ClientWidth'#3#170#2#0#6'TLabel'#9'LinkLabel'#21'AnchorSideTop.Contro' + +'l'#7#8'LinkEdit'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#6#6'Height' + +#2#16#3'Top'#2#28#5'Width'#2'3'#17'BorderSpacing.Top'#2#6#7'Caption'#6#9'Lin' + +'kLabel'#11'ParentColor'#8#0#0#6'TLabel'#10'ShortLabel'#22'AnchorSideLeft.Co' + +'ntrol'#7#13'ShortTabSheet'#21'AnchorSideTop.Control'#7#9'ShortEdit'#18'Anch' + +'orSideTop.Side'#7#9'asrCenter'#4'Left'#2#6#6'Height'#2#16#3'Top'#2#3#5'Widt' + +'h'#2'9'#18'BorderSpacing.Left'#2#6#7'Caption'#6#10'ShortLabel'#11'ParentCol' + +'or'#8#0#0#5'TEdit'#9'ShortEdit'#22'AnchorSideLeft.Control'#7#10'ShortLabel' + +#19'AnchorSideLeft.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#13'Sho' + +'rtTabSheet'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2'E'#6'Height'#2 + +#23#3'Top'#2#0#5'Width'#3'c'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0 + +#10'AutoSelect'#8#18'BorderSpacing.Left'#2#6#19'BorderSpacing.Right'#2#2#8'O' + +'nChange'#7#15'ShortEditChange'#13'OnEditingDone'#7#20'ShortEditEditingDone' + +#8'TabOrder'#2#0#4'Text'#6#9'ShortEdit'#0#0#7'TButton'#12'CreateButton'#21'A' + +'nchorSideTop.Control'#7#8'LinkEdit'#18'AnchorSideTop.Side'#7#9'asrBottom'#4 + +'Left'#2#6#6'Height'#2#25#3'Top'#2'6'#5'Width'#2'`'#8'AutoSize'#9#20'BorderS' + +'pacing.Around'#2#6#7'Caption'#6#12'CreateButton'#7'OnClick'#7#17'CreateButt' + +'onClick'#8'TabOrder'#2#1#0#0#5'TEdit'#8'LinkEdit'#22'AnchorSideLeft.Control' + +#7#9'LinkLabel'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Cont' + +'rol'#7#9'ShortEdit'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRigh' + +'t.Control'#7#13'ShortTabSheet'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Le' + +'ft'#2'?'#6'Height'#2#23#3'Top'#2#25#5'Width'#3'i'#2#7'Anchors'#11#5'akTop'#6 + +'akLeft'#7'akRight'#0#10'AutoSelect'#8#18'BorderSpacing.Left'#2#6#17'BorderS' + +'pacing.Top'#2#2#19'BorderSpacing.Right'#2#2#8'OnChange'#7#14'LinkEditChange' + +#13'OnEditingDone'#7#19'LinkEditEditingDone'#8'TabOrder'#2#2#4'Text'#6#8'Lin' + +'kEdit'#0#0#0#9'TTabSheet'#17'InheritedTabSheet'#7'Caption'#6#17'InheritedTa' + +'bSheet'#12'ClientHeight'#2'b'#11'ClientWidth'#3#170#2#0#6'TLabel'#19'Inheri' + +'tedShortLabel'#4'Left'#2#0#6'Height'#2#16#3'Top'#2#2#5'Width'#3#170#2#5'Ali' + +'gn'#7#5'alTop'#17'BorderSpacing.Top'#2#2#7'Caption'#6#19'InheritedShortLabe' + +'l'#11'ParentColor'#8#0#0#5'TEdit'#18'InheritedShortEdit'#22'AnchorSideLeft.' + +'Control'#7#17'InheritedTabSheet'#21'AnchorSideTop.Control'#7#19'InheritedSh' + +'ortLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control' + +#7#17'InheritedTabSheet'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#0 + +#6'Height'#2#23#3'Top'#2#20#5'Width'#3#170#2#7'Anchors'#11#5'akTop'#6'akLeft' + +#7'akRight'#0#17'BorderSpacing.Top'#2#2#8'ReadOnly'#9#8'TabOrder'#2#0#4'Text' + +#6#18'InheritedShortEdit'#0#0#7'TButton'#21'MoveToInheritedButton'#21'Anchor' + +'SideTop.Control'#7#18'InheritedShortEdit'#18'AnchorSideTop.Side'#7#9'asrBot' + +'tom'#4'Left'#2#0#6'Height'#2#25#3'Top'#2'1'#5'Width'#3#153#0#8'AutoSize'#9 + +#20'BorderSpacing.Around'#2#6#7'Caption'#6#21'MoveToInheritedButton'#7'OnCli' + +'ck'#7#26'MoveToInheritedButtonClick'#8'TabOrder'#2#1#0#0#7'TButton'#23'Copy' + +'FromInheritedButton'#22'AnchorSideLeft.Control'#7#21'MoveToInheritedButton' + +#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#21'MoveT' + +'oInheritedButton'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#3#163#0#6'H' + +'eight'#2#25#3'Top'#2'1'#5'Width'#3#165#0#8'AutoSize'#9#18'BorderSpacing.Lef' + +'t'#2#10#7'Caption'#6#23'CopyFromInheritedButton'#7'OnClick'#7#28'CopyFromIn' + +'heritedButtonClick'#8'TabOrder'#2#2#0#0#7'TButton'#24'AddLinkToInheritedBut' + +'ton'#22'AnchorSideLeft.Control'#7#23'CopyFromInheritedButton'#19'AnchorSide' + +'Left.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7#23'CopyFromInheritedB' + +'utton'#4'Left'#3'R'#1#6'Height'#2#25#3'Top'#2'1'#5'Width'#3#167#0#8'AutoSiz' + +'e'#9#18'BorderSpacing.Left'#2#10#7'Caption'#6#24'AddLinkToInheritedButton'#7 + +'OnClick'#7#29'AddLinkToInheritedButtonClick'#8'TabOrder'#2#3#0#0#0#9'TTabSh' + +'eet'#13'DescrTabSheet'#7'Caption'#6#13'DescrTabSheet'#12'ClientHeight'#2'b' + +#11'ClientWidth'#3#170#2#0#5'TMemo'#9'DescrMemo'#4'Left'#2#0#6'Height'#2'^'#3 + +'Top'#2#0#5'Width'#3#168#2#5'Align'#7#8'alClient'#19'BorderSpacing.Right'#2#2 + +#20'BorderSpacing.Bottom'#2#4#13'Lines.Strings'#1#6#9'DescrMemo'#0#8'OnChang' + ,'e'#7#15'DescrMemoChange'#13'OnEditingDone'#7#20'DescrMemoEditingDone'#8'Tab' + +'Order'#2#0#0#0#0#9'TTabSheet'#14'ErrorsTabSheet'#7'Caption'#6#14'ErrorsTabS' + +'heet'#12'ClientHeight'#2'b'#11'ClientWidth'#3#170#2#0#5'TMemo'#10'ErrorsMem' + +'o'#4'Left'#2#0#6'Height'#2'^'#3'Top'#2#0#5'Width'#3#168#2#5'Align'#7#8'alCl' + +'ient'#19'BorderSpacing.Right'#2#2#20'BorderSpacing.Bottom'#2#4#13'Lines.Str' + +'ings'#1#6#10'ErrorsMemo'#0#8'OnChange'#7#16'ErrorsMemoChange'#13'OnEditingD' + +'one'#7#21'ErrorsMemoEditingDone'#8'TabOrder'#2#0#0#0#0#9'TTabSheet'#15'SeeA' + +'lsoTabSheet'#7'Caption'#6#15'SeeAlsoTabSheet'#12'ClientHeight'#2'b'#11'Clie' + +'ntWidth'#3#170#2#0#5'TMemo'#11'SeeAlsoMemo'#4'Left'#2#0#6'Height'#2'b'#3'To' + +'p'#2#0#5'Width'#3#170#2#5'Align'#7#8'alClient'#13'Lines.Strings'#1#6#11'See' + +'AlsoMemo'#0#8'OnChange'#7#17'SeeAlsoMemoChange'#13'OnEditingDone'#7#22'SeeA' + +'lsoMemoEditingDone'#8'TabOrder'#2#0#0#0#0#9'TTabSheet'#15'ExampleTabSheet'#7 + +'Caption'#6#15'ExampleTabSheet'#12'ClientHeight'#2'b'#11'ClientWidth'#3#170#2 + +#0#5'TEdit'#11'ExampleEdit'#4'Left'#2#0#6'Height'#2#23#3'Top'#2#0#5'Width'#3 + +#168#2#5'Align'#7#5'alTop'#10'AutoSelect'#8#19'BorderSpacing.Right'#2#2#8'On' + +'Change'#7#17'ExampleEditChange'#13'OnEditingDone'#7#22'ExampleEditEditingDo' + +'ne'#8'TabOrder'#2#0#4'Text'#6#11'ExampleEdit'#0#0#7'TButton'#19'BrowseExamp' + +'leButton'#21'AnchorSideTop.Control'#7#11'ExampleEdit'#18'AnchorSideTop.Side' + +#7#9'asrBottom'#23'AnchorSideRight.Control'#7#15'ExampleTabSheet'#20'AnchorS' + +'ideRight.Side'#7#9'asrBottom'#4'Left'#3#20#2#6'Height'#2#25#3'Top'#2#29#5'W' + +'idth'#3#144#0#7'Anchors'#11#5'akTop'#7'akRight'#0#8'AutoSize'#9#20'BorderSp' + +'acing.Around'#2#6#7'Caption'#6#19'BrowseExampleButton'#7'OnClick'#7#24'Brow' + +'seExampleButtonClick'#8'TabOrder'#2#1#0#0#0#9'TTabSheet'#10'TopicSheet'#7'C' + +'aption'#6#6'Topics'#12'ClientHeight'#2'b'#11'ClientWidth'#3#170#2#0#6'TPane' + +'l'#6'Panel1'#4'Left'#3#0#2#6'Height'#2'b'#3'Top'#2#0#5'Width'#3#170#0#5'Ali' + +'gn'#7#7'alRight'#18'BorderSpacing.Left'#2#5#10'BevelOuter'#7#6'bvNone'#12'C' + +'lientHeight'#2'b'#11'ClientWidth'#3#170#0#8'TabOrder'#2#0#0#6'TPanel'#6'Pan' + +'el2'#4'Left'#2#0#6'Height'#2#25#3'Top'#2#0#5'Width'#3#170#0#5'Align'#7#5'al' + +'Top'#8'AutoSize'#9#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2#25#11'Clie' + +'ntWidth'#3#170#0#8'TabOrder'#2#0#0#7'TButton'#14'NewTopicButton'#4'Left'#2 + +'x'#6'Height'#2#25#3'Top'#2#0#5'Width'#2'2'#5'Align'#7#7'alRight'#8'AutoSize' + +#9#7'Caption'#6#3'New'#7'OnClick'#7#19'NewTopicButtonClick'#8'TabOrder'#2#0#0 + +#0#5'TEdit'#16'NewTopicNameEdit'#4'Left'#2#0#6'Height'#2#25#3'Top'#2#0#5'Wid' + +'th'#2's'#5'Align'#7#8'alClient'#19'BorderSpacing.Right'#2#5#7'OnEnter'#7#17 + +'TopicControlEnter'#8'TabOrder'#2#1#0#0#0#8'TListBox'#12'TopicListBox'#4'Lef' + +'t'#2#0#6'Height'#2'D'#3'Top'#2#30#5'Width'#3#170#0#5'Align'#7#8'alClient'#17 + +'BorderSpacing.Top'#2#5#10'ItemHeight'#2#0#7'OnClick'#7#17'TopicListBoxClick' + +#7'OnEnter'#7#17'TopicControlEnter'#8'TabOrder'#2#1#0#0#0#6'TPanel'#6'Panel3' + +#4'Left'#2#0#6'Height'#2'b'#3'Top'#2#0#5'Width'#3#251#1#5'Align'#7#8'alClien' + +'t'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'b'#11'ClientWidth'#3#251#1 + +#8'TabOrder'#2#1#0#5'TEdit'#10'TopicShort'#4'Left'#2#0#6'Height'#2#23#3'Top' + +#2#0#5'Width'#3#251#1#5'Align'#7#5'alTop'#10'AutoSelect'#8#8'OnChange'#7#16 + +'TopicDescrChange'#7'OnEnter'#7#17'TopicControlEnter'#8'TabOrder'#2#0#0#0#5 + +'TMemo'#10'TopicDescr'#4'Left'#2#0#6'Height'#2'F'#3'Top'#2#28#5'Width'#3#251 + +#1#5'Align'#7#8'alClient'#17'BorderSpacing.Top'#2#5#8'OnChange'#7#16'TopicDe' + +'scrChange'#7'OnEnter'#7#17'TopicControlEnter'#8'TabOrder'#2#1#0#0#0#0#0#6'T' + +'Panel'#12'LeftBtnPanel'#4'Left'#2#0#6'Height'#2'~'#3'Top'#2#0#5'Width'#2'?' + +#5'Align'#7#6'alLeft'#8'AutoSize'#9#10'BevelOuter'#7#6'bvNone'#18'ChildSizin' + +'g.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.ControlsPerLin' + +'e'#2#3#12'ClientHeight'#2'~'#11'ClientWidth'#2'?'#11'FullRepaint'#8#14'Pare' + +'ntShowHint'#8#8'ShowHint'#9#8'TabOrder'#2#1#0#12'TSpeedButton'#16'BoldForma' + +'tButton'#4'Left'#2#0#6'Height'#2#23#3'Top'#2#0#5'Width'#2#20#21'Constraints' + +'.MaxHeight'#2#23#20'Constraints.MaxWidth'#2#20#5'Color'#7#9'clBtnFace'#9'Nu' + +'mGlyphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#0#0#12'TSpeedButton'#18'Ita' + +'licFormatButton'#3'Tag'#2#1#4'Left'#2#20#6'Height'#2#23#3'Top'#2#0#5'Width' + +#2#20#21'Constraints.MaxHeight'#2#23#20'Constraints.MaxWidth'#2#20#5'Color'#7 + +#9'clBtnFace'#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#0#0#12'TSp' + +'eedButton'#21'UnderlineFormatButton'#3'Tag'#2#2#4'Left'#2'('#6'Height'#2#23 + +#3'Top'#2#0#5'Width'#2#20#21'Constraints.MaxHeight'#2#23#20'Constraints.MaxW' + +'idth'#2#20#5'Color'#7#9'clBtnFace'#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatB' + +'uttonClick'#0#0#12'TSpeedButton'#18'InsertVarTagButton'#3'Tag'#2#5#4'Left'#2 + +#0#6'Height'#2#23#3'Top'#2#23#5'Width'#2#20#21'Constraints.MaxHeight'#2#23#20 +'Constraints.MaxWidth'#2#20#5'Color'#7#9'clBtnFace'#9'NumGlyphs'#2#0#7'OnCli' +'ck'#7#17'FormatButtonClick'#0#0#12'TSpeedButton'#26'InsertParagraphSpeedBut' - +'ton'#3'Tag'#2#6#4'Left'#2#20#6'Height'#2#23#3'Top'#2#23#5'Width'#2#20#21'Co' + ,'ton'#3'Tag'#2#6#4'Left'#2#20#6'Height'#2#23#3'Top'#2#23#5'Width'#2#20#21'Co' +'nstraints.MaxHeight'#2#23#20'Constraints.MaxWidth'#2#20#7'Caption'#6#1'P'#5 +'Color'#7#9'clBtnFace'#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#0 +#0#12'TSpeedButton'#21'InsertLinkSpeedButton'#4'Left'#2'('#6'Height'#2#23#3 @@ -129,7 +152,7 @@ LazarusResources.Add('TFPDocEditor','FORMDATA',[ +'Width'#2#20#21'Constraints.MaxHeight'#2#23#20'Constraints.MaxWidth'#2#20#5 +'Color'#7#9'clBtnFace'#9'NumGlyphs'#2#0#7'OnClick'#7#17'FormatButtonClick'#8 +'ShowHint'#9#14'ParentShowHint'#8#0#0#12'TSpeedButton'#10'SaveButton'#19'Anc' - ,'horSideLeft.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#29#3'Top'#2'a'#5'W' + +'horSideLeft.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#29#3'Top'#2'a'#5'W' +'idth'#2'?'#5'Align'#7#8'alBottom'#7'Caption'#6#4'Save'#5'Color'#7#9'clBtnFa' +'ce'#9'NumGlyphs'#2#0#7'OnClick'#7#15'SaveButtonClick'#0#0#0#11'TOpenDialog' +#10'OpenDialog'#5'Title'#6#17'Open example file'#6'Filter'#6#28'pascal file|' diff --git a/ide/fpdoceditwindow.pas b/ide/fpdoceditwindow.pas index 3460feec1e..92945db574 100644 --- a/ide/fpdoceditwindow.pas +++ b/ide/fpdoceditwindow.pas @@ -63,6 +63,12 @@ type AddLinkToInheritedButton: TButton; BoldFormatButton: TSpeedButton; BrowseExampleButton: TButton; + TopicShort: TEdit; + TopicDescr: TMemo; + Panel3: TPanel; + TopicListBox: TListBox; + NewTopicNameEdit: TEdit; + NewTopicButton: TButton; ControlDocker: TLazControlDocker; CopyFromInheritedButton: TButton; CreateButton: TButton; @@ -84,6 +90,8 @@ type LeftBtnPanel: TPanel; LinkEdit: TEdit; LinkLabel: TLabel; + Panel1: TPanel; + Panel2: TPanel; SaveButton: TSpeedButton; SeeAlsoMemo: TMemo; MoveToInheritedButton: TButton; @@ -95,6 +103,7 @@ type ShortTabSheet: TTabSheet; InsertPrintShortSpeedButton: TSpeedButton; InsertURLTagSpeedButton: TSpeedButton; + TopicSheet: TTabSheet; UnderlineFormatButton: TSpeedButton; procedure AddLinkToInheritedButtonClick(Sender: TObject); procedure ApplicationIdle(Sender: TObject; var Done: Boolean); @@ -116,12 +125,16 @@ type procedure LinkEditChange(Sender: TObject); procedure LinkEditEditingDone(Sender: TObject); procedure MoveToInheritedButtonClick(Sender: TObject); + procedure NewTopicButtonClick(Sender: TObject); procedure PageControlChange(Sender: TObject); procedure SaveButtonClick(Sender: TObject); procedure SeeAlsoMemoChange(Sender: TObject); procedure SeeAlsoMemoEditingDone(Sender: TObject); procedure ShortEditChange(Sender: TObject); procedure ShortEditEditingDone(Sender: TObject); + procedure TopicControlEnter(Sender: TObject); + procedure TopicDescrChange(Sender: TObject); + procedure TopicListBoxClick(Sender: TObject); private FCaretXY: TPoint; FModified: Boolean; @@ -160,6 +173,12 @@ type function GetCurrentModuleName: string; procedure JumpToError(Item : TFPDocItem; LineCol: TPoint); function GUIModified: boolean; + private + FLastTopicControl: TControl; + FInTopicSetup: Boolean; + FCurrentTopic: String; + procedure FillTopicCombo; + function TopicDocFile(CreateIfNoExists: Boolean = False): TLazFPDocFile; public procedure Reset; procedure InvalidateChain; @@ -266,6 +285,8 @@ begin InsertRemarkButton.LoadGlyphFromLazarusResource('insertremark'); InsertURLTagSpeedButton.LoadGlyphFromLazarusResource('formatunderline'); SaveButton.LoadGlyphFromLazarusResource('laz_save'); + + FInTopicSetup := false; end; procedure TFPDocEditor.FormDestroy(Sender: TObject); @@ -296,6 +317,12 @@ procedure TFPDocEditor.FormatButtonClick(Sender: TObject); DescrMemo.SelText := StartTag + DescrMemo.SelText + EndTag else if PageControl.ActivePage = ErrorsTabSheet then ErrorsMemo.SelText := StartTag + ErrorsMemo.SelText + EndTag + else if PageControl.ActivePage = TopicSheet then begin + if (FLastTopicControl = TopicShort) then + TopicShort.SelText := StartTag + TopicShort.SelText + EndTag; + if (FLastTopicControl = TopicDescr) then + TopicDescr.SelText := StartTag + TopicDescr.SelText + EndTag; + end else exit; Modified:=true; @@ -356,6 +383,13 @@ begin SeeAlsoMemo.SelText := LinkSrc; if PageControl.ActivePage = ErrorsTabSheet then ErrorsMemo.SelText := LinkSrc; + if PageControl.ActivePage = TopicSheet then begin + if (FLastTopicControl = TopicShort) then + TopicShort.SelText := LinkSrc; + if (FLastTopicControl = TopicDescr) then + TopicDescr.SelText := LinkSrc; + end; + Modified:=true; end; @@ -450,6 +484,23 @@ begin end; end; +procedure TFPDocEditor.NewTopicButtonClick(Sender: TObject); +var + Dfile: TLazFPDocFile; +begin + if NewTopicNameEdit.Text = '' then exit; + Dfile := TopicDocFile(True); + if not assigned(DFile) then exit; + if DFile.GetModuleTopic(NewTopicNameEdit.Text) = nil then begin + DFile.CreateModuleTopic(NewTopicNameEdit.Text); + CodeHelpBoss.SaveFPDocFile(DFile); + end; + FillTopicCombo; + TopicListBox.ItemIndex := TopicListBox.Items.IndexOf(NewTopicNameEdit.Text); + TopicShort.SetFocus; + TopicListBoxClick(Sender); +end; + procedure TFPDocEditor.PageControlChange(Sender: TObject); begin UpdateButtons; @@ -482,6 +533,51 @@ begin Modified:=true; end; +procedure TFPDocEditor.TopicControlEnter(Sender: TObject); +begin + FLastTopicControl := TControl(Sender); +end; + +procedure TFPDocEditor.TopicDescrChange(Sender: TObject); +begin + if FInTopicSetup then exit; + Modified := True; + SaveButton.Enabled := True; +end; + +procedure TFPDocEditor.TopicListBoxClick(Sender: TObject); +var + DFile: TLazFPDocFile; + Node: TDOMNode; + Child: TDOMNode; +begin + if (FCurrentTopic <> '') and Modified then + Save; + + FInTopicSetup := True; + TopicShort.Clear; + TopicDescr.Clear; + FInTopicSetup := false; + + FCurrentTopic := ''; + if TopicListBox.ItemIndex < 0 then exit; + Dfile := TopicDocFile(True); + if DFile = nil then exit; + + Node := DFile.GetModuleTopic(TopicListBox.Items[TopicListBox.ItemIndex]); + if Node = nil then exit; + FCurrentTopic := TopicListBox.Items[TopicListBox.ItemIndex]; + + FInTopicSetup := True; + Child := Node.FindNode('short'); + if Child <> nil then + TopicShort.Text := DFile.GetChildValuesAsString(Child); + Child := Node.FindNode('descr'); + if Child <> nil then + TopicDescr.Text := DFile.GetChildValuesAsString(Child); + FInTopicSetup := false; +end; + function TFPDocEditor.GetContextTitle(Element: TCodeHelpElement): string; // get codetools path. for example: TButton.Align begin @@ -793,7 +889,8 @@ begin HasEdit:=(PageControl.ActivePage = ShortTabSheet) or (PageControl.ActivePage = DescrTabSheet) or (PageControl.ActivePage = SeeAlsoTabSheet) - or (PageControl.ActivePage = ErrorsTabSheet); + or (PageControl.ActivePage = ErrorsTabSheet) + or (PageControl.ActivePage = TopicSheet); BoldFormatButton.Enabled:=HasEdit; ItalicFormatButton.Enabled:=HasEdit; UnderlineFormatButton.Enabled:=HasEdit; @@ -846,6 +943,40 @@ begin or (ExampleEdit.Text<>FOldVisualValues[fpdiExample]); end; +procedure TFPDocEditor.FillTopicCombo; +var + c, i: LongInt; + DFile: TLazFPDocFile; +begin + FCurrentTopic := ''; + FInTopicSetup := True; + TopicListBox.Clear; + TopicShort.Clear; + TopicDescr.Clear; + FInTopicSetup := false; + Dfile := TopicDocFile; + if not assigned(DFile) then exit; + c := DFile.GetModuleTopicCount; + for i := 0 to c - 1 do begin + TopicListBox.Items.Add(DFile.GetModuleTopicName(i)); + end; +end; + +function TFPDocEditor.TopicDocFile(CreateIfNoExists: Boolean): TLazFPDocFile; +var + CacheWasUsed : Boolean; + AnOwner: TObject; + DFileName: String; +begin + if assigned(DocFile) then + Result := DocFile + else begin + DFileName := CodeHelpBoss.GetFPDocFilenameForSource(SourceFilename, true, CacheWasUsed, AnOwner, CreateIfNoExists); + if CodeHelpBoss.LoadFPDocFile(DFileName, [chofUpdateFromDisk], Result, CacheWasUsed) <> chprSuccess then + Result := nil; + end; +end; + procedure TFPDocEditor.Reset; begin FreeAndNil(fChain); @@ -890,6 +1021,7 @@ begin fSourceFilename:=NewSrcFilename; Reset; + FillTopicCombo; InvalidateChain; end; @@ -921,6 +1053,8 @@ end; procedure TFPDocEditor.Save(CheckGUI: boolean); var Values: TFPDocElementValues; + DFile: TLazFPDocFile; + Node: TDOMNode; begin //DebugLn(['TFPDocEditor.Save FModified=',FModified]); if (not FModified) @@ -930,17 +1064,34 @@ begin end; FModified:=false; SaveButton.Enabled:=false; + + DFile := nil; + if FCurrentTopic <> '' then begin + Dfile := TopicDocFile(True); + if DFile <> nil then begin + Node := DFile.GetModuleTopic(FCurrentTopic); + if Node <> nil then begin + DFile.SetChildValue(Node, 'short', TopicShort.Text); + DFile.SetChildValue(Node, 'descr', TopicDescr.Text); + end; + end; + end; if (fChain=nil) or (fChain.Count=0) then begin - DebugLn(['TFPDocEditor.Save failed: no chain']); + if (FCurrentTopic <> '') and (DFile <> nil) then CodeHelpBoss.SaveFPDocFile(DFile) + else DebugLn(['TFPDocEditor.Save failed: no chain']); exit; end; if not fChain.IsValid then begin - DebugLn(['TFPDocEditor.Save failed: chain not valid']); + if (FCurrentTopic <> '') and (DFile <> nil) then CodeHelpBoss.SaveFPDocFile(DFile) + else DebugLn(['TFPDocEditor.Save failed: chain not valid']); exit; end; - Values:=GetGUIValues; - if not WriteNode(fChain[0],Values,true) then begin - DebugLn(['TLazDocForm.Save WriteNode FAILED']); + if (fChain[0].FPDocFile = nil) and (DFile <> nil) then CodeHelpBoss.SaveFPDocFile(DFile) + else begin + Values:=GetGUIValues; + if not WriteNode(fChain[0],Values,true) then begin + DebugLn(['TLazDocForm.Save WriteNode FAILED']); + end; end; end;