Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP SignalMast Icon Click Sensors #12901

Open
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

icklesteve
Copy link
Member

Enables Sensors to go active on clicks to the Icon.
Adds Control ( right ) clicked options with default behaviour as existing.
Sensor selection ComboBox added to edit icon popup when selecting Sensor action.
Sensors stored as NamedBeanHandles.
Larger methods to smaller blocks.

There's a getUsageReport( NamedBean ) method for the WhereUsed tool however not linked up.

Marked WIP to check general code structure is ok before tweaking the LoadAndStore xml files.

Enables Sensors to go active on clicks to the Icon.
Adds Control ( right ) clicked options with default behaviour as existing.
Sensor choosers added to edit icon popup.
Sensors stored as NamedBeanHandles.
larger methods to smaller blocks
add tests for clicks / popups.
add click sensors to signalmast icon
remove unnecessary import
@mergeable mergeable bot added the Needs L10N Needs localization label Feb 12, 2024
Copy link

mergeable bot commented Feb 12, 2024

Thanks for the PR. It includes changes to properties files, so the 'Needs L10N' label has been added"

@mergeable mergeable bot added the New PR Newly created PR that is less than 1 day old label Feb 12, 2024
@dsand47
Copy link
Contributor

dsand47 commented Feb 12, 2024

What is the purpose of clicking on a signal mast icon to activate a sensor.

I am not able to find any key combinations to trigger the action on macOS using a track pad. Control-click brings up the context menu.

@icklesteve
Copy link
Member Author

Hi @dsand47

It would be possible to set ( NX style ) routes by ( left ) clicking from mast to mast.
Route cancellation could be performed on the right ( control ) click.
I believe this may be fairly common IECC behaviour used in many VSCS's ( VDU Signalling Control System ).
Also the method used in SimSig, a popular IECC emulator ( https://www.simsig.co.uk/ ) .

The ( Windows right click ), ( Mac Control ? ) Sensor action only comes into play when the Panel is not in edit mode, the preference to use the ( right / control ) click action has been set, and a Sensor has been set.

Steve.

@dsand47
Copy link
Contributor

dsand47 commented Feb 13, 2024

Hi @dsand47

It would be possible to set ( NX style ) routes by ( left ) clicking from mast to mast. Route cancellation could be performed on the right ( control ) click. I believe this may be fairly common IECC behaviour used in many VSCS's ( VDU Signalling Control System ). Also the method used in SimSig, a popular IECC emulator ( https://www.simsig.co.uk/ ) .

The ( Windows right click ), ( Mac Control ? ) Sensor action only comes into play when the Panel is not in edit mode, the preference to use the ( right / control ) click action has been set, and a Sensor has been set.

Steve.

I am able to get it to work with Panel Editor, but Layout Editor still does not work.

What is interesting is that the JMRI Entry/Exit system was designed to use sensors or signals. However, the signal support was never implemented. In Entry/Exit, route cancellation is done by re-selecting the same sensor pair.

@mergeable mergeable bot removed the New PR Newly created PR that is less than 1 day old label Feb 15, 2024
@icklesteve
Copy link
Member Author

Hi again @dsand47

I am able to get it to work with Panel Editor, but Layout Editor still does not work.

Interesting. With current HOM, when not in Panel Edit mode and a SignalMast is ( Win 11 Right ) clicked on, there's a SignalMast aspect selection, do you see that with the Control Click?

It should be triggered via the mouseReleased method in LayoutEditor.
I've added some temporary logging to the PR to assist trace this, here's what I get . . .

     [java] 15:23:14,512 rit.display.layoutEditor.LayoutEditor INFO  - mouseReleased jmri.util.swing.JmriMouseEvent@4c4ac92e [AWT-EventQueue-0]
     [java] 15:23:14,512 rit.display.layoutEditor.LayoutEditor INFO  - requesting marker popup out of edit mode [AWT-EventQueue-0]
     [java] 15:23:14,512 rit.display.layoutEditor.LayoutEditor INFO  - SignalMast found from checkSignalMastIconPopUps [AWT-EventQueue-0]
     [java] 15:23:14,513 rit.display.layoutEditor.LayoutEditor INFO  - showPopUp for IF$tsm:BR-2003:2-h($0001) [AWT-EventQueue-0]
     [java] 15:23:14,513 jmri.jmrit.display.SignalMastIcon     INFO  - showPopup [AWT-EventQueue-0]
     [java] 15:23:14,513 jmri.jmrit.display.SignalMastIcon     INFO  - performing right click action  [AWT-EventQueue-0]
     [java] java.lang.Exception: Trace
     [java]     at jmri.jmrit.display.SignalMastIcon.performControlClickNonEditAction(SignalMastIcon.java:406) [classes/:?]
     [java]     at jmri.jmrit.display.SignalMastIcon.showPopUp(SignalMastIcon.java:212) [classes/:?]
     [java]     at jmri.jmrit.display.layoutEditor.LayoutEditor.showPopUp(LayoutEditor.java:3985) [classes/:?]
     [java]     at jmri.jmrit.display.layoutEditor.LayoutEditor.mouseReleased(LayoutEditor.java:3715) [classes/:?]
     [java]     at jmri.util.swing.JmriMouseListener$1.mouseReleased(JmriMouseListener.java:33) [classes/:?]
     [java]     at java.awt.Component.processMouseEvent(Component.java:6635) [?:?]

What is interesting is that the JMRI Entry/Exit system was designed to use sensors or signals. However, the signal support was never implemented. In Entry/Exit, route cancellation is done by re-selecting the same sensor pair.

I'm assuming that it's OK to just set the Sensor active for this to work, there doesn't need to be a momentary action.

Steve.

@icklesteve
Copy link
Member Author

btw @dsand47 , here's the mini Panel I'm testing this with :

sigMastIconTest.zip

@dsand47
Copy link
Contributor

dsand47 commented Feb 16, 2024

I tested your latest updates. The mast icon does not respond to control-click or right click in Layout Editor. They both work for markers.

23:45:08,786 rit.display.layoutEditor.LayoutEditor INFO  - mouseReleased jmri.util.swing.JmriMouseEvent@25dc7161 [AWT-EventQueue-0]
23:45:08,787 rit.display.layoutEditor.LayoutEditor INFO  - requesting marker popup out of edit mode [AWT-EventQueue-0]
23:45:08,787 rit.display.layoutEditor.LayoutEditor INFO  - showPopUp for null [AWT-EventQueue-0]

The signal mast only shows the mouseReleased.

Note: Entry/Exit sensors are not momentary.

@icklesteve
Copy link
Member Author

Much thanks for the feedback and log @dsand47

There are only a few else if statements difference so we're definitely getting closer!
If you could please try the latest PR, the Right / Control clicks are initally going down the same path,

Win 11 latest PR right click on test case Panel Signal Mast Icon I'm getting

     [java] 02:06:08,956 rit.display.layoutEditor.LayoutEditor INFO  - mouseReleased, editable false [AWT-EventQueue-0]
     [java] 02:06:08,957 rit.display.layoutEditor.LayoutEditor INFO  - requesting popup out of edit mode [AWT-EventQueue-0]
     [java] 02:06:08,957 rit.display.layoutEditor.LayoutEditor INFO  - checking for SignalMast Icon at Point2D.Double[53.0, 28.0] [AWT-EventQueue-0]
     [java] 02:06:08,958 rit.display.layoutEditor.LayoutEditor INFO  - checking if click at Point2D.Double[53.0, 28.0] within bounds of SigMast Icon at java.awt.Rectangle[x=41,y=22,width=19,height=16] [AWT-EventQueue-0]
     [java] 02:06:08,962 rit.display.layoutEditor.LayoutEditor INFO  - SignalMast found from checkSignalMastIconPopUps [AWT-EventQueue-0]
     [java] 02:06:08,962 rit.display.layoutEditor.LayoutEditor INFO  - showPopUp for IF$tsm:BR-2003:2-h($0001) [AWT-EventQueue-0]
     [java] 02:06:08,962 jmri.jmrit.display.SignalMastIcon     INFO  - showPopup [AWT-EventQueue-0]
     [java] 02:06:08,962 jmri.jmrit.display.SignalMastIcon     INFO  - performing right click action  [AWT-EventQueue-0]
     [java] java.lang.Exception: Trace
     [java]     at jmri.jmrit.display.SignalMastIcon.performControlClickNonEditAction(SignalMastIcon.java:406) [classes/:?]
     [java]     at jmri.jmrit.display.SignalMastIcon.showPopUp(SignalMastIcon.java:212) [classes/:?]
     [java]     at jmri.jmrit.display.layoutEditor.LayoutEditor.showPopUp(LayoutEditor.java:3991) [classes/:?]
     [java]     at jmri.jmrit.display.layoutEditor.LayoutEditor.mouseReleased(LayoutEditor.java:3721) [classes/:?]
     [java]     at jmri.util.swing.JmriMouseListener$1.mouseReleased(JmriMouseListener.java:33) [classes/:?]
     [java]     at java.awt.Component.processMouseEvent(Component.java:6635) [?:?]

@dsand47
Copy link
Contributor

dsand47 commented Feb 17, 2024

Much thanks for the feedback and log @dsand47

There are only a few else if statements difference so we're definitely getting closer! If you could please try the latest PR, the Right / Control clicks are initally going down the same path,

Win 11 latest PR right click on test case Panel Signal Mast Icon I'm getting

     [java] 02:06:08,956 rit.display.layoutEditor.LayoutEditor INFO  - mouseReleased, editable false [AWT-EventQueue-0]
     [java] 02:06:08,957 rit.display.layoutEditor.LayoutEditor INFO  - requesting popup out of edit mode [AWT-EventQueue-0]
     [java] 02:06:08,957 rit.display.layoutEditor.LayoutEditor INFO  - checking for SignalMast Icon at Point2D.Double[53.0, 28.0] [AWT-EventQueue-0]
     [java] 02:06:08,958 rit.display.layoutEditor.LayoutEditor INFO  - checking if click at Point2D.Double[53.0, 28.0] within bounds of SigMast Icon at java.awt.Rectangle[x=41,y=22,width=19,height=16] [AWT-EventQueue-0]
     [java] 02:06:08,962 rit.display.layoutEditor.LayoutEditor INFO  - SignalMast found from checkSignalMastIconPopUps [AWT-EventQueue-0]
     [java] 02:06:08,962 rit.display.layoutEditor.LayoutEditor INFO  - showPopUp for IF$tsm:BR-2003:2-h($0001) [AWT-EventQueue-0]
     [java] 02:06:08,962 jmri.jmrit.display.SignalMastIcon     INFO  - showPopup [AWT-EventQueue-0]
     [java] 02:06:08,962 jmri.jmrit.display.SignalMastIcon     INFO  - performing right click action  [AWT-EventQueue-0]
     [java] java.lang.Exception: Trace
     [java]     at jmri.jmrit.display.SignalMastIcon.performControlClickNonEditAction(SignalMastIcon.java:406) [classes/:?]
     [java]     at jmri.jmrit.display.SignalMastIcon.showPopUp(SignalMastIcon.java:212) [classes/:?]
     [java]     at jmri.jmrit.display.layoutEditor.LayoutEditor.showPopUp(LayoutEditor.java:3991) [classes/:?]
     [java]     at jmri.jmrit.display.layoutEditor.LayoutEditor.mouseReleased(LayoutEditor.java:3721) [classes/:?]
     [java]     at jmri.util.swing.JmriMouseListener$1.mouseReleased(JmriMouseListener.java:33) [classes/:?]
     [java]     at java.awt.Component.processMouseEvent(Component.java:6635) [?:?]

The LE signal popup issue also applies to Linux.

For Linux (right click) and macOS (ctl-click), isPopupTrigger() might be true on mousePressed, never on mouseReleased.

At line 3148 is the code to handle Markers for Mac and Linux.

            // not in edit mode - check if a marker popup menu is being requested
              LocoIcon lo = checkMarkerPopUps(dLoc);
            if (lo != null) {
                delayedPopupTrigger = true;
            }

If you have not done so, you will need code similar to checkMarkerPopUps to see whether the mast, if any, should get the pup-up menu. delayedPopupTrigger is used to defer the trigger processing until mouseReleased which will include Windows.

add check for SignalMastIcon as delayedPopupTrigger
@icklesteve
Copy link
Member Author

Thanks for the line pointer @dsand47 , I've added the SignalMastIcon check.

@dsand47
Copy link
Contributor

dsand47 commented Feb 19, 2024

I think I know which does what. I have some extra log.info messages.

Win11 running in Parallels.

  • Button 3
    • pressed: popup true, delayed not set
    • released: popup true
    • sensor set on popup true
  • CTRL Button 3
    • pressed: popup true, delayed set true
    • released: popup false
    • sensor set based on delayed true

Ubuntu running in Parallels.

  • Button 3
    • pressed: popup true, delayed not set
    • released: popup false
    • sensor not set
  • CTRL Button 3
    • pressed: popup true, delayed set true
    • released: popup false
    • sensor set based on delayed true

Raspberry Pi

  • Button 3
    • pressed: popup true, delayed not set
    • released: popup false
    • sensor not set
  • CTRL Button 3
    • pressed: popup true, delayed set true
    • released: popup false
    • sensor set based on delayed true

macOS

  • Button 3 (two finger click on track pad)
    • pressed: popup true, delayed set true due to meta
    • released: popup false
    • sensor set based on delayed true
  • CTRL Button 1
    • pressed: popup true, delayed set true
    • released: popup false
    • sensor set based on delayed true

Summary

  • WIn 11: Button 3 with or without CTRL
  • Linux: Button 3 with CTRL
  • macOS: Button 1 with CTRL or Button 3 with META. Real mouse unknown.

@icklesteve
Copy link
Member Author

They both work for markers.

Hi @dsand47 I've found another location that the Marker popups are being activated from :-)
Thanks for all your testing on this, much appreciated,
Steve.

Copy link

This PR is stale because it has been open for 45 days with no activity.

@github-actions github-actions bot added the Pending closure This issue or PR has not been updated for a while label Apr 15, 2024
@icklesteve icklesteve removed the Pending closure This issue or PR has not been updated for a while label Apr 24, 2024
@icklesteve icklesteve added the After Next Production Release Do not merge this until after the next production release label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
After Next Production Release Do not merge this until after the next production release Needs L10N Needs localization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants