mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 07:59:45 +02:00
externhelp: fixed showing options
git-svn-id: trunk@23775 -
This commit is contained in:
parent
e3398afbb6
commit
007f3d4686
@ -6,7 +6,7 @@
|
|||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="8"/>
|
<Version Value="8"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/"/>
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Parsing>
|
<Parsing>
|
||||||
<SyntaxOptions>
|
<SyntaxOptions>
|
||||||
@ -23,6 +23,7 @@
|
|||||||
<Files Count="2">
|
<Files Count="2">
|
||||||
<Item1>
|
<Item1>
|
||||||
<Filename Value="externhelpfrm.pas"/>
|
<Filename Value="externhelpfrm.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
<UnitName Value="ExternHelpFrm"/>
|
<UnitName Value="ExternHelpFrm"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
<Item2>
|
<Item2>
|
||||||
|
@ -13,6 +13,7 @@ implementation
|
|||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
begin
|
begin
|
||||||
|
RegisterUnit('ExternHelpFrm', @ExternHelpFrm.Register);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
@ -1,3 +1,33 @@
|
|||||||
|
{ Extern help options frame for Lazarus IDE.
|
||||||
|
|
||||||
|
Copyright (C) 2010 Mattias Gaertner mattias@freepascal.org
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version with the following modification:
|
||||||
|
|
||||||
|
As a special exception, the copyright holders of this library give you
|
||||||
|
permission to link this library with independent modules to produce an
|
||||||
|
executable, regardless of the license terms of these independent modules,and
|
||||||
|
to copy and distribute the resulting executable under terms of your choice,
|
||||||
|
provided that you also meet, for each linked independent module, the terms
|
||||||
|
and conditions of the license of that module. An independent module is a
|
||||||
|
module which is not derived from or based on this library. If you modify
|
||||||
|
this library, you may extend this exception to your version of the library,
|
||||||
|
but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
|
exception statement from your version.
|
||||||
|
|
||||||
|
This program 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 Library General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public License
|
||||||
|
along with this library; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
}
|
||||||
|
|
||||||
unit ExternHelpFrm;
|
unit ExternHelpFrm;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
@ -14,7 +44,7 @@ var
|
|||||||
ExternHelpOptionGeneralID: integer = 100;
|
ExternHelpOptionGeneralID: integer = 100;
|
||||||
|
|
||||||
resourcestring
|
resourcestring
|
||||||
EHGroupTitle = 'Extern help';
|
ehrsGroupTitle = 'Extern help';
|
||||||
ehrsName = 'Name';
|
ehrsName = 'Name';
|
||||||
ehrsUnitFileOrUnitDirectory = 'Unit file or unit directory';
|
ehrsUnitFileOrUnitDirectory = 'Unit file or unit directory';
|
||||||
ehrsURL = 'URL';
|
ehrsURL = 'URL';
|
||||||
@ -164,11 +194,25 @@ implementation
|
|||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
var
|
||||||
|
Config: TConfigStorage;
|
||||||
begin
|
begin
|
||||||
ExternHelpOptions:=TExternHelpOptions.Create;
|
ExternHelpOptions:=TExternHelpOptions.Create;
|
||||||
ExternHelpOptionID:=RegisterIDEOptionsGroup(ExternHelpOptionID,TExternHelpOptions)^.Index;
|
ExternHelpOptionID:=RegisterIDEOptionsGroup(ExternHelpOptionID,TExternHelpOptions)^.Index;
|
||||||
ExternHelpOptionGeneralID:=RegisterIDEOptionsEditor(ExternHelpOptionID,
|
ExternHelpOptionGeneralID:=RegisterIDEOptionsEditor(ExternHelpOptionID,
|
||||||
TExternHelpGeneralOptsFrame,ExternHelpOptionGeneralID)^.Index;
|
TExternHelpGeneralOptsFrame,ExternHelpOptionGeneralID)^.Index;
|
||||||
|
try
|
||||||
|
Config:=GetIDEConfigStorage(ExternHelpOptions.Filename,true);
|
||||||
|
try
|
||||||
|
ExternHelpOptions.Load(Config);
|
||||||
|
finally
|
||||||
|
Config.Free;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on E: Exception do begin
|
||||||
|
DebugLn(['Error reading externhelp options ',ExternHelpOptions.Filename,': ',E.Message]);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TExternHelpOptions }
|
{ TExternHelpOptions }
|
||||||
@ -194,7 +238,7 @@ end;
|
|||||||
|
|
||||||
class function TExternHelpOptions.GetGroupCaption: string;
|
class function TExternHelpOptions.GetGroupCaption: string;
|
||||||
begin
|
begin
|
||||||
Result:=EHGroupTitle;
|
Result:=ehrsGroupTitle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TExternHelpOptions.GetInstance: TAbstractIDEOptions;
|
class function TExternHelpOptions.GetInstance: TAbstractIDEOptions;
|
||||||
@ -329,7 +373,8 @@ begin
|
|||||||
SelTVNode:=ItemsTreeView.Selected;
|
SelTVNode:=ItemsTreeView.Selected;
|
||||||
Item:=TExternHelpItem.Create;
|
Item:=TExternHelpItem.Create;
|
||||||
Item.Name:=CreateUniqueName('Item');
|
Item.Name:=CreateUniqueName('Item');
|
||||||
if TObject(SelTVNode.Data) is TExternHelpItem then begin
|
if (SelTVNode<>nil) and (TObject(SelTVNode.Data) is TExternHelpItem) then
|
||||||
|
begin
|
||||||
// init with values of selected node
|
// init with values of selected node
|
||||||
SelItem:=TExternHelpItem(SelTVNode.Data);
|
SelItem:=TExternHelpItem(SelTVNode.Data);
|
||||||
Item.Filename:=SelItem.Filename;
|
Item.Filename:=SelItem.Filename;
|
||||||
@ -432,7 +477,7 @@ var
|
|||||||
Item: TExternHelpItem;
|
Item: TExternHelpItem;
|
||||||
begin
|
begin
|
||||||
NewName:=Trim(NewName);
|
NewName:=Trim(NewName);
|
||||||
if TObject(TVNode.Data) is TExternHelpItem then begin
|
if (TVNode<>nil) and (TObject(TVNode.Data) is TExternHelpItem) then begin
|
||||||
Item:=TExternHelpItem(TVNode.Data);
|
Item:=TExternHelpItem(TVNode.Data);
|
||||||
Item.Name:=NewName;
|
Item.Name:=NewName;
|
||||||
if UpdateTree then
|
if UpdateTree then
|
||||||
@ -532,6 +577,7 @@ begin
|
|||||||
FillItemsTreeView;
|
FillItemsTreeView;
|
||||||
ItemsTreeView.Selected:=ItemsTreeView.Items.GetFirstNode;
|
ItemsTreeView.Selected:=ItemsTreeView.Items.GetFirstNode;
|
||||||
end;
|
end;
|
||||||
|
SelectionChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TExternHelpGeneralOptsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
procedure TExternHelpGeneralOptsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||||
@ -553,10 +599,27 @@ end;
|
|||||||
procedure TExternHelpGeneralOptsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
procedure TExternHelpGeneralOptsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||||
var
|
var
|
||||||
Opts: TExternHelpOptions;
|
Opts: TExternHelpOptions;
|
||||||
|
Config: TConfigStorage;
|
||||||
begin
|
begin
|
||||||
if AOptions is TExternHelpOptions then begin
|
if AOptions is TExternHelpOptions then begin
|
||||||
Opts:=TExternHelpOptions(AOptions);
|
Opts:=TExternHelpOptions(AOptions);
|
||||||
Opts.Assign(Options);
|
if not Opts.IsEqual(Options) then
|
||||||
|
begin
|
||||||
|
Opts.Assign(Options);
|
||||||
|
try
|
||||||
|
Config:=GetIDEConfigStorage(Opts.Filename,false);
|
||||||
|
try
|
||||||
|
Opts.Save(Config);
|
||||||
|
Config.WriteToDisk;
|
||||||
|
finally
|
||||||
|
Config.Free;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on E: Exception do begin
|
||||||
|
DebugLn(['TExternHelpGeneralOptsFrame.WriteSettings unable to write file ',Opts.Filename,': ',E.Message]);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ function CreateNiceWindowPosition(Width, Height: integer): TRect;
|
|||||||
function NonModalIDEFormIDToEnum(const FormID: string): TNonModalIDEWindow;
|
function NonModalIDEFormIDToEnum(const FormID: string): TNonModalIDEWindow;
|
||||||
|
|
||||||
function GetLazIDEConfigStorage(const Filename: string; LoadFromDisk: Boolean
|
function GetLazIDEConfigStorage(const Filename: string; LoadFromDisk: Boolean
|
||||||
): TConfigStorage;
|
): TConfigStorage; // load errors: raises exceptions
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ type
|
|||||||
var
|
var
|
||||||
// will be set by the IDE
|
// will be set by the IDE
|
||||||
DefaultConfigClass: TConfigStorageClass = nil;
|
DefaultConfigClass: TConfigStorageClass = nil;
|
||||||
GetIDEConfigStorage: TGetIDEConfigStorage = nil;
|
GetIDEConfigStorage: TGetIDEConfigStorage = nil; // load errors: raises exceptions
|
||||||
|
|
||||||
function EnvironmentAsStringList: TStringList;
|
function EnvironmentAsStringList: TStringList;
|
||||||
procedure AssignEnvironmentTo(DestStrings, Overrides: TStrings);
|
procedure AssignEnvironmentTo(DestStrings, Overrides: TStrings);
|
||||||
|
Loading…
Reference in New Issue
Block a user