From 9dbcaa2733878bf089ac12514ed22d9b8ebe27a9 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Wed, 6 Jun 2012 18:54:06 +0400 Subject: [PATCH] Support adventure mode and stockpile screens in focus strings. --- library/modules/Gui.cpp | 45 ++++++++++++++++++++++++++++++++++++++++- library/xml | 2 +- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index 111ea94c7..63ba811c1 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -58,12 +58,14 @@ using namespace DFHack; #include "df/viewscreen_layer_overall_healthst.h" #include "df/viewscreen_layer_assigntradest.h" #include "df/viewscreen_layer_militaryst.h" +#include "df/viewscreen_layer_stockpilest.h" #include "df/viewscreen_petst.h" #include "df/viewscreen_tradegoodsst.h" #include "df/viewscreen_storesst.h" #include "df/ui_unit_view_mode.h" #include "df/ui_sidebar_menus.h" #include "df/ui_look_list.h" +#include "df/ui_advmode.h" #include "df/job.h" #include "df/ui_build_selector.h" #include "df/building_workshopst.h" @@ -273,7 +275,9 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode) break; case Burrows: - if (ui->burrows.in_add_units_mode) + if (ui->burrows.in_confirm_delete) + focus += "/ConfirmDelete"; + else if (ui->burrows.in_add_units_mode) focus += "/AddUnits"; else if (ui->burrows.in_edit_name_mode) focus += "/EditName"; @@ -288,6 +292,16 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode) } } +DEFINE_GET_FOCUS_STRING_HANDLER(dungeonmode) +{ + using df::global::ui_advmode; + + if (!ui_advmode) + return; + + focus += "/" + enum_item_key(ui_advmode->menu); +} + DEFINE_GET_FOCUS_STRING_HANDLER(unitlist) { focus += "/" + enum_item_key(screen->page); @@ -407,6 +421,35 @@ DEFINE_GET_FOCUS_STRING_HANDLER(stores) focus += "/Items"; } +DEFINE_GET_FOCUS_STRING_HANDLER(layer_stockpile) +{ + auto list1 = getLayerList(screen, 0); + auto list2 = getLayerList(screen, 1); + auto list3 = getLayerList(screen, 2); + if (!list1 || !list2 || !list3 || !screen->settings) return; + + auto group = screen->cur_group; + if (group != vector_get(screen->group_ids, list1->cursor)) + return; + + focus += "/" + enum_item_key(group); + + auto bits = vector_get(screen->group_bits, list1->cursor); + if (bits.whole && !(bits.whole & screen->settings->flags.whole)) + { + focus += "/Off"; + return; + } + + focus += "/On"; + + if (list2->bright || list3->bright || screen->list_ids.empty()) { + focus += "/" + enum_item_key(screen->cur_list); + + if (list3->bright) + focus += (screen->item_names.empty() ? "/None" : "/Item"); + } +} std::string Gui::getFocusString(df::viewscreen *top) { diff --git a/library/xml b/library/xml index fc618cce6..0a0dc568d 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit fc618cce63f0037442ec8d650a11cbe823f0443a +Subproject commit 0a0dc568dff80396efd1b2c9a6ef1614df5786f7