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

Adds customizable keys for activating the key tips #563

Merged
merged 6 commits into from
Apr 19, 2018
Merged

Adds customizable keys for activating the key tips #563

merged 6 commits into from
Apr 19, 2018

Conversation

pschimmel
Copy link
Contributor

As announced in Issue #559 I extended the ribbon service that the implementer can change the default keys that activate key tips.

This can become handy when the default keys are needed for other functions in the application.

@pschimmel pschimmel mentioned this pull request Apr 12, 2018
@batzen
Copy link
Member

batzen commented Apr 13, 2018

Thanks for contributing!
Will have a look at this as soon as i got some spare time. Which might take a few days.

@batzen batzen self-assigned this Apr 13, 2018
@batzen batzen added this to the 7.0.0 milestone Apr 13, 2018
@batzen
Copy link
Member

batzen commented Apr 13, 2018

Could you add some documentation for this feature to the documentation repository? That would be nice ;-)

@pschimmel
Copy link
Contributor Author

pschimmel commented Apr 13, 2018

Yes. No problem. But it might take a couple of days.

Wait a minute. What exactly is the documentation repository?? Is there a separate repo for that?

@batzen
Copy link
Member

batzen commented Apr 13, 2018

Yes there is https://github.com/fluentribbon/fluentribbon.github.io which hosts the website and documentation. ;-)

@batzen
Copy link
Member

batzen commented Apr 15, 2018

Finally found some time to have a look at this.
I am wondering if it would be more flexible to just use a list of KeyGesture instead of custom parsed strings. That way people could specify keys and modifiers. And it would be type safe. ;-)

@pschimmel
Copy link
Contributor Author

I agree it could be easier to define a list of KeyGestures in XAML as they are used in other places, too and programmers are used to them.

I thought it could be a problem that some keys that are only valid when a also a modifier was provided.

When editing the IsShowOrHideKey method of the KeyTipService I was also not sure about the limitation to SystemKeys and Shift keys. But I assume that's there because of a certain reason, so I left that part untouched.

@batzen
Copy link
Member

batzen commented Apr 16, 2018

You are right about the modifier keys.
If Key == None then we can't call gesture.Matches but have to check that manually.
The check for SystemKey could be removed, the checks for shift are way too broad.
They are there because Word behaves different when certain keys are pressed and shift is also pressed.

  • Shift + F10 opens the context menu
  • Shift + Alt shows key tips

So the only special case left is Shift + F10.
We should keep that special case by checking if modifier for a given gesture is None, key is F10 and shift is pressed. That case should then not show the key tips. As that shortcut is not only for Word but a global shortcut used to open a context menu.

I noticed that Space shouldn't open key tips as Word doesn't too. Don't know why it's there.
So we should just remove it and add it as a breaking change to the changelog.

@pschimmel
Copy link
Contributor Author

I just pushed the changes that use KeyGestures.
I removed the checks for SystemKey and the check for Shift keys. Instead it checks against a list of invalid gestures.

Some parts might require some optimization, but it's already a bit late :)

@batzen
Copy link
Member

batzen commented Apr 18, 2018

There are a few things that are problematic in the code.
Should i add comments to the lines you changed and you fix the issues, or should i accept your PR and push changes fixing the issues?
The second approach would be faster and wouldn't cause us to go back and forth. ;-)

@pschimmel
Copy link
Contributor Author

I agree. Just go ahead and do the changes. I'll take a look at them when the PR is merged with the main branch.

@batzen batzen merged commit 77f1477 into fluentribbon:develop Apr 19, 2018
@batzen
Copy link
Member

batzen commented Apr 19, 2018

Ok, i have admit that KeyGesture doesn't work as well as i thought because we can't check modifier-keys on KeyUp.
I will change the code to just use a list of Key.

By that we still get type-safe keys because you can use

<Fluent:Ribbon.KeyTipKeys>
    <Key>A</Key>
</Fluent:Ribbon.KeyTipKeys>

batzen added a commit that referenced this pull request Apr 19, 2018
batzen added a commit that referenced this pull request Apr 19, 2018
batzen added a commit that referenced this pull request Jun 26, 2018
batzen added a commit that referenced this pull request Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants