IDE: formatting

git-svn-id: trunk@38065 -
This commit is contained in:
juha 2012-07-28 07:50:24 +00:00
parent 19aa4a00c0
commit bca8afb5c1

View File

@ -16918,7 +16918,6 @@ begin
if not BeginCodeTool(SrcEdit, ActiveUnitInfo, if not BeginCodeTool(SrcEdit, ActiveUnitInfo,
[ctfUseGivenSourceEditor {, ctfActivateAbortMode}]) then exit; [ctfUseGivenSourceEditor {, ctfActivateAbortMode}]) then exit;
BaseURL:=''; BaseURL:='';
SmartHintStr := ''; SmartHintStr := '';
{$IFDEF IDE_DEBUG} {$IFDEF IDE_DEBUG}
@ -17067,21 +17066,17 @@ var
begin begin
if SysUtils.CompareText(ActiveUnitInfo.Unit_Name,AName)=0 then if SysUtils.CompareText(ActiveUnitInfo.Unit_Name,AName)=0 then
raise Exception.Create(Format( raise Exception.Create(Format(
lisTheUnitItselfHasAlreadyTheNamePascalIdentifiersMus, ['"', AName, '"'] lisTheUnitItselfHasAlreadyTheNamePascalIdentifiersMus, ['"', AName, '"']));
));
if ActiveUnitInfo.IsPartOfProject then begin if ActiveUnitInfo.IsPartOfProject then begin
// check if component name already exists in project // check if component name already exists in project
i:=Project1.IndexOfUnitWithComponentName(AName,true,ActiveUnitInfo); i:=Project1.IndexOfUnitWithComponentName(AName,true,ActiveUnitInfo);
if i>=0 then if i>=0 then
raise Exception.Create( raise Exception.Create(Format(lisThereIsAlreadyAFormWithTheName, ['"', AName, '"']));
Format(lisThereIsAlreadyAFormWithTheName, ['"',
AName, '"']));
// check if pascal identifier already exists in the units // check if pascal identifier already exists in the units
i:=Project1.IndexOfUnitWithName(AName,true,nil); i:=Project1.IndexOfUnitWithName(AName,true,nil);
if i>=0 then if i>=0 then
raise Exception.Create(Format( raise Exception.Create(Format(
lisThereIsAlreadyAUnitWithTheNamePascalIdentifiersMus, ['"', AName, lisThereIsAlreadyAUnitWithTheNamePascalIdentifiersMus, ['"', AName, '"']));
'"']));
end; end;
// check if classname // check if classname
@ -17096,8 +17091,7 @@ var
// check if keyword // check if keyword
if CodeToolBoss.IsKeyWord(ActiveUnitInfo.Source,AName) then if CodeToolBoss.IsKeyWord(ActiveUnitInfo.Source,AName) then
raise Exception.Create(Format(lisComponentNameIsKeyword, ['"', AName, '"'] raise Exception.Create(Format(lisComponentNameIsKeyword, ['"', AName, '"']));
));
// check if registered component class // check if registered component class
RegComp:=IDEComponentPalette.FindComponent(AName); RegComp:=IDEComponentPalette.FindComponent(AName);
@ -17258,23 +17252,16 @@ begin
then begin then begin
raise Exception.Create(Format(lisComponentNameIsAPascalKeyword, [NewName])); raise Exception.Create(Format(lisComponentNameIsAPascalKeyword, [NewName]));
end; end;
if AComponent.Name='' then begin if AComponent.Name='' then
// this component was never added to the source. It is a new component. exit; // this component was never added to the source. It is a new component.
exit;
end;
if (FRenamingComponents<>nil) if (FRenamingComponents<>nil)
and (FRenamingComponents.IndexOf(AComponent)>=0) then begin and (FRenamingComponents.IndexOf(AComponent)>=0) then
// already validated exit; // already validated
exit;
end;
if SysUtils.CompareText(AComponent.Name,'Owner')=0 then begin if SysUtils.CompareText(AComponent.Name,'Owner')=0 then
// 'Owner' is used by TReader/TWriter // 'Owner' is used by TReader/TWriter
raise EComponentError.Create( raise EComponentError.Create(lisOwnerIsAlreadyUsedByTReaderTWriterPleaseChooseAnot);
lisOwnerIsAlreadyUsedByTReaderTWriterPleaseChooseAnot);
exit;
end;
BeginCodeTool(ADesigner,ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]); BeginCodeTool(ADesigner,ActiveSrcEdit,ActiveUnitInfo,[ctfSwitchToFormSource]);
ActiveUnitInfo:=Project1.UnitWithComponent(ADesigner.LookupRoot); ActiveUnitInfo:=Project1.UnitWithComponent(ADesigner.LookupRoot);
@ -17332,8 +17319,7 @@ begin
BossResult:=CodeToolBoss.RenamePublishedVariable(ActiveUnitInfo.Source, BossResult:=CodeToolBoss.RenamePublishedVariable(ActiveUnitInfo.Source,
ADesigner.LookupRoot.ClassName, ADesigner.LookupRoot.ClassName,
AComponent.Name,NewName,AComponent.ClassName,true); AComponent.Name,NewName,AComponent.ClassName,true);
ApplyBossResult(Format(lisUnableToRenameVariableInSource, [#13]) ApplyBossResult(Format(lisUnableToRenameVariableInSource, [#13]));
);
end else begin end else begin
RaiseException('TMainIDE.OnDesignerRenameComponent internal error:'+AComponent.Name+':'+AComponent.ClassName); RaiseException('TMainIDE.OnDesignerRenameComponent internal error:'+AComponent.Name+':'+AComponent.ClassName);
end; end;
@ -17398,21 +17384,15 @@ begin
// if this is a project file, start in project directory // if this is a project file, start in project directory
if AnUnitInfo.IsPartOfProject and (not Project1.IsVirtual) if AnUnitInfo.IsPartOfProject and (not Project1.IsVirtual)
and (not FileIsInPath(SaveDialog.InitialDir,Project1.ProjectDirectory)) then and (not FileIsInPath(SaveDialog.InitialDir,Project1.ProjectDirectory)) then
begin
SaveDialog.InitialDir:=Project1.ProjectDirectory; SaveDialog.InitialDir:=Project1.ProjectDirectory;
end;
// if this is a package file, then start in package directory // if this is a package file, then start in package directory
PkgDefaultDirectory:= PkgDefaultDirectory:=PkgBoss.GetDefaultSaveDirectoryForFile(AnUnitInfo.Filename);
PkgBoss.GetDefaultSaveDirectoryForFile(AnUnitInfo.Filename);
if (PkgDefaultDirectory<>'') if (PkgDefaultDirectory<>'')
and (not FileIsInPath(SaveDialog.InitialDir,PkgDefaultDirectory)) then and (not FileIsInPath(SaveDialog.InitialDir,PkgDefaultDirectory)) then
SaveDialog.InitialDir:=PkgDefaultDirectory; SaveDialog.InitialDir:=PkgDefaultDirectory;
// show save dialog // show save dialog
if (not SaveDialog.Execute) or (ExtractFileName(SaveDialog.Filename)='') if (not SaveDialog.Execute) or (ExtractFileName(SaveDialog.Filename)='') then
then begin exit; // user cancels
// user cancels
exit;
end;
Filename:=ExpandFileNameUTF8(SaveDialog.Filename); Filename:=ExpandFileNameUTF8(SaveDialog.Filename);
finally finally
InputHistories.StoreFileDialogSettings(SaveDialog); InputHistories.StoreFileDialogSettings(SaveDialog);
@ -18319,8 +18299,7 @@ begin
ActiveUnitInfo:=Project1.UnitWithComponent(ADesigner.LookupRoot) ActiveUnitInfo:=Project1.UnitWithComponent(ADesigner.LookupRoot)
else if (GlobalDesignHook.LookupRoot<>nil) else if (GlobalDesignHook.LookupRoot<>nil)
and (GlobalDesignHook.LookupRoot is TComponent) then and (GlobalDesignHook.LookupRoot is TComponent) then
ActiveUnitInfo:= ActiveUnitInfo:=Project1.UnitWithComponent(TComponent(GlobalDesignHook.LookupRoot))
Project1.UnitWithComponent(TComponent(GlobalDesignHook.LookupRoot))
else else
ActiveUnitInfo:=nil; ActiveUnitInfo:=nil;
if (ActiveUnitInfo<>nil) and (ActiveUnitInfo.OpenEditorInfoCount > 0) then begin if (ActiveUnitInfo<>nil) and (ActiveUnitInfo.OpenEditorInfoCount > 0) then begin