diff --git a/Frameworks/HTMLOutput/src/HTMLOutput.mm b/Frameworks/HTMLOutput/src/HTMLOutput.mm
index 497455b5..76d63724 100644
--- a/Frameworks/HTMLOutput/src/HTMLOutput.mm
+++ b/Frameworks/HTMLOutput/src/HTMLOutput.mm
@@ -156,7 +156,7 @@ namespace
- (void)startLoading
{
- NSURLResponse* response = [[[NSURLResponse alloc] initWithURL:[[self request] URL] MIMEType:@"text/html" expectedContentLength:-1 textEncodingName:@"utf-8"] autorelease];
+ NSURLResponse* response = [[NSURLResponse alloc] initWithURL:[[self request] URL] MIMEType:@"text/html" expectedContentLength:-1 textEncodingName:@"utf-8"];
[[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
// WebView seems to stall until it has received at least 1024 bytes
diff --git a/Frameworks/HTMLOutput/src/OakHTMLOutputView.h b/Frameworks/HTMLOutput/src/OakHTMLOutputView.h
index c2723fdf..c3245b1a 100644
--- a/Frameworks/HTMLOutput/src/OakHTMLOutputView.h
+++ b/Frameworks/HTMLOutput/src/OakHTMLOutputView.h
@@ -1,13 +1,6 @@
-#import
#import "browser/HOBrowserView.h"
-
-@class HOAutoScroll;
+#import
PUBLIC @interface OakHTMLOutputView : HOBrowserView
-{
- HOAutoScroll* autoScrollHelper;
- std::map environment;
- BOOL runningCommand;
-}
@property (nonatomic, readonly) BOOL runningCommand;
@end
diff --git a/Frameworks/HTMLOutput/src/OakHTMLOutputView.mm b/Frameworks/HTMLOutput/src/OakHTMLOutputView.mm
index d8aad2d3..3f86ae38 100644
--- a/Frameworks/HTMLOutput/src/OakHTMLOutputView.mm
+++ b/Frameworks/HTMLOutput/src/OakHTMLOutputView.mm
@@ -8,26 +8,23 @@ extern NSString* const kCommandRunnerURLScheme; // from HTMLOutput.h
@interface OakHTMLOutputView ()
@property (nonatomic, assign) BOOL runningCommand;
+@property (nonatomic, retain) HOAutoScroll* autoScrollHelper;
@end
@implementation OakHTMLOutputView
-@synthesize runningCommand;
+{
+ std::map environment;
+}
- (id)initWithFrame:(NSRect)frame
{
if(self = [super initWithFrame:frame])
{
- autoScrollHelper = [HOAutoScroll new];
+ self.autoScrollHelper = [HOAutoScroll new];
}
return self;
}
-- (void)dealloc
-{
- [autoScrollHelper release];
- [super dealloc];
-}
-
- (BOOL)isOpaque
{
return YES;
@@ -44,20 +41,20 @@ extern NSString* const kCommandRunnerURLScheme; // from HTMLOutput.h
- (void)loadRequest:(NSURLRequest*)aRequest autoScrolls:(BOOL)flag
{
- autoScrollHelper.webFrame = flag ? webView.mainFrame.frameView : nil;
+ _autoScrollHelper.webFrame = flag ? self.webView.mainFrame.frameView : nil;
self.runningCommand = [[[aRequest URL] scheme] isEqualToString:kCommandRunnerURLScheme];
- [webView.mainFrame loadRequest:aRequest];
+ [self.webView.mainFrame loadRequest:aRequest];
}
- (void)stopLoading
{
- [webView.mainFrame stopLoading];
+ [self.webView.mainFrame stopLoading];
}
- (void)webView:(WebView*)sender didStartProvisionalLoadForFrame:(WebFrame*)frame
{
- statusBar.isBusy = YES;
- if(NSString* scheme = [[[[[webView mainFrame] provisionalDataSource] request] URL] scheme])
+ self.statusBar.isBusy = YES;
+ if(NSString* scheme = [[[[[self.webView mainFrame] provisionalDataSource] request] URL] scheme])
[self setUpdatesProgress:![scheme isEqualToString:kCommandRunnerURLScheme]];
}
@@ -67,11 +64,11 @@ extern NSString* const kCommandRunnerURLScheme; // from HTMLOutput.h
- (void)webView:(WebView*)sender didClearWindowObject:(WebScriptObject*)windowScriptObject forFrame:(WebFrame*)frame
{
- NSString* scheme = [[[[[webView mainFrame] dataSource] request] URL] scheme];
+ NSString* scheme = [[[[[self.webView mainFrame] dataSource] request] URL] scheme];
if([@[ kCommandRunnerURLScheme, @"tm-file", @"file" ] containsObject:scheme])
{
- HOJSBridge* bridge = [[HOJSBridge new] autorelease];
- [bridge setDelegate:statusBar];
+ HOJSBridge* bridge = [HOJSBridge new];
+ [bridge setDelegate:self.statusBar];
[bridge setEnvironment:environment];
[windowScriptObject setValue:bridge forKey:@"TextMate"];
}
diff --git a/Frameworks/HTMLOutput/src/browser/HOBrowserView.h b/Frameworks/HTMLOutput/src/browser/HOBrowserView.h
index 3c89df95..8b49fa01 100644
--- a/Frameworks/HTMLOutput/src/browser/HOBrowserView.h
+++ b/Frameworks/HTMLOutput/src/browser/HOBrowserView.h
@@ -1,16 +1,10 @@
-#import
+#import
@class HOStatusBar;
-@class HOWebViewDelegateHelper;
@interface HOBrowserView : NSView
-{
- OBJC_WATCH_LEAKS(HOBrowserView);
- WebView* webView;
- HOStatusBar* statusBar;
- HOWebViewDelegateHelper* webViewDelegateHelper;
-}
@property (nonatomic, readonly) WebView* webView;
+@property (nonatomic, readonly) HOStatusBar* statusBar;
@property (nonatomic, retain) NSString* projectUUID;
- (void)setUpdatesProgress:(BOOL)flag;
@end
diff --git a/Frameworks/HTMLOutput/src/browser/HOBrowserView.mm b/Frameworks/HTMLOutput/src/browser/HOBrowserView.mm
index 363a3f94..325754ff 100644
--- a/Frameworks/HTMLOutput/src/browser/HOBrowserView.mm
+++ b/Frameworks/HTMLOutput/src/browser/HOBrowserView.mm
@@ -4,9 +4,13 @@
#import
#import
-@implementation HOBrowserView
-@synthesize webView;
+@interface HOBrowserView ()
+@property (nonatomic, readwrite) WebView* webView;
+@property (nonatomic, readwrite) HOStatusBar* statusBar;
+@property (nonatomic, retain) HOWebViewDelegateHelper* webViewDelegateHelper;
+@end
+@implementation HOBrowserView
+ (BOOL)requiresConstraintBasedLayout
{
return YES;
@@ -21,52 +25,50 @@
{
if(self = [super initWithFrame:frame])
{
- webView = [[WebView alloc] initWithFrame:NSZeroRect];
+ _webView = [[WebView alloc] initWithFrame:NSZeroRect];
- statusBar = [[HOStatusBar alloc] initWithFrame:NSZeroRect];
- statusBar.delegate = webView;
+ _statusBar = [[HOStatusBar alloc] initWithFrame:NSZeroRect];
+ _statusBar.delegate = _webView;
- webViewDelegateHelper = [HOWebViewDelegateHelper new];
- webViewDelegateHelper.delegate = statusBar;
- webView.policyDelegate = webViewDelegateHelper;
- webView.resourceLoadDelegate = webViewDelegateHelper;
- webView.UIDelegate = webViewDelegateHelper;
- webView.frameLoadDelegate = self;
+ _webViewDelegateHelper = [HOWebViewDelegateHelper new];
+ _webViewDelegateHelper.delegate = _statusBar;
+ _webView.policyDelegate = _webViewDelegateHelper;
+ _webView.resourceLoadDelegate = _webViewDelegateHelper;
+ _webView.UIDelegate = _webViewDelegateHelper;
+ _webView.frameLoadDelegate = self;
- NSBox* divider = OakCreateViewWithColor([NSColor colorWithString:@"#9d9d9d"]);
+ NSDictionary* views = @{
+ @"webView" : _webView,
+ @"divider" : OakCreateViewWithColor([NSColor colorWithString:@"#9d9d9d"]),
+ @"statusBar" : _statusBar
+ };
- NSDictionary* views = NSDictionaryOfVariableBindings(webView, divider, statusBar);
for(NSView* view in [views allValues])
{
[view setTranslatesAutoresizingMaskIntoConstraints:NO];
[self addSubview:view];
}
- [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[webView(==statusBar,==divider)]|" options:NSLayoutFormatAlignAllTop metrics:nil views:views]];
+ [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[webView(==statusBar,==divider)]|" options:NSLayoutFormatAlignAllTop metrics:nil views:views]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[webView(>=10)][divider(==1)][statusBar]|" options:NSLayoutFormatAlignAllLeading metrics:nil views:views]];
}
return self;
}
-- (NSString*)projectUUID { return webViewDelegateHelper.projectUUID; }
-- (void)setProjectUUID:(NSString*)aProjectUUID { webViewDelegateHelper.projectUUID = aProjectUUID; }
+- (NSString*)projectUUID { return _webViewDelegateHelper.projectUUID; }
+- (void)setProjectUUID:(NSString*)aProjectUUID { _webViewDelegateHelper.projectUUID = aProjectUUID; }
- (void)webViewProgressEstimateChanged:(NSNotification*)notification
{
- statusBar.progress = webView.estimatedProgress;
+ _statusBar.progress = _webView.estimatedProgress;
}
- (void)dealloc
{
[self setUpdatesProgress:NO];
- [webView setResourceLoadDelegate:nil];
- [webView setFrameLoadDelegate:nil];
- [[webView mainFrame] stopLoading];
-
- [webView release];
- [webViewDelegateHelper release];
- [statusBar release];
- [super dealloc];
+ [_webView setResourceLoadDelegate:nil];
+ [_webView setFrameLoadDelegate:nil];
+ [[_webView mainFrame] stopLoading];
}
- (BOOL)isOpaque
@@ -76,25 +78,25 @@
- (void)swipeWithEvent:(NSEvent*)anEvent
{
- if([anEvent deltaX] == +1 && webView.canGoBack)
- [webView goBack:self];
- else if([anEvent deltaX] == -1 && webView.canGoForward)
- [webView goForward:self];
+ if([anEvent deltaX] == +1 && _webView.canGoBack)
+ [_webView goBack:self];
+ else if([anEvent deltaX] == -1 && _webView.canGoForward)
+ [_webView goForward:self];
}
- (void)setUpdatesProgress:(BOOL)flag
{
if(flag)
{
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewProgressEstimateChanged:) name:WebViewProgressFinishedNotification object:webView];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewProgressEstimateChanged:) name:WebViewProgressEstimateChangedNotification object:webView];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewProgressEstimateChanged:) name:WebViewProgressStartedNotification object:webView];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewProgressEstimateChanged:) name:WebViewProgressFinishedNotification object:_webView];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewProgressEstimateChanged:) name:WebViewProgressEstimateChangedNotification object:_webView];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewProgressEstimateChanged:) name:WebViewProgressStartedNotification object:_webView];
}
else
{
- [[NSNotificationCenter defaultCenter] removeObserver:self name:WebViewProgressStartedNotification object:webView];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:WebViewProgressEstimateChangedNotification object:webView];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:WebViewProgressFinishedNotification object:webView];
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:WebViewProgressStartedNotification object:_webView];
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:WebViewProgressEstimateChangedNotification object:_webView];
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:WebViewProgressFinishedNotification object:_webView];
}
}
@@ -104,15 +106,15 @@
- (void)webView:(WebView*)sender didStartProvisionalLoadForFrame:(WebFrame*)frame
{
- statusBar.isBusy = YES;
+ _statusBar.isBusy = YES;
[self setUpdatesProgress:YES];
}
- (void)webView:(WebView*)sender didFinishLoadForFrame:(WebFrame*)frame
{
- statusBar.canGoBack = webView.canGoBack;
- statusBar.canGoForward = webView.canGoForward;
- statusBar.isBusy = NO;
- statusBar.progress = 0;
+ _statusBar.canGoBack = _webView.canGoBack;
+ _statusBar.canGoForward = _webView.canGoForward;
+ _statusBar.isBusy = NO;
+ _statusBar.progress = 0;
}
@end
diff --git a/Frameworks/HTMLOutput/src/browser/HOStatusBar.h b/Frameworks/HTMLOutput/src/browser/HOStatusBar.h
index 6eca790f..8363cb94 100644
--- a/Frameworks/HTMLOutput/src/browser/HOStatusBar.h
+++ b/Frameworks/HTMLOutput/src/browser/HOStatusBar.h
@@ -4,11 +4,11 @@
@end
@interface HOStatusBar : NSView
-@property (nonatomic, assign) BOOL isBusy;
-@property (nonatomic, assign) CGFloat progress;
-@property (nonatomic, retain) NSString* statusText;
-@property (nonatomic, assign) BOOL canGoBack;
-@property (nonatomic, assign) BOOL canGoForward;
+@property (nonatomic, weak) id delegate;
-@property (nonatomic, assign) id delegate;
+@property (nonatomic) NSString* statusText;
+@property (nonatomic) CGFloat progress;
+@property (nonatomic) BOOL isBusy;
+@property (nonatomic) BOOL canGoBack;
+@property (nonatomic) BOOL canGoForward;
@end
diff --git a/Frameworks/HTMLOutput/src/browser/HOStatusBar.mm b/Frameworks/HTMLOutput/src/browser/HOStatusBar.mm
index ad2439e7..05a676c3 100644
--- a/Frameworks/HTMLOutput/src/browser/HOStatusBar.mm
+++ b/Frameworks/HTMLOutput/src/browser/HOStatusBar.mm
@@ -3,12 +3,12 @@
static NSButton* OakCreateImageButton (NSString* imageName)
{
- NSButton* res = [[NSButton new] autorelease];
+ NSButton* res = [NSButton new];
[res setButtonType:NSMomentaryChangeButton];
[res setBezelStyle:NSSmallSquareBezelStyle];
[res setBordered:NO];
- NSImage* image = [[[NSImage imageNamed:imageName] copy] autorelease];
+ NSImage* image = [[NSImage imageNamed:imageName] copy];
[image setSize:NSMakeSize(13, 13)];
[res setImage:image];
[res setImagePosition:NSImageOnly];
@@ -18,7 +18,7 @@ static NSButton* OakCreateImageButton (NSString* imageName)
static NSTextField* OakCreateTextField ()
{
- NSTextField* res = [[[NSTextField alloc] initWithFrame:NSZeroRect] autorelease];
+ NSTextField* res = [[NSTextField alloc] initWithFrame:NSZeroRect];
[res setBordered:NO];
[res setEditable:NO];
[res setSelectable:NO];
@@ -30,22 +30,22 @@ static NSTextField* OakCreateTextField ()
static NSImageView* OakCreateImageView (NSImage* image)
{
- NSImageView* res = [[[NSImageView alloc] initWithFrame:NSZeroRect] autorelease];
+ NSImageView* res = [[NSImageView alloc] initWithFrame:NSZeroRect];
[res setImage:image];
return res;
}
@interface HOStatusBar ()
-@property (nonatomic, retain) NSImage* backgroundImage;
-@property (nonatomic, retain) NSImageView* firstSeparatorImageView;
-@property (nonatomic, retain) NSImageView* secondSeparatorImageView;
-@property (nonatomic, retain) NSButton* goBackButton;
-@property (nonatomic, retain) NSButton* goForwardButton;
-@property (nonatomic, retain) NSTextField* statusTextField;
-@property (nonatomic, retain) NSProgressIndicator* progressIndicator;
-@property (nonatomic, retain) NSProgressIndicator* spinner;
-@property (nonatomic, retain) NSMutableArray* layoutConstraints;
-@property (nonatomic, assign) BOOL indeterminateProgress;
+@property (nonatomic) NSImage* backgroundImage;
+@property (nonatomic) NSImageView* firstSeparatorImageView;
+@property (nonatomic) NSImageView* secondSeparatorImageView;
+@property (nonatomic) NSButton* goBackButton;
+@property (nonatomic) NSButton* goForwardButton;
+@property (nonatomic) NSTextField* statusTextField;
+@property (nonatomic) NSProgressIndicator* progressIndicator;
+@property (nonatomic) NSProgressIndicator* spinner;
+@property (nonatomic) NSMutableArray* layoutConstraints;
+@property (nonatomic) BOOL indeterminateProgress;
@end
@implementation HOStatusBar
@@ -55,25 +55,25 @@ static NSImageView* OakCreateImageView (NSImage* image)
{
_indeterminateProgress = YES;
- self.backgroundImage = [NSImage imageNamed:@"Statusbar Background" inSameBundleAsClass:NSClassFromString(@"OakStatusBar")];
- self.firstSeparatorImageView = OakCreateImageView([NSImage imageNamed:@"Statusbar Separator" inSameBundleAsClass:NSClassFromString(@"OakStatusBar")]);
- self.secondSeparatorImageView = OakCreateImageView([NSImage imageNamed:@"Statusbar Separator" inSameBundleAsClass:NSClassFromString(@"OakStatusBar")]);
+ _backgroundImage = [NSImage imageNamed:@"Statusbar Background" inSameBundleAsClass:NSClassFromString(@"OakStatusBar")];
+ _firstSeparatorImageView = OakCreateImageView([NSImage imageNamed:@"Statusbar Separator" inSameBundleAsClass:NSClassFromString(@"OakStatusBar")]);
+ _secondSeparatorImageView = OakCreateImageView([NSImage imageNamed:@"Statusbar Separator" inSameBundleAsClass:NSClassFromString(@"OakStatusBar")]);
- self.goBackButton = OakCreateImageButton(NSImageNameGoLeftTemplate);
- self.goBackButton.toolTip = @"Show the previous page";
- self.goBackButton.enabled = NO;
- self.goBackButton.target = self;
- self.goBackButton.action = @selector(goBack:);
+ _goBackButton = OakCreateImageButton(NSImageNameGoLeftTemplate);
+ _goBackButton.toolTip = @"Show the previous page";
+ _goBackButton.enabled = NO;
+ _goBackButton.target = self;
+ _goBackButton.action = @selector(goBack:);
- self.goForwardButton = OakCreateImageButton(NSImageNameGoRightTemplate);
- self.goForwardButton.toolTip = @"Show the next page";
- self.goForwardButton.enabled = NO;
- self.goForwardButton.target = self;
- self.goForwardButton.action = @selector(goForward:);
+ _goForwardButton = OakCreateImageButton(NSImageNameGoRightTemplate);
+ _goForwardButton.toolTip = @"Show the next page";
+ _goForwardButton.enabled = NO;
+ _goForwardButton.target = self;
+ _goForwardButton.action = @selector(goForward:);
- self.statusTextField = OakCreateTextField();
- [self.statusTextField setContentCompressionResistancePriority:NSLayoutPriorityDefaultLow forOrientation:NSLayoutConstraintOrientationHorizontal];
- [self.statusTextField.cell setLineBreakMode:NSLineBreakByTruncatingMiddle];
+ _statusTextField = OakCreateTextField();
+ [_statusTextField setContentCompressionResistancePriority:NSLayoutPriorityDefaultLow forOrientation:NSLayoutConstraintOrientationHorizontal];
+ [_statusTextField.cell setLineBreakMode:NSLineBreakByTruncatingMiddle];
_progressIndicator = [NSProgressIndicator new];
_progressIndicator.controlSize = NSSmallControlSize;
@@ -99,31 +99,16 @@ static NSImageView* OakCreateImageView (NSImage* image)
return self;
}
-- (void)dealloc
-{
- self.backgroundImage = nil;
- self.firstSeparatorImageView = nil;
- self.secondSeparatorImageView = nil;
- self.goBackButton = nil;
- self.goForwardButton = nil;
- self.statusTextField = nil;
- self.progressIndicator = nil;
- self.spinner = nil;
- self.layoutConstraints = nil;
-
- [super dealloc];
-}
-
- (NSSize)intrinsicContentSize
{
- return NSMakeSize(NSViewNoInstrinsicMetric, self.backgroundImage.size.height);
+ return NSMakeSize(NSViewNoInstrinsicMetric, _backgroundImage.size.height);
}
- (void)updateConstraints
{
- if(self.layoutConstraints)
- [self removeConstraints:self.layoutConstraints];
- self.layoutConstraints = [NSMutableArray array];
+ if(_layoutConstraints)
+ [self removeConstraints:_layoutConstraints];
+ _layoutConstraints = [NSMutableArray array];
[super updateConstraints];
diff --git a/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.h b/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.h
index c0c4d020..12aff221 100644
--- a/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.h
+++ b/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.h
@@ -1,13 +1,8 @@
@protocol HOWebViewDelegateHelperProtocol
-- (NSString*)statusText;
-- (void)setStatusText:(NSString*)text;
+@property (nonatomic, retain) NSString* statusText;
@end
@interface HOWebViewDelegateHelper : NSObject
-{
- id delegate;
- NSString* projectUUID;
-}
-@property (nonatomic, assign) id delegate;
+@property (nonatomic, weak) id /**/ delegate;
@property (nonatomic, retain) NSString* projectUUID;
@end
diff --git a/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.mm b/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.mm
index 84d3da10..077b3ba5 100644
--- a/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.mm
+++ b/Frameworks/HTMLOutput/src/browser/HOWebViewDelegateHelper.mm
@@ -4,26 +4,18 @@
#import
@implementation HOWebViewDelegateHelper
-@synthesize delegate, projectUUID;
-
-- (void)dealloc
-{
- [projectUUID release];
- [super dealloc];
-}
-
// =====================
// = WebViewUIDelegate =
// =====================
- (void)webView:(WebView*)sender setStatusText:(NSString*)text
{
- [delegate setStatusText:(text ?: @"")];
+ [_delegate setStatusText:(text ?: @"")];
}
- (NSString*)webViewStatusText:(WebView*)sender
{
- return [delegate statusText];
+ return [_delegate statusText];
}
- (void)webView:(WebView*)sender mouseDidMoveOverElement:(NSDictionary*)elementInformation modifierFlags:(NSUInteger)modifierFlags
@@ -56,7 +48,7 @@
NSPoint origin = [sender.window cascadeTopLeftFromPoint:NSMakePoint(NSMinX(sender.window.frame), NSMaxY(sender.window.frame))];
origin.y -= NSHeight(sender.window.frame);
- HOBrowserView* view = [[HOBrowserView new] autorelease];
+ HOBrowserView* view = [HOBrowserView new];
NSWindow* window = [[NSWindow alloc] initWithContentRect:(NSRect){origin, NSMakeSize(750, 800)}
styleMask:(NSTitledWindowMask|NSClosableWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask)
backing:NSBackingStoreBuffered
@@ -96,8 +88,8 @@
NSURL* url = request.URL;
if([[url scheme] isEqualToString:@"txmt"])
{
- if(projectUUID)
- url = [NSURL URLWithString:[[url absoluteString] stringByAppendingFormat:@"&project=%@", projectUUID]];
+ if(_projectUUID)
+ url = [NSURL URLWithString:[[url absoluteString] stringByAppendingFormat:@"&project=%@", _projectUUID]];
[NSApp sendAction:@selector(handleTxMtURL:) to:nil from:url];
}
else
diff --git a/Frameworks/HTMLOutput/src/helpers/HOAutoScroll.h b/Frameworks/HTMLOutput/src/helpers/HOAutoScroll.h
index fa361991..fdda52f0 100644
--- a/Frameworks/HTMLOutput/src/helpers/HOAutoScroll.h
+++ b/Frameworks/HTMLOutput/src/helpers/HOAutoScroll.h
@@ -1,7 +1,3 @@
@interface HOAutoScroll : NSObject
-{
- WebFrameView* webFrame;
- NSRect lastFrame, lastVisibleRect;
-}
-@property (nonatomic, retain) WebFrameView* webFrame;
+@property (nonatomic) WebFrameView* webFrame;
@end
diff --git a/Frameworks/HTMLOutput/src/helpers/HOAutoScroll.mm b/Frameworks/HTMLOutput/src/helpers/HOAutoScroll.mm
index a4c434e2..74a12e31 100644
--- a/Frameworks/HTMLOutput/src/helpers/HOAutoScroll.mm
+++ b/Frameworks/HTMLOutput/src/helpers/HOAutoScroll.mm
@@ -3,9 +3,12 @@
OAK_DEBUG_VAR(HTMLOutput_AutoScroll);
-@implementation HOAutoScroll
-@synthesize webFrame;
+@interface HOAutoScroll ()
+@property (nonatomic) NSRect lastFrame;
+@property (nonatomic) NSRect lastVisibleRect;
+@end
+@implementation HOAutoScroll
- (void)scrollViewToBottom:(NSView*)aView
{
NSRect visibleRect = [aView visibleRect];
@@ -17,25 +20,21 @@ OAK_DEBUG_VAR(HTMLOutput_AutoScroll);
{
D(DBF_HTMLOutput_AutoScroll, bug("\n"););
self.webFrame = nil;
- [super dealloc];
}
- (void)setWebFrame:(WebFrameView*)aWebFrame
{
D(DBF_HTMLOutput_AutoScroll, bug("%s\n", [aWebFrame description].UTF8String););
- if(aWebFrame == webFrame)
+ if(aWebFrame == _webFrame)
return;
- [webFrame release];
- webFrame = [aWebFrame retain];
-
- if(webFrame)
+ if(_webFrame = aWebFrame)
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewDidChangeFrame:) name:NSViewFrameDidChangeNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewDidChangeBounds:) name:NSViewBoundsDidChangeNotification object:nil];
- lastFrame = [[webFrame documentView] frame];
- lastVisibleRect = [[webFrame documentView] visibleRect];
+ _lastFrame = [[_webFrame documentView] frame];
+ _lastVisibleRect = [[_webFrame documentView] visibleRect];
}
else
{
@@ -46,39 +45,39 @@ OAK_DEBUG_VAR(HTMLOutput_AutoScroll);
- (void)webViewDidChangeBounds:(NSNotification*)aNotification
{
- NSClipView* clipView = [[[webFrame documentView] enclosingScrollView] contentView];
+ NSClipView* clipView = [[[_webFrame documentView] enclosingScrollView] contentView];
if(clipView != [aNotification object])
return;
- D(DBF_HTMLOutput_AutoScroll, bug("bounds changed: %s → %s\n", NSStringFromRect(lastVisibleRect).UTF8String, NSStringFromRect([[clipView documentView] visibleRect]).UTF8String););
- lastVisibleRect = [[clipView documentView] visibleRect];
+ D(DBF_HTMLOutput_AutoScroll, bug("bounds changed: %s → %s\n", NSStringFromRect(_lastVisibleRect).UTF8String, NSStringFromRect([[clipView documentView] visibleRect]).UTF8String););
+ _lastVisibleRect = [[clipView documentView] visibleRect];
}
- (void)webViewDidChangeFrame:(NSNotification*)aNotification
{
NSView* view = [aNotification object];
- if(view != webFrame && view != [webFrame documentView])
+ if(view != _webFrame && view != [_webFrame documentView])
return;
- if(view == [webFrame documentView])
+ if(view == [_webFrame documentView])
{
- D(DBF_HTMLOutput_AutoScroll, bug("frame changed: %s → %s\n", NSStringFromRect(lastFrame).UTF8String, NSStringFromRect([view frame]).UTF8String););
- if(NSMaxY(lastVisibleRect) >= NSMaxY(lastFrame))
+ D(DBF_HTMLOutput_AutoScroll, bug("frame changed: %s → %s\n", NSStringFromRect(_lastFrame).UTF8String, NSStringFromRect([view frame]).UTF8String););
+ if(NSMaxY(_lastVisibleRect) >= NSMaxY(_lastFrame))
{
D(DBF_HTMLOutput_AutoScroll, bug("scroll to bottom\n"););
[self scrollViewToBottom:view];
- lastVisibleRect = [view visibleRect];
+ _lastVisibleRect = [view visibleRect];
}
- lastFrame = [view frame];
+ _lastFrame = [view frame];
}
- if(view == webFrame)
+ if(view == _webFrame)
{
- D(DBF_HTMLOutput_AutoScroll, bug("vislble rect changed: %s → %s\n", NSStringFromRect(lastVisibleRect).UTF8String, NSStringFromRect([[webFrame documentView] visibleRect]).UTF8String););
- if(NSMaxY(lastVisibleRect) >= NSMaxY(lastFrame))
+ D(DBF_HTMLOutput_AutoScroll, bug("vislble rect changed: %s → %s\n", NSStringFromRect(_lastVisibleRect).UTF8String, NSStringFromRect([[webFrame documentView] visibleRect]).UTF8String););
+ if(NSMaxY(_lastVisibleRect) >= NSMaxY(_lastFrame))
{
D(DBF_HTMLOutput_AutoScroll, bug("scroll to bottom\n"););
- [self scrollViewToBottom:[webFrame documentView]];
+ [self scrollViewToBottom:[_webFrame documentView]];
}
}
}
diff --git a/Frameworks/HTMLOutput/src/helpers/HOJSBridge.h b/Frameworks/HTMLOutput/src/helpers/HOJSBridge.h
index da141ea8..64d90d5e 100644
--- a/Frameworks/HTMLOutput/src/helpers/HOJSBridge.h
+++ b/Frameworks/HTMLOutput/src/helpers/HOJSBridge.h
@@ -4,15 +4,11 @@
@end
@interface HOJSBridge : NSObject
-{
- id delegate;
- std::map environment;
- BOOL isBusy; // dummy key
- float progress; // dummy key
-}
+@property (nonatomic, weak) id /**/ delegate;
+
+- (void)setEnvironment:(const std::map&)variables;
+- (std::map const&)environment;
+
- (id)system:(NSString*)aCommand handler:(id)aHandler;
- (void)log:(NSString*)aMessage;
-- (std::map const&)environment;
-- (void)setDelegate:(id)aDelegate;
-- (void)setEnvironment:(const std::map&)variables;
@end
diff --git a/Frameworks/HTMLOutput/src/helpers/HOJSBridge.mm b/Frameworks/HTMLOutput/src/helpers/HOJSBridge.mm
index e3a1d71b..821ac204 100644
--- a/Frameworks/HTMLOutput/src/helpers/HOJSBridge.mm
+++ b/Frameworks/HTMLOutput/src/helpers/HOJSBridge.mm
@@ -20,8 +20,6 @@
std::vector outputData, errorData;
int status;
- id outputHandler, errorHandler, exitHandler;
-
oak::process_t* process;
bool didCloseInput;
io::reader_t* outputReader;
@@ -56,6 +54,14 @@
OAK_DEBUG_VAR(HTMLOutput_JSBridge);
@implementation HOJSBridge
+{
+ std::map environment;
+
+ // unused dummy keys to get them exposed to javascript
+ BOOL isBusy;
+ float progress;
+}
+
- (std::map const&)environment;
{
return environment;
@@ -94,22 +100,17 @@ OAK_DEBUG_VAR(HTMLOutput_JSBridge);
- (void)setIsBusy:(BOOL)flag
{
- [delegate setIsBusy:flag];
+ [_delegate setIsBusy:flag];
}
- (void)setProgress:(id)newProgress;
{
- [delegate setProgress:[newProgress floatValue]];
+ [(id )_delegate setProgress:[newProgress floatValue]];
}
- (double)progress
{
- return [delegate progress];
-}
-
-- (void)setDelegate:(id)aDelegate
-{
- delegate = aDelegate;
+ return [_delegate progress];
}
- (void)log:(NSString*)aMessage
@@ -180,8 +181,6 @@ OAK_DEBUG_VAR(HTMLOutput_JSShellCommand);
@end
@implementation HOJSShellCommand
-@synthesize outputHandler, errorHandler, exitHandler;
-
- (id)initWithCommand:(NSString*)aCommand andEnvironment:(const std::map&)someEnvironment
{
if(self = [super init])
@@ -198,8 +197,8 @@ OAK_DEBUG_VAR(HTMLOutput_JSShellCommand);
{
if(++completeCounter == 3)
{
- if(exitHandler)
- [exitHandler callWebScriptMethod:@"call" withArguments:@[ exitHandler, self ]];
+ if(_exitHandler)
+ [_exitHandler callWebScriptMethod:@"call" withArguments:@[ _exitHandler, self ]];
else runLoop.stop();
}
}
@@ -207,27 +206,27 @@ OAK_DEBUG_VAR(HTMLOutput_JSShellCommand);
- (void)outputDataReceived:(char const*)bytes length:(size_t)len
{
D(DBF_HTMLOutput_JSShellCommand, bug("%zu bytes\n", len););
- if(exitHandler)
+ if(_exitHandler)
outputData.erase(outputData.begin(), utf8::find_safe_end(outputData.begin(), outputData.end()));
outputData.insert(outputData.end(), bytes, bytes + len);
if(len == 0)
[self increaseCompleteCounter];
- else if(outputHandler)
- [outputHandler callWebScriptMethod:@"call" withArguments:@[ outputHandler, [self valueForKey:@"outputString"] ]];
+ else if(_outputHandler)
+ [_outputHandler callWebScriptMethod:@"call" withArguments:@[ _outputHandler, [self valueForKey:@"outputString"] ]];
}
- (void)errorDataReceived:(char const*)bytes length:(size_t)len
{
D(DBF_HTMLOutput_JSShellCommand, bug("%zu bytes\n", len););
- if(exitHandler)
+ if(_exitHandler)
errorData.erase(errorData.begin(), utf8::find_safe_end(errorData.begin(), errorData.end()));
errorData.insert(errorData.end(), bytes, bytes + len);
if(len == 0)
[self increaseCompleteCounter];
- else if(errorHandler)
- [errorHandler callWebScriptMethod:@"call" withArguments:@[ errorHandler, [self valueForKey:@"errorString"] ]];
+ else if(_errorHandler)
+ [_errorHandler callWebScriptMethod:@"call" withArguments:@[ _errorHandler, [self valueForKey:@"errorString"] ]];
}
- (void)processDidExit:(int)rc
@@ -340,7 +339,7 @@ OAK_DEBUG_VAR(HTMLOutput_JSShellCommand);
+ (HOJSShellCommand*)runShellCommand:(NSString*)aCommand withEnvironment:(const std::map&)someEnvironment andExitHandler:(id)aHandler
{
D(DBF_HTMLOutput_JSShellCommand, bug("%s (handler: %s)\n", [aCommand UTF8String], [[aHandler description] UTF8String]););
- HOJSShellCommand* res = [[[self alloc] initWithCommand:aCommand andEnvironment:someEnvironment] autorelease];
+ HOJSShellCommand* res = [[self alloc] initWithCommand:aCommand andEnvironment:someEnvironment];
res.exitHandler = aHandler;
[res launchAndWait:aHandler == nil];
return res;
@@ -349,9 +348,7 @@ OAK_DEBUG_VAR(HTMLOutput_JSShellCommand);
- (void)dealloc
{
D(DBF_HTMLOutput_JSShellCommand, bug("\n"););
-
[self cancelCommand];
- [super dealloc];
}
// =========================
@@ -402,14 +399,14 @@ OAK_DEBUG_VAR(HTMLOutput_JSShellCommand);
{
D(DBF_HTMLOutput_JSShellCommand, bug("%s\n", [[aHandler description] UTF8String]););
self.outputHandler = aHandler;
- [outputHandler callWebScriptMethod:@"call" withArguments:@[ outputHandler, [self outputString] ]];
+ [_outputHandler callWebScriptMethod:@"call" withArguments:@[ _outputHandler, [self outputString] ]];
}
- (void)setOnreaderror:(id)aHandler
{
D(DBF_HTMLOutput_JSShellCommand, bug("%s\n", [[aHandler description] UTF8String]););
self.errorHandler = aHandler;
- [errorHandler callWebScriptMethod:@"call" withArguments:@[ errorHandler, [self errorString] ]];
+ [_errorHandler callWebScriptMethod:@"call" withArguments:@[ _errorHandler, [self errorString] ]];
}
- (void)finalizeForWebScript
diff --git a/Frameworks/HTMLOutput/src/helpers/WebView Additions.mm b/Frameworks/HTMLOutput/src/helpers/WebView Additions.mm
index d2f8bb32..3e8f66ad 100644
--- a/Frameworks/HTMLOutput/src/helpers/WebView Additions.mm
+++ b/Frameworks/HTMLOutput/src/helpers/WebView Additions.mm
@@ -85,11 +85,11 @@
std::string str;
if([encoding isEqualToString:@"utf-8"])
- str = to_s((NSString*)[[[NSString alloc] initWithData:[dataSource data] encoding:NSUTF8StringEncoding] autorelease]);
+ str = to_s((NSString*)[[NSString alloc] initWithData:[dataSource data] encoding:NSUTF8StringEncoding]);
else if([encoding isEqualToString:@"utf-16"] || [encoding isEqualToString:@"utf16"])
- str = to_s((NSString*)[[[NSString alloc] initWithData:[dataSource data] encoding:NSUnicodeStringEncoding] autorelease]);
+ str = to_s((NSString*)[[NSString alloc] initWithData:[dataSource data] encoding:NSUnicodeStringEncoding]);
else if([encoding isEqualToString:@"macintosh"])
- str = to_s((NSString*)[[[NSString alloc] initWithData:[dataSource data] encoding:NSMacOSRomanStringEncoding] autorelease]);
+ str = to_s((NSString*)[[NSString alloc] initWithData:[dataSource data] encoding:NSMacOSRomanStringEncoding]);
else
return (void)NSRunAlertPanel(@"Unknown Encoding", @"The encoding used for this HTML buffer (“%@”) is unsupported.\nPlease file a bug report stating the encoding name and how you got to it.", @"Continue", nil, nil, [dataSource textEncodingName]);
diff --git a/Frameworks/HTMLOutput/target b/Frameworks/HTMLOutput/target
index c4ac3e05..b0509300 100644
--- a/Frameworks/HTMLOutput/target
+++ b/Frameworks/HTMLOutput/target
@@ -3,5 +3,3 @@ EXPORT = src/HTMLOutput.h
CP_Resources = resources/*
LINK += text ns document command OakAppKit OakFoundation OakSystem
FRAMEWORKS = Cocoa WebKit
-
-OBJCXX_FLAGS += -fno-objc-arc