Skip to content

Commit 27e82fa

Browse files
committed
formatting
2 parents 4b7c06d + 3d70c75 commit 27e82fa

11 files changed

+652
-550
lines changed

SquirrelApplicationDelegate.h

+14-12
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
@class SquirrelPanel;
66
@class SquirrelOptionSwitcher;
77

8-
typedef enum {
8+
// Note: the SquirrelApplicationDelegate is instantiated automatically as an outlet of NSApp's instance
9+
@interface SquirrelApplicationDelegate : NSObject <NSApplicationDelegate>
10+
11+
typedef NS_ENUM(NSUInteger, SquirrelNotificationPolicy) {
912
kShowNotificationsNever = 0,
1013
kShowNotificationsWhenAppropriate = 1,
1114
kShowNotificationsAlways = 2
12-
} SquirrelNotificationPolicy;
13-
14-
// Note: the SquirrelApplicationDelegate is instantiated automatically as an outlet of NSApp's instance
15-
@interface SquirrelApplicationDelegate : NSObject <NSApplicationDelegate>
15+
};
1616

17-
@property(nonatomic, copy) IBOutlet NSMenu *menu;
18-
@property(nonatomic, strong) IBOutlet SquirrelPanel *panel;
19-
@property(nonatomic, strong) IBOutlet id updater;
17+
@property(nonatomic, weak) IBOutlet NSMenu *menu;
18+
@property(nonatomic, weak) IBOutlet SquirrelPanel *panel;
19+
@property(nonatomic, weak) IBOutlet id updater;
2020

21-
@property(nonatomic, readonly, strong) SquirrelConfig *config;
21+
@property(nonatomic, strong, readonly) SquirrelConfig *config;
2222
@property(nonatomic, readonly) SquirrelNotificationPolicy showNotifications;
2323

2424
- (IBAction)deploy:(id)sender;
@@ -35,13 +35,15 @@ typedef enum {
3535

3636
@property(nonatomic, readonly) BOOL problematicLaunchDetected;
3737

38-
@end
38+
@end // SquirrelApplicationDelegate
39+
3940

4041
@interface NSApplication (SquirrelApp)
4142

42-
@property(nonatomic, readonly, strong) SquirrelApplicationDelegate *squirrelAppDelegate;
43+
@property(nonatomic, strong, readonly) SquirrelApplicationDelegate *squirrelAppDelegate;
44+
45+
@end // NSApplication (SquirrelApp)
4346

44-
@end
4547

4648
// also used in main.m
4749
extern void show_notification(const char *msg_text);

SquirrelApplicationDelegate.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static void notification_handler(void *context_object, RimeSessionId session_id,
109109
if ([app_delegate.panel.optionSwitcher containsOption:@(option_name)]) {
110110
if ([app_delegate.panel.optionSwitcher updateGroupState:@(message_value)
111111
ofOption:@(option_name)]) {
112-
NSString *schemaId = [app_delegate panel].optionSwitcher.schemaId;
112+
NSString *schemaId = app_delegate.panel.optionSwitcher.schemaId;
113113
[app_delegate loadSchemaSpecificLabels:schemaId];
114114
[app_delegate loadSchemaSpecificSettings:schemaId
115115
withRimeSession:session_id];

SquirrelConfig.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#import <Cocoa/Cocoa.h>
22

3-
typedef NSDictionary<NSString *, NSNumber *> SquirrelAppOptions;
4-
typedef NSMutableDictionary<NSString *, NSNumber *> SquirrelMutableAppOptions;
5-
63
@interface SquirrelOptionSwitcher : NSObject
74

85
@property(nonatomic, strong, readonly) NSString *schemaId;
@@ -32,6 +29,9 @@ typedef NSMutableDictionary<NSString *, NSNumber *> SquirrelMutableAppOptions;
3229

3330
@interface SquirrelConfig : NSObject
3431

32+
typedef NSDictionary<NSString *, NSNumber *> SquirrelAppOptions;
33+
typedef NSMutableDictionary<NSString *, NSNumber *> SquirrelMutableAppOptions;
34+
3535
@property(nonatomic, readonly) BOOL isOpen;
3636
@property(nonatomic, strong) NSString *colorSpace;
3737
@property(nonatomic, strong, readonly) NSString *schemaId;

SquirrelInputController.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#import <Cocoa/Cocoa.h>
22
#import <InputMethodKit/InputMethodKit.h>
33

4-
typedef enum {
4+
@interface SquirrelInputController : IMKInputController
5+
6+
typedef NS_ENUM(NSInteger, SquirrelAction) {
57
kSELECT = 1, // accepts indices in digits, selection keys, and keycodes (XK_Escape)
68
kHILITE = 2, // accepts indices in digits and selection keys (char '1' / 'A')
79
kDELETE = 3 // only accepts indices in digits (int 1)
8-
} SquirrelAction;
10+
};
911

1012
typedef NS_ENUM(NSUInteger, SquirrelIndex) {
1113
// 0 ... 9 are ordinal digits, used as (int) index
@@ -21,9 +23,7 @@ typedef NS_ENUM(NSUInteger, SquirrelIndex) {
2123
kVoidSymbol = 0xffffff // XK_VoidSymbol
2224
};
2325

24-
@interface SquirrelInputController : IMKInputController
25-
26-
@property(nonatomic, class, readonly) SquirrelInputController *currentController;
26+
@property(class, weak, readonly) SquirrelInputController *currentController;
2727

2828
- (void)moveCursor:(NSUInteger)cursorPosition
2929
toPosition:(NSUInteger)targetPosition
@@ -33,4 +33,4 @@ typedef NS_ENUM(NSUInteger, SquirrelIndex) {
3333
- (void)perform:(SquirrelAction)action
3434
onIndex:(SquirrelIndex)index;
3535

36-
@end
36+
@end // SquirrelInputController

0 commit comments

Comments
 (0)