Commit b8d87b8c authored by Prakhar Agarwal's avatar Prakhar Agarwal 🎯
Browse files

fixed merge conflicts

parents d42fdd43 c6831368
<div id="patch" class="patch"> <div id="patch" class="patch">
<h6 class="text-center patch-filename" id="patch-filename"></h6> <div class="d-flex justify-content-between align-items-center">
<h6 class="patch-filename" id="patch-filename" style="margin-right: auto; margin-left: auto;"></h6>
<button id="close-canvas" type="button" class="close" aria-label="Close">
<span class="p-2" aria-hidden="true">&times;</span>
</button>
</div>
<div class="rounded"> <div class="rounded">
<!-- Patch menu --> <!-- Patch menu -->
<ul class="patch-menu" id="patch-menu"> <ul class="patch-menu" id="patch-menu">
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<label> <label>
<li id="file-open"> <li id="file-open">
</li> </li>
<input id="uploadPatch" type="file" onchange="pdbundle.pdgui.upload_patch(this.files)" multiple> <input id="uploadPatch" type="file" accept=".pd" onchange="pdbundle.pdgui.upload_patch(this.files)" multiple>
</label> </label>
<!-- Recent Files submenu --> <!-- Recent Files submenu -->
...@@ -33,14 +33,6 @@ ...@@ -33,14 +33,6 @@
</ul> </ul>
</li> </li>
<!-- View Section -->
<li id="menu-view">
<ul class="rounded shadow">
<li id="view-fullscreen"></li>
</ul>
</li>
<!-- Media section --> <!-- Media section -->
<li id="menu-media"> <li id="menu-media">
<ul class="rounded shadow"> <ul class="rounded shadow">
......
...@@ -107,15 +107,6 @@ function menu_options(type, w, cid) { ...@@ -107,15 +107,6 @@ function menu_options(type, w, cid) {
onclick: function () { menu_section_click("menu-view" + cid) }, onclick: function () { menu_section_click("menu-view" + cid) },
onmousemove: function () { menu_section_move("menu-view" + cid) } onmousemove: function () { menu_section_move("menu-view" + cid) }
} }
},
// View entries
"view-fullscreen": {
label: l("menu.fullscreen"),
key: pdbundle.shortcuts.menu.fullscreen_web.key,
modifiers: pdbundle.shortcuts.menu.fullscreen_web.modifiers,
tooltip: l("menu.fullscreen_tt"),
top_hr: {}
} }
} }
...@@ -185,10 +176,6 @@ function menu_options(type, w, cid) { ...@@ -185,10 +176,6 @@ function menu_options(type, w, cid) {
modifiers: pdbundle.shortcuts.menu.preferences_web.modifiers, modifiers: pdbundle.shortcuts.menu.preferences_web.modifiers,
tooltip: l("menu.preferences_tt") tooltip: l("menu.preferences_tt")
}, },
// View
...view_base,
// Media section // Media section
"menu-media": { "menu-media": {
label: l("menu.media"), label: l("menu.media"),
...@@ -417,6 +404,8 @@ function menu_options(type, w, cid) { ...@@ -417,6 +404,8 @@ function menu_options(type, w, cid) {
}, },
// View section // View section
...view_base,
// View entries
"view-zoomreset": { "view-zoomreset": {
label: l("menu.zoomreset"), label: l("menu.zoomreset"),
key: pdbundle.shortcuts.menu.zoomreset_web.key, key: pdbundle.shortcuts.menu.zoomreset_web.key,
...@@ -436,9 +425,13 @@ function menu_options(type, w, cid) { ...@@ -436,9 +425,13 @@ function menu_options(type, w, cid) {
modifiers: pdbundle.shortcuts.menu.zoomout_web.modifiers, modifiers: pdbundle.shortcuts.menu.zoomout_web.modifiers,
tooltip: l("menu.zoomout_tt") tooltip: l("menu.zoomout_tt")
}, },
...view_base, "view-fullscreen": {
label: l("menu.fullscreen"),
// View entries key: pdbundle.shortcuts.menu.fullscreen_web.key,
modifiers: pdbundle.shortcuts.menu.fullscreen_web.modifiers,
tooltip: l("menu.fullscreen_tt"),
top_hr: {}
},
"view-optimalzoom": { "view-optimalzoom": {
label: l("menu.zoomoptimal"), label: l("menu.zoomoptimal"),
key: pdbundle.shortcuts.menu.zoomoptimal_web.key, key: pdbundle.shortcuts.menu.zoomoptimal_web.key,
...@@ -680,7 +673,8 @@ window.modifiers = function (menu_item, modifiers) { ...@@ -680,7 +673,8 @@ window.modifiers = function (menu_item, modifiers) {
} }
window.tooltip = function (menu_item, tooltip) { window.tooltip = function (menu_item, tooltip) {
// console.log("NEED TO IMPLEMENT TOOLTIP", tooltip); menu_item.setAttribute("data-toggle", "tooltip");
menu_item.setAttribute("title", tooltip);
} }
window.recent_files = function (elem) { window.recent_files = function (elem) {
......
...@@ -68,6 +68,23 @@ ...@@ -68,6 +68,23 @@
color: #007BFF; color: #007BFF;
} }
#file-icons {
display: none;
}
#list-item:hover > div {
display: flex;
display: inline-block;
}
#list-item > li {
max-width: 150px;
}
#list-item:hover > li {
max-width: 75px;
}
#content { #content {
position: relative; position: relative;
} }
...@@ -293,8 +310,10 @@ li .hr{ ...@@ -293,8 +310,10 @@ li .hr{
} }
.patch-filename{ .patch-filename{
margin-top: 10px; margin: 0;
margin-bottom: 5px; padding-top: 10px;
padding-bottom: 5px;
cursor: move;
} }
#div-svg-p{ #div-svg-p{
...@@ -326,6 +345,13 @@ li .hr{ ...@@ -326,6 +345,13 @@ li .hr{
::-webkit-scrollbar-corner { ::-webkit-scrollbar-corner {
background-color: transparent; background-color: transparent;
} }
*[unselectable="on"] {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Bootstrap */ /* Bootstrap */
.container-fluid{ .container-fluid{
...@@ -356,3 +382,4 @@ li .hr{ ...@@ -356,3 +382,4 @@ li .hr{
cursor: pointer; cursor: pointer;
transition: transform 1s linear; transition: transform 1s linear;
} }
...@@ -30,6 +30,32 @@ ...@@ -30,6 +30,32 @@
</div> </div>
</div> </div>
<!-- Modal -->
<div class="modal fade" id="message-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">New message</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="message-text" class="col-form-label">Message:</label>
<textarea class="form-control" id="message-text"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" id="send-message-btn" class="btn btn-primary" onclick="pdbundle.pdgui.web_menu_send()">Send message</button>
</div>
</div>
</div>
</div>
<div id="container-app" class="container-fluid"> <div id="container-app" class="container-fluid">
<!-- Menu --> <!-- Menu -->
<nav id="menu"></nav> <nav id="menu"></nav>
...@@ -100,6 +126,8 @@ ...@@ -100,6 +126,8 @@
<div class="console-find-webapp" id="console_find" style="display: none;"> <div class="console-find-webapp" id="console_find" style="display: none;">
<div class="d-flex justify-content-end align-items-center"> <div class="d-flex justify-content-end align-items-center">
<i class="fa fa-long-arrow-up text-primary" id="find_above" style="cursor: pointer;"></i>
<i class="fa fa-long-arrow-down text-primary" id="find_below" style="cursor: pointer;"></i>
<label><input type="text" id="console_find_text" name="console_find_text" defaultValue="Search in Console" style="width: 15em;" placeholder="Search in Console" /> </label> <label><input type="text" id="console_find_text" name="console_find_text" defaultValue="Search in Console" style="width: 15em;" placeholder="Search in Console" /> </label>
<label class="highlight-find d-flex align-items-center"> <label class="highlight-find d-flex align-items-center">
Highlight All Highlight All
...@@ -107,8 +135,10 @@ ...@@ -107,8 +135,10 @@
</label> </label>
</div> </div>
</div> </div>
<div>
<i class='fa fa-trash ml-3 text-primary' style='cursor:pointer' id='clear' data-toggle="tooltip" title="Clear Console"></i> <i class="fa fa-clone text-primary" id="cons_copy" unselectable="on" style="cursor: pointer;" data-toggle="tooltip" title="Copy Console"></i>
<i class='fa fa-trash ml-3 text-primary' style='cursor:pointer' id='clear' data-toggle="tooltip" title="Clear Console"></i>
</div>
</div> </div>
<div class="collapse show" id="console_bottom"> <div class="collapse show" id="console_bottom">
...@@ -518,11 +548,11 @@ ...@@ -518,11 +548,11 @@
// Add pd module to pd // Add pd module to pd
//Clear Console // Clear Console
document.getElementById("clear").addEventListener("click",()=>{ document.getElementById("clear").addEventListener("click", function() {
document.getElementById('p1').innerHTML=''; document.getElementById("p1").innerHTML="";
});
})
</script> </script>
<!-- Pd Bundle --> <!-- Pd Bundle -->
...@@ -585,5 +615,18 @@ ...@@ -585,5 +615,18 @@
}); });
</script> </script>
<script>
$(document).ready(function(){
// Rearrangable patches
$("#canvas-container").sortable({
axis: "x",
cursor: "move",
handle: ".patch-filename",
scroll: false,
revert: true,
});
});
</script>
</body> </body>
</html> </html>
...@@ -52,6 +52,38 @@ function load_menu_actions(){ ...@@ -52,6 +52,38 @@ function load_menu_actions(){
} }
}); });
minit("cons_copy", {
onclick: function() {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
text = document.selection.createRange().text;
}
if (text.length === 0) {
var container_id = "p1", range;
// This should work across browsers
if (window.document.selection) {
range = window.document.body.createTextRange();
range.moveToElementText(window.document.getElementById(container_id));
range.select();
} else if (window.getSelection) {
range = window.document.createRange();
range.selectNode(window.document.getElementById(container_id));
// we need to empty the current selection to avoid a strange
// error when trying to select all right after Pd starts:
// "The given range and the current selection belong to two
// different document fragments."
// (I guess nw.js somehow starts up with the selection being
// somewhere outside the window...)
window.getSelection().empty();
window.getSelection().addRange(range);
}
}
window.document.execCommand("copy");
}
});
minit("edit-find", { minit("edit-find", {
onclick: function() { onclick: function() {
var find_bar = window.document.getElementById("console_find"), var find_bar = window.document.getElementById("console_find"),
...@@ -91,6 +123,18 @@ function load_menu_actions(){ ...@@ -91,6 +123,18 @@ function load_menu_actions(){
} }
}); });
minit("find_below", {
onclick: function() {
console_find_below()
}
});
minit("find_above", {
onclick: function() {
console_find_above()
}
});
// View entries // View entries
minit("view-fullscreen",{onclick: minit("view-fullscreen",{onclick:
...@@ -128,7 +172,7 @@ function load_menu_actions(){ ...@@ -128,7 +172,7 @@ function load_menu_actions(){
// Help entries // Help entries
minit("help-about", {onclick: minit("help-about", {onclick:
function(){ function(){
pdbundle.pdgui.web_pd_doc_open("doc/about", "about.pd") pdbundle.pdgui.web_external_doc_open("https://agraef.github.io/purr-data-intro/Purr-Data-Intro.html")
} }
}); });
...@@ -176,6 +220,7 @@ function add_shortcuts(cid){ ...@@ -176,6 +220,7 @@ function add_shortcuts(cid){
document.onkeydown = function (e){ document.onkeydown = function (e){
// Check modifiers // Check modifiers
var shortcut = e.ctrlKey ? "Ctrl+": ""; var shortcut = e.ctrlKey ? "Ctrl+": "";
shortcut += e.metaKey ? "Cmd+": "";
shortcut += e.shiftKey ? "Shift+": ""; shortcut += e.shiftKey ? "Shift+": "";
shortcut += e.altKey ? "Alt+": ""; shortcut += e.altKey ? "Alt+": "";
// Add key // Add key
......
...@@ -60,7 +60,7 @@ function console_find_callback() { ...@@ -60,7 +60,7 @@ function console_find_callback() {
var highlight_checkbox = document.getElementById("console_find_highlight"); var highlight_checkbox = document.getElementById("console_find_highlight");
console_find_highlight_all(highlight_checkbox); console_find_highlight_all(highlight_checkbox);
console_find_traverse.set_index(0); console_find_traverse.set_index(0);
console_find_traverse.next(); console_find_traverse.set_first_match();
} }
function console_find_keypress(e) { function console_find_keypress(e) {
...@@ -99,6 +99,12 @@ var console_find_traverse = (function () { ...@@ -99,6 +99,12 @@ var console_find_traverse = (function () {
next: function () { next: function () {
var i, last, next, var i, last, next,
elements = console_text.getElementsByTagName(wrap_tag); elements = console_text.getElementsByTagName(wrap_tag);
count++;
if (count >= elements.length) {
count = 0;
} else if (count < 0) {
count = elements.length - 1;
}
if (elements.length > 0) { if (elements.length > 0) {
i = count % elements.length; i = count % elements.length;
elements[i].classList.add("console_find_current"); elements[i].classList.add("console_find_current");
...@@ -110,18 +116,58 @@ var console_find_traverse = (function () { ...@@ -110,18 +116,58 @@ var console_find_traverse = (function () {
} }
// adjust the scrollbar to make sure the element is visible, // adjust the scrollbar to make sure the element is visible,
// but only if necessary. // but only if necessary.
// I don't think this is available on all browsers...
var isFirefox = typeof InstallTrigger !== 'undefined'; // checks if browser is Firefox or not var isFirefox = typeof InstallTrigger !== 'undefined'; // checks if browser is Firefox or not
if (isFirefox) { if (isFirefox) {
elements[i].scrollIntoView(); elements[i].scrollIntoView();
} else { } else {
elements[i].scrollIntoViewIfNeeded(); elements[i].scrollIntoViewIfNeeded();
} }
count++; }
},
previous: function () {
var i, last, prev,
elements = console_text.getElementsByTagName(wrap_tag);
count--;
if (count >= elements.length) {
count = 0;
} else if (count < 0) {
count = elements.length - 1;
}
if (elements.length > 0) {
i = count % elements.length;
elements[i].classList.add("console_find_current");
if (elements.length > 1) {
last = i === elements.length - 1 ? 0 : i + 1;
prev = (i - 1 + elements.length) % elements.length;
elements[last].classList.remove("console_find_current");
elements[prev].classList.remove("console_find_current");
}
// adjust the scrollbar to make sure the element is visible,
// but only if necessary.
var isFirefox = typeof InstallTrigger !== 'undefined'; // checks if browser is Firefox or not
if (isFirefox) {
elements[i].scrollIntoView();
} else {
elements[i].scrollIntoViewIfNeeded();
}
} }
}, },
set_index: function(c) { set_index: function(c) {
count = c; count = c;
},
set_first_match: function() {
var elements = console_text.getElementsByTagName(wrap_tag);
if (elements.length > 0) {
elements[0].classList.add("console_find_current");
}
// adjust the scrollbar to make sure the element is visible,
// but only if necessary.
var isFirefox = typeof InstallTrigger !== 'undefined'; // checks ifbrowser is Firefox or not
if (isFirefox) {
elements[0].scrollIntoView();
} else {
elements[0].scrollIntoViewIfNeeded();
}
} }
}; };
}()); }());
...@@ -140,3 +186,11 @@ function console_find_keydown(evt) { ...@@ -140,3 +186,11 @@ function console_find_keydown(evt) {
} }
} }
function console_find_below() {
console_find_traverse.next();
}
function console_find_above() {
console_find_traverse.previous();
}
...@@ -78,6 +78,7 @@ mark { ...@@ -78,6 +78,7 @@ mark {
mark.console_find_current.console_find_highlighted, mark.console_find_current.console_find_highlighted,
mark.console_find_current { mark.console_find_current {
background: yellow !important; background: yellow !important;
padding: 0;
} }
mark.console_find_highlighted { mark.console_find_highlighted {
......
...@@ -182,6 +182,7 @@ mark { ...@@ -182,6 +182,7 @@ mark {
mark.console_find_current.console_find_highlighted, mark.console_find_current.console_find_highlighted,
mark.console_find_current { mark.console_find_current {
background: yellow !important; background: yellow !important;
padding: 0;
} }
mark.console_find_highlighted { mark.console_find_highlighted {
......
...@@ -72,6 +72,7 @@ mark { ...@@ -72,6 +72,7 @@ mark {
mark.console_find_current.console_find_highlighted, mark.console_find_current.console_find_highlighted,
mark.console_find_current { mark.console_find_current {
background: yellow !important; background: yellow !important;
padding: 0;
} }
mark.console_find_highlighted { mark.console_find_highlighted {
......
...@@ -189,6 +189,7 @@ mark { ...@@ -189,6 +189,7 @@ mark {
mark.console_find_current.console_find_highlighted, mark.console_find_current.console_find_highlighted,
mark.console_find_current { mark.console_find_current {
background: yellow !important; background: yellow !important;
padding: 0;
} }
mark.console_find_highlighted { mark.console_find_highlighted {
......
...@@ -79,6 +79,7 @@ mark { ...@@ -79,6 +79,7 @@ mark {
mark.console_find_current.console_find_highlighted, mark.console_find_current.console_find_highlighted,
mark.console_find_current { mark.console_find_current {
background: yellow !important; background: yellow !important;
padding: 0;
} }
mark.console_find_highlighted { mark.console_find_highlighted {
......
...@@ -80,6 +80,7 @@ mark { ...@@ -80,6 +80,7 @@ mark {
mark.console_find_current.console_find_highlighted, mark.console_find_current.console_find_highlighted,
mark.console_find_current {