Bay 12 Games Forum

Dwarf Fortress => DF Modding => Utilities and 3rd Party Applications => Topic started by: mifki on May 26, 2014, 03:14:07 am

Title: MultiScroll - dfhack plugin [OS X]
Post by: mifki on May 26, 2014, 03:14:07 am
Another tiny plugin to make life better. Multitouch (two-finger) map scrolling with touchpad or Magic Mouse on OS X. I'll probably later add some settings/modifiers for z and secondary scroll, so that most navigation can be done without moving right hand between touchpad and z-scroll/secondary scroll keys all the time.

Home Page / Sources (https://github.com/mifki/df-multiscroll) -- Latest Release (https://github.com/mifki/df-multiscroll/releases) -- Report an Issue (https://github.com/mifki/df-multiscroll/issues)
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on May 26, 2014, 08:41:30 pm
Trying to compile this for r4 by adding it to plugins/CMakeLists.txt gives me a lot of strange, Objective C-related errors such as:
Code: [Select]
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:6:0,
                 from /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:5,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10,
                 from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
                 from dfhack/plugins/multiscroll.mm:9:
/usr/include/objc/NSObject.h:41:1: error: stray '@' in program
I'm assuming this is because GCC is trying to compile it as C++. What additional flags did you set to compile it as Objective-C?

Also, it would be nice to include this in DFHack releases, although the "All rights reserved" at the top makes it unclear if this is possible. (It also claims to be "twbt.cpp" ;) )

This works really well on r3, though. Nice work!
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on May 26, 2014, 09:09:13 pm
Are you using GCC from MacPorts as per dfhack compilation instructions? Maybe it doesn't install Obj-C support (however that's strange). So I don't know - I haven't yet tried to compile these plugins as part of dfhack (and check my Makefile for flags to compile separately), and also I use system llvm/clang to build dfhack anyway.
But what if you just use my Makefile and change dfhack version in it (and paths)?

Oh that's automatically generated header, then I copied twbt to make this one, so never mind. However I don't know dfhack developers' position regarding platform-specific code or plugins.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on May 26, 2014, 10:04:49 pm
I'm surprised that DFHack even builds with Clang. I'm using Homebrew's gcc, although I made sure to enable objective-c support. Apparently I failed to notice the makefile, so I'll try that (and see if I can make cmake work with it somehow).
I think the main concern with plugins is making them compatible with as many platforms as possible, but since this depends on an OS X feature, it's not as important here as with other plugins. Granted, it would be nice to support this on other platforms with the required hardware, but maintaining compatibility with all of them would be a nightmare.

Edit: Using the makefile works, although it seems to require gcc 4.2 (4.5 and up don't seem to recognize -std=gnu++11, -stdlib=libstdc++, or -Wno-ignored-attributes). I'll look into compatibility with gcc 4.5/cmake more when I get a chance.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on May 26, 2014, 10:30:17 pm
Why not.. as far as I remember I only had to fix couple things in protobuf related to include names, and in dfhack tthread::* classes conflicted with something when used without namespace specified. It's all because of a different c++ stdlib.
I'm using only macs for a long time so I personally have no idea what multitouch hardware exists for Win/Linux is and how to work with it.

Not surprising, the Makefile is for clang as well:)
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: Warmist on May 26, 2014, 11:30:35 pm
Oh that's automatically generated header, then I copied twbt to make this one, so never mind. However I don't know dfhack developers' position regarding platform-specific code or plugins.
It's usually (in other projects as far as i know) frowned upon on copying pregenerated stuff (because it WILL change and then everything breaks), but nobody in df has yet to build plugins outside of dfhack library (you are the first :) ). Platform specific code is okay, specially for features like this, that don't really exist on other platforms.
However not sure about compiler specific code, if your plugin only builds on clang, and everything is built on gcc ver (some-old-version) there might be problems. For best results we are tied down to specific compilers on each platform.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on May 27, 2014, 12:04:48 am
I'll add a cmake file instead then. The code itself is of course not clang-specific.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on June 20, 2014, 08:42:59 am
Package updated to include a binary for dfhack r5.

Anybody using this?
Just in case somebody missed it. I find it a completely new experience being able to smoothly and quickly scroll the map in any direction. Sad Windows users can't try it.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on June 20, 2014, 09:08:14 am
I use it. :) I think Fricy included it in the MacNewbie pack too, although I haven't checked.

One minor issue: when the screen is taller than the map, scrolling sideways causes the map to jump between the top and bottom of the screen (I notice this the most with x-by-1 embarks).
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on June 20, 2014, 09:09:01 am
I use it. :) I think Fricy included it in the MacNewbie pack too, although I haven't checked.

One minor issue: when the screen is taller than the map, scrolling sideways causes the map to jump between the top and bottom of the screen (I notice this the most with x-by-1 embarks).

Yep, "known issue" :)
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: fricy on June 20, 2014, 02:52:29 pm
Package updated to include a binary for dfhack r5.

Anybody using this?
Just in case somebody missed it. I find it a completely new experience being able to smoothly and quickly scroll the map in any direction. Sad Windows users can't try it.

To tell you the truth, not really, tried it, but haven't noticed anything on my old macbook, so I didn't bother up to now...
The reason for this post is that I'm testing dfhack-r5, but can't get it to load. I'm trying the new version from today, should be r5, but:
Code: [Select]
Can't load plugin /Users/fricy/Applications/Macnewbie_8.6/Macnewbie/Dwarf Fortress/hack/plugins/multiscroll.plug.soaaaaand:
No need to build anything, just update -r3 to -r5 with any hex editor ;)
I love you for this. :)
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on June 20, 2014, 05:50:06 pm
The reason for this post is that I'm testing dfhack-r5, but can't get it to load. I'm trying the new version from today, should be r5, but:

Hm.. I'll check if it references some non-standard libraries or something..
What OS X version do you have?
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: fricy on June 21, 2014, 02:01:30 am
Hm.. I'll check if it references some non-standard libraries or something..
What OS X version do you have?
10.7.5
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on June 24, 2014, 07:27:09 pm
Does stderr.log include anything about multiscroll? Plugins failing to load because of a version incompatibility should give a more detailed message than that in the DFHack console.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on June 24, 2014, 07:45:26 pm
I just tried it on older OS X version and see the problem. Will try to fix.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on June 25, 2014, 07:05:21 am
Fixed. See updated first post for binary/sources location.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on June 25, 2014, 09:36:06 am
Package updated to include a binary for dfhack r5.

Anybody using this?
Just in case somebody missed it. I find it a completely new experience being able to smoothly and quickly scroll the map in any direction. Sad Windows users can't try it.
I've become addicted, absolutely unable to play without it.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: Meph on June 25, 2014, 09:55:28 am
Windows users use the mouse wheel. At least thats my mod setting... I know other use it to go up/down z levels as well.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: fricy on September 24, 2014, 02:20:35 pm
@mifki: crash report be here. (http://www.reddit.com/r/dwarffortress/comments/2h0v9r/macnewbie_pack_0910_with_df_4013/ckpj37q)
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: TV4Fun on April 13, 2015, 02:27:37 am
Any hope of a new build of this for the latest release of DFHack?
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on April 16, 2015, 10:05:35 pm
The version at http://do1.mifki.com:8810/dashboard;jsessionid=1ma5xzqibejw11rkajccggkcgh claims to be v2.32, which is newer than the v2.29 on GitHub (although I'm not sure if it's built for 0.40.24-r3 or an earlier version).
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on April 16, 2015, 10:58:37 pm
It's for r3, published to GitHub now as well.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on June 01, 2015, 09:34:53 am
Sometimes multiscroll (latest) stops working (trackpad movements become zoom instead of scroll)
It used to happen every hour or so, but now it happens more often.
There are no messages in the dfhack console.

Is there any way to restart it without quitting DF?
Is there any way I can help with debugging the issue?

I'm not sure, but it seems like lags are causing multiscroll to quit (season change, or just occasional stutter while scrolling)
I have rMBP with OS X 10.10 and dfhack r3
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on June 01, 2015, 02:47:27 pm
Does "reload multiscroll" help?
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on June 01, 2015, 03:07:27 pm
Yes, thank you!
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: TheBloke on December 02, 2015, 03:30:04 pm
I just switched from Windows to OSX as my main platform.  I have a Magic Mouse, and I have been very tempted to buy the new Apple Magic Trackpad 2 (shame it costs so much money :( )

mifki this plugin is excellent!  I am sad it has only two pages of posts, and I am the first in six months!

I have the same issue someone mentioned above - sometimes it swaps between moving the map and normal zoom.   

mifki, are you still interested in developing this plugin?  You are exactly right, it makes a HUGE difference to playing the game, being able to smoothly scroll about while still being able to have a separate mouse cursor.  Before multiscroll, I used mousequery with your drag extension, and used right-click drag to move the map.   Multiscroll is much nicer.

The only issue is that I am very used to having scroll wheel = move up/down Z levels (not the default of zoom in/out.)   I want to switch Z levels nearly as often as moving about on one Z level.

Do you think any more gestures could be added to allow the mouse to also be used for Z levels/zoom (depending on hotkey config)?

For example:  one finger up/down scroll = move map;  two finger up/down scroll = change Z level.  What do you think?
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on December 02, 2015, 04:01:42 pm
I don't think it's possible to recognise more gestures on the Magic Mouse. But I can add more modifier keys (currently it scrolls without modifier keys and zooms with the Command key). I haven't played with Magic Mouse for a long time, I'll see what can be done to improve usability.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: TheBloke on December 02, 2015, 04:26:54 pm
I don't think it's possible to recognise more gestures on the Magic Mouse. But I can add more modifier keys (currently it scrolls without modifier keys and zooms with the Command key). I haven't played with Magic Mouse for a long time, I'll see what can be done to improve usability.

Do you mean it's not possible for your plugin, or just in general?

Because it's definitely possible in general - check out the tool BetterTouchTool (http://www.boastr.net/), it does amazing things with the Magic Mouse.  One, two, three, four finger taps, swipes, pinch in/out, multi-taps (press two fingers then release one and re-tap it) etc etc. It's awesome :)  It's not open source but it does show it's possible - and I think possibly he uses some OS code, for example I think his Live View mode (shows exactly what fingers are pressed/where on the magic mouse and trackpad) is based on open source code:

(http://i.imgur.com/qEmQI1nm.png) (http://imgur.com/qEmQI1n)

But yeah if it's not possible from the plugin, modifier keys are good too.  And thanks for the details on Command. 

One thing I would definitely like to see changed:  I think right now you have hardcoded Cmd+Up/Down = Zoom?   I ask because I have re-bound Up/Down Z to the mouse wheel (Mouse button 4/5), and unbound those buttons from Zoom, but Cmd+up/down still zooms.  I was hoping that it sent the key command, but I guess it doesn't?

If you could change that, that would be excellent, as for me I don't care about zooming with the mouse (I do it rarely, so it's fine to use keyboard) but I would love to go up/down Z with magic mouse.  And maybe other people will want to do other things.  So if Multiscroll can send the appropriate keyboard command, which can then be rebound - or at least, have some kind of plugin config - then it can work best for everyone.

What would be perfect would be some kind of config (with DFHack plugin commands), where we can define Actions:

multiscroll <add|remove> <mouse action> <num fingers> <DF key> [modifier key(s)]
eg:
Code: [Select]
multiscroll add|remove up|down|left|right 1|2|3 <DF key> [Cmd|Control|Shift|Option  (or Cmd+Control,  Shift+Option,  Cmd+Control+Option, etc)]
multiscroll add up 1 SCROLL_UP
multiscroll add down 1 SCROLL_DOWN
multiscroll add left 1 SCROLL_LEFT
multiscroll add right 1 SCROLL_RIGHT
multiscroll add up 2 CURSOR_UP_Z
multiscroll add down 2 CURSOR_DOWN_Z
multiscroll add up 1 ZOOM_IN Command
multiscroll add down 1 ZOOM_OUT Command

Which would configure:
1. One finger Up/down/left/right = move around map
2. Two finger up/down = Z level
3. One finger up/down + Command = zoom

I realise that is the most advanced way, and maybe a lot more than you are interested to do.  But that would be the perfect design in my view, if it is possible :)  And maybe I can help with some of the basic stuff and testing, if you are interested to do any of it.

Thanks again!  Really love it.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on December 02, 2015, 11:51:08 pm
I actually didn't find it comfortable to switch z-levels with Magic Mouse or trackpad because without clicks (which usual mouse wheels have) it's hard to switch z-levels precisely.
Anyway, I'll see what can be done.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: TheBloke on December 06, 2015, 11:11:41 pm
I actually didn't find it comfortable to switch z-levels with Magic Mouse or trackpad because without clicks (which usual mouse wheels have) it's hard to switch z-levels precisely.
Anyway, I'll see what can be done.

Just to let you know I've been playing about a bit on OSX with multiscroll disabled, and up/down scroll on MM is working OK for Z levels

You do have to be careful to only move your finger a little way, but it's quite easy to get the hang of it and I'm successfully using it to go up/down Zs.  It's definitely my preferred way of doing that.  it also has the advantage that if you want to go a lot of Zs, you can do a bigger finger movement and move ~25 in one go :)
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on January 19, 2018, 11:14:16 pm
Any chance for update to latest dfhack?
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on January 20, 2018, 07:00:56 pm
Yeah, I'll do it soon.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: jecowa on January 20, 2018, 07:59:10 pm
Does this have any other multi-touch features besides scrolling around the map with 2 fingers? Using the trackpad to scroll sounds a lot better than using it to zoom.

Does it really require multi-touch? I can scroll both horizontally and vertically by using two fingers in web browsers and text editors on my pre-multitouch MacBook.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on January 21, 2018, 03:11:04 am
Does this have any other multi-touch features besides scrolling around the map with 2 fingers? Using the trackpad to scroll sounds a lot better than using it to zoom.

Does it really require multi-touch? I can scroll both horizontally and vertically by using two fingers in web browsers and text editors on my pre-multitouch MacBook.

Yes, it allows to use touchpad (two fingers) for two-directional scroll just like you do in Preview.app. It's really convenient and intuitive, it gives you ability to scroll fast while having pinpoint accuracy.

And, if I remember it correctly, you still have the option to zoom tileset and text font independently of each other by pressing alt while scrolling.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on January 21, 2018, 03:18:47 am
That didn't answer the question:
Does this have any other multi-touch features besides scrolling around the map with 2 fingers?
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on January 21, 2018, 04:59:03 pm
Does this have any other multi-touch features besides scrolling around the map with 2 fingers? Using the trackpad to scroll sounds a lot better than using it to zoom.

Does it really require multi-touch? I can scroll both horizontally and vertically by using two fingers in web browsers and text editors on my pre-multitouch MacBook.

No it doesn't have any other features.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on January 24, 2018, 07:00:37 am
Since multiscroll seems to not depend on DF version, maybe it's best to include it in dfhack, so it will be silently re-built for every new release?
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on January 24, 2018, 09:02:08 am
Last time I tried that, the compilation process was different enough from the rest of DFHack that it wasn't possible.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on January 30, 2018, 09:42:21 pm
Yeah, I'll do it soon.
I'm not a developer, but maybe there is something I can do to help?
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on February 15, 2018, 08:18:14 am
Is there any way I can help?
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on February 15, 2018, 10:56:12 am
It's outdated enough that it no longer compiles with DFHack for 0.44.05. I'll work on fixing it.

Edit: https://github.com/mifki/df-multiscroll/pull/1
And https://github.com/lethosor/df-multiscroll/releases/tag/0.44.05-r1-unofficial
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: Holloweye on February 15, 2018, 03:06:21 pm
Amazing plugin love it!

Would be amazing if it had Pinch In / Out:
Pinch in = Down 1-Z level
Pinch out = Up 1-Z level
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on February 15, 2018, 05:51:47 pm
It's outdated enough that it no longer compiles with DFHack for 0.44.05. I'll work on fixing it.

Edit: https://github.com/mifki/df-multiscroll/pull/1
And https://github.com/lethosor/df-multiscroll/releases/tag/0.44.05-r1-unofficial
Holy shit it's working, thank you!!

The only thing that's missing is "hold Cmd to zoom". Plugin reacts to a keypress like it should, it stops scrolling, but zoom not happening for some reason.

Possible workaround is to assign keyboard shortcuts to "load multiscroll / unload multiscroll".
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on February 15, 2018, 06:06:21 pm
Amazing plugin love it!

Would be amazing if it had Pinch In / Out:
Pinch in = Down 1-Z level
Pinch out = Up 1-Z level

Not sure how much of a trackpad input can be read, but 3 finger swipes up/down make more sense for z-level navigation.
Second (failsafe) option is to add another modifier key - Cmd to zoom tileset, Alt to navigate through z-levels, although the non-discrete input like scroll (or pinching) is shit for something like switching z-levels.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on February 15, 2018, 11:25:05 pm
It's outdated enough that it no longer compiles with DFHack for 0.44.05. I'll work on fixing it.

Edit: https://github.com/mifki/df-multiscroll/pull/1
And https://github.com/lethosor/df-multiscroll/releases/tag/0.44.05-r1-unofficial
Holy shit it's working, thank you!!

The only thing that's missing is "hold Cmd to zoom". Plugin reacts to a keypress like it should, it stops scrolling, but zoom not happening for some reason.

Possible workaround is to assign keyboard shortcuts to "load multiscroll / unload multiscroll".
Did you unbind DF's scroll to zoom bindings? I don't remember multiscroll dealing with zooming itself, so maybe it just allows those bindings to take effect.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on February 16, 2018, 05:05:46 am
Simple "unload multiscroll" brings back zooming, and it works with CMD pressed on. Looks like multiscroll recognizes the keypress, stops scrolling, but not returning input back to the game unless you unload it completely. Anyway, it's minor, thank you again for fixing it.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: jecowa on February 17, 2018, 09:00:47 pm
I like it. Map translation is a much better use for scrolling than changing the tile size, imo. Both horizontal and vertical scrolling work for me even though my MacBook doesn't have Multi-Touch.

Having [BUTTON:0:5] and [BUTTON:0:4] assigned in the interface.txt file seems to cause issues. Fricy adds [SYM:2:3] to zoom_in and [SYM:2:4] to zoom_out, which seems to fix the problem.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on February 19, 2018, 05:12:14 am
I've made a new "official" build, finally. https://github.com/mifki/df-multiscroll/releases
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on February 19, 2018, 09:41:35 am
Thank you! I can confirm that official build doesn't have a problem switching between scroll and zoom with Cmd held down.

P.S. Inertial multidirectional scroll is amazing. This is the best way to navigate the map in the history of PC gaming.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on February 19, 2018, 09:43:47 am
That's really strange. Are you also using TWBT or something?
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on February 19, 2018, 10:27:29 am
That's really strange. Are you also using TWBT or something?

Yes. mifki made changes to the multiscroll plugin code in his latest commit (https://github.com/mifki/df-multiscroll/commit/0d8dfb3bdbc7fcb56e84d78b676fa11ed7622f49), this is probably the reason why it works in the official build.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: lethosor on February 19, 2018, 12:59:36 pm
I saw that. That's why I asked. I didn't test anything with TWBT, so if you're using that, that could explain strange behavior.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: jecowa on February 19, 2018, 06:24:40 pm
Mifki, are you okay with Multiscroll being bundled with Lazy Newb Packs? I'm guessing this would also work for non-Mac users too since a lot of other laptops support two-finger scrolling.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: mifki on February 19, 2018, 08:35:53 pm
Mifki, are you okay with Multiscroll being bundled with Lazy Newb Packs? I'm guessing this would also work for non-Mac users too since a lot of other laptops support two-finger scrolling.

Well it's a purely Mac-specific code, so it won't. But I don't mind:)
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: jecowa on February 22, 2020, 04:29:59 am
I like this one. I hate when I accidentally zoom in with the touchpad. It's so much better using it to look around.
Title: Re: MultiScroll - dfhack plugin [OS X]
Post by: falcn on March 16, 2022, 11:37:21 pm
Can someone please recompile multiscroll for 0.47.05?