Patch: Centred X in close window button

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

User avatar
dev|ant
Traffic Manager
Traffic Manager
Posts: 140
Joined: 30 Nov 2005 11:26
Location: melbourne.au

Post by dev|ant »

Code: Select all

<Bjarni> they are all orbiting the sun, which makes forum diffs very evil
lol. :)
matthijs wrote:DevIant, can you explain why this fix works? Maybe we can help you finding a better solution for this problem. Also, stop by on IRC sometime :-)
Thanks for the invite matthijs, I'll try to hop on IRC when I get the chance. :)

As for the problematic X, I think it's caused by the width of the sprite including it's shadow, but the shadow not being used in this case. I don't know enough about the GRFs yet to be sure. Reducing it's width by 1 is ugly, but I thought if it isn't used anywhere else, it shouldn't impact on anything.

Another part of the problem is there's no way to tell the difference between WWT_CLOSEBOX and WWT_TEXTBTN, so to the code a close box looks exactly like a button. The only way I can think of to tell the difference and allow DrawStringCentered() to make the alignment change is to look at which string is being passed. If it's a cross, shift it to the right one. Anything else, leave it as is.

I'm happy to code something along those lines if the devs prefer it that way?
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1791
Joined: 30 Mar 2005 09:43

Post by peter1138 »

I've made a patch to fix this, by separating the WWT_TEXTBTN and WWT_CLOSEBOX widgets (made possible by an earlier fix). Testers appreciated...

http://bugs.openttd.org/task/23
He's like, some kind of OpenTTD developer.
User avatar
dev|ant
Traffic Manager
Traffic Manager
Posts: 140
Joined: 30 Nov 2005 11:26
Location: melbourne.au

Post by dev|ant »

Works a treat! :)

Sorry you had to stay up half the night coding it. :(
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

I tried every window available on single player mode.
All X buttons are correctly centered.

I wander how I could have lived with this off- centered X for so long... ;)

Good work Peter1138
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Indeed, the original patch is just horrid, no matter what you say. Peter's however... 8)
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
User avatar
dev|ant
Traffic Manager
Traffic Manager
Posts: 140
Joined: 30 Nov 2005 11:26
Location: melbourne.au

Post by dev|ant »

Darkvater wrote:Indeed, the original patch is just horrid, no matter what you say. Peter's however... 8)
Ouch. :oops:
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

dev|ant wrote:
Darkvater wrote:Indeed, the original patch is just horrid, no matter what you say. Peter's however... 8)
Ouch. :oops:
Yeah... but at least your patch eventually raised the awareness of the problem to the point it got fixed!
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

Now, we only have to hope that peter1138 finds a dev kind enough to apply his patch... ;)
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
Born Acorn
Tycoon
Tycoon
Posts: 7596
Joined: 10 Dec 2002 20:36
Skype: bornacorn
Location: Wrexham, Wales
Contact:

Post by Born Acorn »

He could (and did) commit it himself. He has the power to.

peter1138
OpenTTD Developer
Image
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

Born Acorn wrote:He could (and did) commit it himself. He has the power to.

peter1138
OpenTTD Developer
Mmm.... next time, I better put a sign or something to make an emphasis on irony...
I knew that Born Acorn... But thanks anyway...
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
User avatar
webfreakz.nl
Director
Director
Posts: 627
Joined: 11 Aug 2005 08:22
Location: Localhost, 127.0.0.1, [The Netherlands: South Holland-> Westland]
Contact:

Post by webfreakz.nl »

Born Acorn wrote:He could (and did) commit it himself. He has the power to.

peter1138
OpenTTD Developer
http://svn.openttd.org/cgi-bin/trac.cgi/changeset/3302 ?

So people, no more talking about the 'uncentered-X' anymore :P
# Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

dev|ant wrote:
Darkvater wrote:Indeed, the original patch is just horrid, no matter what you say. Peter's however... 8)
Ouch. :oops:
No offence dev|ant. But the patch did not fix the problem in the right place and a few weeks from now nobody will know what it did and why it does what it does and how it does it. It's just a learning-process to find out where to best fix a particulare problem/anomaly.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
mr_pete
Engineer
Engineer
Posts: 37
Joined: 04 May 2005 17:49

Post by mr_pete »

Vaugely ontopic point.... Why does most of the discussion take place in IRC when the forums - admittedly not quite as lightning fast - Keep a record of whats been said open to everyone, not just those privelaged to be online at that point in time?
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 12 guests