Skip to content

Commit

Permalink
UI
Browse files Browse the repository at this point in the history
  • Loading branch information
groverlynn committed Apr 21, 2023
1 parent 1170f8c commit f406b9a
Show file tree
Hide file tree
Showing 10 changed files with 714 additions and 996 deletions.
6 changes: 3 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ To build only for the native architecture, and/or specify the lowest supported m

``` sh
# for Universal macOS App, targetting Ventura
make ARCHS='arm64 x86_64' MACOSX_DEPLOYMENT_TARGET='13.0'
make ARCHS='arm64 x86_64'

# for ARM macOS App, targetting Ventura
make ARCHS='arm64' MACOSX_DEPLOYMENT_TARGET='13.0'
make ARCHS='arm64'
```

## Install it on your Mac
Expand All @@ -123,7 +123,7 @@ make ARCHS='arm64' MACOSX_DEPLOYMENT_TARGET='13.0'
Just add `package` after `make`

```
make package ARCHS='arm64' MACOSX_DEPLOYMENT_TARGET='13.0'
make package ARCHS='arm64'
```

Define or echo `DEV_ID` to automatically handle code signing and [notarization](https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution) (Apple Developer ID needed)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
新詩醉墨時一揮
別後寄我無辭遠

   ——歐陽修
  ——歐陽修

今由 [中州韻輸入法引擎/Rime Input Method Engine](https://rime.im)
及其他開源技術強力驅動
Expand All @@ -28,7 +28,7 @@
安裝輸入法
---

本品適用於 macOS 12.0+
本品適用於 macOS 10.13+

初次安裝,如果在部份應用程序中打不出字,請註銷並重新登錄。

Expand Down
1 change: 0 additions & 1 deletion Sparkle
Submodule Sparkle deleted from 8fb9c8
8 changes: 4 additions & 4 deletions Squirrel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@
"$(inherited)",
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
OTHER_CODE_SIGN_FLAGS = "--deep";
OTHER_CPLUSPLUSFLAGS = (
"-DLEOPARD",
Expand Down Expand Up @@ -679,7 +679,7 @@
"$(inherited)",
"$(LIBRARY_SEARCH_PATHS_QUOTED_FOR_TARGET_1)",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
OTHER_CODE_SIGN_FLAGS = "--deep";
OTHER_CPLUSPLUSFLAGS = (
"-DLEOPARD",
Expand Down Expand Up @@ -743,7 +743,7 @@
/usr/local/lib,
);
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/lib";
MACOSX_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SYSTEM_HEADER_SEARCH_PATHS = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Headers;
Expand Down Expand Up @@ -795,7 +795,7 @@
/usr/lib,
);
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/lib";
MACOSX_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
SYSTEM_HEADER_SEARCH_PATHS = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Headers;
Expand Down
3 changes: 1 addition & 2 deletions SquirrelInputController.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
#import <InputMethodKit/InputMethodKit.h>

@interface SquirrelInputController : IMKInputController
- (BOOL)selectCandidate:(NSInteger)index;
- (BOOL)pageUp:(BOOL)up;

@end
31 changes: 7 additions & 24 deletions SquirrelInputController.m
Original file line number Diff line number Diff line change
Expand Up @@ -218,27 +218,6 @@ -(BOOL)processKey:(int)rime_keycode modifiers:(int)rime_modifiers
return handled;
}

- (BOOL)selectCandidate:(NSInteger)index {
BOOL success = rime_get_api()->select_candidate_on_current_page(_session, (int) index);
if (success) {
[self rimeUpdate];
}
return success;
}

- (BOOL)pageUp:(BOOL)up {
BOOL handled = NO;
if (up) {
handled = rime_get_api()->change_page(_session, True);
} else {
handled = rime_get_api()->change_page(_session, False);
}
if (handled) {
[self rimeUpdate];
}
return handled;
}

-(void)onChordTimer:(NSTimer *)timer
{
// chord release triggered by timer
Expand Down Expand Up @@ -459,22 +438,24 @@ -(void)showPanelWithPreedit:(NSString*)preedit
comments:(NSArray*)comments
labels:(NSArray*)labels
highlighted:(NSUInteger)index
pageNum:(NSUInteger)pageNum
lastPage:(BOOL)lastPage
{
//NSLog(@"showPanelWithPreedit:...:");
_candidates = candidates;
NSRect inputPos;
[_currentClient attributesForCharacterIndex:0 lineHeightRectangle:&inputPos];
SquirrelPanel* panel = NSApp.squirrelAppDelegate.panel;
panel.position = inputPos;
panel.inputController = self;
[panel showPreedit:preedit
selRange:selRange
caretPos:caretPos
candidates:candidates
comments:comments
labels:labels
highlighted:index
update:YES];
pageNum:pageNum
lastPage:lastPage];
}

@end // SquirrelController
Expand Down Expand Up @@ -630,7 +611,9 @@ -(void)rimeUpdate
candidates:candidates
comments:comments
labels:labels
highlighted:ctx.menu.highlighted_candidate_index];
highlighted:ctx.menu.highlighted_candidate_index
pageNum:ctx.menu.page_no
lastPage:ctx.menu.is_last_page];
rime_get_api()->free_context(&ctx);
} else {
[NSApp.squirrelAppDelegate.panel hide];
Expand Down
8 changes: 3 additions & 5 deletions SquirrelPanel.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#import <Cocoa/Cocoa.h>
#import "SquirrelInputController.h"

@class SquirrelConfig;

@interface SquirrelPanel : NSPanel
@interface SquirrelPanel : NSWindow

// Linear candidate list, as opposed to stacked candidate list.
@property(nonatomic, readonly) BOOL linear;
Expand All @@ -16,8 +15,6 @@

// position of input caret on screen.
@property(nonatomic, assign) NSRect position;
// position of input caret on screen.
@property(nonatomic, assign) SquirrelInputController *inputController;

-(void)showPreedit:(NSString*)preedit
selRange:(NSRange)selRange
Expand All @@ -26,7 +23,8 @@
comments:(NSArray*)comments
labels:(NSArray*)labels
highlighted:(NSUInteger)index
update:(BOOL)update;
pageNum:(NSUInteger)pageNum
lastPage:(BOOL)lastPage;

-(void)hide;

Expand Down
Loading

0 comments on commit f406b9a

Please sign in to comment.