Final changes

This commit is contained in:
Robin K 2021-09-24 16:51:27 +02:00
parent e0b9545162
commit 7ae56ea61d
7 changed files with 24 additions and 31 deletions

View File

@ -28,6 +28,7 @@ import org.apache.log4j.Logger;
import com.romraider.Settings; import com.romraider.Settings;
import com.romraider.Settings.Endian; import com.romraider.Settings.Endian;
import com.romraider.editor.ecu.ECUEditorManager;
import com.romraider.util.ByteUtil; import com.romraider.util.ByteUtil;
import com.romraider.util.JEPUtil; import com.romraider.util.JEPUtil;
import com.romraider.util.NumberUtil; import com.romraider.util.NumberUtil;
@ -292,7 +293,10 @@ public class DataCell {
if(!table.isStaticDataTable() && this.isSelected != selected) { if(!table.isStaticDataTable() && this.isSelected != selected) {
this.isSelected = selected; this.isSelected = selected;
if(view!=null) view.drawCell(); if(view!=null) {
ECUEditorManager.getECUEditor().getTableToolBar().updateTableToolBar(table);
view.drawCell();
}
} }
} }

View File

@ -311,11 +311,13 @@ public class Rom extends DefaultMutableTreeNode implements Serializable {
} }
//Most of this function is useless now, since each Datacell is now responsible for each memory region //Most of this function is useless now, since each Datacell is now responsible for each memory region
//It is only used in the Switch Tables, since those don't use DataCells //It is only used to correct the Subaru Checksum. Should be moved somewhere else TODO
public byte[] saveFile() { public byte[] saveFile() {
final List<TableTreeNode> checksumTables = new ArrayList<TableTreeNode>(); final List<TableTreeNode> checksumTables = new ArrayList<TableTreeNode>();
for (TableTreeNode tableNode : tableNodes) { for (TableTreeNode tableNode : tableNodes) {
//Only used in BitwiseSwitch Table...
tableNode.getTable().saveFile(binData); tableNode.getTable().saveFile(binData);
if (tableNode.getTable().getName().contains("Checksum Fix")) { if (tableNode.getTable().getName().contains("Checksum Fix")) {
checksumTables.add(tableNode); checksumTables.add(tableNode);

View File

@ -27,9 +27,7 @@ import javax.naming.NameNotFoundException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.romraider.Settings; import com.romraider.Settings;
import com.romraider.editor.ecu.ECUEditorManager;
import com.romraider.swing.TableFrame; import com.romraider.swing.TableFrame;
import com.romraider.swing.TableToolBar;
import com.romraider.util.ByteUtil; import com.romraider.util.ByteUtil;
import com.romraider.util.JEPUtil; import com.romraider.util.JEPUtil;
import com.romraider.util.NumberUtil; import com.romraider.util.NumberUtil;
@ -611,11 +609,6 @@ public abstract class Table implements Serializable {
clearSelection(); clearSelection();
data[y].setSelected(true); data[y].setSelected(true);
if(tableView!=null) tableView.highlightY = y; if(tableView!=null) tableView.highlightY = y;
TableToolBar bar = ECUEditorManager.getECUEditor().getTableToolBar();
if(bar!=null)
bar.updateTableToolBar(this);
} }
} }
@ -623,11 +616,6 @@ public abstract class Table implements Serializable {
if(y >= 0 && y < data.length) { if(y >= 0 && y < data.length) {
data[y].setSelected(true); data[y].setSelected(true);
if(tableView!=null)tableView.highlightY = y; if(tableView!=null)tableView.highlightY = y;
TableToolBar bar = ECUEditorManager.getECUEditor().getTableToolBar();
if(bar!=null)
bar.updateTableToolBar(this);
} }
} }

View File

@ -95,10 +95,6 @@ public class Table2D extends Table {
@Override @Override
public byte[] saveFile(byte[] binData) { public byte[] saveFile(byte[] binData) {
/*
binData = super.saveFile(binData);
binData = axis.saveFile(binData);*/
return binData; return binData;
} }

View File

@ -48,9 +48,11 @@ public class TableBitwiseSwitchView extends TableView {
public TableBitwiseSwitchView(TableBitwiseSwitch table) { public TableBitwiseSwitchView(TableBitwiseSwitch table) {
super(table); super(table);
this.table = table;
removeAll(); removeAll();
setLayout(new BorderLayout()); setLayout(new BorderLayout());
checkboxes = new ArrayList<JCheckBox>(); checkboxes = new ArrayList<JCheckBox>();
populateTableVisual();
} }
@Override @Override

View File

@ -22,6 +22,7 @@ package com.romraider.maps;
public class TableSwitchView extends Table1DView { public class TableSwitchView extends Table1DView {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
//Same as a Table1DView just hidden data
public TableSwitchView(TableSwitch t) { public TableSwitchView(TableSwitch t) {
super(t, true); super(t, true);
} }

View File

@ -532,6 +532,15 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
if (fc.showSaveDialog(parent) == JFileChooser.APPROVE_OPTION) { if (fc.showSaveDialog(parent) == JFileChooser.APPROVE_OPTION) {
File selectedFile = fc.getSelectedFile(); File selectedFile = fc.getSelectedFile();
//Append suffix if user didn't set anything
if(!selectedFile.getName().contains(".")) {
Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom();
String lastFile = lastSelectedRom.getFileName().toLowerCase();
String format = ".bin";
if(lastFile.endsWith(".hex")) format=".hex";
selectedFile = new File(selectedFile + format);
}
if (selectedFile.exists()) { if (selectedFile.exists()) {
int option = showConfirmDialog(parent, int option = showConfirmDialog(parent,
MessageFormat.format( MessageFormat.format(
@ -544,15 +553,6 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
} }
} }
//Append suffix if user didnt set anything
if(!selectedFile.getName().contains(".")) {
Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom();
String lastFile = lastSelectedRom.getFileName().toLowerCase();
String format = ".bin";
if(lastFile.endsWith(".hex")) format=".hex";
selectedFile = new File(selectedFile + format);
}
return selectedFile; return selectedFile;
} }
return null; return null;