Skip to content

Commit

Permalink
merge and restructure remaining smaller stuff in main project (part of
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoagx committed Jan 20, 2018
1 parent db2bdd8 commit b04243d
Show file tree
Hide file tree
Showing 26 changed files with 134 additions and 246 deletions.
2 changes: 1 addition & 1 deletion Source/MGTemplateEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define GLOBAL_DELIM_EXPR_END @"expressionEnd"
#define GLOBAL_DELIM_FILTER @"filter"

@interface MGTemplateEngine (PrivateMethods)
@interface MGTemplateEngine ()

- (NSObject *)valueForVariable:(NSString *)var parent:(NSObject **)parent parentKey:(NSString **)parentKey;
- (void)setValue:(NSObject *)newValue forVariable:(NSString *)var forceCurrentStackFrame:(BOOL)inStackFrame;
Expand Down
2 changes: 1 addition & 1 deletion Source/NoodleLineNumberView.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

#pragma mark -

@interface NoodleLineNumberView (Private)
@interface NoodleLineNumberView ()

- (NSArray *)lineIndices;
- (void)invalidateLineIndices;
Expand Down
6 changes: 2 additions & 4 deletions Source/SPActivityTextFieldCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#define FAVORITE_NAME_FONT_SIZE 12.0f

@interface SPActivityTextFieldCell (PrivateAPI)
@interface SPActivityTextFieldCell ()

- (NSAttributedString *)constructSubStringAttributedString;
- (NSAttributedString *)attributedStringForFavoriteName;
Expand Down Expand Up @@ -332,9 +332,7 @@ - (void)dealloc
[super dealloc];
}

@end

@implementation SPActivityTextFieldCell (PrivateAPI)
#pragma mark - Private API

/**
* Constructs the attributed string to be used as the cell's substring.
Expand Down
2 changes: 1 addition & 1 deletion Source/SPCSVParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* Please see the header files for a general description of the purpose of this class.
*/

@implementation SPCSVParser : NSObject
@implementation SPCSVParser

#pragma mark -
#pragma mark Retrieving data from the CSV string
Expand Down
4 changes: 2 additions & 2 deletions Source/SPColorSelectorView.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@

@end

@interface NSObject (SPColorSelectorViewDelegate)

@protocol SPColorSelectorViewDelegate <NSObject>
@optional
/**
* Called on a delegate when the selection did (really) change
* @param aView The changed view
Expand Down
4 changes: 2 additions & 2 deletions Source/SPColorSelectorView.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#import "SPColorSelectorView.h"
#import "SPOSInfo.h"

@interface SPColorSelectorView (Private)
@interface SPColorSelectorView ()

- (void)setupTrackingAreas;
- (void)_drawDotBevelStyleWithGradient:(NSGradient *)gradient insideRect:(NSRect)colorSquareRect;
Expand Down Expand Up @@ -414,7 +414,7 @@ - (void)mouseUp:(NSEvent*)event
}

if (delegate != nil && [delegate respondsToSelector:@selector(colorSelectorDidChange:)]) {
[delegate colorSelectorDidChange:self];
[(id<SPColorSelectorViewDelegate>)delegate colorSelectorDidChange:self];
}

[self setNeedsDisplay:YES];
Expand Down
4 changes: 0 additions & 4 deletions Source/SPComboPopupButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,3 @@
@property(readonly, assign) NSUInteger lineOffset;

@end

@interface SPComboPopupButtonCell : NSPopUpButtonCell

@end
16 changes: 5 additions & 11 deletions Source/SPComboPopupButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@
#define kSPComboPopupButtonLineOffsetSmall 15;
#define kSPComboPopupButtonLineOffsetRegular 17;

@interface SPComboPopupButton (PrivateAPI)
@interface SPComboPopupButton ()

- (void)_initCustomData;

@end

@interface SPComboPopupButtonCell : NSPopUpButtonCell

@end

@implementation SPComboPopupButton

@synthesize shouldDrawNonHighlightState;
Expand Down Expand Up @@ -184,12 +188,8 @@ - (void)menuDidClose:(NSMenu *)menu
menuIsOpen = NO;
}

@end

#pragma mark -

@implementation SPComboPopupButton (PrivateAPI)

- (void)_initCustomData
{

Expand Down Expand Up @@ -221,12 +221,6 @@ - (void)_initCustomData

#pragma mark -

@interface SPComboPopupButtonCell (PrivateAPI)

- (void)_initCustomData;

@end

@implementation SPComboPopupButtonCell

/**
Expand Down
6 changes: 2 additions & 4 deletions Source/SPDataStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <stdlib.h>
#include <mach/mach_time.h>

@interface SPDataStorage (Private_API)
@interface SPDataStorage ()

- (void) _checkNewRow:(NSMutableArray *)aRow;
- (void) _addRowUnsafeUnchecked:(NSMutableArray *)aRow;
Expand Down Expand Up @@ -559,9 +559,7 @@ - (void) dealloc
[super dealloc];
}

@end

@implementation SPDataStorage (PrivateAPI)
#pragma mark - Private API

// DO NOT CALL THIS METHOD UNLESS YOU CURRENTLY HAVE A LOCK ON SELF!!!
- (void) _checkNewRow:(NSMutableArray *)aRow
Expand Down
2 changes: 1 addition & 1 deletion Source/SPEditorPreferencePane.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

#define SP_EXPORT_COLOR_SCHEME_NAME_STRING NSLocalizedString(@"MyTheme", @"Preferences : Themes : Initial filename for 'Export'")

@interface SPEditorPreferencePane (PrivateAPI)
@interface SPEditorPreferencePane ()

- (BOOL)_checkForUnsavedTheme;
- (NSArray *)_getAvailableThemes;
Expand Down
8 changes: 2 additions & 6 deletions Source/SPGeometryDataView.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#import "SPGeometryDataView.h"

@interface SPGeometryDataView (PrivateAPI)
@interface SPGeometryDataView ()

- (NSPoint)_normalizePoint:(NSPoint)aPoint;
- (void)_drawPoint:(NSPoint)aPoint;
Expand Down Expand Up @@ -282,12 +282,8 @@ - (void)dealloc
[super dealloc];
}

@end

#pragma mark -
#pragma mark PrivateAPI

@implementation SPGeometryDataView (PrivateAPI)
#pragma mark Private API

/**
* Converts original NSPoint to target coordinates
Expand Down
4 changes: 2 additions & 2 deletions Source/SPImageView.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
//
// More info at <https://github.com/sequelpro/sequelpro>

@interface NSObject (SPImageViewDelegate)

@protocol SPImageViewDelegate <NSObject>
@optional
- (void)processUpdatedImageData:(NSData *)data;
- (void)processPasteImageData;

Expand Down
4 changes: 2 additions & 2 deletions Source/SPImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ @implementation SPImageView
*/
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
id delegateForUse = nil;
id<SPImageViewDelegate> delegateForUse = nil;

// If the delegate or the delegate's content instance doesn't implement processUpdatedImageData:,
// return the super's implementation
Expand Down Expand Up @@ -113,7 +113,7 @@ - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
- (void)paste:(id)sender
{
// [super paste:sender];
id delegateForUse = nil;
id<SPImageViewDelegate> delegateForUse = nil;

// If the delegate or the delegate's content instance doesn't implement processUpdatedImageData:,
// return the super's implementation
Expand Down
2 changes: 1 addition & 1 deletion Source/SPNarrowDownCompletion.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ - (BOOL)SP_NarrowDownCompletion_canHandleEvent:(NSEvent*)anEvent;

@end

@interface SPNarrowDownCompletion (Private)
@interface SPNarrowDownCompletion ()

- (NSRect)rectOfMainScreen;
- (NSString*)filterString;
Expand Down
2 changes: 1 addition & 1 deletion Source/SPNetworkPreferencePane.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
static NSString *SPSSLCipherListMarkerItem = @"--";
static NSString *SPSSLCipherPboardTypeName = @"SSLCipherPboardType";

@interface SPNetworkPreferencePane (Private)
@interface SPNetworkPreferencePane ()
- (void)updateHiddenFiles;
- (void)loadSSLCiphers;
- (void)storeSSLCiphers;
Expand Down
99 changes: 98 additions & 1 deletion Source/SPPreferenceController.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#import "SPEditorPreferencePane.h"
#import "SPGeneralPreferencePane.h"

@interface SPPreferenceController (PrivateAPI)
@interface SPPreferenceController () <NSWindowDelegate>

- (void)_setupToolbar;
- (void)_resizeWindowForContentView:(NSView *)view;
Expand Down Expand Up @@ -226,6 +226,103 @@ - (void)_resizeWindowForContentView:(NSView *)view
[view setFrameOrigin:NSMakePoint(0, 0)];
}

#pragma mark - SPPreferenceControllerDelegate

#pragma mark Window delegate methods

/**
* Trap window close notifications and use them to ensure changes are saved.
*/
- (void)windowWillClose:(NSNotification *)notification
{
[[NSColorPanel sharedColorPanel] close];

// Mark the currently selected field in the window as having finished editing, to trigger saves.
if ([[self window] firstResponder]) {
[[self window] endEditingFor:[[self window] firstResponder]];
}
}

/**
* Trap window resize notifications and use them to disable resizing on most tabs
* - except for the favourites tab.
*/
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize
{
[[NSColorPanel sharedColorPanel] close];

return [sender showsResizeIndicator] ? frameSize : [sender frame].size;
}

#pragma mark -
#pragma mark Toolbar delegate methods

- (NSToolbarItem *)toolbar:(NSToolbar *)aToolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
{
if ([itemIdentifier isEqualToString:SPPreferenceToolbarGeneral]) {
return generalItem;
}
else if ([itemIdentifier isEqualToString:SPPreferenceToolbarTables]) {
return tablesItem;
}
else if ([itemIdentifier isEqualToString:SPPreferenceToolbarNotifications]) {
return notificationsItem;
}
else if ([itemIdentifier isEqualToString:SPPreferenceToolbarAutoUpdate]) {
return autoUpdateItem;
}
else if ([itemIdentifier isEqualToString:SPPreferenceToolbarNetwork]) {
return networkItem;
}
else if ([itemIdentifier isEqualToString:SPPreferenceToolbarEditor]) {
return editorItem;
}
else if ([itemIdentifier isEqualToString:SPPreferenceToolbarShortcuts]) {
return shortcutItem;
}

return [[[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier] autorelease];
}

- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)aToolbar
{
return @[
SPPreferenceToolbarGeneral,
SPPreferenceToolbarTables,
SPPreferenceToolbarNotifications,
SPPreferenceToolbarEditor,
SPPreferenceToolbarShortcuts,
SPPreferenceToolbarAutoUpdate,
SPPreferenceToolbarNetwork
];
}

- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)aToolbar
{
return @[
SPPreferenceToolbarGeneral,
SPPreferenceToolbarTables,
SPPreferenceToolbarNotifications,
SPPreferenceToolbarEditor,
SPPreferenceToolbarShortcuts,
SPPreferenceToolbarAutoUpdate,
SPPreferenceToolbarNetwork
];
}

- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)aToolbar
{
return @[
SPPreferenceToolbarGeneral,
SPPreferenceToolbarTables,
SPPreferenceToolbarNotifications,
SPPreferenceToolbarEditor,
SPPreferenceToolbarShortcuts,
SPPreferenceToolbarAutoUpdate,
SPPreferenceToolbarNetwork
];
}

#pragma mark -

- (void)dealloc
Expand Down
42 changes: 0 additions & 42 deletions Source/SPPreferenceControllerDelegate.h

This file was deleted.

Loading

0 comments on commit b04243d

Please sign in to comment.