菜单功能添加

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 () { init: function () {
$("#dialogCloseEditor").dialog({ $("#dialogCloseEditor").dialog({
"modal": true, "modal": true,
"height": 66, "height": 90,
"width": 260, "width": 260,
"title": config.label.tip, "title": config.label.tip,
"hideFooter": true, "hideFooter": true,

View File

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

View File

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

View File

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

View File

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