From 76a3ee98d83a1cfc8404eb4f620414192316232e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 24 May 2016 14:45:53 +0300 Subject: [PATCH] =?UTF-8?q?[PE,=20SSE]=20=D0=92=D1=8B=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D0=BF=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BF=D1=80=D0=BE=D0=BF=D0=BE=D1=80=D1=86=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D0=B8=D0=B7=D0=BE=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D0=B9,=20=D0=B0=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D1=84=D0=B8=D0=B3=D1=83=D1=80=20=D0=B8=20=D0=B4=D0=B8=D0=B0?= =?UTF-8?q?=D0=B3=D1=80=D0=B0=D0=BC=D0=BC=20(=D1=81=D0=BC.=20=D0=B1=D0=B0?= =?UTF-8?q?=D0=B3=D0=B8=2032442,=2032436).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/app/view/ChartSettings.js | 20 +++++++++++++------ .../main/app/view/ShapeSettingsAdvanced.js | 9 +++++---- .../main/app/view/ChartSettings.js | 19 ++++++++++++------ .../main/app/view/ImageSettings.js | 19 ++++++++++++------ .../main/app/view/ShapeSettingsAdvanced.js | 10 +++++----- 5 files changed, 50 insertions(+), 27 deletions(-) diff --git a/apps/presentationeditor/main/app/view/ChartSettings.js b/apps/presentationeditor/main/app/view/ChartSettings.js index 141c896e3..175d1d459 100644 --- a/apps/presentationeditor/main/app/view/ChartSettings.js +++ b/apps/presentationeditor/main/app/view/ChartSettings.js @@ -71,7 +71,8 @@ define([ ChartStyle: 1, ChartType: -1, SeveralCharts: false, - DisabledControls: false + DisabledControls: false, + keepRatio: false }; this._nRatio = 1; this.spinners = []; @@ -213,15 +214,16 @@ define([ this.btnRatio.render($('#chart-button-ratio')) ; this.lockedControls.push(this.btnRatio); - var value = Common.localStorage.getItem("pe-settings-chartratio"); - if (value!==null && parseInt(value) == 1) { - this.btnRatio.toggle(true); - } this.btnRatio.on('click', _.bind(function(btn, e) { if (btn.pressed && this.spnHeight.getNumberValue()>0) { this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); } - Common.localStorage.setItem("pe-settings-chartratio", (btn.pressed) ? 1 : 0); + if (this.api) { + var props = new Asc.CAscChartProp(); + props.asc_putLockAspect(btn.pressed); + this.api.ChartApply(props); + } + this.fireEvent('editcomplete', this); }, this)); }, @@ -312,6 +314,12 @@ define([ if (props.get_Height()>0) this._nRatio = props.get_Width()/props.get_Height(); + + value = props.asc_getLockAspect(); + if (this._state.keepRatio!==value) { + this.btnRatio.toggle(value); + this._state.keepRatio=value; + } } }, diff --git a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js index 6e6590b48..624dc92cd 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js @@ -150,6 +150,9 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem if (btn.pressed && this.spnHeight.getNumberValue()>0) { this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); } + if (this._changedProps) { + this._changedProps.asc_putLockAspect(btn.pressed); + } }, this)); // Margins @@ -427,10 +430,8 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem if (props.get_Height()>0) this._nRatio = props.get_Width()/props.get_Height(); - var value = Common.localStorage.getItem("pe-settings-shaperatio"); - if (value!==null && parseInt(value) == 1) { - this.btnRatio.toggle(true); - } + var value = props.asc_getLockAspect(); + this.btnRatio.toggle(value); this._setShapeDefaults(props); diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettings.js b/apps/spreadsheeteditor/main/app/view/ChartSettings.js index 01ec3e5c6..923acfc3e 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettings.js @@ -73,7 +73,8 @@ define([ ChartStyle: 1, ChartType: -1, SeveralCharts: false, - DisabledControls: false + DisabledControls: false, + keepRatio: false }; this._nRatio = 1; this.spinners = []; @@ -209,15 +210,15 @@ define([ this.btnRatio.render($('#chart-button-ratio')) ; this.lockedControls.push(this.btnRatio); - var value = Common.localStorage.getItem("sse-settings-chartratio"); - if (value!==null && parseInt(value) == 1) { - this.btnRatio.toggle(true); - } this.btnRatio.on('click', _.bind(function(btn, e) { if (btn.pressed && this.spnHeight.getNumberValue()>0) { this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); } - Common.localStorage.setItem("sse-settings-chartratio", (btn.pressed) ? 1 : 0); + if (this.api) { + var props = new Asc.asc_CImgProperty(); + props.asc_putLockAspect(btn.pressed); + this.api.asc_setGraphicObjectProps(props); + } }, this)); $(this.el).on('click', '#chart-advanced-link', _.bind(this.openAdvancedSettings, this)); @@ -314,6 +315,12 @@ define([ if (props.asc_getHeight()>0) this._nRatio = props.asc_getWidth()/props.asc_getHeight(); + + value = props.asc_getLockAspect(); + if (this._state.keepRatio!==value) { + this.btnRatio.toggle(value); + this._state.keepRatio=value; + } } }, diff --git a/apps/spreadsheeteditor/main/app/view/ImageSettings.js b/apps/spreadsheeteditor/main/app/view/ImageSettings.js index 30b7148da..18734424a 100644 --- a/apps/spreadsheeteditor/main/app/view/ImageSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ImageSettings.js @@ -71,7 +71,8 @@ define([ this._state = { Width: 0, Height: 0, - DisabledControls: false + DisabledControls: false, + keepRatio: false }; this.spinners = []; this.lockedControls = []; @@ -115,15 +116,15 @@ define([ this.btnRatio.render($('#image-button-ratio')) ; this.lockedControls.push(this.btnRatio); - var value = Common.localStorage.getItem("sse-settings-imageratio"); - if (value===null || parseInt(value) == 1) { - this.btnRatio.toggle(true); - } this.btnRatio.on('click', _.bind(function(btn, e) { if (btn.pressed && this.spnHeight.getNumberValue()>0) { this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); } - Common.localStorage.setItem("sse-settings-imageratio", (btn.pressed) ? 1 : 0); + if (this.api) { + var props = new Asc.asc_CImgProperty(); + props.asc_putLockAspect(btn.pressed); + this.api.asc_setGraphicObjectProps(props); + } }, this)); this.btnOriginalSize = new Common.UI.Button({ @@ -204,6 +205,12 @@ define([ if (props.asc_getHeight()>0) this._nRatio = props.asc_getWidth()/props.asc_getHeight(); + value = props.asc_getLockAspect(); + if (this._state.keepRatio!==value) { + this.btnRatio.toggle(value); + this._state.keepRatio=value; + } + this.btnOriginalSize.setDisabled(props.asc_getImageUrl()===null || props.asc_getImageUrl()===undefined || this._locked); } }, diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js index 74d12de3e..1b4a697d5 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js @@ -150,6 +150,9 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp if (btn.pressed && this.spnHeight.getNumberValue()>0) { this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue(); } + if (this._changedProps) { + this._changedProps.asc_putLockAspect(btn.pressed); + } }, this)); // Margins @@ -453,10 +456,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp if (props.asc_getHeight()>0) this._nRatio = props.asc_getWidth()/props.asc_getHeight(); - var value = Common.localStorage.getItem("sse-settings-shaperatio"); - if (value!==null && parseInt(value) == 1) { - this.btnRatio.toggle(true); - } + var value = props.asc_getLockAspect(); + this.btnRatio.toggle(value); this._setShapeDefaults(shapeprops); @@ -478,7 +479,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp }, getSettings: function() { - Common.localStorage.setItem("sse-settings-shaperatio", (this.btnRatio.pressed) ? 1 : 0); return { shapeProps: this._changedProps} ; },