Symbol table refactoring
This commit is contained in:
parent
28861851fb
commit
5fba110d35
|
@ -350,6 +350,7 @@ define([
|
||||||
Common.Views.SymbolTableDialog = Common.UI.Window.extend(_.extend({
|
Common.Views.SymbolTableDialog = Common.UI.Window.extend(_.extend({
|
||||||
options: {
|
options: {
|
||||||
width: 450,
|
width: 450,
|
||||||
|
height: 395,
|
||||||
style: 'min-width: 230px;',
|
style: 'min-width: 230px;',
|
||||||
cls: 'modal-dlg',
|
cls: 'modal-dlg',
|
||||||
buttons: ['ok', 'cancel']
|
buttons: ['ok', 'cancel']
|
||||||
|
@ -413,6 +414,7 @@ define([
|
||||||
|
|
||||||
this.options.tpl = _.template(this.template)(this.options);
|
this.options.tpl = _.template(this.template)(this.options);
|
||||||
this.api = this.options.api;
|
this.api = this.options.api;
|
||||||
|
this.type = this.options.type || 0; // 0 - close on OK, single adding symbol
|
||||||
|
|
||||||
var filter = Common.localStorage.getKeysFilter();
|
var filter = Common.localStorage.getKeysFilter();
|
||||||
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
|
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
|
||||||
|
@ -619,13 +621,6 @@ define([
|
||||||
Common.UI.Window.prototype.close.apply(this, arguments);
|
Common.UI.Window.prototype.close.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
setSettings: function (props) {
|
|
||||||
},
|
|
||||||
|
|
||||||
getSettings: function () {
|
|
||||||
return this.getPasteSymbol(this.$window.find('.cell-selected').attr('id'));
|
|
||||||
},
|
|
||||||
|
|
||||||
getPasteSymbol: function(cellId) {
|
getPasteSymbol: function(cellId) {
|
||||||
var bUpdateRecents = cellId[0] === 'c';
|
var bUpdateRecents = cellId[0] === 'c';
|
||||||
var sFont;
|
var sFont;
|
||||||
|
@ -649,14 +644,15 @@ define([
|
||||||
|
|
||||||
_handleInput: function(state) {
|
_handleInput: function(state) {
|
||||||
var settings = this.getPasteSymbol(this.$window.find('.cell-selected').attr('id'));
|
var settings = this.getPasteSymbol(this.$window.find('.cell-selected').attr('id'));
|
||||||
if (state=='ok') {
|
|
||||||
settings.updateRecents && this.checkRecent(nCurrentSymbol, settings.font);
|
|
||||||
settings.updateRecents && this.updateRecents();
|
|
||||||
}
|
|
||||||
if (this.options.handler) {
|
if (this.options.handler) {
|
||||||
this.options.handler.call(this, this, state, settings);
|
this.options.handler.call(this, this, state, settings);
|
||||||
}
|
}
|
||||||
|
if (state=='ok') {
|
||||||
|
settings.updateRecents && this.checkRecent(nCurrentSymbol, settings.font);
|
||||||
|
settings.updateRecents && this.updateRecents();
|
||||||
|
if (this.type)
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -877,10 +873,14 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
cellDblClickHandler: function (e){
|
cellDblClickHandler: function (e){
|
||||||
|
if (!this.type)
|
||||||
|
this._handleInput('ok');
|
||||||
|
else {
|
||||||
var settings = this.getPasteSymbol($(e.target).attr('id'));
|
var settings = this.getPasteSymbol($(e.target).attr('id'));
|
||||||
settings.updateRecents && this.checkRecent(nCurrentSymbol, settings.font);
|
settings.updateRecents && this.checkRecent(nCurrentSymbol, settings.font);
|
||||||
settings.updateRecents && this.updateView(false, undefined, undefined, true);
|
settings.updateRecents && this.updateView(false, undefined, undefined, true);
|
||||||
this.fireEvent('symbol:dblclick', [this, settings]);
|
this.fireEvent('symbol:dblclick', this, settings);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
updateRecents: function(){
|
updateRecents: function(){
|
||||||
|
@ -1149,8 +1149,8 @@ define([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(value === 13){//enter
|
else if(value === 13){//enter
|
||||||
this.checkRecent(nCurrentSymbol, aFontSelects[nCurrentFont].displayName);
|
this.checkRecent(nCurrentSymbol, aFontSelects[nCurrentFont].displayValue);
|
||||||
this.fireEvent('symbol:dblclick', {font: aFontSelects[nCurrentFont].displayName, symbol: this.encodeSurrogateChar(nCurrentSymbol)});
|
this.fireEvent('symbol:dblclick', this, {font: aFontSelects[nCurrentFont].displayValue, symbol: this.encodeSurrogateChar(nCurrentSymbol)});
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
bFill = false;
|
bFill = false;
|
||||||
|
@ -1207,7 +1207,7 @@ define([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(value === 13){//enter
|
else if(value === 13){//enter
|
||||||
this.fireEvent('symbol:dblclick', {font: aFontSelects[nFontNameRecent].displayName, symbol: this.encodeSurrogateChar(nCurrentSymbol)});
|
this.fireEvent('symbol:dblclick', this, {font: aFontSelects[nFontNameRecent].displayValue, symbol: this.encodeSurrogateChar(nCurrentSymbol)});
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
bFill = false;
|
bFill = false;
|
||||||
|
|
|
@ -2479,16 +2479,20 @@ define([
|
||||||
var me = this,
|
var me = this,
|
||||||
win = new Common.Views.SymbolTableDialog({
|
win = new Common.Views.SymbolTableDialog({
|
||||||
api: me.api,
|
api: me.api,
|
||||||
handler: function(dlg, result) {
|
// modal: false,
|
||||||
|
// type: 1,
|
||||||
|
// buttons: [{value: 'ok', caption: this.textInsert}, 'close'],
|
||||||
|
handler: function(dlg, result, settings) {
|
||||||
if (result == 'ok') {
|
if (result == 'ok') {
|
||||||
var settings = dlg.getSettings();
|
|
||||||
me.api.pluginMethod_PasteHtml("<span style=\"font-family:'" + settings.font + "'\">" + settings.symbol + "</span>");
|
me.api.pluginMethod_PasteHtml("<span style=\"font-family:'" + settings.font + "'\">" + settings.symbol + "</span>");
|
||||||
}
|
}
|
||||||
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
win.show();
|
win.show();
|
||||||
// win.setSettings();
|
win.on('symbol:dblclick', function(cmp, settings) {
|
||||||
|
me.api.pluginMethod_PasteHtml("<span style=\"font-family:'" + settings.font + "'\">" + settings.symbol + "</span>");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertSymbol);
|
Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertSymbol);
|
||||||
},
|
},
|
||||||
|
@ -3291,7 +3295,8 @@ define([
|
||||||
confirmAddFontName: 'The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the device fonts, the saved font will be used when it is available.<br>Do you want to continue?',
|
confirmAddFontName: 'The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the device fonts, the saved font will be used when it is available.<br>Do you want to continue?',
|
||||||
notcriticalErrorTitle: 'Warning',
|
notcriticalErrorTitle: 'Warning',
|
||||||
txtMarginsW: 'Left and right margins are too high for a given page wight',
|
txtMarginsW: 'Left and right margins are too high for a given page wight',
|
||||||
txtMarginsH: 'Top and bottom margins are too high for a given page height'
|
txtMarginsH: 'Top and bottom margins are too high for a given page height',
|
||||||
|
textInsert: 'Insert'
|
||||||
|
|
||||||
}, DE.Controllers.Toolbar || {}));
|
}, DE.Controllers.Toolbar || {}));
|
||||||
});
|
});
|
Loading…
Reference in a new issue