Remove instance data from header

Also add type-safety by introducing a protocol for the delegate.
This commit is contained in:
Allan Odgaard
2013-01-22 06:36:31 +01:00
parent 3c92d2aeb9
commit 49a822c0d5
3 changed files with 29 additions and 21 deletions

View File

@@ -1,21 +1,15 @@
#import <OakAppKit/OakStatusBar.h>
#import <text/types.h>
@protocol OTVStatusBarDelegate <NSObject>
- (void)showLanguageSelector:(id)sender;
- (void)showBundleItemSelector:(id)sender;
- (void)showTabSizeSelector:(id)sender;
- (void)showSymbolSelector:(id)sender;
- (void)toggleMacroRecording:(id)sender;
@end
@interface OTVStatusBar : OakStatusBar
{
text::range_t caretPosition;
NSString* grammarName;
NSString* symbolName;
BOOL isMacroRecording;
BOOL softTabs;
int32_t tabSize;
id delegate;
NSImage* pulsedRecordingIndicator;
NSTimer* recordingTimer;
CGFloat recordingTime;
}
- (void)setCaretPosition:(std::string const&)range;
@property (nonatomic, copy) NSString* grammarName;
@property (nonatomic, copy) NSString* symbolName;
@@ -23,5 +17,5 @@
@property (nonatomic, assign) BOOL softTabs;
@property (nonatomic, assign) int32_t tabSize;
@property (nonatomic, assign) id delegate;
@property (nonatomic, assign) id <OTVStatusBarDelegate> delegate;
@end

View File

@@ -2,6 +2,20 @@
#import <OakAppKit/NSImage Additions.h>
@interface OTVStatusBar ()
{
text::range_t caretPosition;
NSString* grammarName;
NSString* symbolName;
BOOL isMacroRecording;
BOOL softTabs;
int32_t tabSize;
id <OTVStatusBarDelegate> delegate;
NSImage* pulsedRecordingIndicator;
NSTimer* recordingTimer;
CGFloat recordingTime;
}
- (void)update;
@property (nonatomic, retain) NSTimer* recordingTimer;
@property (nonatomic, retain) NSImage* pulsedRecordingIndicator;

View File

@@ -31,7 +31,7 @@ static NSString* const kFoldingsColumnIdentifier = @"foldings";
}
@end
@interface OakDocumentView ()
@interface OakDocumentView () <OTVStatusBarDelegate>
@property (nonatomic, readonly) OTVStatusBar* statusBar;
@property (nonatomic, retain) NSDictionary* gutterImages;
@property (nonatomic, retain) NSDictionary* gutterHoverImages;
@@ -469,7 +469,7 @@ private:
}
}
- (IBAction)showLanguageSelector:(id)sender
- (void)showLanguageSelector:(id)sender
{
std::multimap<std::string, bundles::item_ptr, text::less_t> grammars;
citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeGrammar))
@@ -502,7 +502,7 @@ private:
[textView setSelectionString:[sender representedObject]];
}
- (IBAction)showSymbolSelector:(id)sender
- (void)showSymbolSelector:(id)sender
{
ng::buffer_t const& buf = document->buffer();
text::selection_t sel([textView.selectionString UTF8String]);
@@ -531,7 +531,7 @@ private:
[statusBar showMenu:menu withSelectedIndex:(index ? index-1 : 0) forCellWithTag:[sender tag] font:[NSFont controlContentFontOfSize:[NSFont smallSystemFontSize]] popup:YES];
}
- (IBAction)showBundleItemSelector:(id)sender
- (void)showBundleItemSelector:(id)sender
{
std::multimap<std::string, bundles::item_ptr, text::less_t> ordered;
citerate(item, bundles::query(bundles::kFieldAny, NULL_STR, scope::wildcard, bundles::kItemTypeBundle))
@@ -561,7 +561,7 @@ private:
[menu release];
}
- (IBAction)showTabSizeSelector:(id)sender
- (void)showTabSizeSelector:(id)sender
{
NSInteger index = 0;
NSInteger sizes[] = { 2, 3, 4, 8 };
@@ -623,7 +623,7 @@ private:
[tabSizeSelectorPanel makeKeyAndOrderFront:self];
}
- (IBAction)toggleMacroRecording:(id)sender { [textView toggleMacroRecording:sender]; }
- (void)toggleMacroRecording:(id)sender { [textView toggleMacroRecording:sender]; }
- (IBAction)takeThemeUUIDFrom:(id)sender
{