[DE PE SSE] Fix change of themes in view tab

This commit is contained in:
JuliaSvinareva 2022-06-03 14:17:21 +03:00
parent c97440e676
commit 24910d5651
3 changed files with 55 additions and 1 deletions

View file

@ -61,6 +61,7 @@ define([
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('contenttheme:dark', this.onContentThemeChangedToDark.bind(this)); Common.NotificationCenter.on('contenttheme:dark', this.onContentThemeChangedToDark.bind(this));
Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this)); Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this));
Common.NotificationCenter.on('uitheme:countchanged', this.onThemeCountChanged.bind(this));
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this)); Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
}, },
@ -271,6 +272,23 @@ define([
} }
}, },
onThemeCountChanged: function () {
if (this.view && Common.UI.Themes.available()) {
this.view.btnInterfaceTheme.menu.removeAll();
var currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId();
for (var t in Common.UI.Themes.map()) {
var item = {
value: t,
caption: Common.UI.Themes.get(t).text,
checked: t === currentTheme,
checkable: true,
toggleGroup: 'interface-theme'
};
this.view.btnInterfaceTheme.menu.addItem(item);
}
}
},
onComboBlur: function() { onComboBlur: function() {
Common.NotificationCenter.trigger('edit:complete', this.view); Common.NotificationCenter.trigger('edit:complete', this.view);
} }

View file

@ -63,6 +63,7 @@ define([
}; };
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this)); Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this));
Common.NotificationCenter.on('uitheme:countchanged', this.onThemeCountChanged.bind(this));
Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this)); Common.NotificationCenter.on('document:ready', _.bind(this.onDocumentReady, this));
}, },
@ -235,6 +236,23 @@ define([
} }
}, },
onThemeCountChanged: function () {
if (this.view && Common.UI.Themes.available()) {
this.view.btnInterfaceTheme.menu.removeAll();
var currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId();
for (var t in Common.UI.Themes.map()) {
var item = {
value: t,
caption: Common.UI.Themes.get(t).text,
checked: t === currentTheme,
checkable: true,
toggleGroup: 'interface-theme'
};
this.view.btnInterfaceTheme.menu.addItem(item);
}
}
},
applyZoom: function (value) { applyZoom: function (value) {
this._state.zoom_percent = undefined; this._state.zoom_percent = undefined;
this._state.zoom_type = undefined; this._state.zoom_type = undefined;

View file

@ -60,6 +60,7 @@ define([
onLaunch: function () { onLaunch: function () {
this._state = {}; this._state = {};
Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this)); Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this));
Common.NotificationCenter.on('uitheme:countchanged', this.onThemeCountChanged.bind(this));
}, },
setApi: function (api) { setApi: function (api) {
@ -283,7 +284,24 @@ define([
menu_item.setChecked(true, true); menu_item.setChecked(true, true);
} }
} }
},
onThemeCountChanged: function () {
if (this.view && Common.UI.Themes.available()) {
this.view.btnInterfaceTheme.menu.removeAll();
var currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId();
for (var t in Common.UI.Themes.map()) {
var item = {
value: t,
caption: Common.UI.Themes.get(t).text,
checked: t === currentTheme,
checkable: true,
toggleGroup: 'interface-theme'
};
this.view.btnInterfaceTheme.menu.addItem(item);
} }
}
},
}, SSE.Controllers.ViewTab || {})); }, SSE.Controllers.ViewTab || {}));
}); });