Commit Graph
11370 Commits
Author SHA1 Message Date
David Richardson 66ea130c8d AppKit: Disable Undo and Redo when a text view does not allow undo
A text view handled undo: and redo: and registered its changes even when allowsUndo was NO, so Edit > Undo stayed enabled and did nothing.

Behaviour now follows canonical Cocoa: a text view that does not allow undo registers nothing and passes undo: and redo: on to the window, and Undo and Redo are enabled only when there is a change to undo or redo.

* CPTextView/CPTextView.j: Register changes only when undo is allowed, stop responding to undo: and redo: when it is not, and validate the Undo and Redo items against the undo manager.

* CPWindow/CPWindow.j: Validate the Undo and Redo items against the window's undo manager.

* Tests/AppKit/CPTextViewTest.j: Add tests for responding to undo:, registering changes and validating the Undo item.

* Tests/Manual/TextEditor/DocumentWindowController.j: Add toggleAllowsUndo: and validateMenuItem:, so that undo can be turned on and off for the active document.

* Tests/Manual/TextEditor/Resources/MainMenu.xib, Resources/MainMenu.cib: Add Edit > Allow Undo.

* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this gap, record Allow Undo as tested, and add the key equivalent behaviour of disabled menu items for discussion.
2026-10-23 17:20:27 -06:00
David Richardson 92b8039c71 Merge pull request #3335 from enquora/integration-test-document-based-app
AppKit: Show CPBundleDisplayName as the application's name
2026-10-23 16:46:50 -06:00
David Richardson 947fbaddfa AppKit: Show CPBundleDisplayName as the application's name
AppKit read only CPBundleName for the name that users see, so an application's display name was ignored. It now follows Cocoa, which shows CFBundleDisplayName and falls back to CFBundleName.

* CPApplication.j: Add _applicationName, which returns CPBundleDisplayName or, without one, CPBundleName, and use it as the About panel title.

* CPMenu/_CPMenuBarWindow.j: Use the display name in the browser tab title.

* Tests/Manual/TextEditor/Info.plist: Rename the display name key from CFBundleDisplayName to CPBundleDisplayName.

* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this gap, and record the About panel as tested.
2026-10-23 16:45:51 -06:00
David Richardson bf4181dc76 Merge pull request #3334 from enquora/integration-test-document-based-app
Gaps exposed by the TextEditor test application and fixed in AppKit, Foundation:

* Foundation: CPUndoManager no longer raises when undo runs in the same run loop cycle as the change it reverts.

* AppKit: The Show Toolbar menu item now reflects the toolbar's visibility.

* AppKit: The Window menu now lists the application's windows, marks the main window and supports Bring All to Front.
2026-10-23 16:33:04 -06:00
David Richardson 055ae6d04e AppKit: List the application's windows in the Windows menu
The Window menu never listed the application's windows, because AppKit had none of Cocoa's Windows menu support.

* CPApplication.j: Add windowsMenu, setWindowsMenu:, addWindowsItem:title:filename:, changeWindowsItem:title:filename:, removeWindowsItem:, updateWindowsItem: and arrangeInFront:; find the menu named _CPWindowsMenu in the main menu, and list the visible windows when the main menu is set.

* CPWindow/CPWindow.j: Add isExcludedFromWindowsMenu and setExcludedFromWindowsMenu:, and keep the window's item current when the window is ordered in or out, retitled, made main or no longer main, miniaturized, deminiaturized or closed.

* Tests/AppKit/CPApplicationWindowsMenuTest.j: Add tests for listing, retitling, exclusion, the main window check mark, separator handling, file name titles and moving items to another Windows menu.

* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this gap, and record the Window menu as tested.
2026-10-23 16:29:46 -06:00
David Richardson 56aa68f832 AppKit: Reflect the toolbar's visibility in the Show Toolbar menu item
The Show Toolbar menu item toggled the toolbar, but CPWindow did not validate it, so its title never changed and it stayed enabled in windows without a toolbar.

* CPWindow/CPWindow.j: Add validateUserInterfaceItem:, which sets the toggleToolbarShown: item's title to Hide Toolbar or Show Toolbar and enables it only when the window has a toolbar.
* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this defect, and record the menu item as tested.
2026-10-23 16:12:14 -06:00
David Richardson 263f7a4038 Merge pull request #3333 from enquora/integration-test-document-based-app
Undo functionality: verify behaviour, fix accidentally disclosed edge…
2026-10-23 15:56:19 -06:00
David Richardson 41969c7f55 Undo functionality: verify behaviour, fix accidentally disclosed edge case
The TextEditor work list recorded redo as unreliable. Retesting proved that undo and redo work correctly.

Supporting investigation disclosed an edge case in CPUndoManager: when undo ran in the same run loop cycle as the change it reverted, it closed the open event grouping itself, but the run loop's scheduled close still ran and raised CPInternalInconsistencyException because no grouping was open.

* Foundation/CPUndoManager.j: Cancel the run loop's scheduled close when undo closes the event grouping itself.
* Tests/Foundation/CPUndoManagerTest.j: Add a test that undoes a change in the same run loop cycle and then redoes it, and correct the doIt selector registered by the undoIt helper.
* Tests/Manual/TextEditor/WORKLIST.md: Remove the redo entry recorded in error, and record undo and redo as tested.
2026-10-23 15:54:19 -06:00
David Richardson c4a90c16a7 Merge pull request #3332 from enquora/integration-test-document-based-app
AppKit: Store the window delegate's resize size in the window frame
2026-10-23 15:31:16 -06:00
David Richardson c1f8c8ceb3 AppKit: Store the window delegate's resize size in the window frame
A window stored the proposed size in its frame before asking its delegate through windowWillResize:toSize:, and gave the delegate's size only to the window view. When the delegate enlarged the size, hit testing used the smaller frame, so the window could no longer be moved or resized.

* CPWindow/CPWindow.j: Ask the delegate before storing the new size, and store the size it returns in the frame.
* CPWindow/_CPWindowView.j: Ask the delegate during a user resize, and move the origin by the delegate's adjustment when resizing from the left or top edge, so that the opposite edge stays in place.
* Tests/Manual/TextEditor/Resources/DocumentWindow.xib: Make the document window's content view resize with the window.
* Tests/Manual/TextEditor/WORKLIST.md: Remove the entry for this defect, record the minimum window size behaviour as tested, and add the content view resizing setting that does not reach the cib.
2026-10-23 15:21:23 -06:00
David Richardson dec05699f3 Merge pull request #3331 from enquora/integration-test-document-based-app
Integration test for document-based apps
2026-10-23 14:58:09 -06:00
David Richardson 41a7004a53 Tests/Manual: Record more AppKit gaps in the TextEditor work list
Add the AppKit gaps found since the work list was created, and describe the visible effect of the window resize defect.

* WORKLIST.md: Add entries for CPBundleDisplayName, which AppKit ignores, and for the Show Toolbar menu item, which never reflects the toolbar state; state that a window shrunk to its minimum size can no longer be moved or resized, because hit testing uses the unclamped frame.
2026-10-23 14:52:36 -06:00
David Richardson 98c3611ade Tests/Manual: Name TextEditor TextEdit by Cappuccino
Give TextEditor a display name and a real bundle identifier, and replace the template copyright and author placeholders.

* Info.plist: Set the bundle identifier to dev.cappuccino.TextEditor, add the display name TextEdit by Cappuccino, and state the MIT license in the copyright string.
* Jakefile: Set the same bundle identifier and remove the placeholder email.
* Resources/MainMenu.xib, Resources/MainMenu.cib: Use the display name in the application menu, About and Help items.
2026-10-23 14:41:45 -06:00
David Richardson e3a3cf6bcd Tests/Manual: Remove Internet Explorer markup from TextEditor html launch pages
Remove the conditional comments for Internet Explorer 8 and 9 that the capp gen template added, since no supported browser reads them.

* index.html, index-debug.html: Remove the X-UA-Compatible meta elements and their IE conditional comments.
2026-10-23 14:18:45 -06:00
David Richardson 1944382e0e Tests/Manual: Clamp TextEditor document windows to a minimum size
Stop document windows from shrinking below a usable size, and record the AppKit gaps that TextEditor has found.

* DocumentWindowController.j: Implement windowWillResize:toSize: to keep the window at or above provisional minimum dimensions.
* WORKLIST.md: Add a work list of the AppKit gaps found by TextEditor, the planned additions to the app and the tests done.
2026-10-22 19:05:35 -06:00
David Richardson 24b760b306 Tests/Manual: Declare the TextEditor bundle type and identifier
Add the bundle package type and identifier to the TextEditor Info.plist, so that the build does not have to derive them.

* Info.plist: Add CPBundlePackageType APPL and CPBundleIdentifier.
2026-10-22 19:04:57 -06:00
David Richardson f4109c0ee4 Enable “Undo” functionality
Undo was not enabled in the IB NSTextView attributes.
Enable it.
2026-10-22 16:59:30 -06:00
David Richardson 459a61af58 Tests/Manual: Show a horizontal ruler in the TextEditor document window
Turn on the text view's horizontal ruler in code, because nib2cib does not carry the Interface Builder ruler settings into the cib.

* DocumentWindowController.j: Enable the horizontal ruler on the text view's enclosing scroll view in windowDidLoad, with a comment explaining why it is set up in code.
* Resources/MainMenu.xib, Resources/MainMenu.cib: Remove the Insert Lorem Ipsum key equivalent, which duplicated File > New.
2026-10-22 16:49:29 -06:00
David Richardson 080d9e723e Tests/Manual: Add a text view and Lorem Ipsum insertion to TextEditor
Give the document window a scrolling text view and a toolbar, and add an Edit menu item that inserts placeholder text into the active document.

* LoremIpsum.j: Add a class that supplies the traditional Lorem ipsum passage as static text.
* DocumentWindowController.j: Add a textView outlet and an insertLoremIpsum: action that inserts the placeholder text at the selection through insertText:, so the document's undo manager records it.
* Resources/DocumentWindow.xib, Resources/DocumentWindow.cib: Add a text view in a scroll view that resizes with the window, a toolbar with the default items, and the textView outlet connection.
* Resources/MainMenu.xib, Resources/MainMenu.cib: Add an Insert Lorem Ipsum item to the Edit menu that sends insertLoremIpsum: to First Responder.
2026-10-22 16:33:40 -06:00
David Richardson b58be16e8a Tests/Manual: Make TextEditor a document-based application
Move the main window out of MainMenu.xib into a document window owned by a window controller, so that each document opens in its own window.

* Document.j: Add a CPDocument subclass that creates a DocumentWindowController for each document.
* DocumentWindowController.j: Add a CPWindowController subclass that loads DocumentWindow.cib and sets itself as the window's delegate.
* Resources/DocumentWindow.xib, Resources/DocumentWindow.cib: Add the document window, with DocumentWindowController as File's Owner.
* Resources/MainMenu.xib, Resources/MainMenu.cib: Remove the window, name the application menu Text Editor, rename Preferences to Settings, and remove Quit.
* AppController.j: Remove the window outlet and the code that made the window fill the browser.
* main.j: Import Document.j.
* Info.plist: Declare the Document type with Document as its document class.
2026-10-22 16:07:56 -06:00
David Richardson 71baddb0be Tests/Manual: Add TextEditor application licensed under MIT
Add a cib-based application generated by capp gen as the foundation for a document-based test application and tutorial, MIT licensed.

* The application is a starting point for new applications, so a permissive license lets developers copy its code into their own work without obligations beyond keeping the notice.
* AppController.j, main.j, Jakefile, index.html, index-debug.html: Replace the template header with an MIT header naming the author as copyright holder.
* main.j: Correct the file name in the header.
* Info.plist, Jakefile: Replace the template author placeholder with the author.
* LICENSE: Add the MIT License text.
* Resources/MainMenu.xib, Resources/MainMenu.cib: Add the template main menu.
2026-10-22 14:57:43 -06:00
David Richardson d2a687d158 Merge pull request #3330 from enquora/objj-runtime-modernize
Objective-J: Adopt general runtime fixes from the npm runtime
2026-10-22 14:22:34 -06:00
David Richardson fc960c62e3 Objective-J: Adopt general runtime fixes from the npm runtime
Executable.setCode failed when the compiler produced no code after a compile
error. This adopts that fix and the other general changes from the runtime
published to npm as @objj/runtime, without its Node-specific changes.

- CFDictionary.js: Add toJSObject, which returns the contents as a plain object
- Executable.js: Return early from setCode when no code was produced
- CPLog.js: Return early from CPLogPrint when CPLogDisable is set
- Bootstrap.js: Accept SourceMapIncludeSource in OBJJ_COMPILER_FLAGS
2026-10-22 14:10:19 -06:00
David Richardson 66e4d3fef6 Merge pull request #3329 from enquora/refactor-remove-nativehost-target
Refactor remove nativehost target and C-style preprocessor usage
2026-10-22 12:55:50 -06:00
David Richardson 7501d86853 Add root Info.plist declaring the Cappuccino frameworks package
The source tree had no description of the frameworks package capp-build builds from its root.

* Info.plist: Declare the CPKG package with its runtime, member frameworks in build order, themes and version.
2026-10-22 12:46:55 -06:00
David Richardson be8d536565 Merge branch 'main' into refactor-remove-nativehost-target 2026-10-22 12:44:13 -06:00
David Richardson aff19db572 Merge pull request #3328 from enquora/frameworks-latent-defects-cleanup
Frameworks latent defects cleanup
2026-10-22 12:43:14 -06:00
David Richardson ac709c97bf AppKit: Document CPAlert's return code as the clicked button's tag
CPAlert's documentation described the return code as the button index, which is only its default tag.

* CPAlert: Document the alert return code as the clicked button's tag, which is its index unless changed.
2026-10-22 12:37:02 -06:00
David Richardson 203bf38b21 AppKit: Size vertical scrollers by scroller style in CPScrollView
CPScrollView's frame and content size calculations sized the vertical scroller with scrollerWidthForControlSize:, passing a scroller style, so it always took the legacy width.

* CPScrollView: Use scrollerWidthInStyle: for the vertical scroller in +contentSizeForFrameSize:… and +frameSizeForContentSize:….
* CPScrollViewTest: Add tests for both methods with a scroller whose widths differ by style.
2026-10-22 12:36:32 -06:00
David Richardson 99b47c9a29 Foundation: Fix CPDecimalAdd overflow sign swap
CPDecimalAdd tested for underflow twice when reporting overflow of two negative operands, so the overflow was never swapped to underflow.

* CPDecimal: Swap CPCalculationOverflow to CPCalculationUnderflow for a negative result, matching CPDecimalSubtract.
* CPDecimalTest: Add a test that the overflow of two negative operands is reported as underflow.
2026-10-22 12:35:00 -06:00
David Richardson b06c70eb65 Tests: Add configure-modern for capp-build frameworks
Manual tests could only be provisioned with the legacy framework builds.

* Manual/Jakefile: Add configure-modern, which links every manual test's Frameworks and Frameworks/Debug to the capp-build package in Build/modern/Frameworks; share the provisioning with configure through provisionFrameworks.
2026-10-20 17:48:51 -06:00
David Richardson 483fff9305 Merge branch 'main' into refactor-remove-nativehost-target 2026-10-20 17:35:13 -06:00
David Richardson 230261485a Merge pull request #3327 from cappuccino/fix-unresolved-identifiers
Fix unresolved identifiers
2026-10-20 17:24:02 -06:00
David Richardson a49a5021df AppKit: Fix references to undefined identifiers
Several functions and methods referenced identifiers that were never declared or defined.

* CGColor: Compare color spaces by identity in CGColorEqualToColor, replacing a call to the undefined CGColorSpaceEqualToColorSpace whose test was inverted.
* CGContextCanvas: Declare abs_cos and abs_sin in scale_rotate and rotate_scale.
* CGContextText: Call CGPointMakeZero in CGContextGetTextPosition instead of the removed _CGPointMakeZero.
* CPColor: Compare pattern orientation with CPColorPatternIsVertical instead of BlendKit's PatternIsVertical.
* CPMenu: Declare _CPMenuBarImage with the file's other menu bar variables.
* CPScrollView: Test horizontalScrollerClass and verticalScrollerClass in +frameSizeForContentSize:horizontalScrollerClass:verticalScrollerClass:borderType:controlSize:scrollerStyle: instead of the undefined hFlag and vFlag.
2026-10-20 17:15:04 -06:00
David Richardson 53692b1b71 Foundation: Declare variables used before declaration and remove dead IE code
References to undeclared variables created implicit globals, and an Internet Explorer code path referenced the now unsupported ActiveXObject.

* CPDecimal: Declare adderror in CPDecimalAdd and error1 in _SimpleDivide and _SimpleMultiply.
* CPFunctionOperation: Declare functionOp in +functionOperationWithFunction:.
* CPRunLoop: Declare CPMainRunLoop at file level instead of creating it as an implicit global in +initialize.
* CPWebDAVManager: Remove the ActiveXObject path from XMLDocumentFromString.
2026-10-20 17:13:38 -06:00
David Richardson 850c348cca Tests: Add SmartFoldersDemo index-debug.html and provision test frameworks
- Add missing index-debug.html entry point to SmartFoldersDemo.
- Update Tests/Manual/Jakefile configure and clobber tasks to link Release and Debug framework variants (Objective-J, Foundation, AppKit, BlendKit) across all manual tests.
- Safeguard symlink replacement logic to correctly handle existing links while protecting physical asset directories.
2026-10-20 16:19:39 -06:00
David Richardson cc5807e568 SmartFoldersDemo: Add target classification keys for capp-build
Defines explicit target type identifiers in Info.plist required by the static compiler.
These keys have no effect on the legacy Node build pipeline.
2026-10-20 15:29:24 -06:00
David Richardson 1585123040 Merge pull request #3325 from daboe01/smartfoldersdemo
Improve SmartFoldersDemo manual application to cover much extended range of AppKit API.
Builds are green with both Node and new capp-build compilers.
2026-10-20 14:39:10 -06:00
daboe01 f10eb2e0a5 fixed: CPAlertFirstButtonReturn.. 2026-10-20 18:20:15 +02:00
daboe01 7b2528f7c2 removed: accidentally added zip file 2026-10-19 22:22:33 +02:00
daboe01 1ae6767971 aristo2 fix 2026-10-18 18:12:55 +02:00
daboe01 34b3367468 textcolorfix 2026-10-18 14:54:44 +02:00
daboe01 98ba46872d new: SmartFoldersDemo 2026-10-18 14:32:32 +02:00
David Richardson f1a8b154fc AppKit: Fix CPDOMAvailable read before assignment
CPDOMAvailable was read during load before it was assigned.

* CPCompatibility: Move the CPDOMAvailable assignment ahead of the engine detection, whose AppleWebKit case calls +[CPPlatform isBrowser], which reads it.
* CPCompatibilityTest: Add a test that re-executes CPCompatibility.j with an AppleWebKit user agent and CPDOMAvailable unset, failing on any exception.
2026-10-15 09:26:12 -06:00
David Richardson 572c872c31 Merge branch 'main' into refactor-remove-nativehost-target 2026-10-13 10:06:18 -06:00
David Richardson 8cff67cfed Merge pull request #3323 from cappuccino/note-cpkeybindings-platform-TODO
AppKit: Annotate macOS-only standard key bindings as TODO
2026-10-13 10:04:51 -06:00
David Richardson 2aee03c7fb AppKit: Annotate macOS-only standard key bindings
Record that the standard key binding table is not platform-aware.

* CPKeyBinding: Add TODO noting that CPStandardKeyBindings applies macOS bindings on every platform.

The modifier-key conflicts on Windows and Linux are now documented at the source.
2026-10-13 10:01:47 -06:00
David Richardson 15268c45c4 AppKit: Remove remaining #if DEBUG conditionals
Eliminate conditional compilation for debug builds across AppKit.

* CPAnimationContext: Remove debug logging traces.
* _CPCibCustomObject, _CPCibCustomView, _CPCibWindowTemplate: Convert unknown-class log messages to unconditional warnings.
* CPView: Convert duplicate-subview assertion to an unconditional check.
* _CPObject+Theme: Convert array-as-state assertions to unconditional checks and remove obsolete performance TODOs.

AppKit is now free of C-style preprocessor directives.
2026-10-09 16:47:46 -06:00
David Richardson bf19b09ad0 AppKit: add missed CPDOMDisplayServer.j promotion, drop its header
- the promotion commit captured the consumer imports and the test
  update but missed the new source file itself and the deletion of
  the force-included header it replaces
- without the .j, the display-server functions are absent from the
  compiled frameworks; with the .h still present, the legacy build
  force-includes the old macro definitions alongside the new
  functions
- follow-up to the display-server promotion commit
2026-10-06 19:40:40 -06:00
David Richardson 7f38fbe7c7 Tests: promote CPDOMDisplayServer.h to a real source file
- the 11 display-server primitives become plain functions in
  Platform/DOM/CPDOMDisplayServer.j; bodies verbatim from the macro
  definitions; the header was force-included into every AppKit
  compilation by the legacy build and invisible to capp-build
- CPView.j, CPImageView.j, _CPDisplayServer.j import the new file;
  this was the last header in either framework
- CPDOMDisplayServerTest: the raw #include replaced by the
  framework-qualified import
2026-10-06 18:50:09 -06:00