Patches: Close tool with middle click / persistent clone

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

Patches: Close tool with middle click / persistent clone

Post by Terkhen »

This one is the penultimate of my patching spree. Don't worry about my sanity; it is very small and simple, but pretty handful. This feature allows to close any tool currently in use pressing the middle mouse button. This is specially useful with persistent tools and / or quick goto turned on. I know that you can already do the same with the ESC key, but it is so far from the rest of frequently used keys that I lose too much time using it. Try it once and you will never go back, I know I won't :D

The middle mouse button code (the complicated part) was created by erikjanp for the shade windows patch, which means that almost every line of this code was made by him.

Right now the behaviour is to close tools if there's a tool active, which lefts open the possibility of allowing it to do other things under different conditions. Do you think this behaviour for the middle button is consistent enough?. Is there any problem with using the middle button (besides that this feature can't be used in platforms without this button)?.
Attachments
close_tools_middle_v1_r17268.diff
(4.55 KiB) Downloaded 154 times
close_tools_middle_win32_v1_r17268.rar
(2.71 MiB) Downloaded 139 times
close_tools_middle_shade_windows_v2_r17435.diff
(467 Bytes) Downloaded 125 times
Last edited by Terkhen on 06 Sep 2009 22:35, edited 2 times in total.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Patch: Persistent clone

Post by Terkhen »

And the last one: persistent clone. While you are cloning, the clone tool stays active until you click on its button again or press ESC. To turn on / off this behaviour, it uses the same setting than the persistent building tool.
Attachments
persistent_clone_v2_r17273.diff
(509 Bytes) Downloaded 142 times
persistent_clone_win32_v2_r17273.rar
(2.71 MiB) Downloaded 127 times
Last edited by Terkhen on 24 Aug 2009 12:24, edited 1 time in total.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Patches: Close tool with middle click / persistent clone

Post by petert »

I find close tools with middle mouse button very useful. I usually have to use del key, therefore my finger is on the del key almost all the time that I am building. The tool that is sort-of pesky is the Land Area Information, since that doesn't go away when you press del. I don't know what people will do without a middle mouse button though. :roll:

:arrow: As for the persistant clone tool, as of now, that one didn't work for me. I tried making an aircraft, then clicked on clone and when I cloned it, I had to re-click clone vehicle again. I've a feeling I'm using this one wrong. :?:

If you need me to post screenshots, video, I can do that.

Keep up the good work Terkhan and erikjanp :!:

Me gusta como trabajas.

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

Re: Patches: Close tool with middle click / persistent clone

Post by Terkhen »

petert wrote::arrow: As for the persistant clone tool, as of now, that one didn't work for me. I tried making an aircraft, then clicked on clone and when I cloned it, I had to re-click clone vehicle again. I've a feeling I'm using this one wrong. :?:
You probably have the setting for quick goto off; As stated, right now they are using the same setting. Turn it on and you will be able to enjoy persistent cloning.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Patches: Close tool with middle click / persistent clone

Post by petert »

Like I said:
petert wrote:I've a feeling I'm using this one wrong.
Thanks for the help.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patches: Close tool with middle click / persistent clone

Post by Terkhen »

I just tested that these patches can apply to the 0.7 branch without rejects.

Edit: Persistent clone updated. I just made it use the existing "persistent building tools" settings: it is more correct in this way.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Patches: Close tool with middle click / persistent clone

Post by petert »

Can you update the first post with the compiled binary of v2 of persistant clone?
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patches: Close tool with middle click / persistent clone

Post by Terkhen »

The persistent clone binary and diff are at the second post. Why should I move the files?
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

ptmPP has a Google Code page!

Post by petert »

Edit: Removed ptMPP from here, check out

ptMPP's Google Code Page
Last edited by petert on 08 Nov 2009 00:08, edited 6 times in total.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patches: Close tool with middle click / persistent clone

Post by Terkhen »

If you are going to create a patch pack, you should start a new thread for it.

Edit: The download link is not correct: after clicking on the url I had to remove "Connection: close" from the end of the url to download it. Also, the zip file still has the .svn folders. If you export the files with svn after compiling and before packing (or delete the .svn folders manually) the zip file will be lighter.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Patches: Close tool with middle click / persistent clone

Post by petert »

The url doesn't contain "Connection: Close" at the end. I don't know what caused that.
Scautura
Engineer
Engineer
Posts: 102
Joined: 01 Aug 2006 07:30

Re: Patches: Close tool with middle click / persistent clone

Post by Scautura »

MediaFire doesn't allow you to link directly to the file, you need to link here: http://www.mediafire.com/?o2dv1d5xey3
Duct tape is like the Force - it has a Dark side, a Light side, and it holds the universe together.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Patches: Close tool with middle click / persistent clone

Post by petert »

Ok, I updated the link. Thank you Scatura.
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: Patches: Close tool with middle click / persistent clone

Post by Ammler »

Terkhen wrote:If you export the files with svn after compiling and before packing (or delete the .svn folders manually) the zip file will be lighter.
or just use "make bundle_*" ;-)
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patches: Close tool with middle click / persistent clone

Post by Terkhen »

Ammler wrote:or just use "make bundle_*" ;-)
Sadly that's not possible for me since I use Visual Studio (or at least I wasn't able to find documentation about it).
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Patches: Close tool with middle click / persistent clone

Post by Yexo »

Terkhen wrote:
Ammler wrote:or just use "make bundle_*" ;-)
Sadly that's not possible for me since I use Visual Studio (or at least I wasn't able to find documentation about it).
I use Visual Studio too, but for making a bundle I use cygwin or msys.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patches: Close tool with middle click / persistent clone

Post by Terkhen »

I use gnuwin32 tools myself: I had to uninstall msys because it conflicted with devkitpro. Now that I finished my project involving devkitpro, I can give msys another chance when I finish my exams.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patches: Close tool with middle click / persistent clone

Post by DaleStan »

Terkhen wrote:Right now the behaviour is to close tools if there's a tool active, which lefts open the possibility of allowing it to do other things under different conditions. Do you think this behaviour for the middle button is consistent enough?. Is there any problem with using the middle button (besides that this feature can't be used in platforms without this button)?.
If there's a tool active and you middle-click on the title-bar of a window, what happens? Does the window (un)shade, or does the tool get closed? (Or -- horror of horrors -- both?)
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
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Patches: Close tool with middle click / persistent clone

Post by Terkhen »

The planned behaviour is to close the the tool first, and another click would shade the window. When the shade windows patch gets updated to trunk, I will do a version of close tool with middle click compatible with it. Right now, if you just tried to solve the rejects between the two patches manually shading window with middle click could either not work at all or land in the horror of horrors, depending on how it was solved. These are the correct changes, if anyone wants to try it before shade windows is updated.

Without erikjamp's code for middle click, my patch is this single line (placed in the part of the code that handles middle clicking):

Code: Select all

if (_cursor.sprite != SPR_CURSOR_MOUSE) ResetObjectToPlace();
To have compatibility with shade windows, it needs to be like this:

Code: Select all

if (_cursor.sprite != SPR_CURSOR_MOUSE) {
	ResetObjectToPlace();
} else {
	click = MC_MIDDLE; //Constant that I currently don't use, as the middle click don't needs to be checked in the GUI in my patch.
}
audigex
Tycoon
Tycoon
Posts: 2056
Joined: 09 Dec 2007 21:28
Contact:

Re: Patches: Close tool with middle click / persistent clone

Post by audigex »

How about clicking the middle mouse button again re-instates the previous tool?
Jon
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Bing [Bot] and 14 guests