[DE] Refactoring + disable "insert page number to current position" when paragraph is disabled.

This commit is contained in:
Julia Radzhabova 2016-08-12 15:04:12 +03:00
parent 6ea59501e9
commit 98c04632d2
3 changed files with 73 additions and 69 deletions

View file

@ -414,8 +414,7 @@ define([
}, },
setDisabled: function(disabled) { setDisabled: function(disabled) {
if (this.rendered && if (this.rendered && this.disabled != disabled) {
this.disabled != disabled) {
var el = this.cmpEl, var el = this.cmpEl,
isGroup = el.hasClass('btn-group'); isGroup = el.hasClass('btn-group');
@ -490,9 +489,9 @@ define([
} }
} }
} }
} },
, setMenu: function (m) { setMenu: function (m) {
if (m && _.isObject(m) && _.isFunction(m.render)){ if (m && _.isObject(m) && _.isFunction(m.render)){
this.menu = m; this.menu = m;
this.menu.render(this.cmpEl); this.menu.render(this.cmpEl);

View file

@ -85,8 +85,8 @@ define([
initialize : function(options) { initialize : function(options) {
Common.UI.ComboBox.prototype.initialize.call(this, _.extend(options, { Common.UI.ComboBox.prototype.initialize.call(this, _.extend(options, {
displayField: 'name' displayField: 'name',
, scroller: { scroller: {
alwaysVisibleY: true, alwaysVisibleY: true,
onChange: this.updateVisibleFontsTiles.bind(this) onChange: this.updateVisibleFontsTiles.bind(this)
} }

View file

@ -761,9 +761,9 @@ define([
this.toolbarControls.push(this.btnHide); this.toolbarControls.push(this.btnHide);
this.btnFitPage = { this.btnFitPage = {
conf: {checked:false} conf: {checked:false},
, setChecked: function(val) { this.conf.checked = val;} setChecked: function(val) { this.conf.checked = val;},
, isChecked: function () { return this.conf.checked; } isChecked: function () { return this.conf.checked; }
}; };
this.btnFitWidth = _.clone(this.btnFitPage); this.btnFitWidth = _.clone(this.btnFitPage);
@ -1137,59 +1137,7 @@ define([
this.updateMetricUnit(); this.updateMetricUnit();
} }
var me = this; // set hints
this.mnuInsertChartPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-insertchart'),
parentMenu: this.btnInsertChart.menu,
showLast: false,
restoreHeight: 411,
groups: new Common.UI.DataViewGroupStore([
{ id: 'menu-chart-group-bar', caption: me.textColumn },
{ id: 'menu-chart-group-line', caption: me.textLine },
{ id: 'menu-chart-group-pie', caption: me.textPie },
{ id: 'menu-chart-group-hbar', caption: me.textBar },
{ id: 'menu-chart-group-area', caption: me.textArea },
{ id: 'menu-chart-group-scatter', caption: me.textPoint },
{ id: 'menu-chart-group-stock', caption: me.textStock }
]),
store: new Common.UI.DataViewStore([
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, allowSelected: true, iconCls: 'column-normal', selected: true},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, allowSelected: true, iconCls: 'column-stack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, allowSelected: true, iconCls: 'column-pstack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, allowSelected: true, iconCls: 'column-3d-normal'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, allowSelected: true, iconCls: 'column-3d-stack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, allowSelected: true, iconCls: 'column-3d-pstack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, allowSelected: true, iconCls: 'column-3d-normal-per'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, allowSelected: true, iconCls: 'line-normal'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, allowSelected: true, iconCls: 'line-stack'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, allowSelected: true, iconCls: 'line-pstack'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, allowSelected: true, iconCls: 'line-3d'},
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, allowSelected: true, iconCls: 'pie-normal'},
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, allowSelected: true, iconCls: 'pie-doughnut'},
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, allowSelected: true, iconCls: 'pie-3d-normal'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, allowSelected: true, iconCls: 'bar-normal'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, allowSelected: true, iconCls: 'bar-stack'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, allowSelected: true, iconCls: 'bar-pstack'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, allowSelected: true, iconCls: 'bar-3d-normal'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, allowSelected: true, iconCls: 'bar-3d-stack'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, allowSelected: true, iconCls: 'bar-3d-pstack'},
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, allowSelected: true, iconCls: 'area-normal'},
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, allowSelected: true, iconCls: 'area-stack'},
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, allowSelected: true, iconCls: 'area-pstack'},
{ group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, allowSelected: true, iconCls: 'point-normal'},
{ group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, allowSelected: true, iconCls: 'stock-normal'}
]),
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')
});
this.mnuTablePicker = new Common.UI.DimensionPicker({
el : $('#id-toolbar-menu-tablepicker'),
minRows : 8,
minColumns : 10,
maxRows : 8,
maxColumns : 10
});
this.btnNewDocument.updateHint(this.tipNewDocument); this.btnNewDocument.updateHint(this.tipNewDocument);
this.btnOpenDocument.updateHint(this.tipOpenDocument); this.btnOpenDocument.updateHint(this.tipOpenDocument);
this.btnPrint.updateHint(this.tipPrint + Common.Utils.String.platformKey('Ctrl+P')); this.btnPrint.updateHint(this.tipPrint + Common.Utils.String.platformKey('Ctrl+P'));
@ -1241,6 +1189,10 @@ define([
this.btnHide.updateHint(this.tipViewSettings); this.btnHide.updateHint(this.tipViewSettings);
this.btnAdvSettings.updateHint(this.tipAdvSettings); this.btnAdvSettings.updateHint(this.tipAdvSettings);
// set menus
var me = this;
this.btnHide.setMenu(new Common.UI.Menu({ this.btnHide.setMenu(new Common.UI.Menu({
cls: 'pull-right', cls: 'pull-right',
style: 'min-width: 180px;', style: 'min-width: 180px;',
@ -1264,13 +1216,13 @@ define([
{ caption: '--' }, { caption: '--' },
this.btnFitPage = new Common.UI.MenuItem({ this.btnFitPage = new Common.UI.MenuItem({
caption: this.textFitPage, caption: this.textFitPage,
checkable: true checkable: true,
, checked: this.btnFitPage.isChecked() checked: this.btnFitPage.isChecked()
}), }),
this.btnFitWidth = new Common.UI.MenuItem({ this.btnFitWidth = new Common.UI.MenuItem({
caption: this.textFitWidth, caption: this.textFitWidth,
checkable: true checkable: true,
, checked: this.btnFitWidth.isChecked() checked: this.btnFitWidth.isChecked()
}), }),
(new Common.UI.MenuItem({ (new Common.UI.MenuItem({
template: _.template([ template: _.template([
@ -1338,8 +1290,7 @@ define([
] ]
}) })
); );
this.paragraphControls.push(this.mnuPageNumCurrentPos);
/**/
this.mnuZoomOut = new Common.UI.Button({ this.mnuZoomOut = new Common.UI.Button({
el : $('#id-menu-zoom-out'), el : $('#id-menu-zoom-out'),
@ -1350,6 +1301,8 @@ define([
cls : 'btn-toolbar' cls : 'btn-toolbar'
}); });
// set dataviews
var _conf = this.mnuMarkersPicker.conf; var _conf = this.mnuMarkersPicker.conf;
this.mnuMarkersPicker = new Common.UI.DataView({ this.mnuMarkersPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-markers'), el: $('#id-toolbar-menu-markers'),
@ -1419,9 +1372,61 @@ define([
{ offsety: 165, allowSelected: false, data:{ type:c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM, subtype:c_pageNumPosition.PAGE_NUM_POSITION_RIGHT} } { offsety: 165, allowSelected: false, data:{ type:c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM, subtype:c_pageNumPosition.PAGE_NUM_POSITION_RIGHT} }
]), ]),
itemTemplate: _.template('<div id="<%= id %>" class="item-pagenumber" style="background-position: 0 -<%= offsety %>px"></div>') itemTemplate: _.template('<div id="<%= id %>" class="item-pagenumber" style="background-position: 0 -<%= offsety %>px"></div>')
}) });
_conf && this.mnuPageNumberPosPicker.setDisabled(_conf.disabled); _conf && this.mnuPageNumberPosPicker.setDisabled(_conf.disabled);
this.mnuInsertChartPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-insertchart'),
parentMenu: this.btnInsertChart.menu,
showLast: false,
restoreHeight: 411,
groups: new Common.UI.DataViewGroupStore([
{ id: 'menu-chart-group-bar', caption: me.textColumn },
{ id: 'menu-chart-group-line', caption: me.textLine },
{ id: 'menu-chart-group-pie', caption: me.textPie },
{ id: 'menu-chart-group-hbar', caption: me.textBar },
{ id: 'menu-chart-group-area', caption: me.textArea },
{ id: 'menu-chart-group-scatter', caption: me.textPoint },
{ id: 'menu-chart-group-stock', caption: me.textStock }
]),
store: new Common.UI.DataViewStore([
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, allowSelected: true, iconCls: 'column-normal', selected: true},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, allowSelected: true, iconCls: 'column-stack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, allowSelected: true, iconCls: 'column-pstack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, allowSelected: true, iconCls: 'column-3d-normal'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, allowSelected: true, iconCls: 'column-3d-stack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, allowSelected: true, iconCls: 'column-3d-pstack'},
{ group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, allowSelected: true, iconCls: 'column-3d-normal-per'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, allowSelected: true, iconCls: 'line-normal'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, allowSelected: true, iconCls: 'line-stack'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, allowSelected: true, iconCls: 'line-pstack'},
{ group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, allowSelected: true, iconCls: 'line-3d'},
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, allowSelected: true, iconCls: 'pie-normal'},
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, allowSelected: true, iconCls: 'pie-doughnut'},
{ group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, allowSelected: true, iconCls: 'pie-3d-normal'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, allowSelected: true, iconCls: 'bar-normal'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, allowSelected: true, iconCls: 'bar-stack'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, allowSelected: true, iconCls: 'bar-pstack'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, allowSelected: true, iconCls: 'bar-3d-normal'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, allowSelected: true, iconCls: 'bar-3d-stack'},
{ group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, allowSelected: true, iconCls: 'bar-3d-pstack'},
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, allowSelected: true, iconCls: 'area-normal'},
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, allowSelected: true, iconCls: 'area-stack'},
{ group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, allowSelected: true, iconCls: 'area-pstack'},
{ group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, allowSelected: true, iconCls: 'point-normal'},
{ group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, allowSelected: true, iconCls: 'stock-normal'}
]),
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')
});
this.mnuTablePicker = new Common.UI.DimensionPicker({
el : $('#id-toolbar-menu-tablepicker'),
minRows : 8,
minColumns : 10,
maxRows : 8,
maxColumns : 10
});
/**/ /**/
var mode = this.mode; var mode = this.mode;
var value = Common.localStorage.getItem("de-compact-toolbar"); var value = Common.localStorage.getItem("de-compact-toolbar");