Modify

Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#7171 closed enhancement (fixed)

PicLayer plugin - reimplement toolbar button autohiding

Reported by: akks Owned by: Larry0ua
Priority: normal 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 Changed 17 months ago by Larry0ua

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.

comment:2 Changed 17 months ago by akks

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

Last edited 17 months ago by akks (previous) (diff)

comment:3 Changed 17 months ago by Larry0ua

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 Changed 17 months ago by bastiK

Yes, there is some server magic, that makes this work. The version mapping can be checked here.

comment:5 Changed 17 months ago by Larry0ua

  • Resolution set to fixed
  • Status changed from new to 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]

comment:6 Changed 17 months ago by bastiK

akks: I think I accidentally removed your comment as spam, sorry.

comment:7 follow-up: Changed 17 months ago by stoecker

I think there is a setAutoHideDisabledButton(true) missing to activate that hiding in [o27290].

comment:8 follow-up: Changed 17 months ago by Larry0ua

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 in reply to: ↑ 8 Changed 17 months ago by stoecker

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 in reply to: ↑ 7 Changed 17 months ago by akks

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 Changed 17 months ago by Larry0ua

that's messy. should I add setAutoHideDisabledButton(true) to all my buttons? if yes - [o27296] - fixed

comment:12 Changed 17 months ago by akks

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:13 Changed 17 months ago by Larry0ua

Also - new constructor parameter can be introduced to do same...

comment:14 Changed 17 months ago by stoecker

I think it is ok that way. We don't need core code for every usage possibility, but only the generic functionality.

comment:15 Changed 17 months ago by akks

You mean there is only one plugin with 8 buttons and it already has a factory :)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed .
as The resolution will be set. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.