Bug 495033 - Update minimized and maximized icons in CTabFolderRenderer
Summary: Update minimized and maximized icons in CTabFolderRenderer
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.22 M2   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 576700 430166 466511
  Show dependency tree
 
Reported: 2016-05-31 10:05 EDT by Lars Vogel CLA
Modified: 2021-10-18 09:42 EDT (History)
14 users (show)

See Also:


Attachments
Screenshots of the maximize, minimize and restore (244.35 KB, application/zip)
2016-09-14 03:57 EDT, Matthias Becker CLA
no flags Details
Screenshot Linux before / after (512.91 KB, image/png)
2021-10-18 06:47 EDT, Lars Vogel CLA
no flags Details
Screenshot light Linux before / after (288.75 KB, image/png)
2021-10-18 06:50 EDT, Lars Vogel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2016-05-31 10:05:01 EDT
I suggest to use png files instead of the custom drawings in CTabFolderRenderer for the minimize and maximize icons. IMHO the icons looks strange in Eclipse especially if you scale the icons up. 

Currently the calculation is done in drawMaximize and drawMinimize.
Comment 1 Lars Vogel CLA 2016-09-13 10:00:26 EDT
Relevant methods:

CTabFolderRenderer#drawMinimize and CTabFolderRenderer#drawMaximize. Both methods provide three icons, one for the normal state, one for the hot (mouse over) state and a selected state.
Comment 2 Lars Vogel CLA 2016-09-13 12:01:58 EDT
Looks like we need only one icon for maximize, re-maximize and minimized. At least in my testing the SWT.HOT code path is not used.

Test code:

void drawMaximize(GC gc, Rectangle maxRect, int maxImageState) {
....

switch (maxImageState & (SWT.HOT | SWT.SELECTED)) {
	case SWT.NONE:
           if (!parent.getMaximized()) {
	    // testing
           Image systemImage = new Image(Display.getDefault(), "D:/dev/icons/full/elcl16/tempmaximized.png");
	    gc.drawImage(systemImage, x, y);
	    systemImage.dispose();
	} else {
	// testing
	Image systemImage = new Image(Display.getDefault(), "D:/dev/icons/full/elcl16/temprestore.png");
	gc.drawImage(systemImage, x, y);
	systemImage.dispose();
	}
	break;
}
Comment 3 Matthias Becker CLA 2016-09-14 02:43:23 EDT
But aren't the colors for fill an lines that are set via:

		gc.setForeground(display.getSystemColor(BUTTON_BORDER));
		gc.setBackground(display.getSystemColor(BUTTON_FILL));

platform dependent? Don't they change automatically from platform to platform? We cannot do this as PNGs.

I set some breakpoints but only reach the "case SWT.NONE" branch.
How can the other be reached?
Comment 4 Lars Vogel CLA 2016-09-14 03:16:04 EDT
(In reply to Matthias Becker from comment #3)
> But aren't the colors for fill an lines that are set via:

> platform dependent? Don't they change automatically from platform to
> platform? We cannot do this as PNGs.

I think that is a "feature loss", if we switch to png files, but the "feature gain" is that the button will better on HDPI and dark background. Also on Mac the drawing looks really bad IMHO and this will improve with png files.
 
> I set some breakpoints but only reach the "case SWT.NONE" branch.
> How can the other be reached?

I also was not able to reach that part of the coding. I did send a question about SWT.HOT to the swt mailing list for that. http://dev.eclipse.org/mhonarc/lists/platform-swt-dev/msg08016.html
Comment 5 Matthias Becker CLA 2016-09-14 03:47:11 EDT
in which repo can I find the source code of CTabFolderRenderer?
eclipse.platform.swt.binaries only contains the binaries
Comment 6 Lars Vogel CLA 2016-09-14 03:56:16 EDT
(In reply to Matthias Becker from comment #5)
> in which repo can I find the source code of CTabFolderRenderer?
> eclipse.platform.swt.binaries only contains the binaries

https://git.eclipse.org/r/#/admin/projects/platform/eclipse.platform.swt
Comment 7 Matthias Becker CLA 2016-09-14 03:57:02 EDT
Created attachment 264143 [details]
Screenshots of the maximize, minimize and restore

I was a bit confused about the SWT-Coordinate system especially about the fact that the end points are included in lines.

( Found "The end points are included in the line, and if they are the same then a single pixel dot will be drawn." on https://www.eclipse.org/articles/Article-SWT-graphics/SWT_graphics.html )

So I hope it counted the pixels in the right way. The attachment shows a screenshot of out of Inkscape where you see the SVG with a light gray background (so see the white fill of the shapes) and the 1x1 pixels document grid.

Do the look right?
Comment 8 Sravan Kumar Lakkimsetti CLA 2016-10-19 05:23:41 EDT
Retargetting to 4.7
Comment 9 Lars Vogel CLA 2017-03-29 05:15:05 EDT
(In reply to Matthias Becker from comment #5)
> in which repo can I find the source code of CTabFolderRenderer?
> eclipse.platform.swt.binaries only contains the binaries

See https://git.eclipse.org/r/#/admin/projects/platform/eclipse.platform.swt
Comment 10 Dani Megert CLA 2017-03-29 13:04:45 EDT
(In reply to Lars Vogel from comment #9)
> (In reply to Matthias Becker from comment #5)
> > in which repo can I find the source code of CTabFolderRenderer?
> > eclipse.platform.swt.binaries only contains the binaries
> 
> See https://git.eclipse.org/r/#/admin/projects/platform/eclipse.platform.swt

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/plain/bundles/org.eclipse.swt/Eclipse%20SWT%20Custom%20Widgets/common/org/eclipse/swt/custom/CTabFolderRenderer.java
Comment 11 Lakshmi P Shanmugam CLA 2017-05-03 04:53:35 EDT
This would require changes in CTabFolder code as well. Moving to 4.8.
Comment 12 Eclipse Genie CLA 2018-03-28 10:32:56 EDT
New Gerrit change created: https://git.eclipse.org/r/120357
Comment 13 Lars Vogel CLA 2018-03-29 06:48:45 EDT
Matthias, can you upload a change for SWT so that I can test this?
Comment 14 Matthias Becker CLA 2018-03-29 07:01:53 EDT
(In reply to Lars Vogel from comment #13)
> Matthias, can you upload a change for SWT so that I can test this?

Up to now I only have the SVGs and PNGs.
We should first decide if we go for the black lines with the white fill or not.
Comment 15 Niraj Modi CLA 2018-05-08 03:15:38 EDT
Moving out of M7, please re-target this bug as required.
Comment 16 Niraj Modi CLA 2018-05-14 05:56:46 EDT
Moving to 4.9, please re-target as required.
Comment 17 Matthias Becker CLA 2018-05-15 08:43:09 EDT
I just updated the SVGs and PNGs with the colors we aggreed on in bug 466511.
As I don't have a SWT dev environment at hand: Can someone of the SWT dev replace the custom drawings in CTabFolderRenderer#drawMinimize and CTabFolderRenderer#drawMaximize with the provided PNGs?
Comment 18 Lakshmi P Shanmugam CLA 2018-09-06 01:32:07 EDT
Resetting target. Please re-target as required.
Comment 19 Lars Vogel CLA 2018-09-11 16:31:43 EDT
(In reply to Matthias Becker from comment #17)
> I just updated the SVGs and PNGs with the colors we aggreed on in bug 466511.
> As I don't have a SWT dev environment at hand: Can someone of the SWT dev
> replace the custom drawings in CTabFolderRenderer#drawMinimize and
> CTabFolderRenderer#drawMaximize with the provided PNGs?

Lets do this together while I'm Walldorf.
Comment 20 Lakshmi P Shanmugam CLA 2018-11-20 01:03:18 EST
Is it still in plan for 4.10? If not please re-target as required.
Comment 21 Alexander Kurtakov CLA 2018-11-23 06:12:09 EST
Remove the target as M3 is done. Please set target when planning to merge it.
Comment 22 Lars Vogel CLA 2019-06-24 04:30:15 EDT
As we now use png files for the view menu, I suggest we finish this one too.
Comment 23 Lars Vogel CLA 2020-11-04 08:05:49 EST
Thomas, are you aware of good unicode characters to replace min / max? Similar to the close icon it would be nice if we could replace the custom drawings.
Comment 24 Mickael Istria CLA 2020-11-04 08:10:25 EST
(In reply to Lars Vogel from comment #23)
> Thomas, are you aware of good unicode characters to replace min / max?
> Similar to the close icon it would be nice if we could replace the custom
> drawings.

From emojipedia: 🗖 and 🗕, which are very "raw" but maybe good enough.
Comment 25 Lars Vogel CLA 2020-11-04 08:29:24 EST
(In reply to Mickael Istria from comment #24)
> (In reply to Lars Vogel from comment #23)
> > Thomas, are you aware of good unicode characters to replace min / max?
> > Similar to the close icon it would be nice if we could replace the custom
> > drawings.
> 
> From emojipedia: 🗖 and 🗕, which are very "raw" but maybe good enough.

The above icons look the same to me on latest Ubuntu.
Comment 26 Thomas Wolf CLA 2020-11-04 10:28:08 EST
(In reply to Lars Vogel from comment #23)
> Thomas, are you aware of good unicode characters to replace min / max?

Not really. Maybe ⊡ (\u22a1) and ⊟ (\u229f) for "minimize" and "maximize", but that doesn't really convey the idea. Or ⊹ (\u22b9) for "miminize". There's also ▫(\u25ab) and ◻ (\u25fb) and ◰ (\u25f0) and ◳ (\u25f3).

On an unrelated note, there's also ⋮ (\u22ee) or ⁝ (\u205d). How's the view menu "hamburger" done?

Not sure all fonts have all these. 20xx is Unicode "General Punctuation", 22xx is "Mathematical Operators", 25ax and 25fx are "Geometric Shapes".
Comment 27 Lars Vogel CLA 2020-11-04 11:24:31 EST
Thanks, Thomas.

> How's the view menu "hamburger" done?

Current the view menu is an icon. Would be nice to replace that with unicode.
Comment 28 Thomas Wolf CLA 2020-11-04 14:38:52 EST
(In reply to Lars Vogel from comment #27)
> Thanks, Thomas.
> 
> > How's the view menu "hamburger" done?
> 
> Current the view menu is an icon. Would be nice to replace that with unicode.

If Unicode, there's also ▿ (\u25bf). I liked the old triangle better than the three dots.
Comment 29 Eclipse Genie CLA 2020-11-05 03:39:33 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/171799
Comment 30 Lars Vogel CLA 2020-11-05 03:41:46 EST
(In reply to Thomas Wolf from comment #26)
> (In reply to Lars Vogel from comment #23)
> > Thomas, are you aware of good unicode characters to replace min / max?
> 
> Not really. Maybe ⊡ (\u22a1) and ⊟ (\u229f) for "minimize" and "maximize",
> but that doesn't really convey the idea. Or ⊹ (\u22b9) for "miminize".
> There's also ▫(\u25ab) and ◻ (\u25fb) and ◰ (\u25f0) and ◳ (\u25f3).
> 
> On an unrelated note, there's also ⋮ (\u22ee) or ⁝ (\u205d). How's the view
> menu "hamburger" done?
> 
> Not sure all fonts have all these. 20xx is Unicode "General Punctuation",
> 22xx is "Mathematical Operators", 25ax and 25fx are "Geometric Shapes".

Hi Thomas, thanks again. I created https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/171799 to make it easier for others to play with the potential unicode characters. Issue, currently the icons are really "fat" due to the font size. But if I decrease the font size the icons get really small. Suggestion how to improve this are very welcome.
Comment 31 Andrey Loskutov CLA 2020-11-05 03:55:37 EST
(In reply to Lars Vogel from comment #30)
> Hi Thomas, thanks again. I created
> https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/171799 to make
> it easier for others to play with the potential unicode characters. Issue,
> currently the icons are really "fat" due to the font size. But if I decrease
> the font size the icons get really small. Suggestion how to improve this are
> very welcome.

I've commented on the patch, but here again - I have concerns regarding such change.

This is not cross-platform. "Arial" is not something we can hard-code here and expect that it will be available on all platforms.

*If* SWT would embed some font that has the right characters, it could be OK. But without it, every installation of Eclipse would look different and we couldn't be even sure we would have the right characters available and if, with which font characteristics.
Comment 32 Thomas Wolf CLA 2020-11-05 04:03:08 EST
(In reply to Lars Vogel from comment #30) 
> Hi Thomas, thanks again. I created
> https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/171799 to make
> it easier for others to play with the potential unicode characters. Issue,
> currently the icons are really "fat" due to the font size. But if I decrease
> the font size the icons get really small. Suggestion how to improve this are
> very welcome.

I'm not convinced using fonts like this is a good way to go. You'd always depend on how exactly a particular glyph is defined in a standard font (like the "Arial" you used), and on the font and the glyph in the font being present at all.

I'd rather investigate using SVG icons directly, or if it's got to be a font, use a dedicated icon font. Check out how "icon fonts" work in HTML 5. Basically you could define your own font containing the glyphs you want, at the character codes you want. There's tools out there that can create such fonts for a set of SVG icons. Don't know if gc.drawString() can work directly with such web fonts, or if they'd have to be converted into something else first -- if so, it should also be possible, as long as it's all vector formats.
Comment 33 Thomas Wolf CLA 2020-11-05 04:04:22 EST
(In reply to Andrey Loskutov from comment #31)
> *If* SWT would embed some font that has the right characters, it could be
> OK. But without it, every installation of Eclipse would look different and
> we couldn't be even sure we would have the right characters available and
> if, with which font characteristics.

Exactly. We both made the same point.
Comment 34 Mickael Istria CLA 2020-11-05 04:04:35 EST
(In reply to Andrey Loskutov from comment #31)
> But without it, every installation of Eclipse would look different and
> we couldn't be even sure we would have the right characters available and
> if, with which font characteristics.

The fact that the IDE looks different according to the system is the expectation with SWT. It's not something we need to fight against, we instead it to navigate it smoothly to get better results than other IDEs can achieve.
The suggested characters are using Unicode. Isn't it safe to assume that the fonts used by the Eclipse IDE, the OS by default are expected to be Unicode-compliant and just drop the ball to the OS if something is wrong?


(In reply to Lars Vogel from comment #25)
> > From emojipedia: 🗖 and 🗕, which are very "raw" but maybe good enough.
> 
> The above icons look the same to me on latest Ubuntu.

Really? I suggest reporting a bug to Ubuntu then.
Comment 35 Lars Vogel CLA 2020-11-05 04:10:58 EST
As the font is only required to define the sizing, it should be save to use the parent font. I update the patch.
Comment 36 Christoph Laeubrich CLA 2020-11-05 05:01:35 EST
(In reply to Lars Vogel from comment #4)
> I think that is a "feature loss", if we switch to png files, but the
> "feature gain" is that the button will better on HDPI and dark background.
> Also on Mac the drawing looks really bad IMHO and this will improve with png
> files.

I really wonder why the "custom drawing" should look bad compared to a PNG file?
It should scale to every size, use platform.dependent colors, varying line-with  and so on, so it should be superior to any rastered image anyways.
Maybe its more HOW it is drawn that makes it look ugly (e.g. not using Antialising, missing shaddoweffects, not using transforms/line properties where necessary and so on...?)
Comment 37 Lars Vogel CLA 2021-08-18 10:50:18 EDT
Now that we draw a nicer close icon we should also try to draw a nicer min and max icon.
Comment 38 Phil Beauvoir CLA 2021-08-18 15:58:47 EDT
(In reply to Lars Vogel from comment #37)
> Now that we draw a nicer close icon we should also try to draw a nicer min
> and max icon.

What's wrong with the existing ones? And have you thought about how these types of changes affect downstream RCP apps?
Comment 39 Lars Vogel CLA 2021-08-20 08:16:35 EDT
(In reply to Phil Beauvoir from comment #38)
> (In reply to Lars Vogel from comment #37)
> > Now that we draw a nicer close icon we should also try to draw a nicer min
> > and max icon.
> 
> What's wrong with the existing ones? And have you thought about how these
> types of changes affect downstream RCP apps?

I think the min / max icons in general look fine, but the drawn background does IMHO not look good on light and dark background. 

Multiple RCP clients I support complained in the past about the tab icons (mostly about the close icon), one of them implemented a custom tab renderer to be able to use updated icons.
Comment 40 Phil Beauvoir CLA 2021-08-20 08:19:45 EDT
(In reply to Lars Vogel from comment #39)
> (In reply to Phil Beauvoir from comment #38)
> > (In reply to Lars Vogel from comment #37)
> > > Now that we draw a nicer close icon we should also try to draw a nicer min
> > > and max icon.
> > 
> > What's wrong with the existing ones? And have you thought about how these
> > types of changes affect downstream RCP apps?
> 
> I think the min / max icons in general look fine, but the drawn background
> does IMHO not look good on light and dark background. 
> 
> Multiple RCP clients I support complained in the past about the tab icons
> (mostly about the close icon), one of them implemented a custom tab renderer
> to be able to use updated icons.

Fair comments, Lars.

I mention the RCP aspect because some of our app (Archi) users have complained when something changes in this regard. ;-)
Comment 41 Lars Vogel CLA 2021-08-20 08:28:05 EDT
(In reply to Phil Beauvoir from comment #40)

> I mention the RCP aspect because some of our app (Archi) users have
> complained when something changes in this regard. ;-)

I don't understand this. How can they complain about something we have not yet done? Or do you already know from past experience that your users dislike any UI change?
Comment 42 Phil Beauvoir CLA 2021-08-20 08:31:55 EDT
(In reply to Lars Vogel from comment #41)
> (In reply to Phil Beauvoir from comment #40)
> 
> > I mention the RCP aspect because some of our app (Archi) users have
> > complained when something changes in this regard. ;-)
> 
> I don't understand this. How can they complain about something we have not
> yet done? Or do you already know from past experience that your users
> dislike any UI change?

I didn't mean this particular change. I mean generally things they have no control over such as the local context menu icon changing to three vertical dots from a triangle.
Comment 43 Mickael Istria CLA 2021-08-20 09:49:09 EDT
(In reply to Phil Beauvoir from comment #42)
> I didn't mean this particular change. I mean generally things they have no
> control over such as the local context menu icon changing to three vertical
> dots from a triangle.

There are some discussions here and there about themable icons that would allow RCP providers to ship a static set of icons that doesn't depend on Platform. Bug 562174 is probably the most advanced one. This is the direction you should investigate for such users, if you think their complaints are worth addressing.
Comment 44 Eclipse Genie CLA 2021-08-27 05:09:13 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/184518
Comment 45 Lars Vogel CLA 2021-10-18 06:47:48 EDT
Created attachment 287329 [details]
Screenshot Linux before / after
Comment 46 Lars Vogel CLA 2021-10-18 06:50:24 EDT
Created attachment 287330 [details]
Screenshot light Linux before / after
Comment 47 Andrey Loskutov CLA 2021-10-18 09:19:04 EDT
(In reply to Lars Vogel from comment #46)
> Created attachment 287330 [details]
> Screenshot light Linux before / after

There is now an inconsistency with "three dots" button (icon with circles filled with white) and the updated min/max "not filled with white" buttons.
Shouldn't this "three dots" be drawn now in same way other two are drawn?
Comment 48 Lars Vogel CLA 2021-10-18 09:31:18 EDT
(In reply to Andrey Loskutov from comment #47)
> (In reply to Lars Vogel from comment #46)
> > Created attachment 287330 [details]
> > Screenshot light Linux before / after
> 
> There is now an inconsistency with "three dots" button (icon with circles
> filled with white) and the updated min/max "not filled with white" buttons.
> Shouldn't this "three dots" be drawn now in same way other two are drawn?

That is an png file. Please open a new bug for that.
Comment 49 Andrey Loskutov CLA 2021-10-18 09:33:51 EDT
(In reply to Lars Vogel from comment #48)
> > There is now an inconsistency with "three dots" button (icon with circles
> > filled with white) and the updated min/max "not filled with white" buttons.
> > Shouldn't this "three dots" be drawn now in same way other two are drawn?
> 
> That is an png file. Please open a new bug for that.

Why should I? I'm fine with *current* state. 

But if we are going to change two from three similar looking icons, we should make sure all three are changed in a consistent way. So that belongs to this issue.
Comment 50 Lars Vogel CLA 2021-10-18 09:39:00 EDT
(In reply to Andrey Loskutov from comment #49)

> So that belongs
> to this issue.

The png file is in a different repo. I opened Bug 576700 for updating the png file in platform.ui.