Add choose buttons for the SDF fields in rectangle special nodes
This commit is contained in:
@@ -30,9 +30,11 @@
|
|||||||
<text size='large' top='102' left='8' width='158' height='16'>Stuff Done Flags:</text>
|
<text size='large' top='102' left='8' width='158' height='16'>Stuff Done Flags:</text>
|
||||||
<text name='sdf1-lbl' framed='true' top='121' left='22' width='220' height='15'/>
|
<text name='sdf1-lbl' framed='true' top='121' left='22' width='220' height='15'/>
|
||||||
<field name='sdf1' top='120' left='254' width='51' height='16'/>
|
<field name='sdf1' top='120' left='254' width='51' height='16'/>
|
||||||
|
<button name='sdf1-edit' type='tiny' top='106' left='272'/>
|
||||||
|
|
||||||
<text name='sdf2-lbl' framed='true' top='121' left='317' width='176' height='16'/>
|
<text name='sdf2-lbl' framed='true' top='121' left='317' width='176' height='16'/>
|
||||||
<field name='sdf2' top='120' left='510' width='51' height='16'/>
|
<field name='sdf2' top='120' left='510' width='51' height='16'/>
|
||||||
|
<button name='sdf2-edit' type='tiny' top='106' left='528'/>
|
||||||
|
|
||||||
|
|
||||||
<text size='large' top='141' left='8' width='176' height='16'>Message, Pict:</text>
|
<text size='large' top='141' left='8' width='176' height='16'>Message, Pict:</text>
|
||||||
|
@@ -516,14 +516,16 @@ static std::map<eSpecType, node_properties_t> loadProps() {
|
|||||||
props.p_btn = button_dict[j][3][k];
|
props.p_btn = button_dict[j][3][k];
|
||||||
props.pt_btn = button_dict[j][4][k];
|
props.pt_btn = button_dict[j][4][k];
|
||||||
if(category != eSpecCat::RECT) {
|
if(category != eSpecCat::RECT) {
|
||||||
|
props.sd1_btn = ' ';
|
||||||
props.x1a_btn = button_dict[j][5][k];
|
props.x1a_btn = button_dict[j][5][k];
|
||||||
props.x1b_btn = button_dict[j][6][k];
|
props.x1b_btn = button_dict[j][6][k];
|
||||||
}
|
} else props.sd1_btn = button_dict[j][5][k];
|
||||||
props.x1c_btn = button_dict[j][7][k];
|
props.x1c_btn = button_dict[j][7][k];
|
||||||
if(category != eSpecCat::RECT) {
|
if(category != eSpecCat::RECT) {
|
||||||
|
props.sd2_btn = ' ';
|
||||||
props.x2a_btn = button_dict[j][8][k];
|
props.x2a_btn = button_dict[j][8][k];
|
||||||
props.x2b_btn = button_dict[j][9][k];
|
props.x2b_btn = button_dict[j][9][k];
|
||||||
}
|
} else props.sd2_btn = button_dict[j][8][k];
|
||||||
props.x2c_btn = button_dict[j][10][k];
|
props.x2c_btn = button_dict[j][10][k];
|
||||||
if(category == eSpecCat::RECT) {
|
if(category == eSpecCat::RECT) {
|
||||||
props.x1a_btn = props.x2a_btn = ' ';
|
props.x1a_btn = props.x2a_btn = ' ';
|
||||||
|
@@ -65,7 +65,7 @@ struct node_properties_t {
|
|||||||
std::string ex1a_lbl() const, ex1b_lbl() const, ex1c_lbl() const, ex1a_hlp() const, ex1b_hlp() const, ex1c_hlp() const;
|
std::string ex1a_lbl() const, ex1b_lbl() const, ex1c_lbl() const, ex1a_hlp() const, ex1b_hlp() const, ex1c_hlp() const;
|
||||||
std::string ex2a_lbl() const, ex2b_lbl() const, ex2c_lbl() const, ex2a_hlp() const, ex2b_hlp() const, ex2c_hlp() const;
|
std::string ex2a_lbl() const, ex2b_lbl() const, ex2c_lbl() const, ex2a_hlp() const, ex2b_hlp() const, ex2c_hlp() const;
|
||||||
std::string jmp_lbl() const, jmp_hlp() const;
|
std::string jmp_lbl() const, jmp_hlp() const;
|
||||||
char m1_btn, m2_btn, m3_btn, p_btn, pt_btn;
|
char sd1_btn, sd2_btn, m1_btn, m2_btn, m3_btn, p_btn, pt_btn;
|
||||||
char x1a_btn, x1b_btn, x1c_btn, x2a_btn, x2b_btn, x2c_btn;
|
char x1a_btn, x1b_btn, x1c_btn, x2a_btn, x2b_btn, x2c_btn;
|
||||||
node_properties_t() {}
|
node_properties_t() {}
|
||||||
node_properties_t(std::initializer_list<std::function<void(node_properties_t)>>);
|
node_properties_t(std::initializer_list<std::function<void(node_properties_t)>>);
|
||||||
|
@@ -457,24 +457,22 @@ typedef std::stack<editing_node_t> node_stack_t;
|
|||||||
static void setup_node_field(cDialog& me, std::string field, short value, std::string label, char buttonType) {
|
static void setup_node_field(cDialog& me, std::string field, short value, std::string label, char buttonType) {
|
||||||
me[field + "-lbl"].setText(label);
|
me[field + "-lbl"].setText(label);
|
||||||
me[field].setTextToNum(value);
|
me[field].setTextToNum(value);
|
||||||
|
bool is_sdf = field.substr(0,3) == "sdf";
|
||||||
std::string button = field + "-edit";
|
std::string button = field + "-edit";
|
||||||
try { // Just make sure the button exists before fiddling with it.
|
|
||||||
me.getControl(button);
|
|
||||||
} catch(std::invalid_argument) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch(buttonType) {
|
switch(buttonType) {
|
||||||
case ' ':
|
case ' ':
|
||||||
me[button].hide();
|
me[button].hide();
|
||||||
break;
|
break;
|
||||||
case 'm': case 'M': case'$': case 'd': // messages
|
case 'm': case 'M': case '$': case 'd': // messages
|
||||||
case 's': case 'S': // specials
|
case 's': case 'S': // specials
|
||||||
me[button].show();
|
me[button].show();
|
||||||
|
if(is_sdf) break;
|
||||||
me[button].setText("Create/Edit");
|
me[button].setText("Create/Edit");
|
||||||
dynamic_cast<cButton&>(me[button]).setBtnType(BTN_LG);
|
dynamic_cast<cButton&>(me[button]).setBtnType(BTN_LG);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
me[button].show();
|
me[button].show();
|
||||||
|
if(is_sdf) break;
|
||||||
me[button].setText("Choose");
|
me[button].setText("Choose");
|
||||||
dynamic_cast<cButton&>(me[button]).setBtnType(BTN_REG);
|
dynamic_cast<cButton&>(me[button]).setBtnType(BTN_REG);
|
||||||
break;
|
break;
|
||||||
@@ -499,8 +497,8 @@ static void put_spec_enc_in_dlog(cDialog& me, node_stack_t& edit_stack) {
|
|||||||
|
|
||||||
node_properties_t info = *spec.type;
|
node_properties_t info = *spec.type;
|
||||||
// Set up the labels, fields, and buttons
|
// Set up the labels, fields, and buttons
|
||||||
setup_node_field(me, "sdf1", spec.sd1, info.sdf1_lbl(), ' ');
|
setup_node_field(me, "sdf1", spec.sd1, info.sdf1_lbl(), info.sd1_btn);
|
||||||
setup_node_field(me, "sdf2", spec.sd2, info.sdf2_lbl(), ' ');
|
setup_node_field(me, "sdf2", spec.sd2, info.sdf2_lbl(), info.sd2_btn);
|
||||||
|
|
||||||
setup_node_field(me, "msg1", spec.m1, info.msg1_lbl(), info.m1_btn);
|
setup_node_field(me, "msg1", spec.m1, info.msg1_lbl(), info.m1_btn);
|
||||||
setup_node_field(me, "msg2", spec.m2, info.msg2_lbl(), info.m2_btn);
|
setup_node_field(me, "msg2", spec.m2, info.msg2_lbl(), info.m2_btn);
|
||||||
@@ -731,7 +729,8 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
|
|||||||
std::string field = item_hit.substr(0, item_hit.find_first_of('-'));
|
std::string field = item_hit.substr(0, item_hit.find_first_of('-'));
|
||||||
char btn;
|
char btn;
|
||||||
eSpecType type = edit_stack.top().node.type;
|
eSpecType type = edit_stack.top().node.type;
|
||||||
if(field.substr(0,3) == "sdf") return true;
|
if(field == "sdf1") btn = (*type).sd1_btn;
|
||||||
|
else if(field == "sdf2") btn = (*type).sd2_btn;
|
||||||
else if(field == "msg1") btn = (*type).m1_btn;
|
else if(field == "msg1") btn = (*type).m1_btn;
|
||||||
else if(field == "msg2") btn = (*type).m2_btn;
|
else if(field == "msg2") btn = (*type).m2_btn;
|
||||||
else if(field == "msg3") btn = (*type).m3_btn;
|
else if(field == "msg3") btn = (*type).m3_btn;
|
||||||
@@ -882,6 +881,7 @@ bool edit_spec_enc(short which_node,short mode,cDialog* parent) {
|
|||||||
special.attachClickHandlers(std::bind(edit_spec_enc_value, _1, _2, std::ref(edit_stack)), {
|
special.attachClickHandlers(std::bind(edit_spec_enc_value, _1, _2, std::ref(edit_stack)), {
|
||||||
"msg1-edit", "msg2-edit", "msg3-edit", "pict-edit", "pictype-edit", "jump-edit",
|
"msg1-edit", "msg2-edit", "msg3-edit", "pict-edit", "pictype-edit", "jump-edit",
|
||||||
"x1a-edit", "x1b-edit", "x1c-edit", "x2a-edit", "x2b-edit", "x2c-edit",
|
"x1a-edit", "x1b-edit", "x1c-edit", "x2a-edit", "x2b-edit", "x2c-edit",
|
||||||
|
"sdf1-edit", "sdf2-edit",
|
||||||
});
|
});
|
||||||
special["cancel"].attachClickHandler(std::bind(discard_spec_enc, _1, std::ref(edit_stack)));
|
special["cancel"].attachClickHandler(std::bind(discard_spec_enc, _1, std::ref(edit_stack)));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user