Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/distribution/*
/resources/local.properties
.classpath
.project
/distribution/*
/resources/local.properties
.classpath
.project
/bin/*
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ It lets you snap blocks together to create snippets of code.

### About

<<<<<<< HEAD
The Processing Blocks Tool is currently in pre-alpha.
This is the source repository.
For more information check out the [BlocksTool website](http://bitcraftlab.github.com/Processing-Blocks-Tool/).
=======
The Processing Blocks Tool is currently in **pre-alpha**.
This is the source repository.
For more information check out the [BlocksTool website](http://bitcraftlab.github.com/Processing-Blocks-Tool/).
Developer info can be found inside the [wiki](https://github.com/bitcraftlab/Processing-Blocks-Tool/wiki).
>>>>>>> 5a61432abef787d0842e073efabefd9908ad6e6e

### License

Expand Down
Binary file added data/images/barcharticon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/color gradient 2.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/color gradient 3.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/color gradient.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/eye.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/globals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/histogramicon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/linecharticon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/patchvars.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/runtime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/scatterploticon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/shoulder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash0000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash0023.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash_animated/Thumbs.db
Binary file not shown.
Binary file added data/images/trash_animated/trash0000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash_animated/trash0001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash_animated/trash0002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash_animated/trash0003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash_animated/trash0004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash_animated/trash0005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash_animated/trash0006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash_animated/trash0007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash_animated/trash0008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/trash_animated/trash0009.png
Binary file added data/images/trash_animated/trash0010.png
Binary file added data/images/trash_animated/trash0011.png
Binary file added data/images/trash_animated/trash0012.png
Binary file added data/images/trash_animated/trash0013.png
Binary file added data/images/trash_animated/trash0014.png
Binary file added data/images/trash_animated/trash0015.png
Binary file added data/images/trash_animated/trash0016.png
Binary file added data/images/trash_animated/trash0017.png
Binary file added data/images/trash_animated/trash0018.png
Binary file added data/images/trash_animated/trash0019.png
Binary file added data/images/trash_animated/trash0020.png
Binary file added data/images/trash_animated/trash0021.png
Binary file added data/images/trash_animated/trash0022.png
Binary file added data/images/trash_animated/trash0023.png
Binary file added data/images/trash_animated/trash0024.png
Binary file added data/images/trash_animated/trash0025.png
Binary file added data/images/trash_animated/trash0026.png
Binary file added data/images/trash_animated/trash0027.png
Binary file added data/images/trash_animated/trash0028.png
Binary file added data/images/trash_animated/trash0029.png
Binary file added data/images/trash_animated/trash0030.png
Binary file added data/images/trash_animated/trash0031.png
Binary file added data/images/trash_animated/trash0032.png
Binary file added data/images/trash_animated/trash0033.png
Binary file added data/images/trash_animated/trash0034.png
Binary file added data/images/trash_animated/trash0035.png
Binary file added data/images/trash_animated/trash0036.png
Binary file added data/images/trash_animated/trash0037.png
Binary file added data/images/trash_animated/trash0038.png
Binary file added data/images/trash_animated/trash0039.png
Binary file added data/images/trash_animated/trash0040.png
Binary file added data/images/trash_animated/trash0041.png
Binary file added data/images/trash_animated/trash0042.png
Binary file added data/images/trash_animated/trash0043.png
Binary file added data/images/trash_animated/trash0044.png
Binary file added data/images/trash_animated/trash0045.png
Binary file added data/images/trash_animated/trash0046.png
Binary file added data/images/trash_open.png
Binary file added data/images/xyploticon.gif
163 changes: 163 additions & 0 deletions data/lang_def.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

<!--
Document : lang_def.dtd
Description:
This defines the language and initial workspace setup.
-->


<!ELEMENT BlockLangDef ( BlockConnectorShapes, BlockGenuses, BlockFamilies?, BlockDrawerSets?, Pages?, TrashCan?, MiniMap?)>

<!--This defines a mapping between block connector shape type to number-->
<!ELEMENT BlockConnectorShapes (BlockConnectorShape*)>
<!ELEMENT BlockConnectorShape EMPTY>
<!ATTLIST BlockConnectorShape shape-type CDATA #REQUIRED>
<!ATTLIST BlockConnectorShape shape-number CDATA #REQUIRED>

<!ELEMENT BlockGenuses (BlockGenus*)>
<!--This defines a single block genus-->
<!ELEMENT BlockGenus (description?, BlockConnectors?,Stubs?, Images?, LangSpecProperties?)>
<!ATTLIST BlockGenus name CDATA #REQUIRED>
<!ATTLIST BlockGenus initlabel CDATA #REQUIRED>
<!-- the kind of a genus can affect the rendering of a block. relevant kinds are:
- command: performs an operation and may take in more than one input
- data: returns primitive values such as number, string, boolean
- function: takes in an input and performs an operation to produce an ouput
-->
<!ATTLIST BlockGenus kind CDATA #REQUIRED>
<!ATTLIST BlockGenus color CDATA #REQUIRED>
<!ATTLIST BlockGenus editable-label (yes|no) "no">
<!ATTLIST BlockGenus label-unique (yes|no) "no">
<!ATTLIST BlockGenus is-label-value (yes|no) "no">
<!ATTLIST BlockGenus label-prefix CDATA #IMPLIED>
<!ATTLIST BlockGenus label-suffix CDATA #IMPLIED>
<!ATTLIST BlockGenus page-label-enabled (yes|no) "no">
<!--is-starter and is-terminator only apply to blocks of kind: command -->
<!ATTLIST BlockGenus is-starter (yes|no) "no">
<!ATTLIST BlockGenus is-terminator (yes|no) "no">


<!--This defines a block description and the description of its block arguments-->
<!ELEMENT arg EMPTY>
<!ATTLIST arg n CDATA #REQUIRED name CDATA #IMPLIED>

<!ELEMENT description (text, arg-description*)>
<!ELEMENT text (#PCDATA|note|em|i|br|arg)*>
<!ELEMENT arg-description (#PCDATA)>
<!ATTLIST arg-description n CDATA #REQUIRED name CDATA #REQUIRED>
<!ELEMENT note (#PCDATA|arg|i)*>
<!ELEMENT em (#PCDATA)>
<!ELEMENT i (#PCDATA)>
<!ELEMENT br (#PCDATA)>

<!--BlockConnectors are where blocks get connected-->
<!ELEMENT BlockConnectors (BlockConnector*)>
<!ELEMENT BlockConnector (DefaultArg?)>
<!ATTLIST BlockConnector label CDATA #IMPLIED>
<!ATTLIST BlockConnector label-editable (yes|no) "no">
<!-- Order matters with socket connectors and at most one plug is allowed (no multiple return types) -->
<!ATTLIST BlockConnector connector-kind (plug|socket) #REQUIRED>
<!-- for connector-type use the shape-type values specified in block connectors-->
<!ATTLIST BlockConnector connector-type CDATA #REQUIRED>
<!ATTLIST BlockConnector position-type (single|mirror|bottom) "single">
<!ATTLIST BlockConnector is-expandable (yes|no) "no">

<!ELEMENT DefaultArg EMPTY>
<!ATTLIST DefaultArg genus-name CDATA #REQUIRED>
<!ATTLIST DefaultArg label CDATA #IMPLIED>

<!ELEMENT Stubs (Stub*)>
<!--This defines a stub of a block, so that the block can exist as a single entity and have mini-references to it-->
<!ELEMENT Stub (LangSpecProperties)>
<!ATTLIST Stub scope CDATA #IMPLIED>
<!ATTLIST Stub stub-genus (getter|setter|caller|agent|inc) #REQUIRED>

<!-- Defines the images that are drawn on the block itself.
Note: For now, only one image is enabled and wrap-text and image-editable have no effect.
Note: make sure FileLocation specified is relative to workspace directory -->
<!ELEMENT Images (Image)>
<!ELEMENT Image (FileLocation)>
<!ATTLIST Image wrap-text (yes|no) "no">
<!ATTLIST Image image-editable (yes|no) "no">
<!ATTLIST Image block-location (center|east|west|north|south|southeast|southwest|northeast|northwest) "center">
<!ATTLIST Image width CDATA #IMPLIED>
<!ATTLIST Image height CDATA #IMPLIED>
<!ELEMENT FileLocation (#PCDATA)>


<!ELEMENT LangSpecProperties (LangSpecProperty*)>
<!ELEMENT LangSpecProperty (#PCDATA)>
<!ATTLIST LangSpecProperty key CDATA #REQUIRED>
<!ATTLIST LangSpecProperty value CDATA #REQUIRED>

<!--This defines a BlockGenus Family-->
<!ELEMENT BlockFamilies (BlockFamily*)>
<!ELEMENT BlockFamily (FamilyMember*)>
<!ELEMENT FamilyMember (#PCDATA)>

<!-- Defines BlockDrawerSets and their Block Drawer content-->
<!ELEMENT BlockDrawerSets (BlockDrawerSet*)>
<!ELEMENT BlockDrawerSet (BlockDrawer*)>
<!ATTLIST BlockDrawerSet type (bar|stack) "bar">
<!ATTLIST BlockDrawerSet name CDATA #REQUIRED>
<!ATTLIST BlockDrawerSet location (east|west|north|south|northeast|southeast|southwest|northwest) "west">
<!-- window-per-drawer specifies if each drawer should be its own draggable window. otherwise, all the drawers
are contained within one draggable window and only one drawer can be opened at once.
Whether or not the window is draggable depends if drawer-draggable is set to "yes." -->
<!ATTLIST BlockDrawerSet window-per-drawer (yes|no) "yes">
<!ATTLIST BlockDrawerSet drawer-draggable (yes|no) "yes">
<!-- the width of all the drawers within this set -->
<!ATTLIST BlockDrawerSet width CDATA #IMPLIED>

<!--This defines BlockDrawers and their content-->
<!ELEMENT BlockDrawer ( (BlockGenusMember | Separator | NextLine)* )>
<!ATTLIST BlockDrawer name CDATA #REQUIRED>
<!ATTLIST BlockDrawer type (default|factory|page|custom) "default">
<!ATTLIST BlockDrawer is-open (yes|no) "no">
<!ATTLIST BlockDrawer button-color CDATA #REQUIRED>
<!ELEMENT BlockGenusMember (#PCDATA)>
<!ELEMENT Separator EMPTY>
<!ELEMENT NextLine EMPTY>

<!-- Defines Pages dividing the Block Canvas and the optional PageDrawers associated with them
Each Page can have only one PageDrawer.
For now, every page must have a drawer or no pages can have drawers.
The block canvas need not contain any pages. You may choose to have
a blank canvas instead of a canvas of pages.
-->
<!ELEMENT Pages (Page*)>
<!--
drawer-with-page auto generates a new drawer for each new page created by a user
and creates an empty drawer for each page that does not specify a page drawer
-->
<!ATTLIST Pages drawer-with-page (yes|no) "no">
<!ELEMENT Page (PageDrawer?)>
<!ATTLIST Page page-name CDATA #REQUIRED>
<!ATTLIST Page page-width CDATA #REQUIRED>
<!ATTLIST Page page-drawer CDATA #IMPLIED>
<!ATTLIST Page page-color CDATA #IMPLIED>
<!ATTLIST Page page-shape CDATA #IMPLIED>

<!ELEMENT PageDrawer (BlockGenusMember*)>

<!-- If specified a trash can will appear on the workspace.
For both of its child elements, a location for the images should be specified relative to the working directory.
The open trash image appears when a user drags a block over the trashcan. The closed trash image is the default
image during steady state.
-->
<!ELEMENT TrashCan (OpenTrashImage, ClosedTrashImage)>
<!ELEMENT OpenTrashImage (#PCDATA)>
<!ELEMENT ClosedTrashImage (#PCDATA)>

<!-- By default, a minimap will always appear in the upper right corner
of the block canvas, unless enabled is set to "no."
-->
<!ELEMENT MiniMap EMPTY>
<!ATTLIST MiniMap enabled (yes|no) "yes">

<!-- By default, typeblocking will be enabled, such that when the user types onto the canvas
blocks will fly out that match the entered text.
-->
<!ELEMENT Typeblocking EMPTY>
<!ATTLIST Typeblocking enabled (yes|no) "yes">
Binary file added data/lang_def.xml
Binary file not shown.
100 changes: 100 additions & 0 deletions data/save_format.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<!-- Definition of save XML format for Codeblocks -->

<?xml version="1.0" encoding="UTF-16"?>

<!-- Root element -->
<!ELEMENT CodeBlocks (Pages?, BlockDrawerSets?)>

<!ELEMENT Pages (Page+)>
<!-- NOTE: Exclusive saving (where only changed information or information that
differs from the language definition file is saved) is not
enabled for pages YET -->
<!ATTLIST Pages is-blank-page (yes|no) "no">
<!ELEMENT Page (PageBlocks?)>
<!ATTLIST Page page-name CDATA #REQUIRED>
<!ATTLIST Page page-width CDATA #REQUIRED>
<!ATTLIST Page page-color CDATA #REQUIRED>
<!ATTLIST Page page-drawer CDATA #IMPLIED>

<!ELEMENT PageBlocks (Blocks*, BlockStub*)>

<!-- If the Block is a BlockStub, then specify the following -->
<!ELEMENT BlockStub (StubParentName, StubParentGenus, Block)>
<!ELEMENT StubParentName (#PCDATA)>
<!ELEMENT StubParentGenus (#PCDATA)>

<!ELEMENT Block (Label?, PageLabel?, Location?, BoxSize?, Collapsed?, Comment?, BeforeBlockId?, AfterBlockId?, CompilerErrorMsg?, Plug?, Sockets*, BlockStubInfo?, LangSpecProperties?)>
<!ATTLIST Block id CDATA #REQUIRED>
<!ATTLIST Block genus-name CDATA #REQUIRED>
<!ATTLIST Block has-focus (yes|no) "no">

<!ELEMENT Label (#CDATA)>
<!ELEMENT PageLabel (#CDATA)>
<!ELEMENT CompilerErrorMsg (#CDATA)>

<!-- x, y location within the block's page-->
<!ELEMENT Location (X, Y)>
<!ELEMENT X (#CDATA)>
<!ELEMENT Y (#CDATA)>

<!-- width, height box size -->
<!ELEMENT BoxSize (Width, Height)>
<!ELEMENT Width (#CDATA)>
<!ELEMENT Height (#CDATA)>

<!-- existence of this element implies the block is collapsed -->
<!ELEMENT Collapsed>

<!-- Comment widget associated with a Block -->
<!ELEMENT Comment (Text, Location, Collapsed?)>
<!ELEMENT Text (#PCDATA)>

<!-- Only the Block ID of the block connected at these connectors are
specified. -->
<!ELEMENT BeforeBlockId (#CDATA)>
<!ELEMENT AfterBlockId (#CDATA)>

<!ELEMENT Plug (BlockConnector)>
<!ELEMENT Sockets (BlockConnector*)>

<!-- NOTE: Exclusive saving is not enabled for Block Connectors YET -->
<!ELEMENT BlockConnector (EMPTY)>
<!ATTLIST BlockConnector label CDATA #IMPLIED>
<!ATTLIST BlockConnector connector-kind (plug|socket) "socket">
<!ATTLIST BlockConnector init-type CDATA #IMPLIED>
<!ATTLIST BlockConnector connector-type CDATA #IMPLIED>
<!ATTLIST BlockConnector con-block-id CDATA #IMPLIED>
<!ATTLIST BlockConnector position-type (single|mirror|bottom) #IMPLIED>
<!ATTLIST BlockConnector is-expandable (yes|no) #IMPLIED>

<!ELEMENT LangSpecProperties (LangSpecProperty*)>
<!ELEMENT LangSpecProperty (#PCDATA)>
<!ATTLIST LangSpecProperty key CDATA #REQUIRED>
<!ATTLIST LangSpecProperty value CDATA #REQUIRED>

<!-- To dynamically add drawers and blocks within them to the workspace
If a drawer set or drawer already exists with the name specified for
these widgets within the lang def file, then the loader will
simply insert the new drawers or blocks into the these already loaded widgets. -->

<!-- Defines BlockDrawerSets and their Block Drawer content-->
<!ELEMENT BlockDrawerSets (BlockDrawerSet*)>
<!ELEMENT BlockDrawerSet (BlockDrawer*)>
<!ATTLIST BlockDrawerSet type (bar|stack) "bar">
<!ATTLIST BlockDrawerSet name CDATA #REQUIRED>
<!ATTLIST BlockDrawerSet location (east|west|north|south|northeast|southeast|southwest|northwest) "west">
<!-- window-per-drawer specifies if each drawer should be its own draggable window. otherwise, all the drawers
are contained within one draggable window and only one drawer can be opened at once.
Whether or not the window is draggable depends if drawer-draggable is set to "yes." -->
<!ATTLIST BlockDrawerSet window-per-drawer (yes|no) "yes">
<!ATTLIST BlockDrawerSet drawer-draggable (yes|no) "yes">

<!--This defines BlockDrawers and their content-->
<!ELEMENT BlockDrawer ( (BlockGenusMember | Separator | NextLine)* )>
<!ATTLIST BlockDrawer name CDATA #REQUIRED>
<!ATTLIST BlockDrawer type (default|factory|page|custom) "default">
<!ATTLIST BlockDrawer is-open (yes|no) "no">
<!ATTLIST BlockDrawer button-color CDATA #REQUIRED>
<!ELEMENT BlockGenusMember (#PCDATA)>
<!ELEMENT Separator EMPTY>
<!ELEMENT NextLine EMPTY>
16 changes: 13 additions & 3 deletions src/bitcraftlab/blocks/tool/BlocksTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
*
*/

package bitcraftlab.blocks.tool;
package bitcraftlab.blocks.tool;

import processing.app.*;
import processing.app.tools.*;
import java.io.File;

import edu.mit.blocks.controller.WorkspaceController;
import processing.app.*;
import processing.app.tools.*;


public class BlocksTool implements Tool {
Expand All @@ -29,6 +32,13 @@ public void init(Editor theEditor) {

public void run() {
System.out.println("Let's snap blocks together. ##name## ##version## by ##author##");

String[] args = new String[1];
// TODO: how the heck do we pass in the right relative path for it to load from the data folder?
args[0] = "C:/Users/josh/workspace/Processing-Blocks-Tool/data/lang_def.xml";
System.out.println(args[0]);
WorkspaceController.main(args);

}

}
Expand Down