Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 525836 - Highlighting of days in CDateTime is broken
Summary: Highlighting of days in CDateTime is broken
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Nebula (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Glenn Burkhardt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-10 15:18 EDT by Glenn Burkhardt CLA
Modified: 2021-07-05 11:40 EDT (History)
3 users (show)

See Also:


Attachments
New selection background (21.95 KB, image/gif)
2017-11-19 13:30 EST, Wim Jongman CLA
no flags Details
Calendar showing two different button styles (15.06 KB, image/png)
2017-11-20 10:54 EST, Glenn Burkhardt CLA
no flags Details
different renderings for CDateTime buttons (10.63 KB, image/png)
2017-11-27 19:22 EST, Glenn Burkhardt CLA
no flags Details
Mark I button rendering mimicing Win7 theme (3.36 KB, application/octet-stream)
2017-11-27 19:23 EST, Glenn Burkhardt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Glenn Burkhardt CLA 2017-10-10 15:18:14 EDT
The changes for https://bugs.eclipse.org/bugs/show_bug.cgi?id=512215 have removed the highlighting of the days in the CDateTime widget.  When clicking on a day button, it should become highlighted to show that it's been "selected".  And, of course, when the CDateTime date picker is first shown, the current date should be displayed as "selected", or highlighted.

The change was made with the comment that the use of 'theme' only worked on Windows and GTK versions.  Well, that's rather large segment.  

I think a better fix would be to include code that works with current SWT releases, and put a more permanent fix on a "to do" list.
Comment 1 Wim Jongman CLA 2017-10-10 16:17:30 EDT
We will not resurrect the code that SWT has dropped. The path forward is to remove our dependency on that code. 

Are you able to work on this Glenn?
Comment 2 Eclipse Genie CLA 2017-10-10 16:52:52 EDT
New Gerrit change created: https://git.eclipse.org/r/106539
Comment 3 Vladimir Borkovkin CLA 2017-10-11 07:54:53 EDT
We can't bild project which use org.eclipse.nebula.cwt under Eclipse 4.7.
Are there any workarounds?
Comment 4 Wim Jongman CLA 2017-10-11 12:23:56 EDT
(In reply to Vladimir Borkovkin from comment #3)
> We can't bild project which use org.eclipse.nebula.cwt under Eclipse 4.7.
> Are there any workarounds?

Is this related to this bug?
Comment 5 Glenn Burkhardt CLA 2017-10-11 12:31:14 EDT
Vladimir Borkovkin - you can pick up the changes I propose from the Gerrit review posted 2017-10-10 16:52:52 EDT.  But it is unofficial at this point in time.  It works with Eclipse 4.7, and we are using it in production.

I believe that the 1.3.0 release of Nebula does not depend on org.eclipse.swt.internal or org.eclipse.swt.internal.win32.  It should work with Eclipse 4.7, but there are limitations.
Comment 6 Glenn Burkhardt CLA 2017-10-11 12:37:27 EDT
(In reply to Glenn Burkhardt from comment #5)
> Vladimir Borkovkin - you can pick up the changes I propose from the Gerrit
> review posted 2017-10-10 16:52:52 EDT.  But it is unofficial at this point
> in time.  It works with Eclipse 4.7, and we are using it in production.
> 
> I believe that the 1.3.0 release of Nebula does not depend on
> org.eclipse.swt.internal or org.eclipse.swt.internal.win32.  It should work
> with Eclipse 4.7, but there are limitations.

Also those patches only work on Windows.  Changes will be required to work on other platforms.
Comment 7 Glenn Burkhardt CLA 2017-10-11 12:38:15 EDT
(In reply to Wim Jongman from comment #1)
> We will not resurrect the code that SWT has dropped. The path forward is to
> remove our dependency on that code. 
> 
> Are you able to work on this Glenn?

Possibly, but not this week.
Comment 8 Glenn Burkhardt CLA 2017-10-11 12:40:26 EDT
(In reply to Vladimir Borkovkin from comment #3)
> We can't bild project which use org.eclipse.nebula.cwt under Eclipse 4.7.
> Are there any workarounds?

You should be able to build if you pull the 1.3.0 release.  But some things will not work.
Comment 9 Vladimir Borkovkin CLA 2017-10-11 16:15:47 EDT
1.3.0 release still has imports from org.eclipse.swt.internal.theme and project can't be compiled under eclipse 4.7/4.7.1.
Strange things happens, there are handerts of tests, but obvious bugs stays for months.
Comment 10 Wim Jongman CLA 2017-10-11 17:20:43 EDT
(In reply to Vladimir Borkovkin from comment #9)
> 1.3.0 release still has imports from org.eclipse.swt.internal.theme and
> project can't be compiled under eclipse 4.7/4.7.1.
> Strange things happens, there are handerts of tests, but obvious bugs stays
> for months.

We are compiling fine against 4.7.1. Make sure that you have 1.3.0 installed. See this commit [1]

In case you run into this bug [2] make sure you get the latest snapshot.

[1] http://git.eclipse.org/c/nebula/org.eclipse.nebula.git/diff/widgets/cwt/org.eclipse.nebula.cwt/META-INF/MANIFEST.MF?id=125e7af7b11e32cf10569c3e56c082e5e2111caf

[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=525717
Comment 11 Glenn Burkhardt CLA 2017-10-11 17:40:19 EDT
(In reply to Vladimir Borkovkin from comment #9)
> 1.3.0 release still has imports from org.eclipse.swt.internal.theme and
> project can't be compiled under eclipse 4.7/4.7.1.
> Strange things happens, there are handerts of tests, but obvious bugs stays
> for months.

Please identify the files from 1.3.0 that don't compile correctly.
Comment 12 Eclipse Genie CLA 2017-11-19 13:27:34 EST
New Gerrit change created: https://git.eclipse.org/r/111866
Comment 13 Wim Jongman CLA 2017-11-19 13:30:55 EST
Created attachment 271549 [details]
New selection background
Comment 15 Wim Jongman CLA 2017-11-19 14:13:07 EST
I think this is fixed, Glenn. Please take a look and reopen if you still find problems.
Comment 16 Glenn Burkhardt CLA 2017-11-20 10:54:57 EST
Created attachment 271559 [details]
Calendar showing two different button styles
Comment 17 Glenn Burkhardt CLA 2017-11-20 11:01:27 EST
Thanks for the nudge.  I should have tried working on this, and I should get some time over our holiday this week.

As I noted in the review, the background change you made is an improvement, but doesn't look nearly as nice as it did before.  Please see the attachment.

The '16' is displayed using the button style for 'SELECTED'.  The '25' is displayed using the button style for 'ACTIVE'.  The button is colored 'ACTIVE' as the mouse moves over the calendar.  The 'ACTIVE' button is not quite as dark as the 'SELECTED' button, and button boundary is outlined, with the corners rounded.  The focus rectangle drawn on my Win7 system has dotted lines for the right and bottom sides only.

Also, somehow the shaded background you added isn't centered over the text.  My guess is that the text isn't centered in the control.  But changing that could be tricky, since currently all the text aligns correctly under the day headings for the columns.
Comment 18 Wim Jongman CLA 2017-11-20 14:31:46 EST
(In reply to Glenn Burkhardt from comment #17)
> Thanks for the nudge.  I should have tried working on this, and I should get
> some time over our holiday this week.
> 
> As I noted in the review, the background change you made is an improvement,
> but doesn't look nearly as nice as it did before.  Please see the attachment.

I agree. I will reopen this so that we can make it better.
Comment 19 Eclipse Genie CLA 2017-11-21 17:40:01 EST
New Gerrit change created: https://git.eclipse.org/r/112026
Comment 20 Wim Jongman CLA 2017-11-22 04:09:44 EST
(In reply to Eclipse Genie from comment #19)
> New Gerrit change created: https://git.eclipse.org/r/112026

Glenn, I will probably abandon this change because there are too many collateral changes but you can take a look at it. It follows your suggestion. Basically we have to get rid of the theming thing and draw the backgrounds ourselves. I have made some changes already and it looks very doable.

The changes start at line 25 of VButtonPainter where I have negated the paintnative check to enter the code block:

 		if(!button.paintNative) {
			if(!button.paintInactive

And then creating a paintBackGround method that will do the magic. For now, I have made some test code that we can extend. Please take a look.
Comment 22 Wim Jongman CLA 2017-11-23 15:21:19 EST
(In reply to Eclipse Genie from comment #21)
> Gerrit change https://git.eclipse.org/r/112026 was merged to [master].
> Commit:
> http://git.eclipse.org/c/nebula/org.eclipse.nebula.git/commit/
> ?id=87659b01a2f2fe1aa5126d6868fbc7f17d8b75cc

Glenn, I have released this basic code. It will be easier for you to start working from head.
Comment 23 Glenn Burkhardt CLA 2017-11-27 19:22:52 EST
Created attachment 271660 [details]
different renderings for CDateTime buttons
Comment 24 Glenn Burkhardt CLA 2017-11-27 19:23:41 EST
Created attachment 271661 [details]
Mark I button rendering mimicing Win7 theme
Comment 25 Glenn Burkhardt CLA 2017-11-27 19:29:32 EST
I spent some time coming up with revised backgrounds for the buttons in SELECTED and ACTIVE states.  I managed to get one with a gradient that matched what came up on Win7, but then noticed that Win10 has a different theme that's a lot easier to mimic.  So I'd like to seek your advice on how to proceed.  In the attachment "different renderings for CDateTime buttons", the first example of SELECTED and ACTIVE is what it used to look like on Win7.  That example is smaller than the others because of the screen resolution on the system I made the screen shot from.   The second one is what I came up with (and is generated by the attached "Mark I button rendering mimicing Win7 theme").  The third is what I committed this evening that pretty much matches the Win10 Theme based code (https://git.eclipse.org/r/#/c/112302/).

I'm happy to leave it using the Win10 look alike going forward.  It matches the rest of the CDateTime rendering pretty well, and it's more like to work on other platforms (like Linux, which I haven't tried).

I also noticed that the business about VButton.FOCUSED was never used anywhere, and that the mapping of VControl STATE_xxxx onto VButton.HOT, etc., was only to use the SWT internal Theme paint code.  So it has been stripped out.  All the VButton states (VButton.HOT, etc.) are not referenced anywhere and can be removed as part of the removal of Theme...

So what do you think?  CDTSnippet02 is a good one to use for testing and making changes.
Comment 26 Wim Jongman CLA 2017-11-28 03:38:45 EST
(In reply to Glenn Burkhardt from comment #25)
 
> So what do you think?  CDTSnippet02 is a good one to use for testing and
> making changes.

Looks great Glenn. Thank you for the patch. I have updated it a little bit for housekeeping. Can you take a look at it?

https://git.eclipse.org/r/112303
Comment 27 Glenn Burkhardt CLA 2017-11-28 08:48:56 EST
That's quite a bit of cleanup.  It all looks OK.  Thanks.
Comment 30 Wim Jongman CLA 2017-11-30 05:06:00 EST
Assigned to you Glenn. Thanks a lot! Please set the status to Resolved/Fixed and to Verified/Fixed once verified.

https://wiki.eclipse.org/Nebula/Releases/1.5.0/NaN#CDateTime