fix up prev/next tab

This commit is contained in:
benfry
2007-02-14 03:40:59 +00:00
parent d0c25a04c3
commit 16581162c1
6 changed files with 59 additions and 18 deletions
+3 -3
View File
@@ -819,7 +819,7 @@ public class Editor extends JFrame
if (referenceFile == null) {
message("No reference available for \"" + text + "\"");
} else {
Base.showReference(referenceFile);
Base.showReference(referenceFile + ".html");
}
}
}
@@ -2079,7 +2079,7 @@ public class Editor extends JFrame
* Returns the edit popup menu.
*/
class TextAreaPopup extends JPopupMenu {
String currentDir = System.getProperty("user.dir");
//String currentDir = System.getProperty("user.dir");
String referenceFile = null;
JMenuItem cutItem, copyItem;
@@ -2128,7 +2128,7 @@ public class Editor extends JFrame
referenceItem = new JMenuItem("Find in Reference");
referenceItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Base.showReference(referenceFile);
Base.showReference(referenceFile + ".html");
}
});
this.add(referenceItem);
+15 -2
View File
@@ -356,7 +356,17 @@ public class EditorHeader extends JComponent {
// KeyEvent.VK_LEFT and VK_RIGHT will make Windows beep
item = Editor.newJMenuItem("Previous Tab", '[', true);
int ctrlAlt = ActionEvent.ALT_MASK |
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
//item = Editor.newJMenuItem("Previous Tab", '[', true);
item = new JMenuItem("Previous Tab");
//int shortcut = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
KeyStroke ctrlAltLeft = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, ctrlAlt);
item.setAccelerator(ctrlAltLeft);
//int modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
//KeyStroke tabby = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, modifiers);
// this didn't want to work consistently
/*
item.addActionListener(new ActionListener() {
@@ -367,7 +377,10 @@ public class EditorHeader extends JComponent {
*/
menu.add(item);
item = Editor.newJMenuItem("Next Tab", ']', true);
//item = Editor.newJMenuItem("Next Tab", ']', true);
item = new JMenuItem("Next Tab");
KeyStroke ctrlAltRight = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, ctrlAlt);
item.setAccelerator(ctrlAltRight);
/*
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
+26 -8
View File
@@ -60,6 +60,10 @@ public class EditorListener {
int selectionStart, selectionEnd;
int position;
/** ctrl-alt on windows and linux, cmd-alt on mac os x */
static final int CTRL_ALT = ActionEvent.ALT_MASK |
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
public EditorListener(Editor editor, JEditTextArea textarea) {
this.editor = editor;
@@ -105,6 +109,16 @@ public class EditorListener {
//System.out.println((int)c + " " + code + " " + event);
//System.out.println();
if ((event.getModifiers() & CTRL_ALT) == CTRL_ALT) {
if (code == KeyEvent.VK_LEFT) {
editor.sketch.prevCode();
return true;
} else if (code == KeyEvent.VK_RIGHT) {
editor.sketch.nextCode();
return true;
}
}
if ((event.getModifiers() & KeyEvent.META_MASK) != 0) {
//event.consume(); // does nothing
return false;
@@ -488,27 +502,31 @@ public class EditorListener {
/** Cmd-Shift or Ctrl-Shift depending on the platform */
static final int CMD_SHIFT = ActionEvent.SHIFT_MASK |
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
//static final int CMD_SHIFT = ActionEvent.SHIFT_MASK |
// Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
/** ctrl-alt on windows and linux, cmd-alt on mac os x */
//static final int CTRL_ALT = ActionEvent.ALT_MASK |
// Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
/*
public boolean keyTyped(KeyEvent event) {
char c = event.getKeyChar();
int code = event.getKeyCode();
//System.out.println((int)c + " " + code + " " + event);
//System.out.println();
if ((event.getModifiers() & CMD_SHIFT) != 0) {
if (c == '[') {
if ((event.getModifiers() & CMD_ALT) == CMD_ALT) {
if (code == KeyEvent.VK_LEFT) {
//if (c == '[') {
editor.sketch.prevCode();
return true;
} else if (c == ']') {
} else if (code == KeyEvent.VK_RIGHT) {
//} else if (c == ']') {
editor.sketch.nextCode();
return true;
}
}
return false;
}
*/
/**
+2 -3
View File
@@ -1643,9 +1643,8 @@ public class JEditTextArea extends JComponent
switch(evt.getID()) {
case KeyEvent.KEY_TYPED:
if ((editorListener != null) && !editorListener.keyTyped(evt)) {
inputHandler.keyTyped(evt);
}
//if ((editorListener != null) && !editorListener.keyTyped(evt)) {
inputHandler.keyTyped(evt);
break;
case KeyEvent.KEY_PRESSED:
if ((editorListener != null) && !editorListener.keyPressed(evt)) {
+6
View File
@@ -7,6 +7,12 @@ releases will be super crusty.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ABOUT REV 0125 - XX February 2007
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ABOUT REV 0124 - 4 February 2007
Bug fix bonanza! Something to distract our American audience from
+7 -2
View File
@@ -1,7 +1,8 @@
0125 pde
X prev/next tab conflicting with typing brackets on french macs
X http://dev.processing.org/bugs/show_bug.cgi?id=480
_ prev/next tab conflicting with typing brackets on french macs
_ http://dev.processing.org/bugs/show_bug.cgi?id=480
_ update to 1.4.2_12 on linux and windows
libraries and classpaths [1.0]
@@ -1045,6 +1046,10 @@ _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs
DIST / Mac OS X
_ for the .app file, $APP_PACKAGE will give the path
_ $JAVAROOT will give Contents/Resources/Java location
_ when marking a window as moddifed
_ getRootPane().putClientProperty(WINDOW_MODIFIED, Boolean.TRUE);
_ we're breaking some mac human interface guidelines
_ should be using a menu factory to create menubar for all sub-windows
_ http://developer.apple.com/technotes/tn/tn2042.html