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