Skip to content

Commit 65a4411

Browse files
committed
more tweaks for find/replace et al
1 parent cec8209 commit 65a4411

File tree

4 files changed

+45
-50
lines changed

4 files changed

+45
-50
lines changed

app/src/processing/app/Editor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,13 +733,13 @@ public void actionPerformed(ActionEvent e) {
733733
menu.add(item);
734734

735735
// For Arduino and Mac, this should be command-E, but that currently conflicts with Export Applet
736-
item = new JMenuItem("Use Selection for Find");
736+
item = Base.newJMenuItemAlt("Use Selection for Find", 'F');
737737
item.addActionListener(new ActionListener() {
738738
public void actionPerformed(ActionEvent e) {
739739
if (find == null) {
740740
find = new FindReplace(Editor.this);
741741
}
742-
find.setFindText( getSelectedText() );
742+
find.setFindText(getSelectedText());
743743
}
744744
});
745745
menu.add(item);

app/src/processing/app/FindReplace.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,14 @@ public void focusLost(FocusEvent e) {
178178

179179
ypos += buttonsDimension.height + EDGE;
180180

181-
// Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
182-
183181
int wide = visibleButtonWidth + EDGE*2;
184-
int high = ypos; // butt.y + butt.height + EDGE*2 + SMALL;
182+
int high = ypos;
185183

186184
pack();
187185
Insets insets = getInsets();
188-
// System.out.println("Insets = " + insets);
189186
setSize(wide + insets.left + insets.right,high + insets.top + insets.bottom);
190187

191-
setLocationRelativeTo( null ); // center
192-
// setBounds((screen.width - wide) / 2, (screen.height - high) / 2, wide, high);
188+
setLocationRelativeTo(null); // center
193189

194190
replaceButton.addActionListener(this);
195191
replaceAllButton.addActionListener(this);
@@ -302,7 +298,7 @@ private boolean find(boolean wrap, boolean backwards) {
302298
//int selectionStart = editor.textarea.getSelectionStart();
303299
int selectionStart = editor.getSelectionStart()-1;
304300

305-
if ( selectionStart >= 0 ) {
301+
if (selectionStart >= 0) {
306302
nextIndex = text.lastIndexOf(search, selectionStart);
307303
} else {
308304
nextIndex = -1;
@@ -351,35 +347,35 @@ public void replaceAll() {
351347
editor.setSelection(0, 0);
352348

353349
boolean foundAtLeastOne = false;
354-
while ( true ) {
355-
if ( find(false,false) ) {
350+
while (true) {
351+
if (find(false, false)) {
356352
foundAtLeastOne = true;
357353
replace();
358354
} else {
359355
break;
360356
}
361357
}
362-
if ( !foundAtLeastOne ) {
358+
if (!foundAtLeastOne) {
363359
Toolkit.getDefaultToolkit().beep();
364360
}
365361
}
366362

367363

368-
public void setFindText( String t ) {
369-
findField.setText( t );
364+
public void setFindText(String t) {
365+
findField.setText(t);
370366
findString = t;
371367
}
372368

373369

374370
public void findNext() {
375-
if ( !find( wrapAround, false ) ) {
371+
if (!find(wrapAround, false)) {
376372
Toolkit.getDefaultToolkit().beep();
377373
}
378374
}
379375

380376

381377
public void findPrevious() {
382-
if ( !find( wrapAround, true ) ) {
378+
if (!find(wrapAround, true)) {
383379
Toolkit.getDefaultToolkit().beep();
384380
}
385381
}

app/src/processing/app/SketchCode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ protected boolean deleteFile() {
114114

115115

116116
protected boolean renameTo(File what, String ext) {
117-
System.out.println("renaming " + file);
118-
System.out.println(" to " + what);
117+
// System.out.println("renaming " + file);
118+
// System.out.println(" to " + what);
119119
boolean success = file.renameTo(what);
120120
if (success) {
121121
this.file = what; // necessary?

todo.txt

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,40 @@ X upgrade to Quaqua 7.3.4 on OS X
33
X fixes checkbox in mode menu smashing into things
44
C build a new version of the reference
55

6+
from peter n lewis
7+
X Use Selection For Find
8+
X http://code.google.com/p/processing/issues/detail?id=571
9+
X double-clicking whitespace selects adjacent chars
10+
X clicking i-- ) between -- and ) will select "-- )"
11+
X in eclipse, it looks to see which is closest and selects that
12+
X need to check behavior for word and bbedit
13+
X http://code.google.com/p/processing/issues/detail?id=59
14+
X http://code.google.com/p/processing/issues/detail?id=576
15+
X find/replace all around very ugly, fix it up
16+
o http://dev.processing.org/bugs/show_bug.cgi?id=67
17+
X http://code.google.com/p/processing/issues/detail?id=23
18+
X http://code.google.com/p/processing/issues/detail?id=580
19+
X several tweaks
20+
o http://dev.processing.org/bugs/show_bug.cgi?id=68
21+
o only enable "find next" in menu after a find has happened
22+
X http://code.google.com/p/processing/issues/detail?id=24
23+
24+
_ sketch marked as modified too aggressively
25+
o http://dev.processing.org/bugs/show_bug.cgi?id=328
26+
_ http://code.google.com/p/processing/issues/detail?id=57
27+
_ "save" clears undo information
28+
_ http://code.google.com/p/processing/issues/detail?id=411
29+
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.
30+
Fix: remove lines 985-987 from Editor.java
31+
_ PDE change indicator partially broken
32+
_ http://code.google.com/p/processing/issues/detail?id=620
33+
34+
635
_ help casey re-export all applets for the site
736
_ remove .java files, use one central loading.gif and core.jar?
837
_ use a custom applet.html template for the export
938
_ the tool could copy this into the folder just before exporting
1039

11-
_ changing number of screens between run causes things to show up off-screen
12-
_ so when running, check to make sure that things are out of the area
13-
14-
_ PDE change indicator partially broken
15-
_ http://code.google.com/p/processing/issues/detail?id=620
16-
17-
from peter n lewis
18-
Fixes from Peter N Lewis incorporated for the next release (0196 or 1.5, whichever comes first).
19-
X Use Selection For Find
20-
X http://code.google.com/p/processing/issues/detail?id=571
21-
_ Double and Triple click and drag behaviour
22-
_ http://code.google.com/p/processing/issues/detail?id=576
23-
_ double-clicking whitespace selects adjacent chars
24-
_ clicking i-- ) between -- and ) will select "-- )"
25-
_ in eclipse, it looks to see which is closest and selects that
26-
_ need to check behavior for word and bbedit
27-
_ http://code.google.com/p/processing/issues/detail?id=59
28-
_ Find Previous and FindReplace dialog cleanup
29-
_ http://code.google.com/p/processing/issues/detail?id=580
30-
_ bugs 67, 68, 69 (below) cover more of this
3140

3241
_ remove opengl2 for 1.5 and examples
3342

@@ -147,11 +156,9 @@ _ http://code.google.com/p/processing/issues/detail?id=555
147156

148157
. . . .
149158

150-
_ "save" clears undo information
151-
_ http://code.google.com/p/processing/issues/detail?id=411
152-
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.
153-
Fix: remove lines 985-987 from Editor.java
154159

160+
_ changing number of screens between run causes things to show up off-screen
161+
_ so when running, check to make sure that things are out of the area
155162
_ saved window positions.. if displays has changed, becomes a problem
156163
_ record the display that it was on?
157164
_ GraphicsDevice gd = frame.getGraphicsConfiguration().getDevice();
@@ -162,9 +169,6 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=72
162169
_ http://code.google.com/p/processing/issues/detail?id=27
163170
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.
164171

165-
_ sketch marked as modified too aggressively
166-
_ http://dev.processing.org/bugs/show_bug.cgi?id=328
167-
168172
. . . .
169173

170174
protected void finalize() throws Throwable {
@@ -1060,11 +1064,6 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=924
10601064

10611065
PDE / Find & Replace
10621066

1063-
_ all around very ugly, fix it up
1064-
_ http://dev.processing.org/bugs/show_bug.cgi?id=67
1065-
_ several tweaks
1066-
_ http://dev.processing.org/bugs/show_bug.cgi?id=68
1067-
_ only enable "find next" in menu after a find has happened
10681067
_ allowing to find & replace over multiple tabs
10691068
_ http://dev.processing.org/bugs/show_bug.cgi?id=69
10701069

0 commit comments

Comments
 (0)