From 7774f5f2c1b1e16b9bd3eefe0fd8b4287d03fef7 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sat, 19 May 2012 19:50:36 +0400 Subject: [PATCH] Add a mechanism converting ui focus to a string representation. The idea is to make ui handling more modular, dispensing with huge functions that switch or if/else on lots of variables. For now, used to split up functions in the sort plugin. --- LUA_API.rst | 9 + Lua API.html | 7 + library/LuaApi.cpp | 3 + library/MiscUtils.cpp | 24 ++ library/include/DataDefs.h | 3 + library/include/MiscUtils.h | 45 +++ library/include/modules/Gui.h | 4 + library/modules/Gui.cpp | 320 ++++++++++++++++++++ plugins/sort.cpp | 553 ++++++++++++++-------------------- 9 files changed, 648 insertions(+), 320 deletions(-) diff --git a/LUA_API.rst b/LUA_API.rst index 9ecd2e55e..59a52e596 100644 --- a/LUA_API.rst +++ b/LUA_API.rst @@ -613,6 +613,15 @@ can be omitted. Gui module ---------- +* ``dfhack.gui.getCurViewscreen()`` + + Returns the viewscreen that is current in the core. + +* ``dfhack.gui.getFocusString(viewscreen)`` + + Returns a string representation of the current focus position + in the ui. The string has a "screen/foo/bar/baz..." format. + * ``dfhack.gui.getSelectedWorkshopJob([silent])`` When a job is selected in *'q'* mode, returns the job, else diff --git a/Lua API.html b/Lua API.html index 7ce777c42..e2d4ec23e 100644 --- a/Lua API.html +++ b/Lua API.html @@ -868,6 +868,13 @@ can be omitted.

Gui module