From 49a822c0d544fe0934639bdfee51f2f4740e3ea4 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Tue, 22 Jan 2013 06:36:31 +0100 Subject: [PATCH] Remove instance data from header Also add type-safety by introducing a protocol for the delegate. --- Frameworks/OakTextView/src/OTVStatusBar.h | 24 +++++++------------ Frameworks/OakTextView/src/OTVStatusBar.mm | 14 +++++++++++ Frameworks/OakTextView/src/OakDocumentView.mm | 12 +++++----- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/Frameworks/OakTextView/src/OTVStatusBar.h b/Frameworks/OakTextView/src/OTVStatusBar.h index a5d0524b..21199b2c 100644 --- a/Frameworks/OakTextView/src/OTVStatusBar.h +++ b/Frameworks/OakTextView/src/OTVStatusBar.h @@ -1,21 +1,15 @@ #import #import +@protocol OTVStatusBarDelegate +- (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 delegate; @end diff --git a/Frameworks/OakTextView/src/OTVStatusBar.mm b/Frameworks/OakTextView/src/OTVStatusBar.mm index 7f2ed8d2..09178e19 100644 --- a/Frameworks/OakTextView/src/OTVStatusBar.mm +++ b/Frameworks/OakTextView/src/OTVStatusBar.mm @@ -2,6 +2,20 @@ #import @interface OTVStatusBar () +{ + text::range_t caretPosition; + NSString* grammarName; + NSString* symbolName; + BOOL isMacroRecording; + BOOL softTabs; + int32_t tabSize; + + id delegate; + + NSImage* pulsedRecordingIndicator; + NSTimer* recordingTimer; + CGFloat recordingTime; +} - (void)update; @property (nonatomic, retain) NSTimer* recordingTimer; @property (nonatomic, retain) NSImage* pulsedRecordingIndicator; diff --git a/Frameworks/OakTextView/src/OakDocumentView.mm b/Frameworks/OakTextView/src/OakDocumentView.mm index 2d93898f..08bc5149 100644 --- a/Frameworks/OakTextView/src/OakDocumentView.mm +++ b/Frameworks/OakTextView/src/OakDocumentView.mm @@ -31,7 +31,7 @@ static NSString* const kFoldingsColumnIdentifier = @"foldings"; } @end -@interface OakDocumentView () +@interface OakDocumentView () @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 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 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 {