Skip to content
Snippets Groups Projects
Commit 0a8dfe69 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

Merge branch 'aggraef/purr-data-help_browser'

parents 900a918d de3d2438
No related branches found
No related tags found
No related merge requests found
......@@ -28,11 +28,19 @@ index.setRef("id");
var filetypes = [".pd", ".txt", ".htm", ".html", ".pdf"];
// Table of Contents to start with
/* NOTE: A section title is indicated by an entry consisting just of the title
field. All other entries *must* also contain the directory (relative to the
pd-l2ork lib directory) in the id field, and may optionally contain a
description field. */
var toc = [
// Original Pd documentation
{
title: "Pure Data",
},
{
id: "doc/1.manual",
title: "Pd Manual",
description: "detailed description of the program's behavior and user interface"
description: "HTML manual for Pure Data"
},
{
id: "doc/2.control.examples",
......@@ -45,10 +53,100 @@ var toc = [
description: "objects and concepts related to producing audio in realtime"
},
{
id: "doc/4.data.structures/pd-l2ork/ds-tutorials",
id: "doc/4.data.structures",
title: "Data Structures",
description: "custom data manipulation and interactive graphics"
}
},
{
id: "doc/5.reference",
title: "Reference",
description: "reference patches for key concepts and built-in objects"
},
{
id: "doc/6.externs",
title: "Externals",
description: "how to code control and signal objects in C"
},
/* // Section 7 of the vanilla Pd docs, uncomment these if needed.
{
title: "Stuff",
},
{
id: "doc/7.stuff/soundfile-tools",
title: "Soundfile Tools",
description: "some standard audio transformations packaged to work with mono soundfiles"
},
{
id: "doc/7.stuff/synth",
title: "Synth",
description: "polyphonic subtractive synthesizer example"
},
{
id: "doc/7.stuff/tools",
title: "Tools",
description: "useful little helper patches"
},
*/
// Pd-L2Ork extras
{
title: "Pd-L2Ork",
},
{
id: "doc/4.data.structures/pd-l2ork/ds-tutorials",
title: "Data Structure Tutorials",
description: "overview of svg-based data structure drawing commands"
},
{
id: "extra/disis",
title: "DISIS",
description: "DISIS externals (wiimote et al)"
},
// PDDP tutorials
{
title: "PDDP Tutorials",
},
{
id: "doc/manuals/0.Intro",
title: "Intro",
description: "getting started with Pd"
},
{
id: "doc/manuals/1.Sound",
title: "Sound",
description: "Pd sound examples"
},
{
id: "doc/manuals/2.Image",
title: "Image",
description: "3D graphics with GEM"
},
{
id: "doc/manuals/3.Networking",
title: "Networking",
description: "introduction to Pd's networking facilities"
},
// External libraries
// NOTE: These are just some popular examples. Pd-L2Ork ships with
// many external libraries, too many to list them all. Feel free
// to edit this list as needed.
{
title: "Externals",
},
{
id: "extra/cyclone",
title: "Cyclone",
description: "library of clones of Max/MSP 4.x objects"
},
{
id: "extra/Gem",
title: "GEM",
description: "Graphics Environment for Multimedia (OpenGL graphics in Pd)"
},
{
id: "extra/lyon",
title: "LyonPotpourri",
description: "Eric Lyon's external collection"
},
];
// Stop-gap translator
......@@ -127,16 +225,26 @@ function display_toc() {
text_node;
toc.forEach(function(doc, i, a) {
div = document.createElement("div");
a = document.createElement("a");
a.href = "javascript: click_toc('" + doc.id + "');";
a.textContent = doc.title;
// set title to path for tooltip
a.title = doc.id;
header = document.createElement("h3");
header.appendChild(a);
text_node = document.createTextNode(doc.description);
div.appendChild(header);
div.appendChild(text_node);
if (doc.id) {
a = document.createElement("a");
a.href = "javascript: click_toc('" + doc.id + "');";
a.textContent = doc.title;
// set title to path for tooltip
a.title = doc.id;
header = document.createElement("h3");
header.appendChild(a);
div.appendChild(header);
if (doc.description) {
text_node = document.createTextNode(doc.description);
div.appendChild(text_node);
}
} else {
// make a session title
header = document.createElement("h2");
text_node = document.createTextNode(doc.title);
header.appendChild(text_node);
div.appendChild(header);
}
results_elem.appendChild(div);
});
}
......@@ -169,7 +277,7 @@ function display_directory_callback(err, files) {
doc_path = path.join(current_dir, f);
doc = index.documentStore.getDoc(doc_path) || {
id: doc_path,
title: f,
title: path.basename(f, ".pd"),
description: null
};
display_doc(doc);
......@@ -190,9 +298,9 @@ function file_browser_click() {
function file_browser_callback(elem) {
var doc = elem.value;
pdgui.post("file callback: file is " + elem.value);
pdgui.post("dir is " + pdgui.defunkify_windows_path(path.dirname(doc)));
pdgui.post("file is " + pdgui.defunkify_windows_path(path.basename(doc)));
//pdgui.post("file callback: file is " + elem.value);
//pdgui.post("dir is " + pdgui.defunkify_windows_path(path.dirname(doc)));
//pdgui.post("file is " + pdgui.defunkify_windows_path(path.basename(doc)));
pdgui.doc_open(pdgui.defunkify_windows_path(path.dirname(doc)),
pdgui.defunkify_windows_path(path.basename(doc)));
display_directory(pdgui.defunkify_windows_path(path.dirname(doc)));
......@@ -414,7 +522,7 @@ function register_window_id(id, attrs) {
add_events();
// set file types for the file dialog
document.getElementById("file_browser").accept = filetypes.join(",");
document.getElementById("results").textContent = "Building Index...";
document.getElementById("results").textContent = "Building index...";
document.getElementById("search_text").disabled = true;
document.getElementById("file_browser").setAttribute("nwworkingdir",
pdgui.get_gui_dir() + "/doc"); // Probably need a doc getter in pdgui
......@@ -422,7 +530,7 @@ function register_window_id(id, attrs) {
}
function display_no_results() {
document.getElementById("results").textContent = "No Results Found.";
document.getElementById("results").textContent = "No results found.";
}
function display_doc(doc) {
......@@ -439,9 +547,11 @@ function display_doc(doc) {
a.title = doc.id;
header = document.createElement("h3");
header.appendChild(a);
text_node = document.createTextNode(doc.description);
div.appendChild(header);
div.appendChild(text_node);
if (doc.description) {
text_node = document.createTextNode(doc.description);
div.appendChild(text_node);
}
results_elem.appendChild(div);
}
......@@ -451,9 +561,16 @@ function doc_search() {
results,
doc,
i;
// if the search term is doc/* short circuit the search and
// just list the docs in that directory
if (search_text.slice(0, 4) === "doc/" &&
// if the search term is empty then just redisplay the toc
if (!search_text) {
clear_results();
display_toc();
return;
}
// if the search term is doc/* or extra/* then short circuit
// the search and just list the docs in that directory
if ((search_text.slice(0, 4) === "doc/" ||
search_text.slice(0, 6) === "extra/") &&
search_text.indexOf(" ") === -1) {
display_directory(path.join(pdgui.get_lib_dir(), search_text));
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment