mirror of
https://github.com/processing/processing4.git
synced 2026-02-26 08:44:39 +01:00
fix window sizing for prefs and find/replace
This commit is contained in:
@@ -66,7 +66,6 @@ public class FindReplace extends JFrame {
|
||||
|
||||
public FindReplace(Editor editor) {
|
||||
super(Language.text("find"));
|
||||
setResizable(true);
|
||||
this.editor = editor;
|
||||
|
||||
Container pain = getContentPane();
|
||||
@@ -120,7 +119,7 @@ public class FindReplace extends JFrame {
|
||||
pain.setLayout(layout);
|
||||
layout.setAutoCreateGaps(true);
|
||||
layout.setAutoCreateContainerGaps(true);
|
||||
|
||||
|
||||
Group buttonsHorizontalGroup = layout.createSequentialGroup(); // To hold the buttons in the specified order depending on the OS
|
||||
|
||||
replaceAllButton = new JButton(Language.text("find.btn.replace_all"));
|
||||
@@ -160,7 +159,7 @@ public class FindReplace extends JFrame {
|
||||
}
|
||||
// pain.add(buttons);
|
||||
setFound(false);
|
||||
|
||||
|
||||
Group buttonsVerticalGroup = layout.createParallelGroup(); // Creates group for arranging buttons vertically
|
||||
buttonsVerticalGroup.addComponent(findButton)
|
||||
.addComponent(previousButton)
|
||||
@@ -257,7 +256,7 @@ public class FindReplace extends JFrame {
|
||||
Dimension screen = Toolkit.getScreenSize();
|
||||
setLocation((screen.width - size.width) / 2,
|
||||
(screen.height - size.height) / 2);
|
||||
|
||||
|
||||
replaceButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
replace();
|
||||
@@ -299,27 +298,29 @@ public class FindReplace extends JFrame {
|
||||
|
||||
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
handleClose();
|
||||
}
|
||||
});
|
||||
public void windowClosing(WindowEvent e) {
|
||||
handleClose();
|
||||
}
|
||||
});
|
||||
Toolkit.registerWindowCloseKeys(getRootPane(), new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
//hide();
|
||||
handleClose();
|
||||
}
|
||||
});
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
handleClose();
|
||||
}
|
||||
});
|
||||
Toolkit.setIcon(this);
|
||||
|
||||
// hack to to get first field to focus properly on osx
|
||||
addWindowListener(new WindowAdapter() {
|
||||
public void windowActivated(WindowEvent e) {
|
||||
//System.out.println("activating");
|
||||
/*boolean ok =*/ findField.requestFocusInWindow();
|
||||
//System.out.println("got " + ok);
|
||||
findField.selectAll();
|
||||
}
|
||||
});
|
||||
public void windowActivated(WindowEvent e) {
|
||||
//System.out.println("activating");
|
||||
/*boolean ok =*/ findField.requestFocusInWindow();
|
||||
//System.out.println("got " + ok);
|
||||
findField.selectAll();
|
||||
}
|
||||
});
|
||||
pack();
|
||||
setResizable(true);
|
||||
setLocationRelativeTo(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -379,11 +380,11 @@ public class FindReplace extends JFrame {
|
||||
}
|
||||
|
||||
try {
|
||||
Document doc = sketch.getCode(tabIndex + 1).getDocument();
|
||||
Document doc = sketch.getCode(tabIndex + 1).getDocument();
|
||||
if(doc != null) {
|
||||
text = doc.getText(0, doc.getLength()); // this thing has the latest changes
|
||||
}
|
||||
else {
|
||||
else {
|
||||
text = sketch.getCode(tabIndex + 1).getProgram(); // not this thing.
|
||||
}
|
||||
} catch (BadLocationException e) {
|
||||
@@ -430,11 +431,11 @@ public class FindReplace extends JFrame {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
Document doc = sketch.getCode(tabIndex - 1).getDocument();
|
||||
Document doc = sketch.getCode(tabIndex - 1).getDocument();
|
||||
if(doc != null) {
|
||||
text = doc.getText(0, doc.getLength()); // this thing has the latest changes
|
||||
}
|
||||
else {
|
||||
else {
|
||||
text = sketch.getCode(tabIndex - 1).getProgram(); // not this thing.
|
||||
}
|
||||
} catch (BadLocationException e) {
|
||||
@@ -513,11 +514,11 @@ public class FindReplace extends JFrame {
|
||||
editor.setSelection(0, 0);
|
||||
|
||||
boolean foundAtLeastOne = false;
|
||||
int startTab = -1, startIndex = -1, c = 50000;
|
||||
int startTab = -1, startIndex = -1, c = 50000;
|
||||
// you couldn't seriously be replacing 50K times o_O
|
||||
while (--c > 0) {
|
||||
if (find(false, false)) {
|
||||
if(editor.getSketch().getCurrentCodeIndex() == startTab
|
||||
if(editor.getSketch().getCurrentCodeIndex() == startTab
|
||||
&& editor.getSelectionStart() == startIndex){
|
||||
// we've reached where we started, so stop the replace
|
||||
Toolkit.beep();
|
||||
|
||||
@@ -96,7 +96,7 @@ public class PreferencesFrame {
|
||||
layout = new GroupLayout(pain);// pain ??
|
||||
// layout.setAutoCreateGaps(true);
|
||||
layout.setAutoCreateContainerGaps(true);
|
||||
|
||||
|
||||
// pain.setLayout(null);
|
||||
pain.setLayout(layout);
|
||||
|
||||
@@ -154,9 +154,9 @@ public class PreferencesFrame {
|
||||
|
||||
|
||||
// Language: [ English ] (requires restart of Processing)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Container languageBox = Box.createHorizontalBox();
|
||||
JLabel languageLabel = new JLabel(Language.text("preferences.language")+": ");
|
||||
// languageBox.add(languageLabel);
|
||||
@@ -365,7 +365,7 @@ public class PreferencesFrame {
|
||||
// right = Math.max(right, left + d.width);
|
||||
// top += d.height + GUI_BETWEEN;
|
||||
|
||||
|
||||
|
||||
|
||||
// [ ] Enable complex text input (for Japanese et al, requires restart)
|
||||
|
||||
@@ -651,10 +651,10 @@ public class PreferencesFrame {
|
||||
)
|
||||
.addComponent(preferenceHintLabel)
|
||||
);
|
||||
|
||||
layout.linkSize(okButton, cancelButton); //Making sure that Ok and Cancel buttons
|
||||
//are of the same size
|
||||
|
||||
|
||||
// Making sure that Ok and Cancel buttons are of the same size
|
||||
layout.linkSize(okButton, cancelButton);
|
||||
|
||||
layout.setVerticalGroup(layout
|
||||
.createSequentialGroup()
|
||||
.addComponent(sketchbookLocationLabel)
|
||||
@@ -721,35 +721,28 @@ public class PreferencesFrame {
|
||||
.addContainerGap()
|
||||
);
|
||||
dialog.getRootPane().setDefaultButton(okButton);
|
||||
|
||||
if(Base.isWindows()){
|
||||
|
||||
if (Base.isWindows()){
|
||||
autoAssociateBox.setVisible(true);
|
||||
}
|
||||
// closing the window is same as hitting cancel button
|
||||
|
||||
dialog.addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
disposeFrame();
|
||||
}
|
||||
});
|
||||
public void windowClosing(WindowEvent e) {
|
||||
disposeFrame();
|
||||
}
|
||||
});
|
||||
|
||||
ActionListener disposer = new ActionListener() {
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
disposeFrame();
|
||||
}
|
||||
};
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
disposeFrame();
|
||||
}
|
||||
};
|
||||
|
||||
Toolkit.registerWindowCloseKeys(dialog.getRootPane(), disposer);
|
||||
Toolkit.setIcon(dialog);
|
||||
// dialog.setResizable(true);
|
||||
Dimension screen = Toolkit.getScreenSize();
|
||||
high = (int) layout.preferredLayoutSize(dialog.getContentPane()).getHeight();
|
||||
wide = (int) layout.preferredLayoutSize(dialog.getContentPane()).getWidth();
|
||||
dialog.setLocation((screen.width - wide) / 2,
|
||||
(screen.height - high) / 2);
|
||||
|
||||
dialog.pack(); // get insets
|
||||
// Insets insets = dialog.getInsets();
|
||||
dialog.setSize(wide, high);
|
||||
dialog.pack();
|
||||
dialog.setLocationRelativeTo(null);
|
||||
|
||||
|
||||
// handle window closing commands for ctrl/cmd-W or hitting ESC.
|
||||
|
||||
1
todo.txt
1
todo.txt
@@ -39,6 +39,7 @@ _ https://github.com/processing/processing/issues/3212
|
||||
_ Find/Replace regressions
|
||||
_ https://github.com/processing/processing/issues/3213
|
||||
_ editor window draws in stages (at least on OS X) on first view
|
||||
_ the console/bottom area stays white until an additional repaint?
|
||||
X is debug turned on? lots of "export.txt" complaints
|
||||
_ remove export.txt complaints when loading libraries
|
||||
_ install/remove buttons not working in the managers
|
||||
|
||||
Reference in New Issue
Block a user