[PE] Add guides settings to context menu

This commit is contained in:
Julia Radzhabova 2022-09-29 18:26:54 +03:00
parent dfeea528ac
commit 7ed283a202
4 changed files with 74 additions and 12 deletions

View file

@ -422,6 +422,7 @@ define([
view.menuTableSelectText.menu.on('item:click', _.bind(me.tableSelectText, me));
view.menuTableInsertText.menu.on('item:click', _.bind(me.tableInsertText, me));
view.menuTableDeleteText.menu.on('item:click', _.bind(me.tableDeleteText, me));
view.mnuGuides.menu.on('item:click', _.bind(me.onGuidesClick, me));
},
getView: function (name) {
@ -2114,6 +2115,17 @@ define([
return false;
},
onGuidesClick: function(menu, item) {
if (item.value === 'add-vert' || item.value === 'add-hor')
this.documentHolder.fireEvent('guides:add', [item.value]);
else if (item.value === 'clear')
this.documentHolder.fireEvent('guides:clear');
else if (item.value === 'smart')
this.documentHolder.fireEvent('guides:smart', [item.isChecked()]);
else
this.documentHolder.fireEvent('guides:show', [item.isChecked()]);
},
SetDisabled: function(state) {
this._isDisabled = state;
this.documentHolder.SetDisabled(state);

View file

@ -108,6 +108,12 @@ define([
'view:hide': _.bind(function (statusbar, state) {
this.view.chStatusbar.setValue(!state, true);
}, this)
},
'DocumentHolder': {
'guides:show': _.bind(this.onGuidesShow, this),
'guides:add': _.bind(this.onGuidesAdd, this),
'guides:clear': _.bind(this.onGuidesClear, this),
'guides:smart': _.bind(this.onGuidesSmartShow, this)
}
});
},
@ -228,7 +234,7 @@ define([
onGuidesAfterShow: function() {
if (this.view) {
this.view.btnGuides.menu.items[6].setDisabled(this.api.asc_canClearGuides());
this.view.btnGuides.menu.items[6].setDisabled(!this.api.asc_canClearGuides());
this.view.btnGuides.menu.items[0].setChecked(this.api.asc_getShowGuides(), true);
this.view.btnGuides.menu.items[5].setChecked(this.api.asc_getShowSmartGuides(), true);
}

View file

@ -959,6 +959,22 @@ define([
checked: false
});
me.mnuGuides = new Common.UI.MenuItem({
caption : me.textGuides,
menu : new Common.UI.Menu({
menuAlign: 'tl-tr',
items: [
{ caption: me.textShowGuides, value: 'show', checkable: true },
{ caption: '--'},
{ caption: me.textAddVGuides, value: 'add-vert' },
{ caption: me.textAddHGuides, value: 'add-hor' },
{ caption: '--'},
{ caption: me.textSmartGuides, value: 'smart', checkable: true },
{ caption: me.textClearGuides, value: 'clear' }
]
})
});
me.slideMenu = new Common.UI.Menu({
cls: 'shifted-right',
restoreHeightAndTop: true,
@ -977,17 +993,22 @@ define([
mnuChangeTheme.setVisible(value.isSlideSelect===true || value.fromThumbs!==true);
me.menuSlideSettings.setVisible(value.isSlideSelect===true || value.fromThumbs!==true);
me.menuSlideSettings.options.value = null;
me.slideMenu.items[13].setVisible((!selectedLast || !selectedFirst) && value.isSlideSelect===true);
me.mnuMoveSlideToEnd.setVisible(!selectedLast && value.isSlideSelect===true);
me.mnuMoveSlideToStart.setVisible(!selectedFirst && value.isSlideSelect===true);
me.slideMenu.items[16].setVisible(value.fromThumbs===true);
me.slideMenu.items[17].setVisible(value.fromThumbs===true);
for (var i = 10; i < 13; i++) {
me.slideMenu.items[i].setVisible(value.fromThumbs===true);
}
me.slideMenu.items[10].setVisible(!value.fromThumbs); // guides
me.slideMenu.items[11].setVisible(!value.fromThumbs);
me.slideMenu.items[12].setVisible(value.fromThumbs===true);
me.slideMenu.items[13].setVisible(value.fromThumbs===true);
me.mnuPrintSelection.setVisible(me.mode.canPrint && value.fromThumbs===true);
me.slideMenu.items[15].setVisible((!selectedLast || !selectedFirst) && value.isSlideSelect===true);
me.mnuMoveSlideToEnd.setVisible(!selectedLast && value.isSlideSelect===true);
me.mnuMoveSlideToStart.setVisible(!selectedFirst && value.isSlideSelect===true);
me.slideMenu.items[18].setVisible(value.fromThumbs===true);
me.slideMenu.items[19].setVisible(value.fromThumbs===true);
me.mnuGuides.menu.items[6].setDisabled(!me.api.asc_canClearGuides());
me.mnuGuides.menu.items[0].setChecked(me.api.asc_getShowGuides(), true);
me.mnuGuides.menu.items[5].setChecked(me.api.asc_getShowSmartGuides(), true);
var selectedElements = me.api.getSelectedElements(),
locked = false,
@ -1030,6 +1051,8 @@ define([
mnuChangeTheme,
me.menuSlideSettings,
{caption: '--'},
me.mnuGuides,
{caption: '--'},
me.mnuSelectAll,
me.mnuPrintSelection,
{caption: '--'},
@ -2451,7 +2474,14 @@ define([
textEditPoints: 'Edit Points',
txtMoveSlidesToEnd: 'Move Slide to End',
txtMoveSlidesToStart: 'Move Slide to Beginning',
advancedChartText : 'Chart Advanced Settings'
advancedChartText : 'Chart Advanced Settings',
textGuides: 'Guides',
tipGuides: 'Show guides',
textShowGuides: 'Show Guides',
textAddVGuides: 'Add vertical guide',
textAddHGuides: 'Add horizontal guide',
textSmartGuides: 'Smart Guides',
textClearGuides: 'Clear Guides'
}, PE.Views.DocumentHolder || {}));
});

View file

@ -1613,6 +1613,13 @@
"PE.Views.DocumentHolder.txtUngroup": "Ungroup",
"PE.Views.DocumentHolder.txtWarnUrl": "Clicking this link can be harmful to your device and data.<br>Are you sure you want to continue?",
"PE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
"PE.Views.DocumentHolder.textGuides": "Guides",
"PE.Views.DocumentHolder.tipGuides": "Show guides",
"PE.Views.DocumentHolder.textShowGuides": "Show Guides",
"PE.Views.DocumentHolder.textAddVGuides": "Add vertical guide",
"PE.Views.DocumentHolder.textAddHGuides": "Add horizontal guide",
"PE.Views.DocumentHolder.textSmartGuides": "Smart Guides",
"PE.Views.DocumentHolder.textClearGuides": "Clear Guides",
"PE.Views.DocumentPreview.goToSlideText": "Go to Slide",
"PE.Views.DocumentPreview.slideIndexText": "Slide {0} of {1}",
"PE.Views.DocumentPreview.txtClose": "Close slideshow",
@ -2409,5 +2416,12 @@
"PE.Views.ViewTab.textZoom": "Zoom",
"PE.Views.ViewTab.tipFitToSlide": "Fit to slide",
"PE.Views.ViewTab.tipFitToWidth": "Fit to width",
"PE.Views.ViewTab.tipInterfaceTheme": "Interface theme"
"PE.Views.ViewTab.tipInterfaceTheme": "Interface theme",
"PE.Views.ViewTab.textGuides": "Guides",
"PE.Views.ViewTab.tipGuides": "Show guides",
"PE.Views.ViewTab.textShowGuides": "Show Guides",
"PE.Views.ViewTab.textAddVGuides": "Add vertical guide",
"PE.Views.ViewTab.textAddHGuides": "Add horizontal guide",
"PE.Views.ViewTab.textSmartGuides": "Smart Guides",
"PE.Views.ViewTab.textClearGuides": "Clear Guides"
}