Skip to content

Commit 24212cf

Browse files
committed
Merge branch 'release/2.3.1'
2 parents e908c47 + 262883c commit 24212cf

13 files changed

+1429
-1118
lines changed

TodoTxtMac.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
00D102B61991ABBE00D30237 /* TTMTasklistMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D102B51991ABBE00D30237 /* TTMTasklistMetadata.m */; };
7171
00D531271CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D531261CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m */; };
7272
00D5312A1CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */; };
73+
00DA4A1D1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00DA4A1C1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.m */; };
7374
00EAAB9718E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9618E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m */; };
7475
00EAAB9A18E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9918E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m */; };
7576
00EAAB9D18E1CF92009CBE8C /* TTMPredicateEditorCompletedRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9C18E1CF92009CBE8C /* TTMPredicateEditorCompletedRowTemplate.m */; };
@@ -191,6 +192,8 @@
191192
00D531261CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMTask_IsHidden_UnitTests.m; sourceTree = "<group>"; };
192193
00D531281CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorHiddenRowTemplate.h; sourceTree = "<group>"; };
193194
00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMPredicateEditorHiddenRowTemplate.m; sourceTree = "<group>"; };
195+
00DA4A1B1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorTextRowTemplate.h; sourceTree = "<group>"; };
196+
00DA4A1C1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMPredicateEditorTextRowTemplate.m; sourceTree = "<group>"; };
194197
00EAAB9518E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorDateRowTemplate.h; sourceTree = "<group>"; };
195198
00EAAB9618E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMPredicateEditorDateRowTemplate.m; sourceTree = "<group>"; };
196199
00EAAB9818E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorDueRowTemplate.h; sourceTree = "<group>"; };
@@ -261,6 +264,8 @@
261264
007B835E1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.m */,
262265
00D531281CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.h */,
263266
00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */,
267+
00DA4A1B1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.h */,
268+
00DA4A1C1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.m */,
264269
);
265270
name = Filters;
266271
sourceTree = "<group>";
@@ -586,6 +591,7 @@
586591
00930EB118B537C10064D41B /* TTMDateUtility.m in Sources */,
587592
00FA1D2818F1EF340066A437 /* FontNameTransformer.m in Sources */,
588593
00D102B61991ABBE00D30237 /* TTMTasklistMetadata.m in Sources */,
594+
00DA4A1D1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.m in Sources */,
589595
0086C98518B54F1A00A427AA /* TTMTableViewDelegate.m in Sources */,
590596
007B835F1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.m in Sources */,
591597
00B4CBAF18B43E8400313DAA /* TTMDocument.m in Sources */,

TodoTxtMac/Base.lproj/TTMDocument.xib

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment identifier="macosx"/>
55
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
@@ -20,12 +20,12 @@
2020
</connections>
2121
</customObject>
2222
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
23-
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Window">
23+
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="TTMDocument" animationBehavior="default" id="5" userLabel="Window">
2424
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" unifiedTitleAndToolbar="YES"/>
2525
<windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
2626
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
2727
<rect key="contentRect" x="133" y="235" width="510" height="447"/>
28-
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
28+
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
2929
<value key="minSize" type="size" width="94" height="86"/>
3030
<view key="contentView" wantsLayer="YES" id="6">
3131
<rect key="frame" x="0.0" y="0.0" width="510" height="447"/>
@@ -53,7 +53,7 @@
5353
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
5454
<color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/>
5555
</tableHeaderCell>
56-
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="B31-jc-X0I">
56+
<textFieldCell key="dataCell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="B31-jc-X0I">
5757
<font key="font" metaFont="system"/>
5858
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
5959
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>

TodoTxtMac/TTMDocument.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,4 +550,6 @@ typedef enum : NSUInteger {
550550
*/
551551
- (IBAction)toggleStatusBarVisability:(id)sender;
552552

553+
- (void)setTableWidthToWidthOfContents;
554+
553555
@end

TodoTxtMac/TTMDocument.m

Lines changed: 114 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ - (void)awakeFromNib {
9898
[self.tableView registerForDraggedTypes:[NSArray arrayWithObject:NSStringPboardType]];
9999

100100
[self setTaskListFont];
101-
101+
102+
[self setTableWidthToWidthOfContents];
103+
102104
// Observe array controller selection to update "selected tasks" count in status bar
103105
[self.arrayController addObserver:self forKeyPath:@"selection" options:NSKeyValueObservingOptionNew context:nil];
104106

@@ -110,6 +112,44 @@ - (void)awakeFromNib {
110112
forKeyPath:@"levelsOfUndo"
111113
options:NSKeyValueObservingOptionNew
112114
context:nil];
115+
116+
// Observe NSUserDefaults to update filter-related preferences
117+
[[NSUserDefaults standardUserDefaults] addObserver:self
118+
forKeyPath:@"filterPredicate1"
119+
options:NSKeyValueObservingOptionNew
120+
context:nil];
121+
[[NSUserDefaults standardUserDefaults] addObserver:self
122+
forKeyPath:@"filterPredicate2"
123+
options:NSKeyValueObservingOptionNew
124+
context:nil];
125+
[[NSUserDefaults standardUserDefaults] addObserver:self
126+
forKeyPath:@"filterPredicate3"
127+
options:NSKeyValueObservingOptionNew
128+
context:nil];
129+
[[NSUserDefaults standardUserDefaults] addObserver:self
130+
forKeyPath:@"filterPredicate4"
131+
options:NSKeyValueObservingOptionNew
132+
context:nil];
133+
[[NSUserDefaults standardUserDefaults] addObserver:self
134+
forKeyPath:@"filterPredicate5"
135+
options:NSKeyValueObservingOptionNew
136+
context:nil];
137+
[[NSUserDefaults standardUserDefaults] addObserver:self
138+
forKeyPath:@"filterPredicate6"
139+
options:NSKeyValueObservingOptionNew
140+
context:nil];
141+
[[NSUserDefaults standardUserDefaults] addObserver:self
142+
forKeyPath:@"filterPredicate7"
143+
options:NSKeyValueObservingOptionNew
144+
context:nil];
145+
[[NSUserDefaults standardUserDefaults] addObserver:self
146+
forKeyPath:@"filterPredicate8"
147+
options:NSKeyValueObservingOptionNew
148+
context:nil];
149+
[[NSUserDefaults standardUserDefaults] addObserver:self
150+
forKeyPath:@"filterPredicate9"
151+
options:NSKeyValueObservingOptionNew
152+
context:nil];
113153
}
114154

115155
- (NSString *)windowNibName {
@@ -495,7 +535,8 @@ - (void)refreshTaskListWithSave:(BOOL)saveToFile {
495535
[self.arrayController rearrangeObjects];
496536
// Reload table.
497537
[self.tableView reloadData];
498-
538+
[self setTableWidthToWidthOfContents];
539+
499540
// re-set selected items
500541
[self setTaskListSelections:taskListSelectedItemsList];
501542

@@ -517,6 +558,7 @@ - (IBAction)visualRefreshOnly:(id)sender {
517558
[self setTaskListFont];
518559
[self reapplyActiveFilterPredicate];
519560
[self.tableView reloadData];
561+
[self setTableWidthToWidthOfContents];
520562
[self updateTaskListMetadata];
521563
}
522564

@@ -1442,14 +1484,60 @@ - (IBAction)hideTasklistMetadata:(id)sender {
14421484
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
14431485
if ([keyPath isEqualToString:@"selection"]) {
14441486
[self updateStatusBarText];
1487+
return;
14451488
}
14461489

14471490
if ([keyPath isEqualToString:@"searchFieldPredicate"]) {
14481491
[self reapplyActiveFilterPredicate];
1492+
return;
14491493
}
14501494

14511495
if ([keyPath isEqualToString:@"levelsOfUndo"]) {
14521496
[self.undoManager setLevelsOfUndo:[[NSUserDefaults standardUserDefaults] integerForKey:@"levelsOfUndo"]];
1497+
return;
1498+
}
1499+
1500+
if ([keyPath isEqualToString:@"filterPredicate1"]) {
1501+
[self visualRefreshIfFilterChangedAtPreset:1];
1502+
return;
1503+
}
1504+
if ([keyPath isEqualToString:@"filterPredicate2"]) {
1505+
[self visualRefreshIfFilterChangedAtPreset:2];
1506+
return;
1507+
}
1508+
if ([keyPath isEqualToString:@"filterPredicate3"]) {
1509+
[self visualRefreshIfFilterChangedAtPreset:3];
1510+
return;
1511+
}
1512+
if ([keyPath isEqualToString:@"filterPredicate4"]) {
1513+
[self visualRefreshIfFilterChangedAtPreset:4];
1514+
return;
1515+
}
1516+
if ([keyPath isEqualToString:@"filterPredicate5"]) {
1517+
[self visualRefreshIfFilterChangedAtPreset:5];
1518+
return;
1519+
}
1520+
if ([keyPath isEqualToString:@"filterPredicate6"]) {
1521+
[self visualRefreshIfFilterChangedAtPreset:6];
1522+
return;
1523+
}
1524+
if ([keyPath isEqualToString:@"filterPredicate7"]) {
1525+
[self visualRefreshIfFilterChangedAtPreset:7];
1526+
return;
1527+
}
1528+
if ([keyPath isEqualToString:@"filterPredicate8"]) {
1529+
[self visualRefreshIfFilterChangedAtPreset:8];
1530+
return;
1531+
}
1532+
if ([keyPath isEqualToString:@"filterPredicate9"]) {
1533+
[self visualRefreshIfFilterChangedAtPreset:9];
1534+
1535+
}
1536+
}
1537+
1538+
- (void)visualRefreshIfFilterChangedAtPreset:(int)presentNumber {
1539+
if (self.activeFilterPredicateNumber == presentNumber) {
1540+
[self visualRefreshOnly:self];
14531541
}
14541542
}
14551543

@@ -1477,4 +1565,28 @@ - (IBAction)toggleStatusBarVisability:(id)sender {
14771565
[self setStatusBarVisable:!self.statusBarVisable];
14781566
}
14791567

1568+
// MARK - Column resizing methods
1569+
1570+
- (void)setTableWidthToWidthOfContents {
1571+
CGFloat currentWidth = self.tableView.tableColumns.lastObject.width;
1572+
CGFloat tableContentWidth = [self tableViewContentWidth];
1573+
[self.tableView.tableColumns.lastObject setMinWidth:tableContentWidth];
1574+
if (currentWidth > tableContentWidth) {
1575+
[self.tableView.tableColumns.lastObject setWidth:tableContentWidth];
1576+
}
1577+
}
1578+
1579+
- (CGFloat)tableViewContentWidth {
1580+
NSTableView * tableView = self.tableView;
1581+
NSRect rect = NSMakeRect(0,0, INFINITY, tableView.rowHeight);
1582+
NSInteger columnIndex = 0;
1583+
CGFloat maxSize = 0;
1584+
for (NSInteger i = 0; i < tableView.numberOfRows; i++) {
1585+
NSCell *cell = [tableView preparedCellAtColumn:columnIndex row:i];
1586+
NSSize size = [cell cellSizeForBounds:rect];
1587+
maxSize = MAX(maxSize, size.width);
1588+
}
1589+
return maxSize;
1590+
}
1591+
14801592
@end

0 commit comments

Comments
 (0)