diff --git a/gui/browserv7/src/RBrowserTCanvasWidget.cxx b/gui/browserv7/src/RBrowserTCanvasWidget.cxx index f3c8efcc926c35f2800a915a0f9caa20a6b1de5a..9d19bf1bc3680d2426b5a84a472f887c7ab044d7 100644 --- a/gui/browserv7/src/RBrowserTCanvasWidget.cxx +++ b/gui/browserv7/src/RBrowserTCanvasWidget.cxx @@ -38,6 +38,7 @@ public: fCanvas->SetTitle(name.c_str()); fCanvas->ResetBit(TCanvas::kShowEditor); fCanvas->ResetBit(TCanvas::kShowToolBar); + fCanvas->SetBit(TCanvas::kMenuBar, kTRUE); fCanvas->SetCanvas(fCanvas.get()); fCanvas->SetBatch(kTRUE); // mark canvas as batch fCanvas->SetEditable(kTRUE); // ensure fPrimitives are created diff --git a/ui5/canv/controller/Canvas.controller.js b/ui5/canv/controller/Canvas.controller.js index 1b3e8d7c9bd9d0ff6496f41b41e93c374f06744e..b2665a317695b1dc67e4ae20eb25d3fafc034785 100644 --- a/ui5/canv/controller/Canvas.controller.js +++ b/ui5/canv/controller/Canvas.controller.js @@ -14,6 +14,10 @@ sap.ui.define([ ], function (Controller, Component, JSONModel, XMLView, MessageToast, Dialog, List, InputListItem, Input, Button, Splitter, SplitterLayoutData) { "use strict"; + function chk_icon(flag) { + return flag ? "sap-icon://accept" : "sap-icon://decline"; + } + let CController = Controller.extend("rootui5.canv.controller.Canvas", { onInit : function() { this._Page = this.getView().byId("CanvasMainPage"); @@ -23,7 +27,11 @@ sap.ui.define([ this.bottomVisible = false; - let model = new JSONModel({ GedIcon: "", StatusIcon: "", ToolbarIcon: "", TooltipIcon: "sap-icon://accept", + let model = new JSONModel({ MenuBarIcon: chk_icon(true), + GedIcon: chk_icon(false), + StatusIcon: chk_icon(false), + ToolbarIcon: chk_icon(false), + TooltipIcon: chk_icon(true), StatusLbl1:"", StatusLbl2:"", StatusLbl3:"", StatusLbl4:"", Standalone: true }); this.getView().setModel(model); @@ -45,6 +53,8 @@ sap.ui.define([ cp.removeGed = this.cleanupIfGed.bind(this); cp.hasGed = this.isGedEditor.bind(this); + cp.hasMenuBar = this.isMenuBarShow.bind(this); + cp.actiavteMenuBar = this.toggleMenuBar.bind(this); cp.hasEventStatus = this.isStatusShown.bind(this); cp.activateStatusBar = this.toggleShowStatus.bind(this); cp.showCanvasStatus = this.showCanvasStatus.bind(this); // used only for UI5, otherwise global func @@ -306,7 +316,7 @@ sap.ui.define([ } this.getView().getModel().setProperty("/LeftArea", panel_name); - this.getView().getModel().setProperty("/GedIcon", (panel_name=="Ged") ? "sap-icon://accept" : ""); + this.getView().getModel().setProperty("/GedIcon", chk_icon(panel_name=="Ged")); if (!panel_handle || !panel_name) return Promise.resolve(false); @@ -349,7 +359,7 @@ sap.ui.define([ } this.getView().getModel().setProperty("/LeftArea", panel_name); - this.getView().getModel().setProperty("/GedIcon", (panel_name=="Ged") ? "sap-icon://accept" : ""); + this.getView().getModel().setProperty("/GedIcon", chk_icon(panel_name=="Ged")); if (!panel_name) return Promise.resolve(null); @@ -485,10 +495,11 @@ sap.ui.define([ }, toggleShowStatus : function(new_state) { - if (new_state === undefined) new_state = !this.isStatusShown(); + if ((new_state === undefined) || (new_state == "toggle")) + new_state = !this.isStatusShown(); this._Page.setShowFooter(new_state); - this.getView().getModel().setProperty("/StatusIcon", new_state ? "sap-icon://accept" : ""); + this.getView().getModel().setProperty("/StatusIcon", chk_icon(new_state)); let canvp = this.getCanvasPainter(); if (canvp) canvp.processChanges("sbits", canvp); @@ -499,19 +510,28 @@ sap.ui.define([ this._Page.setShowSubHeader(new_state); - this.getView().getModel().setProperty("/ToolbarIcon", new_state ? "sap-icon://accept" : ""); + this.getView().getModel().setProperty("/ToolbarIcon", chk_icon(new_state)); }, toggleToolTip : function(new_state) { - if (new_state === undefined) new_state = !this.getView().getModel().getProperty("/TooltipIcon"); + let p = this.getCanvasPainter(true); - this.getView().getModel().setProperty("/TooltipIcon", new_state ? "sap-icon://accept" : ""); + if (new_state === undefined) + new_state = p ? !p.isTooltipAllowed() : true; + + this.getView().getModel().setProperty("/TooltipIcon", chk_icon(new_state)); - let p = this.getCanvasPainter(true); if (p) p.setTooltipAllowed(new_state); }, - setShowMenu: function(new_state) { + isMenuBarShow: function() { + return this._Page.getShowHeader(); + }, + + toggleMenuBar: function(new_state) { + if ((new_state === undefined) || (new_state == "toggle")) + new_state = !this._Page.getShowHeader(); + this.getView().getModel().setProperty("/MenuBarIcon", chk_icon(new_state)); this._Page.setShowHeader(new_state); }, @@ -520,6 +540,7 @@ sap.ui.define([ let item = oEvent.getParameter("item"); switch (item.getText()) { + case "Menu": this.toggleMenuBar(); break; case "Editor": this.toggleGedEditor(); break; case "Event statusbar": this.toggleShowStatus(); break; case "Toolbar": this.toggleToolBar(); break; @@ -545,7 +566,7 @@ sap.ui.define([ showSection : function(that, on) { // this function call when section state changed from server side switch(that) { - case "Menu": this.setShowMenu(on); break; + case "Menu": this.toggleMenuBar(on); break; case "StatusBar": this.toggleShowStatus(on); break; case "Editor": return this.showGeEditor(on); case "ToolBar": this.toggleToolBar(on); break; diff --git a/ui5/canv/view/Canvas.view.xml b/ui5/canv/view/Canvas.view.xml index b71fa76d7ede9a9431fc2c387caa8199510e605e..f2d4c5d25724f227eab333f21ea180181424692f 100644 --- a/ui5/canv/view/Canvas.view.xml +++ b/ui5/canv/view/Canvas.view.xml @@ -40,13 +40,14 @@ <menu> <Menu itemSelected="onViewMenuAction"> <items> + <MenuItem text="Menu" icon="{/MenuBarIcon}" tooltip="Toggle menu bar"/> <MenuItem text="Editor" icon="{/GedIcon}" tooltip="Toggle graphics attribute editor"/> <MenuItem text="Toolbar" icon="{/ToolbarIcon}" tooltip="Toolbar with several shortcuts"/> <MenuItem text="Event statusbar" icon="{/StatusIcon}" /> <MenuItem text="Tooltip info" icon="{/TooltipIcon}" /> - <MenuItem text="Colors" startsSection="true" enabled="false"/> - <MenuItem text="Fonts" enabled="false"/> - <MenuItem text="Markers" enabled="false"/> + <MenuItem text="Colors" startsSection="true" icon="sap-icon://palette" enabled="false"/> + <MenuItem text="Fonts" icon="sap-icon://text" enabled="false"/> + <MenuItem text="Markers" icon="sap-icon://tags" enabled="false"/> </items> </Menu> </menu>