Page 2 of 3

Re: Shade windows in OpenTTD

Posted: 13 Jun 2009 14:58
by Terkhen
I must say that I share belugas and Chillcore's opinion about your work: it is incredible.

I have attached a win32 build of the Shade windows patch with middle button functionality included. It already includes the required grf file.

(Removed)

Re: Shade windows in OpenTTD

Posted: 16 Jun 2009 22:02
by xZise
Alberth wrote:It 'works' or it 'compiles' ?

The latter I believe. The former I don't believe.

(Hint: Try shading the town directory window)
It compiles and works mostly :) Only in the town directory I got problems. But the code there is much different to the version from erikjanp. Possible his/her (?) update to r16571 works "better".
[edit]Okay now everything works perfectly![/edit]

Sincerely
xZise

Re: Shade windows in OpenTTD

Posted: 23 Jun 2009 08:47
by adf88
I have a suggestion.
For now all shade windows must have modified OnPaint. It can be eliminated.
Only need to modify DrawOverlappedWindow function (winow.cpp). When window is shaded just call DrawWidgets instead of calling OnPaint.
Some windows need to set some string params before drawing titlebar. For them you may create a special event i.e. "OnShadePaint".
This solution require less modifications in existing gui files and also is easier to use, simpler.

Re: Shade windows in OpenTTD

Posted: 19 Jul 2009 20:30
by erikjanp
Update r16883: update to windowdefs and code-patches.
- Updated to svn-r16883.
- No other changes, not even to coding style.

Re: Shade windows in OpenTTD

Posted: 22 Jul 2009 04:03
by DaleStan
Thanks. I just went and burgled this idea wholesale and shoveled it in TTDPatch. (Except for the new button.)

I don't know if your shading is animated, but I'm rather tempted to animate mine, just for the fun of it.

Re: Shade windows in OpenTTD

Posted: 22 Jul 2009 15:57
by Roujin
DaleStan wrote:Thanks. I just went and burgled this idea wholesale and shoveled it in TTDPatch. (Except for the new button.)

I don't know if your shading is animated, but I'm rather tempted to animate mine, just for the fun of it.
How is it triggered then, by Ctrl-Clicking the title bar?

Re: Shade windows in OpenTTD

Posted: 22 Jul 2009 16:21
by planetmaker
Usual behaviour I'd expect on a title bar when double clicked is to activate / de-activate shading.

Re: Shade windows in OpenTTD

Posted: 22 Jul 2009 16:54
by DaleStan
Roujin wrote:How is it triggered then, by Ctrl-Clicking the title bar?
Middle click. Adding YA button to the title bar would be possible, but not exactly easy.
planetmaker wrote:Usual behaviour I'd expect on a title bar when double clicked is to activate / de-activate shading.
I'd expect that to maximize/restore the window.

Re: Shade windows in OpenTTD

Posted: 24 Jul 2009 18:43
by erikjanp
In my patch, using the scroll wheel on the window caption/title bar also shades/unshades the window.

Update r16943: update to windowdefs and code-patches.
- Updated to svn-r16943
- Fixed coding style
- Removed hardcoded values for the size of the shadebox

Re: Shade windows in OpenTTD

Posted: 24 Jul 2009 23:17
by xZise
Hey guys...

Could it be that your patch (I love it btw) has some "great" features for the townlist?

Sincerely
xZise

Re: Shade windows in OpenTTD

Posted: 25 Jul 2009 10:03
by erikjanp
Hmm that's a big resize button.

I don't know, I've tested here with a clean checkout and it works OK.

Do you have any other patches applied? Is your checked out revision correct? Should be r16943. There are a lot of changes is the widget code, so a different revision could give strange results.

Re: Shade windows in OpenTTD

Posted: 25 Jul 2009 13:18
by xZise
I make a new checkout only for this patch and applied it (only the winodow-def and the maincode).

It is compiled with R 16945.

Sincerely
xZise

Re: Shade windows in OpenTTD

Posted: 26 Jul 2009 22:20
by xZise
False alarm :D

I compiled the nightly R16966 WITHOUT the patch, and there is the same bug :P

Sincerely
xZise

Re: Shade windows in OpenTTD

Posted: 06 Sep 2009 20:49
by erikjanp
Update r17434: update to windowdefs and code-patches.
- Updated to svn-17434. Recently, a lot of changes were done in trunk to the window and widget code, so I hope I got all the changes correctly and didn't leave any old stuff.

By the way, I'm working on a new version of this patch. It will be a more sophisticated version: not simply cutting everything below pixel y=14, but defining for each widget to which shade level it belongs. Shading a window then can be done in steps: big window -> smaller window -> shaded window. Expect a beta version soon. :roll:

Re: Shade windows in OpenTTD

Posted: 09 Sep 2009 09:58
by 2007Alain2007
will this be able to work with patchs like new GRF GUI

Re: Shade windows in OpenTTD

Posted: 09 Sep 2009 16:29
by erikjanp
Yes, why not? But you have to add a few things in the window and widget definitions, and maybe in the widget drawing code of the window. See the windowdefs-patch for a lot of examples.

Re: Shade windows in OpenTTD

Posted: 09 Sep 2009 22:13
by erikjanp
New version!
Here is a new (beta) version of this patch. It is a more sophisticated version: not simply cutting everything below pixel y=14, but defining for each widget to which shade level it belongs. Shading a window then can be done in steps: big window -> smaller window -> shaded window.

Note: it is still beta! Especially in all the gui.cpp's there is still a lot of cleaning up to do.
The most important changes are in window.cpp and widget.cpp; all functional window shading code is found there.
For an (useless) example of a window with more than two shade levels: check out the news history window.
For more information: see docs/shadelevel.txt

The patch can be found in the second post in this thread.

Re: Shade windows in OpenTTD

Posted: 21 Dec 2009 19:54
by Timmaexx
Congrats! :))
This Patch made it into trunk :!:
It's in current nightly: r18594

Re: Shade windows in OpenTTD

Posted: 21 Dec 2009 20:00
by petert
Interesting, it was include r18588.

Re: Shade windows in OpenTTD

Posted: 21 Dec 2009 20:42
by petert