Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Multiple-bar touchbar interface #1801

Open
wants to merge 23 commits into
base: touchbar
Choose a base branch
from

Conversation

michaelsavich
Copy link

@michaelsavich michaelsavich commented Jan 22, 2017

Hopefully this pull request isn't too big, but it took me this long to get around to enabling all of the features present in the base fork. The touchbar now presents different bars depending on the context:
*Welcome Page bar, which displays recent solutions from the Welcome Page allowing for easy access
*Text Editor bar, which is basically the main bar, it is intended to be user-customizable, but a bug means that functionality is currently disabled
*Debug bar, which presents the debug controls
*There are references to a Preferences bar, currently unimplemented, which would allow the user to scrub through tabs in the preferences window

Basically this is a first pass at figuring out how the touchbar features would work, both in terms of UI and structuring in code. This feature isn't done, there are definitely still a couple bugs, and I'd like to stress nobody should be afraid to improve upon what I've written here.

This commit features a workaround due to a garbage collection bug. See AwesomeBar.cs line 41
Scaffolding for multiple touchbars and customization later on
Renamed some of the identifiers in my code to be more clear.
Apple's NSTouchBar guide ominously suggests that the identifiers need to be globally unique, so I added constants for them in the form of "com.MonoDevelop.TouchBarIdentifiers.<Identifier Name>" if you customized the bar in a previous build, you will need to re-customize it to get items to appear again since the identifiers have technically changed.
Previously images were generated every 700 ms when UpdateTouchBar() was called
There is a nasty bug that occurs where after the user dismisses the system's touchbar customization UI, there is a significant chance for all windows on the user's computer to become unresponsive until MonoDevelop is killed. Until this bug is fixed, I've sealed off the customization functionality. (if you can customize the touch bar, changing at least one item, five times in a row without running into this bug then it is probably fixed)
Preliminary support for the debugging controls present in earlier builds has been added back in.
@monojenkins
Copy link
Contributor

Hello! I'm the build bot for the Mono project.

I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done.

Contributors can ignore this message.

michaelsavich and others added 6 commits January 26, 2017 22:33
This makes use of the assets that were added in the last commit
Previously, the images for the run button were loaded as-is, which resulted in a black-on-black button that looked disabled. I enabled the template image effect, which is better-- the button is at a weird size now, but at least it doesn't look broken.
Also fixes a bug in the previous commit where I used absolute URLs to load files-- as in, absolute to my home directory on my computer. I'm so, so sorry about that.
Added a button to start up a new solution from the touchbar on the welcome page. Also removed recent items from the scrollview so it stays fixed in place when the user scrolls.
@DavidKarlas
Copy link
Member

In case of "Debug bar, which presents the debug controls" I would expect at least StepIn, StepOver and StepOut actions...

But more in general I don't like how everything is hardcoded for example public static class Id //unique IDs for TouchBar items I would prefer if this Ids were generated from Command Id, with maybe some global prefix.

What should be goal/design of this whole thing is...
We should have hardcoded scenarios like Preferences window and Welcome page, where UI/TouchBar is very specific...

But for other cases like coding, debugging, unit testing... We should respect layouts:
image
And have some defaults that we think are best...

This is important part:
But give user option in Preferences to modify that like keyboard bindings per layout and rearrange and add/remove any command user wants... In case we don't have icon for that command we should use text name of command...

@michaelsavich
Copy link
Author

michaelsavich commented Feb 15, 2017

@DavidKarlas Thanks for the feedback. This is very much a "first pass" at the UI so your ideas are genuinely useful.

Generating the IDs in a more global way seems like a good idea. Probably make a function that constructs an ID for a Command.

It's interesting you brought up unit testing… I wonder what controls would be useful in that context? It's definitely worth brainstorming.

The step in-out-over buttons are on the to-do list, but do present a problem in that MD must be in focus to use them, making them marginally less useful. There is a private API Xcode uses to work around this, and since MD isn't in the App Store, we could use it... we just have to be careful to code it so if the API breaks MD isn't negatively affected.

Unfortunately Apple's customization UI enforces a finite number of Touch Bar items, so we'd still have to hardcode the subset of commands to expose as Touch Bar controls. It's possible to create our own customization interface but it'd take a lot of work. Apple's customization UI is actually wired up in this build but it's sealed off with an ifdef because it seems to cause the whole app to freeze, some bug in Xamarin.mac I think.

@DavidKarlas
Copy link
Member

Re-Run last unit test would be good start, maybe navigate to failed test source code... Thats why we need to give users ability to set any command in Preferences... They know what is best for them...
I wasn't thinking specifically about unit testing... I'm just saying it should be generic on per Layout basis...

About MD needs being in focus, thats not issue, even today MD needs to be in focus to listen to keyboard shortcuts for stepping and stuff, thats not really issue imo.

@michaelsavich
Copy link
Author

michaelsavich commented Feb 15, 2017 via email

@DavidKarlas
Copy link
Member

We can always limit how many commands user can add to not crash TouchBar :)
But in general, assume user will remove commands user doesn't need to make TouchBar useful...

About showing it in Preferences... If there is really no way of detecting if MacBook has TouchBar or not, always displaying it in Preferences is small price to pay...

@michaelsavich
Copy link
Author

michaelsavich commented Feb 15, 2017 via email

@DavidKarlas
Copy link
Member

That editor looks nice, but I'm not sure if it can handle ~100 commands that we have... We probably also want to give user ability to add commands that are introduced by AddIns... So, we need to give option to add any command in case command doesn't have Icon for touchbar... display Text(name of command)

For same reason, we should probably always show Preferences editor for TouchBar, that is not real problem...

@michaelsavich
Copy link
Author

michaelsavich commented Feb 15, 2017 via email

@TomSoderling
Copy link

Have you considered making this into a VS for Mac Extension? https://docs.microsoft.com/en-us/visualstudio/mac/extending-visual-studio-mac

@michaelsavich
Copy link
Author

Sorry it took me so long to respond. I don't think an extension would work here. There aren't any extension points for the Touchbar, and from my experience with AppKit, I seriously doubt there is a sane way for extensions to add Touchbar support.

The bug that was caused by entering the customization screen seems to be fixed, enabling it again.
@Dids
Copy link

Dids commented Jan 1, 2019

Any updates on this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants