On Thursday, October 26, 2017 at 3:43:55 PM UTC+2, Konrad Zuwała wrote:
>
> I will have my first question here regarding Shelve/Unshelve context menu.
> The problem that we found out was a situation, when we try to Unshelve when
> nothing is shelved. Right now, if you do it, after clicking Unshelve,
> nothing will happen. We thought about two solutions:
> 1. If nothing is shelved in a directory, just hide Unshelve,
> 2. Handle this situation in unshelve dialog (like show MessageBox("Sorry,
> nothing shelved")).
> 3. Is there something like ITEMIS_MULTIPLESELECTION?
>
> First solution is quite problematic in a way it requires us to check
> in CShellExt::Initialize_Wrap if we have anything shelved. We did it by
> adding a method to SVN class -> HasShelvedItems, which would call
> SVN::ShelvesList and check if a list of shelved items is empty or not.
> However, we run into circular #includes -> we cannot include <SVN.h> in
> ContextMenu.cpp, as we're getting compiler errors. This also requires us to
> new ITEMIS #define -> ITEMIS_SHELVED, so kind of modifying "core" of
> Tortoise.
> Do you have any suggestions which way would be best to do it? Like, we go
> with number 2. solution, and handle it in dialog, or we try to hide
> Unshelve menu when nothing is Shelved?
>
I wouldn't do that if not really, really required. Because doing too much
in a context menu handler is bad - imagine doing that on a slow network
share where even fetching the status can take seconds...
If you want to do that, you have to move the SVN::ShelvesList() outside the
SVN class: the shell extension is linked without any networking support,
therefore requires compilation without any network svn libs - and the SVN
class includes everything including the networking stuff.
Think of this as a way to go over ShelvesList() again and optimize it for
speed so the context menu doesn't slow down :)
>
> As for 3., currently we want to disable Shelve, when either one or many
> items are selected - it gives confusing result. We want to do it by hiding
> Shelve menu when you have something selected. Detection of selection is
> easy, in CShellExt::Initialize_Wrap, there is pDataObj which is != NULL
> when we have selection. However, we must add states to itemStates telling
> that something got selected and later use this state
> in ShellMenuShelve/ShellMenuUnshelve. Is there such a flag (telling that
> something was selected by mouse) defined somewhere or we have to add it
> (ITEMIS_SELECTED)?
>
Not sure what you mean: there's always something "selected" when showing
the context menu!
Because the shell extension is only registered to be shown if an
item/folder/directory/folder background is selected.
If you mean multiple items selected: there's the opposite flag
ITEMIS_ONLYONE which is true if only one item is selected, false if
multiple items are selected.
But as I said: there's always at least one item 'selected'.
Stefan
--
You received this message because you are subscribed to the Google Groups
"TortoiseSVN-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tortoisesvn-dev/279a52b1-929c-435c-91e6-bfef1f042b7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.