Implement the inline special node help button
Though this creates the framework, the actual help strings have not been filled in yet.
This commit is contained in:
@@ -772,7 +772,7 @@ std::string node_properties_t::opcode() const {
|
||||
static std::string get_node_string(std::string base, eSpecType type, int which) {
|
||||
eSpecCat cat = getNodeCategory(type);
|
||||
int i = int(cat), j = int(type);
|
||||
int strnum = (j - offsets[i]) * 16 + which + 1;
|
||||
int strnum = (j - offsets[i]) * 17 + which + 1;
|
||||
switch(cat) {
|
||||
case eSpecCat::GENERAL:
|
||||
return get_str(base + "-general", strnum);
|
||||
@@ -798,6 +798,10 @@ std::string node_properties_t::name() const {
|
||||
return get_node_string("specials-text", self, 0);
|
||||
}
|
||||
|
||||
std::string node_properties_t::descr() const {
|
||||
return get_node_string("specials-text", self, 15);
|
||||
}
|
||||
|
||||
node_function_t::node_function_t() {}
|
||||
|
||||
node_function_t::node_function_t(char c) {
|
||||
|
@@ -969,6 +969,15 @@ bool edit_spec_enc(short which_node,short mode,cDialog* parent) {
|
||||
"sdf1-edit", "sdf2-edit",
|
||||
});
|
||||
special["cancel"].attachClickHandler(std::bind(discard_spec_enc, _1, std::ref(edit_stack)));
|
||||
special["node-help"].attachClickHandler([&edit_stack](cDialog& me, std::string item_hit, eKeyMod mods) {
|
||||
eSpecType type = edit_stack.top().node.type;
|
||||
const std::string& str = (*type).descr();
|
||||
// TODO: This is the same dialog as give_help(), the only difference being that we don't have a string number!
|
||||
cStrDlog display_help(str,"","Instant Help",24,PIC_DLOG, &me);
|
||||
display_help.setSound(57);
|
||||
display_help.show();
|
||||
return true;
|
||||
});
|
||||
|
||||
special["back"].hide();
|
||||
edit_stack.push({which_node,mode,the_node});
|
||||
|
Reference in New Issue
Block a user