Skip to content

Commit 53ab930

Browse files
committed
Merge remote-tracking branch 'cmaglie/new-extension' into new-extension
2 parents d338f22 + ccb318c commit 53ab930

File tree

10 files changed

+460
-29
lines changed

10 files changed

+460
-29
lines changed

.classpath

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<classpath>
33
<classpathentry excluding="processing/app/tools/format/|processing/app/tools/format/src/|processing/app/Trace.java|processing/app/RunnerClassLoader.java" kind="src" path="app/src"/>
44
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5-
<classpathentry combineaccessrules="false" kind="src" path="/core"/>
6-
<classpathentry kind="lib" path="build/shared/lib/antlr.jar"/>
7-
<classpathentry kind="lib" path="build/shared/lib/registry.jar"/>
8-
<classpathentry kind="lib" path="build/shared/lib/apple.jar"/>
5+
<classpathentry combineaccessrules="false" kind="src" path="/processing-core"/>
6+
<classpathentry kind="lib" path="app/lib/antlr.jar"/>
7+
<classpathentry kind="lib" path="app/lib/apple.jar"/>
8+
<classpathentry kind="lib" path="app/lib/ecj.jar"/>
9+
<classpathentry kind="lib" path="app/lib/jna.jar"/>
10+
<classpathentry kind="lib" path="app/lib/RXTXcomm.jar"/>
911
<classpathentry kind="output" path="app/bin"/>
1012
</classpath>

.settings/org.eclipse.jdt.core.prefs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
#Thu Jan 10 10:50:38 PST 2008
1+
#Tue Aug 16 19:08:40 CEST 2011
22
eclipse.preferences.version=1
3-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
4-
org.eclipse.jdt.core.compiler.compliance=1.4
5-
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
6-
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
7-
org.eclipse.jdt.core.compiler.source=1.3
3+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6+
org.eclipse.jdt.core.compiler.compliance=1.6
7+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
9+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12+
org.eclipse.jdt.core.compiler.source=1.6
813
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
914
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
1015
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16

app/src/processing/app/Base.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,17 @@ public void storeSketch(Editor editor) {
436436
// .................................................................
437437

438438

439+
/** Command on Mac OS X, Ctrl on Windows and Linux */
440+
static final int SHORTCUT_KEY_MASK =
441+
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
442+
/** Command-W on Mac OS X, Ctrl-W on Windows and Linux */
443+
static final KeyStroke WINDOW_CLOSE_KEYSTROKE =
444+
KeyStroke.getKeyStroke('W', SHORTCUT_KEY_MASK);
445+
/** Command-Option on Mac OS X, Ctrl-Alt on Windows and Linux */
446+
static final int SHORTCUT_ALT_KEY_MASK = ActionEvent.ALT_MASK |
447+
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
448+
449+
439450
// Because of variations in native windowing systems, no guarantees about
440451
// changes to the focused and active Windows can be made. Developers must
441452
// never assume that this Window is the focused or active Window until this

app/src/processing/app/Editor.java

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public class Editor extends JFrame implements RunnerListener {
9999
static SerialMenuListener serialMenuListener;
100100
static SerialMonitor serialMonitor;
101101

102+
Schematics schematics;
103+
102104
EditorHeader header;
103105
EditorStatus status;
104106
EditorConsole console;
@@ -625,6 +627,16 @@ public void actionPerformed(ActionEvent e) {
625627
// }
626628
// });
627629
// sketchMenu.add(item);
630+
631+
sketchMenu.addSeparator();
632+
633+
item = new JMenuItem("Show schematics");
634+
item.addActionListener(new ActionListener() {
635+
public void actionPerformed(ActionEvent e) {
636+
handleSchematics();
637+
}
638+
});
639+
sketchMenu.add(item);
628640

629641
sketchMenu.addSeparator();
630642

@@ -1841,9 +1853,11 @@ public void run() {
18411853
String appletClassName = sketch.build(false);
18421854
statusNotice("Done compiling.");
18431855
} catch (Exception e) {
1856+
status.unprogress();
18441857
statusError(e);
18451858
}
18461859

1860+
status.unprogress();
18471861
toolbar.deactivate(EditorToolbar.RUN);
18481862
}
18491863
}
@@ -1856,9 +1870,11 @@ public void run() {
18561870
String appletClassName = sketch.build(true);
18571871
statusNotice("Done compiling.");
18581872
} catch (Exception e) {
1873+
status.unprogress();
18591874
statusError(e);
18601875
}
18611876

1877+
status.unprogress();
18621878
toolbar.deactivate(EditorToolbar.RUN);
18631879
}
18641880
}
@@ -1890,7 +1906,6 @@ public Point getSketchLocation() {
18901906
return sketchWindowLocation;
18911907
}
18921908

1893-
18941909
/**
18951910
* Implements Sketch &rarr; Stop, or pressing Stop on the toolbar.
18961911
*/
@@ -1907,6 +1922,19 @@ public void handleStop() { // called by menu or buttons
19071922
}
19081923

19091924

1925+
public void handleSchematics() { // called by menu or buttons
1926+
//String s = sketch.getFolder().getAbsolutePath() + File.separator + sketch.getName() + ".png";
1927+
File file = new File(sketch.getFolder(), sketch.getName() + ".png");
1928+
if (file.exists()) {
1929+
if (schematics == null)
1930+
schematics = new Schematics(file);
1931+
schematics.showFrame(this);
1932+
} else {
1933+
statusNotice("This sketch doesn't include schematics");
1934+
}
1935+
}
1936+
1937+
19101938
/**
19111939
* Deactivate the Run button. This is called by Runner to notify that the
19121940
* sketch has stopped running, usually in response to an error (or maybe
@@ -2334,7 +2362,7 @@ synchronized public void handleExport(final boolean usingProgrammer) {
23342362
//if (!handleExportCheckModified()) return;
23352363
toolbar.activate(EditorToolbar.EXPORT);
23362364
console.clear();
2337-
statusNotice("Uploading to I/O Board...");
2365+
status.progress("Uploading to I/O Board...");
23382366

23392367
new Thread(usingProgrammer ? exportAppHandler : exportHandler).start();
23402368
}
@@ -2363,10 +2391,12 @@ public void run() {
23632391
} catch (RunnerException e) {
23642392
//statusError("Error during upload.");
23652393
//e.printStackTrace();
2394+
status.unprogress();
23662395
statusError(e);
23672396
} catch (Exception e) {
23682397
e.printStackTrace();
23692398
}
2399+
status.unprogress();
23702400
uploading = false;
23712401
//toolbar.clear();
23722402
toolbar.deactivate(EditorToolbar.EXPORT);
@@ -2397,10 +2427,12 @@ public void run() {
23972427
} catch (RunnerException e) {
23982428
//statusError("Error during upload.");
23992429
//e.printStackTrace();
2430+
status.unprogress();
24002431
statusError(e);
24012432
} catch (Exception e) {
24022433
e.printStackTrace();
24032434
}
2435+
status.unprogress();
24042436
uploading = false;
24052437
//toolbar.clear();
24062438
toolbar.deactivate(EditorToolbar.EXPORT);

app/src/processing/app/EditorStatus.java

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
4040
//static final int PROMPT = 2;
4141
//static final int EDIT = 3;
4242
static final int EDIT = 2;
43+
static final int PROGRESS = 5;
4344

4445
static final int YES = 1;
4546
static final int NO = 2;
@@ -66,6 +67,7 @@ public class EditorStatus extends JPanel /*implements ActionListener*/ {
6667
JButton cancelButton;
6768
JButton okButton;
6869
JTextField editField;
70+
JProgressBar progressBar;
6971

7072
//Thread promptThread;
7173
int response;
@@ -76,16 +78,22 @@ public EditorStatus(Editor editor) {
7678
empty();
7779

7880
if (bgcolor == null) {
79-
bgcolor = new Color[3]; //4];
81+
bgcolor = new Color[6];
8082
bgcolor[0] = Theme.getColor("status.notice.bgcolor");
8183
bgcolor[1] = Theme.getColor("status.error.bgcolor");
8284
bgcolor[2] = Theme.getColor("status.edit.bgcolor");
85+
bgcolor[3] = null;
86+
bgcolor[4] = null;
87+
bgcolor[5] = Theme.getColor("status.notice.bgcolor");
8388

84-
fgcolor = new Color[3]; //4];
89+
fgcolor = new Color[6];
8590
fgcolor[0] = Theme.getColor("status.notice.fgcolor");
8691
fgcolor[1] = Theme.getColor("status.error.fgcolor");
8792
fgcolor[2] = Theme.getColor("status.edit.fgcolor");
88-
}
93+
fgcolor[3] = null;
94+
fgcolor[4] = null;
95+
fgcolor[5] = Theme.getColor("status.notice.fgcolor");
96+
}
8997
}
9098

9199

@@ -163,6 +171,54 @@ public void unedit() {
163171
empty();
164172
}
165173

174+
public void progress(String message)
175+
{
176+
mode = PROGRESS;
177+
this.message = message;
178+
progressBar.setIndeterminate(false);
179+
progressBar.setVisible(true);
180+
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
181+
repaint();
182+
}
183+
184+
185+
public void progressIndeterminate(String message)
186+
{
187+
mode = PROGRESS;
188+
this.message = message;
189+
progressBar.setIndeterminate(true);
190+
progressBar.setValue(50);
191+
progressBar.setVisible(true);
192+
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
193+
repaint();
194+
}
195+
196+
197+
public void progressNotice(String message) {
198+
//mode = NOTICE;
199+
this.message = message;
200+
//update();
201+
repaint();
202+
}
203+
204+
205+
public void unprogress()
206+
{
207+
if (Preferences.getBoolean("editor.beep.compile")) {
208+
Toolkit.getDefaultToolkit().beep();
209+
}
210+
progressBar.setVisible(false);
211+
progressBar.setValue(0);
212+
setCursor(null);
213+
//empty();
214+
}
215+
216+
217+
public void progressUpdate(int value)
218+
{
219+
progressBar.setValue(value);
220+
repaint();
221+
}
166222

167223
/*
168224
public void update() {
@@ -369,6 +425,19 @@ public void keyTyped(KeyEvent event) {
369425
});
370426
add(editField);
371427
editField.setVisible(false);
428+
429+
progressBar = new JProgressBar(JScrollBar.HORIZONTAL);
430+
progressBar.setIndeterminate(false);
431+
if (Base.isMacOS()) {
432+
//progressBar.setBackground(bgcolor[PROGRESS]);
433+
//progressBar.putClientProperty("JProgressBar.style", "circular");
434+
}
435+
progressBar.setValue(0);
436+
progressBar.setBorderPainted(true);
437+
//progressBar.setStringPainted(true);
438+
add(progressBar);
439+
progressBar.setVisible(false);
440+
372441
}
373442
}
374443

@@ -385,11 +454,13 @@ protected void setButtonBounds() {
385454
//noButton.setLocation(noLeft, top);
386455
cancelButton.setLocation(cancelLeft, top);
387456
okButton.setLocation(noLeft, top);
457+
progressBar.setLocation(noLeft, top);
388458

389459
//yesButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
390460
//noButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
391461
cancelButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
392462
okButton.setSize(Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
463+
progressBar.setSize(2*Preferences.BUTTON_WIDTH, Preferences.BUTTON_HEIGHT);
393464

394465
// edit field height is awkward, and very different between mac and pc,
395466
// so use at least the preferred height for now.
@@ -398,6 +469,7 @@ protected void setButtonBounds() {
398469
int editTop = (1 + sizeH - editHeight) / 2; // add 1 for ceil
399470
editField.setBounds(yesLeft - Preferences.BUTTON_WIDTH, editTop,
400471
editWidth, editHeight);
472+
progressBar.setBounds(noLeft, editTop, editWidth, editHeight);
401473
}
402474

403475

0 commit comments

Comments
 (0)