Shade windows in OpenTTD

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Shade windows in OpenTTD

Post 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)
Last edited by Terkhen on 20 Jul 2009 15:04, edited 1 time in total.
xZise
Engineer
Engineer
Posts: 57
Joined: 19 Mar 2009 16:52
Location: Bad Schwartau

Re: Shade windows in OpenTTD

Post 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
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Shade windows in OpenTTD

Post 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.
:] don't worry, be happy and checkout my patches
erikjanp
Engineer
Engineer
Posts: 16
Joined: 29 Aug 2008 22:30

Re: Shade windows in OpenTTD

Post by erikjanp »

Update r16883: update to windowdefs and code-patches.
- Updated to svn-r16883.
- No other changes, not even to coding style.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Shade windows in OpenTTD

Post 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.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Shade windows in OpenTTD

Post 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?
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Shade windows in OpenTTD

Post by planetmaker »

Usual behaviour I'd expect on a title bar when double clicked is to activate / de-activate shading.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Shade windows in OpenTTD

Post 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.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
erikjanp
Engineer
Engineer
Posts: 16
Joined: 29 Aug 2008 22:30

Re: Shade windows in OpenTTD

Post 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
xZise
Engineer
Engineer
Posts: 57
Joined: 19 Mar 2009 16:52
Location: Bad Schwartau

Re: Shade windows in OpenTTD

Post by xZise »

Hey guys...

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

Sincerely
xZise
Attachments
Townlist featured by shade-patch
Townlist featured by shade-patch
twon_wnd.png (3.26 KiB) Viewed 3566 times
erikjanp
Engineer
Engineer
Posts: 16
Joined: 29 Aug 2008 22:30

Re: Shade windows in OpenTTD

Post 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.
xZise
Engineer
Engineer
Posts: 57
Joined: 19 Mar 2009 16:52
Location: Bad Schwartau

Re: Shade windows in OpenTTD

Post 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
xZise
Engineer
Engineer
Posts: 57
Joined: 19 Mar 2009 16:52
Location: Bad Schwartau

Re: Shade windows in OpenTTD

Post by xZise »

False alarm :D

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

Sincerely
xZise
erikjanp
Engineer
Engineer
Posts: 16
Joined: 29 Aug 2008 22:30

Re: Shade windows in OpenTTD

Post 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:
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: Shade windows in OpenTTD

Post by 2007Alain2007 »

will this be able to work with patchs like new GRF GUI
For Community Integrated Version http://code.google.com/p/civopenttd/
erikjanp
Engineer
Engineer
Posts: 16
Joined: 29 Aug 2008 22:30

Re: Shade windows in OpenTTD

Post 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.
erikjanp
Engineer
Engineer
Posts: 16
Joined: 29 Aug 2008 22:30

Re: Shade windows in OpenTTD

Post 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.
Timmaexx
Transport Coordinator
Transport Coordinator
Posts: 301
Joined: 03 Jan 2009 17:55

Re: Shade windows in OpenTTD

Post by Timmaexx »

Congrats! :))
This Patch made it into trunk :!:
It's in current nightly: r18594
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Shade windows in OpenTTD

Post by petert »

Interesting, it was include r18588.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Shade windows in OpenTTD

Post by petert »

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 20 guests