diff --git a/apps/documenteditor/main/app/controller/ViewTab.js b/apps/documenteditor/main/app/controller/ViewTab.js index 07567b2a5..6274a952e 100644 --- a/apps/documenteditor/main/app/controller/ViewTab.js +++ b/apps/documenteditor/main/app/controller/ViewTab.js @@ -61,6 +61,7 @@ define([ Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('contenttheme:dark', this.onContentThemeChangedToDark.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)); }, @@ -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() { Common.NotificationCenter.trigger('edit:complete', this.view); } diff --git a/apps/presentationeditor/main/app/controller/ViewTab.js b/apps/presentationeditor/main/app/controller/ViewTab.js index 4e2249cf4..b838eac93 100644 --- a/apps/presentationeditor/main/app/controller/ViewTab.js +++ b/apps/presentationeditor/main/app/controller/ViewTab.js @@ -63,6 +63,7 @@ define([ }; Common.NotificationCenter.on('app:ready', this.onAppReady.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)); }, @@ -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) { this._state.zoom_percent = undefined; this._state.zoom_type = undefined; diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js index 1260ac14e..0380bebc9 100644 --- a/apps/spreadsheeteditor/main/app/controller/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js @@ -60,6 +60,7 @@ define([ onLaunch: function () { this._state = {}; Common.NotificationCenter.on('uitheme:changed', this.onThemeChanged.bind(this)); + Common.NotificationCenter.on('uitheme:countchanged', this.onThemeCountChanged.bind(this)); }, setApi: function (api) { @@ -283,7 +284,24 @@ define([ 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 || {})); }); \ No newline at end of file