Commit 201f381c authored by Julia Radzhabova's avatar Julia Radzhabova

[DE] Пересчет пресетов для размеров и маргинов страницы в соответствии с...

[DE] Пересчет пресетов для размеров и маргинов страницы в соответствии с выбранными единицами измерения.
parent 8127d062
......@@ -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) {
......
......@@ -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',
......
......@@ -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() {
......
......@@ -686,10 +686,10 @@ define([
var pageMarginsTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><b><%= caption %></b></div>' +
'<% if (options.value !== null) { %><div style="display: inline-block;margin-right: 20px;min-width: 80px;">' +
'<label style="display: block;">'+ this.textTop +'<%= parseFloat((options.value[0]/10.).toFixed(2)) %>'+ ' ' + Common.Utils.Metric.metricName[0] +'</label>' +
'<label style="display: block;">'+ this.textLeft +'<%= parseFloat((options.value[1]/10.).toFixed(2)) %>'+ ' ' + Common.Utils.Metric.metricName[0] +'</label></div><div style="display: inline-block;">' +
'<label style="display: block;">'+ this.textBottom +'<%= parseFloat((options.value[2]/10.).toFixed(2)) %>'+ ' ' + Common.Utils.Metric.metricName[0] +'</label>'+
'<label style="display: block;">'+ this.textRight +'<%= parseFloat((options.value[3]/10.).toFixed(2)) %>'+ ' ' + Common.Utils.Metric.metricName[0] +'</label></div>'+
'<label style="display: block;">'+ this.textTop +'<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] %></label>' +
'<label style="display: block;">'+ this.textLeft +'<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] %></label></div><div style="display: inline-block;">' +
'<label style="display: block;">'+ this.textBottom +'<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[2]).toFixed(2)) %> <%= Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] %></label>'+
'<label style="display: block;">'+ this.textRight +'<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[3]).toFixed(2)) %> <%= Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()] %></label></div>'+
'<% } %></a>');
this.btnPageMargins = new Common.UI.Button({
......@@ -711,7 +711,10 @@ define([
});
this.toolbarControls.push(this.btnPageMargins);
var pageSizeTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><b><%= caption %></b></div><div><%= options.subtitle %></div></a>');
var pageSizeTemplate = _.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div><b><%= caption %></b></div>' +
'<div><%= 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()] %></div></a>');
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<items.length; i++) {
var mnu = items[i];
if (mnu.checkable) {
var checked = mnu.checked;
$(mnu.el).html(mnu.template({id: Common.UI.getId(), caption : mnu.caption, options : mnu.options}));
if (checked) mnu.setChecked(checked);
}
}
items = this.btnPageSize.menu.items;
for (var i=0; i<items.length; i++) {
var mnu = items[i];
if (mnu.checkable) {
var checked = mnu.checked;
$(mnu.el).html(mnu.template({id: Common.UI.getId(), caption : mnu.caption, options : mnu.options}));
if (checked) mnu.setChecked(checked);
}
}
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment