@@ -1634,11 +1634,9 @@ void GUIFormSpecMenu::parseHyperText(parserData *data, const std::string &elemen
1634
1634
pos = getElementBasePos (&v_pos);
1635
1635
pos -= padding;
1636
1636
1637
- pos.X += stof (v_pos[0 ]) * spacing.X ;
1638
- pos.Y += stof (v_pos[1 ]) * spacing.Y + (m_btn_height * 2 );
1639
-
1640
1637
geom.X = (stof (v_geom[0 ]) * spacing.X ) - (spacing.X - imgsize.X );
1641
- geom.Y = (stof (v_geom[1 ]) * imgsize.Y ) - (spacing.Y - imgsize.Y );
1638
+ geom.Y = (stof (v_geom[1 ]) * (float )imgsize.Y ) - (spacing.Y - imgsize.Y );
1639
+ pos.Y += m_btn_height;
1642
1640
}
1643
1641
1644
1642
core::rect<s32> rect = core::rect<s32>(pos.X , pos.Y , pos.X + geom.X , pos.Y + geom.Y );
@@ -1653,7 +1651,7 @@ void GUIFormSpecMenu::parseHyperText(parserData *data, const std::string &elemen
1653
1651
258 + m_fields.size ()
1654
1652
);
1655
1653
1656
- spec.ftype = f_Unknown ;
1654
+ spec.ftype = f_HyperText ;
1657
1655
GUIHyperText *e = new GUIHyperText (spec.flabel .c_str (), Environment, this ,
1658
1656
spec.fid , rect, m_client, m_tsrc);
1659
1657
e->drop ();
@@ -3309,7 +3307,8 @@ void GUIFormSpecMenu::drawMenu()
3309
3307
}
3310
3308
3311
3309
#ifndef HAVE_TOUCHSCREENGUI
3312
- if (current_cursor_icon != field.fcursor_icon )
3310
+ if (field.ftype != f_HyperText && // Handled directly in guiHyperText
3311
+ current_cursor_icon != field.fcursor_icon )
3313
3312
cursor_control->setActiveIcon (field.fcursor_icon );
3314
3313
#endif
3315
3314
@@ -4235,9 +4234,9 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
4235
4234
(event.GUIEvent .EventType == gui::EGET_CHECKBOX_CHANGED) ||
4236
4235
(event.GUIEvent .EventType == gui::EGET_COMBO_BOX_CHANGED) ||
4237
4236
(event.GUIEvent .EventType == gui::EGET_SCROLL_BAR_CHANGED)) {
4238
- unsigned int btn_id = event.GUIEvent .Caller ->getID ();
4237
+ s32 caller_id = event.GUIEvent .Caller ->getID ();
4239
4238
4240
- if (btn_id == 257 ) {
4239
+ if (caller_id == 257 ) {
4241
4240
if (m_allowclose) {
4242
4241
acceptInput (quit_mode_accept);
4243
4242
quitMenu ();
@@ -4253,8 +4252,11 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
4253
4252
for (GUIFormSpecMenu::FieldSpec &s : m_fields) {
4254
4253
// if its a button, set the send field so
4255
4254
// lua knows which button was pressed
4256
- if ((s.ftype == f_Button || s.ftype == f_CheckBox) &&
4257
- s.fid == event.GUIEvent .Caller ->getID ()) {
4255
+
4256
+ if (caller_id != s.fid )
4257
+ continue ;
4258
+
4259
+ if (s.ftype == f_Button || s.ftype == f_CheckBox) {
4258
4260
s.send = true ;
4259
4261
if (s.is_exit ) {
4260
4262
if (m_allowclose) {
@@ -4270,8 +4272,7 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
4270
4272
s.send = false ;
4271
4273
return true ;
4272
4274
4273
- } else if ((s.ftype == f_DropDown) &&
4274
- (s.fid == event.GUIEvent .Caller ->getID ())) {
4275
+ } else if (s.ftype == f_DropDown) {
4275
4276
// only send the changed dropdown
4276
4277
for (GUIFormSpecMenu::FieldSpec &s2 : m_fields) {
4277
4278
if (s2.ftype == f_DropDown) {
@@ -4289,13 +4290,11 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event)
4289
4290
}
4290
4291
}
4291
4292
return true ;
4292
- } else if ((s.ftype == f_ScrollBar) &&
4293
- (s.fid == event.GUIEvent .Caller ->getID ())) {
4293
+ } else if (s.ftype == f_ScrollBar) {
4294
4294
s.fdefault = L" Changed" ;
4295
4295
acceptInput (quit_mode_no);
4296
4296
s.fdefault = L" " ;
4297
- } else if ((s.ftype == f_Unknown) &&
4298
- (s.fid == event.GUIEvent .Caller ->getID ())) {
4297
+ } else if (s.ftype == f_Unknown || s.ftype == f_HyperText) {
4299
4298
s.send = true ;
4300
4299
acceptInput ();
4301
4300
s.send = false ;
0 commit comments