Moved COM port Auto Refresh to Settings menu to free up more control bar space.

git-svn-id: https://svn2.assembla.com/svn/romraider/trunk@356 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
Dale Schultz 2011-10-05 03:31:57 +00:00
parent e6938d8c02
commit db5be77439
5 changed files with 67 additions and 30 deletions

View File

@ -78,6 +78,7 @@ This is the first beta release of the upcoming official 0.5.4b release.
- Added a Debugging Level selection option to the Help menu. The setting is saved - Added a Debugging Level selection option to the Help menu. The setting is saved
and restored between sessions. INFO should be the normal state to keep the and restored between sessions. INFO should be the normal state to keep the
rr_system.log file in-check. rr_system.log file in-check.
- Moved the COM port Auto Refresh checkbox to the Settings menu.
--- Editor --- --- Editor ---
- Set JInternalFrame.isPalette in TableFarme.java so table titles are visible on - Set JInternalFrame.isPalette in TableFarme.java so table titles are visible on
Mac OS. Mac OS.

View File

@ -215,7 +215,6 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
private JLabel statsLabel; private JLabel statsLabel;
private JTabbedPane tabbedPane; private JTabbedPane tabbedPane;
private SerialPortComboBox portsComboBox; private SerialPortComboBox portsComboBox;
private JCheckBox portRefresh;
private DataUpdateHandlerManager dataHandlerManager; private DataUpdateHandlerManager dataHandlerManager;
private DataRegistrationBroker dataTabBroker; private DataRegistrationBroker dataTabBroker;
private ParameterListTableModel dataTabParamListTableModel; private ParameterListTableModel dataTabParamListTableModel;
@ -1065,15 +1064,6 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
JPanel comboBoxPanel = new JPanel(new FlowLayout()); JPanel comboBoxPanel = new JPanel(new FlowLayout());
comboBoxPanel.add(new JLabel("COM Port:")); comboBoxPanel.add(new JLabel("COM Port:"));
comboBoxPanel.add(portsComboBox); comboBoxPanel.add(portsComboBox);
portRefresh = new JCheckBox("Auto Refresh");
portRefresh.setToolTipText("Check to enable automatic COM port refreshing");
portRefresh.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
refresher.setRefreshMode(portRefresh.isSelected());
settings.setRefreshMode(portRefresh.isSelected());
}
});
comboBoxPanel.add(portRefresh);
final JCheckBox ecuCheckBox = new JCheckBox("ECU"); final JCheckBox ecuCheckBox = new JCheckBox("ECU");
final JCheckBox tcuCheckBox = new JCheckBox("TCU"); final JCheckBox tcuCheckBox = new JCheckBox("TCU");
@ -1456,8 +1446,8 @@ public final class EcuLogger extends AbstractFrame implements MessageListener {
} }
} }
private void setRefreshMode(boolean refreshMode) { public void setRefreshMode(boolean refreshMode) {
portRefresh.setSelected(refreshMode); settings.setRefreshMode(refreshMode);
refresher.setRefreshMode(refreshMode); refresher.setRefreshMode(refreshMode);
} }
} }

View File

@ -19,10 +19,26 @@
package com.romraider.logger.ecu.comms.manager; package com.romraider.logger.ecu.comms.manager;
import com.romraider.Settings;
import com.romraider.logger.ecu.comms.manager.PollingState;
import com.romraider.logger.ecu.comms.io.connection.LoggerConnection;
import static com.romraider.logger.ecu.comms.io.connection.LoggerConnectionFactory.getConnection; import static com.romraider.logger.ecu.comms.io.connection.LoggerConnectionFactory.getConnection;
import static com.romraider.logger.ecu.definition.EcuDataType.EXTERNAL;
import static com.romraider.util.ParamChecker.checkNotNull;
import static com.romraider.util.ThreadUtil.runAsDaemon;
import static com.romraider.util.ThreadUtil.sleep;
import static java.util.Collections.synchronizedList;
import static java.util.Collections.synchronizedMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.SwingUtilities;
import org.apache.log4j.Logger;
import com.romraider.Settings;
import com.romraider.logger.ecu.comms.io.connection.LoggerConnection;
import com.romraider.logger.ecu.comms.query.EcuInitCallback; import com.romraider.logger.ecu.comms.query.EcuInitCallback;
import com.romraider.logger.ecu.comms.query.EcuQuery; import com.romraider.logger.ecu.comms.query.EcuQuery;
import com.romraider.logger.ecu.comms.query.EcuQueryImpl; import com.romraider.logger.ecu.comms.query.EcuQueryImpl;
@ -32,30 +48,15 @@ import com.romraider.logger.ecu.comms.query.Query;
import com.romraider.logger.ecu.comms.query.Response; import com.romraider.logger.ecu.comms.query.Response;
import com.romraider.logger.ecu.comms.query.ResponseImpl; import com.romraider.logger.ecu.comms.query.ResponseImpl;
import com.romraider.logger.ecu.definition.EcuData; import com.romraider.logger.ecu.definition.EcuData;
import static com.romraider.logger.ecu.definition.EcuDataType.EXTERNAL;
import com.romraider.logger.ecu.definition.ExternalData; import com.romraider.logger.ecu.definition.ExternalData;
import com.romraider.logger.ecu.definition.LoggerData; import com.romraider.logger.ecu.definition.LoggerData;
import com.romraider.logger.ecu.ui.MessageListener; import com.romraider.logger.ecu.ui.MessageListener;
import com.romraider.logger.ecu.ui.StatusChangeListener; import com.romraider.logger.ecu.ui.StatusChangeListener;
import com.romraider.logger.ecu.ui.handler.DataUpdateHandler; import com.romraider.logger.ecu.ui.handler.DataUpdateHandler;
import com.romraider.logger.ecu.ui.handler.file.FileLoggerControllerSwitchMonitor; import com.romraider.logger.ecu.ui.handler.file.FileLoggerControllerSwitchMonitor;
import static com.romraider.util.ParamChecker.checkNotNull;
import static com.romraider.util.ThreadUtil.runAsDaemon;
import static com.romraider.util.ThreadUtil.sleep;
import static java.util.Collections.synchronizedList;
import static java.util.Collections.synchronizedMap;
import org.apache.log4j.Logger;
import javax.swing.SwingUtilities;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public final class QueryManagerImpl implements QueryManager { public final class QueryManagerImpl implements QueryManager {
private static final Logger LOGGER = Logger.getLogger(QueryManagerImpl.class); private static final Logger LOGGER = Logger.getLogger(QueryManagerImpl.class);
private final DecimalFormat format = new DecimalFormat("0.00");
private final List<StatusChangeListener> listeners = synchronizedList(new ArrayList<StatusChangeListener>()); private final List<StatusChangeListener> listeners = synchronizedList(new ArrayList<StatusChangeListener>());
private final Map<String, Query> queryMap = synchronizedMap(new HashMap<String, Query>()); private final Map<String, Query> queryMap = synchronizedMap(new HashMap<String, Query>());
private final Map<String, Query> addList = new HashMap<String, Query>(); private final Map<String, Query> addList = new HashMap<String, Query>();

View File

@ -25,6 +25,7 @@ import static java.awt.event.InputEvent.SHIFT_MASK;
import static java.awt.event.KeyEvent.VK_A; import static java.awt.event.KeyEvent.VK_A;
import static java.awt.event.KeyEvent.VK_C; import static java.awt.event.KeyEvent.VK_C;
import static java.awt.event.KeyEvent.VK_D; import static java.awt.event.KeyEvent.VK_D;
import static java.awt.event.KeyEvent.VK_E;
import static java.awt.event.KeyEvent.VK_F; import static java.awt.event.KeyEvent.VK_F;
import static java.awt.event.KeyEvent.VK_F7; import static java.awt.event.KeyEvent.VK_F7;
import static java.awt.event.KeyEvent.VK_H; import static java.awt.event.KeyEvent.VK_H;
@ -49,6 +50,7 @@ import javax.swing.JMenuBar;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import com.romraider.logger.ecu.EcuLogger; import com.romraider.logger.ecu.EcuLogger;
import com.romraider.logger.ecu.ui.swing.menubar.action.ComPortAutoRefreshAction;
import com.romraider.logger.ecu.ui.swing.menubar.action.DisconnectAction; import com.romraider.logger.ecu.ui.swing.menubar.action.DisconnectAction;
import com.romraider.logger.ecu.ui.swing.menubar.action.ExitAction; import com.romraider.logger.ecu.ui.swing.menubar.action.ExitAction;
import com.romraider.logger.ecu.ui.swing.menubar.action.FastPollModeAction; import com.romraider.logger.ecu.ui.swing.menubar.action.FastPollModeAction;
@ -92,9 +94,13 @@ public class EcuLoggerMenuBar extends JMenuBar {
settingsMenu.add(new MenuItem("Log File Output Location...", new LogFileLocationAction(logger), VK_O, getKeyStroke(VK_O, CTRL_MASK))); settingsMenu.add(new MenuItem("Log File Output Location...", new LogFileLocationAction(logger), VK_O, getKeyStroke(VK_O, CTRL_MASK)));
settingsMenu.add(new JSeparator()); settingsMenu.add(new JSeparator());
settingsMenu.add(new RadioButtonMenuItem("Control File Logging With Defogger Switch", VK_C, getKeyStroke(VK_C, CTRL_MASK), new LogFileControllerSwitchAction(logger), logger.getSettings().isFileLoggingControllerSwitchActive())); settingsMenu.add(new RadioButtonMenuItem("Control File Logging With Defogger Switch", VK_C, getKeyStroke(VK_C, CTRL_MASK), new LogFileControllerSwitchAction(logger), logger.getSettings().isFileLoggingControllerSwitchActive()));
RadioButtonMenuItem autoRefresh = new RadioButtonMenuItem("Enable COM port Auto Refresh", VK_E, getKeyStroke(VK_E, CTRL_MASK), new ComPortAutoRefreshAction(logger), logger.getSettings().getRefreshMode());
autoRefresh.setToolTipText("Select to enable automatic COM port refreshing");
settingsMenu.add(autoRefresh);
RadioButtonMenuItem fastPoll = new RadioButtonMenuItem("Enable Fast Polling Mode", VK_M, getKeyStroke(VK_M, CTRL_MASK), new FastPollModeAction(logger), logger.getSettings().isFastPoll()); RadioButtonMenuItem fastPoll = new RadioButtonMenuItem("Enable Fast Polling Mode", VK_M, getKeyStroke(VK_M, CTRL_MASK), new FastPollModeAction(logger), logger.getSettings().isFastPoll());
fastPoll.setToolTipText("Select to enable faster polling of the ECU"); fastPoll.setToolTipText("Select to enable faster polling of the ECU");
settingsMenu.add(fastPoll); settingsMenu.add(fastPoll);
settingsMenu.add(new JSeparator());
settingsMenu.add(new RadioButtonMenuItem("Use Absolute Timestamp In Log File", VK_T, getKeyStroke(VK_T, CTRL_MASK), new LogFileAbsoluteTimestampAction(logger), logger.getSettings().isFileLoggingAbsoluteTimestamp())); settingsMenu.add(new RadioButtonMenuItem("Use Absolute Timestamp In Log File", VK_T, getKeyStroke(VK_T, CTRL_MASK), new LogFileAbsoluteTimestampAction(logger), logger.getSettings().isFileLoggingAbsoluteTimestamp()));
add(settingsMenu); add(settingsMenu);

View File

@ -0,0 +1,39 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2010 RomRaider.com
*
* 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 2 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 for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.romraider.logger.ecu.ui.swing.menubar.action;
import com.romraider.logger.ecu.EcuLogger;
import com.romraider.swing.menubar.action.AbstractAction;
import java.awt.event.ActionEvent;
public final class ComPortAutoRefreshAction extends AbstractAction {
public ComPortAutoRefreshAction(EcuLogger logger) {
super(logger);
}
public void actionPerformed(ActionEvent actionEvent) {
try {
logger.setRefreshMode((Boolean) getValue(SELECTED_KEY));
} catch (Exception e) {
logger.reportError(e);
}
}
}