From 1fffc004e221a375ca4172bdb77133665752255e Mon Sep 17 00:00:00 2001 From: "D. Ben Knoble" Date: Sun, 7 Jan 2024 15:48:21 -0500 Subject: [PATCH] use the new rich-text-display in a few places --- gui/manager.rkt | 5 +++-- gui/monsters.rkt | 23 +++++++++++++++-------- gui/player-info.rkt | 9 ++++++--- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/gui/manager.rkt b/gui/manager.rkt index 5789d62..ba454bb 100644 --- a/gui/manager.rkt +++ b/gui/manager.rkt @@ -36,7 +36,8 @@ frosthaven-manager/gui/monsters frosthaven-manager/gui/render frosthaven-manager/gui/rewards - frosthaven-manager/gui/round-prompts) + frosthaven-manager/gui/round-prompts + frosthaven-manager/gui/rich-text-display) (define (manager s) (define @undo (make-undo s)) @@ -148,7 +149,7 @@ (cond-view [(@> @error-text non-empty-string?) (hpanel (text "Error message:" #:color "red") - (input @error-text #:style '(multiple)))] + (rich-text-display (@> @error-text list) #:min-size '(#f 60)))] [else (spacer)])) (hpanel #:stretch '(#t #f) #:alignment '(center center) diff --git a/gui/monsters.rkt b/gui/monsters.rkt index d221717..66aef78 100644 --- a/gui/monsters.rkt +++ b/gui/monsters.rkt @@ -47,6 +47,7 @@ frosthaven-manager/gui/font frosthaven-manager/gui/helpers frosthaven-manager/gui/table + frosthaven-manager/gui/rich-text-display frosthaven-manager/defns frosthaven-manager/manager @@ -107,7 +108,8 @@ (~a "Swap to "))) on-swap) (vpanel - (text (@~> @monster (~> monster-conditions conditions->string))) + (rich-text-display (@~> @monster (~> monster-conditions conditions->string list)) + #:min-size '(50 30)) (button "Edit Conditions" show-conditions)))) (define (monster-group-view @mg @ability-deck @monster-num @env @@ -261,15 +263,23 @@ (monsters))]))) (define (monster-ability-view @ability @mg @env) - (vpanel - (text (@~> @ability (~> monster-ability-name->text escape-text))) + (hpanel + (rich-text-display + (obs-combine + (λ (ability mg env) + (list* + (monster-ability-name->text ability) newline + (append* + (for/list ([ability-text (if ability (monster-ability-abilities ability) empty)]) + (list ((monster-ability-ability->text ability-text) mg env) newline))))) + @ability @mg @env) + #:min-size '(200 60)) (observable-view @ability (λ (ability) (apply vpanel (for/list ([ability-text (if ability (monster-ability-abilities ability) empty)]) - (hpanel (ability->text @mg ability-text @env) - (ability->extras @mg @ability ability-text)))))))) + (ability->extras @mg @ability ability-text))))))) ;; TODO: should be able to manipulate individual HP (? dialog with counter) ;; Takes a non-observable info-db b/c instantiated by a thunk in @@ -575,9 +585,6 @@ [monster-name (in-hash-keys monster-name->monster-info)]) (string-length monster-name)))) -(define (ability->text @mg ability @env) - (text (obs-combine (flow (~> (esc (monster-ability-ability->text ability)) escape-text)) @mg @env))) - (define (aoe-button pict) (button "AoE" (thunk (with-closing-custodian/eventspace diff --git a/gui/player-info.rkt b/gui/player-info.rkt index 7f53fa5..e5669c4 100644 --- a/gui/player-info.rkt +++ b/gui/player-info.rkt @@ -29,7 +29,8 @@ frosthaven-manager/gui/render frosthaven-manager/gui/mixins frosthaven-manager/gui/font - frosthaven-manager/gui/helpers) + frosthaven-manager/gui/helpers + frosthaven-manager/gui/rich-text-display) (define (player-input-views @num-players #:on-name [on-name void] @@ -119,7 +120,8 @@ (map make-condition-checkbox conditions))))) (define conditions-panel (vpanel - (text (@~> @player (~> player-conditions* conditions->string))) + (rich-text-display (@~> @player (~> player-conditions* conditions->string list)) + #:min-size '(50 30)) (button "Edit Conditions" show-conditions))) (define add-summon-button (button "Summon" (thunk (do-summon add-summon)))) @@ -177,7 +179,8 @@ (button "💀Kill💀" die) (text (escape-text (summon-name s))) (counter (summon->hp-text s) add-hp subtract-hp) - (text (~> (s) summon-conditions* conditions->string)) + (rich-text-display (~> (s) summon-conditions* conditions->string list) + #:min-size '(50 30)) (button "Edit Conditions" edit-conditions))) (define (do-summon add-summon)