[DE] Add handlers to show toolbar, statusbar, rulers buttons in view tab
This commit is contained in:
parent
66f0444bd0
commit
d4b08a16ed
|
@ -65,13 +65,10 @@ define([
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
},
|
},
|
||||||
'Common.Views.Header': {
|
'Common.Views.Header': {
|
||||||
'statusbar:hide': function (view, status) {
|
'statusbar:hide': _.bind(me.onChangeCompactView, me)
|
||||||
me.statusbar.setVisible(!status);
|
},
|
||||||
Common.localStorage.setBool('de-hidden-status', status);
|
'ViewTab': {
|
||||||
|
'statusbar:hide': _.bind(me.onChangeCompactView, me)
|
||||||
Common.NotificationCenter.trigger('layout:changed', 'status');
|
|
||||||
Common.NotificationCenter.trigger('edit:complete', me.statusbar);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -174,6 +171,18 @@ define([
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onChangeCompactView: function (view, status) {
|
||||||
|
this.statusbar.setVisible(!status);
|
||||||
|
Common.localStorage.setBool('de-hidden-status', status);
|
||||||
|
|
||||||
|
if ($(view).parent().prop('id') !== 'slot-btn-options') {
|
||||||
|
this.statusbar.fireEvent('view:hide', [this, status]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Common.NotificationCenter.trigger('layout:changed', 'status');
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', this.statusbar);
|
||||||
|
},
|
||||||
|
|
||||||
onApiTrackRevisionsChange: function(localFlag, globalFlag, userId) {
|
onApiTrackRevisionsChange: function(localFlag, globalFlag, userId) {
|
||||||
var global = (localFlag===null),
|
var global = (localFlag===null),
|
||||||
state = global ? globalFlag : localFlag;
|
state = global ? globalFlag : localFlag;
|
||||||
|
|
|
@ -172,6 +172,9 @@ define([
|
||||||
'go:editor': function() {
|
'go:editor': function() {
|
||||||
Common.Gateway.requestEditRights();
|
Common.Gateway.requestEditRights();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'ViewTab': {
|
||||||
|
'toolbar:setcompact': this.onChangeCompactView.bind(this)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -73,16 +73,30 @@ define([
|
||||||
this.toolbar = config.toolbar;
|
this.toolbar = config.toolbar;
|
||||||
this.view = this.createView('ViewTab', {
|
this.view = this.createView('ViewTab', {
|
||||||
toolbar: this.toolbar.toolbar,
|
toolbar: this.toolbar.toolbar,
|
||||||
mode: config.mode
|
mode: config.mode,
|
||||||
|
compactToolbar: this.toolbar.toolbar.isCompactView
|
||||||
});
|
});
|
||||||
this.addListeners({
|
this.addListeners({
|
||||||
'ViewTab': {
|
'ViewTab': {
|
||||||
'zoom:value': _.bind(this.onChangeZoomValue, this),
|
'zoom:value': _.bind(this.onChangeZoomValue, this),
|
||||||
'zoom:topage': _.bind(this.onBtnZoomTo, this, 'topage'),
|
'zoom:topage': _.bind(this.onBtnZoomTo, this, 'topage'),
|
||||||
'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth')
|
'zoom:towidth': _.bind(this.onBtnZoomTo, this, 'towidth'),
|
||||||
|
'rulers:change': _.bind(this.onChangeRulers, this)
|
||||||
|
},
|
||||||
|
'Toolbar': {
|
||||||
|
'view:compact': _.bind(function (toolbar, state) {
|
||||||
|
this.view.chToolbar.setValue(!state, true);
|
||||||
|
}, this)
|
||||||
},
|
},
|
||||||
'Statusbar': {
|
'Statusbar': {
|
||||||
|
'view:hide': _.bind(function (statusbar, state) {
|
||||||
|
this.view.chStatusbar.setValue(!state, true);
|
||||||
|
}, this)
|
||||||
|
},
|
||||||
|
'Common.Views.Header': {
|
||||||
|
'toolbar:hiderulers': _.bind(function (isChecked) {
|
||||||
|
this.view.chRulers.setValue(!isChecked, true);
|
||||||
|
}, this)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -164,5 +178,14 @@ define([
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onChangeRulers: function (btn, checked) {
|
||||||
|
this.api.asc_SetViewRulers(checked);
|
||||||
|
Common.localStorage.setBool('de-hidden-rulers', !checked);
|
||||||
|
Common.Utils.InternalSettings.set("de-hidden-rulers", !checked);
|
||||||
|
this.view.fireEvent('rulers:hide', [!checked]);
|
||||||
|
Common.NotificationCenter.trigger('layout:changed', 'rulers');
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
|
},
|
||||||
|
|
||||||
}, DE.Controllers.ViewTab || {}));
|
}, DE.Controllers.ViewTab || {}));
|
||||||
});
|
});
|
|
@ -105,6 +105,14 @@ define([
|
||||||
if ( me.header.btnSave )
|
if ( me.header.btnSave )
|
||||||
me.header.btnSave.setDisabled(state);
|
me.header.btnSave.setDisabled(state);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
'ViewTab': {
|
||||||
|
'rulers:hide': function (state) {
|
||||||
|
me.header.mnuitemHideRulers.setChecked(state, true);
|
||||||
|
},
|
||||||
|
'statusbar:hide': function (view, state) {
|
||||||
|
me.header.mnuitemHideStatusBar.setChecked(state, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -231,7 +239,7 @@ define([
|
||||||
}, this));
|
}, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
var mnuitemHideStatusBar = new Common.UI.MenuItem({
|
me.header.mnuitemHideStatusBar = new Common.UI.MenuItem({
|
||||||
caption: me.header.textHideStatusBar,
|
caption: me.header.textHideStatusBar,
|
||||||
checked: Common.localStorage.getBool("de-hidden-status"),
|
checked: Common.localStorage.getBool("de-hidden-status"),
|
||||||
checkable: true,
|
checkable: true,
|
||||||
|
@ -239,16 +247,16 @@ define([
|
||||||
});
|
});
|
||||||
|
|
||||||
if ( config.canBrandingExt && config.customization && config.customization.statusBar === false )
|
if ( config.canBrandingExt && config.customization && config.customization.statusBar === false )
|
||||||
mnuitemHideStatusBar.hide();
|
me.header.mnuitemHideStatusBar.hide();
|
||||||
|
|
||||||
var mnuitemHideRulers = new Common.UI.MenuItem({
|
me.header.mnuitemHideRulers = new Common.UI.MenuItem({
|
||||||
caption: me.header.textHideLines,
|
caption: me.header.textHideLines,
|
||||||
checked: Common.Utils.InternalSettings.get("de-hidden-rulers"),
|
checked: Common.Utils.InternalSettings.get("de-hidden-rulers"),
|
||||||
checkable: true,
|
checkable: true,
|
||||||
value: 'rulers'
|
value: 'rulers'
|
||||||
});
|
});
|
||||||
if (!config.isEdit)
|
if (!config.isEdit)
|
||||||
mnuitemHideRulers.hide();
|
me.header.mnuitemHideRulers.hide();
|
||||||
|
|
||||||
me.header.menuItemsDarkMode = new Common.UI.MenuItem({
|
me.header.menuItemsDarkMode = new Common.UI.MenuItem({
|
||||||
caption: me.txtDarkMode,
|
caption: me.txtDarkMode,
|
||||||
|
@ -292,8 +300,8 @@ define([
|
||||||
style: 'min-width: 180px;',
|
style: 'min-width: 180px;',
|
||||||
items: [
|
items: [
|
||||||
me.header.mnuitemCompactToolbar,
|
me.header.mnuitemCompactToolbar,
|
||||||
mnuitemHideStatusBar,
|
me.header.mnuitemHideStatusBar,
|
||||||
mnuitemHideRulers,
|
me.header.mnuitemHideRulers,
|
||||||
{caption:'--'},
|
{caption:'--'},
|
||||||
me.header.menuItemsDarkMode,
|
me.header.menuItemsDarkMode,
|
||||||
{caption:'--'},
|
{caption:'--'},
|
||||||
|
@ -422,6 +430,7 @@ define([
|
||||||
Common.Utils.InternalSettings.set("de-hidden-rulers", item.isChecked());
|
Common.Utils.InternalSettings.set("de-hidden-rulers", item.isChecked());
|
||||||
Common.NotificationCenter.trigger('layout:changed', 'rulers');
|
Common.NotificationCenter.trigger('layout:changed', 'rulers');
|
||||||
Common.NotificationCenter.trigger('edit:complete', me.header);
|
Common.NotificationCenter.trigger('edit:complete', me.header);
|
||||||
|
me.header.fireEvent('toolbar:hiderulers', [item.isChecked()]);
|
||||||
break;
|
break;
|
||||||
case 'zoom:page':
|
case 'zoom:page':
|
||||||
item.isChecked() ? me.api.zoomFitToPage() : me.api.zoomCustomMode();
|
item.isChecked() ? me.api.zoomFitToPage() : me.api.zoomCustomMode();
|
||||||
|
|
|
@ -63,6 +63,15 @@ define([
|
||||||
me.btnFitToWidth && me.btnFitToWidth.on('click', function () {
|
me.btnFitToWidth && me.btnFitToWidth.on('click', function () {
|
||||||
me.fireEvent('zoom:towidth');
|
me.fireEvent('zoom:towidth');
|
||||||
});
|
});
|
||||||
|
me.chToolbar && me.chToolbar.on('change', _.bind(function(checkbox, state) {
|
||||||
|
me.fireEvent('toolbar:setcompact', [me.chToolbar, state !== 'checked']);
|
||||||
|
}, me));
|
||||||
|
me.chStatusbar && me.chStatusbar.on('change', _.bind(function (checkbox, state) {
|
||||||
|
me.fireEvent('statusbar:hide', [me.chStatusbar, state !== 'checked']);
|
||||||
|
}, me));
|
||||||
|
me.chRulers && me.chRulers.on('change', _.bind(function (checkbox, state) {
|
||||||
|
me.fireEvent('rulers:change', [me.chRulers, state === 'checked']);
|
||||||
|
}, me));
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
|
@ -164,7 +173,7 @@ define([
|
||||||
this.chStatusbar = new Common.UI.CheckBox({
|
this.chStatusbar = new Common.UI.CheckBox({
|
||||||
el: $host.findById('#slot-chk-statusbar'),
|
el: $host.findById('#slot-chk-statusbar'),
|
||||||
labelText: this.textStatusBar,
|
labelText: this.textStatusBar,
|
||||||
value: true, //!Common.localStorage.getBool(''),
|
value: !Common.localStorage.getBool("de-hidden-status"),
|
||||||
//lock: [_set.lostConnect, _set.coAuth, _set.editCell],
|
//lock: [_set.lostConnect, _set.coAuth, _set.editCell],
|
||||||
dataHint: '1',
|
dataHint: '1',
|
||||||
dataHintDirection: 'left',
|
dataHintDirection: 'left',
|
||||||
|
@ -175,7 +184,7 @@ define([
|
||||||
this.chToolbar = new Common.UI.CheckBox({
|
this.chToolbar = new Common.UI.CheckBox({
|
||||||
el: $host.findById('#slot-chk-toolbar'),
|
el: $host.findById('#slot-chk-toolbar'),
|
||||||
labelText: this.textAlwaysShowToolbar,
|
labelText: this.textAlwaysShowToolbar,
|
||||||
value: true, //!Common.localStorage.getBool(''),
|
value: !options.compactToolbar,
|
||||||
//lock: [_set.lostConnect, _set.coAuth, _set.editCell],
|
//lock: [_set.lostConnect, _set.coAuth, _set.editCell],
|
||||||
dataHint : '1',
|
dataHint : '1',
|
||||||
dataHintDirection: 'left',
|
dataHintDirection: 'left',
|
||||||
|
@ -186,7 +195,7 @@ define([
|
||||||
this.chRulers = new Common.UI.CheckBox({
|
this.chRulers = new Common.UI.CheckBox({
|
||||||
el: $host.findById('#slot-chk-rulers'),
|
el: $host.findById('#slot-chk-rulers'),
|
||||||
labelText: this.textRulers,
|
labelText: this.textRulers,
|
||||||
value: true, //!Common.localStorage.getBool(''),
|
value: !Common.Utils.InternalSettings.get("de-hidden-rulers"),
|
||||||
//lock: [_set.lostConnect, _set.coAuth, _set.editCell],
|
//lock: [_set.lostConnect, _set.coAuth, _set.editCell],
|
||||||
dataHint: '1',
|
dataHint: '1',
|
||||||
dataHintDirection: 'left',
|
dataHintDirection: 'left',
|
||||||
|
|
Loading…
Reference in a new issue