From 201f381c9d8680b58efd515d796be8a004522f24 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 7 Apr 2016 12:08:13 +0300 Subject: [PATCH] =?UTF-8?q?[DE]=20=D0=9F=D0=B5=D1=80=D0=B5=D1=81=D1=87?= =?UTF-8?q?=D0=B5=D1=82=20=D0=BF=D1=80=D0=B5=D1=81=D0=B5=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B8=20=D0=BC=D0=B0=D1=80=D0=B3=D0=B8=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B?= =?UTF-8?q?=20=D0=B2=20=D1=81=D0=BE=D0=BE=D1=82=D0=B2=D0=B5=D1=82=D1=81?= =?UTF-8?q?=D1=82=D0=B2=D0=B8=D0=B8=20=D1=81=20=D0=B2=D1=8B=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D0=BC=D0=B8=20=D0=B5=D0=B4=D0=B8=D0=BD?= =?UTF-8?q?=D0=B8=D1=86=D0=B0=D0=BC=D0=B8=20=D0=B8=D0=B7=D0=BC=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/app/controller/Main.js | 1 + .../main/app/view/PageMarginsDialog.js | 23 ++++++------ .../main/app/view/PageSizeDialog.js | 12 +++---- apps/documenteditor/main/app/view/Toolbar.js | 36 ++++++++++++++++--- 4 files changed, 49 insertions(+), 23 deletions(-) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index d115ab6119..98644efcf3 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1591,6 +1591,7 @@ define([ Common.Utils.Metric.setCurrentMetric(value); this.api.asc_SetDocumentUnits((value==Common.Utils.Metric.c_MetricUnits.inch) ? c_oAscDocumentUnits.Inch : ((value==Common.Utils.Metric.c_MetricUnits.pt) ? c_oAscDocumentUnits.Point : c_oAscDocumentUnits.Millimeter)); this.getApplication().getController('RightMenu').updateMetricUnit(); + this.getApplication().getController('Toolbar').getView('Toolbar').updateMetricUnit(); }, onAdvancedOptions: function(advOptions) { diff --git a/apps/documenteditor/main/app/view/PageMarginsDialog.js b/apps/documenteditor/main/app/view/PageMarginsDialog.js index 5dac4af6c8..7ef8bf8571 100644 --- a/apps/documenteditor/main/app/view/PageMarginsDialog.js +++ b/apps/documenteditor/main/app/view/PageMarginsDialog.js @@ -149,7 +149,7 @@ define([ $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('input').on('keypress', _.bind(this.onKeyPress, this)); -// this.updateMetricUnit(); + this.updateMetricUnit(); }, _handleInput: function(state) { @@ -186,26 +186,26 @@ define([ setSettings: function (props) { if (props) { - this.maxMarginsH = parseFloat((props.get_H()/10. - 0.26).toFixed(4)); - this.maxMarginsW = parseFloat((props.get_W()/10. - 1.27).toFixed(4)); + this.maxMarginsH = Common.Utils.Metric.fnRecalcFromMM(props.get_H() - 2.6); + this.maxMarginsW = Common.Utils.Metric.fnRecalcFromMM(props.get_W() - 12.7); this.spnTop.setMaxValue(this.maxMarginsH); this.spnBottom.setMaxValue(this.maxMarginsH); this.spnLeft.setMaxValue(this.maxMarginsW); this.spnRight.setMaxValue(this.maxMarginsW); - this.spnTop.setValue(props.get_TopMargin()/10, true); // this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_TopMargin()), true); - this.spnBottom.setValue(props.get_BottomMargin()/10, true); - this.spnLeft.setValue(props.get_LeftMargin()/10, true); - this.spnRight.setValue(props.get_RightMargin()/10, true); + this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_TopMargin()), true); + this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_BottomMargin()), true); + this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_LeftMargin()), true); + this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_RightMargin()), true); } }, getSettings: function() { var props = new CDocumentSectionProps(); - props.put_TopMargin(this.spnTop.getNumberValue()*10); // props.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(this.spnTop.getNumberValue())); - props.put_BottomMargin(this.spnBottom.getNumberValue()*10); - props.put_LeftMargin(this.spnLeft.getNumberValue()*10); - props.put_RightMargin(this.spnRight.getNumberValue()*10); + props.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(this.spnTop.getNumberValue())); + props.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(this.spnBottom.getNumberValue())); + props.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue())); + props.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue())); return props; }, @@ -217,7 +217,6 @@ define([ spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1); } } - }, textTitle: 'Margins', diff --git a/apps/documenteditor/main/app/view/PageSizeDialog.js b/apps/documenteditor/main/app/view/PageSizeDialog.js index ae067a3097..1d30a088b5 100644 --- a/apps/documenteditor/main/app/view/PageSizeDialog.js +++ b/apps/documenteditor/main/app/view/PageSizeDialog.js @@ -116,7 +116,7 @@ define([ $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('input').on('keypress', _.bind(this.onKeyPress, this)); -// this.updateMetricUnit(); + this.updateMetricUnit(); }, _handleInput: function(state) { @@ -139,15 +139,15 @@ define([ setSettings: function (props) { if (props) { - this.spnWidth.setMinValue(parseFloat((props.get_LeftMargin()/10+props.get_RightMargin()/10.).toFixed(4)) + 1.27); - this.spnWidth.setValue(props.get_W()/10, true); // this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(props[0]), true); - this.spnHeight.setMinValue(parseFloat((props.get_TopMargin()/10+props.get_BottomMargin()/10.).toFixed(4)) + 0.26); - this.spnHeight.setValue(props.get_H()/10, true); + this.spnWidth.setMinValue(Common.Utils.Metric.fnRecalcFromMM(props.get_LeftMargin() + props.get_RightMargin() + 12.7)); + this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_W()), true); + this.spnHeight.setMinValue(Common.Utils.Metric.fnRecalcFromMM(props.get_TopMargin() + props.get_BottomMargin() + 2.6)); + this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_H()), true); } }, getSettings: function() { - return [this.spnWidth.getNumberValue()*10, this.spnHeight.getNumberValue()*10]; //Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue()) + return [Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue()), Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())]; }, updateMetricUnit: function() { diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index e1e2573ab3..18879d0fa5 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -686,10 +686,10 @@ define([ var pageMarginsTemplate = _.template('
<%= caption %>
' + '<% if (options.value !== null) { %>
' + - '' + - '
' + - ''+ - '
'+ + '' + + '
' + + ''+ + '
'+ '<% } %>
'); this.btnPageMargins = new Common.UI.Button({ @@ -711,7 +711,10 @@ define([ }); this.toolbarControls.push(this.btnPageMargins); - var pageSizeTemplate = _.template('
<%= caption %>
<%= options.subtitle %>
'); + var pageSizeTemplate = _.template('
<%= caption %>
' + + '
<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] %> x '+ + '<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] %>
'); + this.btnPageSize = new Common.UI.Button({ id : 'id-toolbar-btn-pagesize', cls : 'btn-toolbar', @@ -1374,6 +1377,29 @@ define([ this.mnuNonPrinting.items[0].setChecked(this.api.get_ShowParaMarks(), true); this.mnuNonPrinting.items[1].setChecked(this.api.get_ShowTableEmptyLine(), true); this.btnShowHidenChars.toggle(this.mnuNonPrinting.items[0].checked, true); + + this.updateMetricUnit(); + } + }, + + updateMetricUnit: function() { + var items = this.btnPageMargins.menu.items; + for (var i=0; i