Cocoa/Config: separate configuration data(cocoaconfig.inc) and definitions (cocoaconfig.pas)

This commit is contained in:
rich2014 2024-08-21 22:10:12 +08:00
parent 08275d757b
commit 3e0fbda2b8
2 changed files with 95 additions and 159 deletions

View File

@ -0,0 +1,93 @@
var
CocoaConfigListView: TCocoaConfigListView = (
vsReport: (
tableViewStyle: NSTableViewStyleAutomatic;
row: ( defaultHeight: 16; imageLineSpacing: 4*2 );
column: ( controlSpacing: 4; textFieldMinWidth: 16 );
columnAutoFit: ( maxCalcRows: 100; minWidth: 20; headerAdditionalWidth: 4 );
);
vsIcon: (
interitemSpacing: 4;
lineSpacing: 4;
item: (
minSize: ( width:64; height:68 );
controlSpacing: 2;
textFieldAlignment: {$ifdef USE_IOS_VALUES}1{$else}2{$endif}; // NSTextAlignmentCenter
checkBoxOccupiedWidth: 24
);
imageView: ( minSize: ( width: 32; height: 32 ); padding: 10; );
textField: ( defaultHeight: 15 );
);
vsSmallIcon: (
interitemSpacing: 10;
lineSpacing: 0;
item: (
minSize: ( width:150; height:28 );
controlSpacing: 2;
textFieldAlignment: 0; // NSTextAlignmentLeft
checkBoxOccupiedWidth: 24
);
imageView: ( minSize: ( width: 16; height: 16 ); padding: 4; );
textField: ( iconWidthFactor: 3; baseWidth: 0; minWidth: 128 );
);
vsList: (
interitemSpacing: 0;
lineSpacing: 10;
item: (
minSize: ( width:146; height:24 );
controlSpacing: 4;
textFieldAlignment: 0; // NSTextAlignmentLeft
checkBoxOccupiedWidth: 24
);
);
);
var
CocoaConfigScroller: TCocoaConfigScroller = (
// the style of the TCocoaScrollBar managed by TCocoaManualScrollView,
// the default value is System Preferred.
// note: TCocoaScrollBar not managed by TCocoaManualScrollView is always
// Legacy Style.
preferredStyle: -1;
// fade in/out time interval, in Seconds
fadeTimeInterval: 0.02;
legacy: (
knob: (
radius: 4; // Knob Radius, in Dots
color: @getCocoaScrollerDefaultKnobColor;
pos: 3; // Knob Position, in Dots
shrunkSize: 5; // Knob Shrunk Size, in Dots
alpha: 0.25; // Knob Alpha in Normal
alphaBlack: 0.5; // Knob Alpha when mouse enters
fadeStep: 0.05; // Knob Alpha Step when fading in/out
);
);
overlay: (
bar: (
// Overly Style Scroller Auto Show Delay Time, in Seconds
// used when the Scroller is triggered by double-finger tapping the touchpad
autoShowDelayTime: 0.2;
autoHideDelayTime: 0.9; // Bar Auto Hide Delay Time, in Seconds
alpha: 0.5; // Bar Alpha in Normal
alphaFadeStep: -0.1; // Bar Alpha Step when fading out
alphaFadeTo: 0; // Bar Alpha when fade out ends
expandTimeInterval: 0.03; // Bar Expands time interval, in Seconds
expandSize: 4; // Bar Expands when the mouse enters, in Dots
);
knob: (
radius: 4; // Knob Radius, in Dots
color: @getCocoaScrollerDefaultKnobColor;
pos: 5; // Knob Position, in Dots
shrunkSize: 6; // Knob Shrunk Size, in Dots
// in extreme cases, the normally calculated Knob size of Overlay Scroller
// may be too small, keep the min size.
// min height for the Knob of VerticalScroller
// min width for the Knob of HorizontalScroller
minSize: 25;
)
);
);

View File

@ -90,50 +90,6 @@ type
vsList: TCocoaConfigCollection;
end;
var
CocoaConfigListView: TCocoaConfigListView = (
vsReport: (
tableViewStyle: NSTableViewStyleAutomatic;
row: ( defaultHeight: 16; imageLineSpacing: 4*2 );
column: ( controlSpacing: 4; textFieldMinWidth: 16 );
columnAutoFit: ( maxCalcRows: 100; minWidth: 20; headerAdditionalWidth: 4 );
);
vsIcon: (
interitemSpacing: 4;
lineSpacing: 4;
item: (
minSize: ( width:64; height:68 );
controlSpacing: 2;
textFieldAlignment: {$ifdef USE_IOS_VALUES}1{$else}2{$endif}; // NSTextAlignmentCenter
checkBoxOccupiedWidth: 24
);
imageView: ( minSize: ( width: 32; height: 32 ); padding: 10; );
textField: ( defaultHeight: 15 );
);
vsSmallIcon: (
interitemSpacing: 10;
lineSpacing: 0;
item: (
minSize: ( width:150; height:28 );
controlSpacing: 2;
textFieldAlignment: 0; // NSTextAlignmentLeft
checkBoxOccupiedWidth: 24
);
imageView: ( minSize: ( width: 16; height: 16 ); padding: 4; );
textField: ( iconWidthFactor: 3; baseWidth: 0; minWidth: 128 );
);
vsList: (
interitemSpacing: 0;
lineSpacing: 10;
item: (
minSize: ( width:146; height:24 );
controlSpacing: 4;
textFieldAlignment: 0; // NSTextAlignmentLeft
checkBoxOccupiedWidth: 24
);
);
);
type
NSColorFunction = Function(): NSColor;
function getCocoaScrollerDefaultKnobColor: NSColor;
@ -182,55 +138,6 @@ type
overlay: TCocoaConfigScrollerOverlay;
end;
var
CocoaConfigScroller: TCocoaConfigScroller = (
// the style of the TCocoaScrollBar managed by TCocoaManualScrollView,
// the default value is System Preferred.
// note: TCocoaScrollBar not managed by TCocoaManualScrollView is always
// Legacy Style.
preferredStyle: -1;
// fade in/out time interval, in Seconds
fadeTimeInterval: 0.02;
legacy: (
knob: (
radius: 4; // Knob Radius, in Dots
color: @getCocoaScrollerDefaultKnobColor;
pos: 3; // Knob Position, in Dots
shrunkSize: 5; // Knob Shrunk Size, in Dots
alpha: 0.25; // Knob Alpha in Normal
alphaBlack: 0.5; // Knob Alpha when mouse enters
fadeStep: 0.05; // Knob Alpha Step when fading in/out
);
);
overlay: (
bar: (
// Overly Style Scroller Auto Show Delay Time, in Seconds
// used when the Scroller is triggered by double-finger tapping the touchpad
autoShowDelayTime: 0.2;
autoHideDelayTime: 0.9; // Bar Auto Hide Delay Time, in Seconds
alpha: 0.5; // Bar Alpha in Normal
alphaFadeStep: -0.1; // Bar Alpha Step when fading out
alphaFadeTo: 0; // Bar Alpha when fade out ends
expandTimeInterval: 0.03; // Bar Expands time interval, in Seconds
expandSize: 4; // Bar Expands when the mouse enters, in Dots
);
knob: (
radius: 4; // Knob Radius, in Dots
color: @getCocoaScrollerDefaultKnobColor;
pos: 5; // Knob Position, in Dots
shrunkSize: 6; // Knob Shrunk Size, in Dots
// in extreme cases, the normally calculated Knob size of Overlay Scroller
// may be too small, keep the min size.
// min height for the Knob of VerticalScroller
// min width for the Knob of HorizontalScroller
minSize: 25;
)
);
);
type
// on macOS, the FocusRing takes up extra space, which may cause strange
@ -257,72 +164,6 @@ type
function getCocoaControlFocusRingStrategry( AClassName: NSString ): TCocoaFocusRingStrategy;
var
// Scroller Knob Fade in/out time interval, in Seconds
CocoaScrollerKnobFadeTimeInterval : Double = 0.02;
// Scroller Knob Radius, in Dots
CocoaScrollerKnobRadius : Double = 4;
// Legacy Style Scroller Knob Color
CocoaScrollerOverlayStyleKnobColor : NSColorFunction = @getCocoaScrollerDefaultKnobColor;
// Legacy Style Scroller Knob Alpha in Normal
CocoaScrollerLegacyStyleAlpha : Double = 0.25;
// Legacy Style Scroller Knob Alpha when mouse enters
CocoaScrollerLegacyStyleAlphaBlack : Double = 0.50;
// Legacy Style Scroller Knob Alpha Step when fading in/out
CocoaScrollerLegacyStyleFadeStep : Double = 0.05;
// Legacy Style Scroller Knob Position, in Dots
CocoaScrollerLegacyStyleKnobPos : Double = 3;
// Legacy Style Scroller Knob Shrunk Size, in Dots
CocoaScrollerLegacyStyleKnobShrunkSize : Double = 5;
// Overly Style Scroller Knob Color
CocoaScrollerLegacyStyleKnobColor : NSColorFunction = @getCocoaScrollerDefaultKnobColor;
// Overly Style Scroller Auto Show Delay Time, in Seconds
// the scrollbar is not shown because the value is updated,
// but because it is triggered by other factors, such as
// double-finger tapping the touchpad
CocoaScrollerOverlayStyleAutoShowDelayTime : Double = 0.2;
// Overly Style Scroller Auto Hide Delay Time, in Seconds
CocoaScrollerOverlayStyleAutoHideDelayTime : Double = 0.9;
// Overlay Style Scroller Alpha in Normal
CocoaScrollerOverlayStyleAlpha : Double = 0.5;
// Overlay Style Scroller Alpha Step when fading out
CocoaScrollerOverlayStyleFadeStep : Double = -0.1;
// Overlay Style Scroller Alpha when fade out ends
CocoaScrollerOverlayStyleFadeTo : Double = 0;
// Overlay Style Scroller expands time interval, in Seconds
CocoaScrollerOverlayStyleExpandTimeInterval : Double = 0.03;
// Overlay Style Scroller expands when the mouse enters, in Dots
CocoaScrollerOverlayStyleExpandSize : Double = 4;
// Overlay Style Scroller Knob Position, in Dots
CocoaScrollerOverlayStyleKnobPos : Double = 5;
// Overlay Style Scroller Knob Shrunk Size, in Dots
CocoaScrollerOverlayStyleKnobShrunkSize : Double = 6;
// in extreme cases, the normally calculated Knob size of Overlay Scroller
// may be too small, keep the min size.
// min height for the Knob of VerticalScroller
// min width for the Knob of HorizontalScroller
CocoaScrollerOverlayStyleKnobMinSize : Double = 25;
// by default on macOS, Notification is only Presented when the APP is
// in the background.
// when CocoaAlwaysPresentNotification is set to True, Notification is
@ -354,6 +195,8 @@ var
LoopHiJackEnded : Boolean = false;
{$endif}
{$include cocoaconfig.inc}
implementation
var