Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
cfry committed Jun 30, 2021
1 parent 6117143 commit 2a6a558
Show file tree
Hide file tree
Showing 28 changed files with 1,178 additions and 434 deletions.
53 changes: 53 additions & 0 deletions HCA/HCA_doc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<details class="doc_details" id="hca_ui_doc_id"><summary>HCA User Interface</summary>
This interface to a graph editor for creating FPGA code is
quite preliminary and far from ready for productive work,
but shows one possible approach.
<p></p>
It reuses DDE user interface
elements for those opperations that are in common with
normal DDE editing.
When the HCA UI is brought up, it replaces the editor section of
DDE's editor pane with a graph editor.
<p></p>
The editor is only available via a secret incantation,
not accessible in released DDE.


<details class="doc_details"><summary>HCA editor keystrokes</summary>
<ul>
<li> <b>ctrl-a</b> select all nodes.</li>
<li> <b>ctrl-x</b> cut the selected nodes.</li>
<li> <b>ctrl-c</b> copy the selected nodes to the clipboard.</li>
<li> <b>ctrl-v</b> paste the selected nodes from the clipboard.</li>
</ul>
</details>

<details class="doc_details"><summary>DDE Menu items for HCA</summary>
<ul>
<li><b>File menu/New</b> Clears the canvas of all nodes and starts a "new buffer".</li>
<li><b>File menu/Open ...</b> Allows the user to select a file from the computer's file system
to edit.</li>
<li><b>File menu/Load ...</b> Allows the user to select a file to load, which creates
buttons of definitions of nodes. Clicking a button creates an instance
of that definition, populating the canvas with nodes.</li>
<li><b>File menu/Save</b> Saves the current file being edited (as a big JSON string).</li>
<li><b>File menu/Save as ...</b> Lets the user choose a file to save the currently
being edited nodes.</li>
<li><b>Edit menu/pretty print</b> arranges the nodes to be well spaced.</li>
</ul>
</details>

<details class="doc_details"><summary>Other DDE UI for HCA</summary>
<b>Files menu</b> (select of recently used files)
If you select a file without
valid HCA code, it errors but leaves the current canvas and fikes menu unchanged.
<p></p>
<b>Eval button</b>
<ul>
<li>If no selection, inspect the HCA class itself.</li>
<li>If one selected node, inspect it.</li>
<li>If more than one selected node, inspect an array of those selected nodes.</li>
</ul>

</details>
</details>
6 changes: 3 additions & 3 deletions HCA/HCA_objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ function MyAndNode() {
this.size = [80, 40] //width and height
this.properties = { precision: 1 };
}
MyAndNode.title = "and"; //name to show
MyAndNode.prototype.onExecute = function() {
var A = this.getInputData(0);
if( A === undefined )
Expand All @@ -21,6 +20,7 @@ MyAndNode.prototype.onExecute = function() {
B = 0;
this.setOutputData( 0, A & B );
}
MyAndNode.title = "and"; //name to show
LiteGraph.registerNodeType("basic/and", MyAndNode ); //register in the system
HCA.palette_objects.push(["basic/and"])

Expand All @@ -33,7 +33,6 @@ function MyOrNode() {
this.size = [80, 40] //width and height
this.properties = { precision: 1 };
}
MyOrNode.title = "or"; //name to show
MyOrNode.prototype.onExecute = function() {
var A = this.getInputData(0);
if( A === undefined )
Expand All @@ -43,6 +42,7 @@ MyOrNode.prototype.onExecute = function() {
B = 0;
this.setOutputData( 0, A | B );
}
MyOrNode.title = "or"; //name to show
LiteGraph.registerNodeType("basic/or", MyOrNode ); //register in the system
HCA.palette_objects.push(["basic/or"])

Expand All @@ -53,13 +53,13 @@ function MyInvertNode() {
this.size = [80, 20] //width and height
this.properties = { precision: 1 };
}
MyInvertNode.title = "invert"; //name to show
MyInvertNode.prototype.onExecute = function() {
var A = this.getInputData(0);
if( A === undefined )
A = 0;
let out = ((A === 1) ? 0 : 1)
this.setOutputData(0, out);
}
MyInvertNode.title = "invert"; //name to show
LiteGraph.registerNodeType("basic/invert", MyInvertNode); //register in the system
HCA.palette_objects.push(["basic/invert"])
31 changes: 30 additions & 1 deletion HCA/HCA_programmer_doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ <h4>Groups</h4>
function LGraphGroup(title)
new LiteGraph.LGraphGroup("mytitle") //make a group.
HCA.lgraph.add(new LiteGraph.LGraphGroup("mytit")) //add new group to grpah, it shows with title
you can drag the lower right cornder of the group rect to exand or contract it.
you can drag the lower right corner of the group rect to exand or contract it.
You can drop a node in a group, then drag teh group and it keeps the node in the group.
You can drag a node and drop it inside the group
</pre>
Expand Down Expand Up @@ -163,6 +163,7 @@ <h4>LGraphCanvas</h4>
LGraphCanvas.prototype.getCanvasMenuOptions = function()
LGraphCanvas.prototype.getNodeMenuOptions = function(node)//called by processContextMenu to extract the menu list
LGraphCanvas.prototype.getGroupMenuOptions = function(node)
subgraph_node.buildFromNodes( nodes_list )

right click menu:
function ContextMenu(values, //(allows object { title: "Nice text", callback: function ... })
Expand All @@ -176,6 +177,28 @@ <h4>LGraphCanvas</h4>
LGraphCanvas.prototype.canvas
Trying to get pop up menu on a node.

Node: onDblClick

Attribute for Node getExtraMenuOptions: //to add option to context menu
LGraphCanvas.prototype.processMouseDown calls this.processContextMenu(node, e);
for a e.which of 3.
var menu = new LiteGraph.ContextMenu(text_values, {
scale: Math.max(1, this.ds.scale),
event: event,
className: "dark",
callback: inner_clicked.bind(w)
},
ref_window);
var menu = new LiteGraph.ContextMenu(
entries,
{
event: e,
callback: inner_clicked,
parentMenu: prev_menu,
node: node
},
ref_window
);

//drawing a node.
LGraphCanvas.prototype.drawNode(node, ctx); c
Expand All @@ -198,6 +221,12 @@ <h4>LGraphCanvas</h4>
an array of 2 floats ie [234.4 125.6]
</pre>

Different link types:
STRAIGHT_LINK: 0,
LINEAR_LINK: 1,
SPLINE_LINK: 2,
LiteGraphCanavas this.links_render_mode = LiteGraph.SPLINE_LINK;

<h4>Questions</h4>
<pre>
You can write any feedback to javi.agenjo@gmail.com
Expand Down
Loading

0 comments on commit 2a6a558

Please sign in to comment.