Commit Graph
323 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 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 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 bfbc522721 AppKit: DOM platform window category ungated (Increment B)
- CPWindow.j: the PLATFORM(BROWSER) import gate removed; the
  CPPlatformWindow (DOM) category now loads under both targets
- category _init restructured: DOM setup (window capture, pasteboard,
  registration) behind CPDOMAvailable; CommonJS branch initializes the
  same state as the base class
- SCROLLWHEEL_LINE_PIXELS converted from #define to a file-scope
  variable; its only uses are within this file
- load-time audit: file-scope statements are DOM-free; the single
  typeof-guarded document reference takes its no-DOM branch under Node
- work-in-progress towards complete removal of CPP directives
2026-10-02 11:11:55 -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 1a9a42ff54 Replace #pragma mark with // MARK:
Replace objc directive with native Javascript version // MARK: to facilitate elimination of preproccsing pass.
2026-07-21 15:15:53 -06:00
daboe01 3b1c1c0886 fixed: tab could not be entered using the keyboard 2026-05-29 22:08:00 +02:00
daboe01 802c644d94 Fixed: CPWindow setContentView: overlapping the toolbar 2026-02-22 14:54:46 +01:00
Martin Carlberg a1e178d0d7 Merge remote-tracking branch 'origin/narwhal' 2024-05-24 12:18:28 +02:00
daboe01 f642330306 new: support for releasedWhenClosed in CPWindow 2023-12-23 19:08:38 +01:00
Martin Carlberg edfba15d6f Merge branch 'master' into node 2022-03-21 15:55:08 +01:00
daboe01 1ef49ef290 formatting 2022-01-23 13:42:12 +01:00
daboe01 76d52e07d4 fixed: freeze when clicking during sheet animation
previously, the app froze when clicking somewhere during sheet open/close animations.
these adversarial clicks are simply ignored by this PR
2022-01-23 13:39:33 +01:00
Alfred Wärnsäter 2ecea40fdc lots of Node fixes 2021-08-19 10:56:13 +02:00
Didier Korthoudt 78b3887e4a New: CSS shadow, new theme parameters and Aristo3 CSS theme ready for CPWindow (#2927) 2020-10-09 14:29:10 +02:00
Didier Korthoudt e7d5afe90e New: Added dynamic attributes set for CSS based themes (#2701) 2020-04-06 13:10:34 +02:00
Martin Carlberg 7dc77ed609 Fixed: Make sure we handle undefined when testing for nil values (#2862) 2020-01-31 13:43:58 +01:00
Martin Carlberg 50519776e0 Fixed: Update Tracking areas only once when doing setFrame: (#2879)
This speed improvement is very notable when resizing a browser window of altering the size of split views.
The fix uses a variable on the window to control when to update the tracking areas.
If the view is not connected to a window the tracking areas will not be updated as they will
be when added to a window.
2020-01-06 12:32:35 +01:00
Alexandre Wilhelm 0db0d744da Merge pull request #2784 from daboe01/fixed-wrong-return-type-in-isMovable
fixed: wrong return type in isMovable
2019-02-06 16:57:21 -08:00
daboe01 ae50fde4e1 fixed: wrong return type of isMiniaturized 2018-10-14 16:49:49 +02:00
daboe01 401461f1f0 fixed: wrong return type in isMovable 2018-10-14 13:36:53 +02:00
daboe01 a178d43b01 Fixed: return key was not swallowed by textview but triggered the default button. (#2598) 2018-08-20 12:52:53 +02:00
daboe01 ef2152beea FIXED: click to key window in the background did not bring it forward (take 2) (#2705) 2018-08-20 12:48:58 +02:00
daboe01 e6475c1a9e Fixed: setMinSize: had no effect in platform windows (#2609) 2018-08-20 12:47:29 +02:00
daboe01 e7eff3e585 Fixed: attached sheets were not put to front after calls to makeKeyAndOrderFront: in code (#2606) 2018-08-20 11:34:21 +02:00
daboe01 ad756a5b86 fixed: some mouse events were not propagated when sheets are open (#2603)
* fixed: mouse dragged was not propagated to parent window when sheet was opened

* better detection for attached sheet
2018-05-29 07:17:41 +02:00
cacaodev 93b12eb14f Revert "FIXED: click to key window in the background did not bring it forward" (#2702)
Fixes #2700
2018-05-06 14:07:25 +02:00
cacaodev 0404ac0395 Merge pull request #2602 from daboe01/issue2545
FIXED: click to key window in the background did not bring it forward
2018-04-12 09:11:57 +02:00
daboe01 f961625f03 fixed: some events were not propagated to the bridge window 2018-04-11 18:30:47 +02:00
daniel 15c3a6eae4 Formatting: add missing semi-colons to CPWindow.j 2018-04-04 09:38:43 -07:00
daboe01 df462774aa refactured front detection logic to own method _isFrontmostWindow
fixes travis error
2018-03-20 14:25:42 +01:00
daboe01 488541f26e fixed: click to key window in the background did not bring it forward 2018-03-18 21:45:25 +01:00
cacaodev 35808e7bde FIXED: uninitialized ivar 2017-06-02 11:15:23 +02:00
cacaodev cee032bbc9 FIXED: send live resize notifications when the window animates
Like in cocoa, these notifications are not sent when a sheet is
displayed.
2017-06-02 09:42:59 +02:00
cacaodev 0f767d9dfc CPWindow: add CPWindowWillStartLiveResizeNotification and CPWindowDidEndLiveResizeNotification
Also fixed CPView -(BOOL)inLiveResize
If a view is added during a live resize, it will not receive a
willStart notif.
If a view is removed during a live resize it will not receive a Didend
notif.
2017-05-20 13:52:50 +02:00
Didier Korthoudt e0fab808b9 fix-overlappingTA-could-be-empty 2016-10-08 17:33:21 +02:00
Alexander Ljungberg 47196cbc55 Typos. 2016-08-19 14:57:57 +01:00
daboe01 5c1cdea3c6 Removed: Obsoleted Nativehost stuff 2016-07-08 21:34:14 +02:00
Didier Korthoudt 2877178b34 Formatting: following Aparajita's recommandations 2016-01-21 20:46:37 +01:00
Didier Korthoudt 0f30d7744d FIXED: CPTrackingArea incorrect handling of view hierarchy updates while processing events 2016-01-19 07:07:45 +01:00
Didier Korthoudt 2ab50c6b61 code style fixed 2015-12-20 09:29:54 +01:00
Didier Korthoudt d7426f6d35 Several fixes 2015-12-19 21:56:27 +01:00
Didier Korthoudt 8f15266f0a delayed cursorUpdates modification 2015-12-17 21:48:27 +01:00
Didier Korthoudt 2a7c50d356 events-during-drag-fix 2015-12-15 15:09:19 +01:00
Didier Korthoudt 7089abcef2 missing-fix 2015-12-08 22:41:18 +01:00
Didier Korthoudt 08d4e19851 various-fixes
Following @aparajita indications
2015-12-07 14:58:42 +01:00
Didier Korthoudt f14062c721 Style-fixes 2015-12-03 20:44:34 +01:00
Didier Korthoudt 634a8b4532 cocoadev-fix 2015-12-01 21:16:02 +01:00
Didier Korthoudt 2f983fc305 optimization 2015-11-29 15:37:33 +01:00