diff --git a/_locales/en/messages.json b/_locales/en/messages.json index bed40df3..a3212691 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -4841,6 +4841,12 @@ "save": { "message": "Save" }, + "copy": { + "message": "Copy" + }, + "paste": { + "message": "Paste" + }, "active": { "message": "Active" }, @@ -5634,6 +5640,12 @@ "osdSettingsSaved": { "message": "OSD settings saved" }, + "osdLayoutInsertedIntoClipboard": { + "message": "Layout has been saved to clipboard" + }, + "osdLayoutPasteFromClipboard": { + "message": "Layout has been restored from clipboard" + }, "failedToOpenSerialPort": { "message": "Failed to open serial port" }, diff --git a/src/css/tabs/osd.css b/src/css/tabs/osd.css index cebffd63..6f10bf38 100644 --- a/src/css/tabs/osd.css +++ b/src/css/tabs/osd.css @@ -733,4 +733,25 @@ button { .osdCustomElement_main_table select, .osdCustomElement_main_table input{ width: 100% !important; +} + +.settings .btn a{ + margin-top: 0; + margin-bottom: 0; + background-color: #37a8db; + border-radius: 3px; + border: 1px solid #3394b5; + color: #fff; + font-family: 'open_sansbold', Arial, serif; + font-size: 12px; + text-shadow: 0 1px rgba(0, 0, 0, 0.25); + cursor: pointer; + transition: all ease 0.2s; + padding: 0 9px; + line-height: 22px; +} + +.settings .btn a:hover { + background-color: #3394b5; + transition: all ease 0.2s; } \ No newline at end of file diff --git a/tabs/osd.html b/tabs/osd.html index 57970cda..e9537bd5 100644 --- a/tabs/osd.html +++ b/tabs/osd.html @@ -10,6 +10,12 @@
+ + + + + +
diff --git a/tabs/osd.js b/tabs/osd.js index 3675f9bb..7f09fa36 100644 --- a/tabs/osd.js +++ b/tabs/osd.js @@ -138,6 +138,8 @@ var video_type = null; var isGuidesChecked = false; var FONT = FONT || {}; +var layout_clipboard = {layout: [], filled: false}; + var FONT = FONT || {}; FONT.initData = function () { if (FONT.data) { @@ -3106,6 +3108,8 @@ OSD.GUI.updateAll = function() { return; } var layouts = $('.osd_layouts'); + var copy = $('.osd_copy'); + var paste = $('.osd_paste').hide(); if (OSD.data.layout_count > 1) { layouts.empty(); for (var ii = 0; ii < OSD.data.layout_count; ii++) { @@ -3121,9 +3125,40 @@ OSD.GUI.updateAll = function() { OSD.GUI.updateDjiView($('#djiUnsupportedElements').find('input').is(':checked')); OSD.GUI.updatePreviews(); }); + + copy.on('click', function() { + if(OSD.data.selected_layout >= 0 && OSD.data.selected_layout < OSD.data.layout_count){ + layout_clipboard = {layout: JSON.parse(JSON.stringify(OSD.data.layouts[OSD.data.selected_layout])), filled: true}; + paste.show(); + GUI.log(chrome.i18n.getMessage('osdLayoutInsertedIntoClipboard')); + } + }); + + paste.on('click', function() { + if(layout_clipboard.filled == true){ + + var oldLayout = JSON.parse(JSON.stringify(OSD.data.layouts[OSD.data.selected_layout])) + OSD.data.layouts[OSD.data.selected_layout] = JSON.parse(JSON.stringify(layout_clipboard.layout)); + layouts.trigger('change'); + OSD.data.layouts[OSD.data.selected_layout].forEach(function(item, index){ + if(!(item.isVisible === false && oldLayout[index].isVisible === false) && (oldLayout[index].x !== item.x || oldLayout[index].y !== item.y || oldLayout[index].position !== item.position || oldLayout[index].isVisible !== item.isVisible)){ + OSD.saveItem({id: index}); + } + }); + GUI.log(chrome.i18n.getMessage('osdLayoutPasteFromClipboard')); + } + }); + + } else { layouts.hide(); layouts.off('change'); + + copy.hide(); + copy.off('change'); + + paste.hide(); + paste.off('change'); } $('.osd_search').on('input', function() {