People: Group sources by application part

Previously, source files sat flat in a single directory, and one file
combined the source list controller with its cell, icon, and badge views.

Sources are now organized by application area, nested where ownership
is hierarchical: ApplicationLifecycle (including the settings window),
Library (with its model and the Navigation, ContentViewer, and
PersonInspector panes), and PrimaryInterface (for the main window).

The source list views move into separate files alongside the
controller, toolchain files remain at the root, and directory names
omit spaces due to legacy toolchain restrictions. Application behavior
is unchanged.
This commit is contained in:
David Richardson committed 2026-11-24 12:21:04 -06:00
1 parent 7358e939bd
commit 2b5c44b973
15 files changed
+385 -355

No files matched your search

@@ -7,13 +7,17 @@
* main menu and the main window controller; everything else lives in the
* view controllers.
*
* AppController
* └─ MainWindowController (CPWindowController, bridge window, toolbar)
* ├─ SourceListViewController (view-based CPOutlineView, badges, DnD target)
* ├─ PeopleViewController (bound CPTableView, CPArrayController, DnD source)
* │ └─ PersonDetailViewController (selection bindings)
* ├─ SmartFolderEditorController (sheet, CPPredicateEditor)
* └─ NameSheetController (sheet)
* AppController (ApplicationLifecycle/)
* ├─ SettingsWindowController (ApplicationLifecycle/Settings/)
* └─ MainWindowController (PrimaryInterface/MainWindow/, bridge window, toolbar)
* ├─ SourceListViewController (Library/Navigation/, view-based CPOutlineView, DnD target)
* │ └─ SourceListCellView (Library/Navigation/SourceItemCell/, icon and badge views)
* ├─ PeopleViewController (Library/ContentViewer/, bound CPTableView, DnD source)
* │ └─ PersonDetailViewController (Library/PersonInspector/, selection bindings)
* ├─ SmartFolderEditorController (Library/Navigation/SmartFolderEditor/, sheet, CPPredicateEditor)
* └─ NameSheetController (Library/Navigation/GroupNameSheet/, sheet)
*
* The model of the library (Person, Library) is at the top of Library/.
*
* Data (people, groups, smart folders) is persisted in CPUserDefaults.
* Use File ▸ Reset Application… to return to the deterministic sample data and the
@@ -28,9 +32,9 @@
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "Library.j"
@import "MainWindowController.j"
@import "SettingsWindowController.j"
@import "../Library/Library.j"
@import "../PrimaryInterface/MainWindow/MainWindowController.j"
@import "Settings/SettingsWindowController.j"
@implementation AppController : CPObject
{
@@ -15,8 +15,8 @@
*/
@import <AppKit/AppKit.j>
@import "Library.j"
@import "PersonDetailViewController.j"
@import "../Library.j"
@import "../PersonInspector/PersonDetailViewController.j"
@implementation PeopleViewController : CPViewController
{
File renamed without changes.
@@ -16,7 +16,7 @@
*/
@import <AppKit/AppKit.j>
@import "Library.j"
@import "../../Library.j"
var EditorWidth = 680.0,
EditorChromeHeight = 200.0,
@@ -0,0 +1,133 @@
/*
* SourceBadgeView.j
* People
*
* Rounded count badge of a source list item.
*/
@import <AppKit/AppKit.j>
var BadgeFont = nil,
BadgeHPadding = 7.0;
/*
The height and the minimum width of a badge; the cell view lays the badge out with them.
*/
SourceBadgeHeight = 16.0;
SourceBadgeMinWidth = 24.0;
@implementation SourceBadgeView : CPView
{
CPTextField _badgeLabel;
int _badgeCount;
BOOL _isHighlighted;
}
+ (void)initialize
{
if (self !== [SourceBadgeView class])
return;
BadgeFont = [CPFont boldSystemFontOfSize:11.0];
}
- (id)initWithFrame:(CGRect)aFrame
{
if (self = [super initWithFrame:aFrame])
{
// A plain, inset-free label that is positioned by hand: the text field's
// own vertical centering includes theme insets and ends up a pixel or two low.
_badgeLabel = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[_badgeLabel setFont:BadgeFont];
[_badgeLabel setAlignment:CPCenterTextAlignment];
[_badgeLabel setEditable:NO];
[_badgeLabel setSelectable:NO];
[_badgeLabel setBezeled:NO];
[_badgeLabel setBordered:NO];
[_badgeLabel setDrawsBackground:NO];
[_badgeLabel setValue:CGInsetMakeZero() forThemeAttribute:@"content-inset"];
[self addSubview:_badgeLabel];
[self _updateColors];
}
return self;
}
+ (CPString)stringForCount:(int)aCount
{
// Keep badges compact: 1234 -> "1.2k", 12345 -> "12k"
if (aCount >= 10000)
return Math.round(aCount / 1000) + "k";
if (aCount >= 1000)
return (Math.round(aCount / 100) / 10) + "k";
return String(aCount);
}
- (void)setCount:(int)aCount
{
_badgeCount = aCount;
var hidden = aCount === CPNotFound || aCount === nil || aCount === undefined;
[self setHidden:hidden];
if (!hidden)
{
[_badgeLabel setStringValue:[SourceBadgeView stringForCount:aCount]];
[self _layoutLabel];
}
[self setNeedsDisplay:YES];
}
- (void)setSelected:(BOOL)aFlag
{
if (_isHighlighted === aFlag)
return;
_isHighlighted = aFlag;
[self _updateColors];
[self setNeedsDisplay:YES];
}
- (float)preferredWidth
{
var size = [[_badgeLabel stringValue] sizeWithFont:BadgeFont];
return MAX(SourceBadgeMinWidth, Math.ceil(size.width) + 2 * BadgeHPadding);
}
- (void)setFrameSize:(CGSize)aSize
{
[super setFrameSize:aSize];
[self _layoutLabel];
}
- (void)_layoutLabel
{
var bounds = [self bounds],
textHeight = Math.ceil([[_badgeLabel stringValue] sizeWithFont:BadgeFont].height);
[_badgeLabel setFrame:CGRectMake(0, Math.round((CGRectGetHeight(bounds) - textHeight) / 2), CGRectGetWidth(bounds), textHeight)];
}
- (void)_updateColors
{
[_badgeLabel setTextColor:_isHighlighted ? [CPColor controlAccentColor] : [CPColor alternateSelectedControlTextColor]];
}
- (void)drawRect:(CGRect)aRect
{
var bounds = [self bounds],
radius = CGRectGetHeight(bounds) / 2,
path = [CPBezierPath bezierPath];
[path appendBezierPathWithRoundedRect:bounds xRadius:radius yRadius:radius];
[(_isHighlighted ? [CPColor alternateSelectedControlTextColor] : [CPColor systemGrayColor]) set];
[path fill];
}
@end
@@ -0,0 +1,82 @@
/*
* SourceIconView.j
* People
*
* Small vector icon of a source list item, drawn with CPBezierPath.
*/
@import <AppKit/AppKit.j>
@implementation SourceIconView : CPView
{
CPString _iconKind;
BOOL _isHighlighted;
}
- (void)setKind:(CPString)aKind
{
if (_iconKind === aKind)
return;
_iconKind = aKind;
[self setNeedsDisplay:YES];
}
- (void)setSelected:(BOOL)aFlag
{
if (_isHighlighted === aFlag)
return;
_isHighlighted = aFlag;
[self setNeedsDisplay:YES];
}
- (void)drawRect:(CGRect)aRect
{
var bounds = [self bounds],
w = CGRectGetWidth(bounds),
h = CGRectGetHeight(bounds);
if (_iconKind === @"all")
{
var color = _isHighlighted ? [CPColor alternateSelectedControlTextColor] : [CPColor controlAccentColor],
head = [CPBezierPath bezierPath],
body = [CPBezierPath bezierPath];
[color set];
[head appendBezierPathWithOvalInRect:CGRectMake(w / 2 - 3.5, 1.5, 7, 7)];
[head fill];
[body appendBezierPathWithRoundedRect:CGRectMake(w / 2 - 6.5, 9.5, 13, 6) xRadius:3 yRadius:3];
[body fill];
return;
}
// Folder shape for groups and smart folders.
var fill = _isHighlighted ? [CPColor alternateSelectedControlTextColor] :
(_iconKind === @"smart" ? [CPColor systemPurpleColor] : [CPColor controlAccentColor]),
folder = [CPBezierPath bezierPath];
[folder moveToPoint:CGPointMake(1, 3)];
[folder lineToPoint:CGPointMake(6, 3)];
[folder lineToPoint:CGPointMake(8, 5)];
[folder lineToPoint:CGPointMake(w - 1, 5)];
[folder lineToPoint:CGPointMake(w - 1, h - 2)];
[folder lineToPoint:CGPointMake(1, h - 2)];
[folder closePath];
[fill set];
[folder fill];
if (_iconKind === @"smart")
{
// Gear-ish dot to distinguish smart folders.
var mark = [CPBezierPath bezierPath],
markColor = _isHighlighted ? [CPColor systemPurpleColor] : [CPColor alternateSelectedControlTextColor];
[markColor set];
[mark appendBezierPathWithOvalInRect:CGRectMake(w / 2 - 2.5, 7.5, 5, 5)];
[mark fill];
}
}
@end
@@ -0,0 +1,126 @@
/*
* SourceListCellView.j
* People
*
* View-based outline cell of the source list: icon, title and count badge.
*/
@import <AppKit/AppKit.j>
@import "../../Library.j"
@import "SourceIconView.j"
@import "SourceBadgeView.j"
/*
The identifier of the cell view; the source list asks the outline view for views with it.
*/
SourceCellIdentifier = @"SourceCell";
@implementation SourceListCellView : CPTableCellView
{
SourceIconView _iconView;
CPTextField _titleField;
SourceBadgeView _badgeView;
BOOL _isHeader;
}
- (id)initWithFrame:(CGRect)aFrame
{
if (self = [super initWithFrame:aFrame])
{
var height = CGRectGetHeight(aFrame);
_iconView = [[SourceIconView alloc] initWithFrame:CGRectMake(2, (height - 16) / 2, 18, 16)];
[_iconView setAutoresizingMask:CPViewMinYMargin | CPViewMaxYMargin];
[self addSubview:_iconView];
_titleField = [[CPTextField alloc] initWithFrame:CGRectMake(24, 0, CGRectGetWidth(aFrame) - 24, height)];
[_titleField setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[_titleField setVerticalAlignment:CPCenterVerticalTextAlignment];
[_titleField setLineBreakMode:CPLineBreakByTruncatingTail];
[_titleField setEditable:NO];
[_titleField setBezeled:NO];
[_titleField setDrawsBackground:NO];
[self addSubview:_titleField];
_badgeView = [[SourceBadgeView alloc] initWithFrame:CGRectMake(CGRectGetWidth(aFrame) - 30, (height - SourceBadgeHeight) / 2, SourceBadgeMinWidth, SourceBadgeHeight)];
[_badgeView setAutoresizingMask:CPViewMinXMargin | CPViewMinYMargin | CPViewMaxYMargin];
[self addSubview:_badgeView];
[self setIdentifier:SourceCellIdentifier];
}
return self;
}
- (void)configureWithItem:(SourceItem)anItem count:(int)aCount
{
_isHeader = [anItem isSection];
var bounds = [self bounds],
width = CGRectGetWidth(bounds),
height = CGRectGetHeight(bounds);
[_titleField setStringValue:[anItem name]];
if (_isHeader)
{
[_iconView setHidden:YES];
[_badgeView setHidden:YES];
[_titleField setFont:[CPFont boldSystemFontOfSize:11.0]];
[_titleField setFrame:CGRectMake(0, 0, width, height)];
}
else
{
var kind = [anItem isKindOfClass:[SmartFolder class]] ? @"smart" :
[anItem isKindOfClass:[LibraryGroup class]] ? @"group" : @"all";
[_iconView setHidden:NO];
[_iconView setKind:kind];
[_titleField setFont:[CPFont systemFontOfSize:12.0]];
[_badgeView setCount:aCount];
var badgeWidth = [_badgeView isHidden] ? 0 : [_badgeView preferredWidth];
[_badgeView setFrame:CGRectMake(width - badgeWidth - 8, Math.round((height - SourceBadgeHeight) / 2), badgeWidth, SourceBadgeHeight)];
[_titleField setFrame:CGRectMake(24, 0, MAX(0, width - 24 - badgeWidth - 14), height)];
}
[self _updateSelectionAppearance];
}
- (void)setThemeState:(ThemeState)aState
{
[super setThemeState:aState];
[self _updateSelectionAppearance];
}
- (void)unsetThemeState:(ThemeState)aState
{
[super unsetThemeState:aState];
[self _updateSelectionAppearance];
}
- (void)_updateSelectionAppearance
{
/*
CPTableView marks data views of selected rows with CPThemeStateSelectedDataView and,
only while the table is focused (first responder in the key window), additionally
with CPThemeStateFirstResponder. The unfocused selection colour is a light gray, so
the selected text colour is only legible in the focused case. A title without a
colour of its own takes the theme's text colour, which follows the appearance.
*/
var selected = [self hasThemeState:CPThemeStateSelectedDataView],
emphasized = selected && [self hasThemeState:CPThemeStateFirstResponder];
[_iconView setSelected:emphasized];
[_badgeView setSelected:emphasized];
if (_isHeader)
[_titleField setTextColor:[CPColor secondaryLabelColor]];
else
[_titleField setTextColor:emphasized ? [CPColor alternateSelectedControlTextColor] : nil];
}
@end
@@ -16,10 +16,11 @@
*/
@import <AppKit/AppKit.j>
@import "Library.j"
var SourceCellIdentifier = @"SourceCell",
SourceRowHeight = 26.0;
@import "../Library.j"
@import "SourceItemCell/SourceListCellView.j"
var SourceRowHeight = 26.0;
// Tags of the action pop-up items.
SourceActionNewGroup = 1;
@@ -29,329 +30,6 @@ SourceActionRename = 4;
SourceActionDelete = 5;
// --------------------------------------------------------------------------------
// SourceIconView – small vector icon drawn with CPBezierPath
// --------------------------------------------------------------------------------
@implementation SourceIconView : CPView
{
CPString _iconKind;
BOOL _isHighlighted;
}
- (void)setKind:(CPString)aKind
{
if (_iconKind === aKind)
return;
_iconKind = aKind;
[self setNeedsDisplay:YES];
}
- (void)setSelected:(BOOL)aFlag
{
if (_isHighlighted === aFlag)
return;
_isHighlighted = aFlag;
[self setNeedsDisplay:YES];
}
- (void)drawRect:(CGRect)aRect
{
var bounds = [self bounds],
w = CGRectGetWidth(bounds),
h = CGRectGetHeight(bounds);
if (_iconKind === @"all")
{
var color = _isHighlighted ? [CPColor alternateSelectedControlTextColor] : [CPColor controlAccentColor],
head = [CPBezierPath bezierPath],
body = [CPBezierPath bezierPath];
[color set];
[head appendBezierPathWithOvalInRect:CGRectMake(w / 2 - 3.5, 1.5, 7, 7)];
[head fill];
[body appendBezierPathWithRoundedRect:CGRectMake(w / 2 - 6.5, 9.5, 13, 6) xRadius:3 yRadius:3];
[body fill];
return;
}
// Folder shape for groups and smart folders.
var fill = _isHighlighted ? [CPColor alternateSelectedControlTextColor] :
(_iconKind === @"smart" ? [CPColor systemPurpleColor] : [CPColor controlAccentColor]),
folder = [CPBezierPath bezierPath];
[folder moveToPoint:CGPointMake(1, 3)];
[folder lineToPoint:CGPointMake(6, 3)];
[folder lineToPoint:CGPointMake(8, 5)];
[folder lineToPoint:CGPointMake(w - 1, 5)];
[folder lineToPoint:CGPointMake(w - 1, h - 2)];
[folder lineToPoint:CGPointMake(1, h - 2)];
[folder closePath];
[fill set];
[folder fill];
if (_iconKind === @"smart")
{
// Gear-ish dot to distinguish smart folders.
var mark = [CPBezierPath bezierPath],
markColor = _isHighlighted ? [CPColor systemPurpleColor] : [CPColor alternateSelectedControlTextColor];
[markColor set];
[mark appendBezierPathWithOvalInRect:CGRectMake(w / 2 - 2.5, 7.5, 5, 5)];
[mark fill];
}
}
@end
// --------------------------------------------------------------------------------
// SourceBadgeView – rounded count badge
// --------------------------------------------------------------------------------
var BadgeFont = nil,
BadgeHeight = 16.0,
BadgeMinWidth = 24.0,
BadgeHPadding = 7.0;
@implementation SourceBadgeView : CPView
{
CPTextField _badgeLabel;
int _badgeCount;
BOOL _isHighlighted;
}
+ (void)initialize
{
if (self !== [SourceBadgeView class])
return;
BadgeFont = [CPFont boldSystemFontOfSize:11.0];
}
- (id)initWithFrame:(CGRect)aFrame
{
if (self = [super initWithFrame:aFrame])
{
// A plain, inset-free label that is positioned by hand: the text field's
// own vertical centering includes theme insets and ends up a pixel or two low.
_badgeLabel = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[_badgeLabel setFont:BadgeFont];
[_badgeLabel setAlignment:CPCenterTextAlignment];
[_badgeLabel setEditable:NO];
[_badgeLabel setSelectable:NO];
[_badgeLabel setBezeled:NO];
[_badgeLabel setBordered:NO];
[_badgeLabel setDrawsBackground:NO];
[_badgeLabel setValue:CGInsetMakeZero() forThemeAttribute:@"content-inset"];
[self addSubview:_badgeLabel];
[self _updateColors];
}
return self;
}
+ (CPString)stringForCount:(int)aCount
{
// Keep badges compact: 1234 -> "1.2k", 12345 -> "12k"
if (aCount >= 10000)
return Math.round(aCount / 1000) + "k";
if (aCount >= 1000)
return (Math.round(aCount / 100) / 10) + "k";
return String(aCount);
}
- (void)setCount:(int)aCount
{
_badgeCount = aCount;
var hidden = aCount === CPNotFound || aCount === nil || aCount === undefined;
[self setHidden:hidden];
if (!hidden)
{
[_badgeLabel setStringValue:[SourceBadgeView stringForCount:aCount]];
[self _layoutLabel];
}
[self setNeedsDisplay:YES];
}
- (void)setSelected:(BOOL)aFlag
{
if (_isHighlighted === aFlag)
return;
_isHighlighted = aFlag;
[self _updateColors];
[self setNeedsDisplay:YES];
}
- (float)preferredWidth
{
var size = [[_badgeLabel stringValue] sizeWithFont:BadgeFont];
return MAX(BadgeMinWidth, Math.ceil(size.width) + 2 * BadgeHPadding);
}
- (void)setFrameSize:(CGSize)aSize
{
[super setFrameSize:aSize];
[self _layoutLabel];
}
- (void)_layoutLabel
{
var bounds = [self bounds],
textHeight = Math.ceil([[_badgeLabel stringValue] sizeWithFont:BadgeFont].height);
[_badgeLabel setFrame:CGRectMake(0, Math.round((CGRectGetHeight(bounds) - textHeight) / 2), CGRectGetWidth(bounds), textHeight)];
}
- (void)_updateColors
{
[_badgeLabel setTextColor:_isHighlighted ? [CPColor controlAccentColor] : [CPColor alternateSelectedControlTextColor]];
}
- (void)drawRect:(CGRect)aRect
{
var bounds = [self bounds],
radius = CGRectGetHeight(bounds) / 2,
path = [CPBezierPath bezierPath];
[path appendBezierPathWithRoundedRect:bounds xRadius:radius yRadius:radius];
[(_isHighlighted ? [CPColor alternateSelectedControlTextColor] : [CPColor systemGrayColor]) set];
[path fill];
}
@end
// --------------------------------------------------------------------------------
// SourceListCellView – view-based outline cell
// --------------------------------------------------------------------------------
@implementation SourceListCellView : CPTableCellView
{
SourceIconView _iconView;
CPTextField _titleField;
SourceBadgeView _badgeView;
BOOL _isHeader;
}
- (id)initWithFrame:(CGRect)aFrame
{
if (self = [super initWithFrame:aFrame])
{
var height = CGRectGetHeight(aFrame);
_iconView = [[SourceIconView alloc] initWithFrame:CGRectMake(2, (height - 16) / 2, 18, 16)];
[_iconView setAutoresizingMask:CPViewMinYMargin | CPViewMaxYMargin];
[self addSubview:_iconView];
_titleField = [[CPTextField alloc] initWithFrame:CGRectMake(24, 0, CGRectGetWidth(aFrame) - 24, height)];
[_titleField setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[_titleField setVerticalAlignment:CPCenterVerticalTextAlignment];
[_titleField setLineBreakMode:CPLineBreakByTruncatingTail];
[_titleField setEditable:NO];
[_titleField setBezeled:NO];
[_titleField setDrawsBackground:NO];
[self addSubview:_titleField];
_badgeView = [[SourceBadgeView alloc] initWithFrame:CGRectMake(CGRectGetWidth(aFrame) - 30, (height - BadgeHeight) / 2, BadgeMinWidth, BadgeHeight)];
[_badgeView setAutoresizingMask:CPViewMinXMargin | CPViewMinYMargin | CPViewMaxYMargin];
[self addSubview:_badgeView];
[self setIdentifier:SourceCellIdentifier];
}
return self;
}
- (void)configureWithItem:(SourceItem)anItem count:(int)aCount
{
_isHeader = [anItem isSection];
var bounds = [self bounds],
width = CGRectGetWidth(bounds),
height = CGRectGetHeight(bounds);
[_titleField setStringValue:[anItem name]];
if (_isHeader)
{
[_iconView setHidden:YES];
[_badgeView setHidden:YES];
[_titleField setFont:[CPFont boldSystemFontOfSize:11.0]];
[_titleField setFrame:CGRectMake(0, 0, width, height)];
}
else
{
var kind = [anItem isKindOfClass:[SmartFolder class]] ? @"smart" :
[anItem isKindOfClass:[LibraryGroup class]] ? @"group" : @"all";
[_iconView setHidden:NO];
[_iconView setKind:kind];
[_titleField setFont:[CPFont systemFontOfSize:12.0]];
[_badgeView setCount:aCount];
var badgeWidth = [_badgeView isHidden] ? 0 : [_badgeView preferredWidth];
[_badgeView setFrame:CGRectMake(width - badgeWidth - 8, Math.round((height - BadgeHeight) / 2), badgeWidth, BadgeHeight)];
[_titleField setFrame:CGRectMake(24, 0, MAX(0, width - 24 - badgeWidth - 14), height)];
}
[self _updateSelectionAppearance];
}
- (void)setThemeState:(ThemeState)aState
{
[super setThemeState:aState];
[self _updateSelectionAppearance];
}
- (void)unsetThemeState:(ThemeState)aState
{
[super unsetThemeState:aState];
[self _updateSelectionAppearance];
}
- (void)_updateSelectionAppearance
{
/*
CPTableView marks data views of selected rows with CPThemeStateSelectedDataView and,
only while the table is focused (first responder in the key window), additionally
with CPThemeStateFirstResponder. The unfocused selection colour is a light gray, so
the selected text colour is only legible in the focused case. A title without a
colour of its own takes the theme's text colour, which follows the appearance.
*/
var selected = [self hasThemeState:CPThemeStateSelectedDataView],
emphasized = selected && [self hasThemeState:CPThemeStateFirstResponder];
[_iconView setSelected:emphasized];
[_badgeView setSelected:emphasized];
if (_isHeader)
[_titleField setTextColor:[CPColor secondaryLabelColor]];
else
[_titleField setTextColor:emphasized ? [CPColor alternateSelectedControlTextColor] : nil];
}
@end
// --------------------------------------------------------------------------------
// SourceListViewController
// --------------------------------------------------------------------------------
@implementation SourceListViewController : CPViewController
{
Library _library;
File renamed without changes.
@@ -12,7 +12,7 @@
*/
@import <AppKit/AppKit.j>
@import "Library.j"
@import "../Library.j"
// Layout grid. Every row is RowHeight tall; labels and controls are centred on
// the row's midline regardless of each control's intrinsic height.
@@ -17,12 +17,12 @@
*/
@import <AppKit/AppKit.j>
@import "Library.j"
@import "SourceListViewController.j"
@import "PeopleViewController.j"
@import "SmartFolderEditorController.j"
@import "NameSheetController.j"
@import "SettingsWindowController.j"
@import "../../Library/Library.j"
@import "../../Library/Navigation/SourceListViewController.j"
@import "../../Library/ContentViewer/PeopleViewController.j"
@import "../../Library/Navigation/SmartFolderEditor/SmartFolderEditorController.j"
@import "../../Library/Navigation/GroupNameSheet/NameSheetController.j"
@import "../../ApplicationLifecycle/Settings/SettingsWindowController.j"
var ToolbarSidebarIdentifier = @"SidebarItem",
ToolbarNewFolderIdentifier = @"NewSmartFolderItem",
+15 -8
View File
@@ -9,17 +9,24 @@ the other icons and the badges are drawn with `CPBezierPath`.
## Structure
Folders follow the parts of the application, nested where one part belongs to another. Imports
between folders are relative (`"../Library.j"`). The toolchain files (`main.j`, `Info.plist`,
`Jakefile`, `index.html`, `index-debug.html`, `Resources/`) stay at the top. Folder names have no
spaces, because the legacy toolchain does not accept them.
| File | Role |
|---|---|
| `main.j`, `Info.plist` | entry point, `CPApplicationDelegateClass` = `AppController` |
| `AppController.j` | creates model, main menu, main window controller |
| `MainWindowController.j` | bridge window, toolbar, sidebar split view, routed actions, menu and toolbar validation |
| `SourceListViewController.j` | view-based `CPOutlineView` source list, badges, drop target, button bar |
| `PeopleViewController.j` | `CPArrayController` + bound `CPTableView`, drag source, pasteboard, detail split |
| `PersonDetailViewController.j` | controls bound to `selection.*` |
| `SmartFolderEditorController.j` | sheet with `CPPredicateEditor` built from row templates |
| `NameSheetController.j` | small reusable name sheet |
| `Library.j`, `Person.j` | model, KVO observation, `CPUserDefaults` persistence, sample data |
| `ApplicationLifecycle/AppController.j` | creates model, main menu, main window controller |
| `ApplicationLifecycle/Settings/SettingsWindowController.j` | settings window |
| `PrimaryInterface/MainWindow/MainWindowController.j` | bridge window, toolbar, sidebar split view, routed actions, menu and toolbar validation |
| `Library/Library.j`, `Library/Person.j` | model, KVO observation, `CPUserDefaults` persistence, sample data |
| `Library/Navigation/SourceListViewController.j` | view-based `CPOutlineView` source list, drop target, button bar |
| `Library/Navigation/SourceItemCell/` | outline cell view with its icon and count badge, drawn with `CPBezierPath` |
| `Library/Navigation/SmartFolderEditor/SmartFolderEditorController.j` | sheet with `CPPredicateEditor` built from row templates |
| `Library/Navigation/GroupNameSheet/NameSheetController.j` | name sheet for new and renamed groups |
| `Library/ContentViewer/PeopleViewController.j` | `CPArrayController` + bound `CPTableView`, drag source, pasteboard, detail split |
| `Library/PersonInspector/PersonDetailViewController.j` | controls bound to `selection.*` |
## Manual test checklist
+1 -1
View File
@@ -9,7 +9,7 @@
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
@import "ApplicationLifecycle/AppController.j"
function main(args, namedArgs)