Patch: Tracking viewport

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

Post Reply
jawsper
Engineer
Engineer
Posts: 20
Joined: 08 Jun 2004 00:02
Location: Netherlands

Patch: Tracking viewport

Post by jawsper »

Well i had some more inspiration and fixed up another patch :D

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
Last edited by jawsper on 14 Aug 2011 12:49, edited 5 times in total.
Patch: change finances window grouping
Patch: Tracking viewport

Warning: Unexpected end of file reached.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Tracking viewport

Post 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.
* @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
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Patch: Tracking viewport

Post 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 :)
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 1274 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.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Patch: Tracking viewport

Post 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 linkhttp://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".
Image
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 :wink:

HackaLittleBit
Attachments
vp.png
vp.png (29.88 KiB) Viewed 10476 times
jawsper
Engineer
Engineer
Posts: 20
Joined: 08 Jun 2004 00:02
Location: Netherlands

Re: Patch: Tracking viewport

Post by jawsper »

Well I did some work on it, and I managed to get rid of the buttons :D 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
tracking_viewport_1.png (57.23 KiB) Viewed 10381 times
tracking_viewport_2.png
tracking_viewport_2.png (50.15 KiB) Viewed 10382 times
Patch: change finances window grouping
Patch: Tracking viewport

Warning: Unexpected end of file reached.
jawsper
Engineer
Engineer
Posts: 20
Joined: 08 Jun 2004 00:02
Location: Netherlands

Re: Patch: Tracking viewport

Post by jawsper »

Sorry for the double post but update for r17895 in first post :)
Patch: change finances window grouping
Patch: Tracking viewport

Warning: Unexpected end of file reached.
CrazyTerabyte
Engineer
Engineer
Posts: 5
Joined: 18 May 2010 01:56
Contact:

Re: Patch: Tracking viewport

Post 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
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Patch: Tracking viewport

Post by Lord Aro »

you might want to try 32bpp extra zoom (just search for it)
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
nighthawk_c_m
Engineer
Engineer
Posts: 26
Joined: 14 Apr 2010 06:26

Re: Patch: Tracking viewport

Post 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.
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Patch: Tracking viewport

Post by Lord Aro »

i wasn't specifically talking about the new graphics - just the extra zoom function
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
NukeBuster
Traffic Manager
Traffic Manager
Posts: 222
Joined: 04 Jan 2006 18:16
Location: Alphen aan den Rijn, The Netherlands
Contact:

Re: Patch: Tracking viewport

Post 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.
NukeBuster

Transport Empire: The Transport Empire Linux effort
Join the Transport Empire IRC channel: [url]irc://irc.oftc.net/transportempire[/url] !

OpenTTD patch(es): Password at join
jawsper
Engineer
Engineer
Posts: 20
Joined: 08 Jun 2004 00:02
Location: Netherlands

Re: Patch: Tracking viewport

Post 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. :D

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 :D
Patch: change finances window grouping
Patch: Tracking viewport

Warning: Unexpected end of file reached.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Patch: Tracking viewport

Post 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
jawsper
Engineer
Engineer
Posts: 20
Joined: 08 Jun 2004 00:02
Location: Netherlands

Re: Patch: Tracking viewport

Post by jawsper »

Updated to trunk (r20082)
Attachments
tracking_viewport_r20082.diff
(8.27 KiB) Downloaded 252 times
Patch: change finances window grouping
Patch: Tracking viewport

Warning: Unexpected end of file reached.
jawsper
Engineer
Engineer
Posts: 20
Joined: 08 Jun 2004 00:02
Location: Netherlands

Re: Patch: Tracking viewport

Post 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 :)
Example of the new button style :)
Tracking viewport.png (177.11 KiB) Viewed 8031 times
Attachments
tracking_viewport_v2_r22688.patch
Patch for r22688 (Tortoise style)
(3.45 KiB) Downloaded 205 times
Patch: change finances window grouping
Patch: Tracking viewport

Warning: Unexpected end of file reached.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 49 guests