forked from mia/Aegisub
Integer-edits in Auto 4 Lua config dialogues now always get spin buttons. If no min/max is specified, minint/maxint are assumed.
Originally committed to SVN as r2916.
This commit is contained in:
parent
0b4ecb9797
commit
55d5b668fa
1 changed files with 6 additions and 19 deletions
|
@ -332,6 +332,8 @@ namespace Automation4 {
|
||||||
nospin:
|
nospin:
|
||||||
if (!hasspin) {
|
if (!hasspin) {
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
min = MININT;
|
||||||
|
max = MAXINT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,32 +356,17 @@ nospin:
|
||||||
value = tmp;
|
value = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef wxValidator IntTextValidator; // TODO
|
|
||||||
wxControl *Create(wxWindow *parent)
|
wxControl *Create(wxWindow *parent)
|
||||||
{
|
{
|
||||||
if (hasspin) {
|
wxSpinCtrl *scw = new wxSpinCtrl(parent, -1, wxString::Format(_T("%d"), value), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, min, max, value);
|
||||||
wxSpinCtrl *scw = new wxSpinCtrl(parent, -1, wxString::Format(_T("%d"), value), wxDefaultPosition, wxDefaultSize, min, max, value);
|
scw->SetToolTip(hint);
|
||||||
scw->SetRange(min, max);
|
|
||||||
scw->SetValue(value);
|
|
||||||
cw = scw;
|
cw = scw;
|
||||||
} else {
|
|
||||||
cw = new wxTextCtrl(parent, -1, wxString::Format(_T("%d"), value), wxDefaultPosition, wxDefaultSize, 0); //, IntTextValidator());
|
|
||||||
}
|
|
||||||
cw->SetToolTip(hint);
|
|
||||||
return cw;
|
return cw;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlReadBack()
|
void ControlReadBack()
|
||||||
{
|
{
|
||||||
if (hasspin) {
|
|
||||||
value = ((wxSpinCtrl*)cw)->GetValue();
|
value = ((wxSpinCtrl*)cw)->GetValue();
|
||||||
} else {
|
|
||||||
long newval;
|
|
||||||
text = ((wxTextCtrl*)cw)->GetValue();
|
|
||||||
if (text.ToLong(&newval)) {
|
|
||||||
value = newval;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaReadBack(lua_State *L)
|
void LuaReadBack(lua_State *L)
|
||||||
|
|
Loading…
Reference in a new issue