Page 1 of 1
Patch: Tracking viewport
Posted: 04 May 2009 22:11
by jawsper
Well i had some more inspiration and fixed up another patch
The scenario:
Ever had a big field to build on, but you cant see where you click when zoomed out? This is where the tracking viewport comes in! Open it with Ctrl+V and it will make sure to show whatever you are pointing at in either the main window or a different viewport!
Changes:
- One text string
- A window class (WC_TRACKING_VIEW_PORT)
- A function to call it
- The hotkey
- Lots of small changes in src/smallmap_gui.cpp to not have to copy most of this class.
Hope you enjoy this! Don't have a screenshot since it only really shows when you try it.
Update 6th of may: fixed the Z being off, removed buttons, and some more size changes.
Update 7th of may (well it is here at least): added item in map menu, added to scenario editor, fixed a possible bug (string missing in language file? need to check this out)
Update 28th of october 2009: Updated to r17895
Re: Patch: Tracking viewport
Posted: 06 May 2009 09:43
by Roujin
Hello,
sounds like a nice idea (have not tested it though)
You could make them invisible instead of disabled, but this will probably leave some empty space where the buttons were before -> also not nice.
A different idea I just had is, do not remove the buttons, but insert a new one: "Follow cursor" button, that enables/disables the tracking behavior.
Re: Patch: Tracking viewport
Posted: 06 May 2009 13:44
by Bilbo
Nice idea, though perhaps you could provide screenshot so people will have better idea of what this does.
As you have not done it, I have compiled latest trunk with your patch and I am attaching a screenshot.

- Screenshot showing the way this feature work. Too bad the CTRL+S does not capture the mouse, but there are still other methods how to produce a screenshot :)
- screenshot2.png (74.04 KiB) Viewed 3404 times
The button could probably go away, as they impose also limit on the minimum width (often you'll want this window quite small).
I think the "static const Widget _extra_view_port_widgets[] = {..." will probably need to be duplicated (yeah, copy & paste, but I am not sure whether it can be done better with current GUI system in openttd) and created once again, but without the extra buttons.
Re: Patch: Tracking viewport
Posted: 06 May 2009 16:21
by HackaLittleBit
Roujin wrote:A different idea I just had is, do not remove the buttons, but insert a new one: "Follow cursor" button, that enables/disables the tracking behavior.
Yep agree with that one.
Have a look at this link
http://bugs.openttd.org/task/2629?proje ... &sort=desc
I tried to make it more user friendly the viewport.
Especially the eye instead of "paste from viewport".

Unfortunately this does not work with new graphics because those graphics don't use an eye.
Bug: The viewport does not center on the z coordinate. This was recently changed by the devs an should be taken into account (future more heights).
photo for bilbo
HackaLittleBit
Re: Patch: Tracking viewport
Posted: 06 May 2009 17:34
by jawsper
Well I did some work on it, and I managed to get rid of the buttons

I also made it a bit smaller, so it's less in the way.
What about a feature that when you click something else, maybe Shift+V(?) that it will open a regular viewport at the position of the tracking port?
Ah I see what you mean with the Z being off, already found where the error is. Will fix that before I post the next update.
Edit: posted update in first post
Screenshots here:

- tracking_viewport_1.png (57.23 KiB) Viewed 12511 times

- tracking_viewport_2.png (50.15 KiB) Viewed 12512 times
Re: Patch: Tracking viewport
Posted: 28 Oct 2009 13:43
by jawsper
Sorry for the double post but update for r17895 in first post

Re: Patch: Tracking viewport
Posted: 18 May 2010 02:19
by CrazyTerabyte
I think this "tracking viewport" feature seems to work like a magnifying glass. MAYBE it should be better implemented as such.
My suggestion:
- Upon holding middle-click (or any other shortcut you want), a magnified view will be overlaid exactly where the cursor is. Maybe the shortcut should toggle the display of this magnified view.
- This magnified view could be drawn similar to this: http://www.youtube.com/watch?v=ngsiTkIoeUE#t=0m45s
- The mouse sensitivity should be automatically "adapted" while the magnifier is shown, in order to allow high precision even when the main window is zoomed out.
- It should work even if left mouse button is held (so, it's possible to start a road/rail somewhere else, move the mouse near the destination, middle-click to magnify, and then release the left mouse button at the desired position).
- If the main window is at 100% zoom, then the magnified view should zoom it 2x or 3x (showing exploded pixels if needed). This will kinda solve this guy issue: Too damn small signals
Re: Patch: Tracking viewport
Posted: 18 May 2010 05:36
by Lord Aro
you might want to try 32bpp extra zoom (just search for it)
Re: Patch: Tracking viewport
Posted: 18 May 2010 06:37
by nighthawk_c_m
32bpp should not always be mentioned when someone complains about the small signal graphics of the 8bpp version, Its not necessarily a solution, and I'd support the idea of this maybe being able to zoom in one more level or so, nice patch so far.
Re: Patch: Tracking viewport
Posted: 18 May 2010 15:17
by Lord Aro
i wasn't specifically talking about the new graphics - just the extra zoom function
Re: Patch: Tracking viewport
Posted: 18 May 2010 17:48
by NukeBuster
From what I understand from the topic, this patch is not about an extra zoom level. But it allows you to see what you are pointing at when zoomed out.
I think this patch is very usable, especially when laying long amounts of track.
Re: Patch: Tracking viewport
Posted: 13 Jun 2010 16:25
by jawsper
NukeBuster is right, that wasn't my goal when making this patch.
It does seem like a very nice idea though, have to reread this when I'm actually home so I'll properly understand it. Already see a potential difficulty issue with the zooming even bigger than normal zoom (is that even necessary?).
I have to admit that I don't use it myself so much any more, but that's because my current main playing game is an old old old 512x512 map so it's not very needed.
I'll update it soon to work with latest trunk too.
P.S. @NukeBuster: What's the chip in your avatar? Can't read the text at the small resolution

Re: Patch: Tracking viewport
Posted: 14 Jun 2010 00:46
by HackaLittleBit
jawsper wrote:P.S. @NukeBuster: What's the chip in your avatar? Can't read the text at the small resolution
Looks like he borrowed it from this
site
Edit: And if you like the chip I can recommend you to see this
website
Re: Patch: Tracking viewport
Posted: 06 Jul 2010 12:07
by jawsper
Updated to trunk (r20082)
Re: Patch: Tracking viewport
Posted: 01 Aug 2011 22:18
by jawsper
Why hello there!
I decided to completly rework my patch, and integrate the tracking feature in the regular viewport.
In the next update I hope to rework this feature again into a "smart view", which will automatically choose between following the cursor and showing the opposite end of a tunnel being built. I have more experience with the source now so I think I am able to make something like that now
Screenshot is coming shortly. Here it is

- Example of the new button style :)
- Tracking viewport.png (177.11 KiB) Viewed 10161 times