mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-09 08:19:25 +02:00
Cocoa: standardize references to several NSString constants
This commit is contained in:
parent
c64aed3fb8
commit
b55c816aa8
@ -28,6 +28,8 @@ const
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
var
|
var
|
||||||
|
NSSTR_EMPTY: NSString;
|
||||||
|
|
||||||
NSSTR_DARK_NAME: NSString;
|
NSSTR_DARK_NAME: NSString;
|
||||||
NSSTR_DARK_NAME_VIBRANT: NSString;
|
NSSTR_DARK_NAME_VIBRANT: NSString;
|
||||||
|
|
||||||
@ -36,6 +38,7 @@ var
|
|||||||
NSSTR_LINE_SEPARATOR: NSString;
|
NSSTR_LINE_SEPARATOR: NSString;
|
||||||
NSSTR_PARAGRAPH_SEPARATOR: NSString;
|
NSSTR_PARAGRAPH_SEPARATOR: NSString;
|
||||||
|
|
||||||
|
NSSTR_KEY_ESC: NSString;
|
||||||
NSSTR_KEY_EQUALS: NSString;
|
NSSTR_KEY_EQUALS: NSString;
|
||||||
NSSTR_KEY_PLUS: NSString;
|
NSSTR_KEY_PLUS: NSString;
|
||||||
|
|
||||||
@ -49,14 +52,17 @@ const
|
|||||||
DarkNameVibrant = 'NSAppearanceNameVibrantDark'; // used in 10.13
|
DarkNameVibrant = 'NSAppearanceNameVibrantDark'; // used in 10.13
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
NSSTR_EMPTY:= NSString.string_;
|
||||||
|
|
||||||
NSSTR_DARK_NAME:= NSSTR(DarkName);
|
NSSTR_DARK_NAME:= NSSTR(DarkName);
|
||||||
NSSTR_DARK_NAME_VIBRANT:= NSSTR(DarkNameVibrant);
|
NSSTR_DARK_NAME_VIBRANT:= NSSTR(DarkNameVibrant);
|
||||||
|
|
||||||
NSSTR_LINE_FEED:= NSStr(#10);
|
NSSTR_LINE_FEED:= NSSTR(#10);
|
||||||
NSSTR_CARRIAGE_RETURN:= NSStr(#13);
|
NSSTR_CARRIAGE_RETURN:= NSSTR(#13);
|
||||||
NSSTR_LINE_SEPARATOR:= NSString.alloc.initWithUTF8String(#$E2#$80#$A8);
|
NSSTR_LINE_SEPARATOR:= NSString.alloc.initWithUTF8String(#$E2#$80#$A8);
|
||||||
NSSTR_PARAGRAPH_SEPARATOR:= NSString.alloc.initWithUTF8String(#$E2#$80#$A9);
|
NSSTR_PARAGRAPH_SEPARATOR:= NSString.alloc.initWithUTF8String(#$E2#$80#$A9);
|
||||||
|
|
||||||
|
NSSTR_KEY_ESC:= NSSTR(#27);
|
||||||
NSSTR_KEY_EQUALS:= NSSTR('=');
|
NSSTR_KEY_EQUALS:= NSSTR('=');
|
||||||
NSSTR_KEY_PLUS:= NSSTR('+');
|
NSSTR_KEY_PLUS:= NSSTR('+');
|
||||||
|
|
||||||
|
@ -290,16 +290,16 @@ begin
|
|||||||
aButton.setKeyEquivalentModifierMask(0);
|
aButton.setKeyEquivalentModifierMask(0);
|
||||||
|
|
||||||
if I = DefaultIndex then
|
if I = DefaultIndex then
|
||||||
aButton.setKeyEquivalent(NSSTR(#13))
|
aButton.setKeyEquivalent(NSSTR_KEY_ESC)
|
||||||
else if I = 0 then
|
else if I = 0 then
|
||||||
// By default, the first button is the default button. If in our
|
// By default, the first button is the default button. If in our
|
||||||
// case this should not be the case, remove the default status
|
// case this should not be the case, remove the default status
|
||||||
// from the first button.
|
// from the first button.
|
||||||
aButton.setKeyEquivalent(NSSTR(''));
|
aButton.setKeyEquivalent(NSSTR_EMPTY);
|
||||||
|
|
||||||
if Buttons[I]=mrCancel then begin
|
if Buttons[I]=mrCancel then begin
|
||||||
needsCancel := False;
|
needsCancel := False;
|
||||||
aButton.setKeyEquivalent(NSSTR(#27));
|
aButton.setKeyEquivalent(NSSTR_KEY_ESC);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
aButton.setTag(Buttons[I]);
|
aButton.setTag(Buttons[I]);
|
||||||
|
@ -29,7 +29,7 @@ uses
|
|||||||
Types, Classes, SysUtils,
|
Types, Classes, SysUtils,
|
||||||
// Libs
|
// Libs
|
||||||
MacOSAll, CocoaAll, CocoaUtils, CocoaGDIObjects,
|
MacOSAll, CocoaAll, CocoaUtils, CocoaGDIObjects,
|
||||||
cocoa_extra, CocoaPrivate,
|
cocoa_extra, CocoaPrivate, CocoaConst,
|
||||||
// LCL
|
// LCL
|
||||||
LCLType;
|
LCLType;
|
||||||
|
|
||||||
@ -924,7 +924,7 @@ begin
|
|||||||
if not isFirstColumnCheckboxes and isImagesInCell then begin
|
if not isFirstColumnCheckboxes and isImagesInCell then begin
|
||||||
img := lclGetItemImageAt(row, col);
|
img := lclGetItemImageAt(row, col);
|
||||||
|
|
||||||
Result := NSImageAndTextCell(NSImageAndTextCell.alloc).initTextCell(NSSTR(''));
|
Result := NSImageAndTextCell(NSImageAndTextCell.alloc).initTextCell(NSSTR_EMPTY);
|
||||||
NSImageAndTextCell(Result).drawImage := img; // if "image" is assigned, text won't be drawn :(
|
NSImageAndTextCell(Result).drawImage := img; // if "image" is assigned, text won't be drawn :(
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
@ -22,7 +22,7 @@ uses
|
|||||||
LCLType, LCLProc, LCLIntf, Graphics, Themes, TmSchema,
|
LCLType, LCLProc, LCLIntf, Graphics, Themes, TmSchema,
|
||||||
customdrawndrawers,
|
customdrawndrawers,
|
||||||
// widgetset
|
// widgetset
|
||||||
CocoaUtils, CocoaGDIObjects;
|
CocoaUtils, CocoaGDIObjects, CocoaConst;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ TCocoaThemeServices }
|
{ TCocoaThemeServices }
|
||||||
@ -266,7 +266,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if (HdrCell=nil) then
|
if (HdrCell=nil) then
|
||||||
begin
|
begin
|
||||||
hdrCell := NSTableHeaderCell.alloc.initTextCell(NSSTR(''));
|
hdrCell := NSTableHeaderCell.alloc.initTextCell(NSSTR_EMPTY);
|
||||||
end;
|
end;
|
||||||
CellDrawStart(DC, R, cur, nsr);
|
CellDrawStart(DC, R, cur, nsr);
|
||||||
|
|
||||||
@ -530,7 +530,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if cocoaBtn < 0 then Exit; // unsupported button type
|
if cocoaBtn < 0 then Exit; // unsupported button type
|
||||||
|
|
||||||
btn := NSButtonCell(NSButtonCell.alloc).initTextCell(NSSTR(''));
|
btn := NSButtonCell(NSButtonCell.alloc).initTextCell(NSSTR_EMPTY);
|
||||||
btn.setButtonType(NSButtonType(cocoaBtn));
|
btn.setButtonType(NSButtonType(cocoaBtn));
|
||||||
|
|
||||||
SetButtonCellToDetails(btn, Details);
|
SetButtonCellToDetails(btn, Details);
|
||||||
@ -542,7 +542,7 @@ end;
|
|||||||
constructor TCocoaThemeServices.Create;
|
constructor TCocoaThemeServices.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
BtnCell := NSButtonCell.alloc.initTextCell(NSSTR(''));
|
BtnCell := NSButtonCell.alloc.initTextCell(NSSTR_EMPTY);
|
||||||
BezelToolBar := NSSmallSquareBezelStyle; // can be resized at any size
|
BezelToolBar := NSSmallSquareBezelStyle; // can be resized at any size
|
||||||
BezelButton := NSSmallSquareBezelStyle;
|
BezelButton := NSSmallSquareBezelStyle;
|
||||||
|
|
||||||
|
@ -1432,8 +1432,6 @@ var
|
|||||||
ns : NSString;
|
ns : NSString;
|
||||||
idx : integer;
|
idx : integer;
|
||||||
ro : Boolean;
|
ro : Boolean;
|
||||||
const
|
|
||||||
LFSTR = #10;
|
|
||||||
begin
|
begin
|
||||||
ns:=FTextView.string_;
|
ns:=FTextView.string_;
|
||||||
idx:=0;
|
idx:=0;
|
||||||
@ -1455,7 +1453,7 @@ begin
|
|||||||
FTextView.setSelectedRange(rng);
|
FTextView.setSelectedRange(rng);
|
||||||
|
|
||||||
if (rng.location>=ns.length) and (st=ced) and (ns.length>0) then
|
if (rng.location>=ns.length) and (st=ced) and (ns.length>0) then
|
||||||
FTextView.insertText( NSString.stringWithUTF8String( LFSTR ));
|
FTextView.insertText( NSSTR_LINE_FEED );
|
||||||
|
|
||||||
if S<>'' then
|
if S<>'' then
|
||||||
begin
|
begin
|
||||||
@ -1463,7 +1461,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
dec(FTextView.supressTextChangeEvent);
|
dec(FTextView.supressTextChangeEvent);
|
||||||
FTextView.insertText( NSString.stringWithUTF8String( LFSTR ));
|
FTextView.insertText( NSSTR_LINE_FEED );
|
||||||
|
|
||||||
if not ro then FTextView.setEditable(ro);
|
if not ro then FTextView.setEditable(ro);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user