mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Refactoring: Move logic from FileBrowserView → FileBrowserViewController
This is to make it easier to support Cocoa’s native resume feature, as for this, we should keep all state in the controller, but also, the controller should be able to know if view state changes, for example expanded/selected items in the outline view, which require our controller to be the delegate.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#import "FileBrowserView.h"
|
||||
#import "FileBrowserViewController.h"
|
||||
#import "FileBrowserNotifications.h"
|
||||
#import "FileItem.h"
|
||||
#import <OakAppKit/OakSound.h>
|
||||
@@ -6,7 +6,7 @@
|
||||
#import <io/path.h>
|
||||
#import <ns/ns.h>
|
||||
|
||||
@implementation FileBrowserView (DiskOperations)
|
||||
@implementation FileBrowserViewController (DiskOperations)
|
||||
- (NSArray<NSURL*>*)performOperation:(FBOperation)op withURLs:(NSDictionary<NSURL*, NSURL*>*)urls unique:(BOOL)makeUnique select:(BOOL)selectDestinationURLs
|
||||
{
|
||||
NSMutableArray* srcURLs = [NSMutableArray array];
|
||||
@@ -524,7 +524,7 @@
|
||||
|
||||
- (BOOL)presentError:(NSError*)error
|
||||
{
|
||||
[self presentError:error modalForWindow:self.window delegate:nil didPresentSelector:nullptr contextInfo:nullptr];
|
||||
[self presentError:error modalForWindow:self.view.window delegate:nil didPresentSelector:nullptr contextInfo:nullptr];
|
||||
return YES;
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include <oak/misc.h>
|
||||
|
||||
@class FileItem;
|
||||
@class OFBHeaderView;
|
||||
@class OFBActionsView;
|
||||
|
||||
@@ -8,47 +7,4 @@
|
||||
@property (nonatomic) OFBHeaderView* headerView;
|
||||
@property (nonatomic) NSOutlineView* outlineView;
|
||||
@property (nonatomic) OFBActionsView* actionsView;
|
||||
|
||||
@property (nonatomic, weak) id target;
|
||||
@property (nonatomic) SEL openAction;
|
||||
@property (nonatomic) SEL closeAction;
|
||||
|
||||
@property (nonatomic) NSURL* URL;
|
||||
@property (nonatomic) NSArray<NSURL*>* openURLs;
|
||||
@property (nonatomic) NSArray<NSURL*>* modifiedURLs;
|
||||
|
||||
@property (nonatomic) BOOL showExcludedItems;
|
||||
|
||||
@property (nonatomic, readonly) FileItem* fileItem;
|
||||
@property (nonatomic, readonly) NSArray<FileItem*>* selectedItems;
|
||||
@property (nonatomic, readonly) NSArray<FileItem*>* previewableItems;
|
||||
@property (nonatomic, readonly) NSURL* directoryURLForNewItems;
|
||||
|
||||
@property (nonatomic, readonly) NSSet<NSURL*>* expandedURLs;
|
||||
@property (nonatomic, readonly) NSSet<NSURL*>* selectedURLs;
|
||||
|
||||
- (void)reload:(id)sender;
|
||||
- (void)expandURLs:(NSArray<NSURL*>*)expandURLs selectURLs:(NSArray<NSURL*>*)selectURLs;
|
||||
- (NSRect)imageRectOfItem:(FileItem*)item;
|
||||
|
||||
- (NSComparator)itemComparator;
|
||||
- (NSArray<FileItem*>*)arrangeChildren:(NSArray<FileItem*>*)children inParent:(FileItem*)parentOrNil;
|
||||
- (void)rearrangeChildrenInParent:(FileItem*)item;
|
||||
- (void)updateDisambiguationSuffixInParent:(FileItem*)item;
|
||||
@end
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, FBOperation) {
|
||||
FBOperationLink = 0x0001,
|
||||
FBOperationCopy = 0x0002,
|
||||
FBOperationDuplicate = 0x0004,
|
||||
FBOperationMove = 0x0008,
|
||||
FBOperationRename = 0x0010,
|
||||
FBOperationTrash = 0x0020,
|
||||
FBOperationNewFile = 0x0040,
|
||||
FBOperationNewFolder = 0x0080,
|
||||
};
|
||||
|
||||
@interface FileBrowserView (DiskOperations)
|
||||
- (NSArray<NSURL*>*)performOperation:(FBOperation)op withURLs:(NSDictionary<NSURL*, NSURL*>*)urls unique:(BOOL)makeUnique select:(BOOL)selectDestinationURLs;
|
||||
- (NSArray<NSURL*>*)performOperation:(FBOperation)op sourceURLs:(NSArray<NSURL*>*)srcURLs destinationURLs:(NSArray<NSURL*>*)destURLs unique:(BOOL)makeUnique select:(BOOL)selectDestinationURLs;
|
||||
@end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
#import "FileBrowserNotifications.h"
|
||||
|
||||
@class FileBrowserViewController;
|
||||
@class FileItem;
|
||||
|
||||
@protocol FileBrowserDelegate
|
||||
- (void)fileBrowser:(FileBrowserViewController*)fileBrowser openURLs:(NSArray*)someURLs;
|
||||
@@ -47,4 +48,28 @@
|
||||
- (void)goToFavorites:(id)sender;
|
||||
- (void)goToSCMDataSource:(id)sender;
|
||||
- (void)orderFrontGoToFolder:(id)sender;
|
||||
|
||||
// ======================================================
|
||||
// = Private (FileBrowserViewController DiskOperations) =
|
||||
// ======================================================
|
||||
@property (nonatomic) FileItem* fileItem;
|
||||
- (NSComparator)itemComparator;
|
||||
- (NSArray<FileItem*>*)arrangeChildren:(NSArray<FileItem*>*)children inParent:(FileItem*)parentOrNil;
|
||||
- (void)rearrangeChildrenInParent:(FileItem*)item;
|
||||
@end
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, FBOperation) {
|
||||
FBOperationLink = 0x0001,
|
||||
FBOperationCopy = 0x0002,
|
||||
FBOperationDuplicate = 0x0004,
|
||||
FBOperationMove = 0x0008,
|
||||
FBOperationRename = 0x0010,
|
||||
FBOperationTrash = 0x0020,
|
||||
FBOperationNewFile = 0x0040,
|
||||
FBOperationNewFolder = 0x0080,
|
||||
};
|
||||
|
||||
@interface FileBrowserViewController (DiskOperations)
|
||||
- (NSArray<NSURL*>*)performOperation:(FBOperation)op withURLs:(NSDictionary<NSURL*, NSURL*>*)urls unique:(BOOL)makeUnique select:(BOOL)selectDestinationURLs;
|
||||
- (NSArray<NSURL*>*)performOperation:(FBOperation)op sourceURLs:(NSArray<NSURL*>*)srcURLs destinationURLs:(NSArray<NSURL*>*)destURLs unique:(BOOL)makeUnique select:(BOOL)selectDestinationURLs;
|
||||
@end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user