mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-03 06:00:31 +02:00
lcl: formatting
git-svn-id: trunk@23219 -
This commit is contained in:
parent
2490ea320f
commit
26d98c9a47
@ -140,21 +140,23 @@ end;
|
|||||||
function TScreen.CustomFormZIndex(AForm: TCustomForm): integer;
|
function TScreen.CustomFormZIndex(AForm: TCustomForm): integer;
|
||||||
begin
|
begin
|
||||||
Result:=FCustomFormsZOrdered.Count-1;
|
Result:=FCustomFormsZOrdered.Count-1;
|
||||||
while (Result>=0) and (CustomFormsZOrdered[Result]<>AForm) do dec(Result);
|
while (Result >= 0) and (CustomFormsZOrdered[Result] <> AForm) do dec(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TScreen.MoveFormToFocusFront(ACustomForm: TCustomForm);
|
procedure TScreen.MoveFormToFocusFront(ACustomForm: TCustomForm);
|
||||||
begin
|
begin
|
||||||
if (Self=nil) or (ACustomForm=nil)
|
if (Self = nil) or (ACustomForm = nil) or
|
||||||
or (csDestroying in ACustomForm.ComponentState) then
|
(csDestroying in ACustomForm.ComponentState) then
|
||||||
RaiseGDBException('TScreen.MoveFormToFocusFront');
|
RaiseGDBException('TScreen.MoveFormToFocusFront');
|
||||||
if (FCustomForms.Count=0) or (TObject(FCustomForms[0])<>ACustomForm) then
|
if (FCustomForms.Count=0) or (TObject(FCustomForms[0])<>ACustomForm) then
|
||||||
begin
|
begin
|
||||||
FCustomForms.Remove(ACustomForm);
|
FCustomForms.Remove(ACustomForm);
|
||||||
FCustomForms.Insert(0, ACustomForm);
|
FCustomForms.Insert(0, ACustomForm);
|
||||||
end;
|
end;
|
||||||
if ACustomForm is TForm then begin
|
if ACustomForm is TForm then
|
||||||
if (FFormList.Count=0) or (TObject(FFormList[0])<>ACustomForm) then begin
|
begin
|
||||||
|
if (FFormList.Count=0) or (TObject(FFormList[0])<>ACustomForm) then
|
||||||
|
begin
|
||||||
FFormList.Remove(ACustomForm);
|
FFormList.Remove(ACustomForm);
|
||||||
FFormList.Insert(0, ACustomForm);
|
FFormList.Insert(0, ACustomForm);
|
||||||
end;
|
end;
|
||||||
@ -163,14 +165,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TScreen.MoveFormToZFront(ACustomForm: TCustomForm);
|
procedure TScreen.MoveFormToZFront(ACustomForm: TCustomForm);
|
||||||
//var i: Integer;
|
|
||||||
begin
|
begin
|
||||||
if (FCustomFormsZOrdered.Count=0)
|
if (FCustomFormsZOrdered.Count = 0) or
|
||||||
or (TObject(FCustomFormsZOrdered[0])<>ACustomForm) then begin
|
(TObject(FCustomFormsZOrdered[0]) <> ACustomForm) then
|
||||||
|
begin
|
||||||
FCustomFormsZOrdered.Remove(ACustomForm);
|
FCustomFormsZOrdered.Remove(ACustomForm);
|
||||||
FCustomFormsZOrdered.Insert(0, ACustomForm);
|
FCustomFormsZOrdered.Insert(0, ACustomForm);
|
||||||
//for i:=0 to FCustomFormsZOrdered.Count-1 do
|
|
||||||
// DebugLn(['TScreen.MoveFormToZFront ',i,'/',FCustomFormsZOrdered.Count,' ',dbgsName(CustomFormsZOrdered[i])]);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -178,20 +178,19 @@ function TScreen.GetCurrentModalForm: TCustomForm;
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
i:=GetCurrentModalFormZIndex;
|
i := GetCurrentModalFormZIndex;
|
||||||
if (i>=0) then
|
if (i >= 0) then
|
||||||
Result:=CustomFormsZOrdered[i]
|
Result := CustomFormsZOrdered[i]
|
||||||
else
|
else
|
||||||
Result:=nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TScreen.GetCurrentModalFormZIndex: Integer;
|
function TScreen.GetCurrentModalFormZIndex: Integer;
|
||||||
begin
|
begin
|
||||||
Result:=0;
|
Result := 0;
|
||||||
while (Result<CustomFormCount)
|
while (Result < CustomFormCount) and not (fsModal in CustomFormsZOrdered[Result].FormState) do
|
||||||
and (not (fsModal in CustomFormsZOrdered[Result].FormState)) do
|
|
||||||
inc(Result);
|
inc(Result);
|
||||||
if Result=CustomFormCount then Result:=-1;
|
if Result = CustomFormCount then Result := -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TScreen.CustomFormBelongsToActiveGroup(AForm: TCustomForm): Boolean;
|
function TScreen.CustomFormBelongsToActiveGroup(AForm: TCustomForm): Boolean;
|
||||||
@ -199,12 +198,13 @@ var
|
|||||||
CurForm: TCustomForm;
|
CurForm: TCustomForm;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
i:=0;
|
i := 0;
|
||||||
Result:=false;
|
Result := False;
|
||||||
while (i<CustomFormCount) do begin
|
while (i < CustomFormCount) do
|
||||||
CurForm:=CustomFormsZOrdered[i];
|
begin
|
||||||
if CurForm=AForm then
|
CurForm := CustomFormsZOrdered[i];
|
||||||
Result:=true;
|
if CurForm = AForm then
|
||||||
|
Result := True;
|
||||||
if fsModal in CurForm.FormState then exit;
|
if fsModal in CurForm.FormState then exit;
|
||||||
inc(i);
|
inc(i);
|
||||||
end;
|
end;
|
||||||
@ -214,10 +214,10 @@ function TScreen.FindForm(const FormName: string): TCustomForm;
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
for i:=0 to FCustomForms.Count-1 do
|
for i := 0 to FCustomForms.Count - 1 do
|
||||||
if CompareText(TCustomForm(FCustomForms[i]).Name,FormName)=0 then
|
if CompareText(TCustomForm(FCustomForms[i]).Name, FormName) = 0 then
|
||||||
exit(TCustomForm(FCustomForms[i]));
|
Exit(TCustomForm(FCustomForms[i]));
|
||||||
Result:=nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TScreen.FindDataModule(const DataModuleName: string): TDataModule;
|
function TScreen.FindDataModule(const DataModuleName: string): TDataModule;
|
||||||
@ -225,21 +225,21 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
for i:=0 to FDataModuleList.Count-1 do
|
for i:=0 to FDataModuleList.Count-1 do
|
||||||
if CompareText(TDataModule(FDataModuleList[i]).Name, DataModuleName)=0 then
|
if CompareText(TDataModule(FDataModuleList[i]).Name, DataModuleName) = 0 then
|
||||||
begin
|
begin
|
||||||
Result:=TDataModule(FDataModuleList[i]);
|
Result := TDataModule(FDataModuleList[i]);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
Result:=nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TScreen.UpdateScreen;
|
procedure TScreen.UpdateScreen;
|
||||||
var
|
var
|
||||||
DC: HDC;
|
DC: HDC;
|
||||||
begin
|
begin
|
||||||
DC:=GetDC(0);
|
DC := GetDC(0);
|
||||||
FPixelsPerInch:=GetDeviceCaps(DC,LOGPIXELSX);
|
FPixelsPerInch := GetDeviceCaps(DC,LOGPIXELSX);
|
||||||
ReleaseDC(0,DC);
|
ReleaseDC(0, DC);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TScreen.AddHandlerFormAdded(OnFormAdded: TScreenFormEvent;
|
procedure TScreen.AddHandlerFormAdded(OnFormAdded: TScreenFormEvent;
|
||||||
@ -465,7 +465,8 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TScreen.GetFonts : TStrings;
|
function TScreen.GetFonts : TStrings;
|
||||||
begin
|
begin
|
||||||
if FFonts.Count=0 then begin
|
if FFonts.Count = 0 then
|
||||||
|
begin
|
||||||
GetScreenFontsList(FFonts);
|
GetScreenFontsList(FFonts);
|
||||||
TStringList(FFonts).Sort;
|
TStringList(FFonts).Sort;
|
||||||
end;
|
end;
|
||||||
@ -537,12 +538,12 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TScreen.GetCustomFormCount: Integer;
|
function TScreen.GetCustomFormCount: Integer;
|
||||||
begin
|
begin
|
||||||
Result:=FCustomForms.Count;
|
Result := FCustomForms.Count;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TScreen.GetCustomFormZOrderCount: Integer;
|
function TScreen.GetCustomFormZOrderCount: Integer;
|
||||||
begin
|
begin
|
||||||
Result:=FCustomFormsZOrdered.Count;
|
Result := FCustomFormsZOrdered.Count;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -814,10 +815,11 @@ procedure TScreen.UpdateLastActive;
|
|||||||
Handler: TScreenFormEvent;
|
Handler: TScreenFormEvent;
|
||||||
begin
|
begin
|
||||||
if Assigned(FOnActiveFormChange) then FOnActiveFormChange(Self);
|
if Assigned(FOnActiveFormChange) then FOnActiveFormChange(Self);
|
||||||
i:=FScreenHandlers[snActiveFormChanged].Count;
|
i := FScreenHandlers[snActiveFormChanged].Count;
|
||||||
while FScreenHandlers[snActiveFormChanged].NextDownIndex(i) do begin
|
while FScreenHandlers[snActiveFormChanged].NextDownIndex(i) do
|
||||||
Handler:=TScreenFormEvent(FScreenHandlers[snActiveFormChanged][i]);
|
begin
|
||||||
Handler(Self,FLastActiveCustomForm);
|
Handler := TScreenFormEvent(FScreenHandlers[snActiveFormChanged][i]);
|
||||||
|
Handler(Self, FLastActiveCustomForm);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -827,10 +829,11 @@ procedure TScreen.UpdateLastActive;
|
|||||||
Handler: TScreenControlEvent;
|
Handler: TScreenControlEvent;
|
||||||
begin
|
begin
|
||||||
if Assigned(FOnActiveControlChange) then FOnActiveControlChange(Self);
|
if Assigned(FOnActiveControlChange) then FOnActiveControlChange(Self);
|
||||||
i:=FScreenHandlers[snActiveControlChanged].Count;
|
i := FScreenHandlers[snActiveControlChanged].Count;
|
||||||
while FScreenHandlers[snActiveControlChanged].NextDownIndex(i) do begin
|
while FScreenHandlers[snActiveControlChanged].NextDownIndex(i) do
|
||||||
Handler:=TScreenControlEvent(FScreenHandlers[snActiveControlChanged][i]);
|
begin
|
||||||
Handler(Self,FLastActiveControl);
|
Handler := TScreenControlEvent(FScreenHandlers[snActiveControlChanged][i]);
|
||||||
|
Handler(Self, FLastActiveControl);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -878,14 +881,14 @@ end;
|
|||||||
procedure TScreen.AddHandler(HandlerType: TScreenNotification;
|
procedure TScreen.AddHandler(HandlerType: TScreenNotification;
|
||||||
const Handler: TMethod; AsLast: Boolean);
|
const Handler: TMethod; AsLast: Boolean);
|
||||||
begin
|
begin
|
||||||
if Handler.Code=nil then RaiseGDBException('TScreen.AddHandler');
|
if Handler.Code = nil then
|
||||||
if FScreenHandlers[HandlerType]=nil then
|
RaiseGDBException('TScreen.AddHandler');
|
||||||
FScreenHandlers[HandlerType]:=TMethodList.Create;
|
if FScreenHandlers[HandlerType] = nil then
|
||||||
FScreenHandlers[HandlerType].Add(Handler,AsLast);
|
FScreenHandlers[HandlerType] := TMethodList.Create;
|
||||||
|
FScreenHandlers[HandlerType].Add(Handler, AsLast);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TScreen.RemoveHandler(HandlerType: TScreenNotification;
|
procedure TScreen.RemoveHandler(HandlerType: TScreenNotification; const Handler: TMethod);
|
||||||
const Handler: TMethod);
|
|
||||||
begin
|
begin
|
||||||
FScreenHandlers[HandlerType].Remove(Handler);
|
FScreenHandlers[HandlerType].Remove(Handler);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user