mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-23 16:48:53 +00:00
AppKit: final PLATFORM body-block sweep (8 files)
- CPVisualEffectView, CPWebView, _CPBorderlessBridgeWindowView, CPViewAnimator, CPFontManager, _CPMenuBarWindow, CPRuleEditor, CPScrollView: 8 PLATFORM blocks resolved to runtime CPDOMAvailable guards (5 wrapped, 2 guard-returns, 1 if/else) - this completes the method-body sweep: remaining PLATFORM directives are a method-definition, class-scope, or import gate, reserved for the structural-design phase - work-in-progress towards complete removal of CPP directives
This commit is contained in:
1 parent
7d59762561
commit
fa525e1cee
8 files changed
+63
-51
No files matched your search
+24
-20
@@ -25,6 +25,7 @@
|
||||
@import "CPControl.j"
|
||||
@import "CPFont.j"
|
||||
@import "CPFontDescriptor.j"
|
||||
@import "CPCompatibility.j"
|
||||
|
||||
@global CPApp
|
||||
@class CPFontPanel
|
||||
@@ -132,28 +133,31 @@ CPRemoveTraitFontAction = 7;
|
||||
{
|
||||
_availableFonts = [];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
_CPFontDetectSpan = document.createElement("span");
|
||||
_CPFontDetectSpan.fontSize = "24px";
|
||||
_CPFontDetectSpan.appendChild(document.createTextNode("mmmmmmmmmml"));
|
||||
var div = document.createElement("div");
|
||||
div.style.position = "absolute";
|
||||
div.style.top = "-1000px";
|
||||
div.appendChild(_CPFontDetectSpan);
|
||||
document.getElementsByTagName("body")[0].appendChild(div);
|
||||
|
||||
_CPFontDetectReferenceFonts = _CPFontDetectPickTwoDifferentFonts(["monospace", "serif", "sans-serif", "cursive"]);
|
||||
|
||||
for (var i = 0; i < _CPFontDetectAllFonts.length; i++)
|
||||
if (CPDOMAvailable)
|
||||
{
|
||||
var available = _CPFontDetectFontAvailable(_CPFontDetectAllFonts[i]);
|
||||
if (available)
|
||||
_availableFonts.push(_CPFontDetectAllFonts[i]);
|
||||
_CPFontDetectSpan = document.createElement("span");
|
||||
_CPFontDetectSpan.fontSize = "24px";
|
||||
_CPFontDetectSpan.appendChild(document.createTextNode("mmmmmmmmmml"));
|
||||
var div = document.createElement("div");
|
||||
div.style.position = "absolute";
|
||||
div.style.top = "-1000px";
|
||||
div.appendChild(_CPFontDetectSpan);
|
||||
document.getElementsByTagName("body")[0].appendChild(div);
|
||||
|
||||
_CPFontDetectReferenceFonts = _CPFontDetectPickTwoDifferentFonts(["monospace", "serif", "sans-serif", "cursive"]);
|
||||
|
||||
for (var i = 0; i < _CPFontDetectAllFonts.length; i++)
|
||||
{
|
||||
var available = _CPFontDetectFontAvailable(_CPFontDetectAllFonts[i]);
|
||||
if (available)
|
||||
_availableFonts.push(_CPFontDetectAllFonts[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If there's no font detection, just assume all fonts are available.
|
||||
_availableFonts = _CPFontDetectAllFonts;
|
||||
}
|
||||
#else
|
||||
// If there's no font detection, just assume all fonts are available.
|
||||
_availableFonts = _CPFontDetectAllFonts;
|
||||
#endif
|
||||
}
|
||||
return _availableFonts;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
@import "CPPanel.j"
|
||||
@import "_CPMenuManager.j"
|
||||
@import "CPCompatibility.j"
|
||||
|
||||
@class _CPMenuView
|
||||
@class CPMenu
|
||||
@@ -100,16 +101,17 @@
|
||||
|
||||
- (void)setTitle:(CPString)aTitle
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
var bundleName = [[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPBundleName"];
|
||||
if (CPDOMAvailable)
|
||||
{
|
||||
var bundleName = [[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPBundleName"];
|
||||
|
||||
if (![bundleName length])
|
||||
document.title = aTitle;
|
||||
else if ([aTitle length])
|
||||
document.title = aTitle + @" - " + bundleName;
|
||||
else
|
||||
document.title = bundleName;
|
||||
#endif
|
||||
if (![bundleName length])
|
||||
document.title = aTitle;
|
||||
else if ([aTitle length])
|
||||
document.title = aTitle + @" - " + bundleName;
|
||||
else
|
||||
document.title = bundleName;
|
||||
}
|
||||
|
||||
[_titleField setStringValue:aTitle];
|
||||
[_titleField sizeToFit];
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
@import "_CPRuleEditorViewSliceRow.j"
|
||||
@import "_CPRuleEditorLocalizer.j"
|
||||
@import "CPCompatibility.j"
|
||||
|
||||
@class CPCompoundPredicate
|
||||
@class CPComparisonPredicate
|
||||
@@ -2248,10 +2249,11 @@ TODO: implement
|
||||
firstSlice = [_slices objectAtIndex:firstIndex],
|
||||
dragview = [[CPView alloc] initWithFrame:[firstSlice frame]];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
var html = firstSlice._DOMElement.innerHTML;
|
||||
dragview._DOMElement.innerHTML = [html copy];
|
||||
#endif
|
||||
if (CPDOMAvailable)
|
||||
{
|
||||
var html = firstSlice._DOMElement.innerHTML;
|
||||
dragview._DOMElement.innerHTML = [html copy];
|
||||
}
|
||||
[dragview setBackgroundColor:[firstSlice backgroundColor]];
|
||||
[dragview setAlphaValue:0.7];
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
@import "CPScroller.j"
|
||||
@import "CPView.j"
|
||||
@import "CPRulerView.j"
|
||||
@import "CPCompatibility.j"
|
||||
|
||||
@class CPTableView
|
||||
@class CPRulerView
|
||||
@@ -49,7 +50,8 @@
|
||||
/*! @ignore */
|
||||
var _isBrowserUsingOverlayScrollers = function()
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
if (!CPDOMAvailable) return NO;
|
||||
|
||||
/*
|
||||
Even if the system supports overlay (Lion) scrollers,
|
||||
the browser (e.g. FireFox *cough*) may not.
|
||||
@@ -85,9 +87,6 @@ var _isBrowserUsingOverlayScrollers = function()
|
||||
document.body.removeChild(outer);
|
||||
|
||||
return usingOverlayScrollers;
|
||||
#else
|
||||
return NO;
|
||||
#endif
|
||||
};
|
||||
|
||||
var TIMER_INTERVAL = 0.2,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
@import <Foundation/Foundation.j>
|
||||
@import "CPAppearance.j"
|
||||
@import "CPView.j"
|
||||
@import "CPCompatibility.j"
|
||||
|
||||
@typedef CPVisualEffectMaterial
|
||||
CPVisualEffectMaterialAppearanceBased = 0;
|
||||
@@ -126,9 +127,10 @@ CPVisualEffectStateInactive = 2;
|
||||
|
||||
[self setBackgroundColor:finalColor];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
self._DOMElement.style[prop] = shouldEnable ? "blur(30px)" : nil;
|
||||
#endif
|
||||
if (CPDOMAvailable)
|
||||
{
|
||||
self._DOMElement.style[prop] = shouldEnable ? "blur(30px)" : nil;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+5
-3
@@ -22,6 +22,7 @@
|
||||
|
||||
@import "CPView.j"
|
||||
@import "CPScrollView.j"
|
||||
@import "CPCompatibility.j"
|
||||
|
||||
@class CPWebScriptObject
|
||||
|
||||
@@ -1031,9 +1032,10 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
||||
_forwardStack = [];
|
||||
_scrollMode = CPWebViewScrollAuto;
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
[self _initDOMWithFrame:[self frame]];
|
||||
#endif
|
||||
if (CPDOMAvailable)
|
||||
{
|
||||
[self _initDOMWithFrame:[self frame]];
|
||||
}
|
||||
|
||||
if (![self backgroundColor])
|
||||
[self setBackgroundColor:[CPColor whiteColor]];
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
@import "_CPWindowView.j"
|
||||
@import "CPCompatibility.j"
|
||||
|
||||
@implementation _CPBorderlessBridgeWindowView : _CPWindowView
|
||||
{
|
||||
@@ -90,10 +91,11 @@
|
||||
if (_frame.size.width < theWindow._minSize.width || _frame.size.height < theWindow._minSize.height)
|
||||
[theWindow._contentView setFrameSize:CGSizeMake(MAX(_frame.size.width, theWindow._minSize.width), MAX(_frame.size.height, theWindow._minSize.height))];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
_DOMElement.style.overflowX = (_frame.size.width < theWindow._minSize.width)? "scroll":"hidden";
|
||||
_DOMElement.style.overflowY = (_frame.size.height < theWindow._minSize.height)? "scroll":"hidden";
|
||||
#endif
|
||||
if (CPDOMAvailable)
|
||||
{
|
||||
_DOMElement.style.overflowX = (_frame.size.width < theWindow._minSize.width)? "scroll":"hidden";
|
||||
_DOMElement.style.overflowY = (_frame.size.height < theWindow._minSize.height)? "scroll":"hidden";
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -394,11 +394,10 @@ var frameToCSSTranslationTransformMatrix = function(start, current)
|
||||
|
||||
- (Object)_DOMElement
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
return _DOMElement;
|
||||
#else
|
||||
if (CPDOMAvailable)
|
||||
return _DOMElement;
|
||||
|
||||
return nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (CPString)debug_description
|
||||
|
||||
Reference in new issue
Block a user