Merge pull request #2 from miho/master

Merge with upstream
This commit is contained in:
Andras 2020-02-04 10:37:41 +01:00 committed by GitHub
commit 5a6e081b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 2038 additions and 1943 deletions

2
.gitignore vendored
View File

@ -5,5 +5,5 @@ out
.idea/
freerouting.iml
tmp
/logs/

View File

@ -62,6 +62,9 @@ dependencies {
compile group: 'javax.help', name: 'javahelp', version: '2.0.05'
// compile files("./lib/eu.mihosoft.freerouting.deps.jh.jar")
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.13.0'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.0'
}
// ext.moduleName = 'eu.mihosoft.freerouting'
@ -172,3 +175,4 @@ task run(type: JavaExec) {
// args 'appArg1'
// jvmArgs 'arg1'
}

View File

@ -2,7 +2,7 @@
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>eu.mihosoft.freerouting.gui</headerType>
<jar>F:\stuff\freerouting.freerouting\build\FreeRouting.jar</jar>
<jar>.\build\libs\FreeRouting.jar</jar>
<outfile>FreeRouting.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>

View File

@ -0,0 +1,4 @@
package eu.mihosoft.freerouting;
public class FreeRouting {
}

View File

@ -37,6 +37,7 @@ import eu.mihosoft.freerouting.board.RoutingBoard;
import eu.mihosoft.freerouting.interactive.BoardHandling;
import eu.mihosoft.freerouting.interactive.InteractiveActionThread;
import eu.mihosoft.freerouting.logger.FRLogger;
/**
* Handles the sequencing of the batch eu.mihosoft.freerouting.autoroute passes.
@ -126,7 +127,9 @@ public class BatchAutorouter
Integer curr_pass_no = hdlg.get_settings().autoroute_settings.get_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);
FRLogger.traceEntry("BatchAutorouter.autoroute_pass("+curr_pass_no+")");
still_unrouted_items = autoroute_pass(curr_pass_no, true);
FRLogger.traceExit("BatchAutorouter.autoroute_pass("+curr_pass_no+")");
if (still_unrouted_items && !is_interrupted)
{
hdlg.get_settings().autoroute_settings.increment_pass_no();

View File

@ -41,6 +41,7 @@ import eu.mihosoft.freerouting.datastructures.ShapeTree.TreeEntry;
import eu.mihosoft.freerouting.library.BoardLibrary;
import eu.mihosoft.freerouting.library.Padstack;
import eu.mihosoft.freerouting.logger.FRLogger;
import eu.mihosoft.freerouting.rules.BoardRules;
import eu.mihosoft.freerouting.boardgraphics.GraphicsContext;
import eu.mihosoft.freerouting.boardgraphics.Drawable;
@ -1386,6 +1387,8 @@ public class BasicBoard implements java.io.Serializable
*/
public void generate_snapshot()
{
FRLogger.logger.info("Generating snapshot");
item_list.generate_snapshot();
components.generate_snapshot();
}

View File

@ -308,6 +308,8 @@ public class BoardFrame extends javax.swing.JFrame
{
return false;
}
FRLogger.logger.info("Saving '"+design_file.get_output_file().getName()+"'...");
java.io.OutputStream output_stream = null;
java.io.ObjectOutputStream object_stream = null;
try
@ -380,7 +382,7 @@ public class BoardFrame extends javax.swing.JFrame
String help_id = "html_files." + p_help_id;
javax.help.CSH.setHelpIDString(curr_component, help_id);
if (help_broker==null) {
FRLogger.warning("help_broker is null");
FRLogger.logger.warn("help_broker is null");
return;
}
help_broker.enableHelpKey(curr_component, help_id, help_set);

View File

@ -22,6 +22,8 @@
*/
package eu.mihosoft.freerouting.gui;
import eu.mihosoft.freerouting.logger.FRLogger;
/**
* Creates the file menu of a eu.mihosoft.freerouting.board frame.
*
@ -67,7 +69,6 @@ public class BoardMenuFile extends javax.swing.JMenu
save_and_exit_item.setToolTipText(file_menu.resources.getString("save_and_exit_tooltip"));
save_and_exit_item.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
if (file_menu.session_file_option)
@ -237,6 +238,7 @@ public class BoardMenuFile extends javax.swing.JMenu
}
else
{
board_frame.screen_messages.set_status_message(resources.getString("message_9"));
board_frame.board_panel.board_handling.start_logfile(filename);
}
@ -272,24 +274,25 @@ public class BoardMenuFile extends javax.swing.JMenu
{
java.io.OutputStream output_stream = null;
java.io.File defaults_file = new java.io.File(board_frame.design_file.get_parent(), BoardFrame.GUI_DEFAULTS_FILE_NAME);
if (defaults_file.exists())
FRLogger.logger.info("Saving '"+BoardFrame.GUI_DEFAULTS_FILE_NAME+"'...");
java.io.File defaults_file = new java.io.File(board_frame.design_file.get_parent(), BoardFrame.GUI_DEFAULTS_FILE_NAME);
if (defaults_file.exists())
{
// Make a backup copy of the old defaulds file.
java.io.File defaults_file_backup = new java.io.File(board_frame.design_file.get_parent(), BoardFrame.GUI_DEFAULTS_FILE_BACKUP_NAME);
if (defaults_file_backup.exists())
{
// Make a backup copy of the old defaulds file.
java.io.File defaults_file_backup = new java.io.File(board_frame.design_file.get_parent(), BoardFrame.GUI_DEFAULTS_FILE_BACKUP_NAME);
if (defaults_file_backup.exists())
{
defaults_file_backup.delete();
}
defaults_file.renameTo(defaults_file_backup);
}
try
{
output_stream = new java.io.FileOutputStream(defaults_file);
} catch (Exception e)
{
output_stream = null;
defaults_file_backup.delete();
}
defaults_file.renameTo(defaults_file_backup);
}
try
{
output_stream = new java.io.FileOutputStream(defaults_file);
} catch (Exception e)
{
output_stream = null;
}
boolean write_ok;
if (output_stream == null)

View File

@ -87,7 +87,7 @@ public class BoardMenuHelp extends BoardMenuHelpReduced
URL hsURL = getClass().getResource(helpset_name);
if (hsURL == null)
{
FRLogger.warning("HelpSet " + helpset_name + " not found.");
FRLogger.logger.warn("HelpSet " + helpset_name + " not found.");
}
else
{

View File

@ -23,6 +23,7 @@
package eu.mihosoft.freerouting.gui;
import eu.mihosoft.freerouting.interactive.ActivityReplayFileScope;
import eu.mihosoft.freerouting.interactive.BoardHandling;
import eu.mihosoft.freerouting.interactive.ScreenMessages;
@ -298,9 +299,9 @@ public class BoardPanel extends javax.swing.JPanel
new java.awt.Point((int)(new_center.getX() - delta.getX()), (int)(new_center.getY() - delta.getY()));
move_mouse(new_mouse_location);
repaint();
this.board_handling.logfile.start_scope(eu.mihosoft.freerouting.interactive.LogfileScope.CENTER_DISPLAY);
this.board_handling.activityReplayFile.start_scope(ActivityReplayFileScope.CENTER_DISPLAY);
eu.mihosoft.freerouting.geometry.planar.FloatPoint curr_corner = new eu.mihosoft.freerouting.geometry.planar.FloatPoint(p_new_center.getX(), p_new_center.getY());
this.board_handling.logfile.add_corner(curr_corner);
this.board_handling.activityReplayFile.add_corner(curr_corner);
}

View File

@ -19,7 +19,7 @@ public class DefaultExceptionHandler implements Thread.UncaughtExceptionHandler
public static void handleException(Throwable e) {
// Here you should have a more robust, permanent record of problems
JOptionPane.showMessageDialog(findActiveFrame(), e.toString(), "Exception Occurred", OK_OPTION);
FRLogger.error(e);
FRLogger.logger.error(e);
}
private static Frame findActiveFrame() {

View File

@ -25,6 +25,7 @@ package eu.mihosoft.freerouting.gui;
import eu.mihosoft.freerouting.datastructures.FileFilter;
import eu.mihosoft.freerouting.designforms.specctra.RulesFile;
import eu.mihosoft.freerouting.logger.FRLogger;
/**
* File functionality with security restrictions used, when the application is opened with Java Webstart
@ -109,7 +110,7 @@ public class DesignFile
result = new java.io.FileInputStream(this.input_file);
} catch (Exception e)
{
// todo: better error handling...
FRLogger.logger.error(e.getLocalizedMessage(), e);
result = null;
}
@ -166,6 +167,7 @@ public class DesignFile
return;
}
String new_file_name = new_file.getName();
FRLogger.logger.info("Saving '"+new_file_name+"'...");
String[] new_name_parts = new_file_name.split("\\.");
String found_file_extension = new_name_parts[new_name_parts.length - 1];
if (found_file_extension.compareToIgnoreCase(binary_file_extension) == 0)
@ -214,6 +216,7 @@ public class DesignFile
{
String output_file_name = design_name + ".ses";
FRLogger.logger.info("Saving '"+output_file_name+"'...");
java.io.File curr_output_file = new java.io.File(get_parent(), output_file_name);
java.io.OutputStream output_stream;
try
@ -251,16 +254,17 @@ public class DesignFile
String rules_file_name = p_design_name + RULES_FILE_EXTENSION;
java.io.OutputStream output_stream;
FRLogger.logger.info("Saving '"+rules_file_name+"'...");
java.io.File rules_file = new java.io.File(this.get_parent(), rules_file_name);
try
{
output_stream = new java.io.FileOutputStream(rules_file);
} catch (java.io.IOException e)
{
System.out.println("unable to create rules file");
return false;
}
java.io.File rules_file = new java.io.File(this.get_parent(), rules_file_name);
try
{
output_stream = new java.io.FileOutputStream(rules_file);
} catch (java.io.IOException e)
{
System.out.println("unable to create rules file");
return false;
}
RulesFile.write(p_board_handling, output_stream, p_design_name);
return true;
@ -278,6 +282,7 @@ public class DesignFile
try
{
java.io.File rules_file = new java.io.File(p_parent_name, rule_file_name);
FRLogger.logger.info("Opening '"+rule_file_name+"'...");
java.io.InputStream input_stream = new java.io.FileInputStream(rules_file);
if (input_stream != null && dsn_file_generated_by_host && WindowMessage.confirm(p_confirm_message))
{
@ -321,6 +326,7 @@ public class DesignFile
String[] file_name_parts = design_file_name.split("\\.", 2);
String design_name = file_name_parts[0];
String output_file_name = design_name + ".scr";
FRLogger.logger.info("Saving '"+output_file_name+"'...");
{
java.io.File curr_output_file = new java.io.File(get_parent(), output_file_name);

View File

@ -24,8 +24,8 @@
package eu.mihosoft.freerouting.gui;
import eu.mihosoft.freerouting.board.TestLevel;
import java.util.logging.Level;
import java.util.logging.Logger;
import eu.mihosoft.freerouting.logger.FRLogger;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
@ -37,26 +37,28 @@ import javax.swing.UnsupportedLookAndFeelException;
*/
public class MainApplication extends javax.swing.JFrame
{
/**
* Main function of the Application
* @param args
*/
public static void main(String args[])
{
FRLogger.traceEntry("MainApplication.main()");
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException ex) {
Logger.getLogger(MainApplication.class.getName()).log(Level.SEVERE, null, ex);
FRLogger.logger.error(ex);
} catch (InstantiationException ex) {
Logger.getLogger(MainApplication.class.getName()).log(Level.SEVERE, null, ex);
FRLogger.logger.error(ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(MainApplication.class.getName()).log(Level.SEVERE, null, ex);
FRLogger.logger.error(ex);
} catch (UnsupportedLookAndFeelException ex) {
Logger.getLogger(MainApplication.class.getName()).log(Level.SEVERE, null, ex);
FRLogger.logger.error(ex);
}
FRLogger.logger.info("Freerouting application is started.");
Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler());
StartupOptions startupOptions = StartupOptions.parse(args);
@ -73,6 +75,8 @@ public class MainApplication extends javax.swing.JFrame
{
board_option = BoardFrame.Option.SINGLE_FRAME;
}
FRLogger.logger.info("Opening '"+startupOptions.design_file_name+"'...");
DesignFile design_file = DesignFile.get_instance(startupOptions.design_file_name, false);
if (design_file == null)
{
@ -108,6 +112,8 @@ public class MainApplication extends javax.swing.JFrame
{
new MainApplication(startupOptions).setVisible(true);
}
FRLogger.traceExit("MainApplication.main()");
}
/**
@ -137,7 +143,7 @@ public class MainApplication extends javax.swing.JFrame
open_board_button = new javax.swing.JButton();
restore_defaults_button = new javax.swing.JButton();
message_field = new javax.swing.JTextField();
message_field.setText("-de or -di not specified");
message_field.setText("Neither '-de <design file>' nor '-di <design directory>' are specified.");
this.window_net_demonstrations = new WindowNetDemonstrations(locale);
java.awt.Point location = getLocation();
this.window_net_demonstrations.setLocation((int) location.getX() + 50, (int) location.getY() + 50);
@ -199,7 +205,7 @@ public class MainApplication extends javax.swing.JFrame
main_panel.add(restore_defaults_button, gridbag_constraints);
}
message_field.setPreferredSize(new java.awt.Dimension(230, 20));
message_field.setPreferredSize(new java.awt.Dimension(400, 20));
message_field.setRequestFocusEnabled(false);
gridbag.setConstraints(message_field, gridbag_constraints);
main_panel.add(message_field, gridbag_constraints);
@ -207,13 +213,11 @@ public class MainApplication extends javax.swing.JFrame
this.addWindowListener(new WindowStateListener());
pack();
setSize(450,250);
}
/** opens a eu.mihosoft.freerouting.board design from a binary file or a specctra dsn file. */
private void open_board_design_action(java.awt.event.ActionEvent evt)
{
DesignFile design_file = DesignFile.open_dialog(this.design_dir_name);
if (design_file == null)
@ -222,6 +226,8 @@ public class MainApplication extends javax.swing.JFrame
return;
}
FRLogger.logger.info("Opening '"+design_file.get_name()+"'...");
BoardFrame.Option option;
if (this.is_webstart)
{

View File

@ -23,6 +23,9 @@
*/
package eu.mihosoft.freerouting.gui;
import java.awt.*;
import java.text.DecimalFormat;
/**
*
* @author Alfons Wirtz
@ -85,7 +88,7 @@ public class WindowAutorouteDetailParameter extends BoardSavableSubWindow
main_panel.add(start_pass_label);
start_pass_no = new javax.swing.JFormattedTextField(number_format);
start_pass_no.setColumns(2);
start_pass_no.setColumns(4);
this.start_pass_no.addKeyListener(new StartPassFieldKeyListener());
this.start_pass_no.addFocusListener(new StartPassFieldFocusListener());
gridbag_constraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
@ -163,6 +166,7 @@ public class WindowAutorouteDetailParameter extends BoardSavableSubWindow
number_format = java.text.NumberFormat.getInstance(p_board_frame.get_locale());
number_format.setMaximumFractionDigits(2);
final int TEXT_FIELD_LENGTH = 2;
java.text.NumberFormat float_number_format = new DecimalFormat("0.0");
for (int i = 0; i < signal_layer_count; ++i)
{
layer_name_arr[i] = new javax.swing.JLabel();
@ -171,13 +175,13 @@ public class WindowAutorouteDetailParameter extends BoardSavableSubWindow
gridbag_constraints.gridwidth = 3;
gridbag.setConstraints(layer_name_arr[i], gridbag_constraints);
main_panel.add(layer_name_arr[i]);
preferred_direction_trace_cost_arr[i] = new javax.swing.JFormattedTextField(number_format);
preferred_direction_trace_cost_arr[i] = new javax.swing.JFormattedTextField(float_number_format);
preferred_direction_trace_cost_arr[i].setColumns(TEXT_FIELD_LENGTH);
preferred_direction_trace_cost_arr[i].addKeyListener(new PreferredDirectionTraceCostKeyListener(i));
preferred_direction_trace_cost_arr[i].addFocusListener(new PreferredDirectionTraceCostFocusListener(i));
gridbag.setConstraints(preferred_direction_trace_cost_arr[i], gridbag_constraints);
main_panel.add(preferred_direction_trace_cost_arr[i]);
against_preferred_direction_trace_cost_arr[i] = new javax.swing.JFormattedTextField(number_format);
against_preferred_direction_trace_cost_arr[i] = new javax.swing.JFormattedTextField(float_number_format);
against_preferred_direction_trace_cost_arr[i].setColumns(TEXT_FIELD_LENGTH);
against_preferred_direction_trace_cost_arr[i].addKeyListener(new AgainstPreferredDirectionTraceCostKeyListener(i));
against_preferred_direction_trace_cost_arr[i].addFocusListener(new AgainstPreferredDirectionTraceCostFocusListener(i));
@ -188,6 +192,11 @@ public class WindowAutorouteDetailParameter extends BoardSavableSubWindow
against_preferred_direction_trace_costs_input_completed[i] = true;
}
javax.swing.JLabel applyValuesNote = new javax.swing.JLabel("(note: you need to press Enter to apply the new values)");
gridbag.setConstraints(applyValuesNote, gridbag_constraints);
main_panel.add(applyValuesNote, gridbag_constraints);
p_board_frame.set_context_sensitive_help(this, "WindowAutorouteDetailParameter");
this.refresh();

View File

@ -120,9 +120,9 @@ public class WindowAutorouteParameter extends BoardSavableSubWindow
gridbag.setConstraints(passes_label, gridbag_constraints);
main_panel.add(passes_label);
this.fanout_pass_button = new javax.swing.JRadioButton(resources.getString("fanout"));
this.autoroute_pass_button = new javax.swing.JRadioButton(resources.getString("autoroute"));
this.postroute_pass_button = new javax.swing.JRadioButton(resources.getString("postroute"));
this.fanout_pass_button = new javax.swing.JCheckBox(resources.getString("fanout"));
this.autoroute_pass_button = new javax.swing.JCheckBox(resources.getString("autoroute"));
this.postroute_pass_button = new javax.swing.JCheckBox(resources.getString("postroute"));
fanout_pass_button.addActionListener(new FanoutListener());
autoroute_pass_button.addActionListener(new AutorouteListener());
@ -217,9 +217,9 @@ public class WindowAutorouteParameter extends BoardSavableSubWindow
private final javax.swing.JCheckBox[] signal_layer_active_arr;
private final javax.swing.JComboBox[] combo_box_arr;
private final javax.swing.JCheckBox vias_allowed;
private final javax.swing.JRadioButton fanout_pass_button;
private final javax.swing.JRadioButton autoroute_pass_button;
private final javax.swing.JRadioButton postroute_pass_button;
private final javax.swing.JCheckBox fanout_pass_button;
private final javax.swing.JCheckBox autoroute_pass_button;
private final javax.swing.JCheckBox postroute_pass_button;
private final WindowAutorouteDetailParameter detail_window;
private final DetailListener detail_listener;
private final String horizontal;

View File

@ -1,282 +1,283 @@
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* Copyright (C) 2017 Michael Hoffer <info@michaelhoffer.de>
* Website www.freerouting.mihosoft.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*/
package eu.mihosoft.freerouting.interactive;
import eu.mihosoft.freerouting.geometry.planar.FloatPoint;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
/**
* Logfile to track the actions in the eu.mihosoft.freerouting.interactive eu.mihosoft.freerouting.board handling
* for automatic replay.
*
* @author Alfons Wirtz
*
*/
public class Logfile
{
/**
* opens the logfile for reading
*/
public boolean start_read(InputStream p_input_stream)
{
this.scanner = new LogfileScanner(p_input_stream);
return (this.scanner != null);
}
/**
* Reads the next corner from the logfile.
* Return null, if no valid corner is found.
*/
public FloatPoint read_corner()
{
double x = 0;
double y = 0;
for (int i = 0; i < 2; ++i)
{
Object curr_ob = this.next_token();
if (!(curr_ob instanceof Double))
{
this.pending_token = curr_ob;
return null;
}
double f = ((Double) curr_ob).doubleValue();
if (i == 0)
{
x = f;
}
else
{
y = f;
}
}
return new FloatPoint(x, y);
}
/**
* closes the logfile after writing
*/
public void close_output()
{
if (this.file_writer != null)
{
try
{
this.file_writer.close();
}
catch (IOException e)
{
System.out.println("unable to close logfile");
}
}
this.write_enabled = false;
}
/**
* opens a logfile for writing
*/
public boolean start_write(File p_file)
{
try
{
this.file_writer = new FileWriter(p_file);
}
catch (IOException e)
{
System.out.println("unable to create logfile");
return false;
}
write_enabled = true;
return true;
}
/**
* Marks the beginning of a new item in the olutput stream
*/
public void start_scope(LogfileScope p_logfile_scope)
{
if (write_enabled)
{
try
{
this.file_writer.write(p_logfile_scope.name);
this.file_writer.write("\n");
}
catch (IOException e2)
{
System.out.println("Logfile.start_scope: write failed");
}
}
}
/**
* Marks the beginning of a new scope in the olutput stream
* Writes also an integer value.
*/
public void start_scope(LogfileScope p_logfile_scope, int p_int_value)
{
start_scope(p_logfile_scope);
add_int(p_int_value);
}
/**
* Marks the beginning of a new scope in the olutput stream
* Writes also 1, if p_boolean_value is true, or 0, if p_boolean_value is false;
*/
public void start_scope(LogfileScope p_logfile_scope, boolean p_boolean_value)
{
start_scope(p_logfile_scope);
int int_value;
if (p_boolean_value)
{
int_value = 1;
}
else
{
int_value = 0;
}
add_int(int_value);
}
/**
* Marks the beginning of a new item in the olutput stream
* Writes also the start corner.
*/
public void start_scope(LogfileScope p_logfile_scope, FloatPoint p_start_corner)
{
start_scope(p_logfile_scope);
add_corner(p_start_corner);
}
/**
* Reads the next scope iidentifier from the logfile.
* Returns null if no more item scope was found.
*/
public LogfileScope start_read_scope()
{
Object curr_ob = this.next_token();
if (curr_ob == null)
{
return null;
}
if (!(curr_ob instanceof String))
{
System.out.println("Logfile.start_read_scope: String expected");
this.pending_token = curr_ob;
return null;
}
LogfileScope result = LogfileScope.get_scope((String) curr_ob);
return result;
}
/**
* adds an int to the logfile
*/
public void add_int(int p_int)
{
if (write_enabled)
{
try
{
this.file_writer.write((Integer.valueOf(p_int)).toString());
this.file_writer.write("\n");
}
catch (IOException e2)
{
System.out.println("unable to write integer to logfile");
}
}
}
/**
* Reads the next int from the logfile.
* Returns -1, if no valid integer was found.
*/
public int read_int()
{
Object curr_ob = this.next_token();
if (!(curr_ob instanceof Integer))
{
System.out.println("Logfile.read_int: Integer expected");
this.pending_token = curr_ob;
return -1;
}
return (((Integer) curr_ob).intValue());
}
/**
* adds a FloatPoint to the logfile
*/
public void add_corner(FloatPoint p_corner)
{
if (write_enabled)
{
if (p_corner == null)
{
System.out.println("logfile.add_corner: p_corner is null");
return;
}
try
{
this.file_writer.write((Double.valueOf(p_corner.x)).toString());
this.file_writer.write(" ");
this.file_writer.write((Double.valueOf(p_corner.y)).toString());
this.file_writer.write("\n");
}
catch (IOException e2)
{
System.out.println("unable to write to logfile while adding corner");
}
}
}
private Object next_token()
{
if (this.pending_token != null)
{
Object result = this.pending_token;
this.pending_token = null;
return result;
}
try
{
Object result = this.scanner.next_token();
return result;
}
catch (IOException e)
{
System.out.println("Logfile.next_token: IO error scanning file");
return null;
}
}
private LogfileScanner scanner = null;
private FileWriter file_writer = null;
private boolean write_enabled = false;
private Object pending_token = null;
/*
* Copyright (C) 2014 Alfons Wirtz
* website www.freerouting.net
*
* Copyright (C) 2017 Michael Hoffer <info@michaelhoffer.de>
* Website www.freerouting.mihosoft.eu
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License at <http://www.gnu.org/licenses/>
* for more details.
*/
package eu.mihosoft.freerouting.interactive;
import eu.mihosoft.freerouting.geometry.planar.FloatPoint;
import eu.mihosoft.freerouting.logger.FRLogger;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
/**
* ActivityReplayFile to track the actions in the eu.mihosoft.freerouting.interactive eu.mihosoft.freerouting.board handling
* for automatic replay.
*
* @author Alfons Wirtz
*
*/
public class ActivityReplayFile
{
/**
* opens the ActivityReplayFile for reading
*/
public boolean start_read(InputStream p_input_stream)
{
this.scanner = new ActivityReplayFileScanner(p_input_stream);
return (this.scanner != null);
}
/**
* Reads the next corner from the ActivityReplayFile.
* Return null, if no valid corner is found.
*/
public FloatPoint read_corner()
{
double x = 0;
double y = 0;
for (int i = 0; i < 2; ++i)
{
Object curr_ob = this.next_token();
if (!(curr_ob instanceof Double))
{
this.pending_token = curr_ob;
return null;
}
double f = ((Double) curr_ob).doubleValue();
if (i == 0)
{
x = f;
}
else
{
y = f;
}
}
return new FloatPoint(x, y);
}
/**
* closes the ActivityReplayFile after writing
*/
public void close_output()
{
if (this.file_writer != null)
{
try
{
this.file_writer.close();
}
catch (IOException e)
{
FRLogger.logger.error("Unable to close the file", e);
}
}
this.write_enabled = false;
}
/**
* opens a ActivityReplayFile for writing
*/
public boolean start_write(File p_file)
{
try
{
this.file_writer = new FileWriter(p_file);
}
catch (IOException e)
{
FRLogger.logger.error("Unable to create the file", e);
return false;
}
write_enabled = true;
return true;
}
/**
* Marks the beginning of a new item in the output stream
*/
public void start_scope(ActivityReplayFileScope p_scope)
{
if (write_enabled)
{
try
{
this.file_writer.write(p_scope.name);
this.file_writer.write("\n");
}
catch (IOException e)
{
FRLogger.logger.error("ActivityReplayFile.start_scope: write failed", e);
}
}
}
/**
* Marks the beginning of a new scope in the output stream
* Writes also an integer value.
*/
public void start_scope(ActivityReplayFileScope p_scope, int p_int_value)
{
start_scope(p_scope);
add_int(p_int_value);
}
/**
* Marks the beginning of a new scope in the output stream
* Writes also 1, if p_boolean_value is true, or 0, if p_boolean_value is false;
*/
public void start_scope(ActivityReplayFileScope p_scope, boolean p_boolean_value)
{
start_scope(p_scope);
int int_value;
if (p_boolean_value)
{
int_value = 1;
}
else
{
int_value = 0;
}
add_int(int_value);
}
/**
* Marks the beginning of a new item in the output stream
* Writes also the start corner.
*/
public void start_scope(ActivityReplayFileScope p_scope, FloatPoint p_start_corner)
{
start_scope(p_scope);
add_corner(p_start_corner);
}
/**
* Reads the next scope identifier from the ActivityReplayFile.
* Returns null if no more item scope was found.
*/
public ActivityReplayFileScope start_read_scope()
{
Object curr_ob = this.next_token();
if (curr_ob == null)
{
return null;
}
if (!(curr_ob instanceof String))
{
FRLogger.logger.error("ActivityReplayFile.start_read_scope: String expected");
this.pending_token = curr_ob;
return null;
}
ActivityReplayFileScope result = ActivityReplayFileScope.get_scope((String) curr_ob);
return result;
}
/**
* adds an int to the ActivityReplayFile
*/
public void add_int(int p_int)
{
if (write_enabled)
{
try
{
this.file_writer.write((Integer.valueOf(p_int)).toString());
this.file_writer.write("\n");
}
catch (IOException e)
{
FRLogger.logger.error("Unable to write integer to the file", e);
}
}
}
/**
* Reads the next int from the ActivityReplayFile.
* Returns -1, if no valid integer was found.
*/
public int read_int()
{
Object curr_ob = this.next_token();
if (!(curr_ob instanceof Integer))
{
FRLogger.logger.error("ActivityReplayFile.read_int: Integer expected");
this.pending_token = curr_ob;
return -1;
}
return (((Integer) curr_ob).intValue());
}
/**
* adds a FloatPoint to the ActivityReplayFile
*/
public void add_corner(FloatPoint p_corner)
{
if (write_enabled)
{
if (p_corner == null)
{
FRLogger.logger.error("ActivityReplayFile.add_corner: p_corner is null");
return;
}
try
{
this.file_writer.write((Double.valueOf(p_corner.x)).toString());
this.file_writer.write(" ");
this.file_writer.write((Double.valueOf(p_corner.y)).toString());
this.file_writer.write("\n");
}
catch (IOException e)
{
FRLogger.logger.error("Unable to write to the file while adding corner", e);
}
}
}
private Object next_token()
{
if (this.pending_token != null)
{
Object result = this.pending_token;
this.pending_token = null;
return result;
}
try
{
Object result = this.scanner.next_token();
return result;
}
catch (IOException e)
{
FRLogger.logger.error("ActivityReplayFile.next_token: IO error scanning file", e);
return null;
}
}
private ActivityReplayFileScanner scanner = null;
private FileWriter file_writer = null;
private boolean write_enabled = false;
private Object pending_token = null;
}

View File

@ -9,7 +9,7 @@ package eu.mihosoft.freerouting.interactive;
* on 06.07.05 18:12 from the specification file
* <tt>C:/Dokumente und Einstellungen/alfons/Eigene Dateien/freeroute/eu.mihosoft.freerouting.interactive/LogfileDescription.flex</tt>
*/
class LogfileScanner {
class ActivityReplayFileScanner {
/** This character denotes the end of file */
public static final int YYEOF = -1;
@ -224,7 +224,7 @@ class LogfileScanner {
*
* @param in the java.io.Reader to read input from.
*/
LogfileScanner(java.io.Reader in) {
ActivityReplayFileScanner(java.io.Reader in) {
this.zzReader = in;
}
@ -234,7 +234,7 @@ class LogfileScanner {
*
* @param in the java.io.Inputstream to read input from.
*/
LogfileScanner(java.io.InputStream in) {
ActivityReplayFileScanner(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}

View File

@ -31,6 +31,7 @@ import eu.mihosoft.freerouting.board.Unit;
import eu.mihosoft.freerouting.autoroute.BatchAutorouter;
import eu.mihosoft.freerouting.autoroute.BatchFanout;
import eu.mihosoft.freerouting.autoroute.BatchOptRoute;
import eu.mihosoft.freerouting.logger.FRLogger;
/**
* Thread for the batch autorouter.
@ -52,6 +53,8 @@ public class BatchAutorouterThread extends InteractiveActionThread
protected void thread_action()
{
FRLogger.traceEntry("BatchAutorouterThread.thread_action()");
try
{
java.util.ResourceBundle resources =
@ -126,8 +129,10 @@ public class BatchAutorouterThread extends InteractiveActionThread
}
} catch (Exception e)
{
FRLogger.logger.error(e.getLocalizedMessage(),e);
}
FRLogger.traceExit("BatchAutorouterThread.thread_action()");
}
public void draw(java.awt.Graphics p_graphics)

View File

@ -76,7 +76,7 @@ public class BoardHandling extends BoardHandlingImpl
this.locale = p_locale;
this.panel = p_panel;
this.screen_messages = p_panel.screen_messages;
this.set_interactive_state(SelectMenuState.get_instance(this, logfile));
this.set_interactive_state(SelectMenuState.get_instance(this, activityReplayFile));
this.resources = java.util.ResourceBundle.getBundle("eu.mihosoft.freerouting.interactive.BoardHandling", p_locale);
}
@ -147,7 +147,7 @@ public class BoardHandling extends BoardHandlingImpl
}
board.change_conduction_is_obstacle(!p_value);
logfile.start_scope(LogfileScope.SET_IGNORE_CONDUCTION, p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_IGNORE_CONDUCTION, p_value);
}
public void set_pin_edge_to_turn_dist(double p_value)
@ -290,8 +290,8 @@ public class BoardHandling extends BoardHandlingImpl
if (p_layer >= 0 && p_layer <= board.get_layer_count())
{
board.rules.set_default_trace_half_width(p_layer, p_value);
logfile.start_scope(LogfileScope.SET_TRACE_HALF_WIDTH, p_layer);
logfile.add_int(p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_TRACE_HALF_WIDTH, p_layer);
activityReplayFile.add_int(p_value);
}
}
@ -305,7 +305,7 @@ public class BoardHandling extends BoardHandlingImpl
return;
}
board.search_tree_manager.set_clearance_compensation_used(p_value);
logfile.start_scope(LogfileScope.SET_CLEARANCE_COMPENSATION, p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_CLEARANCE_COMPENSATION, p_value);
}
/**
@ -318,7 +318,7 @@ public class BoardHandling extends BoardHandlingImpl
return;
}
board.rules.set_trace_angle_restriction(p_snap_angle);
logfile.start_scope(LogfileScope.SET_SNAP_ANGLE, p_snap_angle.get_no());
activityReplayFile.start_scope(ActivityReplayFileScope.SET_SNAP_ANGLE, p_snap_angle.get_no());
}
/**
@ -333,7 +333,7 @@ public class BoardHandling extends BoardHandlingImpl
int layer = Math.max(p_layer, 0);
layer = Math.min(layer, board.get_layer_count() - 1);
set_layer(layer);
logfile.start_scope(LogfileScope.SET_LAYER, p_layer);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_LAYER, p_layer);
}
/**
@ -619,7 +619,7 @@ public class BoardHandling extends BoardHandlingImpl
{
return;
}
logfile.start_write(p_filename);
activityReplayFile.start_write(p_filename);
}
/**
@ -716,7 +716,7 @@ public class BoardHandling extends BoardHandlingImpl
return;
}
board.generate_snapshot();
logfile.start_scope(LogfileScope.GENERATE_SNAPSHOT);
activityReplayFile.start_scope(ActivityReplayFileScope.GENERATE_SNAPSHOT);
}
/**
@ -747,7 +747,7 @@ public class BoardHandling extends BoardHandlingImpl
{
screen_messages.set_status_message(resources.getString("no_more_undo_possible"));
}
logfile.start_scope(LogfileScope.UNDO);
activityReplayFile.start_scope(ActivityReplayFileScope.UNDO);
repaint();
}
@ -773,7 +773,7 @@ public class BoardHandling extends BoardHandlingImpl
{
screen_messages.set_status_message(resources.getString("no_more_redo_possible"));
}
logfile.start_scope(LogfileScope.REDO);
activityReplayFile.start_scope(ActivityReplayFileScope.REDO);
repaint();
}
@ -985,7 +985,7 @@ public class BoardHandling extends BoardHandlingImpl
*/
public void set_select_menu_state()
{
this.interactive_state = SelectMenuState.get_instance(this, logfile);
this.interactive_state = SelectMenuState.get_instance(this, activityReplayFile);
screen_messages.set_status_message(resources.getString("select_menu"));
}
@ -994,7 +994,7 @@ public class BoardHandling extends BoardHandlingImpl
*/
public void set_route_menu_state()
{
this.interactive_state = RouteMenuState.get_instance(this, logfile);
this.interactive_state = RouteMenuState.get_instance(this, activityReplayFile);
screen_messages.set_status_message(resources.getString("route_menu"));
}
@ -1003,7 +1003,7 @@ public class BoardHandling extends BoardHandlingImpl
*/
public void set_drag_menu_state()
{
this.interactive_state = DragMenuState.get_instance(this, logfile);
this.interactive_state = DragMenuState.get_instance(this, activityReplayFile);
screen_messages.set_status_message(resources.getString("drag_menu"));
}
@ -1017,7 +1017,7 @@ public class BoardHandling extends BoardHandlingImpl
{
board = (RoutingBoard) p_design.readObject();
settings = (Settings) p_design.readObject();
settings.set_logfile(this.logfile);
settings.set_logfile(this.activityReplayFile);
coordinate_transform = (CoordinateTransform) p_design.readObject();
graphics_context = (GraphicsContext) p_design.readObject();
}
@ -1156,9 +1156,9 @@ public class BoardHandling extends BoardHandlingImpl
*/
public void close_files()
{
if (logfile != null)
if (activityReplayFile != null)
{
logfile.close_output();
activityReplayFile.close_output();
}
}
@ -1174,7 +1174,7 @@ public class BoardHandling extends BoardHandlingImpl
}
FloatPoint location =
graphics_context.coordinate_transform.screen_to_board(p_point);
InteractiveState new_state = RouteState.get_instance(location, this.interactive_state, this, logfile);
InteractiveState new_state = RouteState.get_instance(location, this.interactive_state, this, activityReplayFile);
set_interactive_state(new_state);
}
@ -1203,7 +1203,7 @@ public class BoardHandling extends BoardHandlingImpl
{
return;
}
set_interactive_state(SelectItemsInRegionState.get_instance(this.interactive_state, this, logfile));
set_interactive_state(SelectItemsInRegionState.get_instance(this.interactive_state, this, activityReplayFile));
}
/**
@ -1219,7 +1219,7 @@ public class BoardHandling extends BoardHandlingImpl
this.display_layer_messsage();
if (interactive_state instanceof MenuState)
{
set_interactive_state(SelectedItemState.get_instance(p_items, interactive_state, this, logfile));
set_interactive_state(SelectedItemState.get_instance(p_items, interactive_state, this, activityReplayFile));
}
else if (interactive_state instanceof SelectedItemState)
{
@ -1398,7 +1398,7 @@ public class BoardHandling extends BoardHandlingImpl
Collection<Item> item_list = curr_state.get_item_list();
FloatPoint from_location = graphics_context.coordinate_transform.screen_to_board(p_from_location);
InteractiveState new_state =
MoveItemState.get_instance(from_location, item_list, interactive_state, this, logfile);
MoveItemState.get_instance(from_location, item_list, interactive_state, this, activityReplayFile);
set_interactive_state(new_state);
repaint();
}
@ -1417,7 +1417,7 @@ public class BoardHandling extends BoardHandlingImpl
Collection<Item> item_list = curr_state.get_item_list();
FloatPoint from_location = graphics_context.coordinate_transform.screen_to_board(p_from_location);
InteractiveState new_state =
CopyItemState.get_instance(from_location, item_list, interactive_state.return_state, this, logfile);
CopyItemState.get_instance(from_location, item_list, interactive_state.return_state, this, activityReplayFile);
set_interactive_state(new_state);
}
@ -1562,7 +1562,7 @@ public class BoardHandling extends BoardHandlingImpl
*/
public void zoom_region()
{
interactive_state = ZoomRegionState.get_instance(this.interactive_state, this, this.logfile);
interactive_state = ZoomRegionState.get_instance(this.interactive_state, this, this.activityReplayFile);
}
/**
@ -1576,7 +1576,7 @@ public class BoardHandling extends BoardHandlingImpl
return;
}
FloatPoint location = graphics_context.coordinate_transform.screen_to_board(p_point);
set_interactive_state(CircleConstructionState.get_instance(location, this.interactive_state, this, logfile));
set_interactive_state(CircleConstructionState.get_instance(location, this.interactive_state, this, activityReplayFile));
}
/**
@ -1590,7 +1590,7 @@ public class BoardHandling extends BoardHandlingImpl
return;
}
FloatPoint location = graphics_context.coordinate_transform.screen_to_board(p_point);
set_interactive_state(TileConstructionState.get_instance(location, this.interactive_state, this, logfile));
set_interactive_state(TileConstructionState.get_instance(location, this.interactive_state, this, activityReplayFile));
}
/**
@ -1605,7 +1605,7 @@ public class BoardHandling extends BoardHandlingImpl
}
FloatPoint location = graphics_context.coordinate_transform.screen_to_board(p_point);
set_interactive_state(PolygonShapeConstructionState.get_instance(location, this.interactive_state,
this, logfile));
this, activityReplayFile));
}
/**
@ -1621,7 +1621,7 @@ public class BoardHandling extends BoardHandlingImpl
}
FloatPoint location = graphics_context.coordinate_transform.screen_to_board(p_point);
InteractiveState new_state =
HoleConstructionState.get_instance(location, this.interactive_state, this, logfile);
HoleConstructionState.get_instance(location, this.interactive_state, this, activityReplayFile);
set_interactive_state(new_state);
}

View File

@ -21,7 +21,7 @@ public class BoardHandlingImpl implements IBoardHandling {
* The file used for logging eu.mihosoft.freerouting.interactive action,
* so that they can be replayed later
*/
public final Logfile logfile = new Logfile();
public final ActivityReplayFile activityReplayFile = new ActivityReplayFile();
/** The current settings for eu.mihosoft.freerouting.interactive actions on the eu.mihosoft.freerouting.board*/
public Settings settings = null;
/** The eu.mihosoft.freerouting.board database used in this eu.mihosoft.freerouting.interactive handling. */
@ -81,7 +81,7 @@ public class BoardHandlingImpl implements IBoardHandling {
new RoutingBoard(p_bounding_box, p_layer_structure, p_outline_shapes, outline_cl_class_no,
p_rules, p_board_communication, p_test_level);
this.settings = new Settings(this.board, this.logfile);
this.settings = new Settings(this.board, this.activityReplayFile);
}
@Override

View File

@ -46,28 +46,28 @@ public class CircleConstructionState extends InteractiveState
* If p_logfile != null; the creation of this item is stored in a logfile
*/
public static CircleConstructionState get_instance(FloatPoint p_location,
InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
p_board_handling.remove_ratsnest(); // inserting a circle may change the connectivity.
return new CircleConstructionState(p_location, p_parent_state, p_board_handling, p_logfile);
return new CircleConstructionState(p_location, p_parent_state, p_board_handling, p_activityReplayFile);
}
/** Creates a new instance of CircleConstructionState */
private CircleConstructionState(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
private CircleConstructionState(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
super(p_parent_state, p_board_handling, p_activityReplayFile);
circle_center = p_location;
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.CREATING_CIRCLE, p_location);
activityReplayFile.start_scope(ActivityReplayFileScope.CREATING_CIRCLE, p_location);
}
}
public InteractiveState left_button_clicked(FloatPoint p_location)
{
if (logfile != null)
if (activityReplayFile != null)
{
logfile.add_corner(p_location);
activityReplayFile.add_corner(p_location);
}
return this.complete();
}
@ -128,9 +128,9 @@ public class CircleConstructionState extends InteractiveState
{
hdlg.screen_messages.set_status_message(resources.getString("keepout_cancelled_because_of_overlaps"));
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.COMPLETE_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.COMPLETE_SCOPE);
}
hdlg.repaint();
return this.return_state;

View File

@ -55,21 +55,21 @@ public class CopyItemState extends InteractiveState
* Returns a new instance of CopyItemState or null, if p_item_list is empty.
*/
public static CopyItemState get_instance(FloatPoint p_location, Collection<Item> p_item_list,
InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
if (p_item_list.size() == 0)
{
return null;
}
p_board_handling.remove_ratsnest(); // copying an item may change the connectivity.
return new CopyItemState(p_location, p_item_list, p_parent_state, p_board_handling, p_logfile);
return new CopyItemState(p_location, p_item_list, p_parent_state, p_board_handling, p_activityReplayFile);
}
/** Creates a new instance of CopyItemState */
private CopyItemState(FloatPoint p_location, Collection<Item> p_item_list,
InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
super(p_parent_state, p_board_handling, p_activityReplayFile);
item_list = new LinkedList<Item>();
start_position = p_location.round();
@ -87,9 +87,9 @@ public class CopyItemState extends InteractiveState
item_list.add(new_item);
}
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.COPYING_ITEMS, p_location);
activityReplayFile.start_scope(ActivityReplayFileScope.COPYING_ITEMS, p_location);
}
}
@ -125,9 +125,9 @@ public class CopyItemState extends InteractiveState
*/
public boolean change_layer_action(int p_new_layer)
{
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.CHANGE_LAYER, p_new_layer);
activityReplayFile.start_scope(ActivityReplayFileScope.CHANGE_LAYER, p_new_layer);
}
current_layer = p_new_layer;
layer_changed = true;
@ -259,9 +259,9 @@ public class CopyItemState extends InteractiveState
{
hdlg.screen_messages.set_status_message(resources.getString("some_items_not_inserted_because_of_obstacles"));
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.add_corner(this.current_position.to_float());
activityReplayFile.add_corner(this.current_position.to_float());
}
start_position = current_position;
layer_changed = false;

View File

@ -36,9 +36,9 @@ public class CornerItemConstructionState extends InteractiveState
{
/** Creates a new instance of CornerItemConstructionState */
protected CornerItemConstructionState(InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
protected CornerItemConstructionState(InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
super(p_parent_state, p_board_handling, p_activityReplayFile);
p_board_handling.remove_ratsnest(); // Constructing an item may change the connectivity.
}
@ -59,9 +59,9 @@ public class CornerItemConstructionState extends InteractiveState
// make shure that the coordinates are integer
this.corner_list.add(location);
hdlg.repaint();
if (logfile != null)
if (activityReplayFile != null)
{
logfile.add_corner(p_location);
activityReplayFile.add_corner(p_location);
}
return this;
}

View File

@ -47,16 +47,16 @@ public class CutoutRouteState extends SelectRegionState
* Returns a new instance of this class.
*/
public static CutoutRouteState get_instance( Collection<Item> p_item_list, InteractiveState p_parent_state,
BoardHandling p_board_handling, Logfile p_logfile)
BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
return get_instance(p_item_list, null, p_parent_state, p_board_handling, p_logfile);
return get_instance(p_item_list, null, p_parent_state, p_board_handling, p_activityReplayFile);
}
/**
* Returns a new instance of this class.
*/
public static CutoutRouteState get_instance( Collection<Item> p_item_list, FloatPoint p_location, InteractiveState p_parent_state,
BoardHandling p_board_handling, Logfile p_logfile)
BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
p_board_handling.display_layer_messsage();
// filter items, whichh cannnot be cutout
@ -70,23 +70,23 @@ public class CutoutRouteState extends SelectRegionState
}
}
CutoutRouteState new_instance = new CutoutRouteState(item_list, p_parent_state, p_board_handling, p_logfile);
CutoutRouteState new_instance = new CutoutRouteState(item_list, p_parent_state, p_board_handling, p_activityReplayFile);
new_instance.corner1 = p_location;
if (p_location != null && new_instance.logfile != null)
if (p_location != null && new_instance.activityReplayFile != null)
{
new_instance.logfile.add_corner(p_location);
new_instance.activityReplayFile.add_corner(p_location);
}
new_instance.hdlg.screen_messages.set_status_message(new_instance.resources.getString("drag_left_mouse_button_to_select_cutout_rectangle"));
return new_instance;
}
/** Creates a new instance of CutoutRouteState */
private CutoutRouteState(Collection<PolylineTrace> p_item_list, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
private CutoutRouteState(Collection<PolylineTrace> p_item_list, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
if (logfile != null)
super(p_parent_state, p_board_handling, p_activityReplayFile);
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.CUTOUT_ROUTE);
activityReplayFile.start_scope(ActivityReplayFileScope.CUTOUT_ROUTE);
}
this.trace_list = p_item_list;
}
@ -95,9 +95,9 @@ public class CutoutRouteState extends SelectRegionState
{
hdlg.screen_messages.set_status_message("");
corner2 = hdlg.get_current_mouse_position();
if (logfile != null)
if (activityReplayFile != null)
{
logfile.add_corner(corner2);
activityReplayFile.add_corner(corner2);
}
this.cutout_route();
return this.return_state;

View File

@ -44,9 +44,9 @@ public class DragItemState extends DragState
{
/** Creates a new instance of MoveItemState */
protected DragItemState(Item p_item_to_move, FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
protected DragItemState(Item p_item_to_move, FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_location, p_parent_state, p_board_handling, p_logfile);
super(p_location, p_parent_state, p_board_handling, p_activityReplayFile);
item_to_move = p_item_to_move;
}
@ -118,12 +118,12 @@ public class DragItemState extends DragState
}
// make the situation restorable by undo
hdlg.get_routing_board().generate_snapshot();
if (logfile != null)
if (activityReplayFile != null)
{
// Delayed till here because otherwise the mouse
// might have been only clicked for selecting
// and not pressed for moving.
logfile.start_scope(LogfileScope.DRAGGING_ITEMS, this.previous_location);
activityReplayFile.start_scope(ActivityReplayFileScope.DRAGGING_ITEMS, this.previous_location);
}
this.something_dragged = true;
}
@ -146,9 +146,9 @@ public class DragItemState extends DragState
hdlg.get_routing_board().end_notify_observers();
this.observers_activated = false;
}
if (logfile != null && something_dragged)
if (activityReplayFile != null && something_dragged)
{
logfile.start_scope(LogfileScope.COMPLETE_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.COMPLETE_SCOPE);
}
if (something_dragged)
{

View File

@ -33,21 +33,21 @@ import eu.mihosoft.freerouting.geometry.planar.FloatPoint;
public class DragMenuState extends MenuState
{
/** Returns a new instance of DragMenuState */
public static DragMenuState get_instance(BoardHandling p_board_handling, Logfile p_logfile)
public static DragMenuState get_instance(BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
DragMenuState new_state = new DragMenuState(p_board_handling, p_logfile);
DragMenuState new_state = new DragMenuState(p_board_handling, p_activityReplayFile);
return new_state;
}
/** Creates a new instance of DragMenuState */
public DragMenuState(BoardHandling p_board_handling, Logfile p_logfile)
public DragMenuState(BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_board_handling, p_logfile);
super(p_board_handling, p_activityReplayFile);
}
public InteractiveState mouse_pressed(FloatPoint p_point)
{
return DragState.get_instance(p_point, this, hdlg, logfile);
return DragState.get_instance(p_point, this, hdlg, activityReplayFile);
}
public String get_help_id()

View File

@ -43,7 +43,7 @@ public abstract class DragState extends InteractiveState
* location; null otherwise.
*/
public static DragState get_instance(FloatPoint p_location, InteractiveState p_parent_state,
BoardHandling p_board_handling, Logfile p_logfile)
BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
p_board_handling.display_layer_messsage();
Item item_to_move = null;
@ -94,11 +94,11 @@ public abstract class DragState extends InteractiveState
DragState result;
if (item_to_move != null)
{
result = new DragItemState(item_to_move, p_location, p_parent_state, p_board_handling, p_logfile);
result = new DragItemState(item_to_move, p_location, p_parent_state, p_board_handling, p_activityReplayFile);
}
else if (!item_found)
{
result = new MakeSpaceState(p_location, p_parent_state, p_board_handling, p_logfile);
result = new MakeSpaceState(p_location, p_parent_state, p_board_handling, p_activityReplayFile);
}
else
{
@ -112,9 +112,9 @@ public abstract class DragState extends InteractiveState
}
/** Creates a new instance of DragState */
protected DragState(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
protected DragState(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
super(p_parent_state, p_board_handling, p_activityReplayFile);
previous_location = p_location;
}
@ -136,9 +136,9 @@ public abstract class DragState extends InteractiveState
}
if (this.something_dragged)
{
if (logfile != null )
if (activityReplayFile != null )
{
logfile.add_corner(p_point);
activityReplayFile.add_corner(p_point);
}
}
return result;

View File

@ -34,9 +34,9 @@ public class DynamicRouteState extends RouteState
{
/** Creates a new instance of DynamicRouteState */
protected DynamicRouteState(InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
protected DynamicRouteState(InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
super(p_parent_state, p_board_handling, p_activityReplayFile);
}
public InteractiveState mouse_moved()
@ -55,9 +55,9 @@ public class DynamicRouteState extends RouteState
hdlg.get_routing_board().end_notify_observers();
this.observers_activated = false;
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.COMPLETE_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.COMPLETE_SCOPE);
}
for (int curr_net_no : this.route.net_no_arr)
{

View File

@ -49,9 +49,9 @@ public class HoleConstructionState extends CornerItemConstructionState
* if that was not possible with the input parameters.
* If p_logfile != null, the construction of this hole is stored in a logfile.
*/
public static HoleConstructionState get_instance(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
public static HoleConstructionState get_instance(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
HoleConstructionState new_instance = new HoleConstructionState(p_parent_state, p_board_handling, p_logfile);
HoleConstructionState new_instance = new HoleConstructionState(p_parent_state, p_board_handling, p_activityReplayFile);
if (!new_instance.start_ok(p_location))
{
new_instance = null;
@ -60,9 +60,9 @@ public class HoleConstructionState extends CornerItemConstructionState
}
/** Creates a new instance of HoleConstructionState */
private HoleConstructionState(InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
private HoleConstructionState(InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
super(p_parent_state, p_board_handling, p_activityReplayFile);
}
/**
@ -97,9 +97,9 @@ public class HoleConstructionState extends CornerItemConstructionState
hdlg.screen_messages.set_status_message(resources.getString("adding_hole_to_circle_not_yet_implemented"));
return false;
}
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.ADDING_HOLE);
activityReplayFile.start_scope(ActivityReplayFileScope.ADDING_HOLE);
}
this.add_corner(p_location);
return true;
@ -202,9 +202,9 @@ public class HoleConstructionState extends CornerItemConstructionState
{
hdlg.screen_messages.set_status_message(resources.getString("adding_hole_failed"));
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.COMPLETE_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.COMPLETE_SCOPE);
}
return this.return_state;
}

View File

@ -166,7 +166,7 @@ public abstract class InteractiveActionThread extends Thread implements eu.mihos
hdlg.screen_messages.set_write_protected(true);
boolean done = false;
InteractiveState previous_state = hdlg.interactive_state;
if (!hdlg.logfile.start_read(this.input_stream))
if (!hdlg.activityReplayFile.start_read(this.input_stream))
{
done = true;
}
@ -182,7 +182,7 @@ public abstract class InteractiveActionThread extends Thread implements eu.mihos
done = true;
}
++debug_counter;
LogfileScope logfile_scope = hdlg.logfile.start_read_scope();
ActivityReplayFileScope logfile_scope = hdlg.activityReplayFile.start_read_scope();
if (logfile_scope == null)
{
done = true; // end of logfile
@ -192,7 +192,7 @@ public abstract class InteractiveActionThread extends Thread implements eu.mihos
try
{
InteractiveState new_state =
logfile_scope.read_scope(hdlg.logfile, hdlg.interactive_state, hdlg);
logfile_scope.read_scope(hdlg.activityReplayFile, hdlg.interactive_state, hdlg);
if (new_state == null)
{
System.out.println("BoardHandling:read_logfile: inconsistent logfile scope");

View File

@ -36,11 +36,11 @@ import java.awt.Graphics;
public class InteractiveState
{
/** Creates a new instance of InteractiveState */
protected InteractiveState(InteractiveState p_return_state, BoardHandling p_board_handling, Logfile p_logfile)
protected InteractiveState(InteractiveState p_return_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
this.return_state = p_return_state;
this.hdlg = p_board_handling;
this.logfile = p_logfile;
this.activityReplayFile = p_activityReplayFile;
this.resources =
java.util.ResourceBundle.getBundle("eu.mihosoft.freerouting.interactive.InteractiveState", p_board_handling.get_locale());
}
@ -139,7 +139,7 @@ public class InteractiveState
}
else if (p_key_char == 'f')
{
result = ZoomRegionState.get_instance(hdlg.get_current_mouse_position(), this, hdlg, logfile);
result = ZoomRegionState.get_instance(hdlg.get_current_mouse_position(), this, hdlg, activityReplayFile);
}
else if (p_key_char =='h')
{
@ -195,9 +195,9 @@ public class InteractiveState
*/
public InteractiveState complete()
{
if (this.return_state != this &&logfile != null)
if (this.return_state != this && activityReplayFile != null)
{
logfile.start_scope(LogfileScope.COMPLETE_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.COMPLETE_SCOPE);
}
return this.return_state;
}
@ -209,9 +209,9 @@ public class InteractiveState
*/
public InteractiveState cancel()
{
if (this.return_state != this && logfile != null)
if (this.return_state != this && activityReplayFile != null)
{
logfile.start_scope(LogfileScope.CANCEL_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.CANCEL_SCOPE);
}
return this.return_state;
}
@ -274,7 +274,7 @@ public class InteractiveState
protected InteractiveState return_state;
/** if logfile != null, the eu.mihosoft.freerouting.interactive actions are stored in a logfile */
protected final Logfile logfile;
protected final ActivityReplayFile activityReplayFile;
/** Contains the files with the language dependent messages */
protected final java.util.ResourceBundle resources;

View File

@ -38,9 +38,9 @@ public class MakeSpaceState extends DragState
{
/** Creates a new instance of MakeSpaceState */
public MakeSpaceState(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
public MakeSpaceState(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_location, p_parent_state, p_board_handling, p_logfile);
super(p_location, p_parent_state, p_board_handling, p_activityReplayFile);
int [] shove_trace_width_arr = new int[hdlg.get_routing_board().get_layer_count()];
boolean [] layer_active_arr = new boolean[shove_trace_width_arr.length];
int shove_trace_width = Math.min (100, hdlg.get_routing_board().get_min_trace_half_width() / 10);
@ -70,12 +70,12 @@ public class MakeSpaceState extends DragState
}
// make the situation restorable by undo
hdlg.get_routing_board().generate_snapshot();
if (logfile != null)
if (activityReplayFile != null)
{
// Delayed till here because otherwise the mouse
// might have been only clicked for selecting
// and not pressed for moving.
logfile.start_scope(LogfileScope.MAKING_SPACE, previous_location);
activityReplayFile.start_scope(ActivityReplayFileScope.MAKING_SPACE, previous_location);
}
something_dragged = true;
}
@ -102,9 +102,9 @@ public class MakeSpaceState extends DragState
hdlg.get_routing_board().end_notify_observers();
this.observers_activated = false;
}
if (logfile != null && something_dragged)
if (activityReplayFile != null && something_dragged)
{
logfile.start_scope(LogfileScope.COMPLETE_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.COMPLETE_SCOPE);
}
hdlg.show_ratsnest();
return this.return_state;

View File

@ -40,9 +40,9 @@ public class MenuState extends InteractiveState
{
/** Creates a new instance of MenuState */
MenuState(BoardHandling p_board_handle, Logfile p_logfile)
MenuState(BoardHandling p_board_handle, ActivityReplayFile p_activityReplayFile)
{
super(null, p_board_handle, p_logfile);
super(null, p_board_handle, p_activityReplayFile);
this.return_state = this;
}
@ -64,11 +64,11 @@ public class MenuState extends InteractiveState
InteractiveState result;
if (something_found)
{
result = SelectedItemState.get_instance(picked_items, this, hdlg, this.logfile);
result = SelectedItemState.get_instance(picked_items, this, hdlg, this.activityReplayFile);
hdlg.screen_messages.set_status_message(resources.getString("in_select_mode"));
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.START_SELECT, p_location);
activityReplayFile.start_scope(ActivityReplayFileScope.START_SELECT, p_location);
}
}
else
@ -93,7 +93,7 @@ public class MenuState extends InteractiveState
return this;
}
eu.mihosoft.freerouting.board.Pin selected_pin = (eu.mihosoft.freerouting.board.Pin) first_item;
result = PinSwapState.get_instance(selected_pin, this, hdlg, this.logfile);
result = PinSwapState.get_instance(selected_pin, this, hdlg, this.activityReplayFile);
}
else
{
@ -115,7 +115,7 @@ public class MenuState extends InteractiveState
}
else if (p_key_char == 'd')
{
curr_return_state = DragMenuState.get_instance(hdlg, logfile);
curr_return_state = DragMenuState.get_instance(hdlg, activityReplayFile);
}
else if (p_key_char == 'e')
{
@ -139,15 +139,15 @@ public class MenuState extends InteractiveState
}
else if (p_key_char == 'r')
{
curr_return_state = RouteMenuState.get_instance(hdlg, logfile);
curr_return_state = RouteMenuState.get_instance(hdlg, activityReplayFile);
}
else if (p_key_char == 's')
{
curr_return_state = SelectMenuState.get_instance(hdlg, logfile);
curr_return_state = SelectMenuState.get_instance(hdlg, activityReplayFile);
}
else if (p_key_char == 't')
{
curr_return_state = RouteState.get_instance(hdlg.get_current_mouse_position(), this, hdlg, logfile);
curr_return_state = RouteState.get_instance(hdlg.get_current_mouse_position(), this, hdlg, activityReplayFile);
}
else if (p_key_char == 'u')
{

View File

@ -52,7 +52,7 @@ public class MoveItemState extends InteractiveState
* to a single component.
*/
public static MoveItemState get_instance(FloatPoint p_location, Collection<Item> p_item_list,
InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
java.util.ResourceBundle resources = java.util.ResourceBundle.getBundle("eu.mihosoft.freerouting.interactive.InteractiveState", p_board_handling.get_locale());
if (p_item_list.isEmpty())
@ -174,21 +174,21 @@ public class MoveItemState extends InteractiveState
}
item_list.addAll(add_items);
return new MoveItemState(p_location, item_list, component_list, grid_snap_component,
p_parent_state.return_state, p_board_handling, p_logfile);
p_parent_state.return_state, p_board_handling, p_activityReplayFile);
}
/** Creates a new instance of MoveComponentState */
private MoveItemState(FloatPoint p_location, Set<Item> p_item_list, Set<Component> p_component_list,
Component p_first_component, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
Component p_first_component, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
super(p_parent_state, p_board_handling, p_activityReplayFile);
this.component_list = p_component_list;
this.grid_snap_component = p_first_component;
this.current_position = p_location.round();
this.previous_position = current_position;
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.MOVE_ITEMS, p_location);
activityReplayFile.start_scope(ActivityReplayFileScope.MOVE_ITEMS, p_location);
}
eu.mihosoft.freerouting.board.BasicBoard routing_board = hdlg.get_routing_board();
this.observers_activated = !hdlg.get_routing_board().observers_active();
@ -239,9 +239,9 @@ public class MoveItemState extends InteractiveState
{
super.mouse_moved();
move(hdlg.get_current_mouse_position());
if (logfile != null)
if (activityReplayFile != null)
{
logfile.add_corner(this.current_position.to_float());
activityReplayFile.add_corner(this.current_position.to_float());
}
return this;
}
@ -284,9 +284,9 @@ public class MoveItemState extends InteractiveState
this.hdlg.update_ratsnest(curr_net_items.net_no);
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.COMPLETE_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.COMPLETE_SCOPE);
}
hdlg.screen_messages.set_status_message(resources.getString("move_completed"));
hdlg.repaint();
@ -300,9 +300,9 @@ public class MoveItemState extends InteractiveState
{
this.hdlg.update_ratsnest(curr_net_items.net_no);
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.CANCEL_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.CANCEL_SCOPE);
}
return this.return_state;
}
@ -390,9 +390,9 @@ public class MoveItemState extends InteractiveState
{
this.hdlg.update_ratsnest(curr_net_items.net_no, curr_net_items.items);
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.TURN_90_DEGREE, p_factor);
activityReplayFile.start_scope(ActivityReplayFileScope.TURN_90_DEGREE, p_factor);
}
hdlg.repaint();
}
@ -420,9 +420,9 @@ public class MoveItemState extends InteractiveState
{
this.hdlg.update_ratsnest(curr_net_items.net_no, curr_net_items.items);
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.ROTATE, (int) p_angle_in_degree);
activityReplayFile.start_scope(ActivityReplayFileScope.ROTATE, (int) p_angle_in_degree);
}
hdlg.repaint();
}
@ -496,9 +496,9 @@ public class MoveItemState extends InteractiveState
{
this.hdlg.update_ratsnest(curr_net_items.net_no, curr_net_items.items);
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.CHANGE_PLACEMENT_SIDE);
activityReplayFile.start_scope(ActivityReplayFileScope.CHANGE_PLACEMENT_SIDE);
}
hdlg.repaint();
}

View File

@ -35,9 +35,9 @@ import eu.mihosoft.freerouting.board.ItemSelectionFilter;
*/
public class PinSwapState extends InteractiveState
{
public static InteractiveState get_instance(Pin p_pin_to_swap, InteractiveState p_return_state, BoardHandling p_board_handling, Logfile p_logfile)
public static InteractiveState get_instance(Pin p_pin_to_swap, InteractiveState p_return_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
PinSwapState new_state = new PinSwapState(p_pin_to_swap, p_return_state, p_board_handling, p_logfile);
PinSwapState new_state = new PinSwapState(p_pin_to_swap, p_return_state, p_board_handling, p_activityReplayFile);
if (new_state.swappable_pins.isEmpty())
{
new_state.hdlg.screen_messages.set_status_message(new_state.resources.getString("no_swappable_pin_found"));
@ -47,9 +47,9 @@ public class PinSwapState extends InteractiveState
return new_state;
}
/** Creates a new instance of PinSwapState */
private PinSwapState(Pin p_pin_to_swap, InteractiveState p_return_state, BoardHandling p_board_handling, Logfile p_logfile)
private PinSwapState(Pin p_pin_to_swap, InteractiveState p_return_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_return_state, p_board_handling, p_logfile);
super(p_return_state, p_board_handling, p_activityReplayFile);
this.from_pin = p_pin_to_swap;
this.swappable_pins = p_pin_to_swap.get_swappable_pins();
}

View File

@ -42,18 +42,18 @@ public class PolygonShapeConstructionState extends CornerItemConstructionState
* Returns a new instance of this class
* If p_logfile != null; the creation of this item is stored in a logfile
*/
public static PolygonShapeConstructionState get_instance(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
public static PolygonShapeConstructionState get_instance(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
return new PolygonShapeConstructionState(p_location, p_parent_state, p_board_handling, p_logfile);
return new PolygonShapeConstructionState(p_location, p_parent_state, p_board_handling, p_activityReplayFile);
}
/** Creates a new instance of PolygonShapeConstructionState */
private PolygonShapeConstructionState(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
private PolygonShapeConstructionState(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
if (this.logfile != null)
super(p_parent_state, p_board_handling, p_activityReplayFile);
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.CREATING_POLYGONSHAPE);
activityReplayFile.start_scope(ActivityReplayFileScope.CREATING_POLYGONSHAPE);
}
this.add_corner(p_location);
}
@ -112,9 +112,9 @@ public class PolygonShapeConstructionState extends CornerItemConstructionState
{
hdlg.screen_messages.set_status_message(resources.getString("keepout_cancelled_because_of_overlaps"));
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.COMPLETE_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.COMPLETE_SCOPE);
}
return this.return_state;
}

View File

@ -34,21 +34,21 @@ import eu.mihosoft.freerouting.geometry.planar.FloatPoint;
public class RouteMenuState extends MenuState
{
/** Returns a new instance of RouteMenuState */
public static RouteMenuState get_instance(BoardHandling p_board_handling, Logfile p_logfile)
public static RouteMenuState get_instance(BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
RouteMenuState new_state = new RouteMenuState(p_board_handling, p_logfile);
RouteMenuState new_state = new RouteMenuState(p_board_handling, p_activityReplayFile);
return new_state;
}
/** Creates a new instance of RouteMenuState */
private RouteMenuState(BoardHandling p_board_handling, Logfile p_logfile)
private RouteMenuState(BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_board_handling, p_logfile);
super(p_board_handling, p_activityReplayFile);
}
public InteractiveState left_button_clicked(FloatPoint p_location)
{
return RouteState.get_instance(p_location, this, hdlg, logfile);
return RouteState.get_instance(p_location, this, hdlg, activityReplayFile);
}
public void display_default_message()

View File

@ -51,7 +51,7 @@ public class RouteState extends InteractiveState
* If p_logfile != null, the creation of the route is stored
* in the logfile.
**/
public static RouteState get_instance(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
public static RouteState get_instance(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
if (!(p_parent_state instanceof MenuState))
{
@ -164,11 +164,11 @@ public class RouteState extends InteractiveState
RouteState new_instance;
if (is_stitch_route)
{
new_instance = new StitchRouteState(p_parent_state, p_board_handling, p_logfile);
new_instance = new StitchRouteState(p_parent_state, p_board_handling, p_activityReplayFile);
}
else
{
new_instance = new DynamicRouteState(p_parent_state, p_board_handling, p_logfile);
new_instance = new DynamicRouteState(p_parent_state, p_board_handling, p_activityReplayFile);
}
new_instance.routing_target_set = picked_item.get_unconnected_set(-1);
@ -186,9 +186,9 @@ public class RouteState extends InteractiveState
p_board_handling.repaint();
if (new_instance != null)
{
if (new_instance.logfile != null)
if (new_instance.activityReplayFile != null)
{
new_instance.logfile.start_scope(LogfileScope.CREATING_TRACE, p_location);
new_instance.activityReplayFile.start_scope(ActivityReplayFileScope.CREATING_TRACE, p_location);
p_board_handling.hide_ratsnest();
}
new_instance.display_default_message();
@ -201,9 +201,9 @@ public class RouteState extends InteractiveState
* If p_logfile != null, the creation of the route is stored
* in the logfile.
*/
protected RouteState(InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
protected RouteState(InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
super(p_parent_state, p_board_handling, p_activityReplayFile);
}
/**
@ -359,9 +359,9 @@ public class RouteState extends InteractiveState
boolean route_completed = route.next_corner(p_location);
String layer_string = hdlg.get_routing_board().layer_structure.arr[route.nearest_target_layer()].name;
hdlg.screen_messages.set_target_layer(layer_string);
if (this.logfile != null)
if (this.activityReplayFile != null)
{
this.logfile.add_corner(p_location);
this.activityReplayFile.add_corner(p_location);
}
if (route_completed)
{
@ -411,9 +411,9 @@ public class RouteState extends InteractiveState
hdlg.get_routing_board().end_notify_observers();
this.observers_activated = false;
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.CANCEL_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.CANCEL_SCOPE);
}
hdlg.screen_messages.clear();
for (int curr_net_no : this.route.net_no_arr)
@ -496,9 +496,9 @@ public class RouteState extends InteractiveState
// make the current situation restorable by undo
hdlg.get_routing_board().generate_snapshot();
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.CHANGE_LAYER, p_new_layer);
activityReplayFile.start_scope(ActivityReplayFileScope.CHANGE_LAYER, p_new_layer);
}
}
else

View File

@ -44,24 +44,24 @@ public class SelectItemsInRegionState extends SelectRegionState
* Returns a new instance of this class.
*/
public static SelectItemsInRegionState get_instance(InteractiveState p_parent_state,
BoardHandling p_board_handling, Logfile p_logfile)
BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
return get_instance(null, p_parent_state, p_board_handling, p_logfile);
return get_instance(null, p_parent_state, p_board_handling, p_activityReplayFile);
}
/**
* Returns a new instance of this class with first point p_location.
*/
public static SelectItemsInRegionState get_instance(FloatPoint p_location, InteractiveState p_parent_state,
BoardHandling p_board_handling, Logfile p_logfile)
BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
p_board_handling.display_layer_messsage();
SelectItemsInRegionState new_instance =
new SelectItemsInRegionState(p_parent_state, p_board_handling, p_logfile);
new SelectItemsInRegionState(p_parent_state, p_board_handling, p_activityReplayFile);
new_instance.corner1 = p_location;
if (new_instance.logfile != null)
if (new_instance.activityReplayFile != null)
{
new_instance.logfile.add_corner(p_location);
new_instance.activityReplayFile.add_corner(p_location);
}
new_instance.hdlg.screen_messages.set_status_message(new_instance.resources.getString("drag_left_mouse_button_to_selects_items_in_region"));
return new_instance;
@ -69,12 +69,12 @@ public class SelectItemsInRegionState extends SelectRegionState
/** Creates a new instance of SelectItemsInRegionState */
private SelectItemsInRegionState(InteractiveState p_parent_state,
BoardHandling p_board_handling, Logfile p_logfile)
BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
if (logfile != null)
super(p_parent_state, p_board_handling, p_activityReplayFile);
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.SELECT_REGION);
activityReplayFile.start_scope(ActivityReplayFileScope.SELECT_REGION);
}
}
@ -84,9 +84,9 @@ public class SelectItemsInRegionState extends SelectRegionState
{
hdlg.screen_messages.set_status_message("");
corner2 = hdlg.get_current_mouse_position();
if (logfile != null)
if (activityReplayFile != null)
{
logfile.add_corner(corner2);
activityReplayFile.add_corner(corner2);
}
this.select_all_in_region();
}
@ -140,7 +140,7 @@ public class SelectItemsInRegionState extends SelectRegionState
}
else
{
this.return_state = SelectedItemState.get_instance(found_items, this.return_state, hdlg, logfile);
this.return_state = SelectedItemState.get_instance(found_items, this.return_state, hdlg, activityReplayFile);
}
}
else

View File

@ -34,16 +34,16 @@ import eu.mihosoft.freerouting.geometry.planar.FloatPoint;
public class SelectMenuState extends MenuState
{
/** Returns a new instance of SelectMenuState */
public static SelectMenuState get_instance(BoardHandling p_board_handling, Logfile p_logfile)
public static SelectMenuState get_instance(BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
SelectMenuState new_state = new SelectMenuState(p_board_handling, p_logfile);
SelectMenuState new_state = new SelectMenuState(p_board_handling, p_activityReplayFile);
return new_state;
}
/** Creates a new instance of SelectMenuState */
private SelectMenuState(BoardHandling p_board_handling, Logfile p_logfile)
private SelectMenuState(BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_board_handling, p_logfile);
super(p_board_handling, p_activityReplayFile);
}
public InteractiveState left_button_clicked(FloatPoint p_location)
@ -54,7 +54,7 @@ public class SelectMenuState extends MenuState
public InteractiveState mouse_dragged(FloatPoint p_point)
{
return SelectItemsInRegionState.get_instance(hdlg.get_current_mouse_position(), this, hdlg, logfile);
return SelectItemsInRegionState.get_instance(hdlg.get_current_mouse_position(), this, hdlg, activityReplayFile);
}
public void display_default_message()

View File

@ -34,9 +34,9 @@ public class SelectRegionState extends InteractiveState
{
/** Creates a new instance of SelectRegionState */
protected SelectRegionState(InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
protected SelectRegionState(InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
super(p_parent_state, p_board_handling, p_activityReplayFile);
}
public InteractiveState button_released()
@ -50,9 +50,9 @@ public class SelectRegionState extends InteractiveState
if (corner1 == null)
{
corner1 = p_point;
if (logfile != null)
if (activityReplayFile != null)
{
logfile.add_corner(corner1);
activityReplayFile.add_corner(corner1);
}
}
hdlg.repaint();

View File

@ -66,20 +66,20 @@ public class SelectedItemState extends InteractiveState
* Creates a new SelectedItemState with with the items in p_item_list selected.
* Returns null, if p_item_list is empty.
*/
public static SelectedItemState get_instance(Set<Item> p_item_list, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
public static SelectedItemState get_instance(Set<Item> p_item_list, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
if (p_item_list.isEmpty())
{
return null;
}
SelectedItemState new_state = new SelectedItemState(p_item_list, p_parent_state, p_board_handling, p_logfile);
SelectedItemState new_state = new SelectedItemState(p_item_list, p_parent_state, p_board_handling, p_activityReplayFile);
return new_state;
}
/** Creates a new instance of SelectedItemState */
private SelectedItemState(Set<Item> p_item_list, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
private SelectedItemState(Set<Item> p_item_list, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
super(p_parent_state, p_board_handling, p_activityReplayFile);
item_list = p_item_list;
}
@ -98,7 +98,7 @@ public class SelectedItemState extends InteractiveState
public InteractiveState mouse_dragged(FloatPoint p_point)
{
return SelectItemsInRegionState.get_instance(hdlg.get_current_mouse_position(), this, hdlg, logfile);
return SelectItemsInRegionState.get_instance(hdlg.get_current_mouse_position(), this, hdlg, activityReplayFile);
}
/**
@ -135,7 +135,7 @@ public class SelectedItemState extends InteractiveState
else if (p_key_char == 'm')
{
result = MoveItemState.get_instance(hdlg.get_current_mouse_position(), item_list,
this.return_state, hdlg, logfile);
this.return_state, hdlg, activityReplayFile);
}
else if (p_key_char == 'n')
{
@ -147,7 +147,7 @@ public class SelectedItemState extends InteractiveState
}
else if (p_key_char == 'r')
{
result = ZoomRegionState.get_instance(hdlg.get_current_mouse_position(), this, hdlg, logfile);
result = ZoomRegionState.get_instance(hdlg.get_current_mouse_position(), this, hdlg, activityReplayFile);
}
else if (p_key_char == 's')
{
@ -190,9 +190,9 @@ public class SelectedItemState extends InteractiveState
curr_ob.set_fixed_state(FixedState.USER_FIXED);
}
}
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.FIX_SELECTED_ITEMS);
activityReplayFile.start_scope(ActivityReplayFileScope.FIX_SELECTED_ITEMS);
}
}
@ -207,9 +207,9 @@ public class SelectedItemState extends InteractiveState
Item curr_ob = it.next();
curr_ob.unfix();
}
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.UNFIX_SELECTED_ITEMS);
activityReplayFile.start_scope(ActivityReplayFileScope.UNFIX_SELECTED_ITEMS);
}
}
@ -253,9 +253,9 @@ public class SelectedItemState extends InteractiveState
{
hdlg.screen_messages.set_status_message(resources.getString("new_net_created_from_selected_items"));
}
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.ASSIGN_SELECTED_TO_NEW_NET);
activityReplayFile.start_scope(ActivityReplayFileScope.ASSIGN_SELECTED_TO_NEW_NET);
}
hdlg.update_ratsnest();
hdlg.repaint();
@ -321,9 +321,9 @@ public class SelectedItemState extends InteractiveState
}
board.insert_pin(new_component.no, i, net_no_arr, curr_via.clearance_class_no(), curr_via.get_fixed_state());
}
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.ASSIGN_SELECTED_TO_NEW_GROUP);
activityReplayFile.start_scope(ActivityReplayFileScope.ASSIGN_SELECTED_TO_NEW_GROUP);
}
hdlg.repaint();
return this.return_state;
@ -366,9 +366,9 @@ public class SelectedItemState extends InteractiveState
{
hdlg.screen_messages.set_status_message(resources.getString("some_items_are_fixed_and_could_therefore_not_be_removed"));
}
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.DELETE_SELECTED);
activityReplayFile.start_scope(ActivityReplayFileScope.DELETE_SELECTED);
}
for (Integer curr_net_no : changed_nets)
@ -384,7 +384,7 @@ public class SelectedItemState extends InteractiveState
*/
public InteractiveState cutout_items()
{
return CutoutRouteState.get_instance(this.item_list, this.return_state, hdlg, logfile);
return CutoutRouteState.get_instance(this.item_list, this.return_state, hdlg, activityReplayFile);
}
/**
@ -485,9 +485,9 @@ public class SelectedItemState extends InteractiveState
hdlg.screen_messages.set_status_message(end_message);
}
hdlg.set_board_read_only(saved_board_read_only);
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.AUTOROUTE_SELECTED);
activityReplayFile.start_scope(ActivityReplayFileScope.AUTOROUTE_SELECTED);
}
hdlg.update_ratsnest();
if (!ratsnest_hidden_before)
@ -572,9 +572,9 @@ public class SelectedItemState extends InteractiveState
hdlg.screen_messages.set_status_message(end_message);
}
hdlg.set_board_read_only(saved_board_read_only);
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.FANOUT_SELECTED);
activityReplayFile.start_scope(ActivityReplayFileScope.FANOUT_SELECTED);
}
hdlg.update_ratsnest();
if (!ratsnest_hidden_before)
@ -649,9 +649,9 @@ public class SelectedItemState extends InteractiveState
hdlg.screen_messages.set_status_message(end_message);
}
hdlg.set_board_read_only(saved_board_read_only);
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.OPTIMIZE_SELECTED);
activityReplayFile.start_scope(ActivityReplayFileScope.OPTIMIZE_SELECTED);
}
hdlg.update_ratsnest();
return this.return_state;
@ -667,10 +667,10 @@ public class SelectedItemState extends InteractiveState
{
return this.return_state;
}
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.ASSIGN_CLEARANCE_CLASS);
logfile.add_int(p_cl_class_index);
activityReplayFile.start_scope(ActivityReplayFileScope.ASSIGN_CLEARANCE_CLASS);
activityReplayFile.add_int(p_cl_class_index);
}
// make the situation restorable by undo
routing_board.generate_snapshot();
@ -717,9 +717,9 @@ public class SelectedItemState extends InteractiveState
{
return this.return_state;
}
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.EXTEND_TO_WHOLE_NETS);
activityReplayFile.start_scope(ActivityReplayFileScope.EXTEND_TO_WHOLE_NETS);
}
filter();
hdlg.repaint();
@ -756,9 +756,9 @@ public class SelectedItemState extends InteractiveState
return this.return_state;
}
this.item_list = new_selected_items;
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.EXTEND_TO_WHOLE_COMPONENTS);
activityReplayFile.start_scope(ActivityReplayFileScope.EXTEND_TO_WHOLE_COMPONENTS);
}
hdlg.repaint();
return this;
@ -784,9 +784,9 @@ public class SelectedItemState extends InteractiveState
return this.return_state;
}
this.item_list = new_selected_items;
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.EXTEND_TO_WHOLE_CONNECTED_SETS);
activityReplayFile.start_scope(ActivityReplayFileScope.EXTEND_TO_WHOLE_CONNECTED_SETS);
}
filter();
hdlg.repaint();
@ -813,9 +813,9 @@ public class SelectedItemState extends InteractiveState
return this.return_state;
}
this.item_list = new_selected_items;
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.EXTEND_TO_WHOLE_CONNECTIONS);
activityReplayFile.start_scope(ActivityReplayFileScope.EXTEND_TO_WHOLE_CONNECTIONS);
}
filter();
hdlg.repaint();
@ -858,9 +858,9 @@ public class SelectedItemState extends InteractiveState
{
result = this;
}
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.TOGGLE_SELECT, p_point);
activityReplayFile.start_scope(ActivityReplayFileScope.TOGGLE_SELECT, p_point);
}
return result;
}

View File

@ -34,9 +34,9 @@ import eu.mihosoft.freerouting.board.RoutingBoard;
public class Settings implements java.io.Serializable
{
/** Creates a new eu.mihosoft.freerouting.interactive settings variable. */
public Settings(RoutingBoard p_board, Logfile p_logfile)
public Settings(RoutingBoard p_board, ActivityReplayFile p_activityReplayFile)
{
this.logfile = p_logfile;
this.activityReplayFile = p_activityReplayFile;
// Initialise with default values.
layer = 0;
push_enabled = true;
@ -69,7 +69,7 @@ public class Settings implements java.io.Serializable
*/
public Settings(Settings p_settings)
{
this.logfile = p_settings.logfile;
this.activityReplayFile = p_settings.activityReplayFile;
this.read_only = p_settings.read_only;
this.layer = p_settings.layer;
this.push_enabled = p_settings.push_enabled;
@ -304,7 +304,7 @@ public class Settings implements java.io.Serializable
return;
}
push_enabled = p_value;
logfile.start_scope(LogfileScope.SET_PUSH_ENABLED, p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_PUSH_ENABLED, p_value);
}
/**
@ -317,7 +317,7 @@ public class Settings implements java.io.Serializable
return;
}
drag_components_enabled = p_value;
logfile.start_scope(LogfileScope.SET_DRAG_COMPONENTS_ENABLED, p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_DRAG_COMPONENTS_ENABLED, p_value);
}
@ -332,7 +332,7 @@ public class Settings implements java.io.Serializable
return;
}
select_on_all_visible_layers = p_value;
logfile.start_scope(LogfileScope.SET_SELECT_ON_ALL_LAYER, p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_SELECT_ON_ALL_LAYER, p_value);
}
/** Route mode: stitching or dynamic */
@ -344,7 +344,7 @@ public class Settings implements java.io.Serializable
}
is_stitch_route = p_value;
logfile.start_scope(LogfileScope.SET_STITCH_ROUTE, p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_STITCH_ROUTE, p_value);
}
/**
@ -357,7 +357,7 @@ public class Settings implements java.io.Serializable
return;
}
trace_pull_tight_region_width = p_value;
logfile.start_scope(LogfileScope.SET_PULL_TIGHT_REGION_WIDTH, p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_PULL_TIGHT_REGION_WIDTH, p_value);
}
/**
@ -370,7 +370,7 @@ public class Settings implements java.io.Serializable
return;
}
trace_pull_tight_accuracy = p_value;
logfile.start_scope(LogfileScope.SET_PULL_TIGHT_ACCURACY, p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_PULL_TIGHT_ACCURACY, p_value);
}
/**
@ -396,7 +396,7 @@ public class Settings implements java.io.Serializable
return;
}
manual_rule_selection = p_value;
logfile.start_scope(LogfileScope.SET_MANUAL_TRACEWITH_SELECTION, p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_MANUAL_TRACEWITH_SELECTION, p_value);
}
/**
@ -409,8 +409,8 @@ public class Settings implements java.io.Serializable
return;
}
manual_trace_half_width_arr[p_layer_no] = p_value;
logfile.start_scope(LogfileScope.SET_MANUAL_TRACE_HALF_WIDTH, p_layer_no);
logfile.add_int(p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_MANUAL_TRACE_HALF_WIDTH, p_layer_no);
activityReplayFile.add_int(p_value);
}
@ -425,7 +425,7 @@ public class Settings implements java.io.Serializable
return;
}
manual_trace_clearance_class = p_index;
logfile.start_scope(LogfileScope.SET_MANUAL_TRACE_CLEARANCE_CLASS, p_index);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_MANUAL_TRACE_CLEARANCE_CLASS, p_index);
}
/**
@ -440,9 +440,9 @@ public class Settings implements java.io.Serializable
if (zoom_with_wheel != p_value)
{
zoom_with_wheel = p_value;
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.SET_ZOOM_WITH_WHEEL, p_value);
activityReplayFile.start_scope(ActivityReplayFileScope.SET_ZOOM_WITH_WHEEL, p_value);
}
}
}
@ -458,7 +458,7 @@ public class Settings implements java.io.Serializable
}
item_selection_filter.set_selected(p_item_type, p_value);
logfile.start_scope(LogfileScope.SET_SELECTABLE, p_item_type.ordinal());
activityReplayFile.start_scope(ActivityReplayFileScope.SET_SELECTABLE, p_item_type.ordinal());
int logged_value;
if (p_value)
{
@ -468,7 +468,7 @@ public class Settings implements java.io.Serializable
{
logged_value = 0;
}
logfile.add_int(logged_value);
activityReplayFile.add_int(logged_value);
}
/**
@ -479,9 +479,9 @@ public class Settings implements java.io.Serializable
this.read_only = p_value;
}
void set_logfile(Logfile p_logfile)
void set_logfile(ActivityReplayFile p_activityReplayFile)
{
this.logfile = p_logfile;
this.activityReplayFile = p_activityReplayFile;
}
/** Reads an instance of this class from a file */
@ -583,5 +583,5 @@ public class Settings implements java.io.Serializable
* The file used for logging eu.mihosoft.freerouting.interactive action,
* so that they can be replayed later
*/
private transient Logfile logfile;
private transient ActivityReplayFile activityReplayFile;
}

View File

@ -91,7 +91,7 @@ public class SnapShot implements java.io.Serializable
if (snapshot_attributes.interactive_state)
{
p_board_handling.set_interactive_state(this.get_interactive_state(p_board_handling, p_board_handling.logfile));
p_board_handling.set_interactive_state(this.get_interactive_state(p_board_handling, p_board_handling.activityReplayFile));
}
if (snapshot_attributes.selection_layers)
{
@ -143,20 +143,20 @@ public class SnapShot implements java.io.Serializable
/**
* Returns a new InterativeState from the data of this instance.
*/
public InteractiveState get_interactive_state(BoardHandling p_board_handling, Logfile p_logfile)
public InteractiveState get_interactive_state(BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
InteractiveState result;
if (this.interactive_state_no == 1)
{
result = RouteMenuState.get_instance(p_board_handling, p_logfile);
result = RouteMenuState.get_instance(p_board_handling, p_activityReplayFile);
}
else if (this.interactive_state_no == 2)
{
result = DragMenuState.get_instance(p_board_handling, p_logfile);
result = DragMenuState.get_instance(p_board_handling, p_activityReplayFile);
}
else
{
result = SelectMenuState.get_instance(p_board_handling, p_logfile);
result = SelectMenuState.get_instance(p_board_handling, p_activityReplayFile);
}
return result;
}

View File

@ -35,9 +35,9 @@ public class StitchRouteState extends RouteState
{
/** Creates a new instance of StichRouteState */
protected StitchRouteState(InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
protected StitchRouteState(InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
super(p_parent_state, p_board_handling, p_activityReplayFile);
}
public InteractiveState left_button_clicked(FloatPoint p_location)

View File

@ -49,18 +49,18 @@ public class TileConstructionState extends CornerItemConstructionState
* Returns a new instance of this class
* If p_logfile != null; the creation of this item is stored in a logfile
*/
public static TileConstructionState get_instance(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
public static TileConstructionState get_instance(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
return new TileConstructionState(p_location, p_parent_state, p_board_handling, p_logfile);
return new TileConstructionState(p_location, p_parent_state, p_board_handling, p_activityReplayFile);
}
/** Creates a new instance of TileConstructionState */
private TileConstructionState(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
private TileConstructionState(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
if (this.logfile != null)
super(p_parent_state, p_board_handling, p_activityReplayFile);
if (this.activityReplayFile != null)
{
logfile.start_scope(LogfileScope.CREATING_TILE);
activityReplayFile.start_scope(ActivityReplayFileScope.CREATING_TILE);
}
this.add_corner(p_location);
}
@ -131,9 +131,9 @@ public class TileConstructionState extends CornerItemConstructionState
{
hdlg.screen_messages.set_status_message(resources.getString("keepout_cancelled_because_of_overlaps"));
}
if (logfile != null)
if (activityReplayFile != null)
{
logfile.start_scope(LogfileScope.COMPLETE_SCOPE);
activityReplayFile.start_scope(ActivityReplayFileScope.COMPLETE_SCOPE);
}
return this.return_state;
}

View File

@ -37,29 +37,29 @@ public class ZoomRegionState extends SelectRegionState
/**
* Returns a new instance of this class.
*/
public static ZoomRegionState get_instance(InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
public static ZoomRegionState get_instance(InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
return get_instance(null, p_parent_state, p_board_handling, p_logfile);
return get_instance(null, p_parent_state, p_board_handling, p_activityReplayFile);
}
/**
* Returns a new instance of this class with first point p_location.
*/
public static ZoomRegionState get_instance(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
public static ZoomRegionState get_instance(FloatPoint p_location, InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
ZoomRegionState new_instance = new ZoomRegionState(p_parent_state, p_board_handling, p_logfile);
ZoomRegionState new_instance = new ZoomRegionState(p_parent_state, p_board_handling, p_activityReplayFile);
new_instance.corner1 = p_location;
new_instance.hdlg.screen_messages.set_status_message(new_instance.resources.getString("drag_left_mouse_button_to_create_region_to_display"));
return new_instance;
}
/** Creates a new instance of ZoomRegionState */
public ZoomRegionState(InteractiveState p_parent_state, BoardHandling p_board_handling, Logfile p_logfile)
public ZoomRegionState(InteractiveState p_parent_state, BoardHandling p_board_handling, ActivityReplayFile p_activityReplayFile)
{
super(p_parent_state, p_board_handling, p_logfile);
if (this.logfile != null)
super(p_parent_state, p_board_handling, p_activityReplayFile);
if (this.activityReplayFile != null)
{
logfile.start_scope(eu.mihosoft.freerouting.interactive.LogfileScope.ZOOM_FRAME);
activityReplayFile.start_scope(ActivityReplayFileScope.ZOOM_FRAME);
}
}
@ -67,9 +67,9 @@ public class ZoomRegionState extends SelectRegionState
{
corner2 = hdlg.get_current_mouse_position();
zoom_region();
if (this.logfile != null)
if (this.activityReplayFile != null)
{
logfile.add_corner(corner2);
activityReplayFile.add_corner(corner2);
}
return this.return_state;
}

View File

@ -1,19 +1,41 @@
package eu.mihosoft.freerouting.logger;
/**
* Andrey Belomutskiy
* 6/28/2014
*/
import eu.mihosoft.freerouting.FreeRouting;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.appender.ConsoleAppender;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.logging.log4j.core.config.builder.api.*;
import org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration;
import java.text.DecimalFormat;
import java.time.Duration;
import java.time.Instant;
import java.util.HashMap;
public class FRLogger {
public static void warning(String message) {
/**
* there is a problem that errors are currently being written to standard console and thus not visible to the
* user
*/
System.out.println(message);
public static Logger logger = LogManager.getLogger(FreeRouting.class);
private static DecimalFormat performanceFormat = new DecimalFormat("0.00");
private static HashMap<Integer, Instant> perfData = new HashMap<Integer, Instant>();
public static void traceEntry(String perfId)
{
perfData.put(perfId.hashCode(), java.time.Instant.now());
}
public static void error(Throwable e) {
e.printStackTrace();
public static void traceExit(String perfId)
{
var timeElapsed = Duration.between(perfData.get(perfId.hashCode()), java.time.Instant.now()).toMillis();
perfData.remove(perfId.hashCode());
if (timeElapsed < 0) {
timeElapsed = 0;
}
logger.trace("Method '" + perfId + "' was performed in " + performanceFormat.format(timeElapsed/1000.0) + " seconds.");
}
}

View File

@ -9,10 +9,10 @@ cancel_and_exit = Cancel and Exit
cancel_and_exit_tooltip = exits the program without saving the design
save_as = Save as
save_as_tooltip = use extensions .bin for binary and .dsn for Specctra text format
generate_logfile = Generate Logfile
generate_logfile_tooltip = starts writing the interactive actions to a logfile
replay_logfile = Replay Logfile
replay_logfile_tooltip = repeats the interactive actions stored in a logfile
generate_logfile = Start recording actions
generate_logfile_tooltip = starts writing the interactive actions into an activity replay file
replay_logfile = Replay recorded actions
replay_logfile_tooltip = repeats the interactive actions stored in an activity replay file
session_file = Export Specctra Session File
session_file_tooltip = writes a session file in the Specctra .ses format
eagle_script = Export Eagle Session Script

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Properties>
<Property name="filename">logs/freerouter.log</Property>
</Properties>
<ThresholdFilter level="trace"/>
<Appenders>
<File name="File" fileName="${filename}" bufferSize="1">
<PatternLayout>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n</pattern>
</PatternLayout>
</File>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="TRACE">
<AppenderRef ref="Console"/>
<AppenderRef ref="File"/>
</Root>
</Loggers>
</Configuration>