mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 22:39:18 +02:00
cocoa: formatting, cleanup
git-svn-id: trunk@38877 -
This commit is contained in:
parent
55c631cd34
commit
77958ad8a4
@ -275,7 +275,7 @@ var
|
||||
DC: HDC;
|
||||
begin
|
||||
DC := GetDC(0);
|
||||
FPixelsPerInch := GetDeviceCaps(DC,LOGPIXELSX);
|
||||
FPixelsPerInch := GetDeviceCaps(DC, LOGPIXELSX);
|
||||
ReleaseDC(0, DC);
|
||||
end;
|
||||
|
||||
|
@ -782,7 +782,7 @@ begin
|
||||
FAlignment := AAlignment;
|
||||
|
||||
if (FType in [cbtMono, cbtGray]) and (FDepth=0) then
|
||||
FDepth:=FBitsPerPixel;
|
||||
FDepth := FBitsPerPixel;
|
||||
|
||||
FBytesPerRow := ((AWidth * ABitsPerPixel) + 7) shr 3;
|
||||
M := FBytesPerRow and ALIGNBITS[AAlignment];
|
||||
@ -960,7 +960,7 @@ end;
|
||||
destructor TCocoaTextLayout.Destroy;
|
||||
begin
|
||||
FTextStorage.release;
|
||||
FFont.release;
|
||||
FFont.Release;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -1113,8 +1113,6 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCocoaBitmapContext.SetBitmap(const AValue: TCocoaBitmap);
|
||||
var
|
||||
I: Boolean;
|
||||
begin
|
||||
if FBitmap <> AValue then
|
||||
begin
|
||||
|
@ -199,7 +199,7 @@ begin
|
||||
if NSApp.dockTile.respondsToSelector_(objcselector('setBadgeLabel:')) then
|
||||
begin
|
||||
ns := NSStringUtf8(ATitle);
|
||||
NSApp.dockTile.setBadgeLabel(NSStringUtf8(ATitle));
|
||||
NSApp.dockTile.setBadgeLabel(ns);
|
||||
ns.release;
|
||||
end;
|
||||
end;
|
||||
|
@ -1227,7 +1227,7 @@ end;
|
||||
|
||||
function LCLViewExtension.lclFrame: TRect;
|
||||
var
|
||||
v : NSView;
|
||||
v: NSView;
|
||||
begin
|
||||
v := superview;
|
||||
if Assigned(v) then
|
||||
@ -1238,7 +1238,7 @@ end;
|
||||
|
||||
procedure LCLViewExtension.lclSetFrame(const r: TRect);
|
||||
var
|
||||
ns : NSRect;
|
||||
ns: NSRect;
|
||||
begin
|
||||
if Assigned(superview) then
|
||||
LCLToNSRect(r, superview.frame.size.height, ns)
|
||||
|
@ -153,7 +153,7 @@ begin
|
||||
Result := NSColor.colorWithCalibratedRed_green_blue_alpha(
|
||||
(Color and $FF) / $FF,
|
||||
((Color shr 8) and $FF) / $FF,
|
||||
((Color shr 16) and $FF) / $FF, 1)
|
||||
((Color shr 16) and $FF) / $FF, 1);
|
||||
end;
|
||||
|
||||
function CFStringToStr(AString: CFStringRef; Encoding: CFStringEncoding = DEFAULT_CFSTRING_ENCODING): String;
|
||||
@ -190,7 +190,7 @@ end;
|
||||
|
||||
function GetNSObjectView(obj: NSObject): NSView;
|
||||
begin
|
||||
Result:=nil;
|
||||
Result := nil;
|
||||
if not Assigned(obj) then Exit;
|
||||
if obj.isKindOfClass_(NSView) then Result:=NSView(obj)
|
||||
else if obj.isKindOfClass_(NSWindow) then Result:=NSWindow(obj).contentView;
|
||||
@ -198,9 +198,9 @@ end;
|
||||
|
||||
procedure AddViewToNSObject(ctrl: NSView; obj: NSObject);
|
||||
var
|
||||
view : NSView;
|
||||
view: NSView;
|
||||
begin
|
||||
view:=GetNSObjectView(obj);
|
||||
view := GetNSObjectView(obj);
|
||||
if not Assigned(view) then Exit;
|
||||
view.addSubView(ctrl);
|
||||
end;
|
||||
@ -213,8 +213,8 @@ end;
|
||||
|
||||
function GetNSPoint(x, y: single): NSPoint;
|
||||
begin
|
||||
Result.x:=x;
|
||||
Result.y:=y;
|
||||
Result.x := x;
|
||||
Result.y := y;
|
||||
end;
|
||||
|
||||
function GetNSRect(x, y, width, height: Integer): NSRect;
|
||||
@ -270,7 +270,7 @@ begin
|
||||
Result := GetCGRect(Left, Top, Right, Bottom);
|
||||
end;
|
||||
|
||||
function CGRectToRect(const c:CGRect):TRect;
|
||||
function CGRectToRect(const c: CGRect): TRect;
|
||||
begin
|
||||
with Result do
|
||||
begin
|
||||
@ -333,20 +333,21 @@ end;
|
||||
|
||||
function NSStringUtf8(s: PChar): NSString;
|
||||
var
|
||||
cf : CFStringRef;
|
||||
cf: CFStringRef;
|
||||
r: Integer;
|
||||
begin
|
||||
{NSString and CFStringRef are interchangable}
|
||||
cf:=CFStringCreateWithCString(nil, S, kCFStringEncodingUTF8);
|
||||
Result:=NSString(cf);
|
||||
cf := CFStringCreateWithCString(nil, S, kCFStringEncodingUTF8);
|
||||
Result := NSString(cf);
|
||||
end;
|
||||
|
||||
function NSStringUtf8(const s: String): NSString;
|
||||
var
|
||||
cf : CFStringRef;
|
||||
cf: CFStringRef;
|
||||
begin
|
||||
{NSString and CFStringRef are interchangable}
|
||||
cf:=CFStringCreateWithCString(nil, Pointer(PChar(S)), kCFStringEncodingUTF8);
|
||||
Result:=NSString(cf);
|
||||
cf := CFStringCreateWithCString(nil, Pointer(PChar(S)), kCFStringEncodingUTF8);
|
||||
Result := NSString(cf);
|
||||
end;
|
||||
|
||||
function NSStringToString(ns: NSString): String;
|
||||
|
@ -915,7 +915,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCocoaWidgetSet.InvalidateRect(aHandle : HWND; Rect : pRect; bErase : Boolean): Boolean;
|
||||
function TCocoaWidgetSet.InvalidateRect(aHandle: HWND; Rect: pRect; bErase: Boolean): Boolean;
|
||||
begin
|
||||
Result := aHandle <> 0;
|
||||
if Result then
|
||||
|
@ -167,13 +167,12 @@ var
|
||||
begin
|
||||
if not Assigned(AMenuItem) then Exit;
|
||||
|
||||
if AMenuItem.Caption='-' then
|
||||
item:=NSMenuItem.separatorItem
|
||||
if AMenuItem.Caption = '-' then
|
||||
item := NSMenuItem.separatorItem
|
||||
else
|
||||
begin
|
||||
ns := NSStringUtf8(AMenuItem.Caption);
|
||||
item:=TCocoaMenuItem.alloc.initWithTitle_action_keyEquivalent(
|
||||
NSStringUtf8(AMenuItem.Caption),
|
||||
item := TCocoaMenuItem.alloc.initWithTitle_action_keyEquivalent(ns,
|
||||
objcselector('lclItemSelected:'), NSString.alloc.init);
|
||||
ns.release;
|
||||
item.setTarget(item);
|
||||
|
Loading…
Reference in New Issue
Block a user