#7171 closed enhancement (fixed)
PicLayer plugin - reimplement toolbar button autohiding
Reported by: | akks | Owned by: | Larry0ua |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Plugin piclayer | Version: | |
Keywords: | Cc: |
Description
After latest changes in core considering button visibilty mechanism (left toolbar) [4669]
some PicLayer button customizing functionality is reimplemented in the core (slightly differnet way)
For better integration it would be good to change PicLayer code like in [o27288], especiialy code like
/** * The toolbar buttons shall be active and visible only when the PicLayer is active. */ @Override public void activeLayerChange(Layer oldLayer, Layer newLayer) { boolean oldPic = oldLayer instanceof PicLayerAbstract; boolean newPic = newLayer instanceof PicLayerAbstract; // actually that should be not enough - JOSM should hide all buttons that are disabled for current layer! if (oldPic && !newPic || oldLayer == null && !newPic) { // leave picture layer - hide all controls for (PicToggleButton btn : buttonList) { btn.writeVisible(); btn.setVisible(false); } if (oldLayer != null) ((PicLayerAbstract)oldLayer).setDrawPoints(false); } if (!oldPic && newPic) { // enter picture layer - reset visibility of controls for (PicToggleButton btn : buttonList) btn.readVisible(); } }
Attachments (0)
Change History (15)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
You are almost right - if you change min josm version in build.xml, users who use older josm will receive old version of plugin. So it will not affect tested users. I am almost sure :) You can test it - upload some insinificant improvement asfor 4669 and check that 4666 will not get this verison.
Oh, I forget to post link for core change ticket: #6953
comment:3 by , 14 years ago
how about users who did not have piclayer before, have tested josm and want to download piclayer? will they be able to download older version in such case?
comment:4 by , 14 years ago
Yes, there is some server magic, that makes this work. The version mapping can be checked here.
comment:5 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
thanks, now it is more clear to me
and - that's great that anyone can have autohide tool buttons without reimplementing same bicycle...
fixed at [o27290]
follow-up: 10 comment:7 by , 14 years ago
I think there is a setAutoHideDisabledButton(true) missing to activate that hiding in [o27290].
follow-up: 9 comment:8 by , 14 years ago
it worked for me... I added preference sidetoolbar.hideDisabledButtons=true and buttons hide for me instead of disabling. Should it work that way?
comment:9 by , 14 years ago
Replying to Larry0ua:
it worked for me... I added preference sidetoolbar.hideDisabledButtons=true and buttons hide for me instead of disabling. Should it work that way?
That is the "do this always" mode. This will stay a hidden setting in the future (it is a bit disturbing). The above call does enable that for individual buttons.
comment:10 by , 14 years ago
Replying to stoecker:
I think there is a setAutoHideDisabledButton(true) missing to activate that hiding in [o27290].
Yes, you really need to call setAutoHideDisabledButton(true) want to restore original behaviour.
I like hidetoolbar.hideDisabledButtons=true too now, but it is disabled by default :)
comment:11 by , 14 years ago
that's messy. should I add setAutoHideDisabledButton(true) to all my buttons? if yes - [o27296] - fixed
comment:12 by , 14 years ago
Yes, I am afraid so... Elsewhere we have to enable hiding by default.
Do you have an idea how to make it simpler?
I see you have used a factory - you can make a patch and move it to core as IconToggleButton.createAutoHidingButton(MapMode), for example...
comment:14 by , 14 years ago
I think it is ok that way. We don't need core code for every usage possibility, but only the generic functionality.
comment:15 by , 14 years ago
You mean there is only one plugin with 8 buttons and it already has a factory :)
current josm-tested is 4666, so I am not sure how to make it to leave code for tested and remove for latest. may be it's better to wait some time?
Do you know how auto-update works for plugins? Maybe I should change min josm version for piclayer to 4669 and remove enabling/disabling code? But this will affect tested users.