diff --git a/help/en/JavaHelpSearch/DOCS b/help/en/JavaHelpSearch/DOCS index a1f4132187c..133f7d64e1c 100644 Binary files a/help/en/JavaHelpSearch/DOCS and b/help/en/JavaHelpSearch/DOCS differ diff --git a/help/en/JavaHelpSearch/DOCS.TAB b/help/en/JavaHelpSearch/DOCS.TAB index 27502e3cd4d..a1a3cbc5788 100644 Binary files a/help/en/JavaHelpSearch/DOCS.TAB and b/help/en/JavaHelpSearch/DOCS.TAB differ diff --git a/help/en/JavaHelpSearch/OFFSETS b/help/en/JavaHelpSearch/OFFSETS index 8c9be103c52..30bbf18f52e 100644 Binary files a/help/en/JavaHelpSearch/OFFSETS and b/help/en/JavaHelpSearch/OFFSETS differ diff --git a/help/en/JavaHelpSearch/POSITIONS b/help/en/JavaHelpSearch/POSITIONS index 05ff756ff93..80c19f0e98a 100644 Binary files a/help/en/JavaHelpSearch/POSITIONS and b/help/en/JavaHelpSearch/POSITIONS differ diff --git a/help/en/JavaHelpSearch/SCHEMA b/help/en/JavaHelpSearch/SCHEMA index 4bd102cae2c..7943901a6fc 100644 --- a/help/en/JavaHelpSearch/SCHEMA +++ b/help/en/JavaHelpSearch/SCHEMA @@ -1,2 +1,2 @@ JavaSearch 1.0 -TMAP bs=2048 rt=72 fl=-1 id1=15445 id2=1 +TMAP bs=2048 rt=78 fl=-1 id1=15483 id2=1 diff --git a/help/en/JavaHelpSearch/TMAP b/help/en/JavaHelpSearch/TMAP index 9159cea8bfe..9933f5de9b9 100644 Binary files a/help/en/JavaHelpSearch/TMAP and b/help/en/JavaHelpSearch/TMAP differ diff --git a/help/en/Map.jhm b/help/en/Map.jhm index 2b713084486..12e8002689f 100644 --- a/help/en/Map.jhm +++ b/help/en/Map.jhm @@ -2048,6 +2048,8 @@ + + @@ -3218,6 +3220,8 @@ + + @@ -3778,6 +3782,8 @@ + + diff --git a/java/src/jmri/jmrit/beantable/TransitTableAction.java b/java/src/jmri/jmrit/beantable/TransitTableAction.java index a466efdac4b..59430fb0b0d 100644 --- a/java/src/jmri/jmrit/beantable/TransitTableAction.java +++ b/java/src/jmri/jmrit/beantable/TransitTableAction.java @@ -770,12 +770,19 @@ void removeLastSectionPressed(ActionEvent e) { curSequenceNum--; curSection = sectionList.get(j - 1); curSectionDirection = direction[j - 1]; + // delete alternate if present int k = j - 2; while ((k >= 0) && alternate[k]) { k--; } - prevSection = sectionList.get(k); - prevSectionDirection = direction[k]; + // After this delete we need the new previous section, if there is one. + if (k < 0) { + // There is no previous section + prevSection = null; + } else { + prevSection = sectionList.get(k); + prevSectionDirection = direction[k]; + } } sectionList.remove(j); initializeSectionCombos(); diff --git a/java/src/jmri/jmrit/dispatcher/AutoTurnouts.java b/java/src/jmri/jmrit/dispatcher/AutoTurnouts.java index 65d5372eb6b..44f0eae74a7 100644 --- a/java/src/jmri/jmrit/dispatcher/AutoTurnouts.java +++ b/java/src/jmri/jmrit/dispatcher/AutoTurnouts.java @@ -184,30 +184,17 @@ private boolean turnoutUtil(Section s, int seqNum, Section nextSection, // next Block is outside of the Section nextBlock = exitPt.getFromBlock(); } else { - if (!at.isAllocationReversed()) { - if (direction == Section.FORWARD) { - nextBlock = s.getBlockBySequenceNumber(curBlockSeqNum + 1); - nextBlockSeqNum = curBlockSeqNum + 1; - } else if (direction == Section.REVERSE) { - nextBlock = s.getBlockBySequenceNumber(curBlockSeqNum - 1); - nextBlockSeqNum = curBlockSeqNum - 1; - } - if ((nextBlock == null) && (curBlock != at.getEndBlock())) { - log.error("Error in block sequence numbers fwd when setting/checking turnouts"); - return false; - } - } else { - if (direction == Section.REVERSE) { - nextBlock = s.getBlockBySequenceNumber(curBlockSeqNum + 1); - nextBlockSeqNum = curBlockSeqNum + 1; - } else if (direction == Section.FORWARD) { - nextBlock = s.getBlockBySequenceNumber(curBlockSeqNum - 1); - nextBlockSeqNum = curBlockSeqNum - 1; - } - if ((nextBlock == null) && (curBlock != at.getStartBlock())) { - log.error("Error in block sequence numbers rev when setting/checking turnouts"); - return false; - } + // next Block is inside the Section + if (direction == Section.FORWARD) { + nextBlock = s.getBlockBySequenceNumber(curBlockSeqNum + 1); + nextBlockSeqNum = curBlockSeqNum + 1; + } else if (direction == Section.REVERSE) { + nextBlock = s.getBlockBySequenceNumber(curBlockSeqNum - 1); + nextBlockSeqNum = curBlockSeqNum - 1; + } + if ((nextBlock == null) && (curBlock != at.getEndBlock())) { + log.error("Error in block sequence numbers when setting/checking turnouts"); + return false; } } diff --git a/java/src/jmri/jmrit/dispatcher/DispatcherBundle.properties b/java/src/jmri/jmrit/dispatcher/DispatcherBundle.properties index d9cdf46a76f..e9dc9038351 100644 --- a/java/src/jmri/jmrit/dispatcher/DispatcherBundle.properties +++ b/java/src/jmri/jmrit/dispatcher/DispatcherBundle.properties @@ -112,8 +112,8 @@ DestinationBlockBoxLabel = Destination Location of Train DestinationBlockBoxHint = Select the Block where the Train will be located when Transit ends. AutoRun = Run Train Automatically AllocateMethodLabel = Allocation Method -AllocateMethodBoxHint = Number of Blocks ahead to auto allocate -NumberOfBlocks = Number of Blocks +AllocateMethodBoxHint = Number of Sections ahead to auto allocate +NumberOfBlocks = Number of Sections AsFarAsPos = As Far As Pos ToSafeSections = To Safe Secs UseSpeedProfileLabel = Use Speed Profile diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditor.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditor.java index e363877d5da..9338ae6decd 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditor.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditor.java @@ -2090,10 +2090,13 @@ public static void setupComboBox(@Nonnull JmriBeanComboBox inComboBox, boolean i inComboBox.setValidateMode(inValidateMode); inComboBox.setText(""); + // This has to be set before calling setupComboBoxMaxRows + // (otherwise if inFirstBlank then the number of rows will be wrong) + inComboBox.setFirstItemBlank(inFirstBlank); + // set the max number of rows that will fit onscreen JComboBoxUtil.setupComboBoxMaxRows(inComboBox); - inComboBox.setFirstItemBlank(inFirstBlank); inComboBox.setSelectedIndex(-1); } //setupComboBox @@ -2849,7 +2852,7 @@ public void menuCanceled(MenuEvent event) { /*============================================*\ |* LayoutTrackDrawingOptions accessor methods *| \*============================================*/ - private LayoutTrackDrawingOptions layoutTrackDrawingOptions = null; + private transient LayoutTrackDrawingOptions layoutTrackDrawingOptions = null; public LayoutTrackDrawingOptions getLayoutTrackDrawingOptions() { if (layoutTrackDrawingOptions == null) { @@ -5707,6 +5710,11 @@ && allControlling() && !isMetaDown(event) && !event.isAltDown() && !event.isPopu prevSelectedObject = selectedObject; selectedObject = null; } + + // clear these + beginObject = null; + foundObject = null; + isDragging = false; delayedPopupTrigger = false; requestFocusInWindow(); diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorBundle.properties b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorBundle.properties index 2a09c3677f3..37fff0d8dac 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorBundle.properties +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorBundle.properties @@ -636,7 +636,8 @@ CheckUnBlockedTracksMenuTitle = Un-Blocked Tracks CheckUnBlockedTracksMenuToolTip = Select this to check for tracks that do not have an assigned block CheckNonContiguousBlocksMenuTitle = Non-Contiguous Blocks CheckNonContiguousBlocksMenuToolTip = Select this to check for blocks that are not contiguous - +CheckUnnecessaryAnchorsMenuTitle = Unnecessary Anchors +CheckUnnecessaryAnchorsMenuToolTip = Select this to check if the adjacent track segments can be merged #LayoutTrackDrawingOptionsDialog properties # # the presets diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorChecks.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorChecks.java index 9324345d92d..b09e4cadb4d 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorChecks.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutEditorChecks.java @@ -32,15 +32,18 @@ public class LayoutEditorChecks { private JMenuItem checkInProgressMenuItem = new JMenuItem(Bundle.getMessage("CheckInProgressMenuItemTitle")); private JMenuItem checkNoResultsMenuItem = new JMenuItem(Bundle.getMessage("CheckNoResultsMenuItemTitle")); - // Check Un-Connected Tracks + // Check for Un-Connected Tracks private JMenu checkUnConnectedTracksMenu = new JMenu(Bundle.getMessage("CheckUnConnectedTracksMenuTitle")); - // Check Un-Blocked Tracks + // Check for Un-Blocked Tracks private JMenu checkUnBlockedTracksMenu = new JMenu(Bundle.getMessage("CheckUnBlockedTracksMenuTitle")); - // Check Non-Contiguous Blocks + // Check for Non-Contiguous Blocks private JMenu checkNonContiguousBlocksMenu = new JMenu(Bundle.getMessage("CheckNonContiguousBlocksMenuTitle")); + // Check for Unnecessary Anchors + private JMenu checkUnnecessaryAnchorsMenu = new JMenu(Bundle.getMessage("CheckUnnecessaryAnchorsMenuTitle")); + /** * The constructor for this class * @@ -65,6 +68,7 @@ public void menuSelected(@Nonnull MenuEvent menuEvent) { checkUnConnectedTracksMenu.setEnabled(enabled); checkUnBlockedTracksMenu.setEnabled(enabled); checkNonContiguousBlocksMenu.setEnabled(enabled); + checkUnnecessaryAnchorsMenu.setEnabled(enabled); } @Override @@ -169,6 +173,34 @@ public void menuCanceled(@Nonnull MenuEvent menuEvent) { //nothing to see here... move along... } }); + + // + // Check for Unnecessary Anchors + // + checkUnnecessaryAnchorsMenu.setToolTipText(Bundle.getMessage("CheckUnnecessaryAnchorsMenuToolTip")); + checkUnnecessaryAnchorsMenu.add(checkInProgressMenuItem); + checkMenu.add(checkUnnecessaryAnchorsMenu); + + checkUnnecessaryAnchorsMenu.addMenuListener(new MenuListener() { + @Override + public void menuSelected(@Nonnull MenuEvent menuEvent) { + log.debug("menuSelected"); + setupCheckUnnecessaryAnchorsMenu(); + } + + @Override + public void menuDeselected(@Nonnull MenuEvent menuEvent) { + log.debug("menuDeselected"); + //nothing to see here... move along... + } + + @Override + public void menuCanceled(@Nonnull MenuEvent menuEvent) { + log.debug("menuCanceled"); + //nothing to see here... move along... + } + }); + } // @@ -187,9 +219,6 @@ private void setupCheckUnConnectedTracksMenu() { // check all tracks for free connections List trackNames = new ArrayList<>(); for (LayoutTrack layoutTrack : layoutEditor.getLayoutTracks()) { - //if (layoutTrack.getName().equals("EC5")) { - // log.debug("Stop here!"); - //} List connections = layoutTrack.checkForFreeConnections(); if (!connections.isEmpty()) { // add this track's name to the list of track names @@ -207,17 +236,12 @@ private void setupCheckUnConnectedTracksMenu() { JCheckBoxMenuItem jmi = new JCheckBoxMenuItem(trackName); checkUnConnectedTracksMenu.add(jmi); jmi.addActionListener((ActionEvent event) -> { -// JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) event.getSource(); -// String menuItemName = menuItem.getText(); doCheckUnConnectedTracksMenuItem(trackName); }); // if it's in the check marked set then (re-)checkmark it - for (String item : checkMarkedMenuItemNamesSet) { - if (item.equals(trackName)) { - jmi.setSelected(true); - break; - } + if (checkMarkedMenuItemNamesSet.contains(trackName)) { + jmi.setSelected(true); } } } else { @@ -276,17 +300,12 @@ private void setupCheckUnBlockedTracksMenu() { JCheckBoxMenuItem jmi = new JCheckBoxMenuItem(trackName); checkUnBlockedTracksMenu.add(jmi); jmi.addActionListener((ActionEvent event) -> { -// JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) event.getSource(); -// String menuItemName = menuItem.getText(); doCheckUnBlockedTracksMenuItem(trackName); }); // if it's in the check marked set then (re-)checkmark it - for (String item : checkMarkedMenuItemNamesSet) { - if (item.equals(trackName)) { - jmi.setSelected(true); - break; - } + if (checkMarkedMenuItemNamesSet.contains(trackName)) { + jmi.setSelected(true); } } } else { @@ -327,12 +346,6 @@ private void setupCheckNonContiguousBlocksMenu() { // collect all contiguous blocks HashMap>> blockNamesToTrackNameSetMaps = new HashMap<>(); for (LayoutTrack layoutTrack : layoutEditor.getLayoutTracks()) { - //if (layoutTrack.getName().equals("TO1") - // || layoutTrack.getName().equals("TO2") - // || layoutTrack.getName().equals("TO3")) { - - // log.debug("*Stop here!"); - //} layoutTrack.checkForNonContiguousBlocks(blockNamesToTrackNameSetMaps); } @@ -364,7 +377,9 @@ private void setupCheckNonContiguousBlocksMenu() { } } // setupCheckNonContiguousBlocksMenu -// action to be performed when checkNonContiguousBlocksMenu item is clicked + // + // action to be performed when checkNonContiguousBlocksMenu item is clicked + // private void doCheckNonContiguousBlocksMenuItem( @Nonnull String blockName, @Nullable Set trackNameSet) { @@ -400,7 +415,111 @@ private void doCheckNonContiguousBlocksMenuItem( } } // doCheckNonContiguousBlocksMenuItem + // + // run the Unnecessary Anchors check and + // populate the CheckUnnecessaryAnchorsMenu + // + private void setupCheckUnnecessaryAnchorsMenu() { + log.debug("setupCheckUnnecessaryAnchorsMenu"); + + // collect the names of all menu items with checkmarks + Set checkMarkedMenuItemNamesSet = getCheckMarkedMenuItemNames(checkUnBlockedTracksMenu); + // mark our menu as "in progress..." + checkUnnecessaryAnchorsMenu.removeAll(); + checkUnnecessaryAnchorsMenu.add(checkInProgressMenuItem); + + // check all PositionablePoints + List aatzlts = new ArrayList<>(); + for (PositionablePoint pp : layoutEditor.getPositionablePoints()) { + // has to be an anchor... + if (pp.getType() == PositionablePoint.ANCHOR) { + // adjacent track segments must be defined... + TrackSegment ts1 = pp.getConnect1(); + TrackSegment ts2 = pp.getConnect2(); + if ((ts1 != null) && (ts2 != null)) { + // can't be an arc, circle or bezier... + if (!ts1.isArc() && !ts1.isCircle() && !ts1.isBezier() + && !ts2.isArc() && !ts2.isCircle() && !ts2.isBezier()) { + // must be in same block... + String blockName1 = ts1.getBlockName(); + String blockName2 = ts2.getBlockName(); + if (blockName1.equals(blockName2)) { + // if length of ts1 is zero... + Rectangle2D bounds1 = ts1.getBounds(); + double length1 = Math.hypot(bounds1.getWidth(), bounds1.getHeight()); + if (length1 < 1.0) { + aatzlts.add(pp); + continue; // so we don't get added again + } + // if length of ts2 is zero... + Rectangle2D bounds = ts2.getBounds(); + double length = Math.hypot(bounds.getWidth(), bounds.getHeight()); + if (length < 1.0) { + aatzlts.add(pp); + continue; // so we don't get added again + } + // if adjacent tracks are collinear... + double dir1 = ts1.getDirectionRAD(); + double dir2 = ts2.getDirectionRAD(); + double diffRAD = MathUtil.absDiffAngleRAD(dir1, dir2); + if (MathUtil.equals(diffRAD, 0.0) + || MathUtil.equals(diffRAD, Math.PI)) { + aatzlts.add(pp); + continue; // so we don't get added again + } + } // if blocknames are equal + } // isn't arc, circle or bezier + } // isn't null + } // is anchor + } // for pp + + // clear the "in progress..." menu item + checkUnnecessaryAnchorsMenu.removeAll(); + + // for each anchor we found + for (PositionablePoint pp : aatzlts) { + String anchorName = pp.getName(); + JMenuItem jmi = new JMenuItem(anchorName); + checkUnnecessaryAnchorsMenu.add(jmi); + jmi.addActionListener((ActionEvent event) -> { + doCheckUnnecessaryAnchorsMenuItem(anchorName); + }); + + // if it's in the check marked set then (re-)checkmark it + if (checkMarkedMenuItemNamesSet.contains(anchorName)) { + jmi.setSelected(true); + } + } + // if we didn't find any... + if (checkUnnecessaryAnchorsMenu.getMenuComponentCount() == 0) { + checkUnnecessaryAnchorsMenu.add(checkNoResultsMenuItem); + } + } // setupCheckUnnecessaryAnchorsMenu + + // + // action to be performed when CheckUnnecessaryAnchorsMenu item is clicked + // + private void doCheckUnnecessaryAnchorsMenuItem( + @Nonnull String anchorName) { + log.debug("doCheckUnnecessaryAnchorsMenuItem({})", anchorName); + + LayoutTrack layoutTrack = layoutEditor.getFinder().findObjectByName(anchorName); + if (layoutTrack != null) { + layoutEditor.setSelectionRect(layoutTrack.getBounds()); + // setSelectionRect calls createSelectionGroups... + // so we have to clear it before amending to it + layoutEditor.clearSelectionGroups(); + layoutEditor.amendSelectionGroup(layoutTrack); + // show its popup menu + layoutTrack.showPopup(); + } else { + layoutEditor.clearSelectionGroups(); + } + } // doCheckUnnecessaryAnchorsMenuItem + + // // collect the names of all checkbox menu items with checkmarks + // private Set getCheckMarkedMenuItemNames(@Nonnull JMenu menu) { Set results = new HashSet<>(); for (int idx = 0; idx < menu.getMenuComponentCount(); idx++) { @@ -415,6 +534,6 @@ private Set getCheckMarkedMenuItemNames(@Nonnull JMenu menu) { return results; } // getCheckMarkedMenuItemNames - private final static Logger log = LoggerFactory.getLogger(LayoutEditorChecks.class); + private final static Logger log + = LoggerFactory.getLogger(LayoutEditorChecks.class); } - diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutSlip.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutSlip.java index f712632406a..a951d57c65f 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutSlip.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutSlip.java @@ -1313,7 +1313,7 @@ protected void draw2(Graphics2D g2, boolean drawMain, float railDisplacement) { if (drawMain == mainlineA) { g2.draw(new Line2D.Double(pAR, pVL)); - g2.draw(new Line2D.Double(pVLtD, pKL)); + g2.draw(new Line2D.Double(pVLtD, pKLtB)); GeneralPath path = new GeneralPath(); path.moveTo(pAL.getX(), pAL.getY()); path.lineTo(pAPL.getX(), pAPL.getY()); @@ -1322,7 +1322,7 @@ protected void draw2(Graphics2D g2, boolean drawMain, float railDisplacement) { } if (drawMain == mainlineB) { g2.draw(new Line2D.Double(pBL, pVL)); - g2.draw(new Line2D.Double(pVLtC, pKR)); + g2.draw(new Line2D.Double(pVLtC, pKRtA)); if (getTurnoutType() == DOUBLE_SLIP) { GeneralPath path = new GeneralPath(); path.moveTo(pBR.getX(), pBR.getY()); @@ -1335,7 +1335,7 @@ protected void draw2(Graphics2D g2, boolean drawMain, float railDisplacement) { } if (drawMain == mainlineC) { g2.draw(new Line2D.Double(pCL, pVR)); - g2.draw(new Line2D.Double(pVRtB, pKR)); + g2.draw(new Line2D.Double(pVRtB, pKRtD)); if (getTurnoutType() == DOUBLE_SLIP) { GeneralPath path = new GeneralPath(); path.moveTo(pCR.getX(), pCR.getY()); @@ -1348,7 +1348,7 @@ protected void draw2(Graphics2D g2, boolean drawMain, float railDisplacement) { } if (drawMain == mainlineD) { g2.draw(new Line2D.Double(pDR, pVR)); - g2.draw(new Line2D.Double(pVRtA, pKL)); + g2.draw(new Line2D.Double(pVRtA, pKLtC)); GeneralPath path = new GeneralPath(); path.moveTo(pDL.getX(), pDL.getY()); path.lineTo(pDPL.getX(), pDPL.getY()); diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptions.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptions.java index f57f838e3e9..22e6fd4b99c 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptions.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptions.java @@ -12,7 +12,7 @@ * * @author George Warner Copyright (C) 2017 */ -public class LayoutTrackDrawingOptions implements Cloneable { +public class LayoutTrackDrawingOptions { private String name; @@ -369,12 +369,12 @@ public boolean equals(Object obj) { if (mainBlockLineWidth != ltdo.getMainBlockLineWidth()) { break; } + result = true; } while (false); - result = true; } } return result; - } + } // equals /** * Hash on the header diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.form b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.form index 44e9157e9a3..3f7ff7b6ab5 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.form +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.form @@ -7,9 +7,6 @@ - - - @@ -51,14 +48,14 @@ - + - + @@ -73,7 +70,7 @@ - + diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.java index a8df9175e54..5b1ac6ec650 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackDrawingOptionsDialog.java @@ -6,7 +6,6 @@ package jmri.jmrit.display.layoutEditor; import java.awt.Color; -import java.awt.Frame; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.List; @@ -26,8 +25,8 @@ public class LayoutTrackDrawingOptionsDialog extends JDialog { private final LayoutEditor layoutEditor; - private final LayoutTrackDrawingOptions leLTDOptions; - private LayoutTrackDrawingOptions ltdOptions = null; + private transient final LayoutTrackDrawingOptions leLTDOptions; + private transient LayoutTrackDrawingOptions ltdOptions = null; private String classicPresetName = Bundle.getMessage("ClassicPresetName"); private String draftingPresetName = Bundle.getMessage("DraftingPresetName"); @@ -36,21 +35,21 @@ public class LayoutTrackDrawingOptionsDialog extends JDialog { private String garishPresetName = Bundle.getMessage("GarishPresetName"); private String customPresetName = Bundle.getMessage("CustomPresetName"); - private final List ltdoList = new ArrayList<>(); + private transient final List ltdoList = new ArrayList<>(); /** * Creates new form LayoutTrackDrawingOptionsDialog */ - public LayoutTrackDrawingOptionsDialog(Frame parentFrame, boolean modal, + public LayoutTrackDrawingOptionsDialog(LayoutEditor layoutEditor, boolean modal, LayoutTrackDrawingOptions ltdOptions) { - super(parentFrame, modal); + super(layoutEditor, modal); - this.layoutEditor = (LayoutEditor) parentFrame; + this.layoutEditor = (LayoutEditor) layoutEditor; this.leLTDOptions = ltdOptions; this.ltdOptions = new LayoutTrackDrawingOptions(ltdOptions); initComponents(); - setLocationRelativeTo(parentFrame); + setLocationRelativeTo(layoutEditor); definePresets(); } @@ -64,7 +63,7 @@ public LayoutTrackDrawingOptionsDialog(Frame parentFrame, boolean modal, private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); - OptionsPanel = new javax.swing.JPanel(); + optionsPanel = new javax.swing.JPanel(); optionLabel = new javax.swing.JLabel(); mainlineLabel = new javax.swing.JLabel(); railCountLabel = new javax.swing.JLabel(); @@ -108,16 +107,15 @@ private void initComponents() { applyButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setMaximumSize(new java.awt.Dimension(512, 329)); setMinimumSize(new java.awt.Dimension(512, 329)); setResizable(false); setSize(new java.awt.Dimension(512, 329)); - OptionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(ltdOptions.getName())); - OptionsPanel.setMaximumSize(new java.awt.Dimension(800, 529)); - OptionsPanel.setMinimumSize(new java.awt.Dimension(800, 529)); - OptionsPanel.setPreferredSize(new java.awt.Dimension(800, 529)); - OptionsPanel.setSize(new java.awt.Dimension(800, 529)); + optionsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(ltdOptions.getName())); + optionsPanel.setMaximumSize(new java.awt.Dimension(800, 529)); + optionsPanel.setMinimumSize(new java.awt.Dimension(800, 529)); + optionsPanel.setPreferredSize(new java.awt.Dimension(800, 529)); + optionsPanel.setSize(new java.awt.Dimension(800, 529)); optionLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N optionLabel.setText(Bundle.getMessage("OptionLabelText")); @@ -574,13 +572,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { sidelineLabel.setPreferredSize(new java.awt.Dimension(64, 16)); sidelineLabel.setSize(new java.awt.Dimension(64, 16)); - javax.swing.GroupLayout OptionsPanelLayout = new javax.swing.GroupLayout(OptionsPanel); - OptionsPanel.setLayout(OptionsPanelLayout); - OptionsPanelLayout.setHorizontalGroup( - OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(OptionsPanelLayout.createSequentialGroup() + javax.swing.GroupLayout optionsPanelLayout = new javax.swing.GroupLayout(optionsPanel); + optionsPanel.setLayout(optionsPanelLayout); + optionsPanelLayout.setHorizontalGroup( + optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(optionsPanelLayout.createSequentialGroup() .addContainerGap() - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(tieColorLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(tieGapLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(tieWidthLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -594,7 +592,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(railWidthLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(railCountLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(mainlineLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(mainRailCountSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(mainRailWidthSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -607,13 +605,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(mainTieWidthSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(mainTieGapSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(mainTieColorButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, OptionsPanelLayout.createSequentialGroup() + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, optionsPanelLayout.createSequentialGroup() .addGap(12, 12, 12) .addComponent(sideTieColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(OptionsPanelLayout.createSequentialGroup() + .addGroup(optionsPanelLayout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(sideRailCountSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(sideRailWidthSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(sideRailGapSpinner, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -627,78 +625,78 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(sidelineLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) ); - OptionsPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {mainBallastColorButton, mainBallastWidthSpinner, mainBlockLineWidthSpinner, mainRailColorButton, mainRailCountSpinner, mainRailGapSpinner, mainRailWidthSpinner, mainTieColorButton, mainTieGapSpinner, mainTieLengthSpinner, mainTieWidthSpinner, mainlineLabel, sideBallastColorButton, sideBallastWidthSpinner, sideBlockLineWidthSpinner, sideRailColorButton, sideRailCountSpinner, sideRailGapSpinner, sideRailWidthSpinner, sideTieColorButton, sideTieGapSpinner, sideTieLengthSpinner, sideTieWidthSpinner, sidelineLabel}); + optionsPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {mainBallastColorButton, mainBallastWidthSpinner, mainBlockLineWidthSpinner, mainRailColorButton, mainRailCountSpinner, mainRailGapSpinner, mainRailWidthSpinner, mainTieColorButton, mainTieGapSpinner, mainTieLengthSpinner, mainTieWidthSpinner, mainlineLabel, sideBallastColorButton, sideBallastWidthSpinner, sideBlockLineWidthSpinner, sideRailColorButton, sideRailCountSpinner, sideRailGapSpinner, sideRailWidthSpinner, sideTieColorButton, sideTieGapSpinner, sideTieLengthSpinner, sideTieWidthSpinner, sidelineLabel}); - OptionsPanelLayout.setVerticalGroup( - OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(OptionsPanelLayout.createSequentialGroup() - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(OptionsPanelLayout.createSequentialGroup() - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(OptionsPanelLayout.createSequentialGroup() - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + optionsPanelLayout.setVerticalGroup( + optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(optionsPanelLayout.createSequentialGroup() + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(optionsPanelLayout.createSequentialGroup() + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(optionsPanelLayout.createSequentialGroup() + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(sidelineLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mainlineLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(optionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(railCountLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mainRailCountSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sideRailCountSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(railWidthLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mainRailWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sideRailWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(railGapLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mainRailGapSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sideRailGapSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(railColorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mainRailColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sideRailColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(blockLineWidthLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mainBlockLineWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sideBlockLineWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ballastWidthLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mainBallastWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sideBallastWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ballastColorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sideBallastColorButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(mainBallastColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tieLengthLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mainTieLengthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sideTieLengthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tieWidthLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mainTieWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sideTieWidthSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tieGapLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(mainTieGapSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sideTieGapSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(OptionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tieColorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sideTieColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(mainTieColorButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); - OptionsPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {ballastColorLabel, ballastWidthLabel, blockLineWidthLabel, mainBallastColorButton, mainBallastWidthSpinner, mainBlockLineWidthSpinner, mainRailColorButton, mainRailCountSpinner, mainRailGapSpinner, mainRailWidthSpinner, mainTieColorButton, mainTieGapSpinner, mainTieLengthSpinner, mainTieWidthSpinner, mainlineLabel, optionLabel, railColorLabel, railCountLabel, railGapLabel, railWidthLabel, sideBallastColorButton, sideBallastWidthSpinner, sideBlockLineWidthSpinner, sideRailColorButton, sideRailCountSpinner, sideRailGapSpinner, sideRailWidthSpinner, sideTieColorButton, sideTieGapSpinner, sideTieLengthSpinner, sideTieWidthSpinner, sidelineLabel, tieColorLabel, tieGapLabel, tieLengthLabel, tieWidthLabel}); + optionsPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {ballastColorLabel, ballastWidthLabel, blockLineWidthLabel, mainBallastColorButton, mainBallastWidthSpinner, mainBlockLineWidthSpinner, mainRailColorButton, mainRailCountSpinner, mainRailGapSpinner, mainRailWidthSpinner, mainTieColorButton, mainTieGapSpinner, mainTieLengthSpinner, mainTieWidthSpinner, mainlineLabel, optionLabel, railColorLabel, railCountLabel, railGapLabel, railWidthLabel, sideBallastColorButton, sideBallastWidthSpinner, sideBlockLineWidthSpinner, sideRailColorButton, sideRailCountSpinner, sideRailGapSpinner, sideRailWidthSpinner, sideTieColorButton, sideTieGapSpinner, sideTieLengthSpinner, sideTieWidthSpinner, sidelineLabel, tieColorLabel, tieGapLabel, tieLengthLabel, tieWidthLabel}); presetsComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Classic JMRI", "Drafting", "Realistic", "Realistic Oh!", "Garrish", "--", "Custom" })); presetsComboBox.addActionListener(new java.awt.event.ActionListener() { @@ -748,12 +746,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(okButton)) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addComponent(OptionsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 506, Short.MAX_VALUE)) + .addComponent(optionsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 506, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(OptionsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(optionsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(presetsLabel) @@ -790,7 +788,7 @@ private void presetsComboBoxActionPerformed(ActionEvent evt) {//GEN-FIRST:event_ if (!ltdOptions.getName().equals(ltdo.getName())) { ltdOptions = ltdo; setupControls(); - OptionsPanel.setBorder(BorderFactory.createTitledBorder(presetName)); + optionsPanel.setBorder(BorderFactory.createTitledBorder(presetName)); presetsComboBox.setSelectedItem(presetName); } break; @@ -1056,7 +1054,7 @@ private void makeCustomPreset() { presetsComboBox.addItem(ltdOptions.getName()); } presetsComboBox.setSelectedItem(ltdOptions.getName()); - OptionsPanel.setBorder(BorderFactory.createTitledBorder((String) customPresetName)); + optionsPanel.setBorder(BorderFactory.createTitledBorder((String) customPresetName)); } } // define the presets @@ -1201,7 +1199,6 @@ private void definePresets() { \*===========================*/ // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JPanel OptionsPanel; private javax.swing.JButton applyButton; private javax.swing.JLabel ballastWidthLabel; private javax.swing.JLabel blockLineWidthLabel; @@ -1221,6 +1218,7 @@ private void definePresets() { private javax.swing.JLabel mainlineLabel; private javax.swing.JButton okButton; private javax.swing.JLabel optionLabel; + private javax.swing.JPanel optionsPanel; private javax.swing.JComboBox presetsComboBox; private javax.swing.JLabel presetsLabel; private javax.swing.JLabel railCountLabel; diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackEditors.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackEditors.java index 4cd7f39a645..b35132a7f2d 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackEditors.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTrackEditors.java @@ -247,8 +247,7 @@ public void windowClosing(java.awt.event.WindowEvent e) { private void editTrackSegmentEditBlockPressed(ActionEvent a) { // check if a block name has been entered String newName = editTrackSegmentBlockNameComboBox.getUserName(); - if ((trackSegment.getBlockName() == null) - || !trackSegment.getBlockName().equals(newName)) { + if (!trackSegment.getBlockName().equals(newName)) { // get new block, or null if block has been removed try { trackSegment.setLayoutBlock(layoutEditor.provideLayoutBlock(newName)); @@ -301,8 +300,7 @@ private void editTracksegmentDonePressed(ActionEvent a) { } // check if Block changed String newName = editTrackSegmentBlockNameComboBox.getUserName(); - if ((trackSegment.getBlockName() == null) - || !trackSegment.getBlockName().equals(newName)) { + if (!trackSegment.getBlockName().equals(newName)) { // get new block, or null if block has been removed try { trackSegment.setLayoutBlock(layoutEditor.provideLayoutBlock(newName)); @@ -647,8 +645,7 @@ public void windowClosing(java.awt.event.WindowEvent e) { private void editLayoutTurnoutEditBlockPressed(ActionEvent a) { // check if a block name has been entered String newName = editLayoutTurnoutBlockNameComboBox.getUserName(); - if ((layoutTurnout.getBlockName() != null) - || !layoutTurnout.getBlockName().equals(newName)) { + if (!layoutTurnout.getBlockName().equals(newName)) { // get new block, or null if block has been removed try { layoutTurnout.setLayoutBlock(layoutEditor.provideLayoutBlock(newName)); diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTurnout.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutTurnout.java index fa49e0a195e..a199724ed19 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutTurnout.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTurnout.java @@ -412,35 +412,39 @@ public boolean isSecondTurnoutInverted() { return secondTurnoutInverted; } + @Nonnull public String getBlockName() { - return blockName; + return ((blockName == null) ? "" : blockName); } + @Nonnull public String getBlockBName() { if ((blockBName == null) || (blockBName.isEmpty())) { if (getLayoutBlockB() != null) { blockBName = getLayoutBlockB().getId(); } } - return blockBName; + return ((blockBName == null) ? "" : blockBName); } + @Nonnull public String getBlockCName() { if ((blockCName == null) || (blockCName.isEmpty())) { if (getLayoutBlockC() != null) { blockCName = getLayoutBlockC().getId(); } } - return blockCName; + return ((blockCName == null) ? "" : blockCName); } + @Nonnull public String getBlockDName() { if ((blockDName == null) || (blockDName.isEmpty())) { if (getLayoutBlockD() != null) { blockDName = getLayoutBlockD().getId(); } } - return blockDName; + return ((blockDName == null) ? "" : blockDName); } public SignalHead getSignalHead(int loc) { @@ -2639,13 +2643,7 @@ public void actionPerformed(ActionEvent e) { for (Map.Entry entry : map.entrySet()) { String blockName = entry.getKey(); LayoutBlock layoutBlock = entry.getValue(); - viewRouting.add(new AbstractAction(getBlockBName()) { - @Override - public void actionPerformed(ActionEvent e) { - AbstractAction routeTableAction = new LayoutBlockRouteTableAction(blockName, layoutBlock); - routeTableAction.actionPerformed(e); - } - }); + viewRouting.add(new AbstractActionImpl(getBlockBName(), blockName, layoutBlock)); } popup.add(viewRouting); } @@ -3913,6 +3911,11 @@ protected void draw2(Graphics2D g2, boolean isMain, float railDisplacement) { log.error("slips should be being drawn by LayoutSlip sub-class"); break; } + default: { + // this should never happen... but... + log.error("Unknown turnout type: " + type); + break; + } } } @@ -4356,13 +4359,13 @@ public void checkForNonContiguousBlocks( // We're only using a map here because it's convient to // use it to pair up blocks and connections Map blocksAndTracksMap = new HashMap<>(); - if ((getBlockName() != null) && (connectA != null)) { + if (connectA != null) { blocksAndTracksMap.put(connectA, getBlockName()); } - if ((getBlockBName() != null) && (connectB != null)) { + if (connectB != null) { blocksAndTracksMap.put(connectB, getBlockBName()); } - if ((getBlockCName() != null) && (connectC != null)) { + if (connectC != null) { blocksAndTracksMap.put(connectC, getBlockCName()); } if ((getTurnoutType() == DOUBLE_XOVER) @@ -4370,7 +4373,7 @@ public void checkForNonContiguousBlocks( || (getTurnoutType() == RH_XOVER) || (getTurnoutType() == SINGLE_SLIP) || (getTurnoutType() == DOUBLE_SLIP)) { - if ((getBlockDName() != null) && (connectD != null)) { + if (connectD != null) { blocksAndTracksMap.put(connectD, getBlockDName()); } } @@ -4399,7 +4402,7 @@ public void checkForNonContiguousBlocks( TrackNameSets.add(TrackNameSet); } if (TrackNameSet.add(getName())) { - log.debug("- Add track '{}' to trackNameSet for block '{}'", getName(), theBlockName); + log.debug("* Add track '{}' to trackNameSet for block '{}'", getName(), theBlockName); } theConnect.collectContiguousTracksNamesInBlockNamed(theBlockName, TrackNameSet); } @@ -4415,15 +4418,15 @@ public void collectContiguousTracksNamesInBlockNamed( // create list of our connects List connects = new ArrayList<>(); - if ((this.blockName != null) && (this.blockName.equals(blockName)) + if (getBlockName().equals(blockName) && (connectA != null)) { connects.add(connectA); } - if ((getBlockBName() != null) && (getBlockBName().equals(blockName)) + if (getBlockBName().equals(blockName) && (connectB != null)) { connects.add(connectB); } - if ((getBlockCName() != null) && (getBlockCName().equals(blockName)) + if (getBlockCName().equals(blockName) && (connectC != null)) { connects.add(connectC); } @@ -4432,7 +4435,7 @@ public void collectContiguousTracksNamesInBlockNamed( || (getTurnoutType() == RH_XOVER) || (getTurnoutType() == SINGLE_SLIP) || (getTurnoutType() == DOUBLE_SLIP)) { - if ((getBlockDName() != null) && (getBlockDName().equals(blockName)) + if (getBlockDName().equals(blockName) && (connectD != null)) { connects.add(connectD); } @@ -4468,4 +4471,22 @@ public void setAllLayoutBlocks(LayoutBlock layoutBlock) { private final static Logger log = LoggerFactory.getLogger(LayoutTurnout.class ); + private static class AbstractActionImpl extends AbstractAction { + + private final String blockName; + private final LayoutBlock layoutBlock; + + public AbstractActionImpl(String name, String blockName, LayoutBlock layoutBlock) { + super(name); + this.blockName = blockName; + this.layoutBlock = layoutBlock; + } + + @Override + public void actionPerformed(ActionEvent e) { + AbstractAction routeTableAction = new LayoutBlockRouteTableAction(blockName, layoutBlock); + routeTableAction.actionPerformed(e); + } + } + } diff --git a/java/src/jmri/jmrit/display/layoutEditor/LayoutTurntable.java b/java/src/jmri/jmrit/display/layoutEditor/LayoutTurntable.java index 461e4f4737e..c914654cfa4 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LayoutTurntable.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LayoutTurntable.java @@ -750,7 +750,6 @@ protected void draw1(Graphics2D g2, boolean isMain, boolean isBlock) { float trackWidth = 2.F; float halfTrackWidth = trackWidth / 2.f; double radius = getRadius(), diameter = radius + radius; - double circleRadius = LayoutEditor.SIZE * layoutEditor.getTurnoutCircleSize(); if (isBlock && isMain) { // draw turntable circle - default track color, side track width @@ -794,7 +793,6 @@ protected void draw1(Graphics2D g2, boolean isMain, boolean isBlock) { protected void draw2(Graphics2D g2, boolean isMain, float railDisplacement) { float trackWidth = 2.F; float halfTrackWidth = trackWidth / 2.f; - double radius = getRadius(), diameter = radius + radius; // draw ray tracks for (int j = 0; j < getNumberRays(); j++) { @@ -947,9 +945,7 @@ public void checkForNonContiguousBlocks( TrackSegment ts = getRayConnectOrdered(k); if (ts != null) { String blockName = ts.getBlockName(); - if (blockName != null) { - blocksAndTracksMap.put(ts, blockName); - } + blocksAndTracksMap.put(ts, blockName); } } @@ -999,7 +995,7 @@ public void collectContiguousTracksNamesInBlockNamed(@Nonnull String blockName, TrackSegment ts = getRayConnectOrdered(k); if (ts != null) { String blk = ts.getBlockName(); - if ((blk != null) && (blk.equals(blockName))) { // (#1) + if (blk.equals(blockName)) { // (#1) // if we are added to the TrackNameSet if (TrackNameSet.add(getName())) { log.debug("* Add track '{}'for block '{}'", getName(), blockName); diff --git a/java/src/jmri/jmrit/display/layoutEditor/LevelXing.java b/java/src/jmri/jmrit/display/layoutEditor/LevelXing.java index 3180b4ed585..11f5e4be1ac 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/LevelXing.java +++ b/java/src/jmri/jmrit/display/layoutEditor/LevelXing.java @@ -124,12 +124,14 @@ public String toString() { /** * Accessor methods */ + @Nonnull public String getBlockNameAC() { - return blockNameAC; + return ((blockNameAC == null) ? "" : blockNameAC); } + @Nonnull public String getBlockNameBD() { - return blockNameBD; + return ((blockNameBD == null) ? "" : blockNameBD); } public SignalHead getSignalHead(int loc) { diff --git a/java/src/jmri/jmrit/display/layoutEditor/PositionablePoint.java b/java/src/jmri/jmrit/display/layoutEditor/PositionablePoint.java index e95633685a1..ad888481664 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/PositionablePoint.java +++ b/java/src/jmri/jmrit/display/layoutEditor/PositionablePoint.java @@ -1436,16 +1436,16 @@ public boolean isMainline() { protected void draw1(Graphics2D g2, boolean isMain, boolean isBlock) { if (getType() != ANCHOR) { Point2D pt = getCoordsCenter(); - boolean mainline = false; + //boolean mainline = false; Point2D ep1 = pt, ep2 = pt; if (getConnect1() != null) { - mainline = getConnect1().isMainline(); + //mainline = getConnect1().isMainline(); ep1 = getConnect1().getCentreSeg(); } if (getType() == ANCHOR) { if (getConnect2() != null) { - mainline |= getConnect2().isMainline(); + //mainline |= getConnect2().isMainline(); ep2 = getConnect2().getCentreSeg(); } } @@ -1702,9 +1702,40 @@ public void checkForNonContiguousBlocks( // this should never be null... but just in case... if (ts1 != null) { blk1 = ts1.getBlockName(); - if (blk1 != null) { + TrackNameSet = null; // assume not found (pessimist!) + TrackNameSets = blockNamesToTrackNameSetsMap.get(blk1); + if (TrackNameSets != null) { // (#1) + for (Set checkTrackNameSet : TrackNameSets) { + if (checkTrackNameSet.contains(getName())) { // (#2) + TrackNameSet = checkTrackNameSet; + break; + } + } + } else { // (#3) + log.debug("*New block ('{}') trackNameSets", blk1); + TrackNameSets = new ArrayList<>(); + blockNamesToTrackNameSetsMap.put(blk1, TrackNameSets); + } + if (TrackNameSet == null) { + TrackNameSet = new LinkedHashSet<>(); + log.debug("* Add track '{}' to trackNameSet for block '{}'", getName(), blk1); + TrackNameSet.add(getName()); + TrackNameSets.add(TrackNameSet); + } + if (connect1 != null) { // (#4) + connect1.collectContiguousTracksNamesInBlockNamed(blk1, TrackNameSet); + } + } + + if (getType() == ANCHOR) { + //check the 2nd connection points block + TrackSegment ts2 = getConnect2(); + // this should never be null... but just in case... + if (ts2 != null) { + String blk2 = ts2.getBlockName(); + TrackNameSet = null; // assume not found (pessimist!) - TrackNameSets = blockNamesToTrackNameSetsMap.get(blk1); + TrackNameSets = blockNamesToTrackNameSetsMap.get(blk2); if (TrackNameSets != null) { // (#1) for (Set checkTrackNameSet : TrackNameSets) { if (checkTrackNameSet.contains(getName())) { // (#2) @@ -1713,52 +1744,18 @@ public void checkForNonContiguousBlocks( } } } else { // (#3) - log.debug("*New block ('{}') trackNameSets", blk1); + log.debug("*New block ('{}') trackNameSets", blk2); TrackNameSets = new ArrayList<>(); - blockNamesToTrackNameSetsMap.put(blk1, TrackNameSets); + blockNamesToTrackNameSetsMap.put(blk2, TrackNameSets); } if (TrackNameSet == null) { TrackNameSet = new LinkedHashSet<>(); - log.debug("* Add track '{}' to trackNameSet for block '{}'", getName(), blk1); - TrackNameSet.add(getName()); + log.debug("* Add track '{}' to TrackNameSet for block '{}'", getName(), blk2); TrackNameSets.add(TrackNameSet); + TrackNameSet.add(getName()); } - if (connect1 != null) { // (#4) - connect1.collectContiguousTracksNamesInBlockNamed(blk1, TrackNameSet); - } - } - } - - if (getType() == ANCHOR) { - //check the 2nd connection points block - TrackSegment ts2 = getConnect2(); - // this should never be null... but just in case... - if (ts2 != null) { - String blk2 = ts2.getBlockName(); - if (blk2 != null) { - TrackNameSet = null; // assume not found (pessimist!) - TrackNameSets = blockNamesToTrackNameSetsMap.get(blk2); - if (TrackNameSets != null) { // (#1) - for (Set checkTrackNameSet : TrackNameSets) { - if (checkTrackNameSet.contains(getName())) { // (#2) - TrackNameSet = checkTrackNameSet; - break; - } - } - } else { // (#3) - log.debug("*New block ('{}') trackNameSets", blk2); - TrackNameSets = new ArrayList<>(); - blockNamesToTrackNameSetsMap.put(blk2, TrackNameSets); - } - if (TrackNameSet == null) { - TrackNameSet = new LinkedHashSet<>(); - log.debug("* Add track '{}' to TrackNameSet for block '{}'", getName(), blk2); - TrackNameSets.add(TrackNameSet); - TrackNameSet.add(getName()); - } - if (connect2 != null) { // (#4) - connect2.collectContiguousTracksNamesInBlockNamed(blk2, TrackNameSet); - } + if (connect2 != null) { // (#4) + connect2.collectContiguousTracksNamesInBlockNamed(blk2, TrackNameSet); } } } diff --git a/java/src/jmri/jmrit/display/layoutEditor/TrackSegment.java b/java/src/jmri/jmrit/display/layoutEditor/TrackSegment.java index 0b8acfd4828..be28241412d 100644 --- a/java/src/jmri/jmrit/display/layoutEditor/TrackSegment.java +++ b/java/src/jmri/jmrit/display/layoutEditor/TrackSegment.java @@ -143,8 +143,9 @@ public String toString() { /* * Accessor methods */ + @Nonnull public String getBlockName() { - return blockName; + return (blockName == null) ? "" : blockName; } public int getType1() { @@ -389,6 +390,37 @@ public void setAngle(double x) { changed = true; } + /** + * get the direction from end point 1 to 2 + *

+ * Note: Goes CW from east (0) to south (PI/2) to west (PI) to north + * (PI*3/2), etc. + * + * @return the direction (in radians) + */ + public double getDirectionRAD() { + Point2D ep1 = center, ep2 = center; + if (connect1 != null) { + ep1 = layoutEditor.getCoords(connect1, getType1()); + } + if (connect2 != null) { + ep2 = layoutEditor.getCoords(connect2, getType2()); + } + return (Math.PI / 2.0) - MathUtil.computeAngleRAD(ep1, ep2); + } + + /** + * get the direction from end point 1 to 2 + *

+ * Note: Goes CW from east (0) to south (90) to west (180) to north (270), + * etc. + * + * @return the direction (in degrees) + */ + public double getDirectionDEG() { + return Math.toDegrees(getDirectionRAD()); + } + /** * Determine if we need to redraw a curved piece of track. Saves having to * recalculate the circle details each time. @@ -1042,8 +1074,8 @@ void changeType(int choice) { setCircle(true); setBezier(false); break; - case 2: - setArc(true); // arc + case 2: // arc + setArc(true); setAngle(90.0D); setCircle(false); setBezier(false); diff --git a/java/src/jmri/util/MathUtil.java b/java/src/jmri/util/MathUtil.java index 233da868421..438c1bbd2c7 100644 --- a/java/src/jmri/util/MathUtil.java +++ b/java/src/jmri/util/MathUtil.java @@ -451,6 +451,9 @@ public static double computeAngleDEG(@Nonnull Point2D p) { /** * compute the angle (direction in radians) from point 1 to point 2 + *

+ * Note: Goes CCW from south to east to north to west, etc. + * For JMRI subtract from PI/2 to get east, south, west, north * * @param p1 the first Point2D * @param p2 the second Point2D @@ -463,6 +466,9 @@ public static double computeAngleRAD(@Nonnull Point2D p1, @Nonnull Point2D p2) { /** * compute the angle (direction in degrees) from point 1 to point 2 + *

+ * Note: Goes CCW from south to east to north to west, etc. + * For JMRI subtract from 90.0 to get east, south, west, north * * @param p1 the first Point2D * @param p2 the second Point2D diff --git a/java/test/jmri/util/PipeListenerTest.java b/java/test/jmri/util/PipeListenerTest.java index c7c13a3954a..cf1e92cfd9d 100644 --- a/java/test/jmri/util/PipeListenerTest.java +++ b/java/test/jmri/util/PipeListenerTest.java @@ -34,6 +34,7 @@ public void testWrite() throws java.io.IOException { wr.write("Test String"); wr.flush(); jmri.util.JUnitUtil.waitFor(()->{return !(pr.ready());},"buffer empty"); + new org.netbeans.jemmy.QueueTool().waitEmpty(100); // pause to let the JTextArea catch up. Assert.assertEquals("text after character write","Test String",jta.getText()); t.stop(); } diff --git a/release.properties b/release.properties index e6be616f412..52f41ecc330 100644 --- a/release.properties +++ b/release.properties @@ -1,11 +1,11 @@ -#Mon, 20 Nov 2017 06:46:15 -0800 +#Tue, 05 Dec 2017 05:46:38 -0800 # Changes to this file are to be checked in by JMRI release pumpkins only # # these are the numbers for the NEXT release from this branch release.major=4 release.minor=9 -release.build=7 +release.build=8 # additional release descriptor for a long-running expermimental difference # from what is produced by building JMRI/master (e.g. "pjc"). Should not contain diff --git a/scripts/HOWTO-distribution.md b/scripts/HOWTO-distribution.md index 1f81c3513ba..13643a5bc28 100644 --- a/scripts/HOWTO-distribution.md +++ b/scripts/HOWTO-distribution.md @@ -60,7 +60,7 @@ If you're attempting to perform this on MS Windows, refer to the MS Windows note - Update this note by (details in the update-HOWTO.sh comments; arguments when you run it should be last release, this release you're making, the next release; you may need to update): ``` - ./scripts/update-HOWTO.sh 4.9.6 4.9.7 4.9.8 + ./scripts/update-HOWTO.sh 4.9.7 4.9.8 4.9.9 ``` (and then manually update that line above to be last version release, this version being made today, next version to be made later; i.e. when starting to do *.4, the arguments are *.3 *.4 *.5) @@ -155,7 +155,7 @@ We roll some general code maintenance items into the release process. They can - If you fixed anything, commit it back. Also commit the current copy of these notes. Push directly back to master on GitHub. ``` -git commit -m"for 4.9.6" scripts/HOWTO-distribution.md +git commit -m"for 4.9.7" scripts/HOWTO-distribution.md git push github ``` @@ -172,13 +172,13 @@ git push github ``` cd (local web copy)/releasenotes git pull - cp jmri4.9.6.shtml jmri4.9.7.shtml + cp jmri4.9.7.shtml jmri4.9.8.shtml (edit the new release note accordingly) change numbers throughout move new warnings to old remove old-version change notes - git add jmri4.9.6.shtml - git commit -m"start new 4.9.7 release note" jmri4.9.7.shtml + git add jmri4.9.8.shtml + git commit -m"start new 4.9.8 release note" jmri4.9.8.shtml git push github cd (local JMRI copy) ``` @@ -213,13 +213,13 @@ where the date at the end should be the date (and optionally time) of the last r - Put the following comment in the release GitHub item saying the branch exists, and all future changes should be documented in the new release note: ``` -The release-4.9.6 branch has been created. +The release-4.9.7 branch has been created. -From now on, please document your changes in the [jmri4.9.7.shtml](https://github.com/JMRI/website/blob/master/releasenotes/jmri4.9.7.shtml) release note file. +From now on, please document your changes in the [jmri4.9.8.shtml](https://github.com/JMRI/website/blob/master/releasenotes/jmri4.9.8.shtml) release note file. -Maintainers, please set the 4.9.7 milestone on pulls from now on, as that will be the next test release from the HEAD of the master branch. +Maintainers, please set the 4.9.8 milestone on pulls from now on, as that will be the next test release from the HEAD of the master branch. -Jenkins will be creating files shortly at the [CI server](http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.6/) +Jenkins will be creating files shortly at the [CI server](http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.7/) ```` ================================================================================ @@ -248,11 +248,11 @@ Jenkins will be creating files shortly at the [CI server](http://jmri.tagadab.co - Change the release note to point to the just-built files (in CI or where you put them), commit, wait (or force via ["Build Now"](http://jmri.tagadab.com/jenkins/job/Web%20Site/job/Website%20from%20JMRI%20GitHub%20website%20repository/) update). Confirm visible on web. -- Announce the file set via email to jmri-developers@lists.sf.net with a subject line "First 4.9.6 files available": +- Announce the file set via email to jmri-developers@lists.sf.net with a subject line "First 4.9.7 files available": -First JMRI 4.9.6 files are available in the usual way at: +First JMRI 4.9.7 files are available in the usual way at: -http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.6 +http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.7 Feedback appreciated. I would like to release this later today or tomorrow morning. @@ -263,7 +263,7 @@ Feedback appreciated. I would like to release this later today or tomorrow morni If anybody wants to add a change from here on in, they should -- Ideally, start the work on either the release-4.9.6 branch (if working after that was started) or on a branch-from-master that's _before_ the release-4.9.6 branch was created. That way, the change can be cleanly included in the release branch, and also directly onto master. +- Ideally, start the work on either the release-4.9.7 branch (if working after that was started) or on a branch-from-master that's _before_ the release-4.9.7 branch was created. That way, the change can be cleanly included in the release branch, and also directly onto master. - Commit their changes to that branch, and push as needed to get it to their GitHub fork. @@ -271,7 +271,7 @@ If anybody wants to add a change from here on in, they should - One to master, as usual - - One to the release branch e.g. "release-4.9.6". The comment on this PR should explain why this should be included instead of waiting for the next release. + - One to the release branch e.g. "release-4.9.7". The comment on this PR should explain why this should be included instead of waiting for the next release. Merging the PR to the master makes those changes available on further developments forever; the one on the release, if accepted, includes the change and kicks off new runs of the various CI and build jobs. @@ -279,7 +279,7 @@ If anybody wants to add a change from here on in, they should If somebody has merged their change into master (or it's branched from master later than the release tag), you have two choices: -- Merge master into the release-4.9.6 branch. This will bring _everything_ that's been merged in, so remember to update the version markers on those PRs. Effectively, you've just started the release process later. Note that the `release.properties` file will have the wrong minor number in it: You'll have to edit and commit that to get the right number in the release. +- Merge master into the release-4.9.7 branch. This will bring _everything_ that's been merged in, so remember to update the version markers on those PRs. Effectively, you've just started the release process later. Note that the `release.properties` file will have the wrong minor number in it: You'll have to edit and commit that to get the right number in the release. - `git cherrypick` just the changes you want. Read the documentation on that command carefully and double check your work. If possible, check the contents of the release branch on the GitHub web site to make sure only the changes you wanted were included. @@ -311,13 +311,13 @@ This step uploads the Linux, Mac OS X and Windows files to the SourceForge file (replace "user" below with your SourceForge.net user name; must have SSH keys for SourceForge.net set up) - - (The "./testrelease 4.9.6" local script on shell.sf.net does the following steps, except for the edit, of course) + - (The "./testrelease 4.9.7" local script on shell.sf.net does the following steps, except for the edit, of course) ``` ssh user,jmri@shell.sf.net create ssh user,jmri@shell.sf.net - curl -o release.zip "http://jmri.tagadab.com/jenkins/job/Test%20Releases/job/4.9.6/ws/dist/release/*zip*/release.zip" + curl -o release.zip "http://jmri.tagadab.com/jenkins/job/Test%20Releases/job/4.9.7/ws/dist/release/*zip*/release.zip" (use the following instead if building on second Jenkins server) - curl -o release.zip "http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.6/ws/dist/release/*zip*/release.zip" + curl -o release.zip "http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.7/ws/dist/release/*zip*/release.zip" rm release/JMRI* unzip release.zip cd release @@ -366,28 +366,28 @@ Note: Unlike releasing files to SourceForge, once a GitHub Release is created it - Fill out form: - - "tag version field" gets v4.9.6 (e.g. leading lower-case "v") - - @ branch: select the release-4.9.6 release branch + - "tag version field" gets v4.9.7 (e.g. leading lower-case "v") + - @ branch: select the release-4.9.7 release branch ``` -"Release title" field gets "Test/Prod Release 4.9.6" +"Release title" field gets "Test/Prod Release 4.9.7" ``` - Description content (the testrelease script above proposed this!): ``` -[Release notes](http://jmri.org/releasenotes/jmri4.9.6.shtml) +[Release notes](http://jmri.org/releasenotes/jmri4.9.7.shtml) Checksums: File | SHA256 checksum ---|--- -[JMRI.4.9.6.Re5a0179.dmg](https://github.com/JMRI/JMRI/releases/download/v4.9.6/JMRI.4.9.6.Re5a0179.dmg) | 9e7e4fcd9cfe6a5cadf50c2b1bdf6f1e838d524ff4ce5fd90191e254fd584525 -[JMRI.4.9.6.Re5a0179.exe](https://github.com/JMRI/JMRI/releases/download/v4.9.6/JMRI.4.9.6.Re5a0179.exe) | fd7a4b12d119761e44d2441e2a715ddbd9b6cf857d0418d5470303bd9aefd2e6 -[JMRI.4.9.6.Re5a0179.tgz](https://github.com/JMRI/JMRI/releases/download/v4.9.6/JMRI.4.9.6.Re5a0179.tgz) | 9e22b0dd001c8c541ad6899058d3e25140ddd3dac229098eece1899ff064dbfc +[JMRI.4.9.7.Re5a0179.dmg](https://github.com/JMRI/JMRI/releases/download/v4.9.7/JMRI.4.9.7.Re5a0179.dmg) | 9e7e4fcd9cfe6a5cadf50c2b1bdf6f1e838d524ff4ce5fd90191e254fd584525 +[JMRI.4.9.7.Re5a0179.exe](https://github.com/JMRI/JMRI/releases/download/v4.9.7/JMRI.4.9.7.Re5a0179.exe) | fd7a4b12d119761e44d2441e2a715ddbd9b6cf857d0418d5470303bd9aefd2e6 +[JMRI.4.9.7.Re5a0179.tgz](https://github.com/JMRI/JMRI/releases/download/v4.9.7/JMRI.4.9.7.Re5a0179.tgz) | 9e22b0dd001c8c541ad6899058d3e25140ddd3dac229098eece1899ff064dbfc ``` - Attach files by selecting them or dragging them in (you might have to have downloaded them above via e.g. a separate ``` -curl -o release.zip "http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.6/lastSuccessfulBuild/artifact/dist/release/*zip*/release.zip"" +curl -o release.zip "http://jmri.tagadab.com/jenkins/job/TestReleases/job/4.9.7/lastSuccessfulBuild/artifact/dist/release/*zip*/release.zip"" ``` and expansion; it's slow to upload from a typical home connection, though, so wish we had a way to cross-load from somewhere fast - if release.zip is still on SF.net, you can do ``` @@ -401,9 +401,9 @@ Note there's a little progress bar that has to go across & "Uploading your relea Alternatively, if you have shell access to the Jenkins server, you perhaps can upload directly from there, once the initial draft release has been created (this hasn't been tested): ``` -github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.6 -n "JMRI.4.9.6+Rd144052.dmg" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.9.6/workspace/dist/release/JMRI.4.9.6+Rd144052.dmg -github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.6 -n "JMRI.4.9.6+Rd144052.exe" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.7.5/workspace/dist/release/JMRI.4.9.6+Rd144052.exe -github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.6 -n "JMRI.4.9.6+Rd144052.tgz" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.7.5/workspace/dist/release/JMRI.4.9.6+Rd144052.tgz +github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.7 -n "JMRI.4.9.7+Rd144052.dmg" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.9.7/workspace/dist/release/JMRI.4.9.7+Rd144052.dmg +github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.7 -n "JMRI.4.9.7+Rd144052.exe" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.7.5/workspace/dist/release/JMRI.4.9.7+Rd144052.exe +github-release upload -s {github_secret} -u JMRI -r JMRI -t v4.9.7 -n "JMRI.4.9.7+Rd144052.tgz" -f /var/lib/jenkins/jobs/TestReleases/jobs/4.7.5/workspace/dist/release/JMRI.4.9.7+Rd144052.tgz ``` - Click "Publish Release" @@ -421,7 +421,7 @@ git fetch git checkout master git pull git checkout -b temp-master -git merge origin/release-4.9.6 +git merge origin/release-4.9.7 ``` Note that you're testing the merge of the release branch back onto master. This should report "Already up-to-date.", i.e. no changes, with the possible exception of some auto-generated files: @@ -453,12 +453,12 @@ git checkout -b (release-n.n.n+1) git push github ``` -- Create the next [GitHub Issue](https://github.com/JMRI/JMRI/issues) to hold discussion with conventional title "Create Test Release 4.9.7". Add the next release milestone (created above) to it. Typical text: +- Create the next [GitHub Issue](https://github.com/JMRI/JMRI/issues) to hold discussion with conventional title "Create Test Release 4.9.8". Add the next release milestone (created above) to it. Typical text: ``` This is the third release of the 4.10 cycle. It's intended to be released around Novemebr 18 from HEAD of master. ``` -- Confirm that the tag for the current release (release-4.9.6) is in place, then manually delete the current release branch via the [GitHub UI](https://github.com/JMRI/JMRI/branches). +- Confirm that the tag for the current release (release-4.9.7) is in place, then manually delete the current release branch via the [GitHub UI](https://github.com/JMRI/JMRI/branches). - Go to the GitHub PR and Issues [labels list](https://github.com/JMRI/JMRI/labels) and remove any "afterNextTestRelease" (and "afterNextProductionRelease" if appropriate) labels from done items @@ -488,27 +488,27 @@ If you don't, a bunch of Windows users are likely to whine - Mail announcement to jmriusers@yahoogroups.com - Subject is "Test version 4.9.6 of JMRI/DecoderPro is available for download" or "JMRI 4.8 is available for download" + Subject is "Test version 4.9.7 of JMRI/DecoderPro is available for download" or "JMRI 4.8 is available for download" Content: -Test version 4.9.6 of JMRI/DecoderPro is available for download. +Test version 4.9.7 of JMRI/DecoderPro is available for download. This is the next in a series of test releases that will culminate in a production release, hopefully in December 2017. - Alt: There have been a lot of updates in this version, so it should be considered experimental. - Alt: We're getting close to the end of the development series, so we'd appreciate feedback on whether or not this release works for your layout. -If you use JMRI on Linux or Mac and are updating from JMRI 4.7.3 or earlier, there’s a necessary migration step. (Not needed on Windows) Please see the release note for details: +If you use JMRI on Linux or Mac and are updating from JMRI 4.7.3 or earlier, there’s a necessary migration step. (Not needed on Windows) Please see the release note for details: -For more information on the issues, new features and bug fixes in 4.9.6 please see the release note: - +For more information on the issues, new features and bug fixes in 4.9.7 please see the release note: + Note that JMRI is made available under the GNU General Public License. For more information, please see our copyright and licensing page. The download links, along with lots of other information which we hope you'll read, can be found on the release note page: - + - If a production version, update the SF automatic download icon by selecting default in SF.net FRS (3 times) @@ -561,7 +561,7 @@ If you're building locally: - Get the release in your local work directory ``` - git checkout release-4.9.6 + git checkout release-4.9.7 ``` - edit release.properties to say release.official=true (last line) diff --git a/xml/decoderIndex.xml b/xml/decoderIndex.xml index 0b0f80825b1..7dc712d2a39 100644 --- a/xml/decoderIndex.xml +++ b/xml/decoderIndex.xml @@ -1,8 +1,8 @@ - - + + @@ -2375,7 +2375,9 @@ - + + + @@ -2438,8 +2440,9 @@ - + + @@ -18863,7 +18866,10 @@ - + + @@ -18871,33 +18877,105 @@ - + - + + + Headlight + Bell + Airhorn/Whistle + Short Horn + + FX5 Output + FX6 Output + Dimmer + Mute + Generator + Uncoupling + Apply/Release Brakes + Coupler Clank + + + + + + + + + + + + + + + + + + + + + + + + Headlight + Bell + Airhorn/Whistle + Short Horn + + FX5 Output + FX6 Output + Dimmer + Mute + Generator + Uncoupling + Apply/Release Brakes + Coupler Clank + + + + + + + + + + + + + + + + + + + + + + + Headlight + Bell + Airhorn/Whistle + Short Horn + Spook the Livestock + FX5 Output + FX6 Output + Dimmer + Mute + Generator + Uncoupling + Apply/Release Brakes + Coupler Clank + - - Headlight - Bell - Airhorn/Whistle - Short Horn - Unassigned - FX5 Output - FX6 Output - Dimmer - Mute - Generator - Uncoupling - Apply/Release Brakes - Coupler Clank - @@ -21941,73 +22019,73 @@ - - - - - - - - - + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - - + + @@ -22021,96 +22099,108 @@ - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - + + + + - + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - - - + + + - + + + + + + + + + + + + + - + diff --git a/xml/defaultPanelIcons.xml b/xml/defaultPanelIcons.xml index 5046927b8a6..b7ba4b51ac9 100644 --- a/xml/defaultPanelIcons.xml +++ b/xml/defaultPanelIcons.xml @@ -214,12 +214,12 @@ - + resources/icons/smallschematics/tracksegments/os-lefthand-east-closed.gif - - + + resources/icons/smallschematics/tracksegments/os-lefthand-east-thrown.gif - + resources/icons/smallschematics/tracksegments/os-lefthand-east-error.gif @@ -228,12 +228,12 @@ - + resources/icons/smallschematics/tracksegments/os-righthand-west-closed.gif - - + + resources/icons/smallschematics/tracksegments/os-righthand-west-thrown.gif - + resources/icons/smallschematics/tracksegments/os-righthand-west-error.gif