more tweaks for find/replace et al

This commit is contained in:
benfry
2011-04-16 16:49:28 +00:00
parent a2f56e0692
commit d732a5cbad
4 changed files with 45 additions and 50 deletions
+2 -2
View File
@@ -733,13 +733,13 @@ public abstract class Editor extends JFrame implements RunnerListener {
menu.add(item);
// For Arduino and Mac, this should be command-E, but that currently conflicts with Export Applet
item = new JMenuItem("Use Selection for Find");
item = Base.newJMenuItemAlt("Use Selection for Find", 'F');
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (find == null) {
find = new FindReplace(Editor.this);
}
find.setFindText( getSelectedText() );
find.setFindText(getSelectedText());
}
});
menu.add(item);
+10 -14
View File
@@ -178,18 +178,14 @@ public class FindReplace extends JFrame implements ActionListener {
ypos += buttonsDimension.height + EDGE;
// Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int wide = visibleButtonWidth + EDGE*2;
int high = ypos; // butt.y + butt.height + EDGE*2 + SMALL;
int high = ypos;
pack();
Insets insets = getInsets();
// System.out.println("Insets = " + insets);
setSize(wide + insets.left + insets.right,high + insets.top + insets.bottom);
setLocationRelativeTo( null ); // center
// setBounds((screen.width - wide) / 2, (screen.height - high) / 2, wide, high);
setLocationRelativeTo(null); // center
replaceButton.addActionListener(this);
replaceAllButton.addActionListener(this);
@@ -302,7 +298,7 @@ public class FindReplace extends JFrame implements ActionListener {
//int selectionStart = editor.textarea.getSelectionStart();
int selectionStart = editor.getSelectionStart()-1;
if ( selectionStart >= 0 ) {
if (selectionStart >= 0) {
nextIndex = text.lastIndexOf(search, selectionStart);
} else {
nextIndex = -1;
@@ -351,35 +347,35 @@ public class FindReplace extends JFrame implements ActionListener {
editor.setSelection(0, 0);
boolean foundAtLeastOne = false;
while ( true ) {
if ( find(false,false) ) {
while (true) {
if (find(false, false)) {
foundAtLeastOne = true;
replace();
} else {
break;
}
}
if ( !foundAtLeastOne ) {
if (!foundAtLeastOne) {
Toolkit.getDefaultToolkit().beep();
}
}
public void setFindText( String t ) {
findField.setText( t );
public void setFindText(String t) {
findField.setText(t);
findString = t;
}
public void findNext() {
if ( !find( wrapAround, false ) ) {
if (!find(wrapAround, false)) {
Toolkit.getDefaultToolkit().beep();
}
}
public void findPrevious() {
if ( !find( wrapAround, true ) ) {
if (!find(wrapAround, true)) {
Toolkit.getDefaultToolkit().beep();
}
}
+2 -2
View File
@@ -114,8 +114,8 @@ public class SketchCode {
protected boolean renameTo(File what, String ext) {
System.out.println("renaming " + file);
System.out.println(" to " + what);
// System.out.println("renaming " + file);
// System.out.println(" to " + what);
boolean success = file.renameTo(what);
if (success) {
this.file = what; // necessary?
+31 -32
View File
@@ -3,31 +3,40 @@ X upgrade to Quaqua 7.3.4 on OS X
X fixes checkbox in mode menu smashing into things
C build a new version of the reference
from peter n lewis
X Use Selection For Find
X http://code.google.com/p/processing/issues/detail?id=571
X double-clicking whitespace selects adjacent chars
X clicking i-- ) between -- and ) will select "-- )"
X in eclipse, it looks to see which is closest and selects that
X need to check behavior for word and bbedit
X http://code.google.com/p/processing/issues/detail?id=59
X http://code.google.com/p/processing/issues/detail?id=576
X find/replace all around very ugly, fix it up
o http://dev.processing.org/bugs/show_bug.cgi?id=67
X http://code.google.com/p/processing/issues/detail?id=23
X http://code.google.com/p/processing/issues/detail?id=580
X several tweaks
o http://dev.processing.org/bugs/show_bug.cgi?id=68
o only enable "find next" in menu after a find has happened
X http://code.google.com/p/processing/issues/detail?id=24
_ sketch marked as modified too aggressively
o http://dev.processing.org/bugs/show_bug.cgi?id=328
_ http://code.google.com/p/processing/issues/detail?id=57
_ "save" clears undo information
_ http://code.google.com/p/processing/issues/detail?id=411
The problem comes from Editor.java's UndoAction inner class. The updateUndoState() method marks a sketch as unmodified when the undo stack is exhausted. This made sense when the undo stack was cleared on save, but it is no longer correct.
Fix: remove lines 985-987 from Editor.java
_ PDE change indicator partially broken
_ http://code.google.com/p/processing/issues/detail?id=620
_ help casey re-export all applets for the site
_ remove .java files, use one central loading.gif and core.jar?
_ use a custom applet.html template for the export
_ the tool could copy this into the folder just before exporting
_ changing number of screens between run causes things to show up off-screen
_ so when running, check to make sure that things are out of the area
_ PDE change indicator partially broken
_ http://code.google.com/p/processing/issues/detail?id=620
from peter n lewis
Fixes from Peter N Lewis incorporated for the next release (0196 or 1.5, whichever comes first).
X Use Selection For Find
X http://code.google.com/p/processing/issues/detail?id=571
_ Double and Triple click and drag behaviour
_ http://code.google.com/p/processing/issues/detail?id=576
_ double-clicking whitespace selects adjacent chars
_ clicking i-- ) between -- and ) will select "-- )"
_ in eclipse, it looks to see which is closest and selects that
_ need to check behavior for word and bbedit
_ http://code.google.com/p/processing/issues/detail?id=59
_ Find Previous and FindReplace dialog cleanup
_ http://code.google.com/p/processing/issues/detail?id=580
_ bugs 67, 68, 69 (below) cover more of this
_ remove opengl2 for 1.5 and examples
@@ -147,11 +156,9 @@ _ http://code.google.com/p/processing/issues/detail?id=555
. . . .
_ "save" clears undo information
_ http://code.google.com/p/processing/issues/detail?id=411
The problem comes from Editor.java's UndoAction inner class. The updateUndoState() method marks a sketch as unmodified when the undo stack is exhausted. This made sense when the undo stack was cleared on save, but it is no longer correct.
Fix: remove lines 985-987 from Editor.java
_ changing number of screens between run causes things to show up off-screen
_ so when running, check to make sure that things are out of the area
_ saved window positions.. if displays has changed, becomes a problem
_ record the display that it was on?
_ GraphicsDevice gd = frame.getGraphicsConfiguration().getDevice();
@@ -162,9 +169,6 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=72
_ http://code.google.com/p/processing/issues/detail?id=27
Base.restoreSketches() has commented out code that checked for out of bounds windows with the preferences last.window.x and last.window.y. These prefs don't exist anymore, but it would be quick to implement it again using last.sketch<i>.location instead. It would probably result in less code, because it would mean we could get rid of the windowPositionValid stuff.
_ sketch marked as modified too aggressively
_ http://dev.processing.org/bugs/show_bug.cgi?id=328
. . . .
protected void finalize() throws Throwable {
@@ -1060,11 +1064,6 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=924
PDE / Find & Replace
_ all around very ugly, fix it up
_ http://dev.processing.org/bugs/show_bug.cgi?id=67
_ several tweaks
_ http://dev.processing.org/bugs/show_bug.cgi?id=68
_ only enable "find next" in menu after a find has happened
_ allowing to find & replace over multiple tabs
_ http://dev.processing.org/bugs/show_bug.cgi?id=69