Any news on this? I would really like to address this at some point to stop TwbT from breaking so many other tools, and to avoid the need for the separate automaterial/mousequery/resume plugins. I may be able to help with this in a week or two, if you need help, but there's an example for at least one of the relevant hooks in plugins/devel/color-dfhack-text.cpp.
Hi mifki, I have a question about some of the sorcery behind rendering the screen. When I use
dm = require('gui.dwarfmode')
size_x = dm.getPanelLayout().map.width
size_y = dm.getPanelLayout().map.height
in most modes, I get the size of map panel in tiles. But in TWBT mode the width seems to be much wider than the actual display, but otherwise acting normally (i.e., the reported width is higher when the minimap is suppressed). My wild guess is that the reported width is the panel's width in text tiles.
...
DFHack offers a way to hook into Gui::getDwarfmodeViewDims(), the C++ equivalent of getPanelLayout(). The problem here is twofold:
a) The Lua version calculates stuff itself, rather than calling the C++ function, which means it can't be hooked into.
b) TwbT doesn't actually hook into that function in the first place (it distributes a couple modified plugins instead)
I suspect that TwbT hooking in and making the Lua function delegate to the C++ function would solve the issue.
mifki: I'm kind of busy this week (hoping to get r1 done!), but feel free to stop by #dfhack or something and I can try to help with the hooks. As far as I remember, you'll only need to add a few functions to twbt.cpp, and that'll fix some issues with Lua scripts and eliminate the need to distribute automaterial/mousequery/resume. (There's an example in devel/color-dfhack-text.cpp if you want to play around with it - not sure if it provides an example of the getDwarfmodeViewDims() hook, but it should at least be similar.)