examples: idehelp: some defaults

git-svn-id: trunk@35137 -
This commit is contained in:
mattias 2012-02-04 21:57:28 +00:00
parent 3b39f0f955
commit 3c9ca0105a
2 changed files with 61 additions and 43 deletions

View File

@ -62,11 +62,11 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
end
object DirectivesTabSheet: TTabSheet
Caption = 'DirectivesTabSheet'
ClientHeight = 435
ClientHeight = 442
ClientWidth = 761
object DirectivesNoteLabel: TLabel
Left = 6
Height = 17
Height = 15
Top = 6
Width = 749
Align = alTop
@ -80,9 +80,9 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
AnchorSideTop.Control = DirectivesNoteLabel
AnchorSideTop.Side = asrBottom
Left = 6
Height = 18
Top = 29
Width = 186
Height = 22
Top = 27
Width = 170
BorderSpacing.Around = 6
Caption = 'DirectivesEnableCheckBox'
TabOrder = 0
@ -91,22 +91,22 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
AnchorSideTop.Control = DirectivesEnableCheckBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 125
Top = 53
Height = 130
Top = 55
Width = 749
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6
Caption = 'FPCDirectivesGroupBox'
ClientHeight = 103
ClientWidth = 741
ClientHeight = 114
ClientWidth = 745
Constraints.MinHeight = 70
TabOrder = 1
object FPCDirectivesMemo: TMemo
Left = 0
Height = 103
Height = 114
Top = 0
Width = 741
Width = 745
Align = alClient
Lines.Strings = (
'FPCDirectivesMemo'
@ -117,20 +117,20 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
object IDEDirectivesGroupBox: TGroupBox
Left = 6
Height = 234
Top = 195
Top = 202
Width = 749
Align = alBottom
BorderSpacing.Around = 6
Caption = 'IDEDirectivesGroupBox'
ClientHeight = 212
ClientWidth = 741
ClientHeight = 218
ClientWidth = 745
Constraints.MinHeight = 70
TabOrder = 2
object IDEDirectivesMemo: TMemo
Left = 0
Height = 212
Height = 218
Top = 0
Width = 741
Width = 745
Align = alClient
Lines.Strings = (
'IDEDirectivesMemo'
@ -142,7 +142,7 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
Cursor = crVSplit
Left = 0
Height = 5
Top = 184
Top = 191
Width = 761
Align = alBottom
ResizeAnchor = akBottom
@ -150,26 +150,27 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
end
object MessagesTabSheet: TTabSheet
Caption = 'MessagesTabSheet'
ClientHeight = 435
ClientHeight = 442
ClientWidth = 761
object MessagesNoteLabel: TLabel
Left = 6
Height = 17
Height = 15
Top = 6
Width = 749
Align = alTop
BorderSpacing.Around = 6
Caption = 'MessagesNoteLabel'
ParentColor = False
WordWrap = True
end
object MessagesEnableCheckBox: TCheckBox
AnchorSideLeft.Control = MessagesTabSheet
AnchorSideTop.Control = MessagesNoteLabel
AnchorSideTop.Side = asrBottom
Left = 6
Height = 18
Top = 29
Width = 185
Height = 22
Top = 27
Width = 171
BorderSpacing.Around = 6
Caption = 'MessagesEnableCheckBox'
TabOrder = 0
@ -177,26 +178,27 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
end
object ContextTabSheet: TTabSheet
Caption = 'ContextTabSheet'
ClientHeight = 435
ClientHeight = 442
ClientWidth = 761
object ContextNoteLabel: TLabel
Left = 6
Height = 17
Height = 15
Top = 6
Width = 749
Align = alTop
BorderSpacing.Around = 6
Caption = 'ContextNoteLabel'
ParentColor = False
WordWrap = True
end
object ContextEnableCheckBox: TCheckBox
AnchorSideLeft.Control = ContextTabSheet
AnchorSideTop.Control = ContextNoteLabel
AnchorSideTop.Side = asrBottom
Left = 6
Height = 18
Top = 29
Width = 174
Height = 22
Top = 27
Width = 159
BorderSpacing.Around = 6
Caption = 'ContextEnableCheckBox'
TabOrder = 0
@ -205,8 +207,8 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
AnchorSideTop.Control = ContextEnableCheckBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 376
Top = 53
Height = 381
Top = 55
Width = 749
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
@ -219,11 +221,11 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
end
object ClassesTabSheet: TTabSheet
Caption = 'ClassesTabSheet'
ClientHeight = 435
ClientHeight = 442
ClientWidth = 761
object ClassesNoteLabel: TLabel
Left = 6
Height = 17
Height = 15
Top = 6
Width = 749
Align = alTop
@ -237,9 +239,9 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
AnchorSideTop.Control = ClassesNoteLabel
AnchorSideTop.Side = asrBottom
Left = 6
Height = 18
Top = 29
Width = 130
Height = 22
Top = 27
Width = 121
BorderSpacing.Around = 6
Caption = 'ClassesCheckBox'
TabOrder = 0
@ -247,11 +249,11 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
end
object PascalSourcesTabSheet: TTabSheet
Caption = 'PascalSourcesTabSheet'
ClientHeight = 435
ClientHeight = 442
ClientWidth = 761
object PascalSourcesNoteLabel: TLabel
Left = 6
Height = 17
Height = 15
Top = 6
Width = 749
Align = alTop
@ -265,9 +267,9 @@ object MyHelpSetupDialog: TMyHelpSetupDialog
AnchorSideTop.Control = PascalSourcesNoteLabel
AnchorSideTop.Side = asrBottom
Left = 6
Height = 18
Top = 29
Width = 220
Height = 22
Top = 27
Width = 203
BorderSpacing.Around = 6
Caption = 'PascalSourcesEnabledCheckBox'
TabOrder = 0

View File

@ -88,6 +88,8 @@ type
FKeywordToText: TStrings;
procedure SetKeywordToText(AValue: TStrings);
public
const
DefaultKeyWordToText = 'procedure=Named code block';
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
function GetNodesForKeyword(const HelpKeyword: string;
@ -117,6 +119,9 @@ type
procedure SetFPCDirectiveToText(AValue: TStrings);
procedure SetIDEDirectiveToText(AValue: TStrings);
public
const
DefaultFPCDirectiveToText = 'mode=Set the syntax, e.g. fpc, objfpc, delphi, macpas, tp';
DefaultIDEDirectiveToText = 'H=Use {%H-} to hide any compiler message at that source position in IDE messages window.';
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
function GetNodesForDirective(const HelpDirective: string;
@ -170,6 +175,8 @@ type
FContextToMessage: TStrings;
procedure SetContextToMessage(AValue: TStrings);
public
const
DefaultContextToMessage = '3456=A help text for helpcontext 3456';
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
function GetNodesForContext(HelpContext: THelpContext;
@ -640,7 +647,7 @@ constructor TMyContextHelpDatabase.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FContextToMessage:=TStringList.Create;
ContextToMessage.Add('3456=A help text for helpcontext 3456');
ContextToMessage.Text:=DefaultContextToMessage;
end;
destructor TMyContextHelpDatabase.Destroy;
@ -698,6 +705,8 @@ procedure TMyContextHelpDatabase.LoadFromConfig(Config: TConfigStorage);
begin
inherited LoadFromConfig(Config);
Config.GetValue('Contexts',ContextToMessage);
if ContextToMessage.Count=0 then
ContextToMessage.Text:=DefaultContextToMessage;
end;
procedure TMyContextHelpDatabase.SaveToConfig(Config: TConfigStorage);
@ -779,9 +788,9 @@ begin
inherited Create(TheOwner);
Enabled:=true;
FFPCDirectiveToText:=TStringList.Create;
FPCDirectiveToText.Add('mode=Set the syntax, e.g. fpc, objfpc, delphi, macpas, tp');
FPCDirectiveToText.Text:=DefaultFPCDirectiveToText;
FIDEDirectiveToText:=TStringList.Create;
IDEDirectiveToText.Add('H=Use {%H-} to hide any compiler message at that source position in IDE messages window.');
IDEDirectiveToText.Text:=DefaultIDEDirectiveToText;
end;
destructor TMyDirectiveHelpDatabase.Destroy;
@ -869,7 +878,11 @@ procedure TMyDirectiveHelpDatabase.LoadFromConfig(Config: TConfigStorage);
begin
inherited LoadFromConfig(Config);
Config.GetValue('FPCDirectives',FPCDirectiveToText);
if FPCDirectiveToText.Count=0 then
FPCDirectiveToText.Text:=DefaultFPCDirectiveToText;
Config.GetValue('IDEDirectives',IDEDirectiveToText);
if IDEDirectiveToText.Count=0 then
IDEDirectiveToText.Text:=DefaultIDEDirectiveToText;
end;
procedure TMyDirectiveHelpDatabase.SaveToConfig(Config: TConfigStorage);
@ -883,6 +896,7 @@ end;
procedure TMyFPCKeywordHelpDatabase.SetKeywordToText(AValue: TStrings);
begin
debugln(['TMyFPCKeywordHelpDatabase.SetKeywordToText ']);
if AssignTrimmedStrings(AValue,FKeywordToText) then
Modified:=true;
end;
@ -891,7 +905,7 @@ constructor TMyFPCKeywordHelpDatabase.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FKeywordToText:=TStringList.Create;
KeywordToText.Add('procedure=Named code block');
KeywordToText.Text:=DefaultKeyWordToText;
end;
destructor TMyFPCKeywordHelpDatabase.Destroy;
@ -950,6 +964,8 @@ procedure TMyFPCKeywordHelpDatabase.LoadFromConfig(Config: TConfigStorage);
begin
inherited LoadFromConfig(Config);
Config.GetValue('KeywordToText',KeywordToText);
if KeywordToText.Count=0 then
KeywordToText.Text:=DefaultKeyWordToText;
end;
procedure TMyFPCKeywordHelpDatabase.SaveToConfig(Config: TConfigStorage);