help for IDE windows: started editor and mapping

git-svn-id: trunk@9198 -
This commit is contained in:
mattias 2006-04-28 14:16:25 +00:00
parent e90422c6be
commit a8832a3e66
13 changed files with 796 additions and 19 deletions

4
.gitattributes vendored
View File

@ -1136,11 +1136,15 @@ ide/helpmanager.pas svneol=native#text/pascal
ide/helpoptions.lfm svneol=native#text/plain
ide/helpoptions.lrs svneol=native#text/pascal
ide/helpoptions.pas svneol=native#text/pascal
ide/idecontexthelpedit.lfm svneol=native#text/plain
ide/idecontexthelpedit.lrs svneol=native#text/plain
ide/idecontexthelpedit.pas svneol=native#text/plain
ide/idedefs.pas svneol=native#text/pascal
ide/ideoptiondefs.pas svneol=native#text/pascal
ide/ideprocs.pp svneol=native#text/pascal
ide/ideprotocol.pas svneol=native#text/pascal
ide/idetranslations.pas svneol=native#text/pascal
ide/idewindowhelp.pas svneol=native#text/plain
ide/imexportcompileropts.lfm svneol=native#text/plain
ide/imexportcompileropts.lrs svneol=native#text/pascal
ide/imexportcompileropts.pas svneol=native#text/pascal

175
ide/idecontexthelpedit.lfm Normal file
View File

@ -0,0 +1,175 @@
object ContextHelpEditorDlg: TContextHelpEditorDlg
Caption = 'ContextHelpEditorDlg'
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6
ChildSizing.EnlargeHorizontal = crsScaleChilds
ClientHeight = 503
ClientWidth = 619
OnClose = FormClose
OnCreate = FormCreate
PixelsPerInch = 112
HorzScrollBar.Page = 618
VertScrollBar.Page = 502
Left = 290
Height = 503
Top = 163
Width = 619
object WindowControlsGroupBox: TGroupBox
Align = alLeft
Caption = 'WindowControlsGroupBox'
ClientHeight = 428
ClientWidth = 301
TabOrder = 0
Left = 6
Height = 445
Top = 6
Width = 305
object ControlsTreeView: TTreeView
Align = alClient
DefaultItemHeight = 14
TabOrder = 0
Height = 358
Width = 301
end
object CreateHelpNodeForControlButton: TButton
Align = alBottom
BorderSpacing.InnerBorder = 2
Caption = 'CreateHelpNodeForControlButton'
TabOrder = 1
Height = 35
Top = 358
Width = 301
end
object TestButton: TButton
Align = alBottom
BorderSpacing.InnerBorder = 2
Caption = 'TestButton'
TabOrder = 2
Height = 35
Top = 393
Width = 301
end
end
object NodesGroupBox: TGroupBox
Align = alClient
Caption = 'NodesGroupBox'
ClientHeight = 428
ClientWidth = 281
TabOrder = 1
Left = 328
Height = 445
Top = 6
Width = 285
object HelpNodesTreeView: TTreeView
Align = alClient
DefaultItemHeight = 14
TabOrder = 0
OnSelectionChanged = HelpNodesTreeViewSelectionChanged
Height = 315
Width = 281
end
object HelpNodePropertiesGroupBox: TGroupBox
Align = alBottom
Caption = 'HelpNodePropertiesGroupBox'
ClientHeight = 96
ClientWidth = 277
TabOrder = 1
Height = 113
Top = 315
Width = 281
object NodeNameLabel: TLabel
Caption = 'Name:'
Color = clNone
ParentColor = False
Left = 10
Height = 13
Top = 10
Width = 36
end
object NodePathLabel: TLabel
Caption = 'Path:'
Color = clNone
ParentColor = False
Left = 10
Height = 13
Top = 40
Width = 29
end
object NodeHasHelpCheckBox: TCheckBox
Caption = 'NodeHasHelpCheckBox'
TabOrder = 0
Left = 6
Height = 24
Top = 65
Width = 162
end
object NodeNameEdit: TEdit
TabOrder = 1
Text = 'NodeNameEdit'
Left = 70
Height = 23
Top = 5
Width = 204
end
object NodePathEdit: TEdit
TabOrder = 2
Text = 'NodePathEdit'
Left = 70
Height = 23
Top = 35
Width = 204
end
end
end
object Splitter1: TSplitter
Height = 445
Width = 5
Cursor = crHSplit
Left = 317
Height = 445
Top = 6
Width = 5
end
object Panel1: TPanel
Align = alBottom
BevelOuter = bvNone
ClientHeight = 40
ClientWidth = 607
TabOrder = 2
Left = 6
Height = 40
Top = 457
Width = 607
object CancelBitBtn: TBitBtn
Align = alRight
Anchors = [akTop, akRight]
BorderSpacing.Around = 6
BorderSpacing.InnerBorder = 2
Caption = 'CancelBitBtn'
ModalResult = 2
NumGlyphs = 0
TabOrder = 0
Left = 496
Height = 28
Top = 6
Width = 105
end
object OkBitBtn: TBitBtn
Align = alRight
Anchors = [akTop, akRight]
BorderSpacing.Right = 15
BorderSpacing.Around = 6
BorderSpacing.InnerBorder = 2
Caption = 'OkBitBtn'
ModalResult = 1
NumGlyphs = 0
TabOrder = 1
Left = 370
Height = 28
Top = 6
Width = 105
end
end
end

View File

@ -0,0 +1,52 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TContextHelpEditorDlg','FORMDATA',[
'TPF0'#21'TContextHelpEditorDlg'#20'ContextHelpEditorDlg'#7'Caption'#6#20'Con'
+'textHelpEditorDlg'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopB'
+'ottomSpacing'#2#6#29'ChildSizing.HorizontalSpacing'#2#6#27'ChildSizing.Vert'
+'icalSpacing'#2#6#29'ChildSizing.EnlargeHorizontal'#7#14'crsScaleChilds'#12
+'ClientHeight'#3#247#1#11'ClientWidth'#3'k'#2#7'OnClose'#7#9'FormClose'#8'On'
+'Create'#7#10'FormCreate'#13'PixelsPerInch'#2'p'#18'HorzScrollBar.Page'#3'j'
+#2#18'VertScrollBar.Page'#3#246#1#4'Left'#3'"'#1#6'Height'#3#247#1#3'Top'#3
+#163#0#5'Width'#3'k'#2#0#9'TGroupBox'#22'WindowControlsGroupBox'#5'Align'#7#6
+'alLeft'#7'Caption'#6#22'WindowControlsGroupBox'#12'ClientHeight'#3#172#1#11
+'ClientWidth'#3'-'#1#8'TabOrder'#2#0#4'Left'#2#6#6'Height'#3#189#1#3'Top'#2#6
+#5'Width'#3'1'#1#0#9'TTreeView'#16'ControlsTreeView'#5'Align'#7#8'alClient'
+#17'DefaultItemHeight'#2#14#8'TabOrder'#2#0#6'Height'#3'f'#1#5'Width'#3'-'#1
+#0#0#7'TButton'#30'CreateHelpNodeForControlButton'#5'Align'#7#8'alBottom'#25
+'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#30'CreateHelpNodeForControlButt'
+'on'#8'TabOrder'#2#1#6'Height'#2'#'#3'Top'#3'f'#1#5'Width'#3'-'#1#0#0#7'TBut'
+'ton'#10'TestButton'#5'Align'#7#8'alBottom'#25'BorderSpacing.InnerBorder'#2#2
+#7'Caption'#6#10'TestButton'#8'TabOrder'#2#2#6'Height'#2'#'#3'Top'#3#137#1#5
+'Width'#3'-'#1#0#0#0#9'TGroupBox'#13'NodesGroupBox'#5'Align'#7#8'alClient'#7
+'Caption'#6#13'NodesGroupBox'#12'ClientHeight'#3#172#1#11'ClientWidth'#3#25#1
+#8'TabOrder'#2#1#4'Left'#3'H'#1#6'Height'#3#189#1#3'Top'#2#6#5'Width'#3#29#1
+#0#9'TTreeView'#17'HelpNodesTreeView'#5'Align'#7#8'alClient'#17'DefaultItemH'
+'eight'#2#14#8'TabOrder'#2#0#18'OnSelectionChanged'#7'!HelpNodesTreeViewSele'
+'ctionChanged'#6'Height'#3';'#1#5'Width'#3#25#1#0#0#9'TGroupBox'#26'HelpNode'
+'PropertiesGroupBox'#5'Align'#7#8'alBottom'#7'Caption'#6#26'HelpNodeProperti'
+'esGroupBox'#12'ClientHeight'#2'`'#11'ClientWidth'#3#21#1#8'TabOrder'#2#1#6
+'Height'#2'q'#3'Top'#3';'#1#5'Width'#3#25#1#0#6'TLabel'#13'NodeNameLabel'#7
+'Caption'#6#5'Name:'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#10#6'H'
+'eight'#2#13#3'Top'#2#10#5'Width'#2'$'#0#0#6'TLabel'#13'NodePathLabel'#7'Cap'
+'tion'#6#5'Path:'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#10#6'Heig'
+'ht'#2#13#3'Top'#2'('#5'Width'#2#29#0#0#9'TCheckBox'#19'NodeHasHelpCheckBox'
+#7'Caption'#6#19'NodeHasHelpCheckBox'#8'TabOrder'#2#0#4'Left'#2#6#6'Height'#2
+#24#3'Top'#2'A'#5'Width'#3#162#0#0#0#5'TEdit'#12'NodeNameEdit'#8'TabOrder'#2
+#1#4'Text'#6#12'NodeNameEdit'#4'Left'#2'F'#6'Height'#2#23#3'Top'#2#5#5'Width'
+#3#204#0#0#0#5'TEdit'#12'NodePathEdit'#8'TabOrder'#2#2#4'Text'#6#12'NodePath'
+'Edit'#4'Left'#2'F'#6'Height'#2#23#3'Top'#2'#'#5'Width'#3#204#0#0#0#0#0#9'TS'
+'plitter'#9'Splitter1'#6'Height'#3#189#1#5'Width'#2#5#6'Cursor'#7#8'crHSplit'
+#4'Left'#3'='#1#6'Height'#3#189#1#3'Top'#2#6#5'Width'#2#5#0#0#6'TPanel'#6'Pa'
+'nel1'#5'Align'#7#8'alBottom'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2
+'('#11'ClientWidth'#3'_'#2#8'TabOrder'#2#2#4'Left'#2#6#6'Height'#2'('#3'Top'
+#3#201#1#5'Width'#3'_'#2#0#7'TBitBtn'#12'CancelBitBtn'#5'Align'#7#7'alRight'
+#7'Anchors'#11#5'akTop'#7'akRight'#0#20'BorderSpacing.Around'#2#6#25'BorderS'
+'pacing.InnerBorder'#2#2#7'Caption'#6#12'CancelBitBtn'#11'ModalResult'#2#2#9
+'NumGlyphs'#2#0#8'TabOrder'#2#0#4'Left'#3#240#1#6'Height'#2#28#3'Top'#2#6#5
+'Width'#2'i'#0#0#7'TBitBtn'#8'OkBitBtn'#5'Align'#7#7'alRight'#7'Anchors'#11#5
+'akTop'#7'akRight'#0#19'BorderSpacing.Right'#2#15#20'BorderSpacing.Around'#2
+#6#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#8'OkBitBtn'#11'ModalResult'
+#2#1#9'NumGlyphs'#2#0#8'TabOrder'#2#1#4'Left'#3'r'#1#6'Height'#2#28#3'Top'#2
+#6#5'Width'#2'i'#0#0#0#0
]);

224
ide/idecontexthelpedit.pas Normal file
View File

@ -0,0 +1,224 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code 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. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Mattias Gaertner
Abstract:
Editor dialog to edit nodes of Help for IDE windows (controls).
}
unit IDEContextHelpEdit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
Buttons, ButtonPanel, StdCtrls, ComCtrls,
// IDEIntf
IDEWindowIntf, HelpIntf,
// IDE
IDEWindowHelp, LazarusIDEStrConsts, ExtCtrls;
type
{ TContextHelpEditorDlg }
TContextHelpEditorDlg = class(TForm)
CancelBitBtn: TBitBtn;
OkBitBtn: TBitBtn;
Panel1: TPanel;
TestButton: TButton;
CreateHelpNodeForControlButton: TButton;
NodeNameEdit: TEdit;
NodePathEdit: TEdit;
NodeHasHelpCheckBox: TCheckBox;
HelpNodePropertiesGroupBox: TGroupBox;
NodePathLabel: TLabel;
NodeNameLabel: TLabel;
NodesGroupBox: TGroupBox;
ControlsTreeView: TTreeView;
HelpNodesTreeView: TTreeView;
Splitter1: TSplitter;
WindowControlsGroupBox: TGroupBox;
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure HelpNodesTreeViewSelectionChanged(Sender: TObject);
private
FIDEWindow: TCustomForm;
FInvoker: TObject;
procedure SetIDEWindow(const AValue: TCustomForm);
procedure SetInvoker(const AValue: TObject);
procedure UpdateWindowControlsGroupBoxCaption;
procedure FillControlsTreeView;
procedure FillHelpNodesTreeView;
procedure UpdateHelpNodePropertiesGroupBox;
public
property Invoker: TObject read FInvoker write SetInvoker;
property IDEWindow: TCustomForm read FIDEWindow write SetIDEWindow;
end;
function ShowContextHelpEditor(Sender: TObject): TModalresult;
implementation
function ShowContextHelpEditor(Sender: TObject): TModalresult;
var
ContextHelpEditorDlg: TContextHelpEditorDlg;
begin
ContextHelpEditorDlg:=TContextHelpEditorDlg.Create(nil);
try
ContextHelpEditorDlg.Invoker:=Sender;
Result:=ContextHelpEditorDlg.ShowModal;
finally
ContextHelpEditorDlg.Free;
end;
end;
{ TContextHelpEditorDlg }
procedure TContextHelpEditorDlg.FormClose(Sender: TObject;
var CloseAction: TCloseAction);
begin
IDEDialogLayoutList.SaveLayout(Self);
end;
procedure TContextHelpEditorDlg.FormCreate(Sender: TObject);
begin
Caption:='Edit context help';
TestButton.Caption:='Test';
CreateHelpNodeForControlButton.Caption:='Create Help node';
NodeHasHelpCheckBox.Caption:='Has Help';
NodePathLabel.Caption:='Path';
NodeNameLabel.Caption:='Name';
NodesGroupBox.Caption:='Help entries';
OkBitBtn.Caption:='Ok';
CancelBitBtn.Caption:='Cancel';
IDEDialogLayoutList.ApplyLayout(Self, 600, 450);
LoadIDEWindowHelp;
FillHelpNodesTreeView;
end;
procedure TContextHelpEditorDlg.HelpNodesTreeViewSelectionChanged(
Sender: TObject);
begin
UpdateHelpNodePropertiesGroupBox;
end;
procedure TContextHelpEditorDlg.SetInvoker(const AValue: TObject);
begin
if FInvoker=AValue then exit;
FInvoker:=AValue;
if Invoker is TControl then begin
IDEWindow:=GetParentForm(TControl(Invoker));
end;
end;
procedure TContextHelpEditorDlg.UpdateWindowControlsGroupBoxCaption;
begin
if IDEWindow<>nil then begin
WindowControlsGroupBox.Caption:=dbgsName(IDEWindow);
WindowControlsGroupBox.Enabled:=true;
end else begin
WindowControlsGroupBox.Caption:='No IDE window selected';
WindowControlsGroupBox.Enabled:=false;
end;
end;
procedure TContextHelpEditorDlg.FillControlsTreeView;
procedure Add(AControl: TControl; ParentNode: TTreeNode);
var
i: Integer;
NewNode: TTreeNode;
begin
NewNode:=ControlsTreeView.Items.AddChild(ParentNode,dbgsName(AControl));
if AControl is TWinControl then begin
for i:=0 to TWinControl(AControl).ControlCount-1 do
Add(TWinControl(AControl).Controls[i],NewNode);
end;
NewNode.Expanded:=true;
end;
begin
ControlsTreeView.BeginUpdate;
ControlsTreeView.Items.Clear;
if IDEWindow<>nil then
Add(IDEWindow,nil);
ControlsTreeView.EndUpdate;
end;
procedure TContextHelpEditorDlg.FillHelpNodesTreeView;
procedure Add(HelpNode: TIWHelpNode; ParentNode: TTreeNode);
var
i: Integer;
NewNode: TTreeNode;
begin
NewNode:=ControlsTreeView.Items.AddChildObject(ParentNode,
HelpNode.Name,HelpNode);
for i:=0 to HelpNode.Count-1 do
Add(HelpNode[i],NewNode);
NewNode.Expanded:=true;
end;
begin
HelpNodesTreeView.BeginUpdate;
HelpNodesTreeView.Items.Clear;
Add(IDEWindowHelpNodes.Root,nil);
HelpNodesTreeView.EndUpdate;
end;
procedure TContextHelpEditorDlg.UpdateHelpNodePropertiesGroupBox;
var
TVNode: TTreeNode;
HelpNode: TIWHelpNode;
begin
TVNode:=HelpNodesTreeView.Selected;
if TVNode<>nil then begin
HelpNode:=TIWHelpNode(TVNode.Data);
HelpNodePropertiesGroupBox.Caption:=HelpNode.Name;
NodeNameEdit.Text:=HelpNode.Name;
NodePathEdit.Text:=HelpNode.Path;
NodeHasHelpCheckBox.Checked:=HelpNode.HasHelp;
HelpNodePropertiesGroupBox.Enabled:=true;
end else begin
HelpNodePropertiesGroupBox.Caption:='no node selected';
HelpNodePropertiesGroupBox.Enabled:=false;
end;
end;
procedure TContextHelpEditorDlg.SetIDEWindow(const AValue: TCustomForm);
begin
if FIDEWindow=AValue then exit;
FIDEWindow:=AValue;
UpdateWindowControlsGroupBoxCaption;
FillControlsTreeView;
end;
initialization
{$I idecontexthelpedit.lrs}
end.

View File

@ -158,6 +158,7 @@ procedure LoadStringList(XMLConfig: TXMLConfig; List: TStrings;
const Path: string);
procedure SaveStringList(XMLConfig: TXMLConfig; List: TStrings;
const Path: string);
procedure MakeXMLName(var Name: string);
function FindProgram(const Programname, BaseDirectory: string;
@ -775,6 +776,21 @@ begin
XMLConfig.SetDeleteValue(Path+'Item'+IntToStr(i+1)+'/Value',List[i],'');
end;
procedure MakeXMLName(var Name: string);
var
i: Integer;
begin
i:=1;
while i<=length(Name) do begin
if (Name[i] in ['a'..'z','A'..'Z','_'])
or (i>1) and (Name[i] in ['0'..'9']) then begin
inc(i);
end else begin
System.Delete(Name,i,1);
end;
end;
end;
procedure LoadRect(XMLConfig: TXMLConfig; const Path: string;
var ARect: TRect);
begin

280
ide/idewindowhelp.pas Normal file
View File

@ -0,0 +1,280 @@
{
***************************************************************************
* *
* This source is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This code 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. *
* *
* A copy of the GNU General Public License is available on the World *
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Author: Mattias Gaertner
Abstract:
Help for IDE windows (controls).
}
unit IDEWindowHelp;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Dialogs, HelpIntf, ConfigStorage,
EnvironmentOpts;
type
{ TIWHelpNode }
TIWHelpNode = class
private
FItems: TFPList;// list of TIWHelpNode
FHasHelp: Boolean;
FName: string;
FParent: TIWHelpNode;
FPath: string;
function GetChilds(Index: integer): TIWHelpNode;
function GetCount: integer;
procedure SetHasHelp(const AValue: Boolean);
procedure SetName(const AValue: string);
procedure SetPath(const AValue: string);
procedure DoRemove(AChild: TIWHelpNode);
public
constructor Create;
destructor Destroy; override;
procedure Clear;
function AddChild(const ChildName: string = '';
const ChildPath: string = ''): TIWHelpNode;
procedure Load(Config: TConfigStorage; const CfgPath: string);
procedure Save(Config: TConfigStorage; const CfgPath: string);
property HasHelp: Boolean read FHasHelp write SetHasHelp;
property Name: string read FName write SetName;
property Path: string read FPath write SetPath;
property Parent: TIWHelpNode read FParent;
property Count: integer read GetCount;
property Childs[Index: integer]: TIWHelpNode read GetChilds; default;
end;
{ TIWHelpTree }
TIWHelpTree = class
private
FRoot: TIWHelpNode;
public
constructor Create;
destructor Destroy; override;
procedure Load(Config: TConfigStorage; const Path: string);
procedure Save(Config: TConfigStorage; const Path: string);
property Root: TIWHelpNode read FRoot;
end;
const
IDEWindowHelpTreeFile = 'docs/IDEWindowHelpTree.xml';
var
IDEWindowHelpNodes: TIWHelpTree = nil;
function GetIDEWindowHelpFilename: string;
procedure LoadIDEWindowHelp;
procedure SaveIDEWindowHelp;
implementation
function GetIDEWindowHelpFilename: string;
begin
Result:=AppendPathDelim(EnvironmentOptions.LazarusDirectory)
+SetDirSeparators(IDEWindowHelpTreeFile);
end;
procedure LoadIDEWindowHelp;
var
Filename: String;
Config: TConfigStorage;
begin
if IDEWindowHelpNodes=nil then
IDEWindowHelpNodes:=TIWHelpTree.Create;
Filename:=GetIDEWindowHelpFilename;
try
Config:=GetIDEConfigStorage(Filename,true);
if Config=nil then exit;
try
IDEWindowHelpNodes.Load(Config,'');
finally
Config.Free;
end;
except
on E: Exception do begin
MessageDlg('Read error','Error reading file '+Filename+#13+E.Message,
mtError,[mbOk],0);
end;
end;
end;
procedure SaveIDEWindowHelp;
var
Filename: String;
Config: TConfigStorage;
begin
if IDEWindowHelpNodes=nil then exit;
Filename:=GetIDEWindowHelpFilename;
try
Config:=GetIDEConfigStorage(Filename,false);
if Config=nil then exit;
try
IDEWindowHelpNodes.Save(Config,'');
Config.WriteToDisk;
finally
Config.Free;
end;
except
on E: Exception do begin
MessageDlg('Write error','Error writing file '+Filename+#13+E.Message,
mtError,[mbOk],0);
end;
end;
end;
{ TIWHelpNode }
procedure TIWHelpNode.SetHasHelp(const AValue: Boolean);
begin
if FHasHelp=AValue then exit;
FHasHelp:=AValue;
end;
procedure TIWHelpNode.SetName(const AValue: string);
begin
if FName=AValue then exit;
FName:=AValue;
end;
function TIWHelpNode.GetChilds(Index: integer): TIWHelpNode;
begin
Result:=TIWHelpNode(FItems[Index]);
end;
function TIWHelpNode.GetCount: integer;
begin
if FItems<>nil then
Result:=FItems.Count
else
Result:=0;
end;
procedure TIWHelpNode.SetPath(const AValue: string);
begin
if FPath=AValue then exit;
FPath:=AValue;
end;
procedure TIWHelpNode.DoRemove(AChild: TIWHelpNode);
begin
FItems.Remove(AChild);
end;
constructor TIWHelpNode.Create;
begin
end;
destructor TIWHelpNode.Destroy;
begin
Clear;
if FParent<>nil then
FParent.DoRemove(Self);
FreeAndNil(FItems);
inherited Destroy;
end;
procedure TIWHelpNode.Clear;
var
i: Integer;
CurChild: TIWHelpNode;
begin
if FItems<>nil then begin
for i:=FItems.Count-1 downto 0 do begin
CurChild:=Childs[i];
CurChild.FParent:=nil;
CurChild.Free;
end;
end;
end;
function TIWHelpNode.AddChild(const ChildName: string;
const ChildPath: string): TIWHelpNode;
begin
Result:=TIWHelpNode.Create;
Result.FParent:=Self;
Result.Name:=ChildName;
Result.Path:=ChildPath;
if FItems=nil then
FItems:=TFPList.Create;
FItems.Add(Result);
end;
procedure TIWHelpNode.Load(Config: TConfigStorage; const CfgPath: string);
var
NewChildCount: LongInt;
i: Integer;
NewChild: TIWHelpNode;
begin
Clear;
Name:=Config.GetValue(CfgPath+'Name','');
Path:=Config.GetValue(CfgPath+'Path','');
HasHelp:=Config.GetValue(CfgPath+'HasHelp',true);
NewChildCount:=Config.GetValue(CfgPath+'ChildCount',0);
for i:=0 to NewChildCount-1 do begin
NewChild:=AddChild('');
NewChild.Load(Config,CfgPath+'Node'+IntToStr(i+1)+'/');
end;
end;
procedure TIWHelpNode.Save(Config: TConfigStorage; const CfgPath: string);
var
i: Integer;
begin
Config.SetDeleteValue(CfgPath+'Name',Name,'');
Config.SetDeleteValue(CfgPath+'Path',Path,'');
Config.SetDeleteValue(CfgPath+'HasHelp',HasHelp,true);
Config.SetDeleteValue(CfgPath+'ChildCount',Count,0);
for i:=0 to Count-1 do
Childs[i].Save(Config,CfgPath+'Node'+IntToStr(i+1)+'/');
end;
{ TIWHelpTree }
constructor TIWHelpTree.Create;
begin
FRoot:=TIWHelpNode.Create;
FRoot.Name:='IDE windows and dialogs';
FRoot.Path:='IDEWindowsAndDialogs';
end;
destructor TIWHelpTree.Destroy;
begin
inherited Destroy;
end;
procedure TIWHelpTree.Load(Config: TConfigStorage; const Path: string);
begin
FRoot.Load(Config,Path);
end;
procedure TIWHelpTree.Save(Config: TConfigStorage; const Path: string);
begin
FRoot.Save(Config,Path);
end;
end.

View File

@ -529,6 +529,7 @@ begin
ecOnlineHelp: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecConfigureHelp: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecContextHelp: SetResult(VK_F1,[],VK_UNKNOWN,[]);
ecEditContextHelp: SetResult(VK_F1,[ssShift,ssCtrl],VK_UNKNOWN,[]);
// designer
ecDesignerCopy : SetResult(VK_C,[ssCtrl],VK_Insert,[ssCtrl]);
@ -838,7 +839,8 @@ begin
ecAboutLazarus: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecOnlineHelp: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecConfigureHelp: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecContextHelp: SetResult(VK_F1,[ssCtrl],VK_UNKNOWN,[],VK_F1,[],VK_UNKNOWN,[]);
ecContextHelp: SetResult(VK_F1,[ssCtrl],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecEditContextHelp: SetResult(VK_F1,[ssCtrl,ssShift],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
// designer
ecDesignerCopy : SetResult(VK_C,[ssCtrl],VK_UNKNOWN,[],VK_Insert,[ssCtrl],VK_UNKNOWN,[]);
@ -1407,6 +1409,7 @@ begin
ecOnlineHelp : Result:= lisMenuOnlineHelp;
ecConfigureHelp : Result:= lisMenuConfigureHelp;
ecContextHelp : Result:= lisMenuContextHelp;
ecEditContextHelp : Result:= lisMenuEditContextHelp;
// desginer
ecDesignerCopy : Result:= lisDsgCopyComponents;
@ -2333,6 +2336,7 @@ begin
AddDefault(C,'Online Help',ecOnlineHelp);
AddDefault(C,'Configure Help',ecConfigureHelp);
AddDefault(C,'Context sensitive help',ecContextHelp);
AddDefault(C,'Edit context sensitive help',ecEditContextHelp);
// designer - without menu items in the IDE bar (at least no direct)
C:=Categories[AddCategory('Designer',lisKeyCatDesigner,IDECmdScopeDesignerOnly)];

View File

@ -297,6 +297,7 @@ resourcestring
lisMenuOnlineHelp = 'Online Help';
lisMenuConfigureHelp = 'Configure Help';
lisMenuContextHelp = 'Context sensitive Help';
lisMenuEditContextHelp = 'Edit context sensitive Help';
lisDsgCopyComponents = 'Copy selected components to clipboard';
lisDsgCutComponents = 'Cut selected components to clipboard';

View File

@ -83,7 +83,7 @@ uses
Project, ProjectDefs, NewProjectDlg, ProjectOpts,
PublishProjectDlg, ProjectInspector,
// help manager
HelpManager,
IDEContextHelpEdit, HelpManager,
// designer
ComponentPalette, ComponentReg, ObjInspExt,
Designer, FormEditor, CustomFormEditor,
@ -133,6 +133,8 @@ type
procedure OnApplicationUserInput(Sender: TObject; Msg: Cardinal);
procedure OnApplicationIdle(Sender: TObject);
procedure OnApplicationActivate(Sender: TObject);
procedure OnApplicationKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
procedure OnScreenRemoveForm(Sender: TObject; AForm: TCustomForm);
// file menu
@ -1126,11 +1128,12 @@ end;
procedure TMainIDE.StartIDE;
begin
// set OnIdle handlers
Application.AddOnUserInputHandler(@OnApplicationUserInput,true);
Application.AddOnIdleHandler(@OnApplicationIdle,true);
Application.AddOnActivateHandler(@OnApplicationActivate,true);
Screen.AddHandlerRemoveForm(@OnScreenRemoveForm,true);
// set Application handlers
Application.AddOnUserInputHandler(@OnApplicationUserInput);
Application.AddOnIdleHandler(@OnApplicationIdle);
Application.AddOnActivateHandler(@OnApplicationActivate);
Application.AddOnKeyDownHandler(@OnApplicationKeyDown);
Screen.AddHandlerRemoveForm(@OnScreenRemoveForm);
SetupHints;
// Now load a project
@ -1159,9 +1162,8 @@ begin
end;
// disconnect handlers
Application.RemoveOnUserInputHandler(@OnApplicationUserInput);
Application.RemoveOnIdleHandler(@OnApplicationIdle);
Screen.RemoveHandlerRemoveForm(@OnScreenRemoveForm);
Application.RemoveAllHandlersOfObject(Self);
Screen.RemoveAllHandlersOfObject(Self);
IDECommands.OnExecuteIDECommand:=nil;
// free project, if it is still there
@ -2568,6 +2570,7 @@ var
Command: Word;
Handled: Boolean;
begin
if Key=VK_UNKNOWN then exit;
Command := EditorOpts.KeyMap.TranslateKey(Key,Shift,IDEWindowClass);
if (Command = ecNone) then exit;
Handled := false;
@ -12039,6 +12042,19 @@ begin
DoCheckFilesOnDisk;
end;
procedure TMainIDE.OnApplicationKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
Command: Word;
begin
//DebugLn('TMainIDE.OnApplicationKeyDown ',dbgs(Key),' ',dbgs(Shift));
Command := EditorOpts.KeyMap.TranslateKey(Key,Shift,nil);
if Command=ecEditContextHelp then begin
Key:=VK_UNKNOWN;
ShowContextHelpEditor(Sender);
end;
end;
procedure TMainIDE.OnScreenRemoveForm(Sender: TObject; AForm: TCustomForm);
begin
HiddenWindowsOnRun.Remove(AForm);

View File

@ -259,6 +259,7 @@ const
ecOnlineHelp = ecFirstLazarus + 901;
ecConfigureHelp = ecFirstLazarus + 902;
ecContextHelp = ecFirstLazarus + 903;
ecEditContextHelp = ecFirstLazarus + 904;
// designer
ecDesignerCopy = ecFirstLazarus + 1000;

View File

@ -1747,6 +1747,7 @@ procedure TOICustomPropertyGrid.HandleStandardKeys(var Key: Word;
var
Handled: Boolean;
begin
//writeln('TOICustomPropertyGrid.HandleStandardKeys ',Key);
Handled:=true;
case Key of
@ -1782,6 +1783,7 @@ begin
OnOIKeyDown(Self,Key,Shift);
Handled:=Key=VK_UNKNOWN;
end;
//writeln('TOICustomPropertyGrid.HandleStandardKeys ',Key,' Handled=',Handled);
if Handled then Key:=VK_UNKNOWN;
end;

View File

@ -414,10 +414,11 @@ begin
if Transparent then begin
if (FLastDrawFlags and DFCS_FLAT) = 0 then begin
if MouseInControl then begin
// Canvas.GetUpdatedHandle([csBrushValid,csPenValid]);
if (FLastDrawFlags and DFCS_PUSHED) <>0 then xBevel := bvLowered
else xBevel := bvRaised;
Canvas.Frame3D(PaintRect,1,xBevel);
end else if (FLastDrawFlags and DFCS_PUSHED) <>0 then begin
Canvas.Frame3D(PaintRect,1,bvLowered);
end;
InflateRect(PaintRect, -1, -1);
end;

View File

@ -5059,8 +5059,9 @@ begin
Exit;
end;
if csLoading in ComponentState then begin
DebugLn('[HINT] TWinControl.CreateWnd creating Handle during loading ',DbgSName(Self));
if [csLoading,csDesigning]*ComponentState=[csLoading] then begin
DebugLn('[HINT] TWinControl.CreateWnd creating Handle during loading ',DbgSName(Self),' csDesigning=',dbgs(csDesigning in ComponentState));
//DumpStack;
end;
Include(FWinControlFlags,wcfCreatingHandle);