菜单功能添加

This commit is contained in:
Van 2014-12-05 17:59:42 +08:00
parent 6600fec368
commit 43b4cd8d98
5 changed files with 66 additions and 51 deletions

View File

@ -78,7 +78,7 @@ var editors = {
init: function () {
$("#dialogCloseEditor").dialog({
"modal": true,
"height": 66,
"height": 90,
"width": 260,
"title": config.label.tip,
"hideFooter": true,

View File

@ -21,35 +21,71 @@ var hotkeys = {
ctrlKey: true,
altKey: false,
shiftKey: false,
which: 48
which: 48,
fun: function () {
if (wide.curEditor) {
wide.curEditor.focus();
}
}
},
// Ctrl-1 焦点切换到文件树
goFileTree: {
ctrlKey: true,
altKey: false,
shiftKey: false,
which: 49
which: 49,
fun: function () {
// 有些元素需设置 tabindex 为 -1 时才可以 focus
if ($(".footer .ico-restore:eq(0)").css("display") === "inline") {
// 当文件树最小化时
$(".side").css({
"left": "0"
});
if ($(".footer .ico-restore:eq(1)").css("display") === "inline") {
// 当底部最小化时
$(".bottom-window-group").css("top", "100%").hide();
}
}
$("#files").focus();
}
},
// Ctrl-4 焦点切换到输出窗口
goOutput: {
ctrlKey: true,
altKey: false,
shiftKey: false,
which: 52
which: 52,
fun: function () {
bottomGroup.tabs.setCurrent("output");
windows.flowBottom();
$(".bottom-window-group .output").focus();
}
},
// Ctrl-5 焦点切换到搜索窗口
goSearch: {
ctrlKey: true,
altKey: false,
shiftKey: false,
which: 53
which: 53,
fun: function () {
bottomGroup.tabs.setCurrent("search");
windows.flowBottom();
$(".bottom-window-group .search").focus();
}
},
// Ctrl-6 焦点切换到通知窗口
goNotification: {
ctrlKey: true,
altKey: false,
shiftKey: false,
which: 54
which: 54,
fun: function () {
bottomGroup.tabs.setCurrent("notification");
windows.flowBottom();
$(".bottom-window-group .notification").focus();
}
},
// Ctrl-C 清空窗口内容
clearWindow: {
@ -311,9 +347,7 @@ var hotkeys = {
$(document).keydown(function (event) {
if (event.ctrlKey === hotKeys.goEditor.ctrlKey
&& event.which === hotKeys.goEditor.which) { // Ctrl-0 焦点切换到当前编辑器
if (wide.curEditor) {
wide.curEditor.focus();
}
hotKeys.goEditor.fun();
event.preventDefault();
return;
@ -321,20 +355,7 @@ var hotkeys = {
if (event.ctrlKey === hotKeys.goFileTree.ctrlKey
&& event.which === hotKeys.goFileTree.which) { // Ctrl-1 焦点切换到文件树
// 有些元素需设置 tabindex 为 -1 时才可以 focus
if ($(".footer .ico-restore:eq(0)").css("display") === "inline") {
// 当文件树最小化时
$(".side").css({
"left": "0"
});
if ($(".footer .ico-restore:eq(1)").css("display") === "inline") {
// 当底部最小化时
$(".bottom-window-group").css("top", "100%").hide();
}
}
$("#files").focus();
hotKeys.goFileTree.fun();
event.preventDefault();
return;
@ -342,10 +363,7 @@ var hotkeys = {
if (event.ctrlKey === hotKeys.goOutput.ctrlKey
&& event.which === hotKeys.goOutput.which) { // Ctrl-4 焦点切换到输出窗口
bottomGroup.tabs.setCurrent("output");
windows.flowBottom();
$(".bottom-window-group .output").focus();
hotKeys.goOutput.fun();
event.preventDefault();
return;
@ -353,9 +371,7 @@ var hotkeys = {
if (event.ctrlKey === hotKeys.goSearch.ctrlKey
&& event.which === hotKeys.goSearch.which) { // Ctrl-5 焦点切换到搜索窗口
bottomGroup.tabs.setCurrent("search");
windows.flowBottom();
$(".bottom-window-group .search").focus();
hotKeys.goSearch.fun();
event.preventDefault();
return;
@ -363,9 +379,7 @@ var hotkeys = {
if (event.ctrlKey === hotKeys.goNotification.ctrlKey
&& event.which === hotKeys.goNotification.which) { // Ctrl-6 焦点切换到通知窗口
bottomGroup.tabs.setCurrent("notification");
windows.flowBottom();
$(".bottom-window-group .notification").focus();
hotKeys.goNotification.fun();
event.preventDefault();
return;

View File

@ -370,7 +370,7 @@ var tree = {
$("#dialogSearchForm").dialog({
"modal": true,
"height": 62,
"height": 80,
"width": 260,
"title": config.label.search,
"okText": config.label.search,

View File

@ -193,7 +193,7 @@ var wide = {
$("#dialogGoFilePrompt").dialog({
"modal": true,
"height": 300,
"height": 320,
"width": 660,
"title": config.label.goto_file,
"okText": config.label.go,

View File

@ -38,7 +38,7 @@
<ul>
<li class="save-all disabled" onclick="menu.saveAllFiles()">
<span>{{.i18n.save_all_files}}</span>
<span class="fn-right">Shift-Ctrl-S</span>
<span class="fn-right ft-small">Shift-Ctrl-S</span>
</li>
<li class="close-all" onclick="menu.closeAllFiles()">
<span>{{.i18n.close_all_files}}</span>
@ -133,12 +133,12 @@
<ul>
<li onclick="$('#dialogGoFilePrompt').dialog('open')">
<span>{{.i18n.goto_file}}</span>
<span class="fn-right">Shift-Alt-O</span>
<span class="fn-right ft-small">Shift-Alt-O</span>
</li>
<li class="hr"></li>
<li onclick="$('#dialogSearchForm').dialog('open')">
<span>{{.i18n.find_in_files}}</span>
<span class="fn-right">Ctrl-F</span>
<span class="fn-right ft-small">Ctrl-F</span>
</li>
<li class="hr"></li>
<li onclick="alert('Dev In Progress')">
@ -163,24 +163,25 @@
<span>{{.i18n.focus}}</span>
<div class="frame">
<ul>
<li onclick="alert('Dev In Progress')">
<span>{{.i18n.switch_tab}}</span>
</li>
<li class="hr"></li>
<li onclick="alert('Dev In Progress')">
<li onclick="hotkeys.defaultKeyMap.goEditor.fun()">
<span>{{.i18n.focus_editor}}</span>
<span class="fn-right ft-small">Ctrl-0</span>
</li>
<li onclick="alert('Dev In Progress')">
<li onclick="hotkeys.defaultKeyMap.goFileTree.fun()">
<span>{{.i18n.focus_file_tree}}</span>
<span class="fn-right ft-small">Ctrl-1</span>
</li>
<li onclick="alert('Dev In Progress')">
<li onclick="hotkeys.defaultKeyMap.goOutput.fun()">
<span>{{.i18n.focus_output}}</span>
<span class="fn-right ft-small">Ctrl-4</span>
</li>
<li onclick="alert('Dev In Progress')">
<li onclick="hotkeys.defaultKeyMap.goSearch.fun()">
<span>{{.i18n.focus_search}}</span>
<span class="fn-right ft-small">Ctrl-5</span>
</li>
<li onclick="alert('Dev In Progress')">
<li onclick="hotkeys.defaultKeyMap.goNotification.fun()">
<span>{{.i18n.focus_notification}}</span>
<span class="fn-right ft-small">Ctrl-6</span>
</li>
</ul>
</div>
@ -191,11 +192,11 @@
<ul>
<li class="build disabled" onclick="menu.build()">
<span>{{.i18n.build}}</span>
<span class="fn-right">F5</span>
<span class="fn-right ft-small">F5</span>
</li>
<li class="run disabled" onclick="menu.run()">
<span>{{.i18n.build_n_run}}</span>
<span class="fn-right">F6</span>
<span class="fn-right ft-small">F6</span>
</li>
<li class="hr"></li>
<li class="go-test disabled" onclick="menu.test()">