mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-25 01:28:54 +00:00
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.
7.0 KiB
7.0 KiB
TextEditor Work List
TextEditor is a document-based test application and a tutorial. When the app uses AppKit, it shows gaps in the framework. This list records those gaps and the planned additions to the app.
AppKit gaps
Windows and documents
- The Window menu does not list document windows. It has no items to show or change the active window. AppKit has no equivalent of the Cocoa windows menu support in
NSApplication:windowsMenu,addWindowsItem:title:filename:,changeWindowsItem:title:filename:,removeWindowsItem:andarrangeInFront:. nib2cib marks the menu as_CPWindowsMenu(Tools/nib2cib/NSMenu.j:31), but nothing in AppKit reads that name. - AppKit ignores
CPBundleDisplayName. Cocoa usesCFBundleDisplayNamefor the name that the user sees, andCFBundleNameas the short name. AppKit reads onlyCPBundleName: for the About panel title (CPApplication.j:389) and for the browser tab title (_CPMenuBarWindow.j:106). Both should useCPBundleDisplayName, withCPBundleNameas the fallback. - The Show Toolbar menu item does not show the toolbar state.
-[CPWindow toggleToolbarShown:]works (CPWindow.j:2758), butCPWindowhas novalidateMenuItem:. In Cocoa,NSWindowvalidates this item: it changes the title between "Show Toolbar" and "Hide Toolbar", and disables the item when the window has no toolbar.CPMenualready asks the target throughvalidateMenuItem:(CPMenu.j:699), so the fix is avalidateMenuItem:inCPWindowthat handlestoggleToolbarShown:and returnsYESfor every other action. - The window ignores the delegate's size for its own frame. In
_setFrame:display:animate:constrainWidth:constrainHeight:,sizerefers to_frame.size, which already holds the proposed size. The result ofwindowWillResize:toSize:replaces the local variable only, and goes to the window view (CPWindow.j:799to811). So when the delegate returns a different size, the window view takes that size, but_framekeeps the proposed size. The platform window chooses the window for a mouse event by testing_frame(containsPoint:and_isValidMousePoint:,CPWindow.j:3832to3845). So after the user shrinks a document window to its minimum, clicks on most of the visible window miss it, and the window can no longer be moved or resized. Resizing the browser window does not repair the frame. The fix: the size returned by the delegate must become_frame.size. - The "save changes" alert is modal for the whole app.
CPDocumentshows it withrunModal(CPDocument.j:903). Cocoa attaches it as a sheet to the document window, so that only that document is blocked. - Save cannot work without a server. With no file URL, Save uses
CPSavePanel, which falls back towindow.prompt(CPSavePanel.j:79).CPDocumentthen sends an HTTP POST. A storage facade is needed, with local (IndexedDB) and remote (HTTP) implementations.
Text view and ruler
- The ruler markers do not update at the right times.
CPTextViewcallsupdateRuleronly when it becomes first responder (CPTextView.j:547) and when its typing attributes change (:1819). It must also update the ruler when the selection changes and when the ruler is first shown. - Indent markers at location 0 are half hidden.
_positionMarker:centres each marker on its location, so a marker at 0 starts at x = -6 (CPRulerView.j). - The ruler scale is offset from the text. The text starts at the text container inset (2 points). The ruler has no origin offset for it.
- Text runs past the right edge. When the text view resizes, the text container takes the full width of the text view and ignores the inset (
CPTextContainer.j:199). - There is no right indent.
CPParagraphStylestorestailIndent, andCPTextViewhandles a movedCPTailIndentmarker (CPTextView.j:2630). ButupdateRulernever creates that marker, and the typesetter ignorestailIndent. - nib2cib ignores the ruler settings. The "Uses Ruler" setting in Interface Builder does not reach the cib.
CPTextViewhas no ruler control API.usesRuler,setUsesRuler:,setRulerVisible:andtoggleRuler:do not exist.isRulerVisiblealways returnsNO(CPTextView.j:2088).CPRulerMarkerignoresmarkerLocation.initWithRulerView:markerLocation:imageValue:representedObject:usesimageValueas the location.
Undo and redo
- Redo is unreliable or does not work. Not yet investigated.
- Undo stays enabled when
allowsUndoisNO.-[CPTextView undo:]then does nothing (CPTextView.j:679). The text view must disable the menu item in that case.
Clipboard
- Paste and Cut from the Edit menu do nothing.
-[CPTextView paste:](CPTextView.j:521) andcut:(:1754) return unless the current event isCPAppKitDefined. Only the browser's native clipboard events, from the keyboard, create that event. - Copy from the Edit menu cannot reach the system clipboard. It fills only the internal
CPPasteboard. - Fix: when a menu item calls these methods, use the asynchronous Clipboard API (
navigator.clipboard). Read RTF first, then plain text. Write plain text, and RTF where the browser allows it. Keep the keyboard path unchanged.
Toolbar
- The Fonts and Print standard items are not implemented.
_standardItemWithItemIdentifier:returnsnilfor both (_CPToolbarItem.j:641). AppKit needs_CPToolbarShowFontsItem(sendsorderFrontFontPanel:) and_CPToolbarPrintItem(sendsprintDocument:). nib2cib needs matching classes.
Text features not yet supported
- Images in text. AppKit has no general
CPTextAttachmentclass, only the table attachment_CPTableTextAttachment. The RTF parser and producer do not handle\pict. - Lists. There is no
CPTextList, andCPParagraphStylehas notextLists.
Platform
- Key equivalents on platforms other than macOS. Filed as an issue.
Planned additions to the app
- Fonts through
CPFontManagerandCPFontPanel. - RTF reading and writing.
- Images and lists in text.
- A storage facade, with saving and opening in IndexedDB and through HTTP.
- An asynchronous fetch test: fetch the text of a page and show it for editing. The page must allow cross-origin requests.
- An inspector pane with
CPSplitViewControllerandCPViewController, with a View menu item that sendstoggleInspector:. - Documents in separate browser windows with
CPPlatformWindow. - A Settings window. The first setting is the minimum size of document windows, now the constants
DocumentWindowMinimumWidthandDocumentWindowMinimumHeightinDocumentWindowController.j.
Tests done
- One window for each document, each loaded from its own cib.
- Insert Lorem Ipsum through the responder chain.
- Undo over several levels, separate for each document.
- Text colour through
CPColorPanel. - Paragraph indents through the ruler markers.
- The "save changes" alert when a document closes.
- A minimum size for document windows, through the window delegate.
- Builds with both the legacy toolchain and capp-build.