From 9fce736edceac48ed5a2677118e44ec500a64a75 Mon Sep 17 00:00:00 2001 From: mqrause Date: Thu, 2 May 2024 14:29:03 +0200 Subject: [PATCH] enable imgui iteminfo on examine in inventory selector, aim and crafting menu --- src/advanced_inv.cpp | 7 ++++--- src/crafting_gui.cpp | 12 +++++++----- src/inventory_ui.cpp | 11 ++++++----- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/advanced_inv.cpp b/src/advanced_inv.cpp index 3f947f9ef7942..472fcc73fee81 100644 --- a/src/advanced_inv.cpp +++ b/src/advanced_inv.cpp @@ -60,6 +60,7 @@ #include "translations.h" #include "type_id.h" #include "ui.h" +#include "ui_iteminfo.h" #include "ui_manager.h" #include "uistate.h" #include "units.h" @@ -1792,10 +1793,10 @@ void advanced_inventory::action_examine( advanced_inv_listitem *sitem, item_info_data data( it.tname(), it.type_name(), vThisItem, vDummy ); data.handle_scrolling = true; + data.arrow_scrolling = true; - ret = draw_item_info( [&]() -> catacurses::window { - return catacurses::newwin( 0, info_width(), point( info_startx(), 0 ) ); - }, data ).get_first_input(); + iteminfo_window info_window( data, point( info_startx(), 0 ), info_width(), TERMY ); + info_window.execute(); } if( ret == KEY_NPAGE || ret == KEY_DOWN ) { spane.scroll_by( +1 ); diff --git a/src/crafting_gui.cpp b/src/crafting_gui.cpp index 06a15c5d356e9..7643b38f69293 100644 --- a/src/crafting_gui.cpp +++ b/src/crafting_gui.cpp @@ -59,6 +59,7 @@ #include "translations.h" #include "type_id.h" #include "ui.h" +#include "ui_iteminfo.h" #include "ui_manager.h" #include "uistate.h" @@ -1865,11 +1866,12 @@ std::pair select_crafter_and_crafting_recipe( int & item_info_data data = result_info.get_result_data( current[line], 1, line_item_info_popup, w_iteminfo ); data.handle_scrolling = true; - draw_item_info( []() -> catacurses::window { - const int width = std::min( TERMX, FULL_SCREEN_WIDTH ); - const int height = std::min( TERMY, FULL_SCREEN_HEIGHT ); - return catacurses::newwin( height, width, point( ( TERMX - width ) / 2, ( TERMY - height ) / 2 ) ); - }, data ); + data.arrow_scrolling = true; + const int info_width = std::min( TERMX, FULL_SCREEN_WIDTH ); + const int info_height = std::min( TERMY, FULL_SCREEN_HEIGHT ); + iteminfo_window info_window( data, point( ( TERMX - info_width ) / 2, ( TERMY - info_height ) / 2 ), + info_width, info_height ); + info_window.execute(); } else if( action == "FILTER" ) { int max_example_length = 0; for( const auto &prefix : prefixes ) { diff --git a/src/inventory_ui.cpp b/src/inventory_ui.cpp index ca45c87b48a1e..0146fb152f673 100644 --- a/src/inventory_ui.cpp +++ b/src/inventory_ui.cpp @@ -40,6 +40,7 @@ #include "translations.h" #include "type_id.h" #include "uistate.h" +#include "ui_iteminfo.h" #include "ui_manager.h" #include "units.h" #include "units_utility.h" @@ -3476,11 +3477,11 @@ void inventory_selector::action_examine( const item_location &sitem ) item_info_data data( sitem->tname(), sitem->type_name(), vThisItem, vDummy ); data.handle_scrolling = true; - draw_item_info( [&]() -> catacurses::window { - int maxwidth = std::max( FULL_SCREEN_WIDTH, TERMX ); - int width = std::min( 80, maxwidth ); - return catacurses::newwin( 0, width, point( maxwidth / 2 - width / 2, 0 ) ); }, - data ).get_first_input(); + data.arrow_scrolling = true; + int maxwidth = std::max( FULL_SCREEN_WIDTH, TERMX ); + int width = std::min( 80, maxwidth ); + iteminfo_window info_window( data, point( maxwidth / 2 - width / 2, -1 ), width, 0 ); + info_window.execute(); } void inventory_selector::highlight()