Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master'
Conflicts:
	app/src/processing/app/Mode.java
	app/src/processing/app/PreferencesFrame.java
	app/src/processing/app/Sketch.java
	build/macosx/appbundler.jar
	build/shared/lib/defaults.txt
	build/shared/lib/languages/PDE_de.properties
	build/shared/lib/languages/PDE_es.properties
	todo.txt
  • Loading branch information
JayDusara committed Apr 10, 2015
commit e941eafbc84aa35190633d0fda336eebf5450d16
67 changes: 26 additions & 41 deletions app/src/processing/app/Mode.java
Original file line number Diff line number Diff line change
Expand Up @@ -654,28 +654,28 @@ public DefaultMutableTreeNode buildExamplesTree() {

try {

DefaultMutableTreeNode modeExParent = new DefaultMutableTreeNode("Mode Examples");
File[] examples = getExampleCategoryFolders();

for (File sub : subfolders) {
DefaultMutableTreeNode subNode = new DefaultMutableTreeNode(sub.getName());
if (base.addSketches(subNode, sub)) {
// examplesParent.add(subNode);
modeExParent.add(subNode);
for (File subFolder : examples) {
DefaultMutableTreeNode subNode = new DefaultMutableTreeNode(subFolder.getName());
if (base.addSketches(subNode, subFolder)) {
root.add(subNode);
}
}

// get library examples
boolean any = false;
DefaultMutableTreeNode foundationLibraries = new DefaultMutableTreeNode("Core Libraries");

// Get examples for core libraries
for (Library lib : coreLibraries) {
if (lib.hasExamples()) {
DefaultMutableTreeNode libNode = new DefaultMutableTreeNode(lib.getName());
if (base.addSketches(libNode, lib.getExamplesFolder()))
foundationLibraries.add(libNode);
}
}

if (modeExParent.getChildCount() > 0)
node.add(modeExParent);
if(foundationLibraries.getChildCount() > 0) {
root.add(foundationLibraries);
}

// Get examples for third party libraries
DefaultMutableTreeNode contributed = new DefaultMutableTreeNode("Libraries");
Expand All @@ -693,10 +693,7 @@ public DefaultMutableTreeNode buildExamplesTree() {
e.printStackTrace();
}

DefaultMutableTreeNode contribExampleNode = buildContributedExamplesTrees();
if (contribExampleNode.getChildCount() > 0)
node.add(contribExampleNode);
return node;
return root;
}

public void resetExamples() {
Expand Down Expand Up @@ -822,19 +819,16 @@ public void actionPerformed(ActionEvent e) {
examplesPanel.setLayout(new BorderLayout());
examplesPanel.setBackground(Color.WHITE);

final JPanel openExamplesManagerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JLabel openExamplesManagerLabel = new JLabel(Language.text("examples.add_examples"));
// openExamplesManagerLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
openExamplesManagerPanel.add(openExamplesManagerLabel);
final JPanel openExamplesManagerPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JButton addExamplesButton = new JButton(Language.text("examples.add_examples"));
openExamplesManagerPanel.add(addExamplesButton);
openExamplesManagerPanel.setOpaque(false);
Border lineBorder = BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK);
Border paddingBorder = BorderFactory.createEmptyBorder(3, 5, 1, 4);
openExamplesManagerPanel.setBorder(BorderFactory.createCompoundBorder(lineBorder, paddingBorder));
openExamplesManagerPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
openExamplesManagerPanel.setCursor(new Cursor(Cursor.HAND_CURSOR));
// openExamplesManagerLabel.setForeground(new Color(0, 0, 238));
openExamplesManagerPanel.addMouseListener(new MouseAdapter() {

addExamplesButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
base.handleOpenExampleManager();
Expand Down Expand Up @@ -1084,14 +1078,14 @@ public void rebuildTree() {
* Called from updateInernal in Base.java
*/
public void updateTree(String sketchName, File sketchFolder) {
File f = new File(sketchFolder.getAbsolutePath() + "\\" + sketchName
+ ".pde");
if (model != null) {
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
SketchReference reference = new SketchReference(sketchName, f);
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(reference);
root.add(newNode);
model.reload(root);
File f = new File(sketchFolder.getAbsolutePath() + "\\" + sketchName
+ ".pde");
if (model != null) {
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
SketchReference reference = new SketchReference(sketchName, f);
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(reference);
root.add(newNode);
model.reload(root);
}
}

Expand All @@ -1106,10 +1100,7 @@ public void actionPerformed(ActionEvent e) {
}
});

sketchbookFrame.getContentPane().setLayout(new BorderLayout());
DefaultMutableTreeNode root = buildSketchbookTree();
model = new DefaultTreeModel(root);
final JTree tree = new JTree(model);
final JTree tree = new JTree(buildSketchbookTree());
tree.getSelectionModel()
.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.setShowsRootHandles(true);
Expand Down Expand Up @@ -1149,10 +1140,6 @@ public void keyTyped(KeyEvent e) {
base.handleOpen(sketch.getPath());
}
}

if (e.getKeyChar() == KeyEvent.VK_SPACE) {
rebuildTree();
}
}
});

Expand All @@ -1165,9 +1152,7 @@ public void keyTyped(KeyEvent e) {
JScrollPane treePane = new JScrollPane(tree);
treePane.setPreferredSize(new Dimension(250, 450));
treePane.setBorder(new EmptyBorder(0, 0, 0, 0));
JLabel refreshLabel = new JLabel("Press SPACE to refresh");
sketchbookFrame.getContentPane().add(refreshLabel, BorderLayout.SOUTH);
sketchbookFrame.getContentPane().add(treePane, BorderLayout.CENTER);
sketchbookFrame.getContentPane().add(treePane);
sketchbookFrame.pack();
}

Expand Down
38 changes: 19 additions & 19 deletions app/src/processing/app/Sketch.java
Original file line number Diff line number Diff line change
Expand Up @@ -330,25 +330,25 @@ public void handleRenameCode() {
promptForTabName(prompt+":", oldName);
mode.rebuildTree();
}

/**
* Displays a dialog for renaming or creating a new tab
* @param prompt - msg to display
* @param oldName
*/
protected void promptForTabName(String prompt, String oldName) {
final JTextField field = new JTextField(oldName);

field.addKeyListener(new KeyAdapter() {
// Forget ESC, the JDialog should handle it.
// Use keyTyped to catch when the feller is actually added to the text
// field. With keyTyped, as opposed to keyPressed, the keyCode will be
// zero, even if it's enter or backspace or whatever, so the keychar
// Use keyTyped to catch when the feller is actually added to the text
// field. With keyTyped, as opposed to keyPressed, the keyCode will be
// zero, even if it's enter or backspace or whatever, so the keychar
// should be used instead. Grr.
public void keyTyped(KeyEvent event) {
//System.out.println("got event " + event);
char ch = event.getKeyChar();
if ((ch == '_') || (ch == '.') || // allow.pde and .java
if ((ch == '_') || (ch == '.') || // allow.pde and .java
(('A' <= ch) && (ch <= 'Z')) || (('a' <= ch) && (ch <= 'z'))) {
// These events are allowed straight through.
} else if (ch == ' ') {
Expand All @@ -364,28 +364,28 @@ public void keyTyped(KeyEvent event) {
// getSelectionStart means that it *will be* the first
// char, because the selection is about to be replaced
// with whatever is typed.
if (field.getCaretPosition() == 0 ||
if (field.getCaretPosition() == 0 ||
field.getSelectionStart() == 0) {
// number not allowed as first digit
event.consume();
}
} else if (ch == KeyEvent.VK_ENTER) {
// Slightly ugly hack that ensures OK button of the dialog consumes
// Slightly ugly hack that ensures OK button of the dialog consumes
// the Enter key event. Since the text field is the default component
// in the dialog, OK doesn't consume Enter key event, by default.
Container parent = field.getParent();
while (!(parent instanceof JOptionPane)) {
parent = parent.getParent();
}
JOptionPane pane = (JOptionPane) parent;
final JPanel pnlBottom = (JPanel)
final JPanel pnlBottom = (JPanel)
pane.getComponent(pane.getComponentCount() - 1);
for (int i = 0; i < pnlBottom.getComponents().length; i++) {
Component component = pnlBottom.getComponents()[i];
if (component instanceof JButton) {
final JButton okButton = (JButton) component;
if (okButton.getText().equalsIgnoreCase("OK")) {
ActionListener[] actionListeners =
ActionListener[] actionListeners =
okButton.getActionListeners();
if (actionListeners.length > 0) {
actionListeners[0].actionPerformed(null);
Expand Down Expand Up @@ -622,12 +622,12 @@ public void handleDeleteCode() {
}

// don't allow if untitled
if (currentIndex == 0 && isUntitled()) {
if (currentIndex == 0 && isUntitled()) {
Base.showMessage(Language.text("delete.messages.cannot_delete"),
Language.text("delete.messages.cannot_delete.description"));
return;
}

// confirm deletion with user, yes/no
Object[] options = { Language.text("prompt.ok"), Language.text("prompt.cancel") };
String prompt = (currentIndex == 0) ?
Expand Down Expand Up @@ -799,7 +799,7 @@ public boolean save() throws IOException {
protected boolean saveAs() throws IOException {
String newParentDir = null;
String newName = null;

final String oldName2 = folder.getName();
// TODO rewrite this to use shared version from PApplet
final String PROMPT = Language.text("save");
Expand Down Expand Up @@ -935,21 +935,21 @@ public boolean accept(File file) {
return true;
}
});


final File newFolder2 = newFolder;
final File[] copyItems2 = copyItems;
final String newName2 = newName;
final String newName2 = newName;

// Create a new event dispatch thread- to display ProgressBar
// while Saving As
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
new ProgressFrame(copyItems2, newFolder2, oldName2, newName2, editor);
}
});


// save the other tabs to their new location
for (int i = 1; i < codeCount; i++) {
File newFile = new File(newFolder, code[i].getFileName());
Expand Down Expand Up @@ -987,7 +987,7 @@ public void run() {
*/
protected void updateInternal(String sketchName, File sketchFolder) {
// reset all the state information for the sketch object
String oldPath = getMainFilePath();
String oldPath = getMainFilePath();
primaryFile = code[0].getFile();
// String newPath = getMainFilePath();
// editor.base.renameRecent(oldPath, newPath);
Expand Down
Binary file modified build/macosx/appbundler.jar
Binary file not shown.
10 changes: 10 additions & 0 deletions build/shared/lib/defaults.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,22 @@ editor.untitled.suffix=yyMMdd
# GTK isn't for everyone (and KDE users will get Metal or some
# such anyway, so this is now broken out as an option
# Linux is by default even uglier than metal (Motif?).
<<<<<<< HEAD
# Actually, i'm using native menus, so they're even uglier
# and Motif-looking (Lesstif?). Ick. Need to fix this.
# For 0120, trying out the gtk+ look and feel as the default.
# This is available in Java 1.4.2 and later, and it can't possibly
# be any worse than Metal. (Ocean might also work, but that's for
# Java 1.5, and we aren't going there yet)
editor.laf.linux = com.sun.java.swing.plaf.gtk.GTKLookAndFeel
=======
#editor.laf.linux = com.sun.java.swing.plaf.gtk.GTKLookAndFeel
# Trying Nimbus in 3.0a6 because the GTK menus are really dreadful.
# Unfortunately, the Nimbus scrollbars are really gross, but...
# As always, people can override on their own, or the next step
# is to do a Synth LAF that gives us something not awful.
editor.laf.linux = javax.swing.plaf.nimbus.NimbusLookAndFeel
>>>>>>> refs/remotes/upstream/master


# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand Down
4 changes: 4 additions & 0 deletions build/shared/lib/languages/PDE_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ preferences.hide_toolbar_background_image = Hintergrundgrafik der Toolbar ausble
preferences.check_for_updates_on_startup = Prüfung auf Updates bei Programmstart
preferences.run_sketches_on_display = Starte Sketch auf Bildschirm
preferences.run_sketches_on_display.tip = \
<<<<<<< HEAD
Bestimme den Bildschirm auf dem der Sketch dargestellt werden soll.
=======
Bestimme den Bildschirm auf dem der Sketch dargestellt werden soll.\
>>>>>>> refs/remotes/upstream/master
Wenn das Fenster des Sketches auf einen anderen Bildschirm geschoben<br>\
wird, so wird der Sketch an selber Stelle wieder geöffnet. Dabei ist es<br>\
egal, ob der Sketch im Present-Modus (Fullscreen) geöffnet wird.
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.