mirror of
https://github.com/processing/processing4.git
synced 2026-02-15 03:15:40 +01:00
remove menu dimming (bug #786), other fixes
This commit is contained in:
@@ -926,16 +926,9 @@ public class Base {
|
||||
protected void rebuildSketchbookMenu(JMenu menu) {
|
||||
//System.out.println("rebuilding sketchbook menu");
|
||||
//new Exception().printStackTrace();
|
||||
boolean nativeButBroken = Base.isMacOS() ?
|
||||
Preferences.getBoolean("apple.laf.useScreenMenuBar") : false;
|
||||
|
||||
try {
|
||||
if (nativeButBroken) { // osx workaround
|
||||
menu.setEnabled(false);
|
||||
} else {
|
||||
menu.removeAll();
|
||||
addSketches(menu, getSketchbookFolder(), false);
|
||||
}
|
||||
menu.removeAll();
|
||||
addSketches(menu, getSketchbookFolder(), false);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -974,16 +967,9 @@ public class Base {
|
||||
|
||||
public void rebuildExamplesMenu(JMenu menu) {
|
||||
//System.out.println("rebuilding examples menu");
|
||||
boolean nativeButBroken = Base.isMacOS() ?
|
||||
Preferences.getBoolean("apple.laf.useScreenMenuBar") : false;
|
||||
|
||||
try {
|
||||
if (nativeButBroken) { // osx workaround
|
||||
menu.setEnabled(false);
|
||||
} else {
|
||||
menu.removeAll();
|
||||
addSketches(menu, examplesFolder, false);
|
||||
}
|
||||
menu.removeAll();
|
||||
addSketches(menu, examplesFolder, false);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -41,6 +41,11 @@ import javax.swing.event.*;
|
||||
import javax.swing.text.*;
|
||||
import javax.swing.undo.*;
|
||||
|
||||
//import org.netbeans.api.java.source.ui.DialogBinding;
|
||||
//import org.openide.filesystems.*;
|
||||
//import org.openide.loaders.DataObject;
|
||||
//import org.openide.text.CloneableEditorSupport;
|
||||
|
||||
|
||||
/**
|
||||
* Main editor panel for the Processing Development Environment.
|
||||
@@ -100,6 +105,9 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
EditorLineStatus lineStatus;
|
||||
|
||||
boolean newEditor = true;
|
||||
JEditorPane editorPane;
|
||||
|
||||
JEditTextArea textarea;
|
||||
EditorListener listener;
|
||||
|
||||
@@ -207,7 +215,22 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
lineStatus = new EditorLineStatus(textarea);
|
||||
consolePanel.add(lineStatus, BorderLayout.SOUTH);
|
||||
|
||||
// if (newEditor) {
|
||||
// try {
|
||||
// setupEditorPane();
|
||||
// upper.add(editorPane);
|
||||
// } catch (Exception e1) {
|
||||
// PrintWriter w = PApplet.createWriter(new File("/Users/fry/Desktop/blah.txt"));
|
||||
// w.println(e1.getMessage());
|
||||
// e1.printStackTrace(w);
|
||||
// w.flush();
|
||||
// w.close();
|
||||
//// e1.printStackTrace());
|
||||
//// e1.printStackTrace(System.out);
|
||||
// }
|
||||
// } else {
|
||||
upper.add(textarea);
|
||||
// }
|
||||
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
|
||||
upper, consolePanel);
|
||||
|
||||
@@ -323,6 +346,46 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// http://wiki.netbeans.org/DevFaqEditorCodeCompletionAnyJEditorPane
|
||||
void setupEditorPane() throws IOException {
|
||||
editorPane = new JEditorPane();
|
||||
|
||||
// This will find the Java editor kit and associate it with
|
||||
// our editor pane. But that does not give us code completion
|
||||
// just yet because we have no Java context (i.e. no class path, etc.).
|
||||
// However, this does give us syntax coloring.
|
||||
EditorKit kit = CloneableEditorSupport.getEditorKit("text/x-java");
|
||||
editorPane.setEditorKit(kit);
|
||||
|
||||
// You can specify any ".java" file.
|
||||
// If the file does not exist, it will be created.
|
||||
// The contents of the file does not matter.
|
||||
// The extension must be ".java", however.
|
||||
// String newSourcePath = "/Users/fry/Desktop/tmp.java";
|
||||
|
||||
// File tmpFile = new File(newSourcePath);
|
||||
// System.out.println(tmpFile.getParent() + " " + tmpFile.getName());
|
||||
// FileObject fob = FileUtil.createData(tmpFile);
|
||||
File tmpFile = File.createTempFile("temp", ".java");
|
||||
FileObject fob = FileUtil.toFileObject(FileUtil.normalizeFile(tmpFile));
|
||||
|
||||
DataObject dob = DataObject.find(fob);
|
||||
editorPane.getDocument().putProperty(Document.StreamDescriptionProperty, dob);
|
||||
|
||||
// This sets up a default class path for us so that
|
||||
// we can find all the JDK classes via code completion.
|
||||
DialogBinding.bindComponentToFile(fob, 0, 0, editorPane);
|
||||
|
||||
// Last but not least, we need to fill the editor pane with
|
||||
// some initial dummy code - as it seems somehow required to
|
||||
// kick-start code completion.
|
||||
// A simple dummy package declaration will do.
|
||||
editorPane.setText("package dummy;");
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
protected void setPlacement(int[] location) {
|
||||
setBounds(location[0], location[1], location[2], location[3]);
|
||||
if (location[4] != 0) {
|
||||
|
||||
@@ -48,6 +48,7 @@ public class Platform extends processing.app.Platform {
|
||||
|
||||
|
||||
public void init(Base base) {
|
||||
System.setProperty("apple.laf.useScreenMenuBar", "true");
|
||||
ThinkDifferent.init(base);
|
||||
/*
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user