[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)
|
||||
},
|
||||
'Common.Views.Header': {
|
||||
'statusbar:hide': function (view, status) {
|
||||
me.statusbar.setVisible(!status);
|
||||
Common.localStorage.setBool('de-hidden-status', status);
|
||||
|
||||
Common.NotificationCenter.trigger('layout:changed', 'status');
|
||||
Common.NotificationCenter.trigger('edit:complete', me.statusbar);
|
||||
}
|
||||
'statusbar:hide': _.bind(me.onChangeCompactView, me)
|
||||
},
|
||||
'ViewTab': {
|
||||
'statusbar:hide': _.bind(me.onChangeCompactView, me)
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -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) {
|
||||
var global = (localFlag===null),
|
||||
state = global ? globalFlag : localFlag;
|
||||
|
|
|
@ -172,6 +172,9 @@ define([
|
|||
'go:editor': function() {
|
||||
Common.Gateway.requestEditRights();
|
||||
}
|
||||
},
|
||||
'ViewTab': {
|
||||
'toolbar:setcompact': this.onChangeCompactView.bind(this)
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -73,16 +73,30 @@ define([
|
|||
this.toolbar = config.toolbar;
|
||||
this.view = this.createView('ViewTab', {
|
||||
toolbar: this.toolbar.toolbar,
|
||||
mode: config.mode
|
||||
mode: config.mode,
|
||||
compactToolbar: this.toolbar.toolbar.isCompactView
|
||||
});
|
||||
this.addListeners({
|
||||
'ViewTab': {
|
||||
'zoom:value': _.bind(this.onChangeZoomValue, this),
|
||||
'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': {
|
||||
|
||||
'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);
|
||||
},
|
||||
|
||||
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 || {}));
|
||||
});
|
|
@ -105,6 +105,14 @@ define([
|
|||
if ( me.header.btnSave )
|
||||
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));
|
||||
}
|
||||
|
||||
var mnuitemHideStatusBar = new Common.UI.MenuItem({
|
||||
me.header.mnuitemHideStatusBar = new Common.UI.MenuItem({
|
||||
caption: me.header.textHideStatusBar,
|
||||
checked: Common.localStorage.getBool("de-hidden-status"),
|
||||
checkable: true,
|
||||
|
@ -239,16 +247,16 @@ define([
|
|||
});
|
||||
|
||||
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,
|
||||
checked: Common.Utils.InternalSettings.get("de-hidden-rulers"),
|
||||
checkable: true,
|
||||
value: 'rulers'
|
||||
});
|
||||
if (!config.isEdit)
|
||||
mnuitemHideRulers.hide();
|
||||
me.header.mnuitemHideRulers.hide();
|
||||
|
||||
me.header.menuItemsDarkMode = new Common.UI.MenuItem({
|
||||
caption: me.txtDarkMode,
|
||||
|
@ -292,8 +300,8 @@ define([
|
|||
style: 'min-width: 180px;',
|
||||
items: [
|
||||
me.header.mnuitemCompactToolbar,
|
||||
mnuitemHideStatusBar,
|
||||
mnuitemHideRulers,
|
||||
me.header.mnuitemHideStatusBar,
|
||||
me.header.mnuitemHideRulers,
|
||||
{caption:'--'},
|
||||
me.header.menuItemsDarkMode,
|
||||
{caption:'--'},
|
||||
|
@ -422,6 +430,7 @@ define([
|
|||
Common.Utils.InternalSettings.set("de-hidden-rulers", item.isChecked());
|
||||
Common.NotificationCenter.trigger('layout:changed', 'rulers');
|
||||
Common.NotificationCenter.trigger('edit:complete', me.header);
|
||||
me.header.fireEvent('toolbar:hiderulers', [item.isChecked()]);
|
||||
break;
|
||||
case 'zoom:page':
|
||||
item.isChecked() ? me.api.zoomFitToPage() : me.api.zoomCustomMode();
|
||||
|
|
|
@ -63,6 +63,15 @@ define([
|
|||
me.btnFitToWidth && me.btnFitToWidth.on('click', function () {
|
||||
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) {
|
||||
|
@ -164,7 +173,7 @@ define([
|
|||
this.chStatusbar = new Common.UI.CheckBox({
|
||||
el: $host.findById('#slot-chk-statusbar'),
|
||||
labelText: this.textStatusBar,
|
||||
value: true, //!Common.localStorage.getBool(''),
|
||||
value: !Common.localStorage.getBool("de-hidden-status"),
|
||||
//lock: [_set.lostConnect, _set.coAuth, _set.editCell],
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'left',
|
||||
|
@ -175,7 +184,7 @@ define([
|
|||
this.chToolbar = new Common.UI.CheckBox({
|
||||
el: $host.findById('#slot-chk-toolbar'),
|
||||
labelText: this.textAlwaysShowToolbar,
|
||||
value: true, //!Common.localStorage.getBool(''),
|
||||
value: !options.compactToolbar,
|
||||
//lock: [_set.lostConnect, _set.coAuth, _set.editCell],
|
||||
dataHint : '1',
|
||||
dataHintDirection: 'left',
|
||||
|
@ -186,7 +195,7 @@ define([
|
|||
this.chRulers = new Common.UI.CheckBox({
|
||||
el: $host.findById('#slot-chk-rulers'),
|
||||
labelText: this.textRulers,
|
||||
value: true, //!Common.localStorage.getBool(''),
|
||||
value: !Common.Utils.InternalSettings.get("de-hidden-rulers"),
|
||||
//lock: [_set.lostConnect, _set.coAuth, _set.editCell],
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'left',
|
||||
|
|
Loading…
Reference in a new issue