Skip to content

Commit

Permalink
Merge branch 'release/1.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mjdescy committed Jun 18, 2015
2 parents 5e25e2a + dde312d commit 0dba5bd
Show file tree
Hide file tree
Showing 9 changed files with 580 additions and 138 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ From a design perspective the goal is to be the fastest, simplest, and cleanest
- Preserves Windows or Unix line endings in the todo.txt file for cross-platform compatability.
- Automatic update checking.
- Displays general metadata (task counts, etc.) about the task list.
- Undo/redo support.

## Adding/removing tasks

Expand Down Expand Up @@ -93,6 +94,11 @@ From a design perspective the goal is to be the fastest, simplest, and cleanest
- Command+Option+Down: Decrease due date by 1 day
- Command+Option+Left or Command+Option+Right: Remove due date

## Undo/redo

- Command+Z: Undo
- Command+Shift+Z: Redo

## Working with files

- Command+N: new file
Expand Down
2 changes: 2 additions & 0 deletions TodoTxtMac/TTMAppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
@"", @"defaultTodoFilePath",
@YES, @"showStatusBar",
[TTMDocumentStatusBarText defaultFormat], @"statusBarFormat",
@0, @"levelsOfUndo",
@YES, @"allowUndoOfArchiveCommand",
nil];
}
return dict;
Expand Down
67 changes: 58 additions & 9 deletions TodoTxtMac/TTMDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ typedef enum : NSUInteger {
TTMSortAlphabetical
} TTMTaskListSortType;

typedef void (^TaskChangeBlock)(id, NSUInteger, BOOL*);

@interface TTMDocument : NSDocument

#pragma mark - Properties
Expand Down Expand Up @@ -111,6 +109,9 @@ typedef void (^TaskChangeBlock)(id, NSUInteger, BOOL*);
@property (nonatomic, retain) TTMTasklistMetadata *filteredTasklistMetadata;
@property (nonatomic, retain) IBOutlet NSWindow *tasklistMetadataSheet;

// Task objects for undo/redo of task edits
@property (nonatomic, copy) NSArray *originalTasks;

#pragma mark - File Loading and Saving Methods

/*!
Expand Down Expand Up @@ -140,6 +141,44 @@ typedef void (^TaskChangeBlock)(id, NSUInteger, BOOL*);
*/
- (void)setTaskListSelections:(NSArray*)taskListSelectedItems;

#pragma mark - Undo/Redo Methods

/*!
* @method replaceTasks:withTasks:
* @abstract This method replaces one array of tasks with another in the task list.
* It is used for undo/redo operations, namely to undo the reload file command.
*/

- (void)replaceAllTasks:(NSArray*)newTasks;

/*!
* @method replaceTasks:withTasks:
* @abstract This method replaces one array of tasks with another in the task list.
* It is used for undo/redo operations.
*/
- (void)replaceTasks:(NSArray*)oldTasks withTasks:(NSArray*)newTasks;

/*!
* @method addTasks:
* @abstract This method adds an array of tasks to the task list.
* It is used for undo/redo operations.
*/
- (void)addTasks:(NSArray*)newTasks;

/*!
* @method addTasks:
* @abstract This method removes an array of tasks from the task list.
* It is used for undo/redo operations.
*/
- (void)removeTasks:(NSArray*)oldTasks;

/*!
* @method addTasks:
* @abstract This method performs and undo for the archive command.
* It is used for undo/redo operations.
*/
- (void)undoArchiveTasks:(NSArray*)archivedTasks fromArchiveFile:(NSString*)archiveFilePath;

#pragma mark - Add/Remove Task(s) methods

/*!
Expand All @@ -164,12 +203,15 @@ typedef void (^TaskChangeBlock)(id, NSUInteger, BOOL*);
- (void)removeAllTasks;

/*!
* @method addTasksFromArray:removeAllTasksFirst:
* @method addTasksFromArray:removeAllTasksFirst:undoActionName
* @abstract Add tasks from an array to the task list.
* @param rawTextStrings The array of tasks' raw text strings.
* @param removeAllRecordsFirst Set to YES if all records should be removed prior to adding tasks.
* @param undoActionName Set to undo action name; blank if operation is not undoable
*/
- (void)addTasksFromArray:(NSArray*)rawTextStrings removeAllTasksFirst:(BOOL)removeAllRecordsFirst;
- (void)addTasksFromArray:(NSArray*)rawTextStrings
removeAllTasksFirst:(BOOL)removeAllRecordsFirst
undoActionName:(NSString*)undoActionName;

/*!
* @method addNewTask:
Expand Down Expand Up @@ -236,12 +278,17 @@ typedef void (^TaskChangeBlock)(id, NSUInteger, BOOL*);
- (IBAction)updateSelectedTask:(id)sender;

/*!
* @method forEachSelectedTaskExecuteBlock:
* @abstract Executes a block for each selected task in the task list.
* @param block A TaskChangeBlock that performs an action on a TTMTask object.
* @discussion This method is called by various other methods in this class.
* @method initializeUpdateSelectedTask:
* @abstract Captures undo data for the update task list command, prior to the update being made.
*/
- (void)forEachSelectedTaskExecuteBlock:(TaskChangeBlock)block;
- (void)initializeUpdateSelectedTask;

/*!
* @method finalizeUpdateSelectedTask:rawText
* @abstract Finalizes preparation of undo data for the update task list command,
* after the update is made.
*/
- (void)finalizeUpdateSelectedTask:(NSString*)rawText;

/*!
* @method toggleTaskCompletion:
Expand Down Expand Up @@ -432,6 +479,8 @@ typedef void (^TaskChangeBlock)(id, NSUInteger, BOOL*);
*/
- (void)appendString:(NSString*)content toArchiveFile:(NSString*)archiveFilePath;

- (void)removeTasks:(NSArray*)tasksToRemove fromArchiveFile:(NSString*)archiveFilePath;

#pragma mark - Find Methods

/*!
Expand Down
Loading

0 comments on commit 0dba5bd

Please sign in to comment.