Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
groverlynn committed Feb 18, 2024
2 parents 4b7c06d + 3d70c75 commit 83e3f35
Show file tree
Hide file tree
Showing 12 changed files with 653 additions and 551 deletions.
26 changes: 14 additions & 12 deletions SquirrelApplicationDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
@class SquirrelPanel;
@class SquirrelOptionSwitcher;

typedef enum {
// Note: the SquirrelApplicationDelegate is instantiated automatically as an outlet of NSApp's instance
@interface SquirrelApplicationDelegate : NSObject <NSApplicationDelegate>

typedef NS_ENUM(NSUInteger, SquirrelNotificationPolicy) {
kShowNotificationsNever = 0,
kShowNotificationsWhenAppropriate = 1,
kShowNotificationsAlways = 2
} SquirrelNotificationPolicy;

// Note: the SquirrelApplicationDelegate is instantiated automatically as an outlet of NSApp's instance
@interface SquirrelApplicationDelegate : NSObject <NSApplicationDelegate>
};

@property(nonatomic, copy) IBOutlet NSMenu *menu;
@property(nonatomic, strong) IBOutlet SquirrelPanel *panel;
@property(nonatomic, strong) IBOutlet id updater;
@property(nonatomic, weak) IBOutlet NSMenu *menu;
@property(nonatomic, weak) IBOutlet SquirrelPanel *panel;
@property(nonatomic, weak) IBOutlet id updater;

@property(nonatomic, readonly, strong) SquirrelConfig *config;
@property(nonatomic, strong, readonly) SquirrelConfig *config;
@property(nonatomic, readonly) SquirrelNotificationPolicy showNotifications;

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

@property(nonatomic, readonly) BOOL problematicLaunchDetected;

@end
@end // SquirrelApplicationDelegate


@interface NSApplication (SquirrelApp)

@property(nonatomic, readonly, strong) SquirrelApplicationDelegate *squirrelAppDelegate;
@property(nonatomic, strong, readonly) SquirrelApplicationDelegate *squirrelAppDelegate;

@end // NSApplication (SquirrelApp)

@end

// also used in main.m
extern void show_notification(const char *msg_text);
2 changes: 1 addition & 1 deletion SquirrelApplicationDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static void notification_handler(void *context_object, RimeSessionId session_id,
if ([app_delegate.panel.optionSwitcher containsOption:@(option_name)]) {
if ([app_delegate.panel.optionSwitcher updateGroupState:@(message_value)
ofOption:@(option_name)]) {
NSString *schemaId = [app_delegate panel].optionSwitcher.schemaId;
NSString *schemaId = app_delegate.panel.optionSwitcher.schemaId;
[app_delegate loadSchemaSpecificLabels:schemaId];
[app_delegate loadSchemaSpecificSettings:schemaId
withRimeSession:session_id];
Expand Down
6 changes: 3 additions & 3 deletions SquirrelConfig.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#import <Cocoa/Cocoa.h>

typedef NSDictionary<NSString *, NSNumber *> SquirrelAppOptions;
typedef NSMutableDictionary<NSString *, NSNumber *> SquirrelMutableAppOptions;

@interface SquirrelOptionSwitcher : NSObject

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

@interface SquirrelConfig : NSObject

typedef NSDictionary<NSString *, NSNumber *> SquirrelAppOptions;
typedef NSMutableDictionary<NSString *, NSNumber *> SquirrelMutableAppOptions;

@property(nonatomic, readonly) BOOL isOpen;
@property(nonatomic, strong) NSString *colorSpace;
@property(nonatomic, strong, readonly) NSString *schemaId;
Expand Down
12 changes: 6 additions & 6 deletions SquirrelInputController.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#import <Cocoa/Cocoa.h>
#import <InputMethodKit/InputMethodKit.h>

typedef enum {
@interface SquirrelInputController : IMKInputController

typedef NS_ENUM(NSInteger, SquirrelAction) {
kSELECT = 1, // accepts indices in digits, selection keys, and keycodes (XK_Escape)
kHILITE = 2, // accepts indices in digits and selection keys (char '1' / 'A')
kDELETE = 3 // only accepts indices in digits (int 1)
} SquirrelAction;
};

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

@interface SquirrelInputController : IMKInputController

@property(nonatomic, class, readonly) SquirrelInputController *currentController;
@property(class, weak, readonly) SquirrelInputController *currentController;

- (void)moveCursor:(NSUInteger)cursorPosition
toPosition:(NSUInteger)targetPosition
Expand All @@ -33,4 +33,4 @@ typedef NS_ENUM(NSUInteger, SquirrelIndex) {
- (void)perform:(SquirrelAction)action
onIndex:(SquirrelIndex)index;

@end
@end // SquirrelInputController
Loading

0 comments on commit 83e3f35

Please sign in to comment.