Skip to content

Commit

Permalink
Remove manual synthesis from Documentation panel
Browse files Browse the repository at this point in the history
  • Loading branch information
alinebee committed Apr 29, 2018
1 parent 107f90a commit e2a27b9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 47 deletions.
29 changes: 6 additions & 23 deletions Boxer/Documentation Panel/BXDocumentationBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,23 @@

/// BXDocumentationBrowser manages the list of documentation for the gamebox.
@interface BXDocumentationBrowser : NSViewController <NSCollectionViewDelegate, NSDraggingDestination>
{
NSArray<NSURL*> *_documentationURLs;
NSIndexSet *_documentationSelectionIndexes;

__weak NSScrollView *_documentationScrollView;
__weak BXDocumentationList *_documentationList;
__weak NSTextField *_titleLabel;
__weak NSTextField *_helpTextLabel;

__weak id <BXDocumentationBrowserDelegate> _delegate;
}

#pragma mark - Properties

/// The delegate to which we will send \c BXDocumentationBrowserDelegate messages.
@property (weak, nonatomic) IBOutlet id <BXDocumentationBrowserDelegate> delegate;

/// The scrolling wrapper in which our documenation list is displayed.
@property (weak, nonatomic) IBOutlet NSScrollView *documentationScrollView;
@property (strong, nonatomic) IBOutlet NSScrollView *documentationScrollView;

/// The title at the top of the browser.
@property (weak, nonatomic) IBOutlet NSTextField *titleLabel;
@property (strong, nonatomic) IBOutlet NSTextField *titleLabel;

/// The help text displayed at the bottom of the browser.
@property (weak, nonatomic) IBOutlet NSTextField *helpTextLabel;
@property (strong, nonatomic) IBOutlet NSTextField *helpTextLabel;

/// The collection view in which our documentation will be displayed.
@property (weak, nonatomic) IBOutlet BXDocumentationList *documentationList;
@property (strong, nonatomic) IBOutlet BXDocumentationList *documentationList;

/// An array of NSURLs for the documentation files included in this gamebox.
/// This is mapped directly to the documentation URLs reported by the gamebox.
Expand All @@ -52,7 +41,7 @@
/// An array of criteria for how the documentation files should be sorted in the UI.
/// Documentation will be sorted by type and then by name, to group similar types
/// of documentation files together.
@property (copy, readonly, nonatomic) NSArray<NSSortDescriptor*> *sortCriteria;
@property (readonly, nonatomic) NSArray<NSSortDescriptor*> *sortCriteria;

/// The currently selected documentation items. Normally, only one item can be selected at a time.
@property (strong, nonatomic) NSIndexSet *documentationSelectionIndexes;
Expand All @@ -66,7 +55,7 @@

/// The text that will be displayed in the help text label at the foot of the view.
/// Changes depending on how many documentation items there are and whether adding new documentation is possible.
@property (copy, readonly, nonatomic) NSString *helpText;
@property (readonly, nonatomic) NSString *helpText;

/// Whether we are able to add or remove documentation from the gamebox.
/// This is determined from the locked status of the gamebox,
Expand Down Expand Up @@ -159,9 +148,6 @@

/// BXDocumentationItem manages each individual documentation file listed in the documentation popup.
@interface BXDocumentationItem : BXCollectionItem
{
NSImage *_icon;
}

/// The icon for the documentation file.
///
Expand All @@ -178,9 +164,6 @@

/// Custom appearance for documentation items. Highlights the background when selected.
@interface BXDocumentationWrapper : BXCollectionItemView
{
CGFloat _highlightStrength;
}
@end


Expand Down
11 changes: 0 additions & 11 deletions Boxer/Documentation Panel/BXDocumentationBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ - (void) synchronizePreviewToSelection;
@end

@implementation BXDocumentationBrowser
@synthesize documentationScrollView = _documentationScrollView;
@synthesize documentationList = _documentationList;
@synthesize titleLabel = _titleLabel;
@synthesize helpTextLabel = _helpTextLabel;

@synthesize documentationURLs = _documentationURLs;
@synthesize documentationSelectionIndexes = _documentationSelectionIndexes;
@synthesize delegate = _delegate;

- (void) setDocumentationSelectionIndexes: (NSIndexSet *)indexes
{
Expand Down Expand Up @@ -654,7 +646,6 @@ + (id) previewItemWithURL: (NSURL *)URL;
@end

@implementation BXDocumentationBrowserPreviewItem
@synthesize originalURL = _originalURL;

+ (id) previewItemWithURL: (NSURL *)URL
{
Expand Down Expand Up @@ -793,7 +784,6 @@ - (void) _refreshIcon;
@end

@implementation BXDocumentationItem
@synthesize icon = _icon;

- (void) viewDidLoad
{
Expand Down Expand Up @@ -887,7 +877,6 @@ @interface BXDocumentationWrapper ()
@end

@implementation BXDocumentationWrapper
@synthesize highlightStrength = _highlightStrength;

+ (id) defaultAnimationForKey: (NSString *)key
{
Expand Down
9 changes: 1 addition & 8 deletions Boxer/Documentation Panel/BXDocumentationPanelController.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,11 @@ NS_ASSUME_NONNULL_BEGIN
@class BXSession;

@interface BXDocumentationPanelController : NSWindowController <NSPopoverDelegate, BXDocumentationBrowserDelegate>
{
NSPopover *_popover;
BXDocumentationBrowser *_popoverBrowser;
BXDocumentationBrowser *_windowBrowser;
NSSize _maxPopoverSize;

BXSession *_session;
}

#pragma mark - Properties

/// The session whose documents are being displayed in the panel.
// FIXME: This may be introducing a memory leak by holding a strong reference
@property (strong, nonatomic, nullable) BXSession *session;

/// Whether the panel is currently visible, either as a popover or as a window.
Expand Down
5 changes: 0 additions & 5 deletions Boxer/Documentation Panel/BXDocumentationPanelController.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ - (void) _sizePopoverToFitNumberOfItems: (NSUInteger)numItems;
@end

@implementation BXDocumentationPanelController
@synthesize session = _session;
@synthesize popover = _popover;
@synthesize windowBrowser = _windowBrowser;
@synthesize popoverBrowser = _popoverBrowser;
@synthesize maxPopoverSize = _maxPopoverSize;

#pragma mark - Initialization and deallocation

Expand Down

0 comments on commit e2a27b9

Please sign in to comment.