Skip to content
Snippets Groups Projects
Commit 585dd7e0 authored by C.W. Betts's avatar C.W. Betts
Browse files

Migrate over to properties.

Not every class was looked over, though.
Remove redundant declarations of dealloc in interface blocks.
Mark constructors of classes with instancetype instead of id.
parent 0ae8cb1b
No related branches found
No related tags found
No related merge requests found
Showing
with 48 additions and 68 deletions
Loading
Loading
@@ -14,6 +14,6 @@
@property(nonatomic, copy) Profile *profile;
 
// An array of keys that may be changed in self.profile. All take string values.
- (NSArray *)allKeys;
@property (readonly, strong) NSArray<NSString*> *allKeys;
 
@end
Loading
Loading
@@ -8,8 +8,7 @@
 
@interface AutocompleteView : Popup
 
- (id)init;
- (void)dealloc;
- (instancetype)init;
 
- (void)onOpen;
- (void)refresh;
Loading
Loading
Loading
Loading
@@ -34,7 +34,7 @@
- (NSGradient *)gradientForColorIndex:(NSInteger)colorIndex;
- (void)drawRect:(NSRect)rect;
- (void)mouseUp:(NSEvent*) event;
- (NSColor*)color;
@property (readonly, retain) NSColor *color;
 
@end
 
Loading
Loading
@@ -27,6 +27,7 @@
#import "ColorsMenuItemView.h"
 
@implementation ColorsMenuItemView
@synthesize color = color_;
 
const int kNumberOfColors = 8;
const int kColorAreaOffsetX = 20;
Loading
Loading
@@ -52,11 +53,6 @@ enum {
kMenuItemGray = 7
};
 
- (NSColor*)color
{
return color_;
}
// Returns the color gradient corresponding to the color index.
// These colours were chosen to appear similar to those in Aperture 3.
// Based on http://cocoatricks.com/2010/07/a-label-color-picker-menu-item-2/
Loading
Loading
Loading
Loading
@@ -27,7 +27,7 @@ extern NSString *const kCommandHistoryDidChangeNotificationName;
 
+ (void)showInformationalMessage;
 
- (BOOL)commandHistoryHasEverBeenUsed;
@property (readonly) BOOL commandHistoryHasEverBeenUsed;
 
- (void)addCommand:(NSString *)command
onHost:(VT100RemoteHost *)host
Loading
Loading
Loading
Loading
@@ -44,7 +44,7 @@
- (BOOL)wantToWrite;
- (void)mainProcessDidTerminate;
- (void)terminate;
- (int)readFileDescriptor; // for reading
- (int)writeFileDescriptor; // for writing
@property (readonly) int readFileDescriptor; // for reading
@property (readonly) int writeFileDescriptor; // for writing
 
@end
Loading
Loading
@@ -43,8 +43,7 @@
// Allocates a circular buffer of the given size in bytes to store screen
// contents. Somewhat more memory is used because there's some per-frame
// storage, but it should be small in comparison.
- (id)initWithBufferCapacity:(int)bytes;
- (void)dealloc;
- (instancetype)initWithBufferCapacity:(int)bytes;
 
// Save the screen state into the DVR.
// frameLines: An array of screen lines that DVREncoder understands.
Loading
Loading
@@ -59,7 +58,7 @@
- (void)releaseDecoder:(DVRDecoder*)decoder;
 
// Get timestamp of first/last frame. Times are in microseconds since 1970.
- (long long)lastTimeStamp;
- (long long)firstTimeStamp;
@property (readonly) long long lastTimeStamp;
@property (readonly) long long firstTimeStamp;
 
@end
Loading
Loading
@@ -81,8 +81,7 @@ typedef enum {
id sanityCheck; // TODO(georgen): remove this after the source of corruption of index_ is found
}
 
- (id)initWithBufferCapacity:(long long)capacity;
- (void)dealloc;
- (instancetype)initWithBufferCapacity:(long long)capacity;
 
// Reserve a chunk of memory. Returns true if blocks had to be freed to make room.
// You can get a pointer to the reserved memory with -[scratch].
Loading
Loading
@@ -103,16 +102,16 @@ typedef enum {
- (BOOL)hasSpaceAvailable:(long long)length;
 
// Returns first/last used keys.
- (long long)firstKey;
- (long long)lastKey;
@property (readonly) long long firstKey;
@property (readonly) long long lastKey;
 
// Look up an index entry by key.
- (DVRIndexEntry*)entryForKey:(long long)key;
 
// Total size of storage.
- (long long)capacity;
@property (readonly) long long capacity;
 
// Are there no frames?
- (BOOL)isEmpty;
@property (readonly, getter=isEmpty) BOOL empty;
@end
 
Loading
Loading
@@ -48,8 +48,7 @@
long long key_;
}
 
- (id)initWithBuffer:(DVRBuffer*)buffer;
- (void)dealloc;
- (instancetype)initWithBuffer:(DVRBuffer*)buffer;
 
// Jump to a given timestamp, or the next available frame. Returns true on success.
// Returns false if timestamp is later than the last timestamp or there are no frames.
Loading
Loading
@@ -58,7 +57,7 @@
// Accessors for the most recent frame.
- (char*)decodedFrame;
- (int)length;
- (long long)timestamp;
@property (readonly) long long timestamp;
- (DVRFrameInfo)info;
 
// Advance to next frame.
Loading
Loading
Loading
Loading
@@ -53,8 +53,7 @@
int reservation_;
}
 
- (id)initWithBuffer:(DVRBuffer*)buffer;
- (void)dealloc;
- (instancetype)initWithBuffer:(DVRBuffer*)buffer;
 
// Encoded a frame into the DVRBuffer. Call -[reserve:] first.
// frameLines: An array of screen lines
Loading
Loading
Loading
Loading
@@ -8,6 +8,6 @@
- (NSArray *)valuesEqualTo:(NSObject<NSCopying> *)target;
- (void)setValue:(NSObject<NSCopying> *)value equalToValue:(NSObject<NSCopying> *)otherValue;
- (void)removeValue:(NSObject<NSCopying> *)target;
- (NSArray *)classes;
@property (readonly, copy) NSArray<Class> *classes;
 
@end
Loading
Loading
@@ -39,7 +39,7 @@
BOOL scrollbarShouldBeVisible;
}
 
- (id)initFromRealWindow:(NSWindowController<iTermWindowController> *)aTerm
- (instancetype)initFromRealWindow:(NSWindowController<iTermWindowController> *)aTerm
session:(PTYSession*)aSession;
 
// PseudoTerminal should call this after adding the session to its tab view.
Loading
Loading
Loading
Loading
@@ -28,9 +28,7 @@
#import <Cocoa/Cocoa.h>
 
 
@interface FindView : NSView {
}
@interface FindView : NSView
 
- (void)drawRect:(NSRect)rect;
 
Loading
Loading
Loading
Loading
@@ -78,8 +78,7 @@
 
 
@interface FindViewController : NSViewController <NSTextFieldDelegate>
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
- (void)dealloc;
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
- (void)close;
- (void)open;
- (void)makeVisible;
Loading
Loading
Loading
Loading
@@ -38,6 +38,6 @@
@property (nonatomic, assign) NSSize size;
@property (nonatomic, assign) double baseline;
 
+ (id)fontSizeEstimatorForFont:(NSFont *)aFont;
+ (instancetype)fontSizeEstimatorForFont:(NSFont *)aFont;
 
@end
Loading
Loading
@@ -23,6 +23,7 @@
 
@class GTMCarbonEventHandler;
@class GTMCarbonHotKey;
@protocol GTMCarbonEventHandlerDelegate;
 
// Objective C wrapper for a Carbon Event
@interface GTMCarbonEvent : NSObject <NSCopying> {
Loading
Loading
@@ -36,70 +37,71 @@
// Returns:
// Autoreleased GTMCarbonEvent
//
+ (id)eventWithClass:(UInt32)inClass kind:(UInt32)kind;
+ (instancetype)eventWithClass:(UInt32)inClass kind:(UInt32)kind;
 
// Create an event based on |event|. Retains |event|.
//
// Returns:
// Autoreleased GTMCarbonEvent
//
+ (id)eventWithEvent:(EventRef)event;
+ (instancetype)eventWithEvent:(EventRef)event;
 
// Create an event based on the event currently being handled.
//
// Returns:
// Autoreleased GTMCarbonEvent
//
+ (id)currentEvent;
+ (instancetype)currentEvent;
 
// Create an event of class |inClass| and kind |inKind|
//
// Returns:
// GTMCarbonEvent
//
- (id)initWithClass:(UInt32)inClass kind:(UInt32)kind;
- (instancetype)initWithClass:(UInt32)inClass kind:(UInt32)kind;
 
// Create an event based on |event|. Retains |event|.
//
// Returns:
// GTMCarbonEvent
//
- (id)initWithEvent:(EventRef)event;
- (instancetype)initWithEvent:(EventRef)event;
 
// Get the event's class.
//
// Returns:
// event class
//
- (UInt32)eventClass;
@property (readonly) UInt32 eventClass;
 
// Get the event's kind.
//
// Returns:
// event kind
//
- (UInt32)eventKind;
@property (readonly) UInt32 eventKind;
 
// Set the event's time.
//
// Arguments:
// time - the time you want associated with the event
//
- (void)setTime:(EventTime)eventTime;
@property EventTime time;
//- (void)setTime:(EventTime)eventTime;
 
// Get the event's time.
//
// Returns:
// the time associated with the event
//
- (EventTime)time;
//- (EventTime)time;
 
// Get the event's eventref for passing to other carbon functions.
//
// Returns:
// the event ref associated with the event
//
- (EventRef)event;
@property (readonly) EventRef event;
 
// Sets (or adds) a parameter to an event. Try not to use this function
// directly. Look at the PARAM_TEMPLATE_DECL/DEFN macros below.
Loading
Loading
@@ -278,32 +280,33 @@ GTM_EXTERN NSUInteger GTMCarbonToCocoaKeyModifiers(UInt32 inCarbonModifiers);
// Returns:
// The event target ref.
//
- (EventTargetRef)eventTarget;
@property (readonly) EventTargetRef eventTarget;
 
// Gets the underlying EventHandlerRef for that this class wraps.
//
// Returns:
// The EventHandlerRef this class wraps.
//
- (EventHandlerRef)eventHandler;
@property (readonly) EventHandlerRef eventHandler;
 
// Gets the delegate for the handler
//
// Returns:
// the delegate
- (id)delegate;
@property (nonatomic, assign) id<GTMCarbonEventHandlerDelegate> delegate;
//- (id)delegate;
 
// Sets the delegate for the handler
//
// Arguments:
// delegate - the delegate to set to
- (void)setDelegate:(id)delegate;
//- (void)setDelegate:(id)delegate;
 
@end
 
// Category for methods that a delegate of GTMCarbonEventHandlerDelegate may
// want to implement.
@interface NSObject (GTMCarbonEventHandlerDelegate)
@protocol GTMCarbonEventHandlerDelegate <NSObject>
 
// If a delegate implements this method it gets called before every event
// that the handler gets sent. If it returns anything but eventNotHandledErr,
Loading
Loading
Loading
Loading
@@ -24,7 +24,7 @@
 
// Wrapper for all the info we need about a hotkey that we can store in a
// Foundation storage class.
@interface GTMCarbonHotKey (GTMCarbonHotKeyPrivate)
@interface GTMCarbonHotKey ()
 
// Create a HotKey record
// Arguments:
Loading
Loading
@@ -352,6 +352,7 @@ NSUInteger GTMCarbonToCocoaKeyModifiers(UInt32 inCarbonModifiers) {
const OSType kGTMCarbonFrameworkSignature = 'GTM ';
 
@implementation GTMCarbonEventHandler
@synthesize delegate = delegate_;
 
// Does our delegate respond to eventHandler:receivedEvent:handler:
//
Loading
Loading
@@ -467,9 +468,6 @@ static OSStatus EventHandler(EventHandlerCallRef inHandler,
//
// Returns:
// the delegate
- (id)delegate {
return delegate_;
}
 
// Sets the delegate for the handler and caches whether it responds to
// the eventHandler:receivedEvent:handler: selector for performance purposes.
Loading
Loading
Loading
Loading
@@ -30,8 +30,7 @@
#import "FutureMethods.h"
 
@interface GlobalSearchView : NSView
{
}
 
- (void)drawRect:(NSRect)rect;
 
Loading
Loading
@@ -49,19 +48,13 @@
 
@end
 
@interface GlobalSearch : NSViewController
@interface GlobalSearch : NSViewController <NSTableViewDataSource>
 
- (void)awakeFromNib;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
- (void)dealloc;
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
- (void)controlTextDidChange:(NSNotification *)aNotification;
- (void)setDelegate:(id<GlobalSearchDelegate>)delegate;
- (int)numResults;
- (void)abort;
 
#pragma mark NSTableView dataSource
- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex;
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification;
@end
Loading
Loading
@@ -64,7 +64,6 @@ const double GLOBAL_SEARCH_MARGIN = 10;
- (id)initWithSession:(PTYSession *)session
findString:(NSString*)findString
label:(NSString*)label;
- (void)dealloc;
- (BOOL)more;
- (NSArray*)results;
- (NSString*)label;
Loading
Loading
@@ -85,7 +84,6 @@ const double GLOBAL_SEARCH_MARGIN = 10;
}
 
- (id)initWithInstance:(GlobalSearchInstance*)instance context:(NSString*)theContext x:(int)x absY:(long long)absY endX:(int)endX y:(long long)absEndY findString:(NSString*)findString;
- (void)dealloc;
- (NSString*)context;
- (NSString*)findString;
- (GlobalSearchInstance*)instance;
Loading
Loading
Loading
Loading
@@ -11,7 +11,7 @@
@interface HighlightTrigger : Trigger
 
+ (NSString *)title;
- (BOOL)takesParameter;
- (BOOL)paramIsPopupButton;
@property (readonly) BOOL takesParameter;
@property (readonly) BOOL paramIsPopupButton;
 
@end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment