diff --git a/apps/common/main/lib/component/Button.js b/apps/common/main/lib/component/Button.js
index cc142495a..3f251628c 100644
--- a/apps/common/main/lib/component/Button.js
+++ b/apps/common/main/lib/component/Button.js
@@ -494,9 +494,10 @@ define([
},
setMenu: function (m) {
- if (this.rendered && m && _.isObject(m) && _.isFunction(m.render)){
+ if (m && _.isObject(m) && _.isFunction(m.render)){
this.menu = m;
- this.menu.render(this.cmpEl);
+ if (this.rendered)
+ this.menu.render(this.cmpEl);
}
}
});
diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js
index 4664ce5cc..d07eb6e80 100644
--- a/apps/presentationeditor/main/app/controller/Main.js
+++ b/apps/presentationeditor/main/app/controller/Main.js
@@ -653,18 +653,19 @@ define([
if (window.styles_loaded) {
clearInterval(timer_sl);
- toolbarController.getView('Toolbar').createDelayedElements();
+ toolbarController.createDelayedElements();
documentHolderController.getView('DocumentHolder').createDelayedElements();
- rightmenuController.createDelayedElements();
-
- me.api.asc_registerCallback('asc_onFocusObject', _.bind(me.onFocusObject, me));
me.api.asc_registerCallback('asc_onUpdateLayout', _.bind(me.fillLayoutsStore, me)); // slide layouts loading
me.updateThemeColors();
var shapes = me.api.asc_getPropertyEditorShapes();
if (shapes)
me.fillAutoShapes(shapes[0], shapes[1]);
+ rightmenuController.createDelayedElements();
+
+ me.api.asc_registerCallback('asc_onFocusObject', _.bind(me.onFocusObject, me));
+
me.fillTextArt(me.api.asc_getTextArtPreviews());
toolbarController.activateControls();
if (me.needToUpdateVersion)
diff --git a/apps/presentationeditor/main/app/controller/RightMenu.js b/apps/presentationeditor/main/app/controller/RightMenu.js
index f26d27389..5428d872e 100644
--- a/apps/presentationeditor/main/app/controller/RightMenu.js
+++ b/apps/presentationeditor/main/app/controller/RightMenu.js
@@ -246,6 +246,7 @@ define([
if (this.editMode && this.api) {
this.api.asc_registerCallback('asc_doubleClickOnObject', _.bind(this.onDoubleClickOnObject, this));
+ this.rightmenu.shapeSettings.createDelayedElements();
var selectedElements = this.api.getSelectedElements();
if (selectedElements.length>0) {
var open = Common.localStorage.getItem("pe-hide-right-settings");
diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js
index 0db6a057b..bb2a14ba5 100644
--- a/apps/presentationeditor/main/app/controller/Toolbar.js
+++ b/apps/presentationeditor/main/app/controller/Toolbar.js
@@ -171,7 +171,7 @@ define([
// Create toolbar view
this.toolbar = this.createView('Toolbar');
- this.toolbar.on('render:after', _.bind(this.onToolbarAfterRender, this));
+// this.toolbar.on('render:after', _.bind(this.onToolbarAfterRender, this));
},
onToolbarAfterRender: function(toolbar) {
@@ -699,6 +699,7 @@ define([
$('.menu-zoom .zoom', this.toolbar.el).html(percent + '%');
this._state.zoom_percent = percent;
}
+ this.toolbar.mnuZoom.options.value = percent;
},
onApiInitEditorStyles: function(themes) {
@@ -1829,6 +1830,11 @@ define([
}
},
+ createDelayedElements: function() {
+ this.toolbar.createDelayedElements();
+ this.onToolbarAfterRender(this.toolbar);
+ },
+
textEmptyImgUrl : 'You need to specify image URL.',
textWarning : 'Warning',
textFontSizeErr : 'The entered value must be more than 0',
diff --git a/apps/presentationeditor/main/app/view/ChartSettings.js b/apps/presentationeditor/main/app/view/ChartSettings.js
index 9a8df02d2..9eb840695 100644
--- a/apps/presentationeditor/main/app/view/ChartSettings.js
+++ b/apps/presentationeditor/main/app/view/ChartSettings.js
@@ -62,7 +62,6 @@ define([
},
initialize: function () {
- var me = this;
this._initSettings = true;
this._state = {
@@ -83,148 +82,6 @@ define([
this._originalProps = null;
this.render();
-
- this.btnChartType = new Common.UI.Button({
- cls : 'btn-large-dataview',
- iconCls : 'item-chartlist bar-normal',
- menu : new Common.UI.Menu({
- style: 'width: 560px;',
- items: [
- { template: _.template('
') }
- ]
- })
- });
- this.btnChartType.on('render:after', function(btn) {
- me.mnuChartTypePicker = new Common.UI.DataView({
- el: $('#id-chart-menu-type'),
- parentMenu: btn.menu,
- 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, iconCls: 'column-normal', selected: true},
- { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'},
- { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'},
- { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'},
- { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'},
- { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'},
- { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'},
- { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'},
- { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'},
- { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'},
- { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'},
- { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'},
- { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'},
- { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'},
- { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'},
- { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'},
- { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'},
- { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'},
- { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'},
- { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'},
- { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'},
- { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'},
- { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'},
- { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'},
- { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'}
- ]),
- itemTemplate: _.template('')
- });
- });
- this.btnChartType.render($('#chart-button-type'));
- this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this, this.btnChartType));
- this.lockedControls.push(this.btnChartType);
-
- this.btnChartStyle = new Common.UI.Button({
- cls : 'btn-large-dataview',
- iconCls : 'item-wrap',
- menu : new Common.UI.Menu({
- menuAlign: 'tr-br',
- items: [
- { template: _.template('') }
- ]
- })
- });
- this.btnChartStyle.on('render:after', function(btn) {
- me.mnuChartStylePicker = new Common.UI.DataView({
- el: $('#id-chart-menu-style'),
- style: 'max-height: 411px;',
- parentMenu: btn.menu,
- store: new Common.UI.DataViewStore(),
- itemTemplate: _.template('')
- });
-
- if (me.btnChartStyle.menu) {
- me.btnChartStyle.menu.on('show:after', function () {
- me.mnuChartStylePicker.scroller.update({alwaysVisibleY: true});
- });
- }
- });
- this.btnChartStyle.render($('#chart-button-style'));
- this.mnuChartStylePicker.on('item:click', _.bind(this.onSelectStyle, this, this.btnChartStyle));
- this.lockedControls.push(this.btnChartStyle);
-
- this.btnEditData = new Common.UI.Button({
- el: $('#chart-button-edit-data')
- });
- this.btnEditData.on('click', _.bind(this.setEditData, this));
- this.lockedControls.push(this.btnEditData);
-
- this.spnWidth = new Common.UI.MetricSpinner({
- el: $('#chart-spin-width'),
- step: .1,
- width: 78,
- defaultUnit : "cm",
- value: '3 cm',
- maxValue: 55.88,
- minValue: 0
- });
- this.spinners.push(this.spnWidth);
- this.lockedControls.push(this.spnWidth);
-
- this.spnHeight = new Common.UI.MetricSpinner({
- el: $('#chart-spin-height'),
- step: .1,
- width: 78,
- defaultUnit : "cm",
- value: '3 cm',
- maxValue: 55.88,
- minValue: 0
- });
- this.spinners.push(this.spnHeight);
- this.lockedControls.push(this.spnHeight);
-
- this.spnWidth.on('change', _.bind(this.onWidthChange, this));
- this.spnHeight.on('change', _.bind(this.onHeightChange, this));
-
- this.btnRatio = new Common.UI.Button({
- cls: 'btn-toolbar',
- iconCls: 'advanced-btn-ratio',
- style: 'margin-bottom: 1px;',
- enableToggle: true,
- hint: this.textKeepRatio
- });
- this.btnRatio.render($('#chart-button-ratio')) ;
- this.lockedControls.push(this.btnRatio);
-
- this.btnRatio.on('click', _.bind(function(btn, e) {
- if (btn.pressed && this.spnHeight.getNumberValue()>0) {
- this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue();
- }
- if (this.api) {
- var props = new Asc.CAscChartProp();
- props.asc_putLockAspect(btn.pressed);
- this.api.ChartApply(props);
- }
- this.fireEvent('editcomplete', this);
- }, this));
},
render: function () {
@@ -243,10 +100,8 @@ define([
},
ChangeSettings: function(props) {
- if (this._initSettings) {
+ if (this._initSettings)
this.createDelayedElements();
- this._initSettings = false;
- }
this.disableControls(this._locked);
@@ -333,8 +188,127 @@ define([
}
},
+ createDelayedControls: function() {
+ var me = this;
+ this.btnChartType = new Common.UI.Button({
+ cls : 'btn-large-dataview',
+ iconCls : 'item-chartlist bar-normal',
+ menu : new Common.UI.Menu({
+ style: 'width: 560px;',
+ items: [
+ { template: _.template('') }
+ ]
+ })
+ });
+ this.btnChartType.on('render:after', function(btn) {
+ me.mnuChartTypePicker = new Common.UI.DataView({
+ el: $('#id-chart-menu-type'),
+ parentMenu: btn.menu,
+ 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, iconCls: 'column-normal', selected: true},
+ { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'},
+ { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'},
+ { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'},
+ { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'},
+ { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'},
+ { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'},
+ { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'},
+ { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'},
+ { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'},
+ { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'},
+ { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'},
+ { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'},
+ { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'},
+ { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'},
+ { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'},
+ { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'},
+ { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'},
+ { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'},
+ { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'},
+ { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'},
+ { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'},
+ { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'},
+ { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'},
+ { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'}
+ ]),
+ itemTemplate: _.template('')
+ });
+ });
+ this.btnChartType.render($('#chart-button-type'));
+ this.mnuChartTypePicker.on('item:click', _.bind(this.onSelectType, this, this.btnChartType));
+ this.lockedControls.push(this.btnChartType);
+
+ this.btnEditData = new Common.UI.Button({
+ el: $('#chart-button-edit-data')
+ });
+ this.btnEditData.on('click', _.bind(this.setEditData, this));
+ this.lockedControls.push(this.btnEditData);
+
+ this.spnWidth = new Common.UI.MetricSpinner({
+ el: $('#chart-spin-width'),
+ step: .1,
+ width: 78,
+ defaultUnit : "cm",
+ value: '3 cm',
+ maxValue: 55.88,
+ minValue: 0
+ });
+ this.spinners.push(this.spnWidth);
+ this.lockedControls.push(this.spnWidth);
+
+ this.spnHeight = new Common.UI.MetricSpinner({
+ el: $('#chart-spin-height'),
+ step: .1,
+ width: 78,
+ defaultUnit : "cm",
+ value: '3 cm',
+ maxValue: 55.88,
+ minValue: 0
+ });
+ this.spinners.push(this.spnHeight);
+ this.lockedControls.push(this.spnHeight);
+
+ this.spnWidth.on('change', _.bind(this.onWidthChange, this));
+ this.spnHeight.on('change', _.bind(this.onHeightChange, this));
+
+ this.btnRatio = new Common.UI.Button({
+ cls: 'btn-toolbar',
+ iconCls: 'advanced-btn-ratio',
+ style: 'margin-bottom: 1px;',
+ enableToggle: true,
+ hint: this.textKeepRatio
+ });
+ this.btnRatio.render($('#chart-button-ratio')) ;
+ this.lockedControls.push(this.btnRatio);
+
+ this.btnRatio.on('click', _.bind(function(btn, e) {
+ if (btn.pressed && this.spnHeight.getNumberValue()>0) {
+ this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue();
+ }
+ if (this.api) {
+ var props = new Asc.CAscChartProp();
+ props.asc_putLockAspect(btn.pressed);
+ this.api.ChartApply(props);
+ }
+ this.fireEvent('editcomplete', this);
+ }, this));
+
+ },
+
createDelayedElements: function() {
+ this.createDelayedControls();
this.updateMetricUnit();
+ this._initSettings = false;
},
setEditData: function() {
@@ -415,6 +389,36 @@ define([
updateChartStyles: function(styles) {
var me = this;
+
+ if (!this.btnChartStyle) {
+ this.btnChartStyle = new Common.UI.Button({
+ cls : 'btn-large-dataview',
+ iconCls : 'item-wrap',
+ menu : new Common.UI.Menu({
+ menuAlign: 'tr-br',
+ items: [
+ { template: _.template('') }
+ ]
+ })
+ });
+ this.btnChartStyle.render($('#chart-button-style'));
+ this.lockedControls.push(this.btnChartStyle);
+ this.mnuChartStylePicker = new Common.UI.DataView({
+ el: $('#id-chart-menu-style'),
+ style: 'max-height: 411px;',
+ parentMenu: this.btnChartStyle.menu,
+ store: new Common.UI.DataViewStore(),
+ itemTemplate: _.template('')
+ });
+
+ if (this.btnChartStyle.menu) {
+ this.btnChartStyle.menu.on('show:after', function () {
+ me.mnuChartStylePicker.scroller.update({alwaysVisibleY: true});
+ });
+ }
+ this.mnuChartStylePicker.on('item:click', _.bind(this.onSelectStyle, this, this.btnChartStyle));
+ }
+
if (styles && styles.length>0){
var stylesStore = this.mnuChartStylePicker.store;
if (stylesStore) {
@@ -493,6 +497,8 @@ define([
},
disableControls: function(disable) {
+ if (this._initSettings) return;
+
if (this._state.DisabledControls!==disable) {
this._state.DisabledControls = disable;
_.each(this.lockedControls, function(item) {
diff --git a/apps/presentationeditor/main/app/view/ImageSettings.js b/apps/presentationeditor/main/app/view/ImageSettings.js
index 5310720f2..f434cae89 100644
--- a/apps/presentationeditor/main/app/view/ImageSettings.js
+++ b/apps/presentationeditor/main/app/view/ImageSettings.js
@@ -64,7 +64,6 @@ define([
},
initialize: function () {
- var me = this;
this._initSettings = true;
this._state = {
@@ -83,7 +82,29 @@ define([
this.labelWidth = $(this.el).find('#image-label-width');
this.labelHeight = $(this.el).find('#image-label-height');
+ },
+ render: function () {
+ var el = $(this.el);
+ el.html(this.template({
+ scope: this
+ }));
+ },
+
+ setApi: function(api) {
+ this.api = api;
+ return this;
+ },
+
+ updateMetricUnit: function() {
+ var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width);
+ this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
+
+ value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height);
+ this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
+ },
+
+ createDelayedControls: function() {
this.btnOriginalSize = new Common.UI.Button({
el: $('#image-button-original-size')
});
@@ -103,7 +124,7 @@ define([
el: $('#image-button-edit-object')
});
this.lockedControls.push(this.btnEditObject);
-
+
this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this));
this.btnInsertFromFile.on('click', _.bind(function(btn){
if (this.api) this.api.ChangeImageFromFile();
@@ -114,41 +135,21 @@ define([
if (this.api) this.api.asc_pluginRun(this._originalProps.asc_getPluginGuid(), 0, this._originalProps.asc_getPluginData());
this.fireEvent('editcomplete', this);
}, this));
- $(this.el).on('click', '#image-advanced-link', _.bind(this.openAdvancedSettings, this));
- },
-
- render: function () {
- var el = $(this.el);
- el.html(this.template({
- scope: this
- }));
this.linkAdvanced = $('#image-advanced-link');
this.lblReplace = $('#image-lbl-replace');
- },
-
- setApi: function(api) {
- this.api = api;
- return this;
- },
-
- updateMetricUnit: function() {
- var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width);
- this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
-
- value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height);
- this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName();
+ $(this.el).on('click', '#image-advanced-link', _.bind(this.openAdvancedSettings, this));
},
createDelayedElements: function() {
+ this.createDelayedControls();
this.updateMetricUnit();
+ this._initSettings = false;
},
ChangeSettings: function(props) {
- if (this._initSettings) {
+ if (this._initSettings)
this.createDelayedElements();
- this._initSettings = false;
- }
this.disableControls(this._locked);
@@ -269,6 +270,8 @@ define([
},
disableControls: function(disable) {
+ if (this._initSettings) return;
+
if (this._state.DisabledControls!==disable) {
this._state.DisabledControls = disable;
_.each(this.lockedControls, function(item) {
diff --git a/apps/presentationeditor/main/app/view/ParagraphSettings.js b/apps/presentationeditor/main/app/view/ParagraphSettings.js
index eb72ea26b..a23d2b7da 100644
--- a/apps/presentationeditor/main/app/view/ParagraphSettings.js
+++ b/apps/presentationeditor/main/app/view/ParagraphSettings.js
@@ -64,7 +64,6 @@ define([
},
initialize: function () {
- var me = this;
this._initSettings = true;
this._state = {
@@ -79,68 +78,6 @@ define([
this._locked = false;
this.render();
-
- this._arrLineRule = [
- {displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''},
- {displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'cm'}
- ];
-
- // Short Size
- this.cmbLineRule = new Common.UI.ComboBox({
- el: $('#paragraph-combo-line-rule'),
- cls: 'input-group-nr',
- menuStyle: 'min-width: 85px;',
- editable: false,
- data: this._arrLineRule
- });
- this.cmbLineRule.setValue(c_paragraphLinerule.LINERULE_AUTO);
- this.lockedControls.push(this.cmbLineRule);
-
- this.numLineHeight = new Common.UI.MetricSpinner({
- el: $('#paragraph-spin-line-height'),
- step: .01,
- width: 85,
- value: '1.5',
- defaultUnit : "",
- maxValue: 132,
- minValue: 0.5
- });
- this.lockedControls.push(this.numLineHeight);
-
- this.numSpacingBefore = new Common.UI.MetricSpinner({
- el: $('#paragraph-spin-spacing-before'),
- step: .1,
- width: 85,
- value: '0 cm',
- defaultUnit : "cm",
- maxValue: 55.88,
- minValue: 0,
- allowAuto : true,
- autoText : this.txtAutoText
- });
- this.spinners.push(this.numSpacingBefore);
- this.lockedControls.push(this.numSpacingBefore);
-
- this.numSpacingAfter = new Common.UI.MetricSpinner({
- el: $('#paragraph-spin-spacing-after'),
- step: .1,
- width: 85,
- value: '0.35 cm',
- defaultUnit : "cm",
- maxValue: 55.88,
- minValue: 0,
- allowAuto : true,
- autoText : this.txtAutoText
- });
- this.spinners.push(this.numSpacingAfter);
- this.lockedControls.push(this.numSpacingAfter);
-
- this.numLineHeight.on('change', _.bind(this.onNumLineHeightChange, this));
- this.numSpacingBefore.on('change', _.bind(this.onNumSpacingBeforeChange, this));
- this.numSpacingAfter.on('change', _.bind(this.onNumSpacingAfterChange, this));
- this.cmbLineRule.on('selected', _.bind(this.onLineRuleSelect, this));
- this.cmbLineRule.on('hide:after', _.bind(this.onHideMenus, this));
- $(this.el).on('click', '#paragraph-advanced-link', _.bind(this.openAdvancedSettings, this));
},
render: function () {
@@ -200,6 +137,8 @@ define([
},
_onLineSpacing: function(value) {
+ if (this._initSettings) return;
+
var linerule = value.get_LineRule();
var line = value.get_Line();
@@ -229,10 +168,8 @@ define([
},
ChangeSettings: function(prop) {
- if (this._initSettings) {
+ if (this._initSettings)
this.createDelayedElements();
- this._initSettings = false;
- }
this.disableControls(this._locked);
@@ -297,22 +234,92 @@ define([
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.01);
}
}
- var rec = this.cmbLineRule.store.at(1);
- rec.set({defaultUnit: Common.Utils.Metric.getCurrentMetricName(),
- minValue: parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)),
- step: (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01});
+ if (this.cmbLineRule) {
+ var rec = this.cmbLineRule.store.at(1);
+ rec.set({defaultUnit: Common.Utils.Metric.getCurrentMetricName(),
+ minValue: parseFloat(Common.Utils.Metric.fnRecalcFromMM(0.3).toFixed(2)),
+ step: (Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt) ? 1 : 0.01});
- if (this._state.LineRule !== null) {
- var obj;
- rec = this.cmbLineRule.store.findWhere((obj={}, obj['value']=this._state.LineRule, obj));
- if (!rec) rec = this.cmbLineRule.store.at(0);
- this.numLineHeight.setDefaultUnit(rec.get('defaultUnit'));
- this.numLineHeight.setStep(rec.get('step'));
+ if (this._state.LineRule !== null) {
+ var obj;
+ rec = this.cmbLineRule.store.findWhere((obj={}, obj['value']=this._state.LineRule, obj));
+ if (!rec) rec = this.cmbLineRule.store.at(0);
+ this.numLineHeight.setDefaultUnit(rec.get('defaultUnit'));
+ this.numLineHeight.setStep(rec.get('step'));
+ }
}
},
+ createDelayedControls: function() {
+ var me = this;
+ this._arrLineRule = [
+ {displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''},
+ {displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'cm'}
+ ];
+
+ // Short Size
+ this.cmbLineRule = new Common.UI.ComboBox({
+ el: $('#paragraph-combo-line-rule'),
+ cls: 'input-group-nr',
+ menuStyle: 'min-width: 85px;',
+ editable: false,
+ data: this._arrLineRule
+ });
+ this.cmbLineRule.setValue(c_paragraphLinerule.LINERULE_AUTO);
+ this.lockedControls.push(this.cmbLineRule);
+
+ this.numLineHeight = new Common.UI.MetricSpinner({
+ el: $('#paragraph-spin-line-height'),
+ step: .01,
+ width: 85,
+ value: '1.5',
+ defaultUnit : "",
+ maxValue: 132,
+ minValue: 0.5
+ });
+ this.lockedControls.push(this.numLineHeight);
+
+ this.numSpacingBefore = new Common.UI.MetricSpinner({
+ el: $('#paragraph-spin-spacing-before'),
+ step: .1,
+ width: 85,
+ value: '0 cm',
+ defaultUnit : "cm",
+ maxValue: 55.88,
+ minValue: 0,
+ allowAuto : true,
+ autoText : this.txtAutoText
+ });
+ this.spinners.push(this.numSpacingBefore);
+ this.lockedControls.push(this.numSpacingBefore);
+
+ this.numSpacingAfter = new Common.UI.MetricSpinner({
+ el: $('#paragraph-spin-spacing-after'),
+ step: .1,
+ width: 85,
+ value: '0.35 cm',
+ defaultUnit : "cm",
+ maxValue: 55.88,
+ minValue: 0,
+ allowAuto : true,
+ autoText : this.txtAutoText
+ });
+ this.spinners.push(this.numSpacingAfter);
+ this.lockedControls.push(this.numSpacingAfter);
+
+ this.numLineHeight.on('change', _.bind(this.onNumLineHeightChange, this));
+ this.numSpacingBefore.on('change', _.bind(this.onNumSpacingBeforeChange, this));
+ this.numSpacingAfter.on('change', _.bind(this.onNumSpacingAfterChange, this));
+ this.cmbLineRule.on('selected', _.bind(this.onLineRuleSelect, this));
+ this.cmbLineRule.on('hide:after', _.bind(this.onHideMenus, this));
+ $(this.el).on('click', '#paragraph-advanced-link', _.bind(this.openAdvancedSettings, this));
+
+ },
+
createDelayedElements: function() {
+ this.createDelayedControls();
this.updateMetricUnit();
+ this._initSettings = false;
},
openAdvancedSettings: function(e) {
@@ -357,6 +364,8 @@ define([
},
disableControls: function(disable) {
+ if (this._initSettings) return;
+
if (this._state.DisabledControls!==disable) {
this._state.DisabledControls = disable;
_.each(this.lockedControls, function(item) {
diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js
index 0666b4e80..dc2414d3d 100644
--- a/apps/presentationeditor/main/app/view/ShapeSettings.js
+++ b/apps/presentationeditor/main/app/view/ShapeSettings.js
@@ -71,7 +71,6 @@ define([
},
initialize: function () {
- var me = this;
this._initSettings = true;
this._originalProps = null;
this._noApply = true;
@@ -123,349 +122,6 @@ define([
this.render();
- this._arrFillSrc = [
- {displayValue: this.textColor, value: Asc.c_oAscFill.FILL_TYPE_SOLID},
- {displayValue: this.textGradientFill, value: Asc.c_oAscFill.FILL_TYPE_GRAD},
- {displayValue: this.textImageTexture, value: Asc.c_oAscFill.FILL_TYPE_BLIP},
- {displayValue: this.textPatternFill, value: Asc.c_oAscFill.FILL_TYPE_PATT},
- {displayValue: this.textNoFill, value: Asc.c_oAscFill.FILL_TYPE_NOFILL}
- ];
-
- this.cmbFillSrc = new Common.UI.ComboBox({
- el: $('#shape-combo-fill-src'),
- cls: 'input-group-nr',
- style: 'width: 100%;',
- menuStyle: 'min-width: 190px;',
- editable: false,
- data: this._arrFillSrc
- });
- this.cmbFillSrc.setValue(this._arrFillSrc[0].value);
- this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this));
- this.fillControls.push(this.cmbFillSrc);
-
- this.btnBackColor = new Common.UI.ColorButton({
- style: "width:45px;",
- menu : new Common.UI.Menu({
- items: [
- { template: _.template('') },
- { template: _.template('' + me.textNewColor + '') }
- ]
- })
- });
-
- this.btnBackColor.on('render:after', function(btn) {
- me.colorsBack = new Common.UI.ThemeColorPalette({
- el: $('#shape-back-color-menu'),
- value: 'transparent',
- transparent: true
- });
- me.colorsBack.on('select', _.bind(me.onColorsBackSelect, me));
- });
- this.btnBackColor.render( $('#shape-back-color-btn'));
- this.btnBackColor.setColor('transparent');
- $(this.el).on('click', '#shape-back-color-new', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor));
- this.fillControls.push(this.btnBackColor);
-
- this.cmbPattern = new Common.UI.ComboDataView({
- itemWidth: 28,
- itemHeight: 28,
- menuMaxHeight: 300,
- enableKeyEvents: true,
- cls: 'combo-pattern'
- });
- this.cmbPattern.menuPicker.itemTemplate = this.cmbPattern.fieldPicker.itemTemplate = _.template([
- '',
- '
px -<%= offsety %>px;"/>',
- '
'
- ].join(''));
- this.cmbPattern.render($('#shape-combo-pattern'));
- this.cmbPattern.openButton.menu.cmpEl.css({
- 'min-width': 178,
- 'max-width': 178
- });
- this.cmbPattern.on('click', _.bind(this.onPatternSelect, this));
- this.cmbPattern.openButton.menu.on('show:after', function () {
- me.cmbPattern.menuPicker.scroller.update({alwaysVisibleY: true});
- });
- this.fillControls.push(this.cmbPattern);
-
- this.btnFGColor = new Common.UI.ColorButton({
- style: "width:45px;",
- menu : new Common.UI.Menu({
- items: [
- { template: _.template('') },
- { template: _.template('' + me.textNewColor + '') }
- ]
- })
- });
-
- this.btnFGColor.on('render:after', function(btn) {
- me.colorsFG = new Common.UI.ThemeColorPalette({
- el: $('#shape-foreground-color-menu'),
- value: '000000'
- });
- me.colorsFG.on('select', _.bind(me.onColorsFGSelect, me));
- });
- this.btnFGColor.render( $('#shape-foreground-color-btn'));
- this.btnFGColor.setColor('000000');
- $(this.el).on('click', '#shape-foreground-color-new', _.bind(this.addNewColor, this, this.colorsFG, this.btnFGColor));
- this.fillControls.push(this.btnFGColor);
-
- this.btnBGColor = new Common.UI.ColorButton({
- style: "width:45px;",
- menu : new Common.UI.Menu({
- items: [
- { template: _.template('') },
- { template: _.template('' + me.textNewColor + '') }
- ]
- })
- });
-
- this.btnBGColor.on('render:after', function(btn) {
- me.colorsBG = new Common.UI.ThemeColorPalette({
- el: $('#shape-background-color-menu'),
- value: 'ffffff'
- });
- me.colorsBG.on('select', _.bind(me.onColorsBGSelect, me));
- });
- this.btnBGColor.render( $('#shape-background-color-btn'));
- this.btnBGColor.setColor('ffffff');
- $(this.el).on('click', '#shape-background-color-new', _.bind(this.addNewColor, this, this.colorsBG, this.btnBGColor));
- this.fillControls.push(this.btnBGColor);
-
- this.btnInsertFromFile = new Common.UI.Button({
- el: $('#shape-button-from-file')
- });
- this.fillControls.push(this.btnInsertFromFile);
-
- this.btnInsertFromUrl = new Common.UI.Button({
- el: $('#shape-button-from-url')
- });
- this.fillControls.push(this.btnInsertFromUrl);
-
- this.btnInsertFromFile.on('click', _.bind(function(btn){
- if (this.api) this.api.ChangeShapeImageFromFile();
- this.fireEvent('editcomplete', this);
- }, this));
- this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this));
-
- this._arrFillType = [
- {displayValue: this.textStretch, value: Asc.c_oAscFillBlipType.STRETCH},
- {displayValue: this.textTile, value: Asc.c_oAscFillBlipType.TILE}
- ];
-
- this.cmbFillType = new Common.UI.ComboBox({
- el: $('#shape-combo-fill-type'),
- cls: 'input-group-nr',
- menuStyle: 'min-width: 90px;',
- editable: false,
- data: this._arrFillType
- });
- this.cmbFillType.setValue(this._arrFillType[0].value);
- this.cmbFillType.on('selected', _.bind(this.onFillTypeSelect, this));
- this.fillControls.push(this.cmbFillType);
-
- this.btnTexture = new Common.UI.ComboBox({
- el: $('#shape-combo-fill-texture'),
- template: _.template([
- ''
- ].join(''))
- });
- this.textureMenu = new Common.UI.Menu({
- items: [
- { template: _.template('') }
- ]
- });
- this.textureMenu.render($('#shape-combo-fill-texture'));
- this.fillControls.push(this.btnTexture);
-
- this.numTransparency = new Common.UI.MetricSpinner({
- el: $('#shape-spin-transparency'),
- step: 1,
- width: 62,
- value: '100 %',
- defaultUnit : "%",
- maxValue: 100,
- minValue: 0
- });
- this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this));
- this.fillControls.push(this.numTransparency);
-
- this.sldrTransparency = new Common.UI.SingleSlider({
- el: $('#shape-slider-transparency'),
- width: 75,
- minValue: 0,
- maxValue: 100,
- value: 100
- });
- this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this));
- this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this));
- this.fillControls.push(this.sldrTransparency);
-
- this.lblTransparencyStart = $(this.el).find('#shape-lbl-transparency-start');
- this.lblTransparencyEnd = $(this.el).find('#shape-lbl-transparency-end');
-
- this._arrGradType = [
- {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR},
- {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH}
- ];
-
- this.cmbGradType = new Common.UI.ComboBox({
- el: $('#shape-combo-grad-type'),
- cls: 'input-group-nr',
- menuStyle: 'min-width: 90px;',
- editable: false,
- data: this._arrGradType
- });
- this.cmbGradType.setValue(this._arrGradType[0].value);
- this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this));
- this.fillControls.push(this.cmbGradType);
-
- this._viewDataLinear = [
- { offsetx: 0, offsety: 0, type:45, subtype:-1, iconcls:'gradient-left-top' },
- { offsetx: 50, offsety: 0, type:90, subtype:4, iconcls:'gradient-top'},
- { offsetx: 100, offsety: 0, type:135, subtype:5, iconcls:'gradient-right-top'},
- { offsetx: 0, offsety: 50, type:0, subtype:6, iconcls:'gradient-left', cls: 'item-gradient-separator', selected: true},
- { offsetx: 100, offsety: 50, type:180, subtype:1, iconcls:'gradient-right'},
- { offsetx: 0, offsety: 100, type:315, subtype:2, iconcls:'gradient-left-bottom'},
- { offsetx: 50, offsety: 100, type:270, subtype:3, iconcls:'gradient-bottom'},
- { offsetx: 100, offsety: 100, type:225, subtype:7, iconcls:'gradient-right-bottom'}
- ];
-
- this._viewDataRadial = [
- { offsetx: 100, offsety: 150, type:2, subtype:5, iconcls:'gradient-radial-center'}
- ];
-
- this.btnDirection = new Common.UI.Button({
- cls : 'btn-large-dataview',
- iconCls : 'item-gradient gradient-left',
- menu : new Common.UI.Menu({
- style: 'min-width: 60px;',
- menuAlign: 'tr-br',
- items: [
- { template: _.template('') }
- ]
- })
- });
- this.btnDirection.on('render:after', function(btn) {
- me.mnuDirectionPicker = new Common.UI.DataView({
- el: $('#id-shape-menu-direction'),
- parentMenu: btn.menu,
- restoreHeight: 174,
- store: new Common.UI.DataViewStore(me._viewDataLinear),
- itemTemplate: _.template('')
- });
- });
- this.btnDirection.render($('#shape-button-direction'));
- this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection));
- this.fillControls.push(this.btnDirection);
-
- this.btnGradColor = new Common.UI.ColorButton({
- style: "width:45px;",
- menu : new Common.UI.Menu({
- items: [
- { template: _.template('') },
- { template: _.template('' + me.textNewColor + '') }
- ]
- })
- });
- this.btnGradColor.on('render:after', function(btn) {
- me.colorsGrad = new Common.UI.ThemeColorPalette({
- el: $('#shape-gradient-color-menu'),
- value: '000000'
- });
- me.colorsGrad.on('select', _.bind(me.onColorsGradientSelect, me));
- });
- this.btnGradColor.render( $('#shape-gradient-color-btn'));
- this.btnGradColor.setColor('000000');
- $(this.el).on('click', '#shape-gradient-color-new', _.bind(this.addNewColor, this, this.colorsGrad, this.btnGradColor));
- this.fillControls.push(this.btnGradColor);
-
- this.sldrGradient = new Common.UI.MultiSliderGradient({
- el: $('#shape-slider-gradient'),
- width: 125,
- minValue: 0,
- maxValue: 100,
- values: [0, 100]
- });
- this.sldrGradient.on('change', _.bind(this.onGradientChange, this));
- this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this));
- this.sldrGradient.on('thumbclick', function(cmp, index){
- me.GradColor.currentIdx = index;
- var color = me.GradColor.colors[me.GradColor.currentIdx];
- me.btnGradColor.setColor(color);
- me.colorsGrad.select(color,false);
- });
- this.sldrGradient.on('thumbdblclick', function(cmp){
- me.btnGradColor.cmpEl.find('button').dropdown('toggle');
- });
- this.fillControls.push(this.sldrGradient);
-
- this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({
- el: $('#shape-combo-border-size'),
- style: "width: 93px;",
- txtNoBorders: this.txtNoBorders
- })
- .on('selected', _.bind(this.onBorderSizeSelect, this))
- .on('changed:before',_.bind(this.onBorderSizeChanged, this, true))
- .on('changed:after', _.bind(this.onBorderSizeChanged, this, false))
- .on('combo:blur', _.bind(this.onComboBlur, this, false));
- this.BorderSize = this.cmbBorderSize.store.at(2).get('value');
- this.cmbBorderSize.setValue(this.BorderSize);
- this.lockedControls.push(this.cmbBorderSize);
-
- this.btnBorderColor = new Common.UI.ColorButton({
- style: "width:45px;",
- menu : new Common.UI.Menu({
- items: [
- { template: _.template('') },
- { template: _.template('' + me.textNewColor + '') }
- ]
- })
- });
-
- this.btnBorderColor.on('render:after', function(btn) {
- me.colorsBorder = new Common.UI.ThemeColorPalette({
- el: $('#shape-border-color-menu'),
- value: '000000'
- });
- me.colorsBorder.on('select', _.bind(me.onColorsBorderSelect, me));
- });
- this.btnBorderColor.render( $('#shape-border-color-btn'));
- this.btnBorderColor.setColor('000000');
- $(this.el).on('click', '#shape-border-color-new', _.bind(this.addNewColor, this, this.colorsBorder, this.btnBorderColor));
- this.lockedControls.push(this.btnBorderColor);
-
- this.cmbBorderType = new Common.UI.ComboBorderType({
- el: $('#shape-combo-border-type'),
- style: "width: 93px;",
- menuStyle: 'min-width: 93px;'
- }).on('selected', _.bind(this.onBorderTypeSelect, this))
- .on('combo:blur', _.bind(this.onComboBlur, this, false));
- this.BorderType = Asc.c_oDashType.solid;
- this.cmbBorderType.setValue(this.BorderType);
- this.lockedControls.push(this.cmbBorderType);
-
- this.btnChangeShape = new Common.UI.Button({
- cls: 'btn-icon-default',
- iconCls: 'btn-change-shape',
- menu : new Common.UI.Menu({
- menuAlign: 'tr-br',
- cls: 'menu-shapes',
- items: []
- })
- });
- this.btnChangeShape.render( $('#shape-btn-change')) ;
- this.lockedControls.push(this.btnChangeShape);
-
- $(this.el).on('click', '#shape-advanced-link', _.bind(this.openAdvancedSettings, this));
-
this.FillColorContainer = $('#shape-panel-color-fill');
this.FillImageContainer = $('#shape-panel-image-fill');
this.FillPatternContainer = $('#shape-panel-pattern-fill');
@@ -480,8 +136,6 @@ define([
el.html(this.template({
scope: this
}));
-
- this.linkAdvanced = $('#shape-advanced-link');
},
setApi: function(api) {
@@ -1024,7 +678,6 @@ define([
ChangeSettings: function(props) {
if (this._initSettings)
this.createDelayedElements();
- this._initSettings = false;
if (props)
{
@@ -1402,7 +1055,229 @@ define([
}
},
+ createDelayedControls: function() {
+ var me = this;
+
+ this._arrFillSrc = [
+ {displayValue: this.textColor, value: Asc.c_oAscFill.FILL_TYPE_SOLID},
+ {displayValue: this.textGradientFill, value: Asc.c_oAscFill.FILL_TYPE_GRAD},
+ {displayValue: this.textImageTexture, value: Asc.c_oAscFill.FILL_TYPE_BLIP},
+ {displayValue: this.textPatternFill, value: Asc.c_oAscFill.FILL_TYPE_PATT},
+ {displayValue: this.textNoFill, value: Asc.c_oAscFill.FILL_TYPE_NOFILL}
+ ];
+
+ this.cmbFillSrc = new Common.UI.ComboBox({
+ el: $('#shape-combo-fill-src'),
+ cls: 'input-group-nr',
+ style: 'width: 100%;',
+ menuStyle: 'min-width: 190px;',
+ editable: false,
+ data: this._arrFillSrc
+ });
+ this.cmbFillSrc.setValue(this._arrFillSrc[0].value);
+ this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this));
+ this.fillControls.push(this.cmbFillSrc);
+
+ this.cmbPattern = new Common.UI.ComboDataView({
+ itemWidth: 28,
+ itemHeight: 28,
+ menuMaxHeight: 300,
+ enableKeyEvents: true,
+ cls: 'combo-pattern'
+ });
+ this.cmbPattern.menuPicker.itemTemplate = this.cmbPattern.fieldPicker.itemTemplate = _.template([
+ '',
+ '
px -<%= offsety %>px;"/>',
+ '
'
+ ].join(''));
+ this.cmbPattern.render($('#shape-combo-pattern'));
+ this.cmbPattern.openButton.menu.cmpEl.css({
+ 'min-width': 178,
+ 'max-width': 178
+ });
+ this.cmbPattern.on('click', _.bind(this.onPatternSelect, this));
+ this.cmbPattern.openButton.menu.on('show:after', function () {
+ me.cmbPattern.menuPicker.scroller.update({alwaysVisibleY: true});
+ });
+ this.fillControls.push(this.cmbPattern);
+
+ this.btnInsertFromFile = new Common.UI.Button({
+ el: $('#shape-button-from-file')
+ });
+ this.fillControls.push(this.btnInsertFromFile);
+
+ this.btnInsertFromUrl = new Common.UI.Button({
+ el: $('#shape-button-from-url')
+ });
+ this.fillControls.push(this.btnInsertFromUrl);
+
+ this.btnInsertFromFile.on('click', _.bind(function(btn){
+ if (this.api) this.api.ChangeShapeImageFromFile();
+ this.fireEvent('editcomplete', this);
+ }, this));
+ this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this));
+
+ this._arrFillType = [
+ {displayValue: this.textStretch, value: Asc.c_oAscFillBlipType.STRETCH},
+ {displayValue: this.textTile, value: Asc.c_oAscFillBlipType.TILE}
+ ];
+
+ this.cmbFillType = new Common.UI.ComboBox({
+ el: $('#shape-combo-fill-type'),
+ cls: 'input-group-nr',
+ menuStyle: 'min-width: 90px;',
+ editable: false,
+ data: this._arrFillType
+ });
+ this.cmbFillType.setValue(this._arrFillType[0].value);
+ this.cmbFillType.on('selected', _.bind(this.onFillTypeSelect, this));
+ this.fillControls.push(this.cmbFillType);
+
+ this.numTransparency = new Common.UI.MetricSpinner({
+ el: $('#shape-spin-transparency'),
+ step: 1,
+ width: 62,
+ value: '100 %',
+ defaultUnit : "%",
+ maxValue: 100,
+ minValue: 0
+ });
+ this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this));
+ this.fillControls.push(this.numTransparency);
+
+ this.sldrTransparency = new Common.UI.SingleSlider({
+ el: $('#shape-slider-transparency'),
+ width: 75,
+ minValue: 0,
+ maxValue: 100,
+ value: 100
+ });
+ this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this));
+ this.sldrTransparency.on('changecomplete', _.bind(this.onTransparencyChangeComplete, this));
+ this.fillControls.push(this.sldrTransparency);
+
+ this.lblTransparencyStart = $(this.el).find('#shape-lbl-transparency-start');
+ this.lblTransparencyEnd = $(this.el).find('#shape-lbl-transparency-end');
+
+ this._arrGradType = [
+ {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR},
+ {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH}
+ ];
+
+ this.cmbGradType = new Common.UI.ComboBox({
+ el: $('#shape-combo-grad-type'),
+ cls: 'input-group-nr',
+ menuStyle: 'min-width: 90px;',
+ editable: false,
+ data: this._arrGradType
+ });
+ this.cmbGradType.setValue(this._arrGradType[0].value);
+ this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this));
+ this.fillControls.push(this.cmbGradType);
+
+ this._viewDataLinear = [
+ { offsetx: 0, offsety: 0, type:45, subtype:-1, iconcls:'gradient-left-top' },
+ { offsetx: 50, offsety: 0, type:90, subtype:4, iconcls:'gradient-top'},
+ { offsetx: 100, offsety: 0, type:135, subtype:5, iconcls:'gradient-right-top'},
+ { offsetx: 0, offsety: 50, type:0, subtype:6, iconcls:'gradient-left', cls: 'item-gradient-separator', selected: true},
+ { offsetx: 100, offsety: 50, type:180, subtype:1, iconcls:'gradient-right'},
+ { offsetx: 0, offsety: 100, type:315, subtype:2, iconcls:'gradient-left-bottom'},
+ { offsetx: 50, offsety: 100, type:270, subtype:3, iconcls:'gradient-bottom'},
+ { offsetx: 100, offsety: 100, type:225, subtype:7, iconcls:'gradient-right-bottom'}
+ ];
+
+ this._viewDataRadial = [
+ { offsetx: 100, offsety: 150, type:2, subtype:5, iconcls:'gradient-radial-center'}
+ ];
+
+ this.btnDirection = new Common.UI.Button({
+ cls : 'btn-large-dataview',
+ iconCls : 'item-gradient gradient-left',
+ menu : new Common.UI.Menu({
+ style: 'min-width: 60px;',
+ menuAlign: 'tr-br',
+ items: [
+ { template: _.template('') }
+ ]
+ })
+ });
+ this.btnDirection.on('render:after', function(btn) {
+ me.mnuDirectionPicker = new Common.UI.DataView({
+ el: $('#id-shape-menu-direction'),
+ parentMenu: btn.menu,
+ restoreHeight: 174,
+ store: new Common.UI.DataViewStore(me._viewDataLinear),
+ itemTemplate: _.template('')
+ });
+ });
+ this.btnDirection.render($('#shape-button-direction'));
+ this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection));
+ this.fillControls.push(this.btnDirection);
+
+ this.sldrGradient = new Common.UI.MultiSliderGradient({
+ el: $('#shape-slider-gradient'),
+ width: 125,
+ minValue: 0,
+ maxValue: 100,
+ values: [0, 100]
+ });
+ this.sldrGradient.on('change', _.bind(this.onGradientChange, this));
+ this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this));
+ this.sldrGradient.on('thumbclick', function(cmp, index){
+ me.GradColor.currentIdx = index;
+ var color = me.GradColor.colors[me.GradColor.currentIdx];
+ me.btnGradColor.setColor(color);
+ me.colorsGrad.select(color,false);
+ });
+ this.sldrGradient.on('thumbdblclick', function(cmp){
+ me.btnGradColor.cmpEl.find('button').dropdown('toggle');
+ });
+ this.fillControls.push(this.sldrGradient);
+
+ this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({
+ el: $('#shape-combo-border-size'),
+ style: "width: 93px;",
+ txtNoBorders: this.txtNoBorders
+ })
+ .on('selected', _.bind(this.onBorderSizeSelect, this))
+ .on('changed:before',_.bind(this.onBorderSizeChanged, this, true))
+ .on('changed:after', _.bind(this.onBorderSizeChanged, this, false))
+ .on('combo:blur', _.bind(this.onComboBlur, this, false));
+ this.BorderSize = this.cmbBorderSize.store.at(2).get('value');
+ this.cmbBorderSize.setValue(this.BorderSize);
+ this.lockedControls.push(this.cmbBorderSize);
+
+ this.cmbBorderType = new Common.UI.ComboBorderType({
+ el: $('#shape-combo-border-type'),
+ style: "width: 93px;",
+ menuStyle: 'min-width: 93px;'
+ }).on('selected', _.bind(this.onBorderTypeSelect, this))
+ .on('combo:blur', _.bind(this.onComboBlur, this, false));
+ this.BorderType = Asc.c_oDashType.solid;
+ this.cmbBorderType.setValue(this.BorderType);
+ this.lockedControls.push(this.cmbBorderType);
+
+ this.btnChangeShape = new Common.UI.Button({
+ cls: 'btn-icon-default',
+ iconCls: 'btn-change-shape',
+ menu : new Common.UI.Menu({
+ menuAlign: 'tr-br',
+ cls: 'menu-shapes',
+ items: []
+ })
+ });
+ this.btnChangeShape.render( $('#shape-btn-change')) ;
+ this.lockedControls.push(this.btnChangeShape);
+
+ this.linkAdvanced = $('#shape-advanced-link');
+ $(this.el).on('click', '#shape-advanced-link', _.bind(this.openAdvancedSettings, this));
+ },
+
createDelayedElements: function() {
+ this.createDelayedControls();
+
var global_hatch_menu_map = [
0,1,3,2,4,
53,5,6,7,8,
@@ -1434,14 +1309,33 @@ define([
this.PatternFillType = this.patternViewData[0].type;
}
-
this.fillAutoShapes();
this.UpdateThemeColors();
+ this._initSettings = false;
},
onInitStandartTextures: function(texture) {
var me = this;
if (texture && texture.length>0){
+ if (!this.btnTexture) {
+ this.btnTexture = new Common.UI.ComboBox({
+ el: $('#shape-combo-fill-texture'),
+ template: _.template([
+ ''
+ ].join(''))
+ });
+ this.textureMenu = new Common.UI.Menu({
+ items: [
+ { template: _.template('') }
+ ]
+ });
+ this.textureMenu.render($('#shape-combo-fill-texture'));
+ this.fillControls.push(this.btnTexture);
+ }
var texturearray = [];
_.each(texture, function(item){
texturearray.push({
@@ -1521,6 +1415,104 @@ define([
},
UpdateThemeColors: function() {
+ if (!this.btnBackColor) {
+ this.btnBackColor = new Common.UI.ColorButton({
+ style: "width:45px;",
+ menu : new Common.UI.Menu({
+ items: [
+ { template: _.template('') },
+ { template: _.template('' + this.textNewColor + '') }
+ ]
+ })
+ });
+ this.btnBackColor.render( $('#shape-back-color-btn'));
+ this.btnBackColor.setColor('transparent');
+ this.fillControls.push(this.btnBackColor);
+ this.colorsBack = new Common.UI.ThemeColorPalette({
+ el: $('#shape-back-color-menu'),
+ value: 'transparent',
+ transparent: true
+ });
+ this.colorsBack.on('select', _.bind(this.onColorsBackSelect, this));
+ $(this.el).on('click', '#shape-back-color-new', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor));
+
+ this.btnFGColor = new Common.UI.ColorButton({
+ style: "width:45px;",
+ menu : new Common.UI.Menu({
+ items: [
+ { template: _.template('') },
+ { template: _.template('' + this.textNewColor + '') }
+ ]
+ })
+ });
+ this.btnFGColor.render( $('#shape-foreground-color-btn'));
+ this.btnFGColor.setColor('000000');
+ this.fillControls.push(this.btnFGColor);
+ this.colorsFG = new Common.UI.ThemeColorPalette({
+ el: $('#shape-foreground-color-menu'),
+ value: '000000'
+ });
+ this.colorsFG.on('select', _.bind(this.onColorsFGSelect, this));
+ $(this.el).on('click', '#shape-foreground-color-new', _.bind(this.addNewColor, this, this.colorsFG, this.btnFGColor));
+
+ this.btnBGColor = new Common.UI.ColorButton({
+ style: "width:45px;",
+ menu : new Common.UI.Menu({
+ items: [
+ { template: _.template('') },
+ { template: _.template('' + this.textNewColor + '') }
+ ]
+ })
+ });
+ this.btnBGColor.render( $('#shape-background-color-btn'));
+ this.btnBGColor.setColor('ffffff');
+ this.fillControls.push(this.btnBGColor);
+ this.colorsBG = new Common.UI.ThemeColorPalette({
+ el: $('#shape-background-color-menu'),
+ value: 'ffffff'
+ });
+ this.colorsBG.on('select', _.bind(this.onColorsBGSelect, this));
+ $(this.el).on('click', '#shape-background-color-new', _.bind(this.addNewColor, this, this.colorsBG, this.btnBGColor));
+
+ this.btnGradColor = new Common.UI.ColorButton({
+ style: "width:45px;",
+ menu : new Common.UI.Menu({
+ items: [
+ { template: _.template('') },
+ { template: _.template('' + this.textNewColor + '') }
+ ]
+ })
+ });
+ this.btnGradColor.render( $('#shape-gradient-color-btn'));
+ this.btnGradColor.setColor('000000');
+ this.fillControls.push(this.btnGradColor);
+ this.colorsGrad = new Common.UI.ThemeColorPalette({
+ el: $('#shape-gradient-color-menu'),
+ value: '000000'
+ });
+ this.colorsGrad.on('select', _.bind(this.onColorsGradientSelect, this));
+ $(this.el).on('click', '#shape-gradient-color-new', _.bind(this.addNewColor, this, this.colorsGrad, this.btnGradColor));
+
+ this.btnBorderColor = new Common.UI.ColorButton({
+ style: "width:45px;",
+ menu : new Common.UI.Menu({
+ items: [
+ { template: _.template('') },
+ { template: _.template('' + this.textNewColor + '') }
+ ]
+ })
+ });
+ this.btnBorderColor.render( $('#shape-border-color-btn'));
+ this.btnBorderColor.setColor('000000');
+ this.lockedControls.push(this.btnBorderColor);
+ this.colorsBorder = new Common.UI.ThemeColorPalette({
+ el: $('#shape-border-color-menu'),
+ value: '000000'
+ });
+ this.colorsBorder.on('select', _.bind(this.onColorsBorderSelect, this));
+ $(this.el).on('click', '#shape-border-color-new', _.bind(this.addNewColor, this, this.colorsBorder, this.btnBorderColor));
+ }
+
this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
@@ -1560,6 +1552,8 @@ define([
},
disableControls: function(disable, disableFill) {
+ if (this._initSettings) return;
+
this.disableFillPanels(disable || disableFill);
if (this._state.DisabledControls!==disable) {
this._state.DisabledControls = disable;
diff --git a/apps/presentationeditor/main/app/view/SlideSettings.js b/apps/presentationeditor/main/app/view/SlideSettings.js
index b17dc8390..30c70bfdf 100644
--- a/apps/presentationeditor/main/app/view/SlideSettings.js
+++ b/apps/presentationeditor/main/app/view/SlideSettings.js
@@ -68,7 +68,6 @@ define([
},
initialize: function () {
- var me = this;
this._initSettings = true;
this._originalProps = null;
this._noApply = true;
@@ -131,241 +130,6 @@ define([
this.cmbFillSrc.setValue('');
this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this));
- this.btnBackColor = new Common.UI.ColorButton({
- style: "width:45px;",
- disabled: true,
- menu : new Common.UI.Menu({
- items: [
- { template: _.template('') },
- { template: _.template('' + me.textNewColor + '') }
- ]
- })
- });
- this.FillItems.push(this.btnBackColor);
-
- this.btnBackColor.on('render:after', function(btn) {
- me.colorsBack = new Common.UI.ThemeColorPalette({
- el: $('#slide-back-color-menu'),
- value: 'ffffff',
- transparent: true
- });
- me.colorsBack.on('select', _.bind(me.onColorsBackSelect, me));
- });
- this.btnBackColor.render( $('#slide-back-color-btn'));
- this.btnBackColor.setColor('ffffff');
- $(this.el).on('click', '#slide-back-color-new', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor));
-
- this.cmbPattern = new Common.UI.ComboDataView({
- itemWidth: 28,
- itemHeight: 28,
- menuMaxHeight: 300,
- enableKeyEvents: true,
- cls: 'combo-pattern'
- });
- this.cmbPattern.menuPicker.itemTemplate = this.cmbPattern.fieldPicker.itemTemplate = _.template([
- '',
- '
px -<%= offsety %>px;"/>',
- '
'
- ].join(''));
- this.cmbPattern.render($('#slide-combo-pattern'));
- this.cmbPattern.openButton.menu.cmpEl.css({
- 'min-width': 178,
- 'max-width': 178
- });
- this.cmbPattern.on('click', _.bind(this.onPatternSelect, this));
- this.FillItems.push(this.cmbPattern);
-
- this.btnFGColor = new Common.UI.ColorButton({
- style: "width:45px;",
- menu : new Common.UI.Menu({
- items: [
- { template: _.template('') },
- { template: _.template('' + me.textNewColor + '') }
- ]
- })
- });
-
- this.btnFGColor.on('render:after', function(btn) {
- me.colorsFG = new Common.UI.ThemeColorPalette({
- el: $('#slide-foreground-color-menu'),
- value: '000000'
- });
- me.colorsFG.on('select', _.bind(me.onColorsFGSelect, me));
- });
- this.btnFGColor.render( $('#slide-foreground-color-btn'));
- this.btnFGColor.setColor('000000');
- $(this.el).on('click', '#slide-foreground-color-new', _.bind(this.addNewColor, this, this.colorsFG, this.btnFGColor));
- this.FillItems.push(this.btnFGColor);
-
- this.btnBGColor = new Common.UI.ColorButton({
- style: "width:45px;",
- menu : new Common.UI.Menu({
- items: [
- { template: _.template('') },
- { template: _.template('' + me.textNewColor + '') }
- ]
- })
- });
-
- this.btnBGColor.on('render:after', function(btn) {
- me.colorsBG = new Common.UI.ThemeColorPalette({
- el: $('#slide-background-color-menu'),
- value: 'ffffff'
- });
- me.colorsBG.on('select', _.bind(me.onColorsBGSelect, me));
- });
- this.btnBGColor.render( $('#slide-background-color-btn'));
- this.btnBGColor.setColor('ffffff');
- $(this.el).on('click', '#slide-background-color-new', _.bind(this.addNewColor, this, this.colorsBG, this.btnBGColor));
- this.FillItems.push(this.btnBGColor);
-
- this.btnInsertFromFile = new Common.UI.Button({
- el: $('#slide-button-from-file')
- });
- this.btnInsertFromFile.on('click', _.bind(function(btn){
- if (this.api) this.api.ChangeSlideImageFromFile();
- this.fireEvent('editcomplete', this);
- }, this));
- this.FillItems.push(this.btnInsertFromFile);
-
- this.btnInsertFromUrl = new Common.UI.Button({
- el: $('#slide-button-from-url')
- });
- this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this));
- this.FillItems.push(this.btnInsertFromUrl);
-
- this._arrFillType = [
- {displayValue: this.textStretch, value: Asc.c_oAscFillBlipType.STRETCH},
- {displayValue: this.textTile, value: Asc.c_oAscFillBlipType.TILE}
- ];
-
- this.cmbFillType = new Common.UI.ComboBox({
- el: $('#slide-combo-fill-type'),
- cls: 'input-group-nr',
- menuStyle: 'min-width: 90px;',
- editable: false,
- data: this._arrFillType
- });
- this.cmbFillType.setValue(this._arrFillType[0].value);
- this.cmbFillType.on('selected', _.bind(this.onFillTypeSelect, this));
- this.FillItems.push(this.cmbFillType);
-
- this.btnTexture = new Common.UI.ComboBox({
- el: $('#slide-combo-fill-texture'),
- template: _.template([
- ''
- ].join(''))
- });
- this.textureMenu = new Common.UI.Menu({
- items: [
- { template: _.template('') }
- ]
- });
- this.textureMenu.render($('#slide-combo-fill-texture'));
- this.FillItems.push(this.btnTexture);
-
- this._arrGradType = [
- {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR},
- {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH}
- ];
-
- this.cmbGradType = new Common.UI.ComboBox({
- el: $('#slide-combo-grad-type'),
- cls: 'input-group-nr',
- menuStyle: 'min-width: 90px;',
- editable: false,
- data: this._arrGradType
- });
- this.cmbGradType.setValue(this._arrGradType[0].value);
- this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this));
- this.FillItems.push(this.cmbGradType);
-
- this._viewDataLinear = [
- { offsetx: 0, offsety: 0, type:45, subtype:-1, iconcls:'gradient-left-top' },
- { offsetx: 50, offsety: 0, type:90, subtype:4, iconcls:'gradient-top'},
- { offsetx: 100, offsety: 0, type:135, subtype:5, iconcls:'gradient-right-top'},
- { offsetx: 0, offsety: 50, type:0, subtype:6, iconcls:'gradient-left', cls: 'item-gradient-separator', selected: true},
- { offsetx: 100, offsety: 50, type:180, subtype:1, iconcls:'gradient-right'},
- { offsetx: 0, offsety: 100, type:315, subtype:2, iconcls:'gradient-left-bottom'},
- { offsetx: 50, offsety: 100, type:270, subtype:3, iconcls:'gradient-bottom'},
- { offsetx: 100, offsety: 100, type:225, subtype:7, iconcls:'gradient-right-bottom'}
- ];
-
- this._viewDataRadial = [
- { offsetx: 100, offsety: 150, type:2, subtype:5, iconcls:'gradient-radial-center'}
- ];
-
- this.btnDirection = new Common.UI.Button({
- cls : 'btn-large-dataview',
- iconCls : 'item-gradient gradient-left',
- menu : new Common.UI.Menu({
- style: 'min-width: 60px;',
- menuAlign: 'tr-br',
- items: [
- { template: _.template('') }
- ]
- })
- });
- this.btnDirection.on('render:after', function(btn) {
- me.mnuDirectionPicker = new Common.UI.DataView({
- el: $('#id-slide-menu-direction'),
- parentMenu: btn.menu,
- restoreHeight: 174,
- store: new Common.UI.DataViewStore(me._viewDataLinear),
- itemTemplate: _.template('')
- });
- });
- this.btnDirection.render($('#slide-button-direction'));
- this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection));
- this.FillItems.push(this.btnDirection);
-
- this.btnGradColor = new Common.UI.ColorButton({
- style: "width:45px;",
- menu : new Common.UI.Menu({
- items: [
- { template: _.template('') },
- { template: _.template('' + me.textNewColor + '') }
- ]
- })
- });
- this.btnGradColor.on('render:after', function(btn) {
- me.colorsGrad = new Common.UI.ThemeColorPalette({
- el: $('#slide-gradient-color-menu'),
- value: '000000'
- });
- me.colorsGrad.on('select', _.bind(me.onColorsGradientSelect, me));
- });
- this.btnGradColor.render( $('#slide-gradient-color-btn'));
- this.btnGradColor.setColor('000000');
- $(this.el).on('click', '#slide-gradient-color-new', _.bind(this.addNewColor, this, this.colorsGrad, this.btnGradColor));
- this.FillItems.push(this.btnGradColor);
-
- this.sldrGradient = new Common.UI.MultiSliderGradient({
- el: $('#slide-slider-gradient'),
- width: 125,
- minValue: 0,
- maxValue: 100,
- values: [0, 100]
- });
- this.sldrGradient.on('change', _.bind(this.onGradientChange, this));
- this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this));
- this.sldrGradient.on('thumbclick', function(cmp, index){
- me.GradColor.currentIdx = index;
- var color = me.GradColor.colors[me.GradColor.currentIdx];
- me.btnGradColor.setColor(color);
- me.colorsGrad.select(color,false);
- });
- this.sldrGradient.on('thumbdblclick', function(cmp){
- me.btnGradColor.cmpEl.find('button').dropdown('toggle');
- });
- this.FillItems.push(this.sldrGradient);
-
this.FillColorContainer = $('#slide-panel-color-fill');
this.FillImageContainer = $('#slide-panel-image-fill');
this.FillPatternContainer = $('#slide-panel-pattern-fill');
@@ -862,7 +626,142 @@ define([
})).show();
},
+ createDelayedControls: function() {
+ var me = this;
+
+ this.cmbPattern = new Common.UI.ComboDataView({
+ itemWidth: 28,
+ itemHeight: 28,
+ menuMaxHeight: 300,
+ enableKeyEvents: true,
+ cls: 'combo-pattern'
+ });
+ this.cmbPattern.menuPicker.itemTemplate = this.cmbPattern.fieldPicker.itemTemplate = _.template([
+ '',
+ '
px -<%= offsety %>px;"/>',
+ '
'
+ ].join(''));
+ this.cmbPattern.render($('#slide-combo-pattern'));
+ this.cmbPattern.openButton.menu.cmpEl.css({
+ 'min-width': 178,
+ 'max-width': 178
+ });
+ this.cmbPattern.on('click', _.bind(this.onPatternSelect, this));
+ this.FillItems.push(this.cmbPattern);
+
+ this.btnInsertFromFile = new Common.UI.Button({
+ el: $('#slide-button-from-file')
+ });
+ this.btnInsertFromFile.on('click', _.bind(function(btn){
+ if (this.api) this.api.ChangeSlideImageFromFile();
+ this.fireEvent('editcomplete', this);
+ }, this));
+ this.FillItems.push(this.btnInsertFromFile);
+
+ this.btnInsertFromUrl = new Common.UI.Button({
+ el: $('#slide-button-from-url')
+ });
+ this.btnInsertFromUrl.on('click', _.bind(this.insertFromUrl, this));
+ this.FillItems.push(this.btnInsertFromUrl);
+
+ this._arrFillType = [
+ {displayValue: this.textStretch, value: Asc.c_oAscFillBlipType.STRETCH},
+ {displayValue: this.textTile, value: Asc.c_oAscFillBlipType.TILE}
+ ];
+
+ this.cmbFillType = new Common.UI.ComboBox({
+ el: $('#slide-combo-fill-type'),
+ cls: 'input-group-nr',
+ menuStyle: 'min-width: 90px;',
+ editable: false,
+ data: this._arrFillType
+ });
+ this.cmbFillType.setValue(this._arrFillType[0].value);
+ this.cmbFillType.on('selected', _.bind(this.onFillTypeSelect, this));
+ this.FillItems.push(this.cmbFillType);
+
+ this._arrGradType = [
+ {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR},
+ {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH}
+ ];
+
+ this.cmbGradType = new Common.UI.ComboBox({
+ el: $('#slide-combo-grad-type'),
+ cls: 'input-group-nr',
+ menuStyle: 'min-width: 90px;',
+ editable: false,
+ data: this._arrGradType
+ });
+ this.cmbGradType.setValue(this._arrGradType[0].value);
+ this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this));
+ this.FillItems.push(this.cmbGradType);
+
+ this._viewDataLinear = [
+ { offsetx: 0, offsety: 0, type:45, subtype:-1, iconcls:'gradient-left-top' },
+ { offsetx: 50, offsety: 0, type:90, subtype:4, iconcls:'gradient-top'},
+ { offsetx: 100, offsety: 0, type:135, subtype:5, iconcls:'gradient-right-top'},
+ { offsetx: 0, offsety: 50, type:0, subtype:6, iconcls:'gradient-left', cls: 'item-gradient-separator', selected: true},
+ { offsetx: 100, offsety: 50, type:180, subtype:1, iconcls:'gradient-right'},
+ { offsetx: 0, offsety: 100, type:315, subtype:2, iconcls:'gradient-left-bottom'},
+ { offsetx: 50, offsety: 100, type:270, subtype:3, iconcls:'gradient-bottom'},
+ { offsetx: 100, offsety: 100, type:225, subtype:7, iconcls:'gradient-right-bottom'}
+ ];
+
+ this._viewDataRadial = [
+ { offsetx: 100, offsety: 150, type:2, subtype:5, iconcls:'gradient-radial-center'}
+ ];
+
+ this.btnDirection = new Common.UI.Button({
+ cls : 'btn-large-dataview',
+ iconCls : 'item-gradient gradient-left',
+ menu : new Common.UI.Menu({
+ style: 'min-width: 60px;',
+ menuAlign: 'tr-br',
+ items: [
+ { template: _.template('') }
+ ]
+ })
+ });
+ this.btnDirection.on('render:after', function(btn) {
+ me.mnuDirectionPicker = new Common.UI.DataView({
+ el: $('#id-slide-menu-direction'),
+ parentMenu: btn.menu,
+ restoreHeight: 174,
+ store: new Common.UI.DataViewStore(me._viewDataLinear),
+ itemTemplate: _.template('')
+ });
+ });
+ this.btnDirection.render($('#slide-button-direction'));
+ this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection));
+ this.FillItems.push(this.btnDirection);
+
+ this.sldrGradient = new Common.UI.MultiSliderGradient({
+ el: $('#slide-slider-gradient'),
+ width: 125,
+ minValue: 0,
+ maxValue: 100,
+ values: [0, 100]
+ });
+ this.sldrGradient.on('change', _.bind(this.onGradientChange, this));
+ this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this));
+ this.sldrGradient.on('thumbclick', function(cmp, index){
+ me.GradColor.currentIdx = index;
+ var color = me.GradColor.colors[me.GradColor.currentIdx];
+ me.btnGradColor.setColor(color);
+ me.colorsGrad.select(color,false);
+ });
+ this.sldrGradient.on('thumbdblclick', function(cmp){
+ me.btnGradColor.cmpEl.find('button').dropdown('toggle');
+ });
+ this.FillItems.push(this.sldrGradient);
+
+ },
+
createDelayedElements: function() {
+ this.createDelayedControls();
+
var global_hatch_menu_map = [
0,1,3,2,4,
53,5,6,7,8,
@@ -895,11 +794,31 @@ define([
}
this.UpdateThemeColors();
+ this._initSettings = false;
},
onInitStandartTextures: function(texture) {
var me = this;
if (texture && texture.length>0){
+ if (!this.btnTexture) {
+ this.btnTexture = new Common.UI.ComboBox({
+ el: $('#slide-combo-fill-texture'),
+ template: _.template([
+ ''
+ ].join(''))
+ });
+ this.textureMenu = new Common.UI.Menu({
+ items: [
+ { template: _.template('') }
+ ]
+ });
+ this.textureMenu.render($('#slide-combo-fill-texture'));
+ this.FillItems.push(this.btnTexture);
+ }
var texturearray = [];
_.each(texture, function(item){
texturearray.push({
@@ -1060,6 +979,86 @@ define([
},
UpdateThemeColors: function() {
+ if (!this.btnBackColor) {
+ this.btnBackColor = new Common.UI.ColorButton({
+ style: "width:45px;",
+ disabled: true,
+ menu : new Common.UI.Menu({
+ items: [
+ { template: _.template('') },
+ { template: _.template('' + this.textNewColor + '') }
+ ]
+ })
+ });
+ this.btnBackColor.render( $('#slide-back-color-btn'));
+ this.btnBackColor.setColor('ffffff');
+ this.FillItems.push(this.btnBackColor);
+ this.colorsBack = new Common.UI.ThemeColorPalette({
+ el: $('#slide-back-color-menu'),
+ value: 'ffffff',
+ transparent: true
+ });
+ this.colorsBack.on('select', _.bind(this.onColorsBackSelect, this));
+ $(this.el).on('click', '#slide-back-color-new', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor));
+
+ this.btnFGColor = new Common.UI.ColorButton({
+ style: "width:45px;",
+ menu : new Common.UI.Menu({
+ items: [
+ { template: _.template('') },
+ { template: _.template('' + this.textNewColor + '') }
+ ]
+ })
+ });
+ this.btnFGColor.render( $('#slide-foreground-color-btn'));
+ this.btnFGColor.setColor('000000');
+ this.FillItems.push(this.btnFGColor);
+ this.colorsFG = new Common.UI.ThemeColorPalette({
+ el: $('#slide-foreground-color-menu'),
+ value: '000000'
+ });
+ this.colorsFG.on('select', _.bind(this.onColorsFGSelect, this));
+ $(this.el).on('click', '#slide-foreground-color-new', _.bind(this.addNewColor, this, this.colorsFG, this.btnFGColor));
+
+ this.btnBGColor = new Common.UI.ColorButton({
+ style: "width:45px;",
+ menu : new Common.UI.Menu({
+ items: [
+ { template: _.template('') },
+ { template: _.template('' + this.textNewColor + '') }
+ ]
+ })
+ });
+ this.btnBGColor.render( $('#slide-background-color-btn'));
+ this.btnBGColor.setColor('ffffff');
+ this.FillItems.push(this.btnBGColor);
+ this.colorsBG = new Common.UI.ThemeColorPalette({
+ el: $('#slide-background-color-menu'),
+ value: 'ffffff'
+ });
+ this.colorsBG.on('select', _.bind(this.onColorsBGSelect, this));
+ $(this.el).on('click', '#slide-background-color-new', _.bind(this.addNewColor, this, this.colorsBG, this.btnBGColor));
+
+ this.btnGradColor = new Common.UI.ColorButton({
+ style: "width:45px;",
+ menu : new Common.UI.Menu({
+ items: [
+ { template: _.template('') },
+ { template: _.template('' + this.textNewColor + '') }
+ ]
+ })
+ });
+ this.btnGradColor.render( $('#slide-gradient-color-btn'));
+ this.btnGradColor.setColor('000000');
+ this.FillItems.push(this.btnGradColor);
+ this.colorsGrad = new Common.UI.ThemeColorPalette({
+ el: $('#slide-gradient-color-menu'),
+ value: '000000'
+ });
+ this.colorsGrad.on('select', _.bind(this.onColorsGradientSelect, this));
+ $(this.el).on('click', '#slide-gradient-color-new', _.bind(this.addNewColor, this, this.colorsGrad, this.btnGradColor));
+ }
+
this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
@@ -1076,7 +1075,6 @@ define([
ChangeSettings: function(props) {
if (this._initSettings)
this.createDelayedElements();
- this._initSettings = false;
if (props)
{
@@ -1405,6 +1403,8 @@ define([
},
SetSlideDisabled: function(background, effects, timing) {
+ if (this._initSettings) return;
+
if (background !== this._stateDisabled.background) {
this.cmbFillSrc.setDisabled(background);
for (var i=0; i