@@ -165,6 +165,25 @@ public String toString() {
165165 new Language (_ ("Western Frisian" ), "Western Frisian" , "fy" ),
166166 };
167167
168+ private static class WarningItem {
169+ private final String value ;
170+ private final String translation ;
171+
172+ public WarningItem (String value , String translation ) {
173+ this .value = value ;
174+ this .translation = translation ;
175+ }
176+
177+ public String getValue () {
178+ return value ;
179+ }
180+
181+ @ Override
182+ public String toString () {
183+ return translation ;
184+ }
185+ }
186+
168187 /**
169188 * Standardized width for buttons. Mac OS X 10.3 wants 70 as its default,
170189 * Windows XP needs 66, and my Ubuntu machine needs 80+, so 80 seems proper.
@@ -203,14 +222,14 @@ public String toString() {
203222 JCheckBox verboseCompilationBox ;
204223 JCheckBox verboseUploadBox ;
205224 JCheckBox displayLineNumbersBox ;
206- JCheckBox enableCompilerWarningsBox ;
207225 JCheckBox verifyUploadBox ;
208226 JCheckBox externalEditorBox ;
209227 JCheckBox checkUpdatesBox ;
210228 JTextField fontSizeField ;
211229 JCheckBox updateExtensionBox ;
212230 JCheckBox autoAssociateBox ;
213231 JComboBox comboLanguage ;
232+ JComboBox comboWarnings ;
214233 JCheckBox saveVerifyUploadBox ;
215234 JTextField proxyHTTPServer ;
216235 JTextField proxyHTTPPort ;
@@ -355,10 +374,22 @@ public void actionPerformed(ActionEvent e) {
355374
356375 // [ ] Enable all compiler warnings
357376
358- enableCompilerWarningsBox = new JCheckBox (_ ("Enable all compiler warnings" ));
359- pane .add (enableCompilerWarningsBox );
360- d = enableCompilerWarningsBox .getPreferredSize ();
361- enableCompilerWarningsBox .setBounds (left , top , d .width + 10 , d .height );
377+ box = Box .createHorizontalBox ();
378+ label = new JLabel (_ ("Compiler warnings: " ));
379+ box .add (label );
380+ WarningItem [] warningItems = new WarningItem []{new WarningItem ("none" , _ ("none" )), new WarningItem ("normal" , _ ("normal" )), new WarningItem ("all" , _ ("all" )), new WarningItem ("extra" , _ ("extra" )), };
381+ comboWarnings = new JComboBox (warningItems );
382+ String currentWarningLevel = PreferencesData .get ("compiler.warning_flags" , "none" );
383+ for (WarningItem item : warningItems ) {
384+ if (currentWarningLevel .equals (item .getValue ())) {
385+ comboWarnings .setSelectedItem (item );
386+ }
387+ }
388+ box .add (comboWarnings );
389+ pane .add (box );
390+ d = box .getPreferredSize ();
391+ box .setForeground (Color .gray );
392+ box .setBounds (left , top , d .width , d .height );
362393 right = Math .max (right , left + d .width );
363394 top += d .height + GUI_BETWEEN ;
364395
@@ -682,7 +713,6 @@ protected void applyFrame() {
682713 PreferencesData .setBoolean ("editor.linenumbers" , displayLineNumbersBox .isSelected ());
683714 PreferencesData .setBoolean ("upload.verify" , verifyUploadBox .isSelected ());
684715 PreferencesData .setBoolean ("editor.save_on_verify" , saveVerifyUploadBox .isSelected ());
685- PreferencesData .setBoolean ("build.allwarnings" , enableCompilerWarningsBox .isSelected ());
686716
687717// setBoolean("sketchbook.closing_last_window_quits",
688718// closingLastQuitsBox.isSelected());
@@ -740,6 +770,9 @@ protected void applyFrame() {
740770 Language newLanguage = (Language ) comboLanguage .getSelectedItem ();
741771 PreferencesData .set ("editor.languages.current" , newLanguage .isoCode );
742772
773+ WarningItem warningItem = (WarningItem ) comboWarnings .getSelectedItem ();
774+ PreferencesData .set ("compiler.warning_flags" , warningItem .getValue ());
775+
743776 Preferences .set ("proxy.http.server" , proxyHTTPServer .getText ());
744777 try {
745778 Preferences .set ("proxy.http.port" , Integer .valueOf (proxyHTTPPort .getText ()).toString ());
@@ -767,7 +800,6 @@ protected void showFrame(Editor editor) {
767800 verboseUploadBox .setSelected (PreferencesData .getBoolean ("upload.verbose" ));
768801 displayLineNumbersBox .setSelected (PreferencesData .getBoolean ("editor.linenumbers" ));
769802 verifyUploadBox .setSelected (PreferencesData .getBoolean ("upload.verify" ));
770- enableCompilerWarningsBox .setSelected (PreferencesData .getBoolean ("build.allwarnings" ));
771803
772804 //closingLastQuitsBox.
773805 // setSelected(getBoolean("sketchbook.closing_last_window_quits"));
0 commit comments