tweaks to editor based on feedback

This commit is contained in:
benfry
2004-10-10 01:01:34 +00:00
parent 3b8789e316
commit efbf7e299f
9 changed files with 100 additions and 54 deletions

View File

@@ -830,7 +830,7 @@ implements MRJAboutHandler, MRJQuitHandler, MRJPrefsHandler
* Convenience method for the antidote to overthought
* swing api mess for setting accelerators.
*/
static public JMenuItem newJMenuItem(String title, char what) {
static public JMenuItem newJMenuItem(String title, int what) {
return newJMenuItem(title, what, false);
}
@@ -842,7 +842,7 @@ implements MRJAboutHandler, MRJQuitHandler, MRJPrefsHandler
* helpher function to *set the command key* for a menu item.
*/
static public JMenuItem newJMenuItem(String title,
char what, boolean shift) {
int what, boolean shift) {
JMenuItem menuItem = new JMenuItem(title);
int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
if (shift) modifiers |= ActionEvent.SHIFT_MASK;

View File

@@ -17,8 +17,8 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -72,27 +72,27 @@ public class PdeEditorHeader extends JComponent {
int imageW, imageH;
public PdeEditorHeader(PdeEditor eddie) {
public PdeEditorHeader(PdeEditor eddie) {
this.editor = eddie; // weird name for listener
pieces = new Image[STATUS.length][WHERE.length];
for (int i = 0; i < STATUS.length; i++) {
for (int j = 0; j < WHERE.length; j++) {
pieces[i][j] = PdeBase.getImage("tab-" + STATUS[i] + "-" +
pieces[i][j] = PdeBase.getImage("tab-" + STATUS[i] + "-" +
WHERE[j] + ".gif", this);
}
}
if (backgroundColor == null) {
backgroundColor =
backgroundColor =
PdePreferences.getColor("header.bgcolor");
textColor[SELECTED] =
textColor[SELECTED] =
PdePreferences.getColor("header.text.selected.color");
textColor[UNSELECTED] =
textColor[UNSELECTED] =
PdePreferences.getColor("header.text.unselected.color");
}
addMouseListener(new MouseAdapter() {
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
int x = e.getX();
int y = e.getY();
@@ -129,7 +129,7 @@ public class PdeEditorHeader extends JComponent {
} else {
// who cares, just resize
sizeW = size.width;
sizeW = size.width;
sizeH = size.height;
//userLeft = 0; // reset
}
@@ -153,7 +153,7 @@ public class PdeEditorHeader extends JComponent {
//}
//Graphics2D g2 = (Graphics2D) g;
//g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
//g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
// RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
// set the background for the offscreen
@@ -170,17 +170,17 @@ public class PdeEditorHeader extends JComponent {
for (int i = 0; i < sketch.codeCount; i++) {
PdeCode code = sketch.code[i];
String codeName = (code.flavor == PdeSketch.PDE) ?
String codeName = (code.flavor == PdeSketch.PDE) ?
code.name : code.file.getName();
// if modified, add the li'l glyph next to the name
String text = " " + codeName + (code.modified ? " \u00A7" : " ");
//int textWidth = metrics.stringWidth(text);
//int textWidth = metrics.stringWidth(text);
Graphics2D g2 = (Graphics2D) g;
int textWidth = (int)
font.getStringBounds(text, g2.getFontRenderContext()).getWidth();
int pieceCount = 2 + (textWidth / PIECE_WIDTH);
int pieceWidth = pieceCount * PIECE_WIDTH;
@@ -209,7 +209,7 @@ public class PdeEditorHeader extends JComponent {
menuLeft = sizeW - (16 + pieces[0][MENU].getWidth(this));
menuRight = sizeW - 16;
// draw the dropdown menu target
g.drawImage(pieces[popup.isVisible() ? SELECTED : UNSELECTED][MENU],
g.drawImage(pieces[popup.isVisible() ? SELECTED : UNSELECTED][MENU],
menuLeft, 0, null);
screen.drawImage(offscreen, 0, 0, null);
@@ -221,7 +221,7 @@ public class PdeEditorHeader extends JComponent {
*/
public void rebuild() {
//System.out.println("rebuilding editor header");
rebuildMenu();
rebuildMenu();
repaint();
}
@@ -234,10 +234,10 @@ public class PdeEditorHeader extends JComponent {
menu = new JMenu();
popup = menu.getPopupMenu();
add(popup);
popup.addPopupMenuListener(new PopupMenuListener() {
popup.addPopupMenuListener(new PopupMenuListener() {
public void popupMenuCanceled(PopupMenuEvent e) {
// on redraw, the isVisible() will get checked.
// actually, a repaint may be fired anyway, so this
// actually, a repaint may be fired anyway, so this
// may be redundant.
repaint();
}
@@ -251,9 +251,36 @@ public class PdeEditorHeader extends JComponent {
// maybe this shouldn't have a command key anyways..
// since we're not trying to make this a full ide..
//item = PdeEditor.newJMenuItem("New", 'T');
item = new JMenuItem("New File");
/*
item = PdeEditor.newJMenuItem("Previous", KeyEvent.VK_PAGE_UP);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
System.out.println("prev");
}
});
if (editor.sketch != null) {
item.setEnabled(editor.sketch.codeCount > 1);
}
menu.add(item);
item = PdeEditor.newJMenuItem("Next", KeyEvent.VK_PAGE_DOWN);
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("ext");
}
});
if (editor.sketch != null) {
item.setEnabled(editor.sketch.codeCount > 1);
}
menu.add(item);
menu.addSeparator();
*/
item = new JMenuItem("New Tab");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
editor.sketch.newCode();
}
});
@@ -261,7 +288,7 @@ public class PdeEditorHeader extends JComponent {
item = new JMenuItem("Rename");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
editor.sketch.renameCode();
}
});
@@ -269,7 +296,7 @@ public class PdeEditorHeader extends JComponent {
item = new JMenuItem("Delete");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
editor.sketch.deleteCode();
}
});
@@ -277,7 +304,7 @@ public class PdeEditorHeader extends JComponent {
item = new JMenuItem("Hide");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
editor.sketch.hideCode();
}
});
@@ -302,14 +329,14 @@ public class PdeEditorHeader extends JComponent {
if (unhide.getItemCount() == 0) {
unhide.setEnabled(false);
}
menu.add(unhide);
if (sketch != null) {
menu.addSeparator();
ActionListener jumpListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
editor.sketch.setCurrent(e.getActionCommand());
}
};

View File

@@ -1003,7 +1003,12 @@ public class PdeSketch {
//importPackageList = PdeCompiler.packageListFromClassPath(classPath);
libraryPath = codeFolder.getAbsolutePath();
} else {
externalRuntime = (codeCount > 1); // may still be set true later
// check to see if multiple files that include a .java file
externalRuntime = false;
for (int i = 0; i < codeCount; i++) {
if (code[i].flavor == JAVA) externalRuntime = true;
}
//externalRuntime = (codeCount > 1); // may still be set true later
//importPackageList = null;
libraryPath = "";
}

View File

@@ -70,6 +70,7 @@ chmod +x processing/Processing.app/Contents/MacOS/JavaApplicationStub
RES=processing/Processing.app/Contents/Resources/Java/
mkdir -p $RES
mv processing/lib/*.jar $RES/
mv $RES/core.jar processing/lib/
# directories used by the app
mkdir processing/lib/build

View File

@@ -31,7 +31,7 @@
<key>JVMVersion</key>
<string>1.3+</string>
<key>ClassPath</key>
<string>$JAVAROOT/pde.jar:$JAVAROOT/core.jar:$JAVAROOT/antlr.jar:$JAVAROOT/oro.jar:lib/build</string>
<string>$JAVAROOT/pde.jar:lib/core.jar:$JAVAROOT/antlr.jar:$JAVAROOT/oro.jar:lib/build</string>
<key>Properties</key>
<dict>
<key>apple.laf.useScreenMenuBar</key>

View File

@@ -108,7 +108,7 @@ cd ../..
# get the libs
mkdir -p work/Processing.app/Contents/Resources/Java/
cp work/lib/*.jar work/Processing.app/Contents/Resources/Java/
cp work/lib/core.jar work/lib/
### -- BUILD LIBRARIES ------------------------------------------------

View File

@@ -98,6 +98,10 @@ changed in the future, but for now, they're not actually 'broken'.
when extra libraries, multiple source code files (more than one tab),
or extra code files in the 'code' folder are employed.
- a long sketch menu that goes off the edge of the screen? doesn't
scroll properly? not much we can do. this is a java issue which
happens on most platforms. to get around it, you can organize your
sketches into subfolders which will appear as submenus.
..................................................................

View File

@@ -203,6 +203,13 @@ quitting presentation mode.. on other platforms, hitting the
there seems to be some key event weirdness under osx. we hope to find
a fix someday.
out of memory? right-click on processing, select "show package
contents", then edit "Info.plist" inside "Contents". change these lines:
<key>VMOptions</key>
<string>-Xms128M -Xmx256M</string>
to set to something higher than 128M and 256M (128 and 256 megabytes
of ram) as you need to / at your own risk.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .

View File

@@ -6,6 +6,33 @@ X uppercase being capitalized before lowercase
X need to mix case.. use toLowerCase before compare
X add a little gap on editor frame at the left
X http://processing.org/discourse/yabb/YaBB.cgi?board=BugFixes;action=display;num=1097363967;start=0
X add to readme or bugs..
X menus that are too long just get clipped on the screen
X can't be fixed because it's a java/os issue
X also strange menu behavior for popups, especially on osx we can't fix
o if applet.html is present, open that in the editor too.
o or do we make people use dreamweaver?
o nixed by casey, we're not dreamweaver
X macosx not exporting core.jar
X the jar is buried Contents/Resources/Java
_ verify that this is working
X don't enable externalRuntime with multiple code files that are pde
X no longer separate classes
X remove "file" from "new file".. maybe just "new tab"?
X not really separate files, so that could be trouble.
_ add file of a .pde or .java file should update the tabs bar
_ and prolly not really complain if it's in the same folder
_ "save as" not properly updating the tab header
_ also include the name of the previous sketch for "save as"
_ allow to use doubles on casting -- particularly for Math.cos() et al
//
_ ctrl-tab to switch between tabs
_ make notes about preproc
_ subclasses need to use "public void keyPressed" not "void keyPressed"
@@ -34,28 +61,6 @@ _ but when uploaded to a unix server causes a serious problem
_ use canonicalPath to flag possible problems
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1096508877;start=5
_ macosx not exporting core.jar
_ the jar is buried Contents/Resources/Java
_ add file of a .pde or .java file should update the tabs bar
_ and prolly not really complain if it's in the same folder
_ add to readme or bugs..
_ menus that are too long just get clipped on the screen
_ can't be fixed because it's a java/os issue
_ also strange menu behavior for popups, especially on osx we can't fix
_ don't enable externalRuntime with multiple code files that are pde
_ no longer separate classes
_ remove "file" from "new file".. maybe just "new tab"?
_ not really separate files, so that could be trouble.
_ "save as" not properly updating the tab header
_ also include the name of the previous sketch for "save as"
_ allow to use doubles on casting -- particularly for Math.cos() et al
_ mouse wheel broken in the text editor? (windows jdk 1.5?)
_ dim "rename" when the main tab is selected (since user needs to "save as")
@@ -67,9 +72,6 @@ _ save caret position when switching tabs
_ add mnemonics for menus (alt-f to open 'file')
_ if applet.html is present, open that in the editor too.
_ or do we make people use dreamweaver?
_ if additional tab is "public" class.. then make external?