[DE] Watermark settings: disable non-active controls
This commit is contained in:
parent
a982f24fba
commit
82c4adf441
|
@ -80,6 +80,8 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
this.props = options.props;
|
this.props = options.props;
|
||||||
this.fontStore = options.fontStore;
|
this.fontStore = options.fontStore;
|
||||||
this.api = options.api;
|
this.api = options.api;
|
||||||
|
this.textControls = [];
|
||||||
|
this.imageControls = [];
|
||||||
|
|
||||||
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
|
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
|
||||||
},
|
},
|
||||||
|
@ -92,11 +94,12 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
el: $('#watermark-radio-none'),
|
el: $('#watermark-radio-none'),
|
||||||
name: 'asc-radio-watermark-type',
|
name: 'asc-radio-watermark-type',
|
||||||
labelText: this.textNone,
|
labelText: this.textNone,
|
||||||
checked: true
|
checked: false
|
||||||
});
|
});
|
||||||
this.radioNone.on('change', _.bind(function(field, newValue, eOpts) {
|
this.radioNone.on('change', _.bind(function(field, newValue, eOpts) {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
// disable text and image
|
// disable text and image
|
||||||
|
this.disableControls(0);
|
||||||
}
|
}
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
|
@ -104,11 +107,12 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
el: $('#watermark-radio-image'),
|
el: $('#watermark-radio-image'),
|
||||||
name: 'asc-radio-watermark-type',
|
name: 'asc-radio-watermark-type',
|
||||||
labelText: this.textImageW,
|
labelText: this.textImageW,
|
||||||
checked: true
|
checked: false
|
||||||
});
|
});
|
||||||
this.radioImage.on('change', _.bind(function(field, newValue, eOpts) {
|
this.radioImage.on('change', _.bind(function(field, newValue, eOpts) {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
// disable text
|
// disable text
|
||||||
|
this.disableControls(2);
|
||||||
}
|
}
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
|
@ -121,6 +125,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
this.radioText.on('change', _.bind(function(field, newValue, eOpts) {
|
this.radioText.on('change', _.bind(function(field, newValue, eOpts) {
|
||||||
if (newValue) {
|
if (newValue) {
|
||||||
// disable image
|
// disable image
|
||||||
|
this.disableControls(1);
|
||||||
}
|
}
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
|
@ -131,11 +136,13 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
this.btnFromFile.on('click', _.bind(function(btn){
|
this.btnFromFile.on('click', _.bind(function(btn){
|
||||||
// if (this.api) this.api.ChangeShapeImageFromFile(this.BlipFillType);
|
// if (this.api) this.api.ChangeShapeImageFromFile(this.BlipFillType);
|
||||||
}, this));
|
}, this));
|
||||||
|
this.imageControls.push(this.btnFromFile);
|
||||||
|
|
||||||
this.btnFromUrl = new Common.UI.Button({
|
this.btnFromUrl = new Common.UI.Button({
|
||||||
el: $('#watermark-from-url')
|
el: $('#watermark-from-url')
|
||||||
});
|
});
|
||||||
// this.btnFromUrl.on('click', _.bind(this.insertFromUrl, this));
|
// this.btnFromUrl.on('click', _.bind(this.insertFromUrl, this));
|
||||||
|
this.imageControls.push(this.btnFromUrl);
|
||||||
|
|
||||||
this._arrScale = [
|
this._arrScale = [
|
||||||
{displayValue: this.textAuto, value: -1},
|
{displayValue: this.textAuto, value: -1},
|
||||||
|
@ -154,6 +161,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
}).on('selected', _.bind(function(combo, record) {
|
}).on('selected', _.bind(function(combo, record) {
|
||||||
}, this));
|
}, this));
|
||||||
this.cmbScale.setValue(this._arrScale[0].value);
|
this.cmbScale.setValue(this._arrScale[0].value);
|
||||||
|
this.imageControls.push(this.cmbScale);
|
||||||
|
|
||||||
// Text watermark
|
// Text watermark
|
||||||
this.cmbText = new Common.UI.ComboBox({
|
this.cmbText = new Common.UI.ComboBox({
|
||||||
|
@ -163,6 +171,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
data : []
|
data : []
|
||||||
}).on('selected', _.bind(function(combo, record) {
|
}).on('selected', _.bind(function(combo, record) {
|
||||||
}, this));
|
}, this));
|
||||||
|
this.textControls.push(this.cmbText);
|
||||||
|
|
||||||
this.cmbFonts = new Common.UI.ComboBoxFonts({
|
this.cmbFonts = new Common.UI.ComboBoxFonts({
|
||||||
el : $('#watermark-fonts'),
|
el : $('#watermark-fonts'),
|
||||||
|
@ -175,6 +184,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
hint : this.tipFontName
|
hint : this.tipFontName
|
||||||
});
|
});
|
||||||
// this.cmbFonts.on('selected', _.bind(this.onFontSelect, this));
|
// this.cmbFonts.on('selected', _.bind(this.onFontSelect, this));
|
||||||
|
this.textControls.push(this.cmbFonts);
|
||||||
|
|
||||||
var data = [
|
var data = [
|
||||||
{ value: -1, displayValue: this.textAuto },
|
{ value: -1, displayValue: this.textAuto },
|
||||||
|
@ -206,6 +216,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
});
|
});
|
||||||
// this.cmbFontSize.on('selected', _.bind(this.onFontSizeSelect, this));
|
// this.cmbFontSize.on('selected', _.bind(this.onFontSizeSelect, this));
|
||||||
this.cmbFontSize.setValue(-1);
|
this.cmbFontSize.setValue(-1);
|
||||||
|
this.textControls.push(this.cmbFontSize);
|
||||||
|
|
||||||
this.btnBold = new Common.UI.Button({
|
this.btnBold = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar',
|
cls: 'btn-toolbar',
|
||||||
|
@ -215,6 +226,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
});
|
});
|
||||||
this.btnBold.render($('#watermark-bold')) ;
|
this.btnBold.render($('#watermark-bold')) ;
|
||||||
// this.btnBold.on('click', _.bind(this.onBoldClick, this));
|
// this.btnBold.on('click', _.bind(this.onBoldClick, this));
|
||||||
|
this.textControls.push(this.btnBold);
|
||||||
|
|
||||||
this.btnItalic = new Common.UI.Button({
|
this.btnItalic = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar',
|
cls: 'btn-toolbar',
|
||||||
|
@ -224,6 +236,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
});
|
});
|
||||||
this.btnItalic.render($('#watermark-italic')) ;
|
this.btnItalic.render($('#watermark-italic')) ;
|
||||||
// this.btnItalic.on('click', _.bind(this.onItalicClick, this));
|
// this.btnItalic.on('click', _.bind(this.onItalicClick, this));
|
||||||
|
this.textControls.push(this.btnItalic);
|
||||||
|
|
||||||
this.btnUnderline = new Common.UI.Button({
|
this.btnUnderline = new Common.UI.Button({
|
||||||
cls : 'btn-toolbar',
|
cls : 'btn-toolbar',
|
||||||
|
@ -233,6 +246,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
});
|
});
|
||||||
this.btnUnderline.render($('#watermark-underline')) ;
|
this.btnUnderline.render($('#watermark-underline')) ;
|
||||||
// this.btnUnderline.on('click', _.bind(this.onUnderlineClick, this));
|
// this.btnUnderline.on('click', _.bind(this.onUnderlineClick, this));
|
||||||
|
this.textControls.push(this.btnUnderline);
|
||||||
|
|
||||||
this.btnStrikeout = new Common.UI.Button({
|
this.btnStrikeout = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar',
|
cls: 'btn-toolbar',
|
||||||
|
@ -242,6 +256,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
});
|
});
|
||||||
this.btnStrikeout.render($('#watermark-strikeout')) ;
|
this.btnStrikeout.render($('#watermark-strikeout')) ;
|
||||||
// this.btnStrikeout.on('click',_.bind(this.onStrikeoutClick, this));
|
// this.btnStrikeout.on('click',_.bind(this.onStrikeoutClick, this));
|
||||||
|
this.textControls.push(this.btnStrikeout);
|
||||||
|
|
||||||
var initNewColor = function(btn, picker_el) {
|
var initNewColor = function(btn, picker_el) {
|
||||||
if (btn && btn.cmpEl) {
|
if (btn && btn.cmpEl) {
|
||||||
|
@ -281,7 +296,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
// this.btnTextColor.on('click', _.bind(this.onTextColor, this));
|
// this.btnTextColor.on('click', _.bind(this.onTextColor, this));
|
||||||
this.mnuTextColorPicker = initNewColor(this.btnTextColor, "#watermark-menu-textcolor");
|
this.mnuTextColorPicker = initNewColor(this.btnTextColor, "#watermark-menu-textcolor");
|
||||||
$('#watermark-auto-color').on('click', _.bind(this.onAutoColor, this));
|
$('#watermark-auto-color').on('click', _.bind(this.onAutoColor, this));
|
||||||
|
this.textControls.push(this.btnTextColor);
|
||||||
|
|
||||||
this.numTransparency = new Common.UI.MetricSpinner({
|
this.numTransparency = new Common.UI.MetricSpinner({
|
||||||
el: $('#watermark-spin-opacity'),
|
el: $('#watermark-spin-opacity'),
|
||||||
|
@ -293,6 +308,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
minValue: 0
|
minValue: 0
|
||||||
});
|
});
|
||||||
this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this));
|
this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this));
|
||||||
|
this.textControls.push(this.numTransparency);
|
||||||
|
|
||||||
this.sldrTransparency = new Common.UI.SingleSlider({
|
this.sldrTransparency = new Common.UI.SingleSlider({
|
||||||
el: $('#watermark-slider-opacity'),
|
el: $('#watermark-slider-opacity'),
|
||||||
|
@ -302,6 +318,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
value: 100
|
value: 100
|
||||||
});
|
});
|
||||||
this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this));
|
this.sldrTransparency.on('change', _.bind(this.onTransparencyChange, this));
|
||||||
|
this.textControls.push(this.sldrTransparency);
|
||||||
|
|
||||||
this.lblTransparencyStart = $(this.el).find('#watermark-lbl-opacity-start');
|
this.lblTransparencyStart = $(this.el).find('#watermark-lbl-opacity-start');
|
||||||
this.lblTransparencyEnd = $(this.el).find('#watermark-lbl-opacity-end');
|
this.lblTransparencyEnd = $(this.el).find('#watermark-lbl-opacity-end');
|
||||||
|
@ -312,11 +329,14 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
labelText: this.textDiagonal,
|
labelText: this.textDiagonal,
|
||||||
checked: true
|
checked: true
|
||||||
});
|
});
|
||||||
|
this.textControls.push(this.radioDiag);
|
||||||
|
|
||||||
this.radioHor = new Common.UI.RadioBox({
|
this.radioHor = new Common.UI.RadioBox({
|
||||||
el: $('#watermark-radio-hor'),
|
el: $('#watermark-radio-hor'),
|
||||||
name: 'asc-radio-watermark-layout',
|
name: 'asc-radio-watermark-layout',
|
||||||
labelText: this.textHor
|
labelText: this.textHor
|
||||||
});
|
});
|
||||||
|
this.textControls.push(this.radioHor);
|
||||||
|
|
||||||
this.afterRender();
|
this.afterRender();
|
||||||
},
|
},
|
||||||
|
@ -401,6 +421,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
this.chLockDelete.setValue(val==Asc.c_oAscSdtLockType.SdtContentLocked || val==Asc.c_oAscSdtLockType.SdtLocked);
|
this.chLockDelete.setValue(val==Asc.c_oAscSdtLockType.SdtContentLocked || val==Asc.c_oAscSdtLockType.SdtLocked);
|
||||||
this.chLockEdit.setValue(val==Asc.c_oAscSdtLockType.SdtContentLocked || val==Asc.c_oAscSdtLockType.ContentLocked);
|
this.chLockEdit.setValue(val==Asc.c_oAscSdtLockType.SdtContentLocked || val==Asc.c_oAscSdtLockType.ContentLocked);
|
||||||
}
|
}
|
||||||
|
this.disableControls(this.radioNone.getValue() ? 0 : (this.radioImage.getValue() ? 2 : 1));
|
||||||
},
|
},
|
||||||
|
|
||||||
getSettings: function () {
|
getSettings: function () {
|
||||||
|
@ -429,6 +450,18 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template',
|
||||||
return props;
|
return props;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
disableControls: function(type) {// 0 - none, 1 - text, 2 - image
|
||||||
|
var disable = (type!=2);
|
||||||
|
_.each(this.imageControls, function(item) {
|
||||||
|
item.setDisabled(disable);
|
||||||
|
});
|
||||||
|
|
||||||
|
disable = (type!=1);
|
||||||
|
_.each(this.textControls, function(item) {
|
||||||
|
item.setDisabled(disable);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
onDlgBtnClick: function(event) {
|
onDlgBtnClick: function(event) {
|
||||||
var me = this;
|
var me = this;
|
||||||
var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event;
|
var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event;
|
||||||
|
|
Loading…
Reference in a new issue