main menu: add entries for preview and fullscreen

This commit is contained in:
rlx 2016-01-18 11:15:33 +05:30
parent a51f5cef09
commit 097708fedd
3 changed files with 34 additions and 1 deletions

View file

@ -18,6 +18,7 @@ oml.ui.list = function() {
}
},
closepreview: function() {
oml.$ui.mainMenu.setItemTitle('preview', Ox._('Show Preview'));
oml.$ui.previewButton.options({value: false});
oml.$ui.previewDialog.close();
delete oml.$ui.previewDialog;
@ -112,6 +113,7 @@ oml.ui.list = function() {
},
openpreview: function() {
if (!oml.$ui.previewDialog) {
oml.$ui.mainMenu.setItemTitle('preview', Ox._('Hide Preview'));
oml.$ui.previewButton.options({value: true});
oml.$ui.previewDialog = oml.ui.previewDialog()
.open()

View file

@ -227,6 +227,19 @@ oml.ui.mainMenu = function() {
title: Ox._((ui.showBrowser ? 'Hide': 'Show') + ' Browser'),
keyboard: 'shift b',
disabled: !ui.item
},
{},
{
id: 'preview',
title: Ox._('Show Preview'),
keyboard: 'space',
disabled: !!ui.item || !ui.listSelection.length
},
{
id: 'fullscreen',
title: Ox._('Enter Fullscreen'),
keyboard: 'shift alt f',
disabled: !ui.item || ui.itemView == 'info'
}
]
},
@ -520,6 +533,18 @@ oml.ui.mainMenu = function() {
oml.UI.set({showFilters: !ui.showFilters});
} else if (id == 'showbrowser') {
oml.UI.set({showBrowser: !ui.showBrowser});
} else if (id == 'preview') {
that.setItemTitle(
'preview',
data.title == Ox._('Show Preview')
? Ox._('Hide Preview') : Ox._('Show Preview')
);
oml.$ui.list[
data.title == Ox._('Show Preview')
? 'openPreview' : 'closePreview'
]();
} else if (id == 'fullscreen') {
Ox.Fullscreen.enter(oml.$ui.viewer.find('iframe')[0]);
} else if (id == 'debugmode') {
if (oml.localStorage('enableDebugMode')) {
oml.localStorage['delete']('enableDebugMode');
@ -562,10 +587,12 @@ oml.ui.mainMenu = function() {
},
oml_itemview: function(data) {
that.checkItem('viewMenu_itemviewSubmenu_' + data.value);
that[data.value == 'book' ? 'enableItem' : 'disableItem']('fullscreen');
},
oml_listselection: function(data) {
that.replaceMenu('listMenu', getListMenu());
that.replaceMenu('editMenu', getEditMenu());
that[!ui.item && data.value.length ? 'enableItem' : 'disableItem']('preview');
},
oml_listsort: function(data) {
that.checkItem('sortMenu_sortitems_' + data.value[0].key);
@ -596,6 +623,11 @@ oml.ui.mainMenu = function() {
},
});
Ox.Event.bind({
key_alt_shift_f: function() {
if (ui.item && ui.itemView == 'book') {
Ox.Fullscreen.enter(oml.$ui.viewer.find('iframe')[0]);
}
},
key_backtick: function() {
changeFocus(1);
},

View file

@ -30,5 +30,4 @@ oml.ui.previewButton = function() {
return that.updateElement();
};