Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#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 Larry0ua, 14 years ago

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 by akks, 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

Last edited 14 years ago by akks (previous) (diff)

comment:3 by Larry0ua, 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 bastiK, 14 years ago

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

comment:5 by Larry0ua, 14 years ago

Resolution: fixed
Status: newclosed

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 by bastiK, 14 years ago

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

comment:7 by stoecker, 14 years ago

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

comment:8 by Larry0ua, 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?

in reply to:  8 comment:9 by stoecker, 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.

in reply to:  7 comment:10 by akks, 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 Larry0ua, 14 years ago

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

comment:12 by akks, 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:13 by Larry0ua, 14 years ago

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

comment:14 by stoecker, 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 akks, 14 years ago

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Larry0ua.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.