diff --git a/src/main/java/eu/mihosoft/freerouting/autoroute/BatchAutorouter.java b/src/main/java/eu/mihosoft/freerouting/autoroute/BatchAutorouter.java index 2e43e1c..50b3f3a 100644 --- a/src/main/java/eu/mihosoft/freerouting/autoroute/BatchAutorouter.java +++ b/src/main/java/eu/mihosoft/freerouting/autoroute/BatchAutorouter.java @@ -131,7 +131,7 @@ public class BatchAutorouter break; } - Integer curr_pass_no = hdlg.get_settings().autoroute_settings.get_pass_no(); + Integer curr_pass_no = hdlg.get_settings().autoroute_settings.get_start_pass_no(); String start_message = resources.getString("batch_autorouter") + " " + resources.getString("stop_message") + " " + resources.getString("pass") + " " + curr_pass_no.toString() + ": "; hdlg.screen_messages.set_status_message(start_message); diff --git a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/AutorouteSettings.java b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/AutorouteSettings.java index 5e309f8..f46baef 100644 --- a/src/main/java/eu/mihosoft/freerouting/designforms/specctra/AutorouteSettings.java +++ b/src/main/java/eu/mihosoft/freerouting/designforms/specctra/AutorouteSettings.java @@ -93,7 +93,7 @@ public class AutorouteSettings } else if (next_token == Keyword.START_PASS_NO) { - result.set_pass_no(DsnFile.read_integer_scope(p_scanner)); + result.set_start_pass_no(DsnFile.read_integer_scope(p_scanner)); } else if (next_token == Keyword.LAYER_RULE) { @@ -280,7 +280,7 @@ public class AutorouteSettings p_file.new_line(); p_file.write("(start_pass_no "); { - Integer pass_no = p_settings.get_pass_no(); + Integer pass_no = p_settings.get_start_pass_no(); p_file.write(pass_no.toString()); } p_file.write(")"); diff --git a/src/main/java/eu/mihosoft/freerouting/gui/MainApplication.java b/src/main/java/eu/mihosoft/freerouting/gui/MainApplication.java index 740208b..2f9d5cc 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/MainApplication.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/MainApplication.java @@ -76,13 +76,11 @@ public class MainApplication extends javax.swing.JFrame board_option = BoardFrame.Option.SINGLE_FRAME; } - FRLogger.logger.info("Opening '"+startupOptions.design_input_filename +"'..."); + FRLogger.logger.info("Opening '"+startupOptions.design_input_filename+"'..."); DesignFile design_file = DesignFile.get_instance(startupOptions.design_input_filename, false); if (design_file == null) { - System.out.print(resources.getString("message_6") + " "); - System.out.print(startupOptions.design_input_filename); - System.out.println(" " + resources.getString("message_7")); + FRLogger.logger.error(resources.getString("message_6") + " " + startupOptions.design_input_filename + " " + resources.getString("message_7")); return; } String message = resources.getString("loading_design") + " " @@ -95,9 +93,17 @@ public class MainApplication extends javax.swing.JFrame welcome_window.dispose(); if (new_frame == null) { + FRLogger.logger.error("Couldn't create window frame"); System.exit(1); return; } + + if (startupOptions.pass_number_first > 0) { + new_frame.board_panel.board_handling.settings.autoroute_settings.set_start_pass_no(startupOptions.pass_number_first); + new_frame.board_panel.board_frame.autoroute_parameter_window.refresh(); + } + new_frame.board_panel.board_handling.settings.autoroute_settings.set_stop_pass_no(startupOptions.pass_number_last); + new_frame.addWindowListener(new java.awt.event.WindowAdapter() { diff --git a/src/main/java/eu/mihosoft/freerouting/gui/StartupOptions.java b/src/main/java/eu/mihosoft/freerouting/gui/StartupOptions.java index be1edd1..218636b 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/StartupOptions.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/StartupOptions.java @@ -1,5 +1,7 @@ package eu.mihosoft.freerouting.gui; +import eu.mihosoft.freerouting.logger.FRLogger; + import java.util.Locale; /** @@ -14,8 +16,8 @@ public class StartupOptions { String design_input_filename = null; String design_output_filename = null; String design_input_directory_name = null; - int pass_number_first = 1; - int pass_number_last = Integer.MAX_VALUE; + int pass_number_first = 0; + int pass_number_last = 99999; java.util.Locale current_locale = java.util.Locale.ENGLISH; private StartupOptions() { @@ -33,51 +35,46 @@ public class StartupOptions { private void process(String[] p_args) { for (int i = 0; i < p_args.length; ++i) { - - if (p_args[i].startsWith("-de")) + try { + if (p_args[i].startsWith("-de")) { + // the design file is provided + if (p_args.length > i + 1 && !p_args[i + 1].startsWith("-")) { + single_design_option = true; + design_input_filename = p_args[i + 1]; + } + } else if (p_args[i].startsWith("-di")) { + // the design directory is provided + if (p_args.length > i + 1 && !p_args[i + 1].startsWith("-")) { + design_input_directory_name = p_args[i + 1]; + } + } else if (p_args[i].startsWith("-do")) { + if (p_args.length > i + 1 && !p_args[i + 1].startsWith("-")) { + design_output_filename = p_args[i + 1]; + } + } else if (p_args[i].startsWith("-pf")) { + if (p_args.length > i + 1 && !p_args[i + 1].startsWith("-")) { + pass_number_first = Integer.decode(p_args[i + 1]); + } + } else if (p_args[i].startsWith("-pl")) { + if (p_args.length > i + 1 && !p_args[i + 1].startsWith("-")) { + pass_number_last = Integer.decode(p_args[i + 1]); + } + } else if (p_args[i].startsWith("-l")) { + // the locale is provided + if (p_args.length > i + 1 && p_args[i + 1].startsWith("d")) { + current_locale = java.util.Locale.GERMAN; + } + } else if (p_args[i].startsWith("-s")) { + session_file_option = true; + } else if (p_args[i].startsWith("-w")) { + webstart_option = true; + } else if (p_args[i].startsWith("-test")) { + test_version_option = true; + } + } + catch (Exception e) { - // the design file is provided - if (p_args.length > i + 1 && !p_args[i + 1].startsWith("-")) { - single_design_option = true; - design_input_filename = p_args[i + 1]; - } - } - else if (p_args[i].startsWith("-di")) { - // the design directory is provided - if (p_args.length > i + 1 && !p_args[i + 1].startsWith("-")) { - design_input_directory_name = p_args[i + 1]; - } - } - else if (p_args[i].startsWith("-do")) - { - if (p_args.length > i + 1 && !p_args[i + 1].startsWith("-")) { - design_output_filename = p_args[i + 1]; - } - } - else if (p_args[i].startsWith("-pf")) - { - if (p_args.length > i + 1 && !p_args[i + 1].startsWith("-")) { - pass_number_first = p_args[i + 1]; - } - } - else if (p_args[i].startsWith("-pl")) { - // the design directory is provided - if (p_args.length > i + 1 && !p_args[i + 1].startsWith("-")) { - pass_number_last = p_args[i + 1]; - } - } - else if (p_args[i].startsWith("-l")) - { - // the locale is provided - if (p_args.length > i + 1 && p_args[i + 1].startsWith("d")) { - current_locale = java.util.Locale.GERMAN; - } - } else if (p_args[i].startsWith("-s")) { - session_file_option = true; - } else if (p_args[i].startsWith("-w")) { - webstart_option = true; - } else if (p_args[i].startsWith("-test")) { - test_version_option = true; + FRLogger.logger.error("There was a problem parsing the '"+p_args[i]+"' parameter", e); } } } diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowAutorouteDetailParameter.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowAutorouteDetailParameter.java index 0494c65..f48b90c 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowAutorouteDetailParameter.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowAutorouteDetailParameter.java @@ -23,7 +23,6 @@ */ package eu.mihosoft.freerouting.gui; -import java.awt.*; import java.text.DecimalFormat; /** @@ -214,7 +213,7 @@ public class WindowAutorouteDetailParameter extends BoardSavableSubWindow this.via_cost_field.setValue(settings.get_via_costs()); this.plane_via_cost_field.setValue(settings.get_plane_via_costs()); this.start_ripup_costs.setValue(settings.get_start_ripup_costs()); - this.start_pass_no.setValue(settings.get_pass_no()); + this.start_pass_no.setValue(settings.get_start_pass_no()); for (int i = 0; i < preferred_direction_trace_cost_arr.length; ++i) { this.preferred_direction_trace_cost_arr[i].setValue(settings.get_preferred_direction_trace_costs(layer_structure.get_layer_no(i))); @@ -398,7 +397,7 @@ public class WindowAutorouteDetailParameter extends BoardSavableSubWindow { if (p_evt.getKeyChar() == '\n') { - int old_value = board_handling.settings.autoroute_settings.get_pass_no(); + int old_value = board_handling.settings.autoroute_settings.get_start_pass_no(); Object input = start_pass_no.getValue(); int input_value; if (input instanceof Number) @@ -416,13 +415,23 @@ public class WindowAutorouteDetailParameter extends BoardSavableSubWindow { input_value = old_value; } - board_handling.settings.autoroute_settings.set_pass_no(input_value); - start_pass_no.setValue(input_value); + set_start_pass_no(input_value); } } } + public void set_start_pass_no(int input_value) + { + board_handling.settings.autoroute_settings.set_start_pass_no(input_value); + start_pass_no.setValue(input_value); + } + + public void set_stop_pass_no(int input_value) + { + board_handling.settings.autoroute_settings.set_stop_pass_no(input_value); + } + private class StartPassFieldFocusListener implements java.awt.event.FocusListener { diff --git a/src/main/java/eu/mihosoft/freerouting/gui/WindowAutorouteParameter.java b/src/main/java/eu/mihosoft/freerouting/gui/WindowAutorouteParameter.java index b8e7725..6a585dc 100644 --- a/src/main/java/eu/mihosoft/freerouting/gui/WindowAutorouteParameter.java +++ b/src/main/java/eu/mihosoft/freerouting/gui/WindowAutorouteParameter.java @@ -290,7 +290,7 @@ public class WindowAutorouteParameter extends BoardSavableSubWindow { eu.mihosoft.freerouting.interactive.AutorouteSettings autoroute_settings = board_handling.settings.autoroute_settings; autoroute_settings.set_with_fanout(fanout_pass_button.isSelected()); - autoroute_settings.set_pass_no(1); + autoroute_settings.set_start_pass_no(1); } } @@ -301,7 +301,7 @@ public class WindowAutorouteParameter extends BoardSavableSubWindow { eu.mihosoft.freerouting.interactive.AutorouteSettings autoroute_settings = board_handling.settings.autoroute_settings; autoroute_settings.set_with_autoroute(autoroute_pass_button.isSelected()); - autoroute_settings.set_pass_no(1); + autoroute_settings.set_start_pass_no(1); } } @@ -312,7 +312,7 @@ public class WindowAutorouteParameter extends BoardSavableSubWindow { eu.mihosoft.freerouting.interactive.AutorouteSettings autoroute_settings = board_handling.settings.autoroute_settings; autoroute_settings.set_with_postroute(postroute_pass_button.isSelected()); - autoroute_settings.set_pass_no(1); + autoroute_settings.set_start_pass_no(1); } } } diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/AutorouteSettings.java b/src/main/java/eu/mihosoft/freerouting/interactive/AutorouteSettings.java index f48d940..2b84efe 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/AutorouteSettings.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/AutorouteSettings.java @@ -135,17 +135,23 @@ public class AutorouteSettings implements java.io.Serializable return start_ripup_costs; } - public void set_pass_no(int p_value) + public void set_start_pass_no(int p_value) { start_pass_no = Math.max(p_value, 1); start_pass_no = Math.min(start_pass_no, 99999); } - public int get_pass_no() + public int get_start_pass_no() { return start_pass_no; } + public void set_stop_pass_no(int p_value) + { + stop_pass_no = Math.max(p_value, 1); + stop_pass_no = Math.min(stop_pass_no, 99999); + } + public void increment_pass_no() { ++start_pass_no; @@ -347,6 +353,7 @@ public class AutorouteSettings implements java.io.Serializable private int plane_via_costs; private int start_ripup_costs; private int start_pass_no; + private int stop_pass_no; private final boolean[] layer_active_arr; private final boolean[] preferred_direction_is_horizontal_arr; private final double[] preferred_direction_trace_cost_arr; diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/BatchAutorouterThread.java b/src/main/java/eu/mihosoft/freerouting/interactive/BatchAutorouterThread.java index 2612972..74ab5af 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/BatchAutorouterThread.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/BatchAutorouterThread.java @@ -70,7 +70,7 @@ public class BatchAutorouterThread extends InteractiveActionThread hdlg.screen_messages.set_status_message(start_message); boolean fanout_first = hdlg.get_settings().autoroute_settings.get_with_fanout() && - hdlg.get_settings().autoroute_settings.get_pass_no() <= 1; + hdlg.get_settings().autoroute_settings.get_start_pass_no() <= 1; if (fanout_first) { BatchFanout.fanout_board(this); diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandling.java b/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandling.java index ad252c0..7862b3f 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandling.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/BoardHandling.java @@ -740,7 +740,7 @@ public class BoardHandling extends BoardHandlingImpl { // reset the start pass number in the autorouter in case // a batch autorouter is undone. - this.settings.autoroute_settings.set_pass_no(1); + this.settings.autoroute_settings.set_start_pass_no(1); } screen_messages.set_status_message(resources.getString("undo")); } diff --git a/src/main/java/eu/mihosoft/freerouting/interactive/ExpandTestState.java b/src/main/java/eu/mihosoft/freerouting/interactive/ExpandTestState.java index b7a315d..55b9ee2 100644 --- a/src/main/java/eu/mihosoft/freerouting/interactive/ExpandTestState.java +++ b/src/main/java/eu/mihosoft/freerouting/interactive/ExpandTestState.java @@ -205,7 +205,7 @@ public class ExpandTestState extends InteractiveState this.control_settings = new AutorouteControl(hdlg.get_routing_board(), route_net_no, hdlg.settings); // this.control_settings.ripup_allowed = true; // this.control_settings.is_fanout = true; - this.control_settings.ripup_pass_no = hdlg.settings.autoroute_settings.get_pass_no(); + this.control_settings.ripup_pass_no = hdlg.settings.autoroute_settings.get_start_pass_no(); this.control_settings.ripup_costs = this.control_settings.ripup_pass_no * hdlg.settings.autoroute_settings.get_start_ripup_costs(); this.control_settings.vias_allowed = false; this.autoroute_engine = new AutorouteEngine(board, this.control_settings.trace_clearance_class_no, false);