Skip to content

Commit

Permalink
Merge branch 'release/2.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mjdescy committed Aug 12, 2016
2 parents e908c47 + 262883c commit 24212cf
Show file tree
Hide file tree
Showing 13 changed files with 1,429 additions and 1,118 deletions.
6 changes: 6 additions & 0 deletions TodoTxtMac.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
00D102B61991ABBE00D30237 /* TTMTasklistMetadata.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D102B51991ABBE00D30237 /* TTMTasklistMetadata.m */; };
00D531271CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D531261CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m */; };
00D5312A1CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */; };
00DA4A1D1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00DA4A1C1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.m */; };
00EAAB9718E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9618E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m */; };
00EAAB9A18E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9918E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.m */; };
00EAAB9D18E1CF92009CBE8C /* TTMPredicateEditorCompletedRowTemplate.m in Sources */ = {isa = PBXBuildFile; fileRef = 00EAAB9C18E1CF92009CBE8C /* TTMPredicateEditorCompletedRowTemplate.m */; };
Expand Down Expand Up @@ -191,6 +192,8 @@
00D531261CACA285007EF487 /* TTMTask_IsHidden_UnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMTask_IsHidden_UnitTests.m; sourceTree = "<group>"; };
00D531281CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorHiddenRowTemplate.h; sourceTree = "<group>"; };
00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMPredicateEditorHiddenRowTemplate.m; sourceTree = "<group>"; };
00DA4A1B1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorTextRowTemplate.h; sourceTree = "<group>"; };
00DA4A1C1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMPredicateEditorTextRowTemplate.m; sourceTree = "<group>"; };
00EAAB9518E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorDateRowTemplate.h; sourceTree = "<group>"; };
00EAAB9618E0C168009CBE8C /* TTMPredicateEditorDateRowTemplate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTMPredicateEditorDateRowTemplate.m; sourceTree = "<group>"; };
00EAAB9818E1CF79009CBE8C /* TTMPredicateEditorDueRowTemplate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTMPredicateEditorDueRowTemplate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -261,6 +264,8 @@
007B835E1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.m */,
00D531281CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.h */,
00D531291CACC3C7007EF487 /* TTMPredicateEditorHiddenRowTemplate.m */,
00DA4A1B1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.h */,
00DA4A1C1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.m */,
);
name = Filters;
sourceTree = "<group>";
Expand Down Expand Up @@ -586,6 +591,7 @@
00930EB118B537C10064D41B /* TTMDateUtility.m in Sources */,
00FA1D2818F1EF340066A437 /* FontNameTransformer.m in Sources */,
00D102B61991ABBE00D30237 /* TTMTasklistMetadata.m in Sources */,
00DA4A1D1D5BBEB600CFF2B1 /* TTMPredicateEditorTextRowTemplate.m in Sources */,
0086C98518B54F1A00A427AA /* TTMTableViewDelegate.m in Sources */,
007B835F1A5A415300A4D5F7 /* TTMPredicateEditorThresholdRowTemplate.m in Sources */,
00B4CBAF18B43E8400313DAA /* TTMDocument.m in Sources */,
Expand Down
8 changes: 4 additions & 4 deletions TodoTxtMac/Base.lproj/TTMDocument.xib
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
Expand All @@ -20,12 +20,12 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Window">
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="TTMDocument" animationBehavior="default" id="5" userLabel="Window">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" unifiedTitleAndToolbar="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="133" y="235" width="510" height="447"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<value key="minSize" type="size" width="94" height="86"/>
<view key="contentView" wantsLayer="YES" id="6">
<rect key="frame" x="0.0" y="0.0" width="510" height="447"/>
Expand Down Expand Up @@ -53,7 +53,7 @@
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="B31-jc-X0I">
<textFieldCell key="dataCell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="B31-jc-X0I">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
Expand Down
2 changes: 2 additions & 0 deletions TodoTxtMac/TTMDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,6 @@ typedef enum : NSUInteger {
*/
- (IBAction)toggleStatusBarVisability:(id)sender;

- (void)setTableWidthToWidthOfContents;

@end
116 changes: 114 additions & 2 deletions TodoTxtMac/TTMDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ - (void)awakeFromNib {
[self.tableView registerForDraggedTypes:[NSArray arrayWithObject:NSStringPboardType]];

[self setTaskListFont];


[self setTableWidthToWidthOfContents];

// Observe array controller selection to update "selected tasks" count in status bar
[self.arrayController addObserver:self forKeyPath:@"selection" options:NSKeyValueObservingOptionNew context:nil];

Expand All @@ -110,6 +112,44 @@ - (void)awakeFromNib {
forKeyPath:@"levelsOfUndo"
options:NSKeyValueObservingOptionNew
context:nil];

// Observe NSUserDefaults to update filter-related preferences
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"filterPredicate1"
options:NSKeyValueObservingOptionNew
context:nil];
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"filterPredicate2"
options:NSKeyValueObservingOptionNew
context:nil];
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"filterPredicate3"
options:NSKeyValueObservingOptionNew
context:nil];
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"filterPredicate4"
options:NSKeyValueObservingOptionNew
context:nil];
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"filterPredicate5"
options:NSKeyValueObservingOptionNew
context:nil];
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"filterPredicate6"
options:NSKeyValueObservingOptionNew
context:nil];
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"filterPredicate7"
options:NSKeyValueObservingOptionNew
context:nil];
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"filterPredicate8"
options:NSKeyValueObservingOptionNew
context:nil];
[[NSUserDefaults standardUserDefaults] addObserver:self
forKeyPath:@"filterPredicate9"
options:NSKeyValueObservingOptionNew
context:nil];
}

- (NSString *)windowNibName {
Expand Down Expand Up @@ -495,7 +535,8 @@ - (void)refreshTaskListWithSave:(BOOL)saveToFile {
[self.arrayController rearrangeObjects];
// Reload table.
[self.tableView reloadData];

[self setTableWidthToWidthOfContents];

// re-set selected items
[self setTaskListSelections:taskListSelectedItemsList];

Expand All @@ -517,6 +558,7 @@ - (IBAction)visualRefreshOnly:(id)sender {
[self setTaskListFont];
[self reapplyActiveFilterPredicate];
[self.tableView reloadData];
[self setTableWidthToWidthOfContents];
[self updateTaskListMetadata];
}

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

if ([keyPath isEqualToString:@"searchFieldPredicate"]) {
[self reapplyActiveFilterPredicate];
return;
}

if ([keyPath isEqualToString:@"levelsOfUndo"]) {
[self.undoManager setLevelsOfUndo:[[NSUserDefaults standardUserDefaults] integerForKey:@"levelsOfUndo"]];
return;
}

if ([keyPath isEqualToString:@"filterPredicate1"]) {
[self visualRefreshIfFilterChangedAtPreset:1];
return;
}
if ([keyPath isEqualToString:@"filterPredicate2"]) {
[self visualRefreshIfFilterChangedAtPreset:2];
return;
}
if ([keyPath isEqualToString:@"filterPredicate3"]) {
[self visualRefreshIfFilterChangedAtPreset:3];
return;
}
if ([keyPath isEqualToString:@"filterPredicate4"]) {
[self visualRefreshIfFilterChangedAtPreset:4];
return;
}
if ([keyPath isEqualToString:@"filterPredicate5"]) {
[self visualRefreshIfFilterChangedAtPreset:5];
return;
}
if ([keyPath isEqualToString:@"filterPredicate6"]) {
[self visualRefreshIfFilterChangedAtPreset:6];
return;
}
if ([keyPath isEqualToString:@"filterPredicate7"]) {
[self visualRefreshIfFilterChangedAtPreset:7];
return;
}
if ([keyPath isEqualToString:@"filterPredicate8"]) {
[self visualRefreshIfFilterChangedAtPreset:8];
return;
}
if ([keyPath isEqualToString:@"filterPredicate9"]) {
[self visualRefreshIfFilterChangedAtPreset:9];

}
}

- (void)visualRefreshIfFilterChangedAtPreset:(int)presentNumber {
if (self.activeFilterPredicateNumber == presentNumber) {
[self visualRefreshOnly:self];
}
}

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

// MARK - Column resizing methods

- (void)setTableWidthToWidthOfContents {
CGFloat currentWidth = self.tableView.tableColumns.lastObject.width;
CGFloat tableContentWidth = [self tableViewContentWidth];
[self.tableView.tableColumns.lastObject setMinWidth:tableContentWidth];
if (currentWidth > tableContentWidth) {
[self.tableView.tableColumns.lastObject setWidth:tableContentWidth];
}
}

- (CGFloat)tableViewContentWidth {
NSTableView * tableView = self.tableView;
NSRect rect = NSMakeRect(0,0, INFINITY, tableView.rowHeight);
NSInteger columnIndex = 0;
CGFloat maxSize = 0;
for (NSInteger i = 0; i < tableView.numberOfRows; i++) {
NSCell *cell = [tableView preparedCellAtColumn:columnIndex row:i];
NSSize size = [cell cellSizeForBounds:rect];
maxSize = MAX(maxSize, size.width);
}
return maxSize;
}

@end
Loading

0 comments on commit 24212cf

Please sign in to comment.