Commit Graph
6306 Commits
Author SHA1 Message Date
David Richardson 7d59762561 AppKit: CPLayoutManager, CPStringDrawing, CPMenu, CPCookie PLATFORM conditional removal
- 8 PLATFORM blocks resolved across four files: runtime CPDOMAvailable
  guards (3 wrapped, 2 early returns, 3 if/else preserving existing
  CommonJS branches)
- CPMenu: @global _CPDOMEventStop declared; its definition resides in
  the DOM-only CPPlatformWindow+DOM category
- zero preprocessor directives remain in these files
- work-in-progress towards complete removal of CPP directives
2026-08-31 17:04:24 -06:00
David Richardson c2be4f87c5 AppKit: CPApplication, CPImage, CPColorPicker PLATFORM conditional removal
- 10 PLATFORM blocks resolved across three files: runtime
  CPDOMAvailable guards (6 wrapped, 3 early returns, 1 sequential
  guard-return preserving the CommonJS result)
- CPApplication: @global CPWindowObjectList declared; its definition
  resides in the DOM-only CPPlatformWindow+DOM category
- zero preprocessor directives remain in these files
- work-in-progress towards complete removal of CPP directives
2026-08-29 12:25:14 -06:00
David Richardson 06ebbfb300 AppKit: CPDatePicker PLATFORM conditional removal
- 13 PLATFORM blocks resolved across the six date picker files;
  mechanical translation to runtime CPDOMAvailable guards
- the recurring _invokedByUserEvent YES/NO sandwich around
  _setDateValue translated as paired single-statement guards
- two stale "Workaround: added if PLATFORM(DOM)" comments updated
  to name the runtime guard
- work-in-progress towards complete removal of CPP directives
2026-08-27 23:17:15 -06:00
David Richardson 61e885db5f Merge branch 'main' into refactor-remove-nativehost-target 2026-08-27 13:28:50 -06:00
daboe01 bad82ee587 Merge pull request #3296 from daboe01/pageunloadfix2
fix: replace legacy `unload` event listener cleanup with `pagehide`
2026-08-27 19:40:57 +02:00
daboe01 16beb1a86c fix: replace legacy unload event listener cleanup with pagehide 2026-08-27 19:28:31 +02:00
David Richardson 690b79f113 Revert "Merge pull request #3260 from enquora/modernize-CALayer"
This reverts commit 8134b6dff7, reversing
changes made to 7083f7b268.
2026-08-27 11:20:41 -06:00
David Richardson 4d13785119 Revert "Merge pull request #3257 from enquora/modernize-CABackingStore"
This reverts commit 5bdac195fc, reversing
changes made to 8134b6dff7.
2026-08-27 11:20:30 -06:00
David Richardson 4f29b77d65 Revert "Merge pull request #3261 from enquora/modernize-CPPlatformpasteboard"
This reverts commit 10351c3d4a, reversing
changes made to 5bdac195fc.
2026-08-27 11:20:20 -06:00
David Richardson be08bed01e Revert "Merge pull request #3256 from enquora/modernize-cgcontext-canvas"
This reverts commit e107e2d804, reversing
changes made to 10351c3d4a.
2026-08-27 11:19:56 -06:00
daboe01 e107e2d804 Merge pull request #3256 from enquora/modernize-cgcontext-canvas
Modernize CGContextCanvas.j: Remove CPP macros and legacy fallbacks
2026-08-27 10:06:21 +02:00
daboe01 10351c3d4a Merge pull request #3261 from enquora/modernize-CPPlatformpasteboard
Refactor CPPlatformPasteboard: Remove CPP macros and legacy IE fallbacks
2026-08-27 10:00:33 +02:00
daboe01 5bdac195fc Merge pull request #3257 from enquora/modernize-CABackingStore
Refactor CABackingStore: Eliminate preprocessor directives and legacy…
2026-08-26 20:52:08 +02:00
daboe01 8134b6dff7 Merge pull request #3260 from enquora/modernize-CALayer
Modernize CALayer, remove macro defined access in favour of ivar
2026-08-26 20:50:47 +02:00
daboe01 acf410776d Merge pull request #3279 from daboe01/whitespace-cleanup
fixed: usage of tab character instead of 4 spaces
2026-08-26 20:46:52 +02:00
daboe01 f85ac1ea10 new: constrain tab stop marker movement between preceding text and adjacent tab stops 2026-08-26 19:16:12 +02:00
daboe01 874792fa6e new: constrain tab stop marker dragging to preceding text boundary 2026-08-26 19:01:32 +02:00
daboe01 ca13595e37 formatting 2026-08-26 17:58:39 +02:00
daboe01 22a43bcfc5 fixed: resolve tab stop skipping and dragging positioning 2026-08-26 17:56:48 +02:00
daboe01 9ffa4decd4 fixed: indentation paddle dragging and clientView binding 2026-08-26 17:06:34 +02:00
David Richardson 6e80d78297 AppKit: _CPImageAndTextView PLATFORM conditional removal
- ivar block ungated: _DOMImageElement, _DOMTextElement,
  _DOMTextShadowElement now declared under both targets
- 5 method-body PLATFORM blocks resolved: setAlignment and
  setSelectedRange via early return, layoutSubviews wrapped whole
  (420 lines, _flags reset kept ungated), setTextColor wrapped,
  textFrame as a compound condition
- work-in-progress towards complete removal of CPP directives
2026-08-25 22:34:22 -06:00
daboe01 8d1429d063 proxy fix 2026-08-25 21:09:51 +02:00
daboe01 d1b5c08272 fixed: KVO observer was missing 2026-08-25 21:03:07 +02:00
daboe01 0a6f2e569a fixed: fix selection bindings and correct KVO dependencies in CPTreeController 2026-08-25 20:35:09 +02:00
David Richardson cdd3801549 AppKit: CALayer PLATFORM conditional removal
- 4 PLATFORM blocks resolved: DOM element creation in init, display
  context setup, sublayer DOM insertion, and the _CALayerUpdateDOM
  helper translated to runtime CPDOMAvailable guards (3 wrapped, 1
  early return)
- two #define macros (DOM, ADJUST_CONTENTS_ZINDEX) remain; they belong
  to the planned macro pass
- work-in-progress towards complete removal of CPP directives
2026-08-24 15:57:56 -06:00
David Richardson 1f453e70ee AppKit: CPPlatformWindow PLATFORM conditional removal
- ivar block ungated: DOM window/element handles, event state, pasteboard
  and touch-tracking ivars now declared under both targets (nil when no
  DOM is present)
- supportsMultipleInstances and isVisible: PLATFORM/#else pairs
  translated to sequential CPDOMAvailable guard-returns preserving the
  CommonJS result (NO)
- init, setContentRect, moveWindow and setTitle blocks translated to
  runtime guards (wrapped, early return, compound condition)
- work-in-progress towards complete removal of CPP directives
2026-08-24 15:42:09 -06:00
David Richardson 2bd31a77d3 AppKit: CPTokenField PLATFORM conditional removal
- file-scope input-state variables ungated (11 module-locals, previously
  browser-only); method-body translations reference them under runtime
  guards only
- 7 method-body PLATFORM blocks resolved: 3 compound conditions, 2
  wrapped, 1 early return
- the method-definition gate around _inputElement remains, held for the
  structural-design phase with the CPTextField and CPTextView gates
- work-in-progress towards complete removal of CPP directives
2026-08-24 15:35:35 -06:00
David Richardson aeb340a4cb AppKit: _CPPopoverWindow PLATFORM conditional removal
- 11 PLATFORM blocks resolved;
- @import "CPCompatibility.j" added for the CPDOMAvailable predicate
- no preprocessor directives remain in this file
- work-in-progress towards complete removal of CPP directives
2026-08-24 09:21:10 -06:00
David Richardson 1ffdcfc89e AppKit: CPTextView PLATFORM conditional removal
- CPTextView.j: 11 PLATFORM blocks resolved;
- work-in-progress towards complete removal of CPP directives
2026-08-24 08:45:35 -06:00
David Richardson 51f4af0c5c AppKit: CPControl, CPSlider PLATFORM conditional removal
- CPControl.j and CPSlider.j: one PLATFORM block each, resolved to
  runtime CPDOMAvailable guards; no preprocessor directives remain
  in either file
- work-in-progress towards complete removal of CPP directives
2026-08-21 15:55:25 -06:00
David Richardson 159a82e077 AppKit: CPScreen, CPColor PLATFORM conditional removal
- CPScreen.j and CPColor.j: one PLATFORM block each, resolved to
  runtime CPDOMAvailable guards; no preprocessor directives remain
  in either file
- work-in-progress towards complete removal of CPP directives
2026-08-21 15:52:17 -06:00
David Richardson 01476c53ac AppKit: CPImageView PLATFORM conditional removal
- CPImageView.j: all 12 PLATFORM blocks resolved; mechanical
  translation to runtime CPDOMAvailable guards (wrapped, compound,
  early-return); no preprocessor directives remain in this file
- work-in-progress towards complete removal of CPP directives
2026-08-21 15:39:37 -06:00
David Richardson bc0bc7c68a AppKit: CPTextField PLATFORM conditional removal
- CPTextField.j: 14 PLATFORM blocks resolved; mechanical translation
  to runtime CPDOMAvailable guards (wrapped, compound, early-return,
  one runtime if/else); one site used a nonstandard directive
  spelling (#if PLATFORM (DOM), space before the parenthesis),
  normalized and resolved with the rest
- The method-definition gate around _inputElement remains, out of
  scope for this change
- work-in-progress towards complete removal of CPP directives
2026-08-21 15:34:50 -06:00
David Richardson 880f6a3220 AppKit: CPWindow PLATFORM conditional removal
- CPWindow.j: 16 of 17 PLATFORM blocks resolved; purely mechanical
  translation to runtime CPDOMAvailable guards (wrapped or compound),
  one ivar un-gated; one latent no-return bug preserved as-is
- The PLATFORM(BROWSER) import gate remains, out of scope for this change
- work-in-progress towards complete removal of CPP directives
2026-08-21 15:24:54 -06:00
David Richardson 45fd97d980 AppKit: complete CPView PLATFORM conditional removal (part 2)
- CPView.j: remaining 17 PLATFORM blocks resolved; purely mechanical
  translation to runtime CPDOMAvailable guards, except the choice of
  guard form (wrapped, compound, or early-return) per site
- No PLATFORM(DOM) conditionals remain in CPView.j; one #if DEBUG
  block remains and is out of scope for this change
- work-in-progress towards complete removal of CPP directives
2026-08-21 15:18:12 -06:00
David Richardson 557e4d7bd2 AppKit: replace PLATFORM(DOM) conditionals with runtime checks (CPView, part 1)
- Add CPDOMAvailable to CPCompatibility.j: canonical documented DOM capability test, bare global assignment
- CPView.j: 13 of 30 PLATFORM blocks resolved. Method bodies now
  guarded at runtime (wrapped, compound, or early-return forms); DOM vars and ivars declared without resort to CPP conditionals
- work-in-progress towards complete removal of CPP directives
2026-08-21 15:05:07 -06:00
David Richardson 4edcf0fecc Merge branch 'main' into refactor-remove-nativehost-target
# Conflicts:
#	AppKit/CPTextView/_CPTableTextAttachment.j
2026-08-21 09:52:57 -06:00
David Richardson ae409d05c1 Convert tabs to spaces 2026-08-21 09:21:51 -06:00
David Richardson 5449561fe2 Clear _CPFontPanelPreviewView build warning
CPFontPanel.j used _CPFontPanelPreviewView as an ivar type and instantiated it before its own @implementation, later in the same file, with no forward declaration. Added @class _CPFontPanelPreviewView, alongside the file's existing forward declarations.

This removes all build warnings.
2026-08-20 20:14:14 -06:00
David Richardson 6121caf75d Remove CPTabStopType build warning
CPParagraphStyle.j defined CPTabStopType's four constants directly, with a comment noting they were "missing" but no @typedef for the type itself.

_CPRTFParser.j uses CPTabStopType as an ivar type and imports CPParagraphStyle.j directly, so the fix belongs in the defining file.

Added the missing @typedef CPTabStopType, same pattern as CPRulerOrientation.
2026-08-20 20:05:38 -06:00
David Richardson 533a1d46eb Address CPRulerOrientation build warning
CPRulerView.j declared CPRulerOrientation's constants directly,
with only a comment claiming it was a typedef.

No @typedef directive existed, so the type was unknown wherever used as an ivar or parameter type.

Added the missing @typedef CPRulerOrientation, matching the pattern already used for CPTextAlignment in CPText.j.
2026-08-20 19:57:35 -06:00
David Richardson 52658b636a Add missing CPTextTab forward declaration in CPRulerView
CPRulerView.j referenced CPTextTab (isKindOfClass: and alloc/init) without a declaration.

Added @class CPTextTab; to resolve the symbol reference. A forward declaration was utilized rather than importing CPParagraphStyle.j to minimize dependency coupling, despite the absence of a circular import risk.

Resolves build warning.
2026-08-20 16:28:02 -06:00
David Richardson a1ac821678 Fix build warnings in _CPTableTextAttachment
Replaced the CPTextView.j import with forward declarations for CPTextView and CPTextContainer (the latter previously reached via the removed import).

The previous import graph created a circular dependency (_CPTableTextAttachment.j -> CPTextView.j -> _CPRTFParser.j / _CPRTFProducer.j -> _CPTableTextAttachment.j).

This caused the legacy compiler to emit a class registration warning during clean builds, as the class was unregistered at the time of resolution. Incremental builds masked this warning via cached symbol tables.

Using forward declarations breaks the cycle and ensures warning-free clean and incremental builds.
2026-08-20 15:31:45 -06:00
David Richardson 78a0ebab6e Remove CPScrollView build warning
CPRulerView.j did not import CPScrollView.
A direct import would create a cycle, since CPScrollView.j already imports CPRulerView.j.
Added a forward declaration instead.
2026-08-19 20:23:33 -06:00
David Richardson ac8ce3eec3 Fix CPOutlineView build warnings and audit+improve CPTreeNode
CPOutlineView.j used CPTreeNode before AppKit.j imported it. This
triggered build warnings. This commit adds an import.

- Add @import "CPTreeNode.j" to CPOutlineView.j.

While addressing this warning, CPTreeNode was audited and found to have an algorithmic complexity regression and multiple structural inconsistencies in the KVO support code.

The test suite for CPTreeNode was Spartan in the extreme.

All of these have been addressed - see inline notes for details.
CPTreeNode is subject to further audit.
2026-08-19 10:11:20 -06:00
daboe01 567ec55875 fixed: usage of tab character instead of 4 spaces 2026-08-18 19:46:22 +02:00
David Richardson 01f7f9b601 Fix CPStackView compile errors and add minimal correctness fixes
CPStackView.j emited warnings during builds and tests which constituted
either real errors or indeterminate state.

These included four types that did not exist: CPUserInterfaceLayoutOrientation, CPLayoutAttribute,
CPEdgeInsets, and CPMapTable.

The missing types are now present.

- Add local typedefs for CPUserInterfaceLayoutOrientation and
  CPLayoutAttribute. Numeric values match the equivalent Cocoa
  constants.
- Add CPEdgeInsets as an alias for the existing CGInset struct.
  Add CPEdgeInsetsMake and CPEdgeInsetsEqualToEdgeInsets.
- Import Foundation/CPMapTable.j. CPMapTable already exists in
  Foundation.

This commit also fixes two logic errors found during review.

- arrangedSubviews did not match the true view order after
  insert or remove. Add _rebuildArrangedSubviews and call it
  from every method that changes view order.
- Trailing-gravity layout added one extra spacing gap past the
  last view. This shifted the returned layout boundary. Spacing
  is now added before each view, not after.

This commit adds one new property.

- Add a distribution property with storage and accessors. It
  has no effect on layout yet. This makes the property honest:
  before this change, the type existed but no property did.

The manual test, ./Tests/Manual/CPStackViewTest, used a Narwhal-era
Jakefile and would not build. This has been updated to reflect
usage under the Node toolchain.

This commit adds CPStackView.j to AppKit.j. The file was never
imported. Only the build script's wildcard file list included
it.

This commit adds a header comment to CPStackView.j. The comment
states that the class is a placeholder. It lists known
limitations. It states that a constraint-solver based
replacement is planned.

Why: CPStackView must compile and pass tests before capp-build
can use this tree as a build reference, and a class with unstated
limits invites misuse.
2026-08-14 20:09:17 -06:00
David Richardson e5c34e3dd7 Remove NativeHost platform target; require CommonJS/Node for tooling
Cappuccino previously supported three platform contexts behind the
PLATFORM() preprocessor macro: Browser, CommonJS/Node, and a NativeHost
target. NativeHost is no longer supported; this removes it and
consolidates on Browser (for the app) and CommonJS/Node (still needed
by the toolchain itself, for theme compilation and testing).

PLATFORM(DOM) conditionals throughout AppKit governed both distinctions
at once - Browser vs NativeHost, and separately, DOM-dependent code vs
the CommonJS/Node build. Each conditional was reviewed individually:
NativeHost-only branches were removed, while branches needed for
CommonJS/Node were kept intact rather than collapsed to Browser-only.

Also included, found in the course of this work:
- Fixed two pre-existing duplicate instance-variable declarations
  (_ephemeralSubviews in CPView, _scrollingTimer in CPTextView)
- Added a missing @import for CPTextContainer.j in CPTextView.j so
  it resolves when compiled outside the full framework bundle
- Merged two Platform/DOM/*.j files into their parents to resolve a
  build-tool basename collision, preserving the CommonJS fallback path
2026-08-12 13:25:52 -06:00
daboe01 ce2803f354 replace unload event listener with pagehide and add DOM safety checks 2026-08-12 16:58:12 +02:00
David Richardson b62721d79a Remove _IS_NUMERIC macro in favor of concrete funtion CPIsNumeric()
- Create Foundation/_CPFoundationUtilities.j to house global low-level utilities.
- Implement CPIsNumeric as a concrete JavaScript function, preserving the exact legacy logic.
- Import _CPFoundationUtilities.j in the Foundation.j umbrella manifest.
- Replace _IS_NUMERIC macro calls at all call sites with CPIsNumeric().
2026-08-05 13:47:28 -06:00