diff --git a/build/application.linux-arm64/data/save.csv b/build/application.linux-arm64/data/save.csv index 4ed18e7..139597f 100644 --- a/build/application.linux-arm64/data/save.csv +++ b/build/application.linux-arm64/data/save.csv @@ -1,43 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Biological Process,395,537,32,33 -Physiological Process,292,455,34 -Cellular Process,483,455,34 -Cellular Physiological Process,391,375,36,35 -Cell Cycle,305,296,40,41 -Cell Division,544,265,37 -Cytokinesis,543,165,38 -Cytokinesis after Meiosis,399,54 -M Phase of Meiotic Cell Cycle,310,144,38 -M Phase,239,225,39 -Meiotic Cell Cycle,392,225,39 - diff --git a/build/application.linux-arm64/lib/ontology.jar b/build/application.linux-arm64/lib/ontology.jar index 8379e9f..f218851 100644 Binary files a/build/application.linux-arm64/lib/ontology.jar and b/build/application.linux-arm64/lib/ontology.jar differ diff --git a/build/application.linux-arm64/source/buttons.pde b/build/application.linux-arm64/source/gui.pde similarity index 63% rename from build/application.linux-arm64/source/buttons.pde rename to build/application.linux-arm64/source/gui.pde index 525ddb1..4b9de3a 100644 --- a/build/application.linux-arm64/source/buttons.pde +++ b/build/application.linux-arm64/source/gui.pde @@ -1,19 +1,26 @@ -int buttonCount = 6; +int buttonCount = 8; int i_buttonId; + + + void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); buttons[2] = new Button(10, 50, "Dark/Bright Mode"); buttons[3] = new Button(10, 90, "Save"); buttons[4] = new Button(10, 130, "Open"); buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ } void buttonFunctions(int functionID) { @@ -38,6 +45,12 @@ void buttonFunctions(int functionID) { case(5): selectOutput("Where to export .png image file to?", "savePNGFile"); break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; default: break; } @@ -76,3 +89,12 @@ class Button { text(label, x+9, y+h/2+5); } } + +boolean menuOpen; + +void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} diff --git a/build/application.linux-arm64/source/ontology.java b/build/application.linux-arm64/source/ontology.java index f7bfd3a..cf773f7 100644 --- a/build/application.linux-arm64/source/ontology.java +++ b/build/application.linux-arm64/source/ontology.java @@ -23,11 +23,12 @@ boolean darkMode = true; public void setup() { surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -72,10 +73,14 @@ public void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -97,22 +102,42 @@ public void draw() { } } } -int buttonCount = 6; + +public void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} +int buttonCount = 8; int i_buttonId; + + + public void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); buttons[2] = new Button(10, 50, "Dark/Bright Mode"); buttons[3] = new Button(10, 90, "Save"); buttons[4] = new Button(10, 130, "Open"); buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ } public void buttonFunctions(int functionID) { @@ -137,6 +162,12 @@ public void buttonFunctions(int functionID) { case(5): selectOutput("Where to export .png image file to?", "savePNGFile"); break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; default: break; } @@ -175,6 +206,15 @@ class Button { text(label, x+9, y+h/2+5); } } + +boolean menuOpen; + +public void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} int linkCount; boolean dragLink; //state of dragging a link @@ -364,7 +404,6 @@ class Node { text(title, x, y+textSize/3); } } - /** * Saving and loading is a messy hack! * You'll get a blank line in your save file for each deleted object. @@ -390,17 +429,7 @@ public void loadCSVFile(File selection) { } public void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { @@ -439,12 +468,12 @@ public void saveCSV(String path) { String[] saveArray = split(saveString, '\n'); saveStrings(path, saveArray); } - /** * Keys only get caught for changing a nodes title. * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + public void keyPressed() { if (key == ESC) { key = 0; @@ -564,7 +593,6 @@ public void mouseWheel(MouseEvent event) { nodes[i].setVectors(); } } - public void settings() { size(800, 600); } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "ontology" }; diff --git a/build/application.linux-arm64/source/ontology.pde b/build/application.linux-arm64/source/ontology.pde index 07edee4..41227fc 100644 --- a/build/application.linux-arm64/source/ontology.pde +++ b/build/application.linux-arm64/source/ontology.pde @@ -7,11 +7,12 @@ boolean darkMode = true; void setup() { size(800, 600); surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -56,10 +57,14 @@ void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -81,3 +86,16 @@ void draw() { } } } + +void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} diff --git a/build/application.linux-arm64/source/save_load.pde b/build/application.linux-arm64/source/save_load.pde index eb7501b..d261652 100644 --- a/build/application.linux-arm64/source/save_load.pde +++ b/build/application.linux-arm64/source/save_load.pde @@ -23,17 +23,7 @@ void loadCSVFile(File selection) { } void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { diff --git a/build/application.linux-arm64/source/ui.pde b/build/application.linux-arm64/source/ui.pde index 67f9b3a..ea86ca1 100644 --- a/build/application.linux-arm64/source/ui.pde +++ b/build/application.linux-arm64/source/ui.pde @@ -3,6 +3,7 @@ * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + void keyPressed() { if (key == ESC) { key = 0; diff --git a/build/application.linux-armv6hf/data/save.csv b/build/application.linux-armv6hf/data/save.csv index 4ed18e7..139597f 100644 --- a/build/application.linux-armv6hf/data/save.csv +++ b/build/application.linux-armv6hf/data/save.csv @@ -1,43 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Biological Process,395,537,32,33 -Physiological Process,292,455,34 -Cellular Process,483,455,34 -Cellular Physiological Process,391,375,36,35 -Cell Cycle,305,296,40,41 -Cell Division,544,265,37 -Cytokinesis,543,165,38 -Cytokinesis after Meiosis,399,54 -M Phase of Meiotic Cell Cycle,310,144,38 -M Phase,239,225,39 -Meiotic Cell Cycle,392,225,39 - diff --git a/build/application.linux-armv6hf/lib/ontology.jar b/build/application.linux-armv6hf/lib/ontology.jar index 8379e9f..f218851 100644 Binary files a/build/application.linux-armv6hf/lib/ontology.jar and b/build/application.linux-armv6hf/lib/ontology.jar differ diff --git a/build/application.linux-armv6hf/source/buttons.pde b/build/application.linux-armv6hf/source/gui.pde similarity index 63% rename from build/application.linux-armv6hf/source/buttons.pde rename to build/application.linux-armv6hf/source/gui.pde index 525ddb1..4b9de3a 100644 --- a/build/application.linux-armv6hf/source/buttons.pde +++ b/build/application.linux-armv6hf/source/gui.pde @@ -1,19 +1,26 @@ -int buttonCount = 6; +int buttonCount = 8; int i_buttonId; + + + void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); buttons[2] = new Button(10, 50, "Dark/Bright Mode"); buttons[3] = new Button(10, 90, "Save"); buttons[4] = new Button(10, 130, "Open"); buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ } void buttonFunctions(int functionID) { @@ -38,6 +45,12 @@ void buttonFunctions(int functionID) { case(5): selectOutput("Where to export .png image file to?", "savePNGFile"); break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; default: break; } @@ -76,3 +89,12 @@ class Button { text(label, x+9, y+h/2+5); } } + +boolean menuOpen; + +void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} diff --git a/build/application.linux-armv6hf/source/ontology.java b/build/application.linux-armv6hf/source/ontology.java index f7bfd3a..cf773f7 100644 --- a/build/application.linux-armv6hf/source/ontology.java +++ b/build/application.linux-armv6hf/source/ontology.java @@ -23,11 +23,12 @@ boolean darkMode = true; public void setup() { surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -72,10 +73,14 @@ public void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -97,22 +102,42 @@ public void draw() { } } } -int buttonCount = 6; + +public void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} +int buttonCount = 8; int i_buttonId; + + + public void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); buttons[2] = new Button(10, 50, "Dark/Bright Mode"); buttons[3] = new Button(10, 90, "Save"); buttons[4] = new Button(10, 130, "Open"); buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ } public void buttonFunctions(int functionID) { @@ -137,6 +162,12 @@ public void buttonFunctions(int functionID) { case(5): selectOutput("Where to export .png image file to?", "savePNGFile"); break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; default: break; } @@ -175,6 +206,15 @@ class Button { text(label, x+9, y+h/2+5); } } + +boolean menuOpen; + +public void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} int linkCount; boolean dragLink; //state of dragging a link @@ -364,7 +404,6 @@ class Node { text(title, x, y+textSize/3); } } - /** * Saving and loading is a messy hack! * You'll get a blank line in your save file for each deleted object. @@ -390,17 +429,7 @@ public void loadCSVFile(File selection) { } public void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { @@ -439,12 +468,12 @@ public void saveCSV(String path) { String[] saveArray = split(saveString, '\n'); saveStrings(path, saveArray); } - /** * Keys only get caught for changing a nodes title. * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + public void keyPressed() { if (key == ESC) { key = 0; @@ -564,7 +593,6 @@ public void mouseWheel(MouseEvent event) { nodes[i].setVectors(); } } - public void settings() { size(800, 600); } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "ontology" }; diff --git a/build/application.linux-armv6hf/source/ontology.pde b/build/application.linux-armv6hf/source/ontology.pde index 07edee4..41227fc 100644 --- a/build/application.linux-armv6hf/source/ontology.pde +++ b/build/application.linux-armv6hf/source/ontology.pde @@ -7,11 +7,12 @@ boolean darkMode = true; void setup() { size(800, 600); surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -56,10 +57,14 @@ void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -81,3 +86,16 @@ void draw() { } } } + +void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} diff --git a/build/application.linux-armv6hf/source/save_load.pde b/build/application.linux-armv6hf/source/save_load.pde index eb7501b..d261652 100644 --- a/build/application.linux-armv6hf/source/save_load.pde +++ b/build/application.linux-armv6hf/source/save_load.pde @@ -23,17 +23,7 @@ void loadCSVFile(File selection) { } void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { diff --git a/build/application.linux-armv6hf/source/ui.pde b/build/application.linux-armv6hf/source/ui.pde index 67f9b3a..ea86ca1 100644 --- a/build/application.linux-armv6hf/source/ui.pde +++ b/build/application.linux-armv6hf/source/ui.pde @@ -3,6 +3,7 @@ * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + void keyPressed() { if (key == ESC) { key = 0; diff --git a/build/application.linux32/data/save.csv b/build/application.linux32/data/save.csv index 4ed18e7..139597f 100644 --- a/build/application.linux32/data/save.csv +++ b/build/application.linux32/data/save.csv @@ -1,43 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Biological Process,395,537,32,33 -Physiological Process,292,455,34 -Cellular Process,483,455,34 -Cellular Physiological Process,391,375,36,35 -Cell Cycle,305,296,40,41 -Cell Division,544,265,37 -Cytokinesis,543,165,38 -Cytokinesis after Meiosis,399,54 -M Phase of Meiotic Cell Cycle,310,144,38 -M Phase,239,225,39 -Meiotic Cell Cycle,392,225,39 - diff --git a/build/application.linux32/lib/ontology.jar b/build/application.linux32/lib/ontology.jar index 8379e9f..f218851 100644 Binary files a/build/application.linux32/lib/ontology.jar and b/build/application.linux32/lib/ontology.jar differ diff --git a/build/application.linux32/source/buttons.pde b/build/application.linux32/source/gui.pde similarity index 63% rename from build/application.linux32/source/buttons.pde rename to build/application.linux32/source/gui.pde index 525ddb1..4b9de3a 100644 --- a/build/application.linux32/source/buttons.pde +++ b/build/application.linux32/source/gui.pde @@ -1,19 +1,26 @@ -int buttonCount = 6; +int buttonCount = 8; int i_buttonId; + + + void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); buttons[2] = new Button(10, 50, "Dark/Bright Mode"); buttons[3] = new Button(10, 90, "Save"); buttons[4] = new Button(10, 130, "Open"); buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ } void buttonFunctions(int functionID) { @@ -38,6 +45,12 @@ void buttonFunctions(int functionID) { case(5): selectOutput("Where to export .png image file to?", "savePNGFile"); break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; default: break; } @@ -76,3 +89,12 @@ class Button { text(label, x+9, y+h/2+5); } } + +boolean menuOpen; + +void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} diff --git a/build/application.linux32/source/ontology.java b/build/application.linux32/source/ontology.java index f7bfd3a..cf773f7 100644 --- a/build/application.linux32/source/ontology.java +++ b/build/application.linux32/source/ontology.java @@ -23,11 +23,12 @@ boolean darkMode = true; public void setup() { surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -72,10 +73,14 @@ public void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -97,22 +102,42 @@ public void draw() { } } } -int buttonCount = 6; + +public void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} +int buttonCount = 8; int i_buttonId; + + + public void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); buttons[2] = new Button(10, 50, "Dark/Bright Mode"); buttons[3] = new Button(10, 90, "Save"); buttons[4] = new Button(10, 130, "Open"); buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ } public void buttonFunctions(int functionID) { @@ -137,6 +162,12 @@ public void buttonFunctions(int functionID) { case(5): selectOutput("Where to export .png image file to?", "savePNGFile"); break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; default: break; } @@ -175,6 +206,15 @@ class Button { text(label, x+9, y+h/2+5); } } + +boolean menuOpen; + +public void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} int linkCount; boolean dragLink; //state of dragging a link @@ -364,7 +404,6 @@ class Node { text(title, x, y+textSize/3); } } - /** * Saving and loading is a messy hack! * You'll get a blank line in your save file for each deleted object. @@ -390,17 +429,7 @@ public void loadCSVFile(File selection) { } public void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { @@ -439,12 +468,12 @@ public void saveCSV(String path) { String[] saveArray = split(saveString, '\n'); saveStrings(path, saveArray); } - /** * Keys only get caught for changing a nodes title. * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + public void keyPressed() { if (key == ESC) { key = 0; @@ -564,7 +593,6 @@ public void mouseWheel(MouseEvent event) { nodes[i].setVectors(); } } - public void settings() { size(800, 600); } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "ontology" }; diff --git a/build/application.linux32/source/ontology.pde b/build/application.linux32/source/ontology.pde index 07edee4..41227fc 100644 --- a/build/application.linux32/source/ontology.pde +++ b/build/application.linux32/source/ontology.pde @@ -7,11 +7,12 @@ boolean darkMode = true; void setup() { size(800, 600); surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -56,10 +57,14 @@ void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -81,3 +86,16 @@ void draw() { } } } + +void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} diff --git a/build/application.linux32/source/save_load.pde b/build/application.linux32/source/save_load.pde index eb7501b..d261652 100644 --- a/build/application.linux32/source/save_load.pde +++ b/build/application.linux32/source/save_load.pde @@ -23,17 +23,7 @@ void loadCSVFile(File selection) { } void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { diff --git a/build/application.linux32/source/ui.pde b/build/application.linux32/source/ui.pde index 67f9b3a..ea86ca1 100644 --- a/build/application.linux32/source/ui.pde +++ b/build/application.linux32/source/ui.pde @@ -3,6 +3,7 @@ * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + void keyPressed() { if (key == ESC) { key = 0; diff --git a/build/application.linux64/data/save.csv b/build/application.linux64/data/save.csv index 4ed18e7..139597f 100644 --- a/build/application.linux64/data/save.csv +++ b/build/application.linux64/data/save.csv @@ -1,43 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Biological Process,395,537,32,33 -Physiological Process,292,455,34 -Cellular Process,483,455,34 -Cellular Physiological Process,391,375,36,35 -Cell Cycle,305,296,40,41 -Cell Division,544,265,37 -Cytokinesis,543,165,38 -Cytokinesis after Meiosis,399,54 -M Phase of Meiotic Cell Cycle,310,144,38 -M Phase,239,225,39 -Meiotic Cell Cycle,392,225,39 - diff --git a/build/application.linux64/lib/ontology.jar b/build/application.linux64/lib/ontology.jar index 8379e9f..f218851 100644 Binary files a/build/application.linux64/lib/ontology.jar and b/build/application.linux64/lib/ontology.jar differ diff --git a/build/application.linux64/source/buttons.pde b/build/application.linux64/source/gui.pde similarity index 63% rename from build/application.linux64/source/buttons.pde rename to build/application.linux64/source/gui.pde index 525ddb1..4b9de3a 100644 --- a/build/application.linux64/source/buttons.pde +++ b/build/application.linux64/source/gui.pde @@ -1,19 +1,26 @@ -int buttonCount = 6; +int buttonCount = 8; int i_buttonId; + + + void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); buttons[2] = new Button(10, 50, "Dark/Bright Mode"); buttons[3] = new Button(10, 90, "Save"); buttons[4] = new Button(10, 130, "Open"); buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ } void buttonFunctions(int functionID) { @@ -38,6 +45,12 @@ void buttonFunctions(int functionID) { case(5): selectOutput("Where to export .png image file to?", "savePNGFile"); break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; default: break; } @@ -76,3 +89,12 @@ class Button { text(label, x+9, y+h/2+5); } } + +boolean menuOpen; + +void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} diff --git a/build/application.linux64/source/ontology.java b/build/application.linux64/source/ontology.java index f7bfd3a..cf773f7 100644 --- a/build/application.linux64/source/ontology.java +++ b/build/application.linux64/source/ontology.java @@ -23,11 +23,12 @@ boolean darkMode = true; public void setup() { surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -72,10 +73,14 @@ public void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -97,22 +102,42 @@ public void draw() { } } } -int buttonCount = 6; + +public void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} +int buttonCount = 8; int i_buttonId; + + + public void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); buttons[2] = new Button(10, 50, "Dark/Bright Mode"); buttons[3] = new Button(10, 90, "Save"); buttons[4] = new Button(10, 130, "Open"); buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ } public void buttonFunctions(int functionID) { @@ -137,6 +162,12 @@ public void buttonFunctions(int functionID) { case(5): selectOutput("Where to export .png image file to?", "savePNGFile"); break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; default: break; } @@ -175,6 +206,15 @@ class Button { text(label, x+9, y+h/2+5); } } + +boolean menuOpen; + +public void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} int linkCount; boolean dragLink; //state of dragging a link @@ -364,7 +404,6 @@ class Node { text(title, x, y+textSize/3); } } - /** * Saving and loading is a messy hack! * You'll get a blank line in your save file for each deleted object. @@ -390,17 +429,7 @@ public void loadCSVFile(File selection) { } public void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { @@ -439,12 +468,12 @@ public void saveCSV(String path) { String[] saveArray = split(saveString, '\n'); saveStrings(path, saveArray); } - /** * Keys only get caught for changing a nodes title. * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + public void keyPressed() { if (key == ESC) { key = 0; @@ -564,7 +593,6 @@ public void mouseWheel(MouseEvent event) { nodes[i].setVectors(); } } - public void settings() { size(800, 600); } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "ontology" }; diff --git a/build/application.linux64/source/ontology.pde b/build/application.linux64/source/ontology.pde index 07edee4..41227fc 100644 --- a/build/application.linux64/source/ontology.pde +++ b/build/application.linux64/source/ontology.pde @@ -7,11 +7,12 @@ boolean darkMode = true; void setup() { size(800, 600); surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -56,10 +57,14 @@ void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -81,3 +86,16 @@ void draw() { } } } + +void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} diff --git a/build/application.linux64/source/save_load.pde b/build/application.linux64/source/save_load.pde index eb7501b..d261652 100644 --- a/build/application.linux64/source/save_load.pde +++ b/build/application.linux64/source/save_load.pde @@ -23,17 +23,7 @@ void loadCSVFile(File selection) { } void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { diff --git a/build/application.linux64/source/ui.pde b/build/application.linux64/source/ui.pde index 67f9b3a..ea86ca1 100644 --- a/build/application.linux64/source/ui.pde +++ b/build/application.linux64/source/ui.pde @@ -3,6 +3,7 @@ * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + void keyPressed() { if (key == ESC) { key = 0; diff --git a/build/application.windows32/data/save.csv b/build/application.windows32/data/save.csv index 4ed18e7..139597f 100644 --- a/build/application.windows32/data/save.csv +++ b/build/application.windows32/data/save.csv @@ -1,43 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Biological Process,395,537,32,33 -Physiological Process,292,455,34 -Cellular Process,483,455,34 -Cellular Physiological Process,391,375,36,35 -Cell Cycle,305,296,40,41 -Cell Division,544,265,37 -Cytokinesis,543,165,38 -Cytokinesis after Meiosis,399,54 -M Phase of Meiotic Cell Cycle,310,144,38 -M Phase,239,225,39 -Meiotic Cell Cycle,392,225,39 - diff --git a/build/application.windows32/lib/ontology.jar b/build/application.windows32/lib/ontology.jar index 8379e9f..f218851 100644 Binary files a/build/application.windows32/lib/ontology.jar and b/build/application.windows32/lib/ontology.jar differ diff --git a/build/application.windows32/ontology.exe b/build/application.windows32/ontology.exe index 40790d1..46d29a1 100755 Binary files a/build/application.windows32/ontology.exe and b/build/application.windows32/ontology.exe differ diff --git a/build/application.windows32/source/buttons.pde b/build/application.windows32/source/buttons.pde deleted file mode 100644 index 525ddb1..0000000 --- a/build/application.windows32/source/buttons.pde +++ /dev/null @@ -1,78 +0,0 @@ -int buttonCount = 6; -int i_buttonId; - -void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); - buttons[2] = new Button(10, 50, "Dark/Bright Mode"); - buttons[3] = new Button(10, 90, "Save"); - buttons[4] = new Button(10, 130, "Open"); - buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ -} - -void buttonFunctions(int functionID) { - switch (functionID) { - case(0): - addNode(int(random(50, width-50)), int(random(30, height-150)), ""); - i_selectedNode = nodeCount-1; - break; - case(1): - deleteSelectedNode(); - break; - case(2): - darkMode = !darkMode; - break; - case(3): - saveCSV(dataPath("save.csv")); - selectOutput("Where to save .csv file to?", "saveCSVFile"); - break; - case(4): - selectInput("Select csv File", "loadCSVFile"); - break; - case(5): - selectOutput("Where to export .png image file to?", "savePNGFile"); - break; - default: - break; - } -} - - -Button buttons[] = new Button[buttonCount]; - -class Button { - int id, x, y, w, h; - String label; - - boolean hover() { - return (mouseX > x && mouseX < x+w && mouseY > y && mouseY < y+h) ? true : false; - } - - void click() { - buttonFunctions(id); - } - Button(int x_, int y_, String label_) { - id = i_buttonId; - i_buttonId++; - x = x_; - y = y_ ; - label = label_; - w = int(textWidth(label))+18; - h = 32; - } - - void display() { - stroke(0); - strokeWeight(1); - fill(255, 127); - rect(x, y, w, h, 4); - fill(0); - text(label, x+9, y+h/2+5); - } -} diff --git a/build/application.windows32/source/gui.pde b/build/application.windows32/source/gui.pde new file mode 100644 index 0000000..4b9de3a --- /dev/null +++ b/build/application.windows32/source/gui.pde @@ -0,0 +1,100 @@ +int buttonCount = 8; +int i_buttonId; + + + + +void initButtons() { + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); + buttons[2] = new Button(10, 50, "Dark/Bright Mode"); + buttons[3] = new Button(10, 90, "Save"); + buttons[4] = new Button(10, 130, "Open"); + buttons[5] = new Button(10, 170, "Export Image"); + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ +} + +void buttonFunctions(int functionID) { + switch (functionID) { + case(0): + addNode(int(random(50, width-50)), int(random(30, height-150)), ""); + i_selectedNode = nodeCount-1; + break; + case(1): + deleteSelectedNode(); + break; + case(2): + darkMode = !darkMode; + break; + case(3): + saveCSV(dataPath("save.csv")); + selectOutput("Where to save .csv file to?", "saveCSVFile"); + break; + case(4): + selectInput("Select csv File", "loadCSVFile"); + break; + case(5): + selectOutput("Where to export .png image file to?", "savePNGFile"); + break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; + default: + break; + } +} + + +Button buttons[] = new Button[buttonCount]; + +class Button { + int id, x, y, w, h; + String label; + + boolean hover() { + return (mouseX > x && mouseX < x+w && mouseY > y && mouseY < y+h) ? true : false; + } + + void click() { + buttonFunctions(id); + } + Button(int x_, int y_, String label_) { + id = i_buttonId; + i_buttonId++; + x = x_; + y = y_ ; + label = label_; + w = int(textWidth(label))+18; + h = 32; + } + + void display() { + stroke(0); + strokeWeight(1); + fill(255, 127); + rect(x, y, w, h, 4); + fill(0); + text(label, x+9, y+h/2+5); + } +} + +boolean menuOpen; + +void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} diff --git a/build/application.windows32/source/ontology.java b/build/application.windows32/source/ontology.java index f7bfd3a..cf773f7 100644 --- a/build/application.windows32/source/ontology.java +++ b/build/application.windows32/source/ontology.java @@ -23,11 +23,12 @@ boolean darkMode = true; public void setup() { surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -72,10 +73,14 @@ public void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -97,22 +102,42 @@ public void draw() { } } } -int buttonCount = 6; + +public void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} +int buttonCount = 8; int i_buttonId; + + + public void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); buttons[2] = new Button(10, 50, "Dark/Bright Mode"); buttons[3] = new Button(10, 90, "Save"); buttons[4] = new Button(10, 130, "Open"); buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ } public void buttonFunctions(int functionID) { @@ -137,6 +162,12 @@ public void buttonFunctions(int functionID) { case(5): selectOutput("Where to export .png image file to?", "savePNGFile"); break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; default: break; } @@ -175,6 +206,15 @@ class Button { text(label, x+9, y+h/2+5); } } + +boolean menuOpen; + +public void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} int linkCount; boolean dragLink; //state of dragging a link @@ -364,7 +404,6 @@ class Node { text(title, x, y+textSize/3); } } - /** * Saving and loading is a messy hack! * You'll get a blank line in your save file for each deleted object. @@ -390,17 +429,7 @@ public void loadCSVFile(File selection) { } public void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { @@ -439,12 +468,12 @@ public void saveCSV(String path) { String[] saveArray = split(saveString, '\n'); saveStrings(path, saveArray); } - /** * Keys only get caught for changing a nodes title. * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + public void keyPressed() { if (key == ESC) { key = 0; @@ -564,7 +593,6 @@ public void mouseWheel(MouseEvent event) { nodes[i].setVectors(); } } - public void settings() { size(800, 600); } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "ontology" }; diff --git a/build/application.windows32/source/ontology.pde b/build/application.windows32/source/ontology.pde index 07edee4..41227fc 100644 --- a/build/application.windows32/source/ontology.pde +++ b/build/application.windows32/source/ontology.pde @@ -7,11 +7,12 @@ boolean darkMode = true; void setup() { size(800, 600); surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -56,10 +57,14 @@ void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -81,3 +86,16 @@ void draw() { } } } + +void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} diff --git a/build/application.windows32/source/save_load.pde b/build/application.windows32/source/save_load.pde index eb7501b..d261652 100644 --- a/build/application.windows32/source/save_load.pde +++ b/build/application.windows32/source/save_load.pde @@ -23,17 +23,7 @@ void loadCSVFile(File selection) { } void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { diff --git a/build/application.windows32/source/ui.pde b/build/application.windows32/source/ui.pde index 67f9b3a..ea86ca1 100644 --- a/build/application.windows32/source/ui.pde +++ b/build/application.windows32/source/ui.pde @@ -3,6 +3,7 @@ * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + void keyPressed() { if (key == ESC) { key = 0; diff --git a/build/application.windows64/data/save.csv b/build/application.windows64/data/save.csv index 4ed18e7..139597f 100644 --- a/build/application.windows64/data/save.csv +++ b/build/application.windows64/data/save.csv @@ -1,43 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Biological Process,395,537,32,33 -Physiological Process,292,455,34 -Cellular Process,483,455,34 -Cellular Physiological Process,391,375,36,35 -Cell Cycle,305,296,40,41 -Cell Division,544,265,37 -Cytokinesis,543,165,38 -Cytokinesis after Meiosis,399,54 -M Phase of Meiotic Cell Cycle,310,144,38 -M Phase,239,225,39 -Meiotic Cell Cycle,392,225,39 - diff --git a/build/application.windows64/lib/ontology.jar b/build/application.windows64/lib/ontology.jar index 8379e9f..f218851 100644 Binary files a/build/application.windows64/lib/ontology.jar and b/build/application.windows64/lib/ontology.jar differ diff --git a/build/application.windows64/ontology.exe b/build/application.windows64/ontology.exe index 3d0c330..c403a9a 100755 Binary files a/build/application.windows64/ontology.exe and b/build/application.windows64/ontology.exe differ diff --git a/build/application.windows64/source/buttons.pde b/build/application.windows64/source/buttons.pde deleted file mode 100644 index 525ddb1..0000000 --- a/build/application.windows64/source/buttons.pde +++ /dev/null @@ -1,78 +0,0 @@ -int buttonCount = 6; -int i_buttonId; - -void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); - buttons[2] = new Button(10, 50, "Dark/Bright Mode"); - buttons[3] = new Button(10, 90, "Save"); - buttons[4] = new Button(10, 130, "Open"); - buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ -} - -void buttonFunctions(int functionID) { - switch (functionID) { - case(0): - addNode(int(random(50, width-50)), int(random(30, height-150)), ""); - i_selectedNode = nodeCount-1; - break; - case(1): - deleteSelectedNode(); - break; - case(2): - darkMode = !darkMode; - break; - case(3): - saveCSV(dataPath("save.csv")); - selectOutput("Where to save .csv file to?", "saveCSVFile"); - break; - case(4): - selectInput("Select csv File", "loadCSVFile"); - break; - case(5): - selectOutput("Where to export .png image file to?", "savePNGFile"); - break; - default: - break; - } -} - - -Button buttons[] = new Button[buttonCount]; - -class Button { - int id, x, y, w, h; - String label; - - boolean hover() { - return (mouseX > x && mouseX < x+w && mouseY > y && mouseY < y+h) ? true : false; - } - - void click() { - buttonFunctions(id); - } - Button(int x_, int y_, String label_) { - id = i_buttonId; - i_buttonId++; - x = x_; - y = y_ ; - label = label_; - w = int(textWidth(label))+18; - h = 32; - } - - void display() { - stroke(0); - strokeWeight(1); - fill(255, 127); - rect(x, y, w, h, 4); - fill(0); - text(label, x+9, y+h/2+5); - } -} diff --git a/build/application.windows64/source/gui.pde b/build/application.windows64/source/gui.pde new file mode 100644 index 0000000..4b9de3a --- /dev/null +++ b/build/application.windows64/source/gui.pde @@ -0,0 +1,100 @@ +int buttonCount = 8; +int i_buttonId; + + + + +void initButtons() { + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); + buttons[2] = new Button(10, 50, "Dark/Bright Mode"); + buttons[3] = new Button(10, 90, "Save"); + buttons[4] = new Button(10, 130, "Open"); + buttons[5] = new Button(10, 170, "Export Image"); + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ +} + +void buttonFunctions(int functionID) { + switch (functionID) { + case(0): + addNode(int(random(50, width-50)), int(random(30, height-150)), ""); + i_selectedNode = nodeCount-1; + break; + case(1): + deleteSelectedNode(); + break; + case(2): + darkMode = !darkMode; + break; + case(3): + saveCSV(dataPath("save.csv")); + selectOutput("Where to save .csv file to?", "saveCSVFile"); + break; + case(4): + selectInput("Select csv File", "loadCSVFile"); + break; + case(5): + selectOutput("Where to export .png image file to?", "savePNGFile"); + break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; + default: + break; + } +} + + +Button buttons[] = new Button[buttonCount]; + +class Button { + int id, x, y, w, h; + String label; + + boolean hover() { + return (mouseX > x && mouseX < x+w && mouseY > y && mouseY < y+h) ? true : false; + } + + void click() { + buttonFunctions(id); + } + Button(int x_, int y_, String label_) { + id = i_buttonId; + i_buttonId++; + x = x_; + y = y_ ; + label = label_; + w = int(textWidth(label))+18; + h = 32; + } + + void display() { + stroke(0); + strokeWeight(1); + fill(255, 127); + rect(x, y, w, h, 4); + fill(0); + text(label, x+9, y+h/2+5); + } +} + +boolean menuOpen; + +void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} diff --git a/build/application.windows64/source/ontology.java b/build/application.windows64/source/ontology.java index f7bfd3a..cf773f7 100644 --- a/build/application.windows64/source/ontology.java +++ b/build/application.windows64/source/ontology.java @@ -23,11 +23,12 @@ boolean darkMode = true; public void setup() { surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -72,10 +73,14 @@ public void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -97,22 +102,42 @@ public void draw() { } } } -int buttonCount = 6; + +public void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} +int buttonCount = 8; int i_buttonId; + + + public void initButtons() { - buttons[0] = new Button(10, 10, "Add Node"); - buttons[1] = new Button(104, 10, "Delete Node"); + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); buttons[2] = new Button(10, 50, "Dark/Bright Mode"); buttons[3] = new Button(10, 90, "Save"); buttons[4] = new Button(10, 130, "Open"); buttons[5] = new Button(10, 170, "Export Image"); -/* buttons[0] = new Button(10, 10, "Node Hinzufügen"); - buttons[1] = new Button(155, 10, "Löschen"); - buttons[2] = new Button(10, 50, "Farben umkehren"); - buttons[3] = new Button(10, 90, "Speichern"); - buttons[4] = new Button(10, 130, "Öffnen"); - buttons[5] = new Button(10, 170, "Bild Exportieren");*/ + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ } public void buttonFunctions(int functionID) { @@ -137,6 +162,12 @@ public void buttonFunctions(int functionID) { case(5): selectOutput("Where to export .png image file to?", "savePNGFile"); break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; default: break; } @@ -175,6 +206,15 @@ class Button { text(label, x+9, y+h/2+5); } } + +boolean menuOpen; + +public void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} int linkCount; boolean dragLink; //state of dragging a link @@ -364,7 +404,6 @@ class Node { text(title, x, y+textSize/3); } } - /** * Saving and loading is a messy hack! * You'll get a blank line in your save file for each deleted object. @@ -390,17 +429,7 @@ public void loadCSVFile(File selection) { } public void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { @@ -439,12 +468,12 @@ public void saveCSV(String path) { String[] saveArray = split(saveString, '\n'); saveStrings(path, saveArray); } - /** * Keys only get caught for changing a nodes title. * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + public void keyPressed() { if (key == ESC) { key = 0; @@ -564,7 +593,6 @@ public void mouseWheel(MouseEvent event) { nodes[i].setVectors(); } } - public void settings() { size(800, 600); } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "ontology" }; diff --git a/build/application.windows64/source/ontology.pde b/build/application.windows64/source/ontology.pde index 07edee4..41227fc 100644 --- a/build/application.windows64/source/ontology.pde +++ b/build/application.windows64/source/ontology.pde @@ -7,11 +7,12 @@ boolean darkMode = true; void setup() { size(800, 600); surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -56,10 +57,14 @@ void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -81,3 +86,16 @@ void draw() { } } } + +void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} diff --git a/build/application.windows64/source/save_load.pde b/build/application.windows64/source/save_load.pde index eb7501b..d261652 100644 --- a/build/application.windows64/source/save_load.pde +++ b/build/application.windows64/source/save_load.pde @@ -23,17 +23,7 @@ void loadCSVFile(File selection) { } void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { diff --git a/build/application.windows64/source/ui.pde b/build/application.windows64/source/ui.pde index 67f9b3a..ea86ca1 100644 --- a/build/application.windows64/source/ui.pde +++ b/build/application.windows64/source/ui.pde @@ -3,6 +3,7 @@ * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + void keyPressed() { if (key == ESC) { key = 0; diff --git a/data/save.csv b/data/save.csv index 4ed18e7..139597f 100644 --- a/data/save.csv +++ b/data/save.csv @@ -1,43 +1,2 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Biological Process,395,537,32,33 -Physiological Process,292,455,34 -Cellular Process,483,455,34 -Cellular Physiological Process,391,375,36,35 -Cell Cycle,305,296,40,41 -Cell Division,544,265,37 -Cytokinesis,543,165,38 -Cytokinesis after Meiosis,399,54 -M Phase of Meiotic Cell Cycle,310,144,38 -M Phase,239,225,39 -Meiotic Cell Cycle,392,225,39 - diff --git a/gui.pde b/gui.pde new file mode 100644 index 0000000..4b9de3a --- /dev/null +++ b/gui.pde @@ -0,0 +1,100 @@ +int buttonCount = 8; +int i_buttonId; + + + + +void initButtons() { + buttons[0] = new Button(72, 10, "Add Node"); + buttons[1] = new Button(164, 10, "Delete Node"); + buttons[2] = new Button(10, 50, "Dark/Bright Mode"); + buttons[3] = new Button(10, 90, "Save"); + buttons[4] = new Button(10, 130, "Open"); + buttons[5] = new Button(10, 170, "Export Image"); + buttons[6] = new Button(10, 210, "Empty Workspace"); + buttons[7] = new Button(10, 10, "Menu"); + /* buttons[0] = new Button(10, 10, "Node Hinzufügen"); + buttons[1] = new Button(155, 10, "Löschen"); + buttons[2] = new Button(10, 50, "Farben umkehren"); + buttons[3] = new Button(10, 90, "Speichern"); + buttons[4] = new Button(10, 130, "Öffnen"); + buttons[5] = new Button(10, 170, "Bild Exportieren"); + buttons[6] = new Button(10, 210, "Arbeitsfläche leeren"); + buttons[7] = new Button(10, 210, "Menü");*/ +} + +void buttonFunctions(int functionID) { + switch (functionID) { + case(0): + addNode(int(random(50, width-50)), int(random(30, height-150)), ""); + i_selectedNode = nodeCount-1; + break; + case(1): + deleteSelectedNode(); + break; + case(2): + darkMode = !darkMode; + break; + case(3): + saveCSV(dataPath("save.csv")); + selectOutput("Where to save .csv file to?", "saveCSVFile"); + break; + case(4): + selectInput("Select csv File", "loadCSVFile"); + break; + case(5): + selectOutput("Where to export .png image file to?", "savePNGFile"); + break; + case(6): + deleteAll(); + break; + case(7): + menu(); + break; + default: + break; + } +} + + +Button buttons[] = new Button[buttonCount]; + +class Button { + int id, x, y, w, h; + String label; + + boolean hover() { + return (mouseX > x && mouseX < x+w && mouseY > y && mouseY < y+h) ? true : false; + } + + void click() { + buttonFunctions(id); + } + Button(int x_, int y_, String label_) { + id = i_buttonId; + i_buttonId++; + x = x_; + y = y_ ; + label = label_; + w = int(textWidth(label))+18; + h = 32; + } + + void display() { + stroke(0); + strokeWeight(1); + fill(255, 127); + rect(x, y, w, h, 4); + fill(0); + text(label, x+9, y+h/2+5); + } +} + +boolean menuOpen; + +void menu() { + if (menuOpen) { + } else { + } + menuOpen = !menuOpen; +} diff --git a/ontology.pde b/ontology.pde index 07edee4..41227fc 100644 --- a/ontology.pde +++ b/ontology.pde @@ -7,11 +7,12 @@ boolean darkMode = true; void setup() { size(800, 600); surface.setResizable(true); + //frame.setResizable(true); textSize(textSize); initButtons(); - + /** * When saving, a copy of the save-file is stored locally which is opened when starting the program */ @@ -56,10 +57,14 @@ void draw() { textAlign(CORNER); buttons[0].display(); if (i_selectedNode != -1) buttons[1].display(); - buttons[2].display(); - buttons[3].display(); - buttons[4].display(); - buttons[5].display(); + if (menuOpen) { + buttons[2].display(); + buttons[3].display(); + buttons[4].display(); + buttons[5].display(); + buttons[6].display(); + } + buttons[7].display(); rectMode(CENTER); textAlign(CENTER); textSize(textSize); @@ -81,3 +86,16 @@ void draw() { } } } + +void deleteAll() { + for (int i = 0; i < nodeCount; i++) { + //nodes[i].deleted = true; + i_selectedNode = i; + deleteSelectedNode(); + } + nodeCount = 0; + for (int i = 0; i < linkCount; i++) { + links[i].active = false; + } + linkCount = 0; +} diff --git a/save_load.pde b/save_load.pde index eb7501b..d261652 100644 --- a/save_load.pde +++ b/save_load.pde @@ -23,17 +23,7 @@ void loadCSVFile(File selection) { } void loadCSV(String path) { - for (int i = 0; i < nodeCount; i++) { - //nodes[i].deleted = true; - i_selectedNode = i; - deleteSelectedNode(); - } - nodeCount = 0; - - for (int i = 0; i < linkCount; i++) { - links[i].active = false; - } - linkCount = 0; + deleteAll(); String[] loadString = loadStrings(path); for (int i = 0; i < loadString.length-1; i++) { diff --git a/ui.pde b/ui.pde index 67f9b3a..ea86ca1 100644 --- a/ui.pde +++ b/ui.pde @@ -3,6 +3,7 @@ * Previous title is remembered in savedTitle and restored when hitting Escape */ String savedTitle; + void keyPressed() { if (key == ESC) { key = 0;