[Patch] Improved Build Station GUI [r19159]

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

ThunderAI
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 26 Nov 2003 09:15

Re: [Patch] Improved Build Station GUI

Post by ThunderAI »

CommanderZ wrote:Idea - what about hiding the right half of the window for the default stations (or sets with only one station) and display it only for the more advanced station sets?
How about the ability to delete one square of a station without deleting the entire station, that would make customizing your station 'worth it', to me.

Yexo
Tycoon
Tycoon
Posts: 3660
Joined: 20 Dec 2007 12:49

Re: [Patch] Improved Build Station GUI

Post by Yexo »

ThunderAI wrote:How about the ability to delete one square of a station without deleting the entire station, that would make customizing your station 'worth it', to me.
You already can. Select the station building tool and then click the bulldozer (not the dynamite).

ThunderAI
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 26 Nov 2003 09:15

Re: [Patch] Improved Build Station GUI

Post by ThunderAI »

Yexo wrote:
ThunderAI wrote:How about the ability to delete one square of a station without deleting the entire station, that would make customizing your station 'worth it', to me.
You already can. Select the station building tool and then click the bulldozer (not the dynamite).

oh, i always wondered what that did

TrainTraveller
Engineer
Engineer
Posts: 6
Joined: 31 Dec 2008 19:00

Re: [Patch] Improved Build Station GUI

Post by TrainTraveller »

Expresso wrote:[..]If a platform type only allows say either 2x(any size) or 4x(any size) the selection rectangle should be able to reflect that too by only resizing in hops - in this case only for the width.
If it is done in this way, you'll still have your visual feedback without losing valuable screen-space to some buttons and a more intuitive user interface too.
I disagree, now I can click on a station and immediately see what sizes are available. With your proposal I'd have to actually try building the station, only to find out it isn't available in the size I need/want.

PhilSophus
Chairman
Chairman
Posts: 776
Joined: 20 Jan 2007 12:08
Location: Germany

Re: [Patch] Improved Build Station GUI

Post by PhilSophus »

TrainTraveller wrote:
Expresso wrote:[..]If a platform type only allows say either 2x(any size) or 4x(any size) the selection rectangle should be able to reflect that too by only resizing in hops - in this case only for the width.
If it is done in this way, you'll still have your visual feedback without losing valuable screen-space to some buttons and a more intuitive user interface too.
I disagree, now I can click on a station and immediately see what sizes are available. With your proposal I'd have to actually try building the station, only to find out it isn't available in the size I need/want.
I agree to disagree :wink: I also prefer to see the possible sizes before building.

Anyway, I don't see why to remove the buttons in the first place. They fit quite nicely into the window layout and removing them wouldn't buy you anything.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008

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

Re: [Patch] Improved Build Station GUI

Post by planetmaker »

update to r14996 with unchanged behaviour.

Some remarks to what I found when testing (both this and the not updated version):
- the scroll bars cannot be scrolled using the mouse wheel / touchpad functionality. It only works by clicking onto the scrollbar above / below the selection or slinding the position bar with keeping the mouse button pressed. The original GUI has mouse wheel support which is IMO very useful for scroll bars. I didn't figure why the behaviour differs, though as to me there are no obvious differences...
EDIT: That's what was reported already here: http://www.tt-forums.net/viewtopic.php?p=754005#p754005 The original GUI allows that kind of scrolling.
- for building purposes it is IMO usefull if the orientation of the shown station tiles is changed when the build orientation is changed: always show the correct sprite which is going to be build, depending upon the selected orientation. This requires re-reading the sprites when the orientation is changed. Might be useful to put this in a seperate routine then.
Attachments
station_build_gui_r14996.diff
station_build_gui.diff for trunk r14996
(22.1 KiB) Downloaded 66 times

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

Re: [Patch] Improved Build Station GUI

Post by planetmaker »

I had sufficient time in the train to spend coding: update to r15142 and some small modifications:

- the station class list now scrolls with mouse over and use of the mouse wheel.
- the station image list now shows the station images in the orientation currently selected.

The station image list still doesn't, though - it needs some further work to get that done. The use of a WWT_MATRIX widget failed for me in that instance. So my guess is that there are two or three possible solutions, all of which I'm not sure whether they're feasible or how difficult they are:
- make the station image list only one wide and try to use a "normal" list then
- make the station image list a new (sub)window
- make a new widget type for this.
Attachments
station_build_gui_r15142.diff
(22.62 KiB) Downloaded 70 times

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4554
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [Patch] Improved Build Station GUI

Post by Zuu »

4) Use a WWT_PANEL, and draw the contents of the panel manually. Such as the sign list for example. Then as you do the painting manually you can take the parameters of the scrollbar into account.

The OnPaint for SignList looks something like this: (taken from local copy form somewhere in December 2008)

Code: Select all

	virtual void OnPaint()
	{
		BuildSignsList();
		SortSignsList();

		SetVScrollCount(this, this->signs.Length());

		SetDParam(0, this->vscroll.count);
		this->DrawWidgets();

		/* No signs? */
		int y = 16; // offset from top of widget
		if (this->vscroll.count == 0) {
			DrawString(2, y, STR_304A_NONE, TC_FROMSTRING);
			return;
		}

		/* Start drawing the signs */
		for (uint16 i = this->vscroll.pos; i < this->vscroll.cap + this->vscroll.pos && i < this->vscroll.count; i++) {
			const Sign *si = this->signs[i];

			if (si->owner != OWNER_NONE) DrawCompanyIcon(si->owner, 4, y + 1);

			SetDParam(0, si->index);
			DrawString(22, y, STR_SIGN_NAME, TC_YELLOW);
			y += 10;
		}
	}
It might not be as pretty as a specialized widget that does it, but it is quite commonly used in OpenTTD as far as I have seen.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

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

Re: [Patch] Improved Build Station GUI

Post by planetmaker »

Zuu wrote:4) Use a WWT_PANEL, and draw the contents of the panel manually. Such as the sign list for example. Then as you do the painting manually you can take the parameters of the scrollbar into account.
Thanks Zuu for that advice. I'll have a look into that :) Actually I thought it an option, but... possiby it's the easiest one :)

2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: [Patch] Improved Build Station GUI

Post by 2007Alain2007 »

Hi i am under takeing a new patchs pack and would like to inclued your patch but i need help doing this
For Community Integrated Version http://code.google.com/p/civopenttd/

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

Re: [Patch] Improved Build Station GUI

Post by planetmaker »

2007Alain2007 wrote:Hi i am under takeing a new patchs pack and would like to inclued your patch but i need help doing this
Are you going to spam all patch thread which you consider interesting with this sentence? The patches where I posted a recent update, those are not that much out of date that it isn't quite easily possible to update them to your desired revision (just a few changes in the settings* files as there are a few additions since. Yes, I will even post an update to trunk of this which conforms to the -p0 subversion style patch format (as opposed to -p1 as I already gave you in your patch pack thread of this one).

User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: [Patch] Improved Build Station GUI

Post by Ammler »

Just a little side note, afaik, a "sed-ed" hg-diff is still not compatible with that silly windows svn client. ;-)

DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: [Patch] Improved Build Station GUI

Post by DaleStan »

Well, sed could manage, but if "head your_patch.diff" and "svn diff | head" don't have exactly the same format, forget it.

That funny "Index:" line? TortoiseMerge requires it.
Those revision numbers? TortoiseMerge requires them.
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

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

Re: [Patch] Improved Build Station GUI

Post by planetmaker »

Ammler wrote:Just a little side note, afaik, a "sed-ed" hg-diff is still not compatible with that silly windows svn client. ;-)
Oh, neither then? That's sad to hear. Is there an easier way around than applying the patch to an svn repo and then creating a new svn conforming one? I think I'm too lazy to do that in full length manually for every patch I update :)

This command line patch binary seems so much more flexible... :)

EDIT: Well, sure it's possible to string together a bash file which extracts the hg revision, creates a proper svn repo, applies the patch and creates a new patch. But to me that seems a bit like overdoing it - and it won't work offline as the svn will need an internet connection in order to update to the proper version - or can I svn co from a local hg repo?

DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: [Patch] Improved Build Station GUI

Post by DaleStan »

patch(1) accepts more formats than TortoiseMerge, at the expense of being much less useful when conflicts occur.
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

hempa
Engineer
Engineer
Posts: 21
Joined: 15 Oct 2008 16:30

Re: [Patch] Improved Build Station GUI

Post by hempa »

This looks like really well done work. I can't wait to try it out. For now, I'll have to be happy and content with forum lurking, cause my work firewall won't let me download the patch...

User avatar
Roest
Traffic Manager
Traffic Manager
Posts: 215
Joined: 03 Apr 2008 08:18

Re: [Patch] Improved Build Station GUI

Post by Roest »

Nice patch. Updated it to current trunk.
Attachments
station_build_gui_r15476.diff
(22.73 KiB) Downloaded 88 times


2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: [Patch] Improved Build Station GUI

Post by 2007Alain2007 »

Hi there i added it in and it works a Dream Evern my g/f likes it if i can get other patch makers to up date their patchs to R15476 it should all work sweet
For Community Integrated Version http://code.google.com/p/civopenttd/

2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

Re: [Patch] Improved Build Station GUI

Post by 2007Alain2007 »

Hi Roest

Your patch is all so working with r15495 just thought your be happy to hear that
For Community Integrated Version http://code.google.com/p/civopenttd/

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: perverted monkey and 3 guests