Skip to content

Commit

Permalink
compatible with predictor && cleanup codes
Browse files Browse the repository at this point in the history
  • Loading branch information
groverlynn committed Nov 22, 2023
1 parent 8b9bead commit 7796c3e
Show file tree
Hide file tree
Showing 12 changed files with 445 additions and 430 deletions.
27 changes: 15 additions & 12 deletions Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,38 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Squirrel</string>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>RimeIcon.icns</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Squirrel</string>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CFBundleShortVersionString</key>
<string>${MARKETING_VERSION}</string>
<key>ComponentInputModeDict</key>
<dict>
<key>tsInputModeListKey</key>
<dict>
<key>im.rime.inputmethod.Squirrel.Hant</key>
<dict>
<key>TISInputSourceID</key>
<string>im.rime.inputmethod.Squirrel.Hant</string>
<string>${PRODUCT_BUNDLE_IDENTIFIER}.Hant</string>
<key>TISIntendedLanguage</key>
<string>zh-Hant</string>
<key>TISIconIsTemplate</key>
<true/>
<key>tsInputModeCharacterRepertoireKey</key>
<array>
<string>Hant</string>
<string>Hans</string>
<string>Hani</string>
</array>
<key>tsInputModeDefaultStateKey</key>
<true/>
Expand All @@ -55,15 +56,14 @@
<key>im.rime.inputmethod.Squirrel.Hans</key>
<dict>
<key>TISInputSourceID</key>
<string>im.rime.inputmethod.Squirrel.Hans</string>
<string>${PRODUCT_BUNDLE_IDENTIFIER}.Hans</string>
<key>TISIntendedLanguage</key>
<string>zh-Hans</string>
<key>TISIconIsTemplate</key>
<true/>
<key>tsInputModeCharacterRepertoireKey</key>
<array>
<string>Hans</string>
<string>Hant</string>
<string>Hani</string>
</array>
<key>tsInputModeDefaultStateKey</key>
<true/>
Expand All @@ -83,15 +83,14 @@
<key>im.rime.inputmethod.Squirrel.Cant</key>
<dict>
<key>TISInputSourceID</key>
<string>im.rime.inputmethod.Squirrel.Cant</string>
<string>${PRODUCT_BUNDLE_IDENTIFIER}.Cant</string>
<key>TISIntendedLanguage</key>
<string>yue-Hant</string>
<key>TISIconIsTemplate</key>
<true/>
<key>tsInputModeCharacterRepertoireKey</key>
<array>
<string>Hant</string>
<string>Hans</string>
<string>Hani</string>
</array>
<key>tsInputModeDefaultStateKey</key>
<true/>
Expand All @@ -117,7 +116,7 @@
</array>
</dict>
<key>InputMethodConnectionName</key>
<string>Squirrel_1_Connection</string>
<string>${PRODUCT_NAME}_1_Connection</string>
<key>InputMethodServerControllerClass</key>
<string>SquirrelInputController</string>
<key>InputMethodServerDelegateClass</key>
Expand All @@ -142,6 +141,10 @@
<true/>
<key>TISIconIsTemplate</key>
<true/>
<key>tsInputMethodCharacterRepertoireKey</key>
<array>
<string>Hani</string>
</array>
<key>tsInputMethodIconFileKey</key>
<string>rime</string>
<key>tsInputMethodAlternateMenuIconFileKey</key>
Expand Down
2 changes: 1 addition & 1 deletion Sparkle
Submodule Sparkle updated 663 files
14 changes: 7 additions & 7 deletions SquirrelApplicationDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#import "SquirrelConfig.h"
#import "SquirrelPanel.h"

static NSString *const kRimeWikiURL = @"https://github.com/rime/home/wiki";
static NSString *kRimeWikiURL = @"https://github.com/rime/home/wiki";

@implementation SquirrelApplicationDelegate

Expand Down Expand Up @@ -148,8 +148,8 @@ - (void)loadSettings {

_enableNotifications =
![[_config getString:@"show_notifications_when"] isEqualToString:@"never"];
[self.panel loadConfig:_config forDarkMode:NO];
[self.panel loadConfig:_config forDarkMode:YES];
[self.panel loadConfig:_config forAppearance:defaultAppear];
[self.panel loadConfig:_config forAppearance:darkAppear];
}

- (void)loadSchemaSpecificSettings:(NSString *)schemaId {
Expand All @@ -159,11 +159,11 @@ - (void)loadSchemaSpecificSettings:(NSString *)schemaId {
SquirrelConfig *schema = [[SquirrelConfig alloc] init];
if ([schema openWithSchemaId:schemaId baseConfig:self.config] &&
[schema hasSection:@"style"]) {
[self.panel loadConfig:schema forDarkMode:NO];
[self.panel loadConfig:schema forDarkMode:YES];
[self.panel loadConfig:schema forAppearance:defaultAppear];
[self.panel loadConfig:schema forAppearance:darkAppear];
} else {
[self.panel loadConfig:self.config forDarkMode:NO];
[self.panel loadConfig:self.config forDarkMode:YES];
[self.panel loadConfig:self.config forAppearance:defaultAppear];
[self.panel loadConfig:self.config forAppearance:darkAppear];
}
[schema close];
}
Expand Down
4 changes: 2 additions & 2 deletions SquirrelConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ - (SquirrelOptionSwitcher *)getOptionSwitcher {
}
RimeConfigEnd(&optionIter);
if (hasStyleSection) {
for (NSUInteger i = 0; i < optionGroup.count; ++i) {
switcher[optionGroup[i]] = optionGroup[reset];
for (size_t i = 0; i < optionGroup.count; ++i) {
switcher[optionGroup[i]] = optionGroup[(size_t)reset];
optionGroups[optionGroup[i]] = optionGroup;
}
}
Expand Down
22 changes: 17 additions & 5 deletions SquirrelInputController.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@

@interface SquirrelInputController : IMKInputController

- (BOOL)perform:(NSUInteger)action onIndex:(NSUInteger)index;
typedef enum {
kSELECT = 1, // accepts indices in both digits and selection keys
kDELETE = 2, // only accepts indices in digits, e.g. (int) 1
kCHOOSE = 3 // only accepts indices in selection keys, e.g. (char) '1' / 'A'
} rimeAction;

@end
typedef enum {
// 0 ... 9 are ordinal digits, used as (int) index
// 0x21 ... 0x7e are ASCII chars (as selection keys)
// other rime keycodes (as function keys), for paging etc.
kPageUp = 0xff55, // XK_Page_Up
kPageDown = 0xff56, // XK_Page_Down
kVoidSymbol = 0xffffff // XK_VoidSymbol
} rimeIndex;

- (void)perform:(rimeAction)action
onIndex:(rimeIndex)index;

#define kSELECT 0x1
#define kDELETE 0x2
#define kCHOOSE 0x3
@end
Loading

0 comments on commit 7796c3e

Please sign in to comment.