mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 04:18:48 +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>
|
||||
<Version Value="8"/>
|
||||
<SearchPaths>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/"/>
|
||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
@ -23,6 +23,7 @@
|
||||
<Files Count="2">
|
||||
<Item1>
|
||||
<Filename Value="externhelpfrm.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="ExternHelpFrm"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
|
@ -13,6 +13,7 @@ implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('ExternHelpFrm', @ExternHelpFrm.Register);
|
||||
end;
|
||||
|
||||
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;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
@ -14,7 +44,7 @@ var
|
||||
ExternHelpOptionGeneralID: integer = 100;
|
||||
|
||||
resourcestring
|
||||
EHGroupTitle = 'Extern help';
|
||||
ehrsGroupTitle = 'Extern help';
|
||||
ehrsName = 'Name';
|
||||
ehrsUnitFileOrUnitDirectory = 'Unit file or unit directory';
|
||||
ehrsURL = 'URL';
|
||||
@ -164,11 +194,25 @@ implementation
|
||||
{$R *.lfm}
|
||||
|
||||
procedure Register;
|
||||
var
|
||||
Config: TConfigStorage;
|
||||
begin
|
||||
ExternHelpOptions:=TExternHelpOptions.Create;
|
||||
ExternHelpOptionID:=RegisterIDEOptionsGroup(ExternHelpOptionID,TExternHelpOptions)^.Index;
|
||||
ExternHelpOptionGeneralID:=RegisterIDEOptionsEditor(ExternHelpOptionID,
|
||||
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;
|
||||
|
||||
{ TExternHelpOptions }
|
||||
@ -194,7 +238,7 @@ end;
|
||||
|
||||
class function TExternHelpOptions.GetGroupCaption: string;
|
||||
begin
|
||||
Result:=EHGroupTitle;
|
||||
Result:=ehrsGroupTitle;
|
||||
end;
|
||||
|
||||
class function TExternHelpOptions.GetInstance: TAbstractIDEOptions;
|
||||
@ -329,7 +373,8 @@ begin
|
||||
SelTVNode:=ItemsTreeView.Selected;
|
||||
Item:=TExternHelpItem.Create;
|
||||
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
|
||||
SelItem:=TExternHelpItem(SelTVNode.Data);
|
||||
Item.Filename:=SelItem.Filename;
|
||||
@ -432,7 +477,7 @@ var
|
||||
Item: TExternHelpItem;
|
||||
begin
|
||||
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.Name:=NewName;
|
||||
if UpdateTree then
|
||||
@ -532,6 +577,7 @@ begin
|
||||
FillItemsTreeView;
|
||||
ItemsTreeView.Selected:=ItemsTreeView.Items.GetFirstNode;
|
||||
end;
|
||||
SelectionChanged;
|
||||
end;
|
||||
|
||||
procedure TExternHelpGeneralOptsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
|
||||
@ -553,10 +599,27 @@ end;
|
||||
procedure TExternHelpGeneralOptsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
var
|
||||
Opts: TExternHelpOptions;
|
||||
Config: TConfigStorage;
|
||||
begin
|
||||
if AOptions is TExternHelpOptions then begin
|
||||
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;
|
||||
|
||||
|
@ -298,7 +298,7 @@ function CreateNiceWindowPosition(Width, Height: integer): TRect;
|
||||
function NonModalIDEFormIDToEnum(const FormID: string): TNonModalIDEWindow;
|
||||
|
||||
function GetLazIDEConfigStorage(const Filename: string; LoadFromDisk: Boolean
|
||||
): TConfigStorage;
|
||||
): TConfigStorage; // load errors: raises exceptions
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -31,7 +31,7 @@ type
|
||||
var
|
||||
// will be set by the IDE
|
||||
DefaultConfigClass: TConfigStorageClass = nil;
|
||||
GetIDEConfigStorage: TGetIDEConfigStorage = nil;
|
||||
GetIDEConfigStorage: TGetIDEConfigStorage = nil; // load errors: raises exceptions
|
||||
|
||||
function EnvironmentAsStringList: TStringList;
|
||||
procedure AssignEnvironmentTo(DestStrings, Overrides: TStrings);
|
||||
|
Loading…
Reference in New Issue
Block a user