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

View File

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