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

fixed merge conflicts

parents 099fd739 c6831368
<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">
<!-- Patch menu -->
<ul class="patch-menu" id="patch-menu">
......
......@@ -8,7 +8,7 @@
<label>
<li id="file-open">
</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>
<!-- Recent Files submenu -->
......@@ -33,14 +33,6 @@
</ul>
</li>
<!-- View Section -->
<li id="menu-view">
<ul class="rounded shadow">
<li id="view-fullscreen"></li>
</ul>
</li>
<!-- Media section -->
<li id="menu-media">
<ul class="rounded shadow">
......
......@@ -107,15 +107,6 @@ function menu_options(type, w, cid) {
onclick: function () { menu_section_click("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) {
modifiers: pdbundle.shortcuts.menu.preferences_web.modifiers,
tooltip: l("menu.preferences_tt")
},
// View
...view_base,
// Media section
"menu-media": {
label: l("menu.media"),
......@@ -417,6 +404,8 @@ function menu_options(type, w, cid) {
},
// View section
...view_base,
// View entries
"view-zoomreset": {
label: l("menu.zoomreset"),
key: pdbundle.shortcuts.menu.zoomreset_web.key,
......@@ -436,9 +425,13 @@ function menu_options(type, w, cid) {
modifiers: pdbundle.shortcuts.menu.zoomout_web.modifiers,
tooltip: l("menu.zoomout_tt")
},
...view_base,
// 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: {}
},
"view-optimalzoom": {
label: l("menu.zoomoptimal"),
key: pdbundle.shortcuts.menu.zoomoptimal_web.key,
......@@ -680,7 +673,8 @@ window.modifiers = function (menu_item, modifiers) {
}
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) {
......
......@@ -68,6 +68,23 @@
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 {
position: relative;
}
......@@ -293,8 +310,10 @@ li .hr{
}
.patch-filename{
margin-top: 10px;
margin-bottom: 5px;
margin: 0;
padding-top: 10px;
padding-bottom: 5px;
cursor: move;
}
#div-svg-p{
......@@ -306,6 +325,14 @@ li .hr{
overflow: auto;
}
*[unselectable="on"] {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* Bootstrap */
.container-fluid{
background-color: transparent;
......@@ -335,3 +362,4 @@ li .hr{
cursor: pointer;
transition: transform 1s linear;
}
......@@ -31,6 +31,7 @@
</div>
<!-- Modal -->
<<<<<<< HEAD
<div class="modal fade" id="dialog-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
......@@ -45,6 +46,32 @@
</div>
</div>
</div>
=======
<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>
>>>>>>> emscripten
<div id="container-app" class="container-fluid">
<!-- Menu -->
......@@ -116,6 +143,8 @@
<div class="console-find-webapp" id="console_find" style="display: none;">
<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 class="highlight-find d-flex align-items-center">
Highlight All
......@@ -123,8 +152,10 @@
</label>
</div>
</div>
<i class='fa fa-trash ml-3 text-primary' style='cursor:pointer' id='clear' data-toggle="tooltip" title="Clear Console"></i>
<div>
<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 class="collapse show" id="console_bottom">
......@@ -534,11 +565,11 @@
// Add pd module to pd
//Clear Console
document.getElementById("clear").addEventListener("click",()=>{
document.getElementById('p1').innerHTML='';
})
// Clear Console
document.getElementById("clear").addEventListener("click", function() {
document.getElementById("p1").innerHTML="";
});
</script>
<!-- Pd Bundle -->
......@@ -601,5 +632,18 @@
});
</script>
<script>
$(document).ready(function(){
// Rearrangable patches
$("#canvas-container").sortable({
axis: "x",
cursor: "move",
handle: ".patch-filename",
scroll: false,
revert: true,
});
});
</script>
</body>
</html>
......@@ -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", {
onclick: function() {
var find_bar = window.document.getElementById("console_find"),
......@@ -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
minit("view-fullscreen",{onclick:
......@@ -128,7 +172,7 @@ function load_menu_actions(){
// Help entries
minit("help-about", {onclick:
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){
document.onkeydown = function (e){
// Check modifiers
var shortcut = e.ctrlKey ? "Ctrl+": "";
shortcut += e.metaKey ? "Cmd+": "";
shortcut += e.shiftKey ? "Shift+": "";
shortcut += e.altKey ? "Alt+": "";
// Add key
......
......@@ -60,7 +60,7 @@ function console_find_callback() {
var highlight_checkbox = document.getElementById("console_find_highlight");
console_find_highlight_all(highlight_checkbox);
console_find_traverse.set_index(0);
console_find_traverse.next();
console_find_traverse.set_first_match();
}
function console_find_keypress(e) {
......@@ -99,6 +99,12 @@ var console_find_traverse = (function () {
next: function () {
var i, last, next,
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");
......@@ -110,18 +116,58 @@ var console_find_traverse = (function () {
}
// adjust the scrollbar to make sure the element is visible,
// 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
if (isFirefox) {
elements[i].scrollIntoView();
} else {
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) {
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) {
}
}
function console_find_below() {
console_find_traverse.next();
}
function console_find_above() {
console_find_traverse.previous();
}
......@@ -78,6 +78,7 @@ mark {
mark.console_find_current.console_find_highlighted,
mark.console_find_current {
background: yellow !important;
padding: 0;
}
mark.console_find_highlighted {
......
......@@ -182,6 +182,7 @@ mark {
mark.console_find_current.console_find_highlighted,
mark.console_find_current {
background: yellow !important;
padding: 0;
}
mark.console_find_highlighted {
......
......@@ -72,6 +72,7 @@ mark {
mark.console_find_current.console_find_highlighted,
mark.console_find_current {
background: yellow !important;
padding: 0;
}
mark.console_find_highlighted {
......
......@@ -189,6 +189,7 @@ mark {
mark.console_find_current.console_find_highlighted,
mark.console_find_current {
background: yellow !important;
padding: 0;
}
mark.console_find_highlighted {
......
......@@ -79,6 +79,7 @@ mark {
mark.console_find_current.console_find_highlighted,
mark.console_find_current {
background: yellow !important;
padding: 0;
}
mark.console_find_highlighted {
......
......@@ -80,6 +80,7 @@ mark {
mark.console_find_current.console_find_highlighted,
mark.console_find_current {
background: #b58900 !important;
padding: 0;
}
mark.console_find_highlighted {
......
......@@ -80,6 +80,7 @@ mark {
mark.console_find_current.console_find_highlighted,
mark.console_find_current {
background: #b58900 !important;
padding: 0;
}
mark.console_find_highlighted {
......
......@@ -78,6 +78,7 @@ mark {
mark.console_find_current.console_find_highlighted,
mark.console_find_current {
background: yellow !important;
padding: 0;
}
mark.console_find_highlighted {
......
......@@ -78,6 +78,7 @@ mark {
mark.console_find_current.console_find_highlighted,
mark.console_find_current {
background: yellow !important;
padding: 0;
}
mark.console_find_highlighted {
......
......@@ -72,6 +72,7 @@ mark {
mark.console_find_current.console_find_highlighted,
mark.console_find_current {
background: yellow !important;
padding: 0;
}
mark.console_find_highlighted {
......
......@@ -78,6 +78,7 @@ mark {
mark.console_find_current.console_find_highlighted,
mark.console_find_current {
background: yellow !important;
padding: 0;
}
mark.console_find_highlighted {
......
......@@ -2149,6 +2149,9 @@ function load_canvas_menu_actions(name, filename){
minit("file-close"+name, {
onclick: function() { pdgui.menu_close(name); }
});
minit("close-canvas"+name, {
onclick: function() { pdgui.menu_close(name); }
});
// Edit entries
......
......@@ -71,30 +71,30 @@ exports.menu = {
// Webapp shortcuts
"new_web": { key: "N", modifiers: cmd_or_ctrl + "+Alt"},
"open_web": { key: "O", modifiers: cmd_or_ctrl + "+Alt"},
"save_web": { key: "S", modifiers: cmd_or_ctrl + "+Alt" },
"new_web": { key: "N", modifiers: cmd_or_ctrl },
"open_web": { key: "O", modifiers: cmd_or_ctrl },
"save_web": { key: "S", modifiers: cmd_or_ctrl },
"saveas_web": { key: "S", modifiers: cmd_or_ctrl + "+Shift" },
"print_web": { key: "P", modifiers: cmd_or_ctrl + "+Alt" },
"message_web" : { key: "M", modifiers: cmd_or_ctrl + "+Alt"},
"close_web": { key: "W", modifiers: cmd_or_ctrl + "+Alt" },
"print_web": { key: "P", modifiers: cmd_or_ctrl },
"message_web" : { key: "M", modifiers: cmd_or_ctrl },
"close_web": { key: "W", modifiers: cmd_or_ctrl },
"undo_web": { key: "Z", modifiers: cmd_or_ctrl + "+Alt" },
"redo_web": { key: "Z", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"undo_web": { key: "Z", modifiers: cmd_or_ctrl },
"redo_web": { key: "Z", modifiers: cmd_or_ctrl + "+Shift" },
"selectall_web":{ key: "Q", modifiers: cmd_or_ctrl + "+Shift"},
"cut_web": { key: "X", modifiers: cmd_or_ctrl + "+Shift" },
"copy_web": { key: "C", modifiers: cmd_or_ctrl + "+Alt"},
"paste_web": { key: "V", modifiers: cmd_or_ctrl + "+Alt" },
"paste_clipboard_web": { key: "G", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"duplicate_web": { key: "D", modifiers: cmd_or_ctrl + "+Alt" },
"reselect_web": { key: "Q", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"clear_console_web": { key: "L", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"tidyup_web": { key: "Y", modifiers: cmd_or_ctrl + "+Alt" },
"cordinspector_web": { key: "R", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"find_web": { key: "F", modifiers: cmd_or_ctrl + "+Alt"},
"findagain_web":{ key: "F", modifiers: cmd_or_ctrl + "+Shift+Alt"},
"editmode_web": { key: "E", modifiers: cmd_or_ctrl + "+Shift+Alt" },
"copy_web": { key: "C", modifiers: cmd_or_ctrl },
"paste_web": { key: "V", modifiers: cmd_or_ctrl },
"paste_clipboard_web": { key: "G", modifiers: cmd_or_ctrl + "+Shift" },
"duplicate_web": { key: "D", modifiers: cmd_or_ctrl },
"reselect_web": { key: "Q", modifiers: cmd_or_ctrl + "+Shift" },
"clear_console_web": { key: "L", modifiers: cmd_or_ctrl + "+Shift" },
"tidyup_web": { key: "Y", modifiers: cmd_or_ctrl },
"cordinspector_web": { key: "R", modifiers: cmd_or_ctrl + "+Shift" },
"find_web": { key: "F", modifiers: cmd_or_ctrl },
"findagain_web":{ key: "F", modifiers: cmd_or_ctrl + "+Shift"},
"editmode_web": { key: "E", modifiers: cmd_or_ctrl + "+Shift" },
"preferences_web": { key: (process.platform === "darwin") ? "," : "P",
modifiers: cmd_or_ctrl },
......@@ -102,34 +102,34 @@ exports.menu = {
"zoomout_web": { key: "-", modifiers: cmd_or_ctrl },
"zoomreset_web": { key: "0", modifiers: cmd_or_ctrl },
"zoomoptimal_web": { key: "9", modifiers: cmd_or_ctrl },
"zoomhoriz_web": { key: "9", modifiers: cmd_or_ctrl + "+Alt" },
"zoomhoriz_web": { key: "9", modifiers: cmd_or_ctrl },
"zoomvert_web": { key: "9", modifiers: cmd_or_ctrl + "+Shift" },
"fullscreen_web": { key: (process.platform === "darwin") ? "F" : "F11",
modifiers: (process.platform === "darwin") ? "Cmd+Ctrl" : null },
"object_web": { key: "1", modifiers: cmd_or_ctrl + "+Alt" },
"msgbox_web": { key: "2", modifiers: cmd_or_ctrl + "+Alt" },
"number_web": { key: "3", modifiers: cmd_or_ctrl + "+Alt" },
"symbol_web": { key: "4", modifiers: cmd_or_ctrl + "+Alt" },
"comment_web": { key: "5", modifiers: cmd_or_ctrl + "+Alt" },