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

[scide] Improve look of tabs #3992

Merged
merged 14 commits into from
Aug 27, 2018
Merged

Conversation

nhthn
Copy link
Contributor

@nhthn nhthn commented Aug 17, 2018

Purpose and Motivation

in #3950, we changed the IDE theme to qt's fusion style for all platforms. this was a necessary move to unify the look and reduce maintenance effort for appearance on multiple platforms, but it also made the IDE look worse on some platforms, so it's a wise idea to start improving the appearance to give good first impressions of 3.10.

this is inspired by scott's ui-refresh branch but doesn't use any stylesheets, just QPalette and custom painting functions.

Types of changes

before:

before

after:

untitled

removed ugly black line under tabs. tabs are now rectangular rather than rounded. the active tab has the same color as the document background, and inactive tabs have a line separating them. inactive tabs have reduced text contrast, and the active tab is bolded.

the border around edit area has been changed to a translucent stripe that appears at the bottom of the editor. it's not a perfect solution, but it's functional.

the X buttons now have a color that matches the text. i had difficulty changing colors in the qt pixmap so i just drew two crossed lines with QPainter -- the pixmap reportedly looked awful on retina displays anyway. scott has a more long-term solution for getting icons to work well with different color themes by loading in Material icons, but this is sufficient for now.

in the process, some code from #3950 was refactored for clarity and behavior was changed a bit. adding offsets to value in HSV color space seems better than the QtColor darker and lighter methods.

Checklist

  • All tests are passing
  • If necessary, new tests were created to address changes in PR, and tests are passing
  • Updated documentation, if necessary
  • This PR is ready for review

Remaining Work

  • rethink focus indicator for editor windows & docklets
  • increase background contrast between selected/deselected tabs
  • reduce text contrast for deselected tabs
  • remove right border for the tab immediately to the left of selected tab and for the rightmost tab
  • test dark and light themes on all OS's, including high-DPI systems

@nhthn nhthn added this to the 3.10 milestone Aug 17, 2018
@nhthn
Copy link
Contributor Author

nhthn commented Aug 17, 2018

probably the most controversial change here is the removal of the rectangle that appears around the edit area when you click on it. since this deliberately implemented behavior, i assume that it's there for a reason. i'm not sure what though, and it looks kinda ugly. i disabled it, but the code is intact and can be re-enabled by editing a boolean.

@jamshark70
Copy link
Contributor

probably the most controversial change here is the removal of the rectangle that appears around the edit area when you click on it.

I don't care about the rectangle, but I do care about a way to distinguish, quickly at a glance, between the editor box having focus and the post window having focus.

It wouldn't be valid, IMO, to suggest that users should look for the blinking insertion point because a/ it's small and hard to see and b/ with the scroll wheel, you might have scrolled so that the insertion point is outside the visible area. (I know, you're not putting that argument forth here -- I'm just handling a potential response in advance.)

FWIW the rectangle is not ugly in my Linux system.

I'll try the other changes in a minute (fetch and build...).

@jamshark70
Copy link
Contributor

Sorry, how to resolve this error?

CMake Error at /opt/qt511/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package):
  Could not find a package configuration file provided by "Qt5WebSockets"
  with any of the following names:

    Qt5WebSocketsConfig.cmake
    qt5websockets-config.cmake

@nhthn
Copy link
Contributor Author

nhthn commented Aug 17, 2018

sudo apt install qt511websockets?

@jamshark70
Copy link
Contributor

Ok, yes, that was it. I just didn't have mental bandwidth at that moment to research it. Thanks.

@jamshark70
Copy link
Contributor

Btw I generally like it. My only quibble is that, in a dark theme, it might make more sense for deselected tabs to be dark and the selected tab to be lighter (so that the deselected tabs recede into the background). Very minor point. Generally looks nice to me.

@htor
Copy link
Contributor

htor commented Aug 17, 2018

looks much better!
my only suggestion for an improvement is to only show the X button on a tab when mouse is hovering over it, not all the time. this is how the Atom editor behaves:

untitled

@miczac
Copy link
Contributor

miczac commented Aug 17, 2018 via email

@miczac
Copy link
Contributor

miczac commented Aug 17, 2018

apparently the tabs bg-colour is coupled to the editor's text bg-colour.
I set my dark theme for maximum contrast, which now results in that:

sc_new_tab-look

top is before applying the patch.

@htor
Copy link
Contributor

htor commented Aug 17, 2018

@miczac i hear you. hiding the x-es might not be intuitive.

thinking about ui changes forward, i think generally it would be easier and less time consuming to produce a consistent ui for the ide if there was a design sketch proposed (an actual drawing) for the changes first, then have a discussion around that sketch, agree on the changes and at the end and then implement it. may be less time consuming. just a thought.

@miczac
Copy link
Contributor

miczac commented Aug 17, 2018 via email

@miczac
Copy link
Contributor

miczac commented Aug 17, 2018

BTW, that's the current "Fonts & Colors" window. I adapted some settings, should cross-check w/ 3.9.3 if things still look sane.

screen shot 2018-08-17 at 14 19 23

sorry forgot: point is: it needs some boundaries! ;)

@scztt
Copy link
Contributor

scztt commented Aug 17, 2018

Using the syntax colors for the preferences panel is a little heavy - got to say, I don't much like that at all.

For the case @miczac described - I think for the tabs, we might need to have logic where -- when the value (the V in HSV) is >0.5 we dim unselected tabs, and for V<0.5 we brighten unselected tabs? No idea how to make that work, but miczacs screenshot is definitely a problem.

And: can you maybe post a screenshot with a bunch of split views? Differentiating between split views that have focus is a touch UI problem, it'd be good to see how it looks in this scheme.

In general, though, this is a HUGE improvement on the look of both tabs and docklet bar. Can we maybe try underlining the tab titles perhaps, to separate tab header text from code (since there's no line now)?

@nhthn
Copy link
Contributor Author

nhthn commented Aug 17, 2018

re: editor focus, i think it would be cool to indicate editor focus by putting a highlight bar over the top of the active tab. stylish, easily visible, doesn't get in the way.

re: contrast. for dark themes, the contrast between tab and background is not so bad on my screen, so i am probably not the best person to adjust it. @miczac or @scztt if you'd like to adjust it yourselves and report back on a reasonable difference, the code is in editors/sc-ide/widgets/app_palette.cpp, here:

bool dark_on_light = window_text.value() < window.value();
if (dark_on_light) {
    mid = color::darken(window, 23);
    highlight = color::darken(window, 50);
    disabled_text = color::darken(window, 20);
    disabled_shadow = color::darken(window, 20);
} else {
    mid = color::lighten(window, 23); // <----- increase this
    highlight = color::lighten(window, 30);
    disabled_shadow = color::lighten(window, 40);
    disabled_text = color::lighten(window, 40);
}

part of distinguishing inactive tabs is the text color, which i will also experiment with.

by the way, i'd prefer if this github PR doesn't get cluttered up with minor design adjustments, so small tips on improving the design are best sent over slack.

@patrickdupuis
Copy link
Contributor

re: editor focus, i think it would be cool to indicate editor focus by putting a highlight bar over the top of the active tab. stylish, easily visible, doesn't get in the way.

👍

@jamshark70
Copy link
Contributor

jamshark70 commented Aug 17, 2018

For the case @miczac described - I think for the tabs, we might need to have logic where -- when the value (the V in HSV) is >0.5 we dim unselected tabs, and for V<0.5 we brighten unselected tabs?

I would argue against brightening unselected tabs in all cases. If you have 4 tabs open, only one can be selected. If it's a dark theme and you brighten unselected tabs, then 75% of the tab bar is brighter than the surrounding regions... exactly what we were trying to avoid.

I think @snappizz's idea of a highlight bar is a much better idea. As I think about it, I'd prefer this over messing with background colors.

If we must use background color to differentiate the active tab, I'd suggest in bright themes to darken the active tab and in all themes to lighten the active tab -- slightly. The lighter color draws the eye. Perhaps with the exception that a single open tab could be darker in dark themes.

@jamshark70
Copy link
Contributor

Also, I'm not sure if my earlier comment about the editor area rectangle registered attention or not.

i assume that it's there for a reason. i'm not sure what though

It's there when the editor panel has focus, and it's not there when another panel has focus (for example, if you're selecting text in the post window, or if you accidentally clicked in the post window, documents, find/replace/commandline/goto-line bar).

I don't mind getting rid of the rectangle, but it would be good to have some other mechanism, then, to know which panel has focus. But I can't think of anything less intrusive than the rectangle. Perhaps reduce the contrast on it.

@miczac
Copy link
Contributor

miczac commented Aug 19, 2018 via email

@nhthn
Copy link
Contributor Author

nhthn commented Aug 19, 2018

i haven't messed with the background contrast yet. feel free to pull the latest version and then adjust.

@nhthn
Copy link
Contributor Author

nhthn commented Aug 20, 2018

it shouldn't look like that at all -- are you sure you're on the right branch and you've rebuilt SC?

@miczac
Copy link
Contributor

miczac commented Aug 21, 2018

(sorry! branch & build was ok, overlooked an error when applying the patch, had files from previous patch floating. Should have noticed the similar gui look :(
Deleted the previous comments.)

I created both with a fresh profile in an arrangement which is about the same as I do have currently.
To get the black one I transferred sc_ide_conf.yaml from my actual profile to the white profile.

screen shot 2018-08-21 at 02 56 09

screen shot 2018-08-21 at 03 27 28

In general, the black one is a tad too much in the dark, IMHO.

@nhthn
Copy link
Contributor Author

nhthn commented Aug 21, 2018

the contrast is not so bad to me, but as previously suggested, maybe you'd like to adjust it for your screen by visiting editors/sc-ide/widgets/app_palette.cpp and editing this line:

bool dark_on_light = window_text.value() < window.value();
if (dark_on_light) {
    mid = color::darken(window, 23);
    highlight = color::darken(window, 50);
    disabled_text = color::darken(window, 20);
    disabled_shadow = color::darken(window, 20);
} else {
    mid = color::lighten(window, 23); // <----- increase the 23
    highlight = color::lighten(window, 30);
    disabled_shadow = color::lighten(window, 40);
    disabled_text = color::lighten(window, 40);
}

@miczac
Copy link
Contributor

miczac commented Aug 21, 2018

tried it, IMHO a value of 29 is fine:

screen shot 2018-08-21 at 14 25 48

BTW: what's this line doing?
disabled_text = color::lighten(window, 40);

FWIW, I found that to my sore eyes reducing the brightness of the inactive tab's text has more effect than increasing the brightness of the bg-colour.

@nhthn
Copy link
Contributor Author

nhthn commented Aug 21, 2018

yeah, to make it more clear i have drawn the active tab text in bold and reduced the opacity of the inactive tab text. hopefully, even with lightening the background color, i've made it crystal clear what's highlighted and what's not. i would also like to hide the X's for inactive tabs until mouseover as @htor suggested, but that's surprisingly tricky to do in qt. maybe for a later PR.

thanks for adjusting. i still like +23 value for dark-but-not-black backgrounds like on dracula or solarized dark, but it seems that we need to threshold the minimum value to 29 to prevent a sea of black when we have a really dark background color.

only thing left to do here is to replace the rectangle for editor focus. i already mentioned that an overline on the selected tab would be nice, but this is actually very hard to write in qt. i think to hold james over we can draw a big translucent rectangle on defocus, or reduce the rectangle to a line at the bottom.

@nhthn
Copy link
Contributor Author

nhthn commented Aug 21, 2018

@jamshark70 the latest commit redesigns the focus rectangle as a thin translucent bar at the bottom of the editor. it's not a perfect solution, but it's less disruptive than the rectangle imo, especially for light themes.

with that, this PR is feature complete. i don't want this to stall too much, so reviewers please keep in mind that the point here is to improve the design, not necessarily perfect it.

Copy link
Contributor

@patrickdupuis patrickdupuis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great step forward. Much appreciated 💯

@miczac
Copy link
Contributor

miczac commented Aug 22, 2018

👍 Thanks!

@jamshark70
Copy link
Contributor

OK, the focus bar at the bottom of the editor is fine.

I have to admit, I'm still confused in the dark theme by the fact that the selected tab has a darker background than deselected tabs. If there are two documents, I can't help but read the lighter one as selected (despite the boldface for the really-selected one). I strongly suggest that the selected tab should have a lighter background.

Firefox tabs, for reference. The github tab (second) is active.

firefox-tabs

@nhthn
Copy link
Contributor Author

nhthn commented Aug 27, 2018

i tried out darkening and you're right, it does look nicer. here's "dracula" theme:

untitled

however, some people set really dark backgrounds, and we can't go darker than that. in my opinion, nearly-black backgrounds are just not attractive color choices. but for people who do use them, i will use an overline. here is the vomitous "dark" theme:

untitled2

let's please push this one through and adjust later, thanks. colors are kinda subjective and there's only so much i can do to accommodate everyone's tastes. in the future can expand our theme system so that these options can be adjusted manually by the user rather than automatically from the colors.

@miczac
Copy link
Contributor

miczac commented Aug 27, 2018

Thanks!
I'm afraid I got a problem here:

/Users/mz/dev/sc3.git/3.9/editors/sc-ide/widgets/style/style.cpp:250:43: error: call to 'abs' is ambiguous
        int window_mid_value_difference = std::abs(
                                          ^~~~~~~~
In file included from /Users/mz/dev/sc3.git/3.9/editors/sc-ide/widgets/style/style.cpp:25:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:664:1: note: candidate function
abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:668:1: note: candidate function
abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:672:1: note: candidate function
abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
^
1 error generated.

just checked: travis complains about the same error.
https://travis-ci.org/supercollider/supercollider/jobs/421298235

@nhthn
Copy link
Contributor Author

nhthn commented Aug 27, 2018

thanks, should be fixed now

@patrickdupuis patrickdupuis merged commit 3a8d7c2 into supercollider:3.10 Aug 27, 2018
@miczac
Copy link
Contributor

miczac commented Aug 27, 2018

Ah, I just included cstdlib to get it to compile, that's what it looks like here:

screen shot 2018-08-28 at 01 48 54

@nhthn
Copy link
Contributor Author

nhthn commented Aug 28, 2018

oh dear -- that overline looks wrong. i'll fix in a separate PR.

@miczac
Copy link
Contributor

miczac commented Aug 28, 2018

I fetched and compiled the original branch Patrick just merged.
Somethings 'counting' wrongly regarding the bar's length, I'm afraid:

screen shot 2018-08-28 at 02 04 35
screen shot 2018-08-28 at 02 04 49
screen shot 2018-08-28 at 02 05 09
screen shot 2018-08-28 at 02 05 23

Since I work with detached windows I just checked in monolith-mode. ;)
screen shot 2018-08-28 at 02 16 43

@miczac
Copy link
Contributor

miczac commented Aug 28, 2018

I'm sorry - github kept telling me "You can't comment at this time. "
Deleted the excess comments.
BTW, notifications appear pretty late, too late - or are we just too quick for github? ;)

@nhthn
Copy link
Contributor Author

nhthn commented Aug 28, 2018

i think github was wigging out, i was getting 500 errors not long ago. seems to be alright now.

@nhthn nhthn deleted the topic/nice-tabs branch August 28, 2018 00:43
@miczac
Copy link
Contributor

miczac commented Aug 28, 2018 via email

@nhthn
Copy link
Contributor Author

nhthn commented Aug 28, 2018

yeah no prob, thanks for your feedback as well!

@jamshark70
Copy link
Contributor

let's please push this one through and adjust later, thanks. colors are kinda subjective and there's only so much i can do to accommodate everyone's tastes.

FWIW I agree with this. My comment about darker-vs-lighter for focus is, I think, about a functional issue. I'm not fussing about specific color choices.

Overall, some major improvements in these PRs!

A bit of a rush now but I'll try the new commits later this afternoon.

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.

6 participants