loleaflet/css/toolbar.css | 2 - loleaflet/src/control/Control.JSDialogBuilder.js | 27 ++++++++++++++++++---- loleaflet/src/control/Control.Menubar.js | 28 ++++++++++++++++------- loleaflet/src/control/Control.MobileWizard.js | 8 ++++-- loleaflet/src/control/Control.Toolbar.js | 27 ++++++++++++++++++++++ 5 files changed, 76 insertions(+), 16 deletions(-)
New commits: commit 4c3ef4c504e4111e9009a567e0b160404407471a Author: Marco Cecchetti <marco.cecche...@collabora.com> AuthorDate: Thu Dec 5 13:44:28 2019 +0100 Commit: Marco Cecchetti <marco.cecche...@collabora.com> CommitDate: Thu Dec 5 13:44:45 2019 +0100 move shapes palette from vex dialog to mobile wizard Change-Id: I76e136140e9268706f53ffc799703bbc72f70099 diff --git a/loleaflet/css/toolbar.css b/loleaflet/css/toolbar.css index d53a3e612..d2d4048d6 100644 --- a/loleaflet/css/toolbar.css +++ b/loleaflet/css/toolbar.css @@ -760,7 +760,7 @@ button.leaflet-control-search-next position: relative; padding: 2px; display: inline-block; - width: 350px; + width: 100%; height: 100%; } diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js index 782eb826c..e60ec7bb0 100644 --- a/loleaflet/src/control/Control.JSDialogBuilder.js +++ b/loleaflet/src/control/Control.JSDialogBuilder.js @@ -39,6 +39,7 @@ L.Control.JSDialogBuilder = L.Control.extend({ this._controlHandlers['listbox'] = this._comboboxControl; this._controlHandlers['valueset'] = this._valuesetControl; this._controlHandlers['fixedtext'] = this._fixedtextControl; + this._controlHandlers['htmlcontrol'] = this._htmlControl; this._controlHandlers['grid'] = this._gridHandler; this._controlHandlers['frame'] = this._frameHandler; this._controlHandlers['panel'] = this._panelHandler; @@ -1123,6 +1124,20 @@ L.Control.JSDialogBuilder = L.Control.extend({ return false; }, + _htmlControl: function(parentContainer, data) { + var container = L.DomUtil.create('div', 'mobile-wizard', parentContainer); + container.appendChild(data.content); + container.id = data.id; + if (data.style && data.style.length) { + L.DomUtil.addClass(container, data.style); + } + + if (data.hidden) + $(container).hide(); + + return false; + }, + _createIconPath: function(name) { if (!name) return ''; @@ -1399,11 +1414,6 @@ L.Control.JSDialogBuilder = L.Control.extend({ if (builder.wizard) { $(menuEntry).click(function() { - if (data.executionType === 'action') { - builder.map.menubar._executeAction(undefined, data.id); - } else { - builder.map.sendUnoCommand(data.command) - } if (window.insertionMobileWizard) window.onClick(null, 'insertion_mobile_wizard'); else if (window.mobileMenuWizard) @@ -1412,6 +1422,13 @@ L.Control.JSDialogBuilder = L.Control.extend({ window.contextMenuWizard = false; builder.map.fire('closemobilewizard'); } + + // before close the wizard then execute the action + if (data.executionType === 'action') { + builder.map.menubar._executeAction(undefined, data.id); + } else { + builder.map.sendUnoCommand(data.command) + } }); } else { console.debug('Builder used outside of mobile wizard: please implement the click handler'); diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js index dee207243..91b0b3eb2 100644 --- a/loleaflet/src/control/Control.Menubar.js +++ b/loleaflet/src/control/Control.Menubar.js @@ -1031,13 +1031,25 @@ L.Control.Menubar = L.Control.extend({ }); }, - _openInsertShapesDialog: function() { - vex.open({ - unsafeContent: '<div id="insertshape-wrapper"><div id="insertshape-popup" class="insertshape-pop ui-widget ui-corner-all"><div class="insertshape-grid"></div></div></div>', - afterOpen: function() { - window.insertShapes(true); - } - }); + _openInsertShapesWizard: function() { + var content = window.createShapesPanel(); + var data = { + id: 'insertshape', + type: '', + text: 'Insert Shape', + enabled: true, + children: [] + }; + + var container = { + id: '', + type: 'htmlcontrol', + content: content, + enabled: true + }; + + data.children.push(container); + this._map._docLayer._openMobileWizard(data); }, _executeAction: function(item, id) { @@ -1091,7 +1103,7 @@ L.Control.Menubar = L.Control.extend({ } else if (id === 'insertpage') { this._map.insertPage(); } else if (id === 'insertshape') { - this._openInsertShapesDialog(); + this._openInsertShapesWizard(); } else if (id === 'duplicatepage') { this._map.duplicatePage(); } else if (id === 'deletepage') { diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js index c02e6d5fc..8837b2f3b 100644 --- a/loleaflet/src/control/Control.MobileWizard.js +++ b/loleaflet/src/control/Control.MobileWizard.js @@ -191,9 +191,13 @@ L.Control.MobileWizard = L.Control.extend({ this._mainTitle = data.text ? data.text : ''; this._setTitle(this._mainTitle); - if (data.id === 'menubar') { + if (data.id === 'menubar' || data.id === 'insertshape') { $('#mobile-wizard').height('100%'); - $('#mobile-wizard').addClass('menuwizard'); + if (data.id === 'menubar') + $('#mobile-wizard').addClass('menuwizard'); + else if (data.id === 'insertshape') { + $('#mobile-wizard').addClass('shapeswizard'); + } if (this.map .getDocType() === 'spreadsheet') $('#mobile-wizard').css('top', $('#spreadsheet-row-column-frame').css('top')); else diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js index fc5fa8197..5d9de3baf 100644 --- a/loleaflet/src/control/Control.Toolbar.js +++ b/loleaflet/src/control/Control.Toolbar.js @@ -648,6 +648,32 @@ var shapes = { ] }; +function createShapesPanel() { + var $grid = $('<div/>').addClass('insertshape-grid'); + + for (var s in shapes) { + var $rowHeader = $('<div/>').addClass('row-header loleaflet-font').append(_(s)); + $grid.append($rowHeader); + var $row = $('<div/>').addClass('row'); + $grid.append($row); + for (var idx = 0; idx < shapes[s].length; ++idx) { + var shape = shapes[s][idx]; + var $col = $('<div/>').addClass('col w2ui-icon').addClass(shape.img); + $col.data('uno', shape.uno); + $row.append($col); + } + } + + $grid.on({ + click: function(e) { + map.sendUnoCommand('.uno:' + $(e.target).data().uno); + map._docLayer._closeMobileWizard(); + } + }); + + return $grid.get(0); +} + function insertShapes(mobile) { var width = 10; var $grid = $('.insertshape-grid'); @@ -2568,6 +2594,7 @@ global.updateCommandValues = updateCommandValues; global.onStyleSelect = onStyleSelect; global.insertTable = insertTable; global.insertShapes = insertShapes; +global.createShapesPanel = createShapesPanel; global.onUpdatePermission = onUpdatePermission; global.onSearch = onSearch; global.onSearchKeyDown = onSearchKeyDown; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits