Dialog XML definitions are now loaded thru the resource manager
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include "dialogxml/dialogs/choicedlog.hpp"
|
||||
#include "tools/winutil.hpp"
|
||||
#include "fileio/fileio.hpp"
|
||||
#include "fileio/resmgr/res_dialog.hpp"
|
||||
#include "fileio/resmgr/res_strings.hpp"
|
||||
#include "dialogxml/widgets/scrollbar.hpp"
|
||||
#include "dialogxml/widgets/button.hpp"
|
||||
@@ -628,7 +629,7 @@ static void fill_job_bank(cDialog& me, job_bank_t& bank, std::string) {
|
||||
}
|
||||
|
||||
static void show_job_bank(int which_bank, std::string title) {
|
||||
cDialog job_dlg("job-bank");
|
||||
cDialog job_dlg(*ResMgr::dialogs.get("job-bank"));
|
||||
job_dlg.attachClickHandlers([&](cDialog& me, std::string hit, eKeyMod) -> bool {
|
||||
int which = hit[4] - '1';
|
||||
me["prompt"].setText("Job accepted.");
|
||||
@@ -1153,7 +1154,7 @@ static bool prefs_event_filter (cDialog& me, std::string id, eKeyMod) {
|
||||
void pick_preferences() {
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog prefsDlog("preferences");
|
||||
cDialog prefsDlog(*ResMgr::dialogs.get("preferences"));
|
||||
prefsDlog.attachClickHandlers(&prefs_event_filter, {"okay", "cancel"});
|
||||
|
||||
cLedGroup& displayMode = dynamic_cast<cLedGroup&>(prefsDlog["display"]);
|
||||
@@ -1291,7 +1292,7 @@ static bool edit_party_event_filter(cDialog& me, std::string item_hit, eKeyMod)
|
||||
void edit_party() {
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog pcDialog("edit-party");
|
||||
cDialog pcDialog(*ResMgr::dialogs.get("edit-party"));
|
||||
std::vector<std::string> buttons = {"done", "help"};
|
||||
for(int i = 1; i <= 6; i++) {
|
||||
std::string n = boost::lexical_cast<std::string>(i);
|
||||
@@ -1337,7 +1338,7 @@ void tip_of_day() {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog tips("tip-of-day");
|
||||
cDialog tips(*ResMgr::dialogs.get("tip-of-day"));
|
||||
tips.attachClickHandlers(std::bind(tip_of_day_event_filter, _1, _2, std::ref(page)),{"done","next"});
|
||||
|
||||
tips["tip"].setText(get_str("tips",50 + page));
|
||||
@@ -1352,7 +1353,7 @@ void tip_of_day() {
|
||||
}
|
||||
|
||||
class cChooseScenario {
|
||||
cDialog me{"pick-scenario"};
|
||||
cDialog me{*ResMgr::dialogs.get("pick-scenario")};
|
||||
std::vector<scen_header_type> scen_headers;
|
||||
void put_scen_info() {
|
||||
std::ostringstream sout;
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "dialogxml/dialogs/strdlog.hpp"
|
||||
#include "dialogxml/widgets/button.hpp"
|
||||
#include "fileio/fileio.hpp"
|
||||
#include "fileio/resmgr/res_dialog.hpp"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "tools/prefs.hpp"
|
||||
#include "spell.hpp"
|
||||
@@ -119,7 +120,7 @@ void display_spells(eSkill mode,short force_spell,cDialog* parent) {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog spellInfo("spell-info", parent);
|
||||
cDialog spellInfo(*ResMgr::dialogs.get("spell-info"), parent);
|
||||
spellInfo.attachClickHandlers(std::bind(display_spells_event_filter,_1,_2,mode), {"done","left","right"});
|
||||
|
||||
dynamic_cast<cPict&>(spellInfo["icon"]).setPict(mode == eSkill::MAGE_SPELLS ? 14 : 15);
|
||||
@@ -175,7 +176,7 @@ void display_skills(eSkill force_skill,cDialog* parent) {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog skillDlog("skill-info", parent);
|
||||
cDialog skillDlog(*ResMgr::dialogs.get("skill-info"), parent);
|
||||
skillDlog.attachClickHandlers(display_skills_event_filter,{"done", "left", "right"});
|
||||
|
||||
put_skill_info(skillDlog);
|
||||
@@ -211,7 +212,7 @@ void display_pc_item(short pc_num,short item,cItem si,cDialog* parent) {
|
||||
else store_i = univ.party[pc_num].items[item];
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog itemInfo("item-info",parent);
|
||||
cDialog itemInfo(*ResMgr::dialogs.get("item-info"),parent);
|
||||
// By attaching the click handler to "id" and "magic", we suppress normal LED behaviour
|
||||
itemInfo.attachClickHandlers(std::bind(display_pc_item_event_filter, _1, _2, std::ref(store_i), std::ref(item), pc_num), {"done","left","right","id","magic"});
|
||||
|
||||
@@ -267,7 +268,7 @@ void display_monst(short array_pos,cCreature *which_m,short mode) {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog monstInfo("monster-info");
|
||||
cDialog monstInfo(*ResMgr::dialogs.get("monster-info"));
|
||||
auto event_filter = std::bind(display_monst_event_filter, _1, _2,std::ref(store_m));
|
||||
monstInfo["done"].attachClickHandler(std::bind(&cDialog::toast, &monstInfo, true));
|
||||
monstInfo.attachClickHandlers(event_filter, {"left", "right"});
|
||||
@@ -310,7 +311,7 @@ void display_alchemy() {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog alchemy("many-str");
|
||||
cDialog alchemy(*ResMgr::dialogs.get("many-str"));
|
||||
alchemy.attachClickHandlers(display_alchemy_event_filter, {"done", "left", "right"});
|
||||
|
||||
get_text = get_str("alchemy", 1);
|
||||
@@ -445,7 +446,7 @@ void give_pc_info(short pc_num) {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog pcInfo("pc-info");
|
||||
cDialog pcInfo(*ResMgr::dialogs.get("pc-info"));
|
||||
pcInfo.attachClickHandlers(std::bind(give_pc_info_event_filter, _1, _2, std::ref(pc_num)), {"done", "left", "right"});
|
||||
pcInfo.attachClickHandlers(std::bind(give_pc_extra_info, _1, _2, std::ref(pc_num)), {"seemage", "seepriest", "trait", "seealch"});
|
||||
|
||||
@@ -511,7 +512,7 @@ void adventure_notes() {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog encNotes("adventure-notes");
|
||||
cDialog encNotes(*ResMgr::dialogs.get("adventure-notes"));
|
||||
encNotes.attachClickHandlers(adventure_notes_event_filter, {"done", "left", "right", "del1", "del2", "del3"});
|
||||
|
||||
for(short i = 0; i < 3; i++) {
|
||||
@@ -571,7 +572,7 @@ void talk_notes() {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog talkNotes("talk-notes");
|
||||
cDialog talkNotes(*ResMgr::dialogs.get("talk-notes"));
|
||||
talkNotes.attachClickHandlers(talk_notes_event_filter, {"done", "left", "right", "del"});
|
||||
|
||||
put_talk(talkNotes);
|
||||
@@ -624,7 +625,7 @@ void journal() {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog journal("event-journal");
|
||||
cDialog journal(*ResMgr::dialogs.get("event-journal"));
|
||||
journal.attachClickHandlers(journal_event_filter, {"done", "left", "right"});
|
||||
|
||||
fill_journal(journal);
|
||||
@@ -672,7 +673,7 @@ void give_help(short help1, short help2, cDialog& parent) {
|
||||
|
||||
void put_quest_info(short which_i) {
|
||||
cQuest& quest = univ.scenario.quests[which_i];
|
||||
cDialog quest_dlg("quest-info");
|
||||
cDialog quest_dlg(*ResMgr::dialogs.get("quest-info"));
|
||||
quest_dlg["name"].setText(quest.name);
|
||||
quest_dlg["descr"].setText(quest.descr);
|
||||
int start = univ.party.active_quests[which_i].start;
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "tools/winutil.hpp"
|
||||
#include "tools/cursors.hpp"
|
||||
#include "fileio/resmgr/res_dialog.hpp"
|
||||
|
||||
extern short which_combat_type;
|
||||
extern eGameMode overall_mode;
|
||||
@@ -556,7 +557,7 @@ bool show_get_items(std::string titleText, std::vector<cItem*>& itemRefs, short
|
||||
using namespace std::placeholders;
|
||||
size_t first_item = 0;
|
||||
|
||||
cDialog itemDialog("get-items");
|
||||
cDialog itemDialog(*ResMgr::dialogs.get("get-items"));
|
||||
auto handler = std::bind(display_item_event_filter, _1, _2, std::ref(first_item), std::ref(pc_getting), std::ref(itemRefs), overload);
|
||||
itemDialog.attachClickHandlers(handler, {"done", "up", "down"});
|
||||
itemDialog.attachClickHandlers(handler, {"pc1", "pc2", "pc3", "pc4", "pc5", "pc6"});
|
||||
@@ -602,7 +603,7 @@ short custom_choice_dialog(std::array<std::string, 6>& strs,short pic_num,ePicTy
|
||||
}
|
||||
|
||||
void custom_pic_dialog(std::string title, pic_num_t bigpic) {
|
||||
cDialog pic_dlg("show-map");
|
||||
cDialog pic_dlg(*ResMgr::dialogs.get("show-map"));
|
||||
cControl& okay = pic_dlg["okay"];
|
||||
cControl& text = pic_dlg["title"];
|
||||
okay.attachClickHandler(std::bind(&cDialog::toast, &pic_dlg, false));
|
||||
@@ -625,7 +626,7 @@ void custom_pic_dialog(std::string title, pic_num_t bigpic) {
|
||||
}
|
||||
|
||||
void story_dialog(std::string title, str_num_t first, str_num_t last, eSpecCtxType which_str_type, pic_num_t pic, ePicType pt) {
|
||||
cDialog story_dlg("many-str");
|
||||
cDialog story_dlg(*ResMgr::dialogs.get("many-str"));
|
||||
dynamic_cast<cPict&>(story_dlg["pict"]).setPict(pic, pt);
|
||||
str_num_t cur = first;
|
||||
story_dlg.attachClickHandlers([&cur,first,last,which_str_type](cDialog& me, std::string clicked, eKeyMod) -> bool {
|
||||
@@ -661,7 +662,7 @@ static bool get_num_of_items_event_filter(cDialog& me, std::string, eKeyMod) {
|
||||
short get_num_of_items(short max_num) {
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog numPanel("get-num");
|
||||
cDialog numPanel(*ResMgr::dialogs.get("get-num"));
|
||||
numPanel.attachClickHandlers(get_num_of_items_event_filter, {"okay"});
|
||||
|
||||
numPanel["prompt"].setText("How many? (0-" + std::to_string(max_num) + ") ");
|
||||
@@ -841,7 +842,7 @@ static bool get_text_response_event_filter(cDialog& me, std::string, eKeyMod) {
|
||||
std::string get_text_response(std::string prompt, pic_num_t pic) {
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog strPanel("get-response");
|
||||
cDialog strPanel(*ResMgr::dialogs.get("get-response"));
|
||||
strPanel.attachClickHandlers(get_text_response_event_filter, {"okay"});
|
||||
if(!prompt.empty()) {
|
||||
dynamic_cast<cPict&>(strPanel["pic"]).setPict(pic);
|
||||
@@ -861,7 +862,7 @@ short get_num_response(short min, short max, std::string prompt) {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog numPanel("get-num");
|
||||
cDialog numPanel(*ResMgr::dialogs.get("get-num"));
|
||||
numPanel.attachClickHandlers(get_num_of_items_event_filter, {"okay"});
|
||||
|
||||
sout << " (" << min << '-' << max << ')';
|
||||
@@ -898,7 +899,7 @@ short char_select_pc(short mode,const char *title) {
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog selectPc("select-pc");
|
||||
cDialog selectPc(*ResMgr::dialogs.get("select-pc"));
|
||||
selectPc.attachClickHandlers(select_pc_event_filter, {"cancel", "pick1", "pick2", "pick3", "pick4", "pick5", "pick6"});
|
||||
|
||||
selectPc["title"].setText(title);
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "dialogxml/dialogs/pictchoice.hpp"
|
||||
#include "tools/winutil.hpp"
|
||||
#include "fileio/fileio.hpp"
|
||||
#include "fileio/resmgr/res_dialog.hpp"
|
||||
#include "boe.menus.hpp"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include "dialogxml/widgets/button.hpp"
|
||||
@@ -1974,7 +1975,7 @@ eSpell pick_spell(short pc_num,eSkill type) { // 70 - no spell OW spell num
|
||||
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog castSpell("cast-spell");
|
||||
cDialog castSpell(*ResMgr::dialogs.get("cast-spell"));
|
||||
|
||||
castSpell.attachClickHandlers(std::bind(pick_spell_caster, _1, _2, type, std::ref(dark), std::ref(former_spell)), {"caster1","caster2","caster3","caster4","caster5","caster6"});
|
||||
castSpell.attachClickHandlers(std::bind(pick_spell_target,_1,_2, type, dark, former_spell), {"target1","target2","target3","target4","target5","target6"});
|
||||
@@ -2135,7 +2136,7 @@ eAlchemy alch_choice(short pc_num) {
|
||||
|
||||
store_alchemy_pc = pc_num;
|
||||
|
||||
cDialog chooseAlchemy("pick-potion");
|
||||
cDialog chooseAlchemy(*ResMgr::dialogs.get("pick-potion"));
|
||||
chooseAlchemy.attachClickHandlers(alch_choice_event_filter, {"cancel", "help"});
|
||||
for(short i = 0; i < 20; i++) {
|
||||
std::string n = boost::lexical_cast<std::string>(i + 1);
|
||||
@@ -2195,7 +2196,7 @@ bool pick_pc_name(short pc_num,cDialog* parent) {
|
||||
using namespace std::placeholders;
|
||||
set_cursor(sword_curs);
|
||||
|
||||
cDialog pcPickName("pick-pc-name", parent);
|
||||
cDialog pcPickName(*ResMgr::dialogs.get("pick-pc-name"), parent);
|
||||
pcPickName["name"].setText(univ.party[pc_num].name);
|
||||
pcPickName["okay"].attachClickHandler(std::bind(pc_name_event_filter, _1, pc_num));
|
||||
|
||||
|
Reference in New Issue
Block a user