mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Exclude non-script menu items from script menu in contex menu
This commit is contained in:
parent
f3d434aa68
commit
2c2200c64c
@ -9,6 +9,7 @@ changelog
|
||||
|
||||
- “Apache” シンタックス定義の更新
|
||||
- アウトラインをインデントで階層化
|
||||
- コンテキストメニューのスクリプトメニューにはスクリプト管理のための項目を含めないように変更
|
||||
- [beta] 全角空白の不可視文字代替文字を一部変更
|
||||
- [beta] 書類タイプに public.text を追加
|
||||
- [rc] ほか、見た目の微調整
|
||||
|
@ -168,6 +168,7 @@
|
||||
</ul></li>
|
||||
<li>Update documents about scripting with AppleScript.</li>
|
||||
</ul></li>
|
||||
<li>Change not to include menu items that manage script menu in context menu.</li>
|
||||
<li>Count characters by composed character sequence in the status bar and the info drawer.
|
||||
<ul>
|
||||
<li>The previous count was actually the length of string in UTF-16 that is internal string expression on OS X (for example, a surrogate pair is counted previously as 2 and now as 1).</li>
|
||||
|
@ -169,6 +169,7 @@
|
||||
</ul></li>
|
||||
<li>AppleScript に関わるドキュメントの更新</li>
|
||||
</ul></li>
|
||||
<li>コンテキストメニューのスクリプトメニューにはスクリプト管理のための項目を含めないように変更</li>
|
||||
<li>ステータスバーおよび情報ドロワーの文字数カウントを composed character 単位に変更
|
||||
<ul>
|
||||
<li>従来の文字数カウントは愚直にUTF-16 (= OS Xでの文字列内部表現) での length を表示するのに対して、新しいカウント法は表示される文字単位でカウントを行なう(例えば、絵文字などのサロゲートペアは文字数:1, 文字長:2となる)</li>
|
||||
|
@ -123,13 +123,16 @@ typedef NS_ENUM(NSUInteger, CEScriptInputType) {
|
||||
[self addChildFileItemTo:menu fromDir:[[self class] scriptDirectoryURL]];
|
||||
|
||||
if ([menu numberOfItems] > 0) {
|
||||
[menu addItem:[NSMenuItem separatorItem]];
|
||||
menuItem = [NSMenuItem separatorItem];
|
||||
[menuItem setTag:CEDefaultScriptMenuItemTag];
|
||||
[menu addItem:menuItem];
|
||||
}
|
||||
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Open Scripts Folder", nil)
|
||||
action:@selector(openScriptFolder:)
|
||||
keyEquivalent:@"a"];
|
||||
[menuItem setTarget:self];
|
||||
[menuItem setTag:CEDefaultScriptMenuItemTag];
|
||||
[menu addItem:menuItem];
|
||||
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy Sample to Scripts Folder", nil)
|
||||
@ -138,14 +141,15 @@ typedef NS_ENUM(NSUInteger, CEScriptInputType) {
|
||||
[menuItem setTarget:self];
|
||||
[menuItem setAlternate:YES];
|
||||
[menuItem setKeyEquivalentModifierMask:NSAlternateKeyMask];
|
||||
[menuItem setTag:CEScriptMenuDirectoryTag]; // Alternate表示のための修飾キーをCotEditor menu key bindingsの対応外にする
|
||||
[menuItem setToolTip:NSLocalizedString(@"Copy bundled sample scripts to the scripts folder.", nil)];
|
||||
[menuItem setTag:CEDefaultScriptMenuItemTag];
|
||||
[menu addItem:menuItem];
|
||||
|
||||
menuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Update Script Menu", nil)
|
||||
action:@selector(buildScriptMenu:)
|
||||
keyEquivalent:@""];
|
||||
[menuItem setTarget:self];
|
||||
[menuItem setTag:CEDefaultScriptMenuItemTag];
|
||||
[menu addItem:menuItem];
|
||||
}
|
||||
|
||||
@ -155,7 +159,15 @@ typedef NS_ENUM(NSUInteger, CEScriptInputType) {
|
||||
- (NSMenu *)contexualMenu
|
||||
//------------------------------------------------------
|
||||
{
|
||||
return [[[[NSApp mainMenu] itemAtIndex:CEScriptMenuIndex] submenu] copy];
|
||||
NSMenu *menu = [[[[NSApp mainMenu] itemAtIndex:CEScriptMenuIndex] submenu] copy];
|
||||
|
||||
for (NSMenuItem *item in [menu itemArray]) {
|
||||
if ([item tag] == CEDefaultScriptMenuItemTag) {
|
||||
[menu removeItem:item];
|
||||
}
|
||||
}
|
||||
|
||||
return ([menu numberOfItems] > 0) ? menu : nil;
|
||||
}
|
||||
|
||||
|
||||
|
@ -564,6 +564,7 @@ const NSInteger kNoMenuItem = -1;
|
||||
[addItem setTag:CEScriptMenuItemTag];
|
||||
[outMenu addItem:addItem];
|
||||
}
|
||||
[outMenu addItem:[NSMenuItem separatorItem]];
|
||||
} else{
|
||||
[ASMenuItem setImage:[NSImage imageNamed:@"ScriptTemplate"]];
|
||||
[[ASMenuItem image] setTemplate:NO];
|
||||
|
@ -343,9 +343,12 @@ typedef NS_ENUM(NSInteger, CEMenuItemTag) {
|
||||
CEFileEncodingMenuItemTag = 4001,
|
||||
CESyntaxMenuItemTag = 4002,
|
||||
CEThemeMenuItemTag = 4003,
|
||||
CEServicesMenuItemTag = 999, // const not to list up in "Menu Key Bindings" Setting
|
||||
CEWindowPanelsMenuItemTag = 7999, // const not to list up in "Menu Key Bindings" Setting
|
||||
CEScriptMenuDirectoryTag = 8999, // const not to list up in "Menu Key Bindings" Setting
|
||||
CEServicesMenuItemTag = 999, // const to not list up in "Menu Key Bindings" setting
|
||||
CEWindowPanelsMenuItemTag = 7999, // const to not list up in "Menu Key Bindings" setting
|
||||
CEScriptMenuDirectoryTag = 8999, // const to not list up in "Menu Key Bindings" setting
|
||||
|
||||
// in script menu
|
||||
CEDefaultScriptMenuItemTag = 8001, // const to not list up in context menu
|
||||
|
||||
// in contextual menu
|
||||
CEUtilityMenuItemTag = 600,
|
||||
|
Loading…
Reference in New Issue
Block a user