IDEIntf: added revert editor file function, h2pas gui: added tools for extern c and empty c macros

git-svn-id: trunk@9839 -
This commit is contained in:
mattias 2006-09-08 15:24:58 +00:00
parent 7f88638d08
commit 694d469e5e
20 changed files with 504 additions and 225 deletions

View File

@ -3291,7 +3291,7 @@ begin
CurPos:=@Src[StartPos]; CurPos:=@Src[StartPos];
while (CurPos<EndSrc) do begin while (CurPos<EndSrc) do begin
if (FirstChar=CurPos^) if (FirstChar=CurPos^)
and ((not WholeWords) or (CurPos>Src) or (IsNonWordChar[PChar(CurPos-1)^])) and ((not WholeWords) or (CurPos=Src) or (IsNonWordChar[PChar(CurPos-1)^]))
then begin then begin
CmpSearch:=Search; CmpSearch:=Search;
CmpSrc:=CurPos; CmpSrc:=CurPos;

View File

@ -24,11 +24,31 @@ interface
uses uses
Classes, SysUtils, LCLProc, LResources, LazConfigStorage, XMLPropStorage, Classes, SysUtils, LCLProc, LResources, LazConfigStorage, XMLPropStorage,
Forms, Controls, Dialogs, FileUtil, FileProcs, Forms, Controls, Dialogs, FileUtil, FileProcs, AvgLvlTree,
TextTools, IDEExternToolIntf, IDEDialogs, LazIDEIntf, IDEMsgIntf, // CodeTools
IDETextConverter; BasicCodeTools,
// IDEIntf
TextTools, IDEExternToolIntf, IDEDialogs, LazIDEIntf,
IDEMsgIntf, IDETextConverter;
type type
{ TRemoveCPlusPlusExternCTool }
TRemoveCPlusPlusExternCTool = class(TCustomTextConverterTool)
public
class function ClassDescription: string; override;
function Execute(aText: TIDETextConverter): TModalResult; override;
end;
{ TRemoveEmptyCMacrosTool }
TRemoveEmptyCMacrosTool = class(TCustomTextConverterTool)
public
class function ClassDescription: string; override;
function Execute(aText: TIDETextConverter): TModalResult; override;
end;
TH2PasProject = class; TH2PasProject = class;
TH2PasConverter = class; TH2PasConverter = class;
@ -120,7 +140,7 @@ type
public public
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure Clear; procedure Clear(AddDefaults: boolean);
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
function IsEqual(AProject: TH2PasProject): boolean; function IsEqual(AProject: TH2PasProject): boolean;
procedure Load(Config: TConfigStorage); procedure Load(Config: TConfigStorage);
@ -135,6 +155,7 @@ type
function LongenFilename(const AFilename: string): string; function LongenFilename(const AFilename: string): string;
function NormalizeFilename(const AFilename: string): string; function NormalizeFilename(const AFilename: string): string;
function HasEnabledFiles: boolean; function HasEnabledFiles: boolean;
procedure AddDefaultPreH2PasTools;
public public
property CHeaderFileCount: integer read GetCHeaderFileCount; property CHeaderFileCount: integer read GetCHeaderFileCount;
property CHeaderFiles[Index: integer]: TH2PasFile read GetCHeaderFiles; property CHeaderFiles[Index: integer]: TH2PasFile read GetCHeaderFiles;
@ -562,20 +583,19 @@ end;
constructor TH2PasProject.Create; constructor TH2PasProject.Create;
begin begin
FCHeaderFiles:=TFPList.Create; FCHeaderFiles:=TFPList.Create;
FPreH2PasTools:=TComponent.Create(nil); Clear(true);
Clear;
end; end;
destructor TH2PasProject.Destroy; destructor TH2PasProject.Destroy;
begin begin
Clear; Clear(false);
if (Converter<>nil) and (Converter.Project=Self) then if (Converter<>nil) and (Converter.Project=Self) then
Converter.Project:=nil; Converter.Project:=nil;
FreeAndNil(FCHeaderFiles); FreeAndNil(FCHeaderFiles);
inherited Destroy; inherited Destroy;
end; end;
procedure TH2PasProject.Clear; procedure TH2PasProject.Clear(AddDefaults: boolean);
begin begin
// FFilename is kept // FFilename is kept
FConstantsInsteadOfEnums:=true; FConstantsInsteadOfEnums:=true;
@ -600,6 +620,8 @@ begin
CHeaderFiles[CHeaderFileCount-1].Free; CHeaderFiles[CHeaderFileCount-1].Free;
FPreH2PasTools.Free; FPreH2PasTools.Free;
FPreH2PasTools:=TComponent.Create(nil); FPreH2PasTools:=TComponent.Create(nil);
if AddDefaults then
AddDefaultPreH2PasTools;
FModified:=false; FModified:=false;
end; end;
@ -633,7 +655,7 @@ begin
FVarParams:=Src.FVarParams; FVarParams:=Src.FVarParams;
FWin32Header:=Src.FWin32Header; FWin32Header:=Src.FWin32Header;
FOutputDirectory:=Src.FOutputDirectory; FOutputDirectory:=Src.FOutputDirectory;
Clear; Clear(false);
for i:=0 to Src.CHeaderFileCount-1 do begin for i:=0 to Src.CHeaderFileCount-1 do begin
NewCHeaderFile:=TH2PasFile.Create; NewCHeaderFile:=TH2PasFile.Create;
NewCHeaderFile.Project:=Self; NewCHeaderFile.Project:=Self;
@ -694,7 +716,7 @@ var
NewCHeaderFile: TH2PasFile; NewCHeaderFile: TH2PasFile;
NewComponent: TComponent; NewComponent: TComponent;
begin begin
Clear; Clear(false);
// FFilename is not saved // FFilename is not saved
FConstantsInsteadOfEnums:=Config.GetValue('ConstantsInsteadOfEnums/Value',true); FConstantsInsteadOfEnums:=Config.GetValue('ConstantsInsteadOfEnums/Value',true);
@ -924,6 +946,12 @@ begin
Result:=false; Result:=false;
end; end;
procedure TH2PasProject.AddDefaultPreH2PasTools;
begin
TRemoveCPlusPlusExternCTool.Create(FPreH2PasTools);
TRemoveEmptyCMacrosTool.Create(FPreH2PasTools);
end;
{ TH2PasConverter } { TH2PasConverter }
procedure TH2PasConverter.OnParseH2PasLine(Sender: TObject; procedure TH2PasConverter.OnParseH2PasLine(Sender: TObject;
@ -1181,16 +1209,16 @@ begin
OutputFilename:=AFile.GetOutputFilename; OutputFilename:=AFile.GetOutputFilename;
TempCHeaderFilename:=ChangeFileExt(OutputFilename,'.tmp.h'); TempCHeaderFilename:=ChangeFileExt(OutputFilename,'.tmp.h');
if not CopyFile(InputFilename,TempCHeaderFilename) then begin
Result:=IDEMessageDialog('Copying file failed',
'Unable to copy file "'+InputFilename+'"'#13
+'to "'+TempCHeaderFilename+'"',
mtError,[mbCancel,mbAbort],'');
exit;
end;
TextConverter:=TIDETextConverter.Create(nil); TextConverter:=TIDETextConverter.Create(nil);
try try
if not CopyFile(InputFilename,TempCHeaderFilename) then begin
Result:=IDEMessageDialog('Copying file failed',
'Unable to copy file "'+InputFilename+'"'#13
+'to "'+TempCHeaderFilename+'"',
mtError,[mbCancel,mbAbort],'');
exit;
end;
TextConverter.Filename:=TempCHeaderFilename; TextConverter.Filename:=TempCHeaderFilename;
FLastUsedFilename:=TextConverter.Filename; FLastUsedFilename:=TextConverter.Filename;
TextConverter.LoadFromFile(InputFilename); TextConverter.LoadFromFile(InputFilename);
@ -1229,6 +1257,8 @@ begin
finally finally
TextConverter.Free; TextConverter.Free;
if (LazarusIDE<>nil) then
LazarusIDE.DoRevertEditorFile(TempCHeaderFilename);
end; end;
Result:=mrOk; Result:=mrOk;
@ -1275,6 +1305,157 @@ begin
or ((Project<>nil) and (Project.CHeaderFileWithFilename(aFilename)<>nil)); or ((Project<>nil) and (Project.CHeaderFileWithFilename(aFilename)<>nil));
end; end;
{ TRemoveCPlusPlusExternCTool }
function TRemoveCPlusPlusExternCTool.ClassDescription: string;
begin
Result:='Remove C++ ''extern "C"'' lines';
end;
function TRemoveCPlusPlusExternCTool.Execute(aText: TIDETextConverter
): TModalResult;
var
i: Integer;
Lines: TStrings;
Line: string;
begin
Result:=mrCancel;
if aText=nil then exit;
Lines:=aText.Strings;
i:=0;
while i<=Lines.Count-1 do begin
Line:=Trim(Lines[i]);
if Line='extern "C" {' then begin
Lines[i]:='';
end
else if (i>0) and (Line='}') and (Lines[i-1]='#if defined(__cplusplus)')
then begin
Lines[i]:='';
end;
inc(i);
end;
Result:=mrOk;
end;
{ TRemoveEmptyCMacrosTool }
function TRemoveEmptyCMacrosTool.ClassDescription: string;
begin
Result:='Remove empty C macros';
end;
function TRemoveEmptyCMacrosTool.Execute(aText: TIDETextConverter
): TModalResult;
var
EmptyMacros: TAvgLvlTree;// tree of PChar
procedure AddEmptyMacro(const MacroName: string);
var
TempStr: String;
Identifier: PChar;
begin
DebugLn(['AddEmptyMacro MacroName="',MacroName,'"']);
if EmptyMacros=nil then
EmptyMacros:=TAvgLvlTree.Create(TListSortCompare(@CompareIdentifiers));
Identifier:=@MacroName[1];
if EmptyMacros.Find(Identifier)<>nil then exit;
TempStr:=MacroName; // increase refcount
if TempStr<>'' then
Pointer(TempStr):=nil;
EmptyMacros.Add(Identifier);
end;
procedure DeleteEmptyMacro(const MacroName: string);
var
OldMacroName: String;
Identifier: PChar;
Node: TAvgLvlTreeNode;
begin
DebugLn(['DeleteEmptyMacro MacroName="',MacroName,'"']);
if EmptyMacros=nil then exit;
Identifier:=@MacroName[1];
Node:=EmptyMacros.Find(Identifier);
if Node=nil then exit;
OldMacroName:='';
Pointer(OldMacroName):=Node.Data;
if OldMacroName<>'' then OldMacroName:=''; // decrease refcount
EmptyMacros.Delete(Node);
end;
procedure FreeMacros;
var
CurMacroName: String;
Node: TAvgLvlTreeNode;
begin
if EmptyMacros=nil then exit;
CurMacroName:='';
Node:=EmptyMacros.FindLowest;
while Node<>nil do begin
Pointer(CurMacroName):=Node.Data;
if CurMacroName<>'' then CurMacroName:=''; // decrease refcount
Node:=EmptyMacros.FindSuccessor(Node);
end;
EmptyMacros.Free;
end;
procedure RemoveEmptyMacrosFromString(var s: string);
var
IdentEnd: Integer;
IdentStart: LongInt;
Identifier: PChar;
IdentLen: LongInt;
begin
if EmptyMacros=nil then exit;
IdentEnd:=1;
repeat
IdentStart:=FindNextIdentifier(s,IdentEnd,length(s));
if IdentStart>length(s) then exit;
Identifier:=@s[IdentStart];
IdentLen:=GetIdentLen(Identifier);
if EmptyMacros.Find(Identifier)<>nil then begin
// empty macro found -> remove
System.Delete(s,IdentStart,IdentLen);
IdentEnd:=IdentStart;
end else begin
IdentEnd:=IdentStart+IdentLen;
end;
until false;
end;
var
MacroStart, MacroLen: integer;
Lines: TStrings;
i: Integer;
Line: string;
MacroName: String;
begin
Result:=mrCancel;
if aText=nil then exit;
Lines:=aText.Strings;
EmptyMacros:=nil;
try
i:=0;
while i<=Lines.Count-1 do begin
Line:=Lines[i];
if REMatches(Line,'^#define\s+([a-zA-Z0-9_]+)\b(.*)$') then begin
REVarPos(1,MacroStart,MacroLen);
MacroName:=copy(Line,MacroStart,MacroLen);
if Trim(copy(Line,MacroStart+MacroLen,length(Line)))='' then
AddEmptyMacro(MacroName)
else
DeleteEmptyMacro(MacroName);
end;
if (Line<>'') and (Line[1]<>'#') then
RemoveEmptyMacrosFromString(Line);
Lines[i]:=Line;
inc(i);
end;
finally
FreeMacros;
end;
Result:=mrOk;
end;
end. end.

View File

@ -16,10 +16,10 @@ object H2PasDialog: TH2PasDialog
AnchorSideBottom.Control = OpenSettingsButton AnchorSideBottom.Control = OpenSettingsButton
Height = 465 Height = 465
Width = 785 Width = 785
ActivePage = FilesTabSheet ActivePage = SettingsTabSheet
Align = alTop Align = alTop
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
TabIndex = 0 TabIndex = 3
TabOrder = 4 TabOrder = 4
object FilesTabSheet: TTabSheet object FilesTabSheet: TTabSheet
Caption = 'FilesTabSheet' Caption = 'FilesTabSheet'

View File

@ -7,11 +7,11 @@ LazarusResources.Add('TH2PasDialog','FORMDATA',[
+#7#14'FormCloseQuery'#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDes' +#7#14'FormCloseQuery'#8'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDes'
+'troy'#9'OnKeyDown'#7#11'FormKeyDown'#8'Position'#7#15'poDesktopCenter'#0#12 +'troy'#9'OnKeyDown'#7#11'FormKeyDown'#8'Position'#7#15'poDesktopCenter'#0#12
+'TPageControl'#15'MainPageControl'#24'AnchorSideBottom.Control'#7#18'OpenSet' +'TPageControl'#15'MainPageControl'#24'AnchorSideBottom.Control'#7#18'OpenSet'
+'tingsButton'#6'Height'#3#209#1#5'Width'#3#17#3#10'ActivePage'#7#13'FilesTab' +'tingsButton'#6'Height'#3#209#1#5'Width'#3#17#3#10'ActivePage'#7#16'Settings'
+'Sheet'#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'ak' +'TabSheet'#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8
+'Bottom'#0#8'TabIndex'#2#0#8'TabOrder'#2#4#0#9'TTabSheet'#13'FilesTabSheet'#7 +'akBottom'#0#8'TabIndex'#2#3#8'TabOrder'#2#4#0#9'TTabSheet'#13'FilesTabSheet'
+'Caption'#6#13'FilesTabSheet'#0#13'TCheckListBox'#24'CHeaderFilesCheckListBo' +#7'Caption'#6#13'FilesTabSheet'#0#13'TCheckListBox'#24'CHeaderFilesCheckList'
+'x'#6'Height'#3#179#1#5'Width'#3#255#0#5'Align'#7#6'alLeft'#7'OnClick'#7#29 +'Box'#6'Height'#3#179#1#5'Width'#3#255#0#5'Align'#7#6'alLeft'#7'OnClick'#7#29
+'CHeaderFilesCheckListBoxClick'#11'OnItemClick'#7'!CHeaderFilesCheckListBoxI' +'CHeaderFilesCheckListBoxClick'#11'OnItemClick'#7'!CHeaderFilesCheckListBoxI'
+'temClick'#8'TabOrder'#2#0#8'TopIndex'#2#255#0#0#7'TButton'#21'AddCHeaderFil' +'temClick'#8'TabOrder'#2#0#8'TopIndex'#2#255#0#0#7'TButton'#21'AddCHeaderFil'
+'esButton'#22'AnchorSideLeft.Control'#7#21'CHeaderFilesSplitter1'#19'AnchorS' +'esButton'#22'AnchorSideLeft.Control'#7#21'CHeaderFilesSplitter1'#19'AnchorS'

View File

@ -176,13 +176,17 @@ var
Key: TIDEShortCut; Key: TIDEShortCut;
Cat: TIDECommandCategory; Cat: TIDECommandCategory;
begin begin
// register IDE shortcut and menu item
Key := IDEShortCut(VK_UNKNOWN,[],VK_UNKNOWN,[]); Key := IDEShortCut(VK_UNKNOWN,[],VK_UNKNOWN,[]);
Cat:=IDECommandList.FindCategoryByName(CommandCategoryToolMenuName); Cat:=IDECommandList.FindCategoryByName(CommandCategoryToolMenuName);
CmdH2PasTool := RegisterIDECommand(Cat , CmdH2PasTool := RegisterIDECommand(Cat ,
h2pH2Pas, h2pCreateUnitsFromCHeaderFiles, Key, nil, @ExecuteH2PasTool); h2pH2Pas, h2pCreateUnitsFromCHeaderFiles, Key, nil, @ExecuteH2PasTool);
RegisterIDEMenuCommand(itmSecondaryTools, h2pH2PasTool, h2pH2Pas, nil, nil, RegisterIDEMenuCommand(itmSecondaryTools, h2pH2PasTool, h2pH2Pas, nil, nil,
CmdH2PasTool); CmdH2PasTool);
// register text converter tools
TextConverterToolClasses.RegisterClass(TRemoveCPlusPlusExternCTool);
TextConverterToolClasses.RegisterClass(TRemoveEmptyCMacrosTool);
end; end;
{ TH2PasDialog } { TH2PasDialog }
@ -200,7 +204,7 @@ begin
h2pasOptionsCheckGroup.Caption:='Options'; h2pasOptionsCheckGroup.Caption:='Options';
with h2pasOptionsCheckGroup.Items do begin with h2pasOptionsCheckGroup.Items do begin
Add('-d '+'Use external; for all procedures'); Add('-d '+'Use external; for all procedures');
Add('-D '+'Use external libname name "func_name" for functions'); Add('-D '+'Use external libname name "func__name" for functions');
Add('-e '+'constants instead of enumeration type for C enums'); Add('-e '+'constants instead of enumeration type for C enums');
Add('-c '+'Compact outputmode, less spaces and empty lines'); Add('-c '+'Compact outputmode, less spaces and empty lines');
Add('-i '+'Create an include file instead of a unit'); Add('-i '+'Create an include file instead of a unit');
@ -210,10 +214,10 @@ begin
Add('-s '+'Strip comments'); Add('-s '+'Strip comments');
Add('-S '+'Strip comments and info'); Add('-S '+'Strip comments and info');
Add('-t '+'Prepend typedef types with T'); Add('-t '+'Prepend typedef types with T');
Add('-T '+'Prepend typedef types with T, and remove _'); Add('-T '+'Prepend typedef types with T, and remove __');
Add('-v '+'Replace pointer parameters by var'); Add('-v '+'Replace pointer parameters by var');
Add('-w '+'Handle special win32 macros'); Add('-w '+'Handle special win32 macros');
Add('-x '+'Handle SYS_TRAP of the PalmOS header files'); Add('-x '+'Handle SYS__TRAP of the PalmOS header files');
end; end;
OutputExtLabel.Caption:='Output extension of new file'; OutputExtLabel.Caption:='Output extension of new file';
OutputDirLabel.Caption:='Output directory'; OutputDirLabel.Caption:='Output directory';
@ -386,7 +390,7 @@ end;
procedure TH2PasDialog.NewSettingsButtonClick(Sender: TObject); procedure TH2PasDialog.NewSettingsButtonClick(Sender: TObject);
begin begin
Project.Filename:=''; Project.Filename:='';
Project.Clear; Project.Clear(true);
UpdateAll; UpdateAll;
end; end;
@ -705,6 +709,7 @@ procedure TH2PasDialog.UpdateConvertPage;
begin begin
ClearMessages; ClearMessages;
PreH2PasEdit.ListOfTools:=Project.PreH2PasTools; PreH2PasEdit.ListOfTools:=Project.PreH2PasTools;
//DebugLn(['TH2PasDialog.UpdateConvertPage PreH2PasEdit.ListOfTools=',PreH2PasEdit.ListOfTools.COmponentCount]);
end; end;
procedure TH2PasDialog.UpdateSettingsPage; procedure TH2PasDialog.UpdateSettingsPage;
@ -968,7 +973,7 @@ begin
end; end;
end else begin end else begin
// new project // new project
Project.Clear; Project.Clear(true);
Converter.CurrentProjectFilename:=NewFilename; Converter.CurrentProjectFilename:=NewFilename;
Project.Filename:=NewFilename; Project.Filename:=NewFilename;
end; end;

View File

@ -1,33 +1,25 @@
object TextConvListEditor: TTextConvListEditor object TextConvListEditor: TTextConvListEditor
ActiveControl = ToolsListBox
Caption = 'TextConvListEditor'
ClientHeight = 227
ClientWidth = 519
Constraints.MinHeight = 200
Constraints.MinWidth = 400
OnCreate = FormCreate
PixelsPerInch = 75
HorzScrollBar.Page = 518
VertScrollBar.Page = 226
Left = 290 Left = 290
Height = 227 Height = 227
Top = 202 Top = 202
Width = 519 Width = 519
HorzScrollBar.Page = 518
VertScrollBar.Page = 226
ActiveControl = ToolsListBox
Caption = 'TextConvListEditor'
Constraints.MinHeight = 200
Constraints.MinWidth = 400
OnCreate = FormCreate
object ToolsLabel: TLabel object ToolsLabel: TLabel
Caption = 'ToolsLabel'
Color = clNone
ParentColor = False
Left = 12 Left = 12
Height = 13 Height = 13
Top = 9 Top = 9
Width = 62 Width = 62
Caption = 'ToolsLabel'
Color = clNone
ParentColor = False
end end
object ToolsListBox: TListBox object ToolsListBox: TListBox
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
OnSelectionChange = ToolsListBoxSelectionChange
TabOrder = 0
TopIndex = -1
AnchorSideTop.Control = ToolsLabel AnchorSideTop.Control = ToolsLabel
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ToolsSplitter AnchorSideRight.Control = ToolsSplitter
@ -35,34 +27,25 @@ object TextConvListEditor: TTextConvListEditor
Height = 120 Height = 120
Top = 24 Top = 24
Width = 232 Width = 232
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
OnSelectionChange = ToolsListBoxSelectionChange
TabOrder = 0
TopIndex = -1
end end
object UpDownSplitter: TSplitter object UpDownSplitter: TSplitter
Align = alNone
Anchors = [akTop, akLeft, akRight]
Beveled = True
Cursor = crVSplit
Height = 5
Width = 519
ResizeAnchor = akBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Cursor = crVSplit Cursor = crVSplit
Height = 5 Height = 5
Top = 144 Top = 144
Width = 519 Width = 519
Align = alNone
Anchors = [akTop, akLeft, akRight]
Beveled = True
ResizeAnchor = akBottom
end end
object ToolsPanel: TPanel object ToolsPanel: TPanel
Anchors = [akTop, akLeft, akRight, akBottom]
BevelOuter = bvNone
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 144
ClientWidth = 283
TabOrder = 1
AnchorSideLeft.Control = ToolsSplitter AnchorSideLeft.Control = ToolsSplitter
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
@ -71,90 +54,96 @@ object TextConvListEditor: TTextConvListEditor
Left = 236 Left = 236
Height = 144 Height = 144
Width = 283 Width = 283
Anchors = [akTop, akLeft, akRight, akBottom]
BevelOuter = bvNone
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
TabOrder = 1
object AddToolButton: TButton object AddToolButton: TButton
Left = 6
Height = 26
Top = 6
Width = 120
BorderSpacing.InnerBorder = 4 BorderSpacing.InnerBorder = 4
Caption = 'AddToolButton' Caption = 'AddToolButton'
OnClick = AddToolButtonClick OnClick = AddToolButtonClick
TabOrder = 0 TabOrder = 0
Left = 6
Height = 26
Top = 6
Width = 120
end end
object DeleteToolButton: TButton object DeleteToolButton: TButton
Left = 132
Height = 26
Top = 6
Width = 137
BorderSpacing.InnerBorder = 4 BorderSpacing.InnerBorder = 4
Caption = 'DeleteToolButton' Caption = 'DeleteToolButton'
OnClick = DeleteToolButtonClick OnClick = DeleteToolButtonClick
TabOrder = 1 TabOrder = 1
Left = 132
Height = 26
Top = 6
Width = 137
end end
object MoveToolUpButton: TButton object MoveToolUpButton: TButton
Left = 6
Height = 26
Top = 38
Width = 120
BorderSpacing.InnerBorder = 4 BorderSpacing.InnerBorder = 4
Caption = 'MoveToolUpButton' Caption = 'MoveToolUpButton'
OnClick = MoveToolUpButtonClick OnClick = MoveToolUpButtonClick
TabOrder = 2 TabOrder = 2
Left = 6
Height = 26
Top = 38
Width = 120
end end
object MoveToolDownButton: TButton object MoveToolDownButton: TButton
Left = 132
Height = 26
Top = 38
Width = 137
BorderSpacing.InnerBorder = 4 BorderSpacing.InnerBorder = 4
Caption = 'MoveToolDownButton' Caption = 'MoveToolDownButton'
OnClick = MoveToolDownButtonClick OnClick = MoveToolDownButtonClick
TabOrder = 3 TabOrder = 3
Left = 132
Height = 26
Top = 38
Width = 137
end end
object CopyToolButton: TButton object CopyToolButton: TButton
Left = 6
Height = 26
Top = 70
Width = 120
BorderSpacing.InnerBorder = 4 BorderSpacing.InnerBorder = 4
Caption = 'CopyToolButton' Caption = 'CopyToolButton'
OnClick = CopyToolButtonClick OnClick = CopyToolButtonClick
TabOrder = 4 TabOrder = 4
Left = 6
Height = 26
Top = 70
Width = 120
end end
object PasteButton: TButton object PasteButton: TButton
BorderSpacing.InnerBorder = 4
Caption = 'PasteButton'
OnClick = PasteButtonClick
TabOrder = 5
Left = 132 Left = 132
Height = 26 Height = 26
Top = 70 Top = 70
Width = 137 Width = 137
BorderSpacing.InnerBorder = 4
Caption = 'PasteButton'
OnClick = PasteButtonClick
TabOrder = 5
end end
object CloneButton: TButton object CloneButton: TButton
BorderSpacing.InnerBorder = 4
Caption = 'CloneButton'
OnClick = CloneButtonClick
TabOrder = 6
Left = 6 Left = 6
Height = 26 Height = 26
Top = 102 Top = 102
Width = 120 Width = 120
BorderSpacing.InnerBorder = 4
Caption = 'CloneButton'
OnClick = CloneButtonClick
TabOrder = 6
end end
end end
object ToolsSplitter: TSplitter object ToolsSplitter: TSplitter
Align = alNone
Anchors = [akTop, akLeft, akBottom]
Beveled = True
Height = 144
Width = 4
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = UpDownSplitter AnchorSideBottom.Control = UpDownSplitter
Cursor = crHSplit
Left = 232 Left = 232
Height = 144 Height = 144
Width = 4 Width = 4
Align = alNone
Anchors = [akTop, akLeft, akBottom]
Beveled = True
end end
end end

View File

@ -1,56 +1,53 @@
{ Dies ist eine automatisch erzeugte Lazarus-Ressourcendatei } { Dies ist eine automatisch erzeugte Lazarus-Ressourcendatei }
LazarusResources.Add('TTextConvListEditor','FORMDATA',[ LazarusResources.Add('TTextConvListEditor','FORMDATA',[
'TPF0'#19'TTextConvListEditor'#18'TextConvListEditor'#13'ActiveControl'#7#12 'TPF0'#19'TTextConvListEditor'#18'TextConvListEditor'#4'Left'#3'"'#1#6'Height'
+'ToolsListBox'#7'Caption'#6#18'TextConvListEditor'#12'ClientHeight'#3#227#0 +#3#227#0#3'Top'#3#202#0#5'Width'#3#7#2#18'HorzScrollBar.Page'#3#6#2#18'VertS'
+#11'ClientWidth'#3#7#2#21'Constraints.MinHeight'#3#200#0#20'Constraints.MinW' +'crollBar.Page'#3#226#0#13'ActiveControl'#7#12'ToolsListBox'#7'Caption'#6#18
+'idth'#3#144#1#8'OnCreate'#7#10'FormCreate'#13'PixelsPerInch'#2'K'#18'HorzSc' +'TextConvListEditor'#21'Constraints.MinHeight'#3#200#0#20'Constraints.MinWid'
+'rollBar.Page'#3#6#2#18'VertScrollBar.Page'#3#226#0#4'Left'#3'"'#1#6'Height' +'th'#3#144#1#8'OnCreate'#7#10'FormCreate'#0#6'TLabel'#10'ToolsLabel'#4'Left'
+#3#227#0#3'Top'#3#202#0#5'Width'#3#7#2#0#6'TLabel'#10'ToolsLabel'#7'Caption' +#2#12#6'Height'#2#13#3'Top'#2#9#5'Width'#2'>'#7'Caption'#6#10'ToolsLabel'#5
+#6#10'ToolsLabel'#5'Color'#7#6'clNone'#11'ParentColor'#8#4'Left'#2#12#6'Heig' +'Color'#7#6'clNone'#11'ParentColor'#8#0#0#8'TListBox'#12'ToolsListBox'#21'An'
+'ht'#2#13#3'Top'#2#9#5'Width'#2'>'#0#0#8'TListBox'#12'ToolsListBox'#7'Anchor' +'chorSideTop.Control'#7#10'ToolsLabel'#18'AnchorSideTop.Side'#7#9'asrBottom'
+'s'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#17'BorderSpacing.Top'#2#2 +#23'AnchorSideRight.Control'#7#13'ToolsSplitter'#24'AnchorSideBottom.Control'
+#17'OnSelectionChange'#7#27'ToolsListBoxSelectionChange'#8'TabOrder'#2#0#8'T' +#7#14'UpDownSplitter'#6'Height'#2'x'#3'Top'#2#24#5'Width'#3#232#0#7'Anchors'
+'opIndex'#2#255#21'AnchorSideTop.Control'#7#10'ToolsLabel'#18'AnchorSideTop.' +#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#17'BorderSpacing.Top'#2#2#17
+'Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#13'ToolsSplitter'#24'Anc' +'OnSelectionChange'#7#27'ToolsListBoxSelectionChange'#8'TabOrder'#2#0#8'TopI'
+'horSideBottom.Control'#7#14'UpDownSplitter'#6'Height'#2'x'#3'Top'#2#24#5'Wi' +'ndex'#2#255#0#0#9'TSplitter'#14'UpDownSplitter'#23'AnchorSideRight.Control'
+'dth'#3#232#0#0#0#9'TSplitter'#14'UpDownSplitter'#5'Align'#7#6'alNone'#7'Anc' +#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#6'Cursor'#7#8'crVSplit'#6
+'hors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Beveled'#9#6'Cursor'#7#8'crVSpli' +'Height'#2#5#3'Top'#3#144#0#5'Width'#3#7#2#5'Align'#7#6'alNone'#7'Anchors'#11
+'t'#6'Height'#2#5#5'Width'#3#7#2#12'ResizeAnchor'#7#8'akBottom'#23'AnchorSid' +#5'akTop'#6'akLeft'#7'akRight'#0#7'Beveled'#9#12'ResizeAnchor'#7#8'akBottom'
+'eRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#6'Cursor' +#0#0#6'TPanel'#10'ToolsPanel'#22'AnchorSideLeft.Control'#7#13'ToolsSplitter'
+#7#8'crVSplit'#6'Height'#2#5#3'Top'#3#144#0#5'Width'#3#7#2#0#0#6'TPanel'#10
+'ToolsPanel'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#10'Be'
+'velOuter'#7#6'bvNone'#28'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.T'
+'opBottomSpacing'#2#6#29'ChildSizing.HorizontalSpacing'#2#6#27'ChildSizing.V'
+'erticalSpacing'#2#6#18'ChildSizing.Layout'#7#29'cclLeftToRightThenTopToBott'
+'om'#27'ChildSizing.ControlsPerLine'#2#2#12'ClientHeight'#3#144#0#11'ClientW'
+'idth'#3#27#1#8'TabOrder'#2#1#22'AnchorSideLeft.Control'#7#13'ToolsSplitter'
+#19'AnchorSideLeft.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#5'Owne' +#19'AnchorSideLeft.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#5'Owne'
+'r'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#14 +'r'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#14
+'UpDownSplitter'#4'Left'#3#236#0#6'Height'#3#144#0#5'Width'#3#27#1#0#7'TButt' +'UpDownSplitter'#4'Left'#3#236#0#6'Height'#3#144#0#5'Width'#3#27#1#7'Anchors'
+'on'#13'AddToolButton'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#13'Add' +#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#10'BevelOuter'#7#6'bvNone'#28
+'ToolButton'#7'OnClick'#7#18'AddToolButtonClick'#8'TabOrder'#2#0#4'Left'#2#6 +'ChildSizing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'C'
+#6'Height'#2#26#3'Top'#2#6#5'Width'#2'x'#0#0#7'TButton'#16'DeleteToolButton' +'hildSizing.HorizontalSpacing'#2#6#27'ChildSizing.VerticalSpacing'#2#6#18'Ch'
+#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#16'DeleteToolButton'#7'OnCli' +'ildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.Contro'
+'ck'#7#21'DeleteToolButtonClick'#8'TabOrder'#2#1#4'Left'#3#132#0#6'Height'#2 +'lsPerLine'#2#2#8'TabOrder'#2#1#0#7'TButton'#13'AddToolButton'#4'Left'#2#6#6
+#26#3'Top'#2#6#5'Width'#3#137#0#0#0#7'TButton'#16'MoveToolUpButton'#25'Borde' +'Height'#2#26#3'Top'#2#6#5'Width'#2'x'#25'BorderSpacing.InnerBorder'#2#4#7'C'
+'rSpacing.InnerBorder'#2#4#7'Caption'#6#16'MoveToolUpButton'#7'OnClick'#7#21 +'aption'#6#13'AddToolButton'#7'OnClick'#7#18'AddToolButtonClick'#8'TabOrder'
+'MoveToolUpButtonClick'#8'TabOrder'#2#2#4'Left'#2#6#6'Height'#2#26#3'Top'#2 +#2#0#0#0#7'TButton'#16'DeleteToolButton'#4'Left'#3#132#0#6'Height'#2#26#3'To'
+'&'#5'Width'#2'x'#0#0#7'TButton'#18'MoveToolDownButton'#25'BorderSpacing.Inn' +'p'#2#6#5'Width'#3#137#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#16'D'
+'erBorder'#2#4#7'Caption'#6#18'MoveToolDownButton'#7'OnClick'#7#23'MoveToolD' +'eleteToolButton'#7'OnClick'#7#21'DeleteToolButtonClick'#8'TabOrder'#2#1#0#0
+'ownButtonClick'#8'TabOrder'#2#3#4'Left'#3#132#0#6'Height'#2#26#3'Top'#2'&'#5 +#7'TButton'#16'MoveToolUpButton'#4'Left'#2#6#6'Height'#2#26#3'Top'#2'&'#5'Wi'
+'Width'#3#137#0#0#0#7'TButton'#14'CopyToolButton'#25'BorderSpacing.InnerBord' +'dth'#2'x'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#16'MoveToolUpButto'
+'er'#2#4#7'Caption'#6#14'CopyToolButton'#7'OnClick'#7#19'CopyToolButtonClick' +'n'#7'OnClick'#7#21'MoveToolUpButtonClick'#8'TabOrder'#2#2#0#0#7'TButton'#18
+#8'TabOrder'#2#4#4'Left'#2#6#6'Height'#2#26#3'Top'#2'F'#5'Width'#2'x'#0#0#7 +'MoveToolDownButton'#4'Left'#3#132#0#6'Height'#2#26#3'Top'#2'&'#5'Width'#3
+'TButton'#11'PasteButton'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#11 +#137#0#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#18'MoveToolDownButton'
+'PasteButton'#7'OnClick'#7#16'PasteButtonClick'#8'TabOrder'#2#5#4'Left'#3#132 +#7'OnClick'#7#23'MoveToolDownButtonClick'#8'TabOrder'#2#3#0#0#7'TButton'#14
+#0#6'Height'#2#26#3'Top'#2'F'#5'Width'#3#137#0#0#0#7'TButton'#11'CloneButton' +'CopyToolButton'#4'Left'#2#6#6'Height'#2#26#3'Top'#2'F'#5'Width'#2'x'#25'Bor'
+#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#11'CloneButton'#7'OnClick'#7 +'derSpacing.InnerBorder'#2#4#7'Caption'#6#14'CopyToolButton'#7'OnClick'#7#19
+#16'CloneButtonClick'#8'TabOrder'#2#6#4'Left'#2#6#6'Height'#2#26#3'Top'#2'f' +'CopyToolButtonClick'#8'TabOrder'#2#4#0#0#7'TButton'#11'PasteButton'#4'Left'
+#5'Width'#2'x'#0#0#0#9'TSplitter'#13'ToolsSplitter'#5'Align'#7#6'alNone'#7'A' +#3#132#0#6'Height'#2#26#3'Top'#2'F'#5'Width'#3#137#0#25'BorderSpacing.InnerB'
+'nchors'#11#5'akTop'#6'akLeft'#8'akBottom'#0#7'Beveled'#9#6'Height'#3#144#0#5 +'order'#2#4#7'Caption'#6#11'PasteButton'#7'OnClick'#7#16'PasteButtonClick'#8
+'Width'#2#4#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control' +'TabOrder'#2#5#0#0#7'TButton'#11'CloneButton'#4'Left'#2#6#6'Height'#2#26#3'T'
+#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Cont' +'op'#2'f'#5'Width'#2'x'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#11'Cl'
+'rol'#7#14'UpDownSplitter'#6'Cursor'#7#8'crHSplit'#4'Left'#3#232#0#6'Height' +'oneButton'#7'OnClick'#7#16'CloneButtonClick'#8'TabOrder'#2#6#0#0#0#9'TSplit'
+#3#144#0#5'Width'#2#4#0#0#0 +'ter'#13'ToolsSplitter'#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRi'
+'ght.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSi'
+'deBottom.Control'#7#14'UpDownSplitter'#4'Left'#3#232#0#6'Height'#3#144#0#5
+'Width'#2#4#5'Align'#7#6'alNone'#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom'
+#0#7'Beveled'#9#0#0#0
]); ]);

View File

@ -168,6 +168,7 @@ begin
if csDestroying in ComponentState then exit; if csDestroying in ComponentState then exit;
UpdateButtons; UpdateButtons;
Tool:=GetCurrentTool; Tool:=GetCurrentTool;
//DebugLn(['TTextConvListEditor.ToolsListBoxSelectionChange Tool=',dbgsName(Tool)]);
PropertyGrid.TIObject:=Tool; PropertyGrid.TIObject:=Tool;
end; end;
@ -318,6 +319,7 @@ begin
Result:=nil; Result:=nil;
if FListOfTools=nil then exit; if FListOfTools=nil then exit;
i:=ToolsListBox.ItemIndex; i:=ToolsListBox.ItemIndex;
//DebugLn(['TTextConvListEditor.GetCurrentTool ',dbgsName(Self),' ToolsListBox.ItemIndex=',ToolsListBox.ItemIndex,' FListOfTools.ComponentCount=',FListOfTools.ComponentCount]);
if (i<0) or (i>=FListOfTools.ComponentCount) then exit; if (i<0) or (i>=FListOfTools.ComponentCount) then exit;
Result:=TCustomTextConverterTool(FListOfTools.Components[i]); Result:=TCustomTextConverterTool(FListOfTools.Components[i]);
end; end;

View File

@ -40,6 +40,7 @@ uses
CodeToolManager, DefineTemplates, CodeToolManager, DefineTemplates,
// IDEIntf // IDEIntf
SrcEditorIntf, ProjectIntf, MacroIntf, IDEDialogs, IDEExternToolIntf, SrcEditorIntf, ProjectIntf, MacroIntf, IDEDialogs, IDEExternToolIntf,
LazIDEIntf,
// IDE // IDE
LazarusIDEStrConsts, DialogProcs, IDEProcs, CodeToolsOptions, InputHistory, LazarusIDEStrConsts, DialogProcs, IDEProcs, CodeToolsOptions, InputHistory,
MiscOptions, LazConf, EnvironmentOpts, TransferMacros, CompilerOptions, MiscOptions, LazConf, EnvironmentOpts, TransferMacros, CompilerOptions,
@ -1122,7 +1123,9 @@ begin
if SourceEditorWindow<>nil then if SourceEditorWindow<>nil then
SourceEditorWindow.ClearErrorLines; SourceEditorWindow.ClearErrorLines;
Result:=EnvironmentOptions.ExternalTools.Run(ExtTool,GlobalMacroList, Result:=EnvironmentOptions.ExternalTools.Run(ExtTool,GlobalMacroList,
TheOutputFilter,CompOptions); nil,CompOptions);
if LazarusIDE<>nil then
LazarusIDE.DoCheckFilesOnDisk;
end; end;
procedure TBuildManager.SetBuildTarget(const TargetOS, TargetCPU, procedure TBuildManager.SetBuildTarget(const TargetOS, TargetCPU,

View File

@ -641,6 +641,7 @@ type
function DoOpenFileAndJumpToPos(const AFilename: string; function DoOpenFileAndJumpToPos(const AFilename: string;
const CursorPosition: TPoint; TopLine: integer; const CursorPosition: TPoint; TopLine: integer;
PageIndex: integer; Flags: TOpenFlags): TModalResult; override; PageIndex: integer; Flags: TOpenFlags): TModalResult; override;
function DoRevertEditorFile(const Filename: string): TModalResult; override;
function DoSaveAll(Flags: TSaveFlags): TModalResult; function DoSaveAll(Flags: TSaveFlags): TModalResult;
procedure DoRestart; procedure DoRestart;
function DoOpenMainUnit(Flags: TOpenFlags): TModalResult; function DoOpenMainUnit(Flags: TOpenFlags): TModalResult;
@ -5383,6 +5384,11 @@ function TMainIDE.DoOpenFileInSourceEditor(AnUnitInfo: TUnitInfo;
var NewSrcEdit: TSourceEditor; var NewSrcEdit: TSourceEditor;
AFilename: string; AFilename: string;
NewSrcEditorCreated: boolean; NewSrcEditorCreated: boolean;
NewCaretXY: TPoint;
NewTopLine: LongInt;
NewLeftChar: LongInt;
NewErrorLine: LongInt;
NewExecutionLine: LongInt;
begin begin
AFilename:=AnUnitInfo.Filename; AFilename:=AnUnitInfo.Filename;
@ -5405,9 +5411,19 @@ begin
NewSrcEditorCreated:=true; NewSrcEditorCreated:=true;
MainIDEBar.itmFileClose.Enabled:=True; MainIDEBar.itmFileClose.Enabled:=True;
MainIDEBar.itmFileCloseAll.Enabled:=True; MainIDEBar.itmFileCloseAll.Enabled:=True;
NewCaretXY:=AnUnitInfo.CursorPos;
NewTopLine:=AnUnitInfo.TopLine;
NewLeftChar:=1;
NewErrorLine:=-1;
NewExecutionLine:=-1;
end else begin end else begin
// revert code in existing source editor // revert code in existing source editor
NewSrcEdit:=SourceNotebook.FindSourceEditorWithPageIndex(PageIndex); NewSrcEdit:=SourceNotebook.FindSourceEditorWithPageIndex(PageIndex);
NewCaretXY:=NewSrcEdit.EditorComponent.CaretXY;
NewTopLine:=NewSrcEdit.EditorComponent.TopLine;
NewLeftChar:=NewSrcEdit.EditorComponent.LeftChar;
NewErrorLine:=NewSrcEdit.ErrorLine;
NewExecutionLine:=NewSrcEdit.ExecutionLine;
NewSrcEdit.EditorComponent.BeginUpdate; NewSrcEdit.EditorComponent.BeginUpdate;
NewSrcEdit.CodeBuffer:=AnUnitInfo.Source; NewSrcEdit.CodeBuffer:=AnUnitInfo.Source;
NewSrcEdit.Modified:=false; NewSrcEdit.Modified:=false;
@ -5423,9 +5439,11 @@ begin
DoRestoreBookMarks(AnUnitInfo,NewSrcEdit); DoRestoreBookMarks(AnUnitInfo,NewSrcEdit);
DebugBoss.DoRestoreDebuggerMarks(AnUnitInfo); DebugBoss.DoRestoreDebuggerMarks(AnUnitInfo);
NewSrcEdit.SyntaxHighlighterType:=AnUnitInfo.SyntaxHighlighter; NewSrcEdit.SyntaxHighlighterType:=AnUnitInfo.SyntaxHighlighter;
NewSrcEdit.EditorComponent.CaretXY:=AnUnitInfo.CursorPos; NewSrcEdit.EditorComponent.CaretXY:=NewCaretXY;
NewSrcEdit.EditorComponent.TopLine:=AnUnitInfo.TopLine; NewSrcEdit.EditorComponent.TopLine:=NewTopLine;
NewSrcEdit.EditorComponent.LeftChar:=1; NewSrcEdit.EditorComponent.LeftChar:=NewLeftChar;
NewSrcEdit.ErrorLine:=NewErrorLine;
NewSrcEdit.ExecutionLine:=NewExecutionLine;
NewSrcEdit.ReadOnly:=AnUnitInfo.ReadOnly; NewSrcEdit.ReadOnly:=AnUnitInfo.ReadOnly;
// mark unit as loaded // mark unit as loaded
@ -5904,9 +5922,7 @@ begin
FilenameNoPath:=ExtractFilename(AFilename); FilenameNoPath:=ExtractFilename(AFilename);
// check to not open directories // check to not open directories
if (not (ofRevert in Flags)) if ((FilenameNoPath='') or (FilenameNoPath='.') or (FilenameNoPath='..')) then
and ((FilenameNoPath='') or (FilenameNoPath='.') or (FilenameNoPath='..'))
then
exit; exit;
if ([ofAddToRecent,ofRevert,ofVirtualFile]*Flags=[ofAddToRecent]) if ([ofAddToRecent,ofRevert,ofVirtualFile]*Flags=[ofAddToRecent])
@ -6521,6 +6537,18 @@ begin
end; end;
end; end;
function TMainIDE.DoRevertEditorFile(const Filename: string): TModalResult;
var
AnUnitInfo: TUnitInfo;
begin
Result:=mrOk;
if (Project1<>nil) then begin
AnUnitInfo:=Project1.UnitInfoWithFilename(Filename,[]);
if AnUnitInfo.EditorIndex>=0 then
Result:=DoOpenEditorFile(Filename,AnUnitInfo.EditorIndex,[ofRevert]);
end;
end;
function TMainIDE.DoNewProject(ProjectDesc: TProjectDescriptor):TModalResult; function TMainIDE.DoNewProject(ProjectDesc: TProjectDescriptor):TModalResult;
var i:integer; var i:integer;
Begin Begin
@ -7450,7 +7478,6 @@ begin
if Result<>mrOk then exit; if Result<>mrOk then exit;
// show messages // show messages
MessagesView.Clear;
MessagesView.BeginBlock; MessagesView.BeginBlock;
try try
@ -11588,14 +11615,9 @@ begin
SourceNotebook.ClearErrorLines; SourceNotebook.ClearErrorLines;
ToolStatus:=itBuilder; ToolStatus:=itBuilder;
if CheckCompilerOptsDlg<>nil then begin MessagesView.Clear;
TheOutputFilter.OnAddFilteredLine:=@CheckCompilerOptsDlg.AddMsg; DoArrangeSourceEditorAndMessageView(false);
TheOutputFilter.OnReadLine:=@CheckCompilerOptsDlg.AddProgress; ConnectOutputFilter;
end else begin
MessagesView.Clear;
DoArrangeSourceEditorAndMessageView(false);
ConnectOutputFilter;
end;
end; end;
procedure TMainIDE.OnExtToolFreeOutputFilter(OutputFilter: TOutputFilter; procedure TMainIDE.OnExtToolFreeOutputFilter(OutputFilter: TOutputFilter;

View File

@ -155,7 +155,6 @@ type
function DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult; virtual; abstract; function DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult; virtual; abstract;
function DoBuildLazarus(Flags: TBuildLazarusFlags): TModalResult; virtual; abstract; function DoBuildLazarus(Flags: TBuildLazarusFlags): TModalResult; virtual; abstract;
function DoSaveForBuild: TModalResult; virtual; abstract; function DoSaveForBuild: TModalResult; virtual; abstract;
function DoCheckFilesOnDisk(Instantaneous: boolean = false): TModalResult; virtual; abstract;
function DoPublishModule(Options: TPublishModuleOptions; function DoPublishModule(Options: TPublishModuleOptions;
const SrcDirectory, DestDirectory: string const SrcDirectory, DestDirectory: string
): TModalResult; virtual; abstract; ): TModalResult; virtual; abstract;

View File

@ -493,7 +493,6 @@ begin
ImproveMessages(DestStartIndex); ImproveMessages(DestStartIndex);
{for i:=0 to SrcLines.Count-1 do begin {for i:=0 to SrcLines.Count-1 do begin
SrcLine:=SrcLines[i]; SrcLine:=SrcLines[i];
DebugLn('TMessagesView.CollectLineParts i=',dbgs(i),' SrcLine=',MsgAsString(SrcLine)); DebugLn('TMessagesView.CollectLineParts i=',dbgs(i),' SrcLine=',MsgAsString(SrcLine));
@ -509,16 +508,19 @@ var
LastSeparator: integer; LastSeparator: integer;
begin begin
BeginBlock; BeginBlock;
LastSeparator := VisibleItemCount - 1; try
while (LastSeparator >= 0) and (VisibleItems[LastSeparator].Msg <> SeparatorLine) do LastSeparator := VisibleItemCount - 1;
Dec(LastSeparator); while (LastSeparator >= 0) and (VisibleItems[LastSeparator].Msg <> SeparatorLine) do
if LastSeparator >= 0 then Dec(LastSeparator);
begin if LastSeparator >= 0 then
while (VisibleItemCount > LastSeparator) do begin
DeleteLine(LinesCount - 1); while (VisibleItemCount > LastSeparator) do
FLastLineIsProgress := False; DeleteLine(LinesCount - 1);
FLastLineIsProgress := False;
end;
finally
EndBlock;
end; end;
EndBlock;
end; end;
procedure TMessagesView.ShowTopMessage; procedure TMessagesView.ShowTopMessage;
@ -686,6 +688,7 @@ end;
procedure TMessagesView.BeginBlock; procedure TMessagesView.BeginBlock;
begin begin
Clear; Clear;
//if fBlockCount=0 then DumpStack;
Inc(fBlockCount); Inc(fBlockCount);
end; end;
@ -694,6 +697,7 @@ begin
if fBlockCount <= 0 then if fBlockCount <= 0 then
RaiseException('TMessagesView.EndBlock Internal Error'); RaiseException('TMessagesView.EndBlock Internal Error');
Dec(fBlockCount); Dec(fBlockCount);
//if fBlockCount=0 then DumpStack;
end; end;
procedure TMessagesView.ClearItems; procedure TMessagesView.ClearItems;

View File

@ -452,7 +452,7 @@ begin
Result:=''; Result:='';
end; end;
procedure SynREVarPos(Index: Integer; var MatchStart, MatchLength: integer); procedure SynREVarPos(Index: Integer; out MatchStart, MatchLength: integer);
begin begin
if SynREEngine<>nil then begin if SynREEngine<>nil then begin
MatchStart:=SynREEngine.MatchPos[Index]; MatchStart:=SynREEngine.MatchPos[Index];

View File

@ -101,11 +101,11 @@ type
procedure SetCaption(const AValue: string); procedure SetCaption(const AValue: string);
procedure SetDescription(const AValue: string); procedure SetDescription(const AValue: string);
public public
class function ClassDescription: string; virtual; abstract;//the first line should be a short title
class function FirstLineOfClassDescription: string;
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
function Execute(aText: TIDETextConverter): TModalResult; virtual; abstract; function Execute(aText: TIDETextConverter): TModalResult; virtual; abstract;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
class function ClassDescription: string; virtual; abstract;//the first line should be a short title
class function FirstLineOfClassDescription: string;
published published
property Caption: string read FCaption write SetCaption; property Caption: string read FCaption write SetCaption;
property Description: string read FDescription write SetDescription; property Description: string read FDescription write SetDescription;
@ -135,9 +135,9 @@ type
procedure SetReplaceWith(const AValue: string); procedure SetReplaceWith(const AValue: string);
procedure SetSearchFor(const AValue: string); procedure SetSearchFor(const AValue: string);
public public
class function ClassDescription: string; override;
function Execute(aText: TIDETextConverter): TModalResult; override; function Execute(aText: TIDETextConverter): TModalResult; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
class function ClassDescription: string; override;
property SearchFor: string read FSearchFor write SetSearchFor; property SearchFor: string read FSearchFor write SetSearchFor;
property ReplaceWith: string read FReplaceWith write SetReplaceWith; property ReplaceWith: string read FReplaceWith write SetReplaceWith;
property Options: TTextReplaceToolOptions read FOptions write SetOptions; property Options: TTextReplaceToolOptions read FOptions write SetOptions;
@ -612,7 +612,10 @@ end;
function TTextConverterToolClasses.GetCount: integer; function TTextConverterToolClasses.GetCount: integer;
begin begin
Result:=FItems.Count; if Self<>nil then
Result:=FItems.Count
else
Result:=0;
end; end;
function TTextConverterToolClasses.GetItems(Index: integer function TTextConverterToolClasses.GetItems(Index: integer
@ -636,6 +639,7 @@ end;
procedure TTextConverterToolClasses.RegisterClass( procedure TTextConverterToolClasses.RegisterClass(
AClass: TCustomTextConverterToolClass); AClass: TCustomTextConverterToolClass);
begin begin
if Self=nil then exit;
if FItems.IndexOf(AClass)<0 then if FItems.IndexOf(AClass)<0 then
FItems.Add(AClass); FItems.Add(AClass);
end; end;
@ -643,6 +647,7 @@ end;
procedure TTextConverterToolClasses.UnregisterClass( procedure TTextConverterToolClasses.UnregisterClass(
AClass: TCustomTextConverterToolClass); AClass: TCustomTextConverterToolClass);
begin begin
if Self=nil then exit;
FItems.Remove(AClass); FItems.Remove(AClass);
end; end;
@ -651,10 +656,11 @@ function TTextConverterToolClasses.FindByName(const aClassName: string
var var
i: Integer; i: Integer;
begin begin
for i:=0 to FItems.Count-1 do begin if Self<>nil then
Result:=Items[i]; for i:=0 to FItems.Count-1 do begin
if CompareText(Result.ClassName,aClassName)=0 then exit; Result:=Items[i];
end; if CompareText(Result.ClassName,aClassName)=0 then exit;
end;
Result:=nil; Result:=nil;
end; end;
@ -663,10 +669,11 @@ function TTextConverterToolClasses.FindByFirstLineOfClassDescription(
var var
i: Integer; i: Integer;
begin begin
for i:=0 to FItems.Count-1 do begin if Self<>nil then
Result:=Items[i]; for i:=0 to FItems.Count-1 do begin
if Result.FirstLineOfClassDescription=Line then exit; Result:=Items[i];
end; if Result.FirstLineOfClassDescription=Line then exit;
end;
Result:=nil; Result:=nil;
end; end;

View File

@ -158,6 +158,7 @@ type
function DoOpenFileAndJumpToPos(const AFilename: string; function DoOpenFileAndJumpToPos(const AFilename: string;
const CursorPosition: TPoint; TopLine: integer; const CursorPosition: TPoint; TopLine: integer;
PageIndex: integer; Flags: TOpenFlags): TModalResult; virtual; abstract; PageIndex: integer; Flags: TOpenFlags): TModalResult; virtual; abstract;
function DoRevertEditorFile(const Filename: string): TModalResult; virtual; abstract;
// project // project
property ActiveProject: TLazProject read GetActiveProject; property ActiveProject: TLazProject read GetActiveProject;
@ -192,6 +193,7 @@ type
FocusEditor: boolean): boolean; virtual; abstract; FocusEditor: boolean): boolean; virtual; abstract;
procedure DoJumpToNextError(DirectionDown: boolean); virtual; abstract; procedure DoJumpToNextError(DirectionDown: boolean); virtual; abstract;
procedure DoShowMessagesView; virtual; abstract; procedure DoShowMessagesView; virtual; abstract;
function DoCheckFilesOnDisk(Instantaneous: boolean = false): TModalResult; virtual; abstract;
// designer // designer
function GetDesignerWithProjectFile(AFile: TLazProjectFile; function GetDesignerWithProjectFile(AFile: TLazProjectFile;

View File

@ -241,8 +241,12 @@ type
end; end;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
TOIPropertyGridState = (pgsChangingItemIndex, pgsApplyingValue, TOIPropertyGridState = (
pgsUpdatingEditControl); pgsChangingItemIndex,
pgsApplyingValue,
pgsUpdatingEditControl,
pgsBuildPropertyListNeeded
);
TOIPropertyGridStates = set of TOIPropertyGridState; TOIPropertyGridStates = set of TOIPropertyGridState;
{ TOICustomPropertyGrid } { TOICustomPropertyGrid }
@ -285,6 +289,7 @@ type
FPropertyEditorHook: TPropertyEditorHook; FPropertyEditorHook: TPropertyEditorHook;
FRows: TList; FRows: TList;
FSelection: TPersistentSelectionList; FSelection: TPersistentSelectionList;
FNotificationComponents: TFPList;
FSplitterX: integer; // current splitter position FSplitterX: integer; // current splitter position
FStates: TOIPropertyGridStates; FStates: TOIPropertyGridStates;
FTopY: integer; FTopY: integer;
@ -297,6 +302,7 @@ type
procedure OnUserInput(Sender: TObject; Msg: Cardinal); procedure OnUserInput(Sender: TObject; Msg: Cardinal);
procedure IncreaseChangeStep; procedure IncreaseChangeStep;
function GridIsUpdating: boolean;
function GetRow(Index:integer):TOIPropertyGridRow; function GetRow(Index:integer):TOIPropertyGridRow;
function GetRowCount:integer; function GetRowCount:integer;
@ -324,6 +330,7 @@ type
procedure SetSelection(const ASelection:TPersistentSelectionList); procedure SetSelection(const ASelection:TPersistentSelectionList);
procedure SetPropertyEditorHook(NewPropertyEditorHook:TPropertyEditorHook); procedure SetPropertyEditorHook(NewPropertyEditorHook:TPropertyEditorHook);
procedure UpdateSelectionNotifications;
procedure AddPropertyEditor(PropEditor: TPropertyEditor); procedure AddPropertyEditor(PropEditor: TPropertyEditor);
procedure AddStringToComboBox(const s: string); procedure AddStringToComboBox(const s: string);
@ -334,7 +341,7 @@ type
procedure SetRowValue; procedure SetRowValue;
procedure DoCallEdit; procedure DoCallEdit;
procedure RefreshValueEdit; procedure RefreshValueEdit;
Procedure ValueEditDblClick(Sender : TObject); procedure ValueEditDblClick(Sender : TObject);
procedure ValueControlMouseDown(Sender: TObject; Button:TMouseButton; procedure ValueControlMouseDown(Sender: TObject; Button:TMouseButton;
Shift: TShiftState; X,Y:integer); Shift: TShiftState; X,Y:integer);
procedure ValueControlMouseMove(Sender: TObject; Shift: TShiftState; procedure ValueControlMouseMove(Sender: TObject; Shift: TShiftState;
@ -366,6 +373,7 @@ type
protected protected
procedure CreateParams(var Params: TCreateParams); override; procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override; procedure CreateWnd; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure MouseDown(Button:TMouseButton; Shift:TShiftState; X,Y:integer); override; procedure MouseDown(Button:TMouseButton; Shift:TShiftState; X,Y:integer); override;
procedure MouseMove(Shift:TShiftState; X,Y:integer); override; procedure MouseMove(Shift:TShiftState; X,Y:integer); override;
@ -404,7 +412,7 @@ type
function PropertyPath(Index: integer):string; function PropertyPath(Index: integer):string;
function PropertyPath(Row: TOIPropertyGridRow):string; function PropertyPath(Row: TOIPropertyGridRow):string;
function TopMax: integer; function TopMax: integer;
procedure BuildPropertyList; procedure BuildPropertyList(OnlyIfNeeded: boolean = false);
procedure Clear; procedure Clear;
procedure Paint; override; procedure Paint; override;
procedure PropEditLookupRootChange; procedure PropEditLookupRootChange;
@ -709,6 +717,7 @@ begin
FLayout := oilHorizontal; FLayout := oilHorizontal;
FSelection:=TPersistentSelectionList.Create; FSelection:=TPersistentSelectionList.Create;
FNotificationComponents:=TFPList.Create;
FPropertyEditorHook:=APropertyEditorHook; FPropertyEditorHook:=APropertyEditorHook;
FFilter:=TypeFilter; FFilter:=TypeFilter;
FItemIndex:=-1; FItemIndex:=-1;
@ -885,6 +894,22 @@ begin
UpdateScrollBar; UpdateScrollBar;
end; end;
procedure TOICustomPropertyGrid.Notification(AComponent: TComponent;
Operation: TOperation);
var
i: LongInt;
begin
if Operation=opRemove then begin
FNotificationComponents.Remove(AComponent);
i:=FSelection.IndexOf(AComponent);
if i>=0 then begin
FSelection.Delete(i);
Include(FStates,pgsBuildPropertyListNeeded);
end;
end;
inherited Notification(AComponent, Operation);
end;
procedure TOICustomPropertyGrid.WMVScroll(var Msg: TLMScroll); procedure TOICustomPropertyGrid.WMVScroll(var Msg: TLMScroll);
begin begin
case Msg.ScrollCode of case Msg.ScrollCode of
@ -913,6 +938,7 @@ begin
for a:=0 to FRows.Count-1 do Rows[a].Free; for a:=0 to FRows.Count-1 do Rows[a].Free;
FreeAndNil(FRows); FreeAndNil(FRows);
FreeAndNil(FSelection); FreeAndNil(FSelection);
FreeAndNil(FNotificationComponents);
FreeAndNil(FValueFont); FreeAndNil(FValueFont);
FreeAndNil(FDefaultValueFont); FreeAndNil(FDefaultValueFont);
FreeAndNil(FNameFont); FreeAndNil(FNameFont);
@ -975,6 +1001,7 @@ begin
ItemIndex:=-1; ItemIndex:=-1;
ClearRows; ClearRows;
FSelection.Assign(ASelection); FSelection.Assign(ASelection);
UpdateSelectionNotifications;
BuildPropertyList; BuildPropertyList;
CurRow:=GetRowByPath(OldSelectedRowPath); CurRow:=GetRowByPath(OldSelectedRowPath);
if CurRow<>nil then if CurRow<>nil then
@ -990,6 +1017,30 @@ begin
SetSelection(FSelection); SetSelection(FSelection);
end; end;
procedure TOICustomPropertyGrid.UpdateSelectionNotifications;
var
i: Integer;
AComponent: TComponent;
begin
for i:=0 to FSelection.Count-1 do begin
if FSelection[i] is TComponent then begin
AComponent:=TComponent(FSelection[i]);
if FNotificationComponents.IndexOf(AComponent)<0 then begin
FNotificationComponents.Add(AComponent);
AComponent.FreeNotification(Self);
end;
end;
end;
for i:=FNotificationComponents.Count-1 downto 0 do begin
AComponent:=TComponent(FNotificationComponents[i]);
if FSelection.IndexOf(AComponent)<0 then begin
FNotificationComponents.Delete(i);
AComponent.RemoveFreeNotification(Self);
end;
end;
//DebugLn(['TOICustomPropertyGrid.UpdateSelectionNotifications FNotificationComponents=',FNotificationComponents.Count,' FSelection=',FSelection.Count]);
end;
function TOICustomPropertyGrid.PropertyPath(Index:integer):string; function TOICustomPropertyGrid.PropertyPath(Index:integer):string;
begin begin
if (Index>=0) and (Index<FRows.Count) then begin if (Index>=0) and (Index<FRows.Count) then begin
@ -1116,7 +1167,7 @@ var
OldChangeStep: integer; OldChangeStep: integer;
begin begin
//writeln('#################### TOICustomPropertyGrid.DoCallEdit ...'); //writeln('#################### TOICustomPropertyGrid.DoCallEdit ...');
if (FStates*[pgsChangingItemIndex,pgsApplyingValue]<>[]) if GridIsUpdating
or (FCurrentEdit=nil) or (FCurrentEdit=nil)
or (FItemIndex<0) or (FItemIndex<0)
or (FItemIndex>=FRows.Count) or (FItemIndex>=FRows.Count)
@ -1168,7 +1219,7 @@ var
CurRow: TOIPropertyGridRow; CurRow: TOIPropertyGridRow;
NewValue: string; NewValue: string;
begin begin
if (FStates*[pgsChangingItemIndex,pgsApplyingValue]=[]) if (not GridIsUpdating)
and (FCurrentEdit<>nil) and (FCurrentEdit<>nil)
and (FItemIndex>=0) and (FItemIndex<FRows.Count) then begin and (FItemIndex>=0) and (FItemIndex<FRows.Count) then begin
CurRow:=Rows[FItemIndex]; CurRow:=Rows[FItemIndex];
@ -1275,8 +1326,7 @@ procedure TOICustomPropertyGrid.SetItemIndex(NewIndex:integer);
var NewRow:TOIPropertyGridRow; var NewRow:TOIPropertyGridRow;
NewValue:string; NewValue:string;
begin begin
if (FStates*[pgsChangingItemIndex,pgsApplyingValue]<>[]) if GridIsUpdating or (FItemIndex=NewIndex) then
or (FItemIndex=NewIndex) then
exit; exit;
// save old edit value // save old edit value
@ -1369,11 +1419,14 @@ begin
Result:=FRows.Count; Result:=FRows.Count;
end; end;
procedure TOICustomPropertyGrid.BuildPropertyList; procedure TOICustomPropertyGrid.BuildPropertyList(OnlyIfNeeded: boolean);
var a:integer; var a:integer;
CurRow:TOIPropertyGridRow; CurRow:TOIPropertyGridRow;
OldSelectedRowPath:string; OldSelectedRowPath:string;
begin begin
if OnlyIfNeeded and (not (pgsBuildPropertyListNeeded in FStates)) then exit;
Exclude(FStates,pgsBuildPropertyListNeeded);
OldSelectedRowPath:=PropertyPath(ItemIndex); OldSelectedRowPath:=PropertyPath(ItemIndex);
// unselect // unselect
ItemIndex:=-1; ItemIndex:=-1;
@ -1588,7 +1641,7 @@ end;
function TOICustomPropertyGrid.CanEditRowValue: boolean; function TOICustomPropertyGrid.CanEditRowValue: boolean;
begin begin
if (FStates*[pgsChangingItemIndex,pgsApplyingValue,pgsUpdatingEditControl]<>[]) if GridIsUpdating
or (FCurrentEdit=nil) or (FCurrentEdit=nil)
or (FItemIndex<0) or (FItemIndex<0)
or (FItemIndex>=FRows.Count) or (FItemIndex>=FRows.Count)
@ -2169,6 +2222,7 @@ procedure TOICustomPropertyGrid.DoPaint(PaintOnlyChangedValues:boolean);
var a:integer; var a:integer;
SpaceRect:TRect; SpaceRect:TRect;
begin begin
BuildPropertyList(true);
if not PaintOnlyChangedValues then begin if not PaintOnlyChangedValues then begin
with Canvas do begin with Canvas do begin
// draw properties // draw properties
@ -2498,12 +2552,18 @@ begin
FChangeStep:=-$7fffffff; FChangeStep:=-$7fffffff;
end; end;
function TOICustomPropertyGrid.GridIsUpdating: boolean;
begin
Result:=(FStates*[pgsChangingItemIndex,pgsApplyingValue,
pgsBuildPropertyListNeeded]<>[])
end;
procedure TOICustomPropertyGrid.ValueEditDblClick(Sender : TObject); procedure TOICustomPropertyGrid.ValueEditDblClick(Sender : TObject);
var var
CurRow: TOIPropertyGridRow; CurRow: TOIPropertyGridRow;
TypeKind : TTypeKind; TypeKind : TTypeKind;
begin begin
if (FStates*[pgsChangingItemIndex,pgsApplyingValue]<>[]) if GridIsUpdating
or (FCurrentEdit=nil) or (FCurrentEdit=nil)
or (FItemIndex<0) or (FItemIndex<0)
or (FItemIndex>=FRows.Count) or (FItemIndex>=FRows.Count)

View File

@ -1037,7 +1037,7 @@ type
TPersistentSelectionList = class TPersistentSelectionList = class
protected protected
FUpdateLock: integer; FUpdateLock: integer;
FPersistentList: TList; FPersistentList: TFPList;
function GetItems(AIndex: integer): TPersistent; function GetItems(AIndex: integer): TPersistent;
procedure SetItems(AIndex: integer; const APersistent: TPersistent); procedure SetItems(AIndex: integer; const APersistent: TPersistent);
function GetCount: integer; function GetCount: integer;
@ -1056,6 +1056,7 @@ type
property Capacity:integer read GetCapacity write SetCapacity; property Capacity:integer read GetCapacity write SetCapacity;
function Add(APersistent: TPersistent): integer; function Add(APersistent: TPersistent): integer;
function Remove(APersistent: TPersistent): integer; function Remove(APersistent: TPersistent): integer;
procedure Delete(Index: Integer);
procedure Assign(SourceSelectionList: TPersistentSelectionList); procedure Assign(SourceSelectionList: TPersistentSelectionList);
property Items[AIndex: integer]: TPersistent read GetItems write SetItems; default; property Items[AIndex: integer]: TPersistent read GetItems write SetItems; default;
end; end;
@ -4845,7 +4846,13 @@ end;
function TPersistentSelectionList.Remove(APersistent: TPersistent): integer; function TPersistentSelectionList.Remove(APersistent: TPersistent): integer;
begin begin
Result:=IndexOf(APersistent); Result:=IndexOf(APersistent);
if Result>=0 then FPersistentList.Remove(APersistent); if Result>=0 then
FPersistentList.Delete(Result);
end;
procedure TPersistentSelectionList.Delete(Index: Integer);
begin
FPersistentList.Delete(Index);
end; end;
procedure TPersistentSelectionList.Clear; procedure TPersistentSelectionList.Clear;
@ -4856,7 +4863,7 @@ end;
constructor TPersistentSelectionList.Create; constructor TPersistentSelectionList.Create;
begin begin
inherited Create; inherited Create;
FPersistentList:=TList.Create; FPersistentList:=TFPList.Create;
end; end;
destructor TPersistentSelectionList.Destroy; destructor TPersistentSelectionList.Destroy;

View File

@ -38,7 +38,6 @@ var
ShowSortSelectionDialogFunc: TShowSortSelectionDialogFunc; ShowSortSelectionDialogFunc: TShowSortSelectionDialogFunc;
SortTextFunc: TSortTextFunc; SortTextFunc: TSortTextFunc;
{ Regular expressions { Regular expressions
This is a simple interface to regular expressions. The syntax is similar This is a simple interface to regular expressions. The syntax is similar
@ -72,7 +71,7 @@ var
function REMatches(const TheText, RegExpr: string; function REMatches(const TheText, RegExpr: string;
const ModifierStr: string = ''): boolean; const ModifierStr: string = ''): boolean;
function REVar(Index: Integer): string; // 1 is the first function REVar(Index: Integer): string; // 1 is the first
procedure REVarPos(Index: Integer; var MatchStart, MatchLength: integer); procedure REVarPos(Index: Integer; out MatchStart, MatchLength: integer);
function REVarCount: Integer; function REVarCount: Integer;
function REReplace(const TheText, FindRegExpr, ReplaceRegExpr: string; function REReplace(const TheText, FindRegExpr, ReplaceRegExpr: string;
UseSubstutition: boolean; UseSubstutition: boolean;
@ -97,7 +96,7 @@ type
): boolean; ): boolean;
TREVarFunction = function(Index: Integer): string; TREVarFunction = function(Index: Integer): string;
TREVarPosProcedure = procedure(Index: Integer; TREVarPosProcedure = procedure(Index: Integer;
var MatchStart, MatchLength: integer); out MatchStart, MatchLength: integer);
TREVarCountFunction = function: Integer; TREVarCountFunction = function: Integer;
TREReplaceProcedure = function(const TheText, FindRegExpr, TREReplaceProcedure = function(const TheText, FindRegExpr,
ReplaceRegExpr: string; UseSubstutition: boolean; ReplaceRegExpr: string; UseSubstutition: boolean;
@ -105,12 +104,12 @@ type
TRESplitFunction = procedure(const TheText, SeparatorRegExpr: string; TRESplitFunction = procedure(const TheText, SeparatorRegExpr: string;
Pieces: TStrings; const ModifierStr: string); Pieces: TStrings; const ModifierStr: string);
var var
REMatchesFunction: TREMatchesFunction; // initialized by the IDE ... REMatchesFunction: TREMatchesFunction = nil; // initialized by the IDE ...
REVarFunction: TREVarFunction; REVarFunction: TREVarFunction = nil;
REVarPosProcedure: TREVarPosProcedure; REVarPosProcedure: TREVarPosProcedure = nil;
REVarCountFunction: TREVarCountFunction; REVarCountFunction: TREVarCountFunction = nil;
REReplaceProcedure: TREReplaceProcedure; REReplaceProcedure: TREReplaceProcedure = nil;
RESplitFunction: TRESplitFunction; RESplitFunction: TRESplitFunction = nil;
implementation implementation
@ -125,7 +124,7 @@ begin
Result:=REVarFunction(Index); Result:=REVarFunction(Index);
end; end;
procedure REVarPos(Index: Integer; var MatchStart, MatchLength: integer); procedure REVarPos(Index: Integer; out MatchStart, MatchLength: integer);
begin begin
REVarPosProcedure(Index,MatchStart,MatchLength); REVarPosProcedure(Index,MatchStart,MatchLength);
end; end;

View File

@ -2021,7 +2021,7 @@ var
begin begin
StateFile:=APackage.GetStateFilename; StateFile:=APackage.GetStateFilename;
if not FileExists(StateFile) then begin if not FileExists(StateFile) then begin
DebugLn('TLazPackageGraph.LoadPackageCompiledState Statefile not found: ',StateFile); //DebugLn('TLazPackageGraph.LoadPackageCompiledState Statefile not found: ',StateFile);
APackage.Flags:=APackage.Flags-[lpfStateFileLoaded]; APackage.Flags:=APackage.Flags-[lpfStateFileLoaded];
Result:=mrOk; Result:=mrOk;
exit; exit;
@ -2245,6 +2245,7 @@ var
EffektiveCompilerParams: String; EffektiveCompilerParams: String;
SrcFilename: String; SrcFilename: String;
CompilePolicies: TPackageUpdatePolicies; CompilePolicies: TPackageUpdatePolicies;
BlockBegan: Boolean;
begin begin
Result:=mrCancel; Result:=mrCancel;
@ -2296,7 +2297,8 @@ begin
// auto increase version // auto increase version
// ToDo // ToDo
if IDEMessagesWindow<>nil then BlockBegan:=IDEMessagesWindow<>nil;
if BlockBegan then
IDEMessagesWindow.BeginBlock; IDEMessagesWindow.BeginBlock;
try try
Result:=PreparePackageOutputDirectory(APackage,pcfCleanCompile in Flags); Result:=PreparePackageOutputDirectory(APackage,pcfCleanCompile in Flags);
@ -2341,9 +2343,9 @@ begin
end; end;
// create external tool to run the compiler // create external tool to run the compiler
DebugLn('TPkgManager.DoCompilePackage Compiler="',CompilerFilename,'"'); //DebugLn('TPkgManager.DoCompilePackage Compiler="',CompilerFilename,'"');
DebugLn('TPkgManager.DoCompilePackage Params="',CompilerParams,'"'); //DebugLn('TPkgManager.DoCompilePackage Params="',CompilerParams,'"');
DebugLn('TPkgManager.DoCompilePackage WorkingDir="',APackage.Directory,'"'); //DebugLn('TPkgManager.DoCompilePackage WorkingDir="',APackage.Directory,'"');
if (not APackage.CompilerOptions.SkipCompiler) if (not APackage.CompilerOptions.SkipCompiler)
and (not (pcfDoNotCompilePackage in Flags)) then begin and (not (pcfDoNotCompilePackage in Flags)) then begin
@ -2409,8 +2411,8 @@ begin
end; end;
end; end;
finally finally
if IDEMessagesWindow<>nil then if BlockBegan and (IDEMessagesWindow<>nil) then
IDEMessagesWindow.BeginBlock; IDEMessagesWindow.EndBlock;
if Result<>mrOk then begin if Result<>mrOk then begin
if (APackage.AutoInstall<>pitNope) and (APackage.Installed=pitNope) if (APackage.AutoInstall<>pitNope) and (APackage.Installed=pitNope)
and (OnUninstallPackage<>nil) then begin and (OnUninstallPackage<>nil) then begin