beginning work on sketchbook, minor cleanups

This commit is contained in:
benfry
2002-07-02 11:16:16 +00:00
parent 1431b022b3
commit 580ed67a55
5 changed files with 83 additions and 166 deletions

View File

@@ -27,13 +27,9 @@ public class PdeEditor extends Panel /*implements PdeEnvironment*/ {
PdeEditorButtons buttons;
PdeEditorHeader header;
PdeEditorStatus status;
//PdeEditorOutput output;
PdeEditorConsole console;
//Label status;
TextArea textarea;
//PdeGraphics graphics;
PdeRunner runner;
Frame frame;
@@ -71,47 +67,9 @@ public class PdeEditor extends Panel /*implements PdeEnvironment*/ {
Panel rightPanel = new Panel();
rightPanel.setLayout(new BorderLayout());
/*
PdeEditorLabel sketchLabel = new PdeEditorLabel(1);
Color sketchBgColor = new Color(51, 51, 51);
Color sketchPrimaryTextColor = Color.white;
Color sketchSecondaryTextColor = new Color(153, 153, 153);
sketchLabel.setForeground(sketchPrimaryTextColor);
sketchLabel.setBackground(sketchBgColor);
rightPanel.add("North", sketchLabel);
*/
header = new PdeEditorHeader(this, "untitled", "default");
rightPanel.add("North", header);
/*
Panel top = new Panel();
top.setBackground(buttonBgColor);
top.setLayout(new BorderLayout());
buttons = new PdeEditorButtons(this);
buttons.setBackground(buttonBgColor);
top.add("West", buttons);
Label buttonStatus =
new Label(PdeEditorButtons.EMPTY_STATUS, Label.RIGHT);
buttonStatus.setBackground(buttonBgColor);
top.add("East", buttonStatus);
buttons.status = buttonStatus;
*/
/*
Panel statusPanel = new Panel();
statusPanel.setBackground(statusBgColor);
statusPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
statusPanel.add(status = new Label(EMPTY));
//right.add("North", statusPanel);
top.add("South", statusPanel);
add("North", top);
*/
if (program == null) program = DEFAULT_PROGRAM;
textarea =
new TextArea(program,
@@ -121,54 +79,18 @@ public class PdeEditor extends Panel /*implements PdeEnvironment*/ {
textarea.setFont(PdeApplet.getFont("editor.program.font",
new Font("Monospaced",
Font.PLAIN, 12)));
//right.add("Center", textarea);
rightPanel.add("Center", textarea);
Panel statusPanel = new Panel();
statusPanel.setLayout(new BorderLayout());
/*
PdeEditorLabel errorLabel = new PdeEditorLabel(1);
//errorLabel.setBackground(errorBgColor);
errorLabel.setBackground(statusBgColor);
errorLabel.setForeground(errorFgColor);
errorLabel.setText("Cannot find method \"bbackground(int)\"");
statusPanel.add("North", errorLabel);
*/
status = new PdeEditorStatus(this);
statusPanel.add("North", status);
//int lineCount = PdeApplet.getInteger("editor.console.lines", 4);
console = new PdeEditorConsole(this); //, lineCount);
/*
Color consoleBgColor =
PdeApplet.getColor("editor.console.bgcolor", new Color(26, 26, 26));
Color consoleFgColor =
PdeApplet.getColor("editor.console.fgcolor", new Color(153, 153, 153));
//console.setBackground(consoleBgColor);
//console.setForeground(consoleFgColor);
Font consoleFont =
PdeApplet.getFont("editor.console.font",
new Font("monospaced", Font.PLAIN, 11));
console.setFont(consoleFont);
*/
//console.setText("Test the print");
//console.setInsets(new Insets(4, 4, 4, 4));
console = new PdeEditorConsole(this);
statusPanel.add("South", console);
rightPanel.add("South", statusPanel);
add("Center", rightPanel);
/*
TextArea console = new TextArea("welcome to pr0[3551ng", 5, 48,
TextArea.SCROLLBARS_VERTICAL_ONLY);
console.setBackground(Color.gray);
console.setFont(PdeApplet.getFont("editor"));
add("South", console);
*/
if (!PdeApplet.isMacintosh()) { // this still relevant?
PdeEditorListener listener = new PdeEditorListener();
textarea.addKeyListener(listener);
@@ -461,18 +383,6 @@ public class PdeEditor extends Panel /*implements PdeEnvironment*/ {
buttons.clear();
return;
}
//File file = new File(directory, filename);
// write java code for applet
/*
File javaOutputFile = new File(outputDirectory, projectName + ".java");
FileOutputStream fos = new FileOutputStream(javaOutputFile);
PrintStream ps = new PrintStream(fos);
ps.println("public class " +
ps.print(converted);
ps.flush();
ps.close();
*/
try {
String program = textarea.getText();
@@ -535,14 +445,6 @@ public class PdeEditor extends Panel /*implements PdeEnvironment*/ {
"export" + File.separator);
String bagelClasses[] = new File(exportDir).list();
/*
final String classes[] = {
"Bagel.class", "BagelConstants.class", "BagelFont.class",
"BagelImage.class", "BagelLight.class", "BagelPolygon.class",
"ProcessingApplet.class"
};
*/
// create new .jar file
FileOutputStream zipOutputFile =
new FileOutputStream(new File(projectDir, projectName + ".jar"));
@@ -552,9 +454,6 @@ public class PdeEditor extends Panel /*implements PdeEnvironment*/ {
// add standard .class files to the jar
for (int i = 0; i < bagelClasses.length; i++) {
if (!bagelClasses[i].endsWith(".class")) continue;
//if ((bagelClasses[i].equals(".")) ||
// (bagelClasses[i].equals(".."))) continue;
//System.out.println("adding class " + (i+1) + " of " + classes.length);
entry = new ZipEntry(bagelClasses[i]);
zos.putNextEntry(entry);
zos.write(grabFile(new File(exportDir + bagelClasses[i])));
@@ -562,7 +461,6 @@ public class PdeEditor extends Panel /*implements PdeEnvironment*/ {
}
// add the project's .class to the jar
//System.out.println("adding " + projectName + ".class");
entry = new ZipEntry(projectName + ".class");
zos.putNextEntry(entry);
zos.write(grabFile(new File("lib", projectName + ".class")));
@@ -592,10 +490,8 @@ public class PdeEditor extends Panel /*implements PdeEnvironment*/ {
int bytesRead;
while ((bytesRead = input.read(buffer, offset, size-offset)) != -1) {
offset += bytesRead;
//System.out.println(offset + " " + bytesRead);
if (bytesRead == 0) break;
}
//System.out.println("done grabbing file");
return buffer;
}

View File

@@ -135,8 +135,6 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
g.setColor(backgroundColor);
g.fillRect(0, 0, imageW, imageH);
// DISABLED TEMPORARILY FOR 0022
/*
g.setColor(secondaryColor);
g.drawString(PROJECT_TITLER, projectTitleLeft, baseline);
g.drawString(USER_TITLER, userTitleLeft, baseline);
@@ -144,7 +142,6 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
g.setColor(primaryColor);
g.drawString(project, projectLeft, baseline);
g.drawString(user, userLeft, baseline);
*/
//g.setColor(fgColor[mode]);
//g.drawString(message, PdeEditor.INSET_SIZE, (sizeH + fontAscent) / 2);

View File

@@ -1,3 +1,12 @@
ABOUT REV 0030
- fix bug where comments were being removed from exported files
- new 'color' datatype, the following are now valid:
color c = color(23, 45, 99);
color c = #ff00cc;
ABOUT REV 0029
- actually updated pde.jar, export, pde.properties, BApplet.java

View File

@@ -1,3 +1,10 @@
0030
X attempt to fold serial into bapplet, but mostly fail
X convert color -> int
X also include #ff00cc -> proper conversion
X comments are removed from exported files
0029
X triangle() 6 parameters
X quad() 8 parameters

124
todo.txt
View File

@@ -1,12 +1,70 @@
0030
X attempt to fold serial into bapplet, but mostly fail
_ kjc issues
_ modify to allow for the 'build' directory in lib
X convert color -> int
X also include #ff00cc -> proper conversion
X comments are removed from exported files
_ make a new 'dist' function for building
0031
ui
a _ sketch.properties contains the last program run
a _ also the window positions, etc
a _ if it doesn't exist, starts with a new project
a _ for a new project, name it untitled-0001 or as appropriate
a _ so that previous projects aren't written over
a _ 'open' button is a switch-to button
a _ pops up list of everything in the sketchbook
a _ first item is 'new sketch', followed by delimeter
a _ next is list of subdirs other than current user, then delim
a _ the rest are the items in the current user's folder
a X need 'new' button on the toolbar --> NOPE, first item on 'open' menu
a _ the zero looking one might be good (instead of export)
a _ export could be three circles in a row, overlapping
a _ everything is a project.. what about short snippets of code?
a _ this version won't be able to access everything from scrapbook
a _ (that requires a more robust class loader)
file structure for export
a _ exporting to applet/.jar file
a _ need to set project name for files
a _ include other .class files built besides the main one
a _ compile into 'classes' folder
a _ include referenced image and font files (can't do if numbered)
included files
a _ 'data' directory for all media
a _ make included media part of the .jar file
a _ it's really a pain to use external files in processing
a _ getStream sucks (zach rewrote)
a _ should be able to work for application or applets
a _ may want to use getResource() (to get things from .jar files)
compiling
a _ remove .java and .class files for compiled classes
a _ (just clean up the boogers afterwards)
a _ compiling .java files leaves the .class files next to the .java
a _ make sure all the dirs in sketchbook added to classpath on startup
a _ if new dir added, must restart processing (this is acceptable)
running
a _ ability to include other code from sketchbook directory
a _ compile entire sketchbook on startup, check for new files on compile?
export
a _ exporting applets that have custom name problems:
a _ if extends processingapplet, the name user types must be same
a _ gets confused about paths and puts boogers in weird places
a _ doesn't compile correctly (must first compile with play)
a _ doesn't include additional (private) classes
a _ when exporting 'name of folder for export...'
a _ default name should be from public class <xxxx>
a _ because otherwise errors are happening
a _ or name from user only determines folder name
a _ if extends ProcessingApplet [more compatible]
a _ make sure export is compiling first
a _ right now have to hit play and then hit export (?)
a _ include main class info for executable jar file with jdk > 1.2
a _ verify save when
a _ closing p5 window
a _ moving to other sketch
_ modify to allow for the 'build' directory in lib
_ make a new 'dist' function for building
_ exceptions in draw() apps aren't caught
_ the program resize(200, 200); just does nothing (doesn't complain)
_ fold simpleserial into BApplet
@@ -267,56 +325,6 @@ b _ this means msft or newer version of jdk
PDE / high & time consuming
a _ exporting to applet/.jar file
a _ need to set project name for files
a _ 'data' directory for all media
a _ include other .class files built besides the main one
a _ compile into 'classes' folder
a _ include referenced image and font files (can't do if numbered)
a _ exporting applets that have custom name problems:
a _ if extends processingapplet, the name user types must be same
a _ gets confused about paths and puts boogers in weird places
a _ doesn't compile correctly (must first compile with play)
a _ doesn't include additional (private) classes
a _ when exporting 'name of folder for export...'
a _ default name should be from public class <xxxx>
a _ because otherwise errors are happening
a _ or name from user only determines folder name
a _ if extends ProcessingApplet [more compatible]
a _ make sure export is compiling first
a _ right now have to hit play and then hit export (?)
a _ include main class info for executable jar file with jdk > 1.2
a _ remove .java and .class files for compiled classes
a _ (just clean up the boogers afterwards)
a _ it's really a pain to use external files in processing
a _ getStream sucks (zach rewrote)
a _ should be able to work for application or applets
a _ may want to use getResource() (to get things from .jar files)
a _ compiling .java files leaves the .class files next to the .java
a _ make sure all the dirs in sketchbook added to classpath on startup
a _ if new dir added, must restart processing (this is acceptable)
a _ ability to include other code from sketchbook directory
a _ compile entire sketchbook on startup, check for new files on compile?
a _ sketch.properties contains the last program run
a _ also the window positions, etc
a _ if it doesn't exist, starts with a new project
a _ for a new project, name it untitled-0001 or as appropriate
a _ so that previous projects aren't written over
a _ 'open' button is a switch-to button
a _ pops up list of everything in the sketchbook
a _ first item is 'new sketch', followed by delimeter
a _ next is list of subdirs other than current user, then delim
a _ the rest are the items in the current user's folder
a X need 'new' button on the toolbar --> NOPE, first item on 'open' menu
a _ the zero looking one might be good (instead of export)
a _ export could be three circles in a row, overlapping
a _ everything is a project.. what about short snippets of code?
a _ this version won't be able to access everything from scrapbook
a _ (that requires a more robust class loader)
a _ verify save when
a _ closing p5 window
a _ moving to other sketch
b _ serial works poorly for starting/stopping applets
b _ this is behaving strangely
b _ breaks on every 2nd run when using serial apps (or others?)