mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Restructure dlgcontrol as a struct with an anon union.
This gets rid of that awkward STANDARD_PREFIX system in which every branch of the old 'union control' had to repeat all the generic fields, and then call sites had to make an arbitrary decision about which branch to access them through. That was the best we could do before accepting C99 features in this code base. But now we have anonymous unions, so we don't need to put up with that nonsense any more! 'dlgcontrol' is now a struct rather than a union, and the generic fields common to all control types are ordinary members of the struct, so you don't have to refer to them as ctrl->generic.foo at all, just ctrl->foo, which saves verbiage at the point of use. The extra per-control fields are still held in structures named after the control type, so you'll still say ctrl->listbox.height or whatever. But now those structures are themselves members of an anonymous union field following the generic fields, so those sub-structures don't have to reiterate all the standard stuff too. While I'm here, I've promoted 'context2' from an editbox-specific field to a generic one (it just seems silly _not_ to allow any control to have two context fields if it needs it). Also, I had to rename the boolean field 'tabdelay' to avoid it clashing with the subsidiary structure field 'tabdelay', now that the former isn't generic.tabdelay any more.
This commit is contained in:
parent
77d15c46c3
commit
89883bf158
180
config.c
180
config.c
@ -29,7 +29,7 @@ void conf_radiobutton_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
* is the one selected.
|
* is the one selected.
|
||||||
*/
|
*/
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
int val = conf_get_int(conf, ctrl->radio.context.i);
|
int val = conf_get_int(conf, ctrl->context.i);
|
||||||
for (button = 0; button < ctrl->radio.nbuttons; button++)
|
for (button = 0; button < ctrl->radio.nbuttons; button++)
|
||||||
if (val == ctrl->radio.buttondata[button].i)
|
if (val == ctrl->radio.buttondata[button].i)
|
||||||
break;
|
break;
|
||||||
@ -39,7 +39,7 @@ void conf_radiobutton_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
} else if (event == EVENT_VALCHANGE) {
|
} else if (event == EVENT_VALCHANGE) {
|
||||||
button = dlg_radiobutton_get(ctrl, dlg);
|
button = dlg_radiobutton_get(ctrl, dlg);
|
||||||
assert(button >= 0 && button < ctrl->radio.nbuttons);
|
assert(button >= 0 && button < ctrl->radio.nbuttons);
|
||||||
conf_set_int(conf, ctrl->radio.context.i,
|
conf_set_int(conf, ctrl->context.i,
|
||||||
ctrl->radio.buttondata[button].i);
|
ctrl->radio.buttondata[button].i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ void conf_radiobutton_bool_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
* config option.
|
* config option.
|
||||||
*/
|
*/
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
int val = conf_get_bool(conf, ctrl->radio.context.i);
|
int val = conf_get_bool(conf, ctrl->context.i);
|
||||||
for (button = 0; button < ctrl->radio.nbuttons; button++)
|
for (button = 0; button < ctrl->radio.nbuttons; button++)
|
||||||
if (val == ctrl->radio.buttondata[button].i)
|
if (val == ctrl->radio.buttondata[button].i)
|
||||||
break;
|
break;
|
||||||
@ -66,7 +66,7 @@ void conf_radiobutton_bool_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
} else if (event == EVENT_VALCHANGE) {
|
} else if (event == EVENT_VALCHANGE) {
|
||||||
button = dlg_radiobutton_get(ctrl, dlg);
|
button = dlg_radiobutton_get(ctrl, dlg);
|
||||||
assert(button >= 0 && button < ctrl->radio.nbuttons);
|
assert(button >= 0 && button < ctrl->radio.nbuttons);
|
||||||
conf_set_bool(conf, ctrl->radio.context.i,
|
conf_set_bool(conf, ctrl->context.i,
|
||||||
ctrl->radio.buttondata[button].i);
|
ctrl->radio.buttondata[button].i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ void conf_checkbox_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
* For a standard checkbox, the context parameter gives the
|
* For a standard checkbox, the context parameter gives the
|
||||||
* primary key (CONF_foo), optionally ORed with CHECKBOX_INVERT.
|
* primary key (CONF_foo), optionally ORed with CHECKBOX_INVERT.
|
||||||
*/
|
*/
|
||||||
key = ctrl->checkbox.context.i;
|
key = ctrl->context.i;
|
||||||
if (key & CHECKBOX_INVERT) {
|
if (key & CHECKBOX_INVERT) {
|
||||||
key &= ~CHECKBOX_INVERT;
|
key &= ~CHECKBOX_INVERT;
|
||||||
invert = true;
|
invert = true;
|
||||||
@ -120,8 +120,8 @@ void conf_editbox_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
* context2 == -1000, then typing 1.2 into the box will set
|
* context2 == -1000, then typing 1.2 into the box will set
|
||||||
* the field to 1200.)
|
* the field to 1200.)
|
||||||
*/
|
*/
|
||||||
int key = ctrl->editbox.context.i;
|
int key = ctrl->context.i;
|
||||||
int length = ctrl->editbox.context2.i;
|
int length = ctrl->context2.i;
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
|
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
@ -156,7 +156,7 @@ void conf_editbox_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
void conf_filesel_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
void conf_filesel_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
int key = ctrl->fileselect.context.i;
|
int key = ctrl->context.i;
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
|
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
@ -172,7 +172,7 @@ void conf_filesel_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
void conf_fontsel_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
void conf_fontsel_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
int key = ctrl->fontselect.context.i;
|
int key = ctrl->context.i;
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
|
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
@ -274,7 +274,7 @@ static void config_protocols_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
int curproto = conf_get_int(conf, CONF_protocol);
|
int curproto = conf_get_int(conf, CONF_protocol);
|
||||||
struct hostport *hp = (struct hostport *)ctrl->generic.context.p;
|
struct hostport *hp = (struct hostport *)ctrl->context.p;
|
||||||
|
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
/*
|
/*
|
||||||
@ -716,7 +716,7 @@ static void sshbug_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
* spurious SELCHANGE we trigger in the process will overwrite
|
* spurious SELCHANGE we trigger in the process will overwrite
|
||||||
* the value we wanted to keep.
|
* the value we wanted to keep.
|
||||||
*/
|
*/
|
||||||
int oldconf = conf_get_int(conf, ctrl->listbox.context.i);
|
int oldconf = conf_get_int(conf, ctrl->context.i);
|
||||||
dlg_update_start(ctrl, dlg);
|
dlg_update_start(ctrl, dlg);
|
||||||
dlg_listbox_clear(ctrl, dlg);
|
dlg_listbox_clear(ctrl, dlg);
|
||||||
dlg_listbox_addwithid(ctrl, dlg, "Auto", AUTO);
|
dlg_listbox_addwithid(ctrl, dlg, "Auto", AUTO);
|
||||||
@ -734,7 +734,7 @@ static void sshbug_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
i = AUTO;
|
i = AUTO;
|
||||||
else
|
else
|
||||||
i = dlg_listbox_getid(ctrl, dlg, i);
|
i = dlg_listbox_getid(ctrl, dlg, i);
|
||||||
conf_set_int(conf, ctrl->listbox.context.i, i);
|
conf_set_int(conf, ctrl->context.i, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,7 +749,7 @@ static void sshbug_handler_manual_only(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
*/
|
*/
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
int oldconf = conf_get_int(conf, ctrl->listbox.context.i);
|
int oldconf = conf_get_int(conf, ctrl->context.i);
|
||||||
dlg_update_start(ctrl, dlg);
|
dlg_update_start(ctrl, dlg);
|
||||||
dlg_listbox_clear(ctrl, dlg);
|
dlg_listbox_clear(ctrl, dlg);
|
||||||
dlg_listbox_addwithid(ctrl, dlg, "Off", FORCE_OFF);
|
dlg_listbox_addwithid(ctrl, dlg, "Off", FORCE_OFF);
|
||||||
@ -765,7 +765,7 @@ static void sshbug_handler_manual_only(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
i = FORCE_OFF;
|
i = FORCE_OFF;
|
||||||
else
|
else
|
||||||
i = dlg_listbox_getid(ctrl, dlg, i);
|
i = dlg_listbox_getid(ctrl, dlg, i);
|
||||||
conf_set_int(conf, ctrl->listbox.context.i, i);
|
conf_set_int(conf, ctrl->context.i, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,7 +818,7 @@ static void sessionsaver_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
struct sessionsaver_data *ssd =
|
struct sessionsaver_data *ssd =
|
||||||
(struct sessionsaver_data *)ctrl->generic.context.p;
|
(struct sessionsaver_data *)ctrl->context.p;
|
||||||
|
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
if (ctrl == ssd->editbox) {
|
if (ctrl == ssd->editbox) {
|
||||||
@ -959,7 +959,7 @@ static void charclass_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
struct charclass_data *ccd =
|
struct charclass_data *ccd =
|
||||||
(struct charclass_data *)ctrl->generic.context.p;
|
(struct charclass_data *)ctrl->context.p;
|
||||||
|
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
if (ctrl == ccd->listbox) {
|
if (ctrl == ccd->listbox) {
|
||||||
@ -1008,7 +1008,7 @@ static void colour_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
struct colour_data *cd =
|
struct colour_data *cd =
|
||||||
(struct colour_data *)ctrl->generic.context.p;
|
(struct colour_data *)ctrl->context.p;
|
||||||
bool update = false, clear = false;
|
bool update = false, clear = false;
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
|
|
||||||
@ -1117,7 +1117,7 @@ static void ttymodes_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
struct ttymodes_data *td =
|
struct ttymodes_data *td =
|
||||||
(struct ttymodes_data *)ctrl->generic.context.p;
|
(struct ttymodes_data *)ctrl->context.p;
|
||||||
|
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
if (ctrl == td->listbox) {
|
if (ctrl == td->listbox) {
|
||||||
@ -1202,7 +1202,7 @@ static void environ_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
struct environ_data *ed =
|
struct environ_data *ed =
|
||||||
(struct environ_data *)ctrl->generic.context.p;
|
(struct environ_data *)ctrl->context.p;
|
||||||
|
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
if (ctrl == ed->listbox) {
|
if (ctrl == ed->listbox) {
|
||||||
@ -1278,7 +1278,7 @@ static void portfwd_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
struct portfwd_data *pfd =
|
struct portfwd_data *pfd =
|
||||||
(struct portfwd_data *)ctrl->generic.context.p;
|
(struct portfwd_data *)ctrl->context.p;
|
||||||
|
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
if (ctrl == pfd->listbox) {
|
if (ctrl == pfd->listbox) {
|
||||||
@ -1442,7 +1442,7 @@ static void manual_hostkey_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
struct manual_hostkey_data *mh =
|
struct manual_hostkey_data *mh =
|
||||||
(struct manual_hostkey_data *)ctrl->generic.context.p;
|
(struct manual_hostkey_data *)ctrl->context.p;
|
||||||
|
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
if (ctrl == mh->listbox) {
|
if (ctrl == mh->listbox) {
|
||||||
@ -1504,9 +1504,9 @@ static void clipboard_selector_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
int setting = ctrl->generic.context.i;
|
int setting = ctrl->context.i;
|
||||||
#ifdef NAMED_CLIPBOARDS
|
#ifdef NAMED_CLIPBOARDS
|
||||||
int strsetting = ctrl->editbox.context2.i;
|
int strsetting = ctrl->context2.i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
@ -1614,7 +1614,7 @@ static void serial_parity_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
{"Mark", SER_PAR_MARK},
|
{"Mark", SER_PAR_MARK},
|
||||||
{"Space", SER_PAR_SPACE},
|
{"Space", SER_PAR_SPACE},
|
||||||
};
|
};
|
||||||
int mask = ctrl->listbox.context.i;
|
int mask = ctrl->context.i;
|
||||||
int i, j;
|
int i, j;
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
|
|
||||||
@ -1668,7 +1668,7 @@ static void serial_flow_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
{"RTS/CTS", SER_FLOW_RTSCTS},
|
{"RTS/CTS", SER_FLOW_RTSCTS},
|
||||||
{"DSR/DTR", SER_FLOW_DSRDTR},
|
{"DSR/DTR", SER_FLOW_DSRDTR},
|
||||||
};
|
};
|
||||||
int mask = ctrl->listbox.context.i;
|
int mask = ctrl->context.i;
|
||||||
int i, j;
|
int i, j;
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
|
|
||||||
@ -1743,7 +1743,7 @@ void proxy_type_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
ADD(PROXY_SSH_EXEC, "SSH to proxy and execute a command");
|
ADD(PROXY_SSH_EXEC, "SSH to proxy and execute a command");
|
||||||
ADD(PROXY_SSH_SUBSYSTEM, "SSH to proxy and invoke a subsystem");
|
ADD(PROXY_SSH_SUBSYSTEM, "SSH to proxy and invoke a subsystem");
|
||||||
}
|
}
|
||||||
if (ctrl->generic.context.i & PROXY_UI_FLAG_LOCAL) {
|
if (ctrl->context.i & PROXY_UI_FLAG_LOCAL) {
|
||||||
ADD(PROXY_CMD, "Local (run a subprogram to connect)");
|
ADD(PROXY_CMD, "Local (run a subprogram to connect)");
|
||||||
}
|
}
|
||||||
ADD(PROXY_TELNET, "'Telnet' (send an ad-hoc command)");
|
ADD(PROXY_TELNET, "'Telnet' (send an ad-hoc command)");
|
||||||
@ -1805,11 +1805,11 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
HELPCTX(no_help),
|
HELPCTX(no_help),
|
||||||
sessionsaver_handler, P(ssd));
|
sessionsaver_handler, P(ssd));
|
||||||
ssd->okbutton->button.isdefault = true;
|
ssd->okbutton->button.isdefault = true;
|
||||||
ssd->okbutton->generic.column = 3;
|
ssd->okbutton->column = 3;
|
||||||
ssd->cancelbutton = ctrl_pushbutton(s, "Cancel", 'c', HELPCTX(no_help),
|
ssd->cancelbutton = ctrl_pushbutton(s, "Cancel", 'c', HELPCTX(no_help),
|
||||||
sessionsaver_handler, P(ssd));
|
sessionsaver_handler, P(ssd));
|
||||||
ssd->cancelbutton->button.iscancel = true;
|
ssd->cancelbutton->button.iscancel = true;
|
||||||
ssd->cancelbutton->generic.column = 4;
|
ssd->cancelbutton->column = 4;
|
||||||
/* We carefully don't close the 5-column part, so that platform-
|
/* We carefully don't close the 5-column part, so that platform-
|
||||||
* specific add-ons can put extra buttons alongside Open and Cancel. */
|
* specific add-ons can put extra buttons alongside Open and Cancel. */
|
||||||
|
|
||||||
@ -1831,12 +1831,12 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
c = ctrl_editbox(s, HOST_BOX_TITLE, 'n', 100,
|
c = ctrl_editbox(s, HOST_BOX_TITLE, 'n', 100,
|
||||||
HELPCTX(session_hostname),
|
HELPCTX(session_hostname),
|
||||||
config_host_handler, I(0), I(0));
|
config_host_handler, I(0), I(0));
|
||||||
c->generic.column = 0;
|
c->column = 0;
|
||||||
hp->host = c;
|
hp->host = c;
|
||||||
c = ctrl_editbox(s, PORT_BOX_TITLE, 'p', 100,
|
c = ctrl_editbox(s, PORT_BOX_TITLE, 'p', 100,
|
||||||
HELPCTX(session_hostname),
|
HELPCTX(session_hostname),
|
||||||
config_port_handler, I(0), I(0));
|
config_port_handler, I(0), I(0));
|
||||||
c->generic.column = 1;
|
c->column = 1;
|
||||||
hp->port = c;
|
hp->port = c;
|
||||||
|
|
||||||
ctrl_columns(s, 1, 100);
|
ctrl_columns(s, 1, 100);
|
||||||
@ -1845,7 +1845,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
c = ctrl_radiobuttons(s, NULL, NO_SHORTCUT, 3,
|
c = ctrl_radiobuttons(s, NULL, NO_SHORTCUT, 3,
|
||||||
HELPCTX(session_hostname),
|
HELPCTX(session_hostname),
|
||||||
config_protocols_handler, P(hp), NULL);
|
config_protocols_handler, P(hp), NULL);
|
||||||
c->generic.column = 0;
|
c->column = 0;
|
||||||
hp->protradio = c;
|
hp->protradio = c;
|
||||||
c->radio.buttons = sresize(c->radio.buttons, PROTOCOL_LIMIT, char *);
|
c->radio.buttons = sresize(c->radio.buttons, PROTOCOL_LIMIT, char *);
|
||||||
c->radio.shortcuts = sresize(c->radio.shortcuts, PROTOCOL_LIMIT, char);
|
c->radio.shortcuts = sresize(c->radio.shortcuts, PROTOCOL_LIMIT, char);
|
||||||
@ -1880,10 +1880,10 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
config_protocols_handler, P(hp));
|
config_protocols_handler, P(hp));
|
||||||
hp->protlist = c;
|
hp->protlist = c;
|
||||||
/* droplist is populated in config_protocols_handler */
|
/* droplist is populated in config_protocols_handler */
|
||||||
c->generic.column = 1;
|
c->column = 1;
|
||||||
|
|
||||||
/* Vertically centre the two protocol controls w.r.t. each other */
|
/* Vertically centre the two protocol controls w.r.t. each other */
|
||||||
hp->protlist->generic.align_next_to = hp->protradio;
|
hp->protlist->align_next_to = hp->protradio;
|
||||||
|
|
||||||
ctrl_columns(s, 1, 100);
|
ctrl_columns(s, 1, 100);
|
||||||
}
|
}
|
||||||
@ -1899,7 +1899,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
ssd->editbox = ctrl_editbox(s, "Saved Sessions", 'e', 100,
|
ssd->editbox = ctrl_editbox(s, "Saved Sessions", 'e', 100,
|
||||||
HELPCTX(session_saved),
|
HELPCTX(session_saved),
|
||||||
sessionsaver_handler, P(ssd), P(NULL));
|
sessionsaver_handler, P(ssd), P(NULL));
|
||||||
ssd->editbox->generic.column = 0;
|
ssd->editbox->column = 0;
|
||||||
/* Reset columns so that the buttons are alongside the list, rather
|
/* Reset columns so that the buttons are alongside the list, rather
|
||||||
* than alongside that edit box. */
|
* than alongside that edit box. */
|
||||||
ctrl_columns(s, 1, 100);
|
ctrl_columns(s, 1, 100);
|
||||||
@ -1907,13 +1907,13 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
ssd->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
|
ssd->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
|
||||||
HELPCTX(session_saved),
|
HELPCTX(session_saved),
|
||||||
sessionsaver_handler, P(ssd));
|
sessionsaver_handler, P(ssd));
|
||||||
ssd->listbox->generic.column = 0;
|
ssd->listbox->column = 0;
|
||||||
ssd->listbox->listbox.height = 7;
|
ssd->listbox->listbox.height = 7;
|
||||||
if (!midsession) {
|
if (!midsession) {
|
||||||
ssd->loadbutton = ctrl_pushbutton(s, "Load", 'l',
|
ssd->loadbutton = ctrl_pushbutton(s, "Load", 'l',
|
||||||
HELPCTX(session_saved),
|
HELPCTX(session_saved),
|
||||||
sessionsaver_handler, P(ssd));
|
sessionsaver_handler, P(ssd));
|
||||||
ssd->loadbutton->generic.column = 1;
|
ssd->loadbutton->column = 1;
|
||||||
} else {
|
} else {
|
||||||
/* We can't offer the Load button mid-session, as it would allow the
|
/* We can't offer the Load button mid-session, as it would allow the
|
||||||
* user to load and subsequently save settings they can't see. (And
|
* user to load and subsequently save settings they can't see. (And
|
||||||
@ -1925,12 +1925,12 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
ssd->savebutton = ctrl_pushbutton(s, "Save", 'v',
|
ssd->savebutton = ctrl_pushbutton(s, "Save", 'v',
|
||||||
HELPCTX(session_saved),
|
HELPCTX(session_saved),
|
||||||
sessionsaver_handler, P(ssd));
|
sessionsaver_handler, P(ssd));
|
||||||
ssd->savebutton->generic.column = 1;
|
ssd->savebutton->column = 1;
|
||||||
if (!midsession) {
|
if (!midsession) {
|
||||||
ssd->delbutton = ctrl_pushbutton(s, "Delete", 'd',
|
ssd->delbutton = ctrl_pushbutton(s, "Delete", 'd',
|
||||||
HELPCTX(session_saved),
|
HELPCTX(session_saved),
|
||||||
sessionsaver_handler, P(ssd));
|
sessionsaver_handler, P(ssd));
|
||||||
ssd->delbutton->generic.column = 1;
|
ssd->delbutton->column = 1;
|
||||||
} else {
|
} else {
|
||||||
/* Disable the Delete button mid-session too, for UI consistency. */
|
/* Disable the Delete button mid-session too, for UI consistency. */
|
||||||
ssd->delbutton = NULL;
|
ssd->delbutton = NULL;
|
||||||
@ -2207,11 +2207,11 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
c = ctrl_editbox(s, "Columns", 'm', 100,
|
c = ctrl_editbox(s, "Columns", 'm', 100,
|
||||||
HELPCTX(window_size),
|
HELPCTX(window_size),
|
||||||
conf_editbox_handler, I(CONF_width), I(-1));
|
conf_editbox_handler, I(CONF_width), I(-1));
|
||||||
c->generic.column = 0;
|
c->column = 0;
|
||||||
c = ctrl_editbox(s, "Rows", 'r', 100,
|
c = ctrl_editbox(s, "Rows", 'r', 100,
|
||||||
HELPCTX(window_size),
|
HELPCTX(window_size),
|
||||||
conf_editbox_handler, I(CONF_height),I(-1));
|
conf_editbox_handler, I(CONF_height),I(-1));
|
||||||
c->generic.column = 1;
|
c->column = 1;
|
||||||
ctrl_columns(s, 1, 100);
|
ctrl_columns(s, 1, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2394,11 +2394,11 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
ccd->editbox = ctrl_editbox(s, "Set to class", 't', 50,
|
ccd->editbox = ctrl_editbox(s, "Set to class", 't', 50,
|
||||||
HELPCTX(copy_charclasses),
|
HELPCTX(copy_charclasses),
|
||||||
charclass_handler, P(ccd), P(NULL));
|
charclass_handler, P(ccd), P(NULL));
|
||||||
ccd->editbox->generic.column = 0;
|
ccd->editbox->column = 0;
|
||||||
ccd->button = ctrl_pushbutton(s, "Set", 's',
|
ccd->button = ctrl_pushbutton(s, "Set", 's',
|
||||||
HELPCTX(copy_charclasses),
|
HELPCTX(copy_charclasses),
|
||||||
charclass_handler, P(ccd));
|
charclass_handler, P(ccd));
|
||||||
ccd->button->generic.column = 1;
|
ccd->button->column = 1;
|
||||||
ctrl_columns(s, 1, 100);
|
ctrl_columns(s, 1, 100);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2435,22 +2435,22 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
cd = (struct colour_data *)ctrl_alloc(b, sizeof(struct colour_data));
|
cd = (struct colour_data *)ctrl_alloc(b, sizeof(struct colour_data));
|
||||||
cd->listbox = ctrl_listbox(s, "Select a colour to adjust:", 'u',
|
cd->listbox = ctrl_listbox(s, "Select a colour to adjust:", 'u',
|
||||||
HELPCTX(colours_config), colour_handler, P(cd));
|
HELPCTX(colours_config), colour_handler, P(cd));
|
||||||
cd->listbox->generic.column = 0;
|
cd->listbox->column = 0;
|
||||||
cd->listbox->listbox.height = 7;
|
cd->listbox->listbox.height = 7;
|
||||||
c = ctrl_text(s, "RGB value:", HELPCTX(colours_config));
|
c = ctrl_text(s, "RGB value:", HELPCTX(colours_config));
|
||||||
c->generic.column = 1;
|
c->column = 1;
|
||||||
cd->redit = ctrl_editbox(s, "Red", 'r', 50, HELPCTX(colours_config),
|
cd->redit = ctrl_editbox(s, "Red", 'r', 50, HELPCTX(colours_config),
|
||||||
colour_handler, P(cd), P(NULL));
|
colour_handler, P(cd), P(NULL));
|
||||||
cd->redit->generic.column = 1;
|
cd->redit->column = 1;
|
||||||
cd->gedit = ctrl_editbox(s, "Green", 'n', 50, HELPCTX(colours_config),
|
cd->gedit = ctrl_editbox(s, "Green", 'n', 50, HELPCTX(colours_config),
|
||||||
colour_handler, P(cd), P(NULL));
|
colour_handler, P(cd), P(NULL));
|
||||||
cd->gedit->generic.column = 1;
|
cd->gedit->column = 1;
|
||||||
cd->bedit = ctrl_editbox(s, "Blue", 'e', 50, HELPCTX(colours_config),
|
cd->bedit = ctrl_editbox(s, "Blue", 'e', 50, HELPCTX(colours_config),
|
||||||
colour_handler, P(cd), P(NULL));
|
colour_handler, P(cd), P(NULL));
|
||||||
cd->bedit->generic.column = 1;
|
cd->bedit->column = 1;
|
||||||
cd->button = ctrl_pushbutton(s, "Modify", 'm', HELPCTX(colours_config),
|
cd->button = ctrl_pushbutton(s, "Modify", 'm', HELPCTX(colours_config),
|
||||||
colour_handler, P(cd));
|
colour_handler, P(cd));
|
||||||
cd->button->generic.column = 1;
|
cd->button->column = 1;
|
||||||
ctrl_columns(s, 1, 100);
|
ctrl_columns(s, 1, 100);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2550,19 +2550,19 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
ed->varbox = ctrl_editbox(s, "Variable", 'v', 60,
|
ed->varbox = ctrl_editbox(s, "Variable", 'v', 60,
|
||||||
HELPCTX(telnet_environ),
|
HELPCTX(telnet_environ),
|
||||||
environ_handler, P(ed), P(NULL));
|
environ_handler, P(ed), P(NULL));
|
||||||
ed->varbox->generic.column = 0;
|
ed->varbox->column = 0;
|
||||||
ed->valbox = ctrl_editbox(s, "Value", 'l', 60,
|
ed->valbox = ctrl_editbox(s, "Value", 'l', 60,
|
||||||
HELPCTX(telnet_environ),
|
HELPCTX(telnet_environ),
|
||||||
environ_handler, P(ed), P(NULL));
|
environ_handler, P(ed), P(NULL));
|
||||||
ed->valbox->generic.column = 0;
|
ed->valbox->column = 0;
|
||||||
ed->addbutton = ctrl_pushbutton(s, "Add", 'd',
|
ed->addbutton = ctrl_pushbutton(s, "Add", 'd',
|
||||||
HELPCTX(telnet_environ),
|
HELPCTX(telnet_environ),
|
||||||
environ_handler, P(ed));
|
environ_handler, P(ed));
|
||||||
ed->addbutton->generic.column = 1;
|
ed->addbutton->column = 1;
|
||||||
ed->rembutton = ctrl_pushbutton(s, "Remove", 'r',
|
ed->rembutton = ctrl_pushbutton(s, "Remove", 'r',
|
||||||
HELPCTX(telnet_environ),
|
HELPCTX(telnet_environ),
|
||||||
environ_handler, P(ed));
|
environ_handler, P(ed));
|
||||||
ed->rembutton->generic.column = 1;
|
ed->rembutton->column = 1;
|
||||||
ctrl_columns(s, 1, 100);
|
ctrl_columns(s, 1, 100);
|
||||||
ed->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
|
ed->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
|
||||||
HELPCTX(telnet_environ),
|
HELPCTX(telnet_environ),
|
||||||
@ -2591,13 +2591,13 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
HELPCTX(proxy_main),
|
HELPCTX(proxy_main),
|
||||||
conf_editbox_handler,
|
conf_editbox_handler,
|
||||||
I(CONF_proxy_host), I(1));
|
I(CONF_proxy_host), I(1));
|
||||||
c->generic.column = 0;
|
c->column = 0;
|
||||||
c = ctrl_editbox(s, "Port", 'p', 100,
|
c = ctrl_editbox(s, "Port", 'p', 100,
|
||||||
HELPCTX(proxy_main),
|
HELPCTX(proxy_main),
|
||||||
conf_editbox_handler,
|
conf_editbox_handler,
|
||||||
I(CONF_proxy_port),
|
I(CONF_proxy_port),
|
||||||
I(-1));
|
I(-1));
|
||||||
c->generic.column = 1;
|
c->column = 1;
|
||||||
ctrl_columns(s, 1, 100);
|
ctrl_columns(s, 1, 100);
|
||||||
ctrl_editbox(s, "Exclude Hosts/IPs", 'e', 100,
|
ctrl_editbox(s, "Exclude Hosts/IPs", 'e', 100,
|
||||||
HELPCTX(proxy_exclude),
|
HELPCTX(proxy_exclude),
|
||||||
@ -2803,7 +2803,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
ctrl_columns(s, 2, 75, 25);
|
ctrl_columns(s, 2, 75, 25);
|
||||||
c = ctrl_text(s, "Host keys or fingerprints to accept:",
|
c = ctrl_text(s, "Host keys or fingerprints to accept:",
|
||||||
HELPCTX(ssh_kex_manual_hostkeys));
|
HELPCTX(ssh_kex_manual_hostkeys));
|
||||||
c->generic.column = 0;
|
c->column = 0;
|
||||||
/* You want to select from the list, _then_ hit Remove. So
|
/* You want to select from the list, _then_ hit Remove. So
|
||||||
* tab order should be that way round. */
|
* tab order should be that way round. */
|
||||||
mh = (struct manual_hostkey_data *)
|
mh = (struct manual_hostkey_data *)
|
||||||
@ -2811,8 +2811,8 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
mh->rembutton = ctrl_pushbutton(s, "Remove", 'r',
|
mh->rembutton = ctrl_pushbutton(s, "Remove", 'r',
|
||||||
HELPCTX(ssh_kex_manual_hostkeys),
|
HELPCTX(ssh_kex_manual_hostkeys),
|
||||||
manual_hostkey_handler, P(mh));
|
manual_hostkey_handler, P(mh));
|
||||||
mh->rembutton->generic.column = 1;
|
mh->rembutton->column = 1;
|
||||||
mh->rembutton->generic.tabdelay = true;
|
mh->rembutton->delay_taborder = true;
|
||||||
mh->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
|
mh->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
|
||||||
HELPCTX(ssh_kex_manual_hostkeys),
|
HELPCTX(ssh_kex_manual_hostkeys),
|
||||||
manual_hostkey_handler, P(mh));
|
manual_hostkey_handler, P(mh));
|
||||||
@ -2826,11 +2826,11 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
mh->keybox = ctrl_editbox(s, "Key", 'k', 80,
|
mh->keybox = ctrl_editbox(s, "Key", 'k', 80,
|
||||||
HELPCTX(ssh_kex_manual_hostkeys),
|
HELPCTX(ssh_kex_manual_hostkeys),
|
||||||
manual_hostkey_handler, P(mh), P(NULL));
|
manual_hostkey_handler, P(mh), P(NULL));
|
||||||
mh->keybox->generic.column = 0;
|
mh->keybox->column = 0;
|
||||||
mh->addbutton = ctrl_pushbutton(s, "Add key", 'y',
|
mh->addbutton = ctrl_pushbutton(s, "Add key", 'y',
|
||||||
HELPCTX(ssh_kex_manual_hostkeys),
|
HELPCTX(ssh_kex_manual_hostkeys),
|
||||||
manual_hostkey_handler, P(mh));
|
manual_hostkey_handler, P(mh));
|
||||||
mh->addbutton->generic.column = 1;
|
mh->addbutton->column = 1;
|
||||||
ctrl_columns(s, 1, 100);
|
ctrl_columns(s, 1, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3007,12 +3007,12 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
td->listbox->listbox.percentages[1] = 60;
|
td->listbox->listbox.percentages[1] = 60;
|
||||||
ctrl_columns(s, 2, 75, 25);
|
ctrl_columns(s, 2, 75, 25);
|
||||||
c = ctrl_text(s, "For selected mode, send:", HELPCTX(ssh_ttymodes));
|
c = ctrl_text(s, "For selected mode, send:", HELPCTX(ssh_ttymodes));
|
||||||
c->generic.column = 0;
|
c->column = 0;
|
||||||
td->setbutton = ctrl_pushbutton(s, "Set", 's',
|
td->setbutton = ctrl_pushbutton(s, "Set", 's',
|
||||||
HELPCTX(ssh_ttymodes),
|
HELPCTX(ssh_ttymodes),
|
||||||
ttymodes_handler, P(td));
|
ttymodes_handler, P(td));
|
||||||
td->setbutton->generic.column = 1;
|
td->setbutton->column = 1;
|
||||||
td->setbutton->generic.tabdelay = true;
|
td->setbutton->delay_taborder = true;
|
||||||
ctrl_columns(s, 1, 100); /* column break */
|
ctrl_columns(s, 1, 100); /* column break */
|
||||||
/* Bit of a hack to get the value radio buttons and
|
/* Bit of a hack to get the value radio buttons and
|
||||||
* edit-box on the same row. */
|
* edit-box on the same row. */
|
||||||
@ -3024,12 +3024,12 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
"Nothing", NO_SHORTCUT, P(NULL),
|
"Nothing", NO_SHORTCUT, P(NULL),
|
||||||
"This:", NO_SHORTCUT, P(NULL),
|
"This:", NO_SHORTCUT, P(NULL),
|
||||||
NULL);
|
NULL);
|
||||||
td->valradio->generic.column = 0;
|
td->valradio->column = 0;
|
||||||
td->valbox = ctrl_editbox(s, NULL, NO_SHORTCUT, 100,
|
td->valbox = ctrl_editbox(s, NULL, NO_SHORTCUT, 100,
|
||||||
HELPCTX(ssh_ttymodes),
|
HELPCTX(ssh_ttymodes),
|
||||||
ttymodes_handler, P(td), P(NULL));
|
ttymodes_handler, P(td), P(NULL));
|
||||||
td->valbox->generic.column = 1;
|
td->valbox->column = 1;
|
||||||
td->valbox->generic.align_next_to = td->valradio;
|
td->valbox->align_next_to = td->valradio;
|
||||||
ctrl_tabdelay(s, td->setbutton);
|
ctrl_tabdelay(s, td->setbutton);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3074,15 +3074,15 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
|
|
||||||
ctrl_columns(s, 3, 55, 20, 25);
|
ctrl_columns(s, 3, 55, 20, 25);
|
||||||
c = ctrl_text(s, "Forwarded ports:", HELPCTX(ssh_tunnels_portfwd));
|
c = ctrl_text(s, "Forwarded ports:", HELPCTX(ssh_tunnels_portfwd));
|
||||||
c->generic.column = COLUMN_FIELD(0,2);
|
c->column = COLUMN_FIELD(0,2);
|
||||||
/* You want to select from the list, _then_ hit Remove. So tab order
|
/* You want to select from the list, _then_ hit Remove. So tab order
|
||||||
* should be that way round. */
|
* should be that way round. */
|
||||||
pfd = (struct portfwd_data *)ctrl_alloc(b,sizeof(struct portfwd_data));
|
pfd = (struct portfwd_data *)ctrl_alloc(b,sizeof(struct portfwd_data));
|
||||||
pfd->rembutton = ctrl_pushbutton(s, "Remove", 'r',
|
pfd->rembutton = ctrl_pushbutton(s, "Remove", 'r',
|
||||||
HELPCTX(ssh_tunnels_portfwd),
|
HELPCTX(ssh_tunnels_portfwd),
|
||||||
portfwd_handler, P(pfd));
|
portfwd_handler, P(pfd));
|
||||||
pfd->rembutton->generic.column = 2;
|
pfd->rembutton->column = 2;
|
||||||
pfd->rembutton->generic.tabdelay = true;
|
pfd->rembutton->delay_taborder = true;
|
||||||
pfd->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
|
pfd->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
|
||||||
HELPCTX(ssh_tunnels_portfwd),
|
HELPCTX(ssh_tunnels_portfwd),
|
||||||
portfwd_handler, P(pfd));
|
portfwd_handler, P(pfd));
|
||||||
@ -3098,12 +3098,12 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
|||||||
pfd->addbutton = ctrl_pushbutton(s, "Add", 'd',
|
pfd->addbutton = ctrl_pushbutton(s, "Add", 'd',
|
||||||
HELPCTX(ssh_tunnels_portfwd),
|
HELPCTX(ssh_tunnels_portfwd),
|
||||||
portfwd_handler, P(pfd));
|
portfwd_handler, P(pfd));
|
||||||
pfd->addbutton->generic.column = 2;
|
pfd->addbutton->column = 2;
|
||||||
pfd->addbutton->generic.tabdelay = true;
|
pfd->addbutton->delay_taborder = true;
|
||||||
pfd->sourcebox = ctrl_editbox(s, "Source port", 's', 40,
|
pfd->sourcebox = ctrl_editbox(s, "Source port", 's', 40,
|
||||||
HELPCTX(ssh_tunnels_portfwd),
|
HELPCTX(ssh_tunnels_portfwd),
|
||||||
portfwd_handler, P(pfd), P(NULL));
|
portfwd_handler, P(pfd), P(NULL));
|
||||||
pfd->sourcebox->generic.column = 0;
|
pfd->sourcebox->column = 0;
|
||||||
pfd->destbox = ctrl_editbox(s, "Destination", 'i', 67,
|
pfd->destbox = ctrl_editbox(s, "Destination", 'i', 67,
|
||||||
HELPCTX(ssh_tunnels_portfwd),
|
HELPCTX(ssh_tunnels_portfwd),
|
||||||
portfwd_handler, P(pfd), P(NULL));
|
portfwd_handler, P(pfd), P(NULL));
|
||||||
@ -3426,7 +3426,7 @@ static void ca_ok_handler(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
static void ca_name_handler(dlgcontrol *ctrl, dlgparam *dp,
|
static void ca_name_handler(dlgcontrol *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
struct ca_state *st = (struct ca_state *)ctrl->generic.context.p;
|
struct ca_state *st = (struct ca_state *)ctrl->context.p;
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
dlg_editbox_set(ctrl, dp, st->name);
|
dlg_editbox_set(ctrl, dp, st->name);
|
||||||
} else if (event == EVENT_VALCHANGE) {
|
} else if (event == EVENT_VALCHANGE) {
|
||||||
@ -3447,7 +3447,7 @@ static void ca_name_handler(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
static void ca_reclist_handler(dlgcontrol *ctrl, dlgparam *dp,
|
static void ca_reclist_handler(dlgcontrol *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
struct ca_state *st = (struct ca_state *)ctrl->generic.context.p;
|
struct ca_state *st = (struct ca_state *)ctrl->context.p;
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
dlg_update_start(ctrl, dp);
|
dlg_update_start(ctrl, dp);
|
||||||
dlg_listbox_clear(ctrl, dp);
|
dlg_listbox_clear(ctrl, dp);
|
||||||
@ -3464,7 +3464,7 @@ static void ca_reclist_handler(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
static void ca_load_handler(dlgcontrol *ctrl, dlgparam *dp,
|
static void ca_load_handler(dlgcontrol *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
struct ca_state *st = (struct ca_state *)ctrl->generic.context.p;
|
struct ca_state *st = (struct ca_state *)ctrl->context.p;
|
||||||
if (event == EVENT_ACTION) {
|
if (event == EVENT_ACTION) {
|
||||||
ca_load_selected_record(st, dp);
|
ca_load_selected_record(st, dp);
|
||||||
}
|
}
|
||||||
@ -3473,7 +3473,7 @@ static void ca_load_handler(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
static void ca_save_handler(dlgcontrol *ctrl, dlgparam *dp,
|
static void ca_save_handler(dlgcontrol *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
struct ca_state *st = (struct ca_state *)ctrl->generic.context.p;
|
struct ca_state *st = (struct ca_state *)ctrl->context.p;
|
||||||
if (event == EVENT_ACTION) {
|
if (event == EVENT_ACTION) {
|
||||||
host_ca *hca = snew(host_ca);
|
host_ca *hca = snew(host_ca);
|
||||||
memset(hca, 0, sizeof(*hca));
|
memset(hca, 0, sizeof(*hca));
|
||||||
@ -3499,7 +3499,7 @@ static void ca_save_handler(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
static void ca_delete_handler(dlgcontrol *ctrl, dlgparam *dp,
|
static void ca_delete_handler(dlgcontrol *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
struct ca_state *st = (struct ca_state *)ctrl->generic.context.p;
|
struct ca_state *st = (struct ca_state *)ctrl->context.p;
|
||||||
if (event == EVENT_ACTION) {
|
if (event == EVENT_ACTION) {
|
||||||
int i = dlg_listbox_index(st->ca_reclist, dp);
|
int i = dlg_listbox_index(st->ca_reclist, dp);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
@ -3526,7 +3526,7 @@ static void ca_delete_handler(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
static void ca_pubkey_handler(dlgcontrol *ctrl, dlgparam *dp,
|
static void ca_pubkey_handler(dlgcontrol *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
struct ca_state *st = (struct ca_state *)ctrl->generic.context.p;
|
struct ca_state *st = (struct ca_state *)ctrl->context.p;
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
dlg_editbox_set(ctrl, dp, st->pubkey);
|
dlg_editbox_set(ctrl, dp, st->pubkey);
|
||||||
} else if (event == EVENT_VALCHANGE) {
|
} else if (event == EVENT_VALCHANGE) {
|
||||||
@ -3538,7 +3538,7 @@ static void ca_pubkey_handler(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
static void ca_wclist_handler(dlgcontrol *ctrl, dlgparam *dp,
|
static void ca_wclist_handler(dlgcontrol *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
struct ca_state *st = (struct ca_state *)ctrl->generic.context.p;
|
struct ca_state *st = (struct ca_state *)ctrl->context.p;
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
dlg_update_start(ctrl, dp);
|
dlg_update_start(ctrl, dp);
|
||||||
dlg_listbox_clear(ctrl, dp);
|
dlg_listbox_clear(ctrl, dp);
|
||||||
@ -3552,7 +3552,7 @@ static void ca_wclist_handler(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
static void ca_wc_edit_handler(dlgcontrol *ctrl, dlgparam *dp,
|
static void ca_wc_edit_handler(dlgcontrol *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
struct ca_state *st = (struct ca_state *)ctrl->generic.context.p;
|
struct ca_state *st = (struct ca_state *)ctrl->context.p;
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
dlg_editbox_set(ctrl, dp, st->wc);
|
dlg_editbox_set(ctrl, dp, st->wc);
|
||||||
} else if (event == EVENT_VALCHANGE) {
|
} else if (event == EVENT_VALCHANGE) {
|
||||||
@ -3564,7 +3564,7 @@ static void ca_wc_edit_handler(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
static void ca_wc_add_handler(dlgcontrol *ctrl, dlgparam *dp,
|
static void ca_wc_add_handler(dlgcontrol *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
struct ca_state *st = (struct ca_state *)ctrl->generic.context.p;
|
struct ca_state *st = (struct ca_state *)ctrl->context.p;
|
||||||
if (event == EVENT_ACTION) {
|
if (event == EVENT_ACTION) {
|
||||||
if (!st->wc) {
|
if (!st->wc) {
|
||||||
dlg_beep(dp);
|
dlg_beep(dp);
|
||||||
@ -3585,7 +3585,7 @@ static void ca_wc_add_handler(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
static void ca_wc_rem_handler(dlgcontrol *ctrl, dlgparam *dp,
|
static void ca_wc_rem_handler(dlgcontrol *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
struct ca_state *st = (struct ca_state *)ctrl->generic.context.p;
|
struct ca_state *st = (struct ca_state *)ctrl->context.p;
|
||||||
if (event == EVENT_ACTION) {
|
if (event == EVENT_ACTION) {
|
||||||
int i = dlg_listbox_index(st->ca_wclist, dp);
|
int i = dlg_listbox_index(st->ca_wclist, dp);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
@ -3626,7 +3626,7 @@ void setup_ca_config_box(struct controlbox *b)
|
|||||||
c = ctrl_pushbutton(s, "Done", 'o', HELPCTX(no_help),
|
c = ctrl_pushbutton(s, "Done", 'o', HELPCTX(no_help),
|
||||||
ca_ok_handler, P(st));
|
ca_ok_handler, P(st));
|
||||||
c->button.isdefault = true;
|
c->button.isdefault = true;
|
||||||
c->generic.column = 4;
|
c->column = 4;
|
||||||
|
|
||||||
/* Load/save box, as similar as possible to the main saved sessions one */
|
/* Load/save box, as similar as possible to the main saved sessions one */
|
||||||
s = ctrl_getset(b, "Main", "loadsave",
|
s = ctrl_getset(b, "Main", "loadsave",
|
||||||
@ -3635,7 +3635,7 @@ void setup_ca_config_box(struct controlbox *b)
|
|||||||
c = ctrl_editbox(s, "Name for this CA (shown in log messages)",
|
c = ctrl_editbox(s, "Name for this CA (shown in log messages)",
|
||||||
'n', 100, HELPCTX(no_help),
|
'n', 100, HELPCTX(no_help),
|
||||||
ca_name_handler, P(st), P(NULL));
|
ca_name_handler, P(st), P(NULL));
|
||||||
c->generic.column = 0;
|
c->column = 0;
|
||||||
st->ca_name_edit = c;
|
st->ca_name_edit = c;
|
||||||
/* Reset columns so that the buttons are alongside the list, rather
|
/* Reset columns so that the buttons are alongside the list, rather
|
||||||
* than alongside that edit box. */
|
* than alongside that edit box. */
|
||||||
@ -3643,18 +3643,18 @@ void setup_ca_config_box(struct controlbox *b)
|
|||||||
ctrl_columns(s, 2, 75, 25);
|
ctrl_columns(s, 2, 75, 25);
|
||||||
c = ctrl_listbox(s, NULL, NO_SHORTCUT, HELPCTX(no_help),
|
c = ctrl_listbox(s, NULL, NO_SHORTCUT, HELPCTX(no_help),
|
||||||
ca_reclist_handler, P(st));
|
ca_reclist_handler, P(st));
|
||||||
c->generic.column = 0;
|
c->column = 0;
|
||||||
c->listbox.height = 6;
|
c->listbox.height = 6;
|
||||||
st->ca_reclist = c;
|
st->ca_reclist = c;
|
||||||
c = ctrl_pushbutton(s, "Load", 'l', HELPCTX(no_help),
|
c = ctrl_pushbutton(s, "Load", 'l', HELPCTX(no_help),
|
||||||
ca_load_handler, P(st));
|
ca_load_handler, P(st));
|
||||||
c->generic.column = 1;
|
c->column = 1;
|
||||||
c = ctrl_pushbutton(s, "Save", 'v', HELPCTX(no_help),
|
c = ctrl_pushbutton(s, "Save", 'v', HELPCTX(no_help),
|
||||||
ca_save_handler, P(st));
|
ca_save_handler, P(st));
|
||||||
c->generic.column = 1;
|
c->column = 1;
|
||||||
c = ctrl_pushbutton(s, "Delete", 'd', HELPCTX(no_help),
|
c = ctrl_pushbutton(s, "Delete", 'd', HELPCTX(no_help),
|
||||||
ca_delete_handler, P(st));
|
ca_delete_handler, P(st));
|
||||||
c->generic.column = 1;
|
c->column = 1;
|
||||||
|
|
||||||
/* Box containing the details of a specific CA record */
|
/* Box containing the details of a specific CA record */
|
||||||
s = ctrl_getset(b, "Main", "details", "Details of a host CA record");
|
s = ctrl_getset(b, "Main", "details", "Details of a host CA record");
|
||||||
@ -3668,12 +3668,12 @@ void setup_ca_config_box(struct controlbox *b)
|
|||||||
ctrl_columns(s, 3, 70, 15, 15);
|
ctrl_columns(s, 3, 70, 15, 15);
|
||||||
c = ctrl_editbox(s, "Hostname pattern to add", 'h', 100,
|
c = ctrl_editbox(s, "Hostname pattern to add", 'h', 100,
|
||||||
HELPCTX(no_help), ca_wc_edit_handler, P(st), P(NULL));
|
HELPCTX(no_help), ca_wc_edit_handler, P(st), P(NULL));
|
||||||
c->generic.column = 0;
|
c->column = 0;
|
||||||
st->ca_wc_edit = c;
|
st->ca_wc_edit = c;
|
||||||
c = ctrl_pushbutton(s, "Add", NO_SHORTCUT, HELPCTX(no_help),
|
c = ctrl_pushbutton(s, "Add", NO_SHORTCUT, HELPCTX(no_help),
|
||||||
ca_wc_add_handler, P(st));
|
ca_wc_add_handler, P(st));
|
||||||
c->generic.column = 1;
|
c->column = 1;
|
||||||
c = ctrl_pushbutton(s, "Remove", NO_SHORTCUT, HELPCTX(no_help),
|
c = ctrl_pushbutton(s, "Remove", NO_SHORTCUT, HELPCTX(no_help),
|
||||||
ca_wc_rem_handler, P(st));
|
ca_wc_rem_handler, P(st));
|
||||||
c->generic.column = 2;
|
c->column = 2;
|
||||||
}
|
}
|
||||||
|
2
defs.h
2
defs.h
@ -172,7 +172,7 @@ typedef struct NTRUKeyPair NTRUKeyPair;
|
|||||||
typedef struct NTRUEncodeSchedule NTRUEncodeSchedule;
|
typedef struct NTRUEncodeSchedule NTRUEncodeSchedule;
|
||||||
|
|
||||||
typedef struct dlgparam dlgparam;
|
typedef struct dlgparam dlgparam;
|
||||||
typedef union control dlgcontrol;
|
typedef struct dlgcontrol dlgcontrol;
|
||||||
|
|
||||||
typedef struct settings_w settings_w;
|
typedef struct settings_w settings_w;
|
||||||
typedef struct settings_r settings_r;
|
typedef struct settings_r settings_r;
|
||||||
|
46
dialog.c
46
dialog.c
@ -214,14 +214,14 @@ static dlgcontrol *ctrl_new(struct controlset *s, int type,
|
|||||||
/*
|
/*
|
||||||
* Fill in the standard fields.
|
* Fill in the standard fields.
|
||||||
*/
|
*/
|
||||||
c->generic.type = type;
|
c->type = type;
|
||||||
c->generic.tabdelay = false;
|
c->delay_taborder = false;
|
||||||
c->generic.column = COLUMN_FIELD(0, s->ncolumns);
|
c->column = COLUMN_FIELD(0, s->ncolumns);
|
||||||
c->generic.helpctx = helpctx;
|
c->helpctx = helpctx;
|
||||||
c->generic.handler = handler;
|
c->handler = handler;
|
||||||
c->generic.context = context;
|
c->context = context;
|
||||||
c->generic.label = NULL;
|
c->label = NULL;
|
||||||
c->generic.align_next_to = NULL;
|
c->align_next_to = NULL;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,12 +252,12 @@ dlgcontrol *ctrl_editbox(struct controlset *s, const char *label,
|
|||||||
intorptr context, intorptr context2)
|
intorptr context, intorptr context2)
|
||||||
{
|
{
|
||||||
dlgcontrol *c = ctrl_new(s, CTRL_EDITBOX, helpctx, handler, context);
|
dlgcontrol *c = ctrl_new(s, CTRL_EDITBOX, helpctx, handler, context);
|
||||||
c->editbox.label = label ? dupstr(label) : NULL;
|
c->label = label ? dupstr(label) : NULL;
|
||||||
c->editbox.shortcut = shortcut;
|
c->editbox.shortcut = shortcut;
|
||||||
c->editbox.percentwidth = percentage;
|
c->editbox.percentwidth = percentage;
|
||||||
c->editbox.password = false;
|
c->editbox.password = false;
|
||||||
c->editbox.has_list = false;
|
c->editbox.has_list = false;
|
||||||
c->editbox.context2 = context2;
|
c->context2 = context2;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,12 +267,12 @@ dlgcontrol *ctrl_combobox(struct controlset *s, const char *label,
|
|||||||
intorptr context, intorptr context2)
|
intorptr context, intorptr context2)
|
||||||
{
|
{
|
||||||
dlgcontrol *c = ctrl_new(s, CTRL_EDITBOX, helpctx, handler, context);
|
dlgcontrol *c = ctrl_new(s, CTRL_EDITBOX, helpctx, handler, context);
|
||||||
c->editbox.label = label ? dupstr(label) : NULL;
|
c->label = label ? dupstr(label) : NULL;
|
||||||
c->editbox.shortcut = shortcut;
|
c->editbox.shortcut = shortcut;
|
||||||
c->editbox.percentwidth = percentage;
|
c->editbox.percentwidth = percentage;
|
||||||
c->editbox.password = false;
|
c->editbox.password = false;
|
||||||
c->editbox.has_list = true;
|
c->editbox.has_list = true;
|
||||||
c->editbox.context2 = context2;
|
c->context2 = context2;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ dlgcontrol *ctrl_radiobuttons(struct controlset *s, const char *label,
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
int i;
|
int i;
|
||||||
dlgcontrol *c = ctrl_new(s, CTRL_RADIO, helpctx, handler, context);
|
dlgcontrol *c = ctrl_new(s, CTRL_RADIO, helpctx, handler, context);
|
||||||
c->radio.label = label ? dupstr(label) : NULL;
|
c->label = label ? dupstr(label) : NULL;
|
||||||
c->radio.shortcut = shortcut;
|
c->radio.shortcut = shortcut;
|
||||||
c->radio.ncolumns = ncolumns;
|
c->radio.ncolumns = ncolumns;
|
||||||
/*
|
/*
|
||||||
@ -333,7 +333,7 @@ dlgcontrol *ctrl_pushbutton(struct controlset *s, const char *label,
|
|||||||
handler_fn handler, intorptr context)
|
handler_fn handler, intorptr context)
|
||||||
{
|
{
|
||||||
dlgcontrol *c = ctrl_new(s, CTRL_BUTTON, helpctx, handler, context);
|
dlgcontrol *c = ctrl_new(s, CTRL_BUTTON, helpctx, handler, context);
|
||||||
c->button.label = label ? dupstr(label) : NULL;
|
c->label = label ? dupstr(label) : NULL;
|
||||||
c->button.shortcut = shortcut;
|
c->button.shortcut = shortcut;
|
||||||
c->button.isdefault = false;
|
c->button.isdefault = false;
|
||||||
c->button.iscancel = false;
|
c->button.iscancel = false;
|
||||||
@ -345,7 +345,7 @@ dlgcontrol *ctrl_listbox(struct controlset *s, const char *label,
|
|||||||
handler_fn handler, intorptr context)
|
handler_fn handler, intorptr context)
|
||||||
{
|
{
|
||||||
dlgcontrol *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context);
|
dlgcontrol *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context);
|
||||||
c->listbox.label = label ? dupstr(label) : NULL;
|
c->label = label ? dupstr(label) : NULL;
|
||||||
c->listbox.shortcut = shortcut;
|
c->listbox.shortcut = shortcut;
|
||||||
c->listbox.height = 5; /* *shrug* a plausible default */
|
c->listbox.height = 5; /* *shrug* a plausible default */
|
||||||
c->listbox.draglist = false;
|
c->listbox.draglist = false;
|
||||||
@ -362,7 +362,7 @@ dlgcontrol *ctrl_droplist(struct controlset *s, const char *label,
|
|||||||
handler_fn handler, intorptr context)
|
handler_fn handler, intorptr context)
|
||||||
{
|
{
|
||||||
dlgcontrol *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context);
|
dlgcontrol *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context);
|
||||||
c->listbox.label = label ? dupstr(label) : NULL;
|
c->label = label ? dupstr(label) : NULL;
|
||||||
c->listbox.shortcut = shortcut;
|
c->listbox.shortcut = shortcut;
|
||||||
c->listbox.height = 0; /* means it's a drop-down list */
|
c->listbox.height = 0; /* means it's a drop-down list */
|
||||||
c->listbox.draglist = false;
|
c->listbox.draglist = false;
|
||||||
@ -379,7 +379,7 @@ dlgcontrol *ctrl_draglist(struct controlset *s, const char *label,
|
|||||||
handler_fn handler, intorptr context)
|
handler_fn handler, intorptr context)
|
||||||
{
|
{
|
||||||
dlgcontrol *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context);
|
dlgcontrol *c = ctrl_new(s, CTRL_LISTBOX, helpctx, handler, context);
|
||||||
c->listbox.label = label ? dupstr(label) : NULL;
|
c->label = label ? dupstr(label) : NULL;
|
||||||
c->listbox.shortcut = shortcut;
|
c->listbox.shortcut = shortcut;
|
||||||
c->listbox.height = 5; /* *shrug* a plausible default */
|
c->listbox.height = 5; /* *shrug* a plausible default */
|
||||||
c->listbox.draglist = true;
|
c->listbox.draglist = true;
|
||||||
@ -397,7 +397,7 @@ dlgcontrol *ctrl_filesel(struct controlset *s, const char *label,
|
|||||||
handler_fn handler, intorptr context)
|
handler_fn handler, intorptr context)
|
||||||
{
|
{
|
||||||
dlgcontrol *c = ctrl_new(s, CTRL_FILESELECT, helpctx, handler, context);
|
dlgcontrol *c = ctrl_new(s, CTRL_FILESELECT, helpctx, handler, context);
|
||||||
c->fileselect.label = label ? dupstr(label) : NULL;
|
c->label = label ? dupstr(label) : NULL;
|
||||||
c->fileselect.shortcut = shortcut;
|
c->fileselect.shortcut = shortcut;
|
||||||
c->fileselect.filter = filter;
|
c->fileselect.filter = filter;
|
||||||
c->fileselect.for_writing = write;
|
c->fileselect.for_writing = write;
|
||||||
@ -410,7 +410,7 @@ dlgcontrol *ctrl_fontsel(struct controlset *s, const char *label,
|
|||||||
handler_fn handler, intorptr context)
|
handler_fn handler, intorptr context)
|
||||||
{
|
{
|
||||||
dlgcontrol *c = ctrl_new(s, CTRL_FONTSELECT, helpctx, handler, context);
|
dlgcontrol *c = ctrl_new(s, CTRL_FONTSELECT, helpctx, handler, context);
|
||||||
c->fontselect.label = label ? dupstr(label) : NULL;
|
c->label = label ? dupstr(label) : NULL;
|
||||||
c->fontselect.shortcut = shortcut;
|
c->fontselect.shortcut = shortcut;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@ -426,7 +426,7 @@ dlgcontrol *ctrl_text(struct controlset *s, const char *text,
|
|||||||
intorptr helpctx)
|
intorptr helpctx)
|
||||||
{
|
{
|
||||||
dlgcontrol *c = ctrl_new(s, CTRL_TEXT, helpctx, NULL, P(NULL));
|
dlgcontrol *c = ctrl_new(s, CTRL_TEXT, helpctx, NULL, P(NULL));
|
||||||
c->text.label = dupstr(text);
|
c->label = dupstr(text);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ dlgcontrol *ctrl_checkbox(struct controlset *s, const char *label,
|
|||||||
handler_fn handler, intorptr context)
|
handler_fn handler, intorptr context)
|
||||||
{
|
{
|
||||||
dlgcontrol *c = ctrl_new(s, CTRL_CHECKBOX, helpctx, handler, context);
|
dlgcontrol *c = ctrl_new(s, CTRL_CHECKBOX, helpctx, handler, context);
|
||||||
c->checkbox.label = label ? dupstr(label) : NULL;
|
c->label = label ? dupstr(label) : NULL;
|
||||||
c->checkbox.shortcut = shortcut;
|
c->checkbox.shortcut = shortcut;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@ -444,8 +444,8 @@ void ctrl_free(dlgcontrol *ctrl)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sfree(ctrl->generic.label);
|
sfree(ctrl->label);
|
||||||
switch (ctrl->generic.type) {
|
switch (ctrl->type) {
|
||||||
case CTRL_RADIO:
|
case CTRL_RADIO:
|
||||||
for (i = 0; i < ctrl->radio.nbuttons; i++)
|
for (i = 0; i < ctrl->radio.nbuttons; i++)
|
||||||
sfree(ctrl->radio.buttons[i]);
|
sfree(ctrl->radio.buttons[i]);
|
||||||
|
593
dialog.h
593
dialog.h
@ -104,317 +104,292 @@ enum {
|
|||||||
typedef void (*handler_fn)(dlgcontrol *ctrl, dlgparam *dp,
|
typedef void (*handler_fn)(dlgcontrol *ctrl, dlgparam *dp,
|
||||||
void *data, int event);
|
void *data, int event);
|
||||||
|
|
||||||
#define STANDARD_PREFIX \
|
struct dlgcontrol {
|
||||||
int type; \
|
|
||||||
char *label; \
|
|
||||||
bool tabdelay; \
|
|
||||||
int column; \
|
|
||||||
handler_fn handler; \
|
|
||||||
intorptr context; \
|
|
||||||
intorptr helpctx; \
|
|
||||||
dlgcontrol *align_next_to
|
|
||||||
|
|
||||||
union control {
|
|
||||||
/*
|
/*
|
||||||
* The first possibility in this union is the generic header
|
* Generic fields shared by all the control types.
|
||||||
* shared by all the structures, which we are therefore allowed
|
|
||||||
* to access through any one of them.
|
|
||||||
*/
|
*/
|
||||||
struct {
|
int type;
|
||||||
int type;
|
/*
|
||||||
/*
|
* Every control except CTRL_COLUMNS has _some_ sort of label. By
|
||||||
* Every control except CTRL_COLUMNS has _some_ sort of
|
* putting it in the `generic' union as well as everywhere else,
|
||||||
* label. By putting it in the `generic' union as well as
|
* we avoid having to have an irritating switch statement when we
|
||||||
* everywhere else, we avoid having to have an irritating
|
* go through and deallocate all the memory in a config-box
|
||||||
* switch statement when we go through and deallocate all
|
* structure.
|
||||||
* the memory in a config-box structure.
|
*
|
||||||
*
|
* Yes, this does mean that any non-NULL value in this field is
|
||||||
* Yes, this does mean that any non-NULL value in this
|
* expected to be dynamically allocated and freeable.
|
||||||
* field is expected to be dynamically allocated and
|
*
|
||||||
* freeable.
|
* For CTRL_COLUMNS, this field MUST be NULL.
|
||||||
*
|
*/
|
||||||
* For CTRL_COLUMNS, this field MUST be NULL.
|
char *label;
|
||||||
*/
|
/*
|
||||||
char *label;
|
* If `delay_taborder' is true, it indicates that this particular
|
||||||
/*
|
* control should not yet appear in the tab order. A subsequent
|
||||||
* If `tabdelay' is non-zero, it indicates that this
|
* CTRL_TABDELAY entry will place it.
|
||||||
* particular control should not yet appear in the tab
|
*/
|
||||||
* order. A subsequent CTRL_TABDELAY entry will place it.
|
bool delay_taborder;
|
||||||
*/
|
/*
|
||||||
bool tabdelay;
|
* Indicate which column(s) this control occupies. This can be
|
||||||
/*
|
* unpacked into starting column and column span by the COLUMN
|
||||||
* Indicate which column(s) this control occupies. This can
|
* macros above.
|
||||||
* be unpacked into starting column and column span by the
|
*/
|
||||||
* COLUMN macros above.
|
int column;
|
||||||
*/
|
/*
|
||||||
int column;
|
* Most controls need to provide a function which gets called when
|
||||||
/*
|
* that control's setting is changed, or when the control's
|
||||||
* Most controls need to provide a function which gets
|
* setting needs initialising.
|
||||||
* called when that control's setting is changed, or when
|
*
|
||||||
* the control's setting needs initialising.
|
* The `data' parameter points to the writable data being modified
|
||||||
*
|
* as a result of the configuration activity; for example, the
|
||||||
* The `data' parameter points to the writable data being
|
* PuTTY `Conf' structure, although not necessarily.
|
||||||
* modified as a result of the configuration activity; for
|
*
|
||||||
* example, the PuTTY `Conf' structure, although not
|
* The `dlg' parameter is passed back to the platform- specific
|
||||||
* necessarily.
|
* routines to read and write the actual control state.
|
||||||
*
|
*/
|
||||||
* The `dlg' parameter is passed back to the platform-
|
handler_fn handler;
|
||||||
* specific routines to read and write the actual control
|
/*
|
||||||
* state.
|
* Almost all of the above functions will find it useful to be
|
||||||
*/
|
* able to store one or two pieces of `void *' or `int' data.
|
||||||
handler_fn handler;
|
*/
|
||||||
/*
|
intorptr context, context2;
|
||||||
* Almost all of the above functions will find it useful to
|
/*
|
||||||
* be able to store a piece of `void *' or `int' data.
|
* For any control, we also allow the storage of a piece of data
|
||||||
*/
|
* for use by context-sensitive help. For example, on Windows you
|
||||||
intorptr context;
|
* can click the magic question mark and then click a control, and
|
||||||
/*
|
* help for that control should spring up. Hence, here is a slot
|
||||||
* For any control, we also allow the storage of a piece of
|
* in which to store per-control data that a particular
|
||||||
* data for use by context-sensitive help. For example, on
|
* platform-specific driver can use to ensure it brings up the
|
||||||
* Windows you can click the magic question mark and then
|
* right piece of help text.
|
||||||
* click a control, and help for that control should spring
|
*/
|
||||||
* up. Hence, here is a slot in which to store per-control
|
intorptr helpctx;
|
||||||
* data that a particular platform-specific driver can use
|
/*
|
||||||
* to ensure it brings up the right piece of help text.
|
* Setting this to non-NULL coerces two controls to have their
|
||||||
*/
|
* y-coordinates adjusted so that they can sit alongside each
|
||||||
intorptr helpctx;
|
* other and look nicely aligned, even if they're different
|
||||||
/*
|
* heights.
|
||||||
* Setting this to non-NULL coerces two controls to have their
|
*
|
||||||
* y-coordinates adjusted so that they can sit alongside each
|
* Set this field on the _second_ control of the pair (in terms of
|
||||||
* other and look nicely aligned, even if they're different
|
* order in the data structure), so that when it's instantiated,
|
||||||
* heights.
|
* the first one is already there to be referred to.
|
||||||
*
|
*/
|
||||||
* Set this field on the _second_ control of the pair (in
|
dlgcontrol *align_next_to;
|
||||||
* terms of order in the data structure), so that when it's
|
|
||||||
* instantiated, the first one is already there to be referred
|
/*
|
||||||
* to.
|
* Union of further fields specific to each control type.
|
||||||
*/
|
*/
|
||||||
dlgcontrol *align_next_to;
|
union {
|
||||||
} generic;
|
struct { /* for CTRL_TABDELAY */
|
||||||
struct {
|
dlgcontrol *ctrl;
|
||||||
STANDARD_PREFIX;
|
} tabdelay;
|
||||||
dlgcontrol *ctrl;
|
struct { /* for CTRL_EDITBOX */
|
||||||
} tabdelay;
|
char shortcut; /* keyboard shortcut */
|
||||||
struct {
|
/*
|
||||||
STANDARD_PREFIX;
|
* Percentage of the dialog-box width used by the edit
|
||||||
} text;
|
* box. If this is set to 100, the label is on its own
|
||||||
struct {
|
* line; otherwise the label is on the same line as the
|
||||||
STANDARD_PREFIX;
|
* box itself.
|
||||||
char shortcut; /* keyboard shortcut */
|
*/
|
||||||
/*
|
int percentwidth;
|
||||||
* Percentage of the dialog-box width used by the edit box.
|
bool password; /* details of input are hidden */
|
||||||
* If this is set to 100, the label is on its own line;
|
/*
|
||||||
* otherwise the label is on the same line as the box
|
* A special case of the edit box is the combo box, which
|
||||||
* itself.
|
* has a drop-down list built in. (Note that a _non_-
|
||||||
*/
|
* editable drop-down list is done as a special case of a
|
||||||
int percentwidth;
|
* list box.)
|
||||||
bool password; /* details of input are hidden */
|
*
|
||||||
/*
|
* Don't try setting has_list and password on the same
|
||||||
* A special case of the edit box is the combo box, which
|
* control; front ends are not required to support that
|
||||||
* has a drop-down list built in. (Note that a _non_-
|
* combination.
|
||||||
* editable drop-down list is done as a special case of a
|
*/
|
||||||
* list box.)
|
bool has_list;
|
||||||
*
|
} editbox;
|
||||||
* Don't try setting has_list and password on the same
|
struct { /* for CTRL_RADIO */
|
||||||
* control; front ends are not required to support that
|
/*
|
||||||
* combination.
|
* `shortcut' here is a single keyboard shortcut which is
|
||||||
*/
|
* expected to select the whole group of radio buttons. It
|
||||||
bool has_list;
|
* can be NO_SHORTCUT if required, and there is also a way
|
||||||
/*
|
* to place individual shortcuts on each button; see
|
||||||
* Edit boxes tend to need two items of context, so here's
|
* below.
|
||||||
* a spare.
|
*/
|
||||||
*/
|
char shortcut;
|
||||||
intorptr context2;
|
/*
|
||||||
} editbox;
|
* There are separate fields for `ncolumns' and `nbuttons'
|
||||||
struct {
|
* for several reasons.
|
||||||
STANDARD_PREFIX;
|
*
|
||||||
/*
|
* Firstly, we sometimes want the last of a set of buttons
|
||||||
* `shortcut' here is a single keyboard shortcut which is
|
* to have a longer label than the rest; we achieve this
|
||||||
* expected to select the whole group of radio buttons. It
|
* by setting `ncolumns' higher than `nbuttons', and the
|
||||||
* can be NO_SHORTCUT if required, and there is also a way
|
* layout code is expected to understand that the final
|
||||||
* to place individual shortcuts on each button; see below.
|
* button should be given all the remaining space on the
|
||||||
*/
|
* line. This sounds like a ludicrously specific special
|
||||||
char shortcut;
|
* case (if we're doing this sort of thing, why not have
|
||||||
/*
|
* the general ability to have a particular button span
|
||||||
* There are separate fields for `ncolumns' and `nbuttons'
|
* more than one column whether it's the last one or not?)
|
||||||
* for several reasons.
|
* but actually it's reasonably common for the sort of
|
||||||
*
|
* three-way control you get a lot of in PuTTY: `yes'
|
||||||
* Firstly, we sometimes want the last of a set of buttons
|
* versus `no' versus `some more complex way to decide'.
|
||||||
* to have a longer label than the rest; we achieve this by
|
*
|
||||||
* setting `ncolumns' higher than `nbuttons', and the
|
* Secondly, setting `nbuttons' higher than `ncolumns'
|
||||||
* layout code is expected to understand that the final
|
* lets us have more than one line of radio buttons for a
|
||||||
* button should be given all the remaining space on the
|
* single setting. A very important special case of this
|
||||||
* line. This sounds like a ludicrously specific special
|
* is setting `ncolumns' to 1, so that each button is on
|
||||||
* case (if we're doing this sort of thing, why not have
|
* its own line.
|
||||||
* the general ability to have a particular button span
|
*/
|
||||||
* more than one column whether it's the last one or not?)
|
int ncolumns;
|
||||||
* but actually it's reasonably common for the sort of
|
int nbuttons;
|
||||||
* three-way control you get a lot of in PuTTY: `yes'
|
/*
|
||||||
* versus `no' versus `some more complex way to decide'.
|
* This points to a dynamically allocated array of `char *'
|
||||||
*
|
* pointers, each of which points to a dynamically
|
||||||
* Secondly, setting `nbuttons' higher than `ncolumns' lets
|
* allocated string.
|
||||||
* us have more than one line of radio buttons for a single
|
*/
|
||||||
* setting. A very important special case of this is
|
char **buttons; /* `nbuttons' button labels */
|
||||||
* setting `ncolumns' to 1, so that each button is on its
|
/*
|
||||||
* own line.
|
* This points to a dynamically allocated array of `char'
|
||||||
*/
|
* giving the individual keyboard shortcuts for each radio
|
||||||
int ncolumns;
|
* button. The array may be NULL if none are required.
|
||||||
int nbuttons;
|
*/
|
||||||
/*
|
char *shortcuts; /* `nbuttons' shortcuts; may be NULL */
|
||||||
* This points to a dynamically allocated array of `char *'
|
/*
|
||||||
* pointers, each of which points to a dynamically
|
* This points to a dynamically allocated array of
|
||||||
* allocated string.
|
* intorptr, giving helpful data for each button.
|
||||||
*/
|
*/
|
||||||
char **buttons; /* `nbuttons' button labels */
|
intorptr *buttondata; /* `nbuttons' entries; may be NULL */
|
||||||
/*
|
} radio;
|
||||||
* This points to a dynamically allocated array of `char'
|
struct { /* for CTRL_CHECKBOX */
|
||||||
* giving the individual keyboard shortcuts for each radio
|
char shortcut;
|
||||||
* button. The array may be NULL if none are required.
|
} checkbox;
|
||||||
*/
|
struct { /* for CTRL_BUTTON */
|
||||||
char *shortcuts; /* `nbuttons' shortcuts; may be NULL */
|
char shortcut;
|
||||||
/*
|
/*
|
||||||
* This points to a dynamically allocated array of
|
* At least Windows has the concept of a `default push
|
||||||
* intorptr, giving helpful data for each button.
|
* button', which gets implicitly pressed when you hit
|
||||||
*/
|
* Return even if it doesn't have the input focus.
|
||||||
intorptr *buttondata; /* `nbuttons' entries; may be NULL */
|
*/
|
||||||
} radio;
|
bool isdefault;
|
||||||
struct {
|
/*
|
||||||
STANDARD_PREFIX;
|
* Also, the reverse of this: a default cancel-type
|
||||||
char shortcut;
|
* button, which is implicitly pressed when you hit
|
||||||
} checkbox;
|
* Escape.
|
||||||
struct {
|
*/
|
||||||
STANDARD_PREFIX;
|
bool iscancel;
|
||||||
char shortcut;
|
} button;
|
||||||
/*
|
struct { /* for CTRL_LISTBOX */
|
||||||
* At least Windows has the concept of a `default push
|
char shortcut; /* keyboard shortcut */
|
||||||
* button', which gets implicitly pressed when you hit
|
/*
|
||||||
* Return even if it doesn't have the input focus.
|
* Height of the list box, in approximate number of lines.
|
||||||
*/
|
* If this is zero, the list is a drop-down list.
|
||||||
bool isdefault;
|
*/
|
||||||
/*
|
int height; /* height in lines */
|
||||||
* Also, the reverse of this: a default cancel-type button,
|
/*
|
||||||
* which is implicitly pressed when you hit Escape.
|
* If this is set, the list elements can be reordered by
|
||||||
*/
|
* the user (by drag-and-drop or by Up and Down buttons,
|
||||||
bool iscancel;
|
* whatever the per-platform implementation feels
|
||||||
} button;
|
* comfortable with). This is not guaranteed to work on a
|
||||||
struct {
|
* drop-down list, so don't try it!
|
||||||
STANDARD_PREFIX;
|
*/
|
||||||
char shortcut; /* keyboard shortcut */
|
bool draglist;
|
||||||
/*
|
/*
|
||||||
* Height of the list box, in approximate number of lines.
|
* If this is non-zero, the list can have more than one
|
||||||
* If this is zero, the list is a drop-down list.
|
* element selected at a time. This is not guaranteed to
|
||||||
*/
|
* work on a drop-down list, so don't try it!
|
||||||
int height; /* height in lines */
|
*
|
||||||
/*
|
* Different non-zero values request slightly different
|
||||||
* If this is set, the list elements can be reordered by
|
* types of multi-selection (this may well be meaningful
|
||||||
* the user (by drag-and-drop or by Up and Down buttons,
|
* only in GTK, so everyone else can ignore it if they
|
||||||
* whatever the per-platform implementation feels
|
* want). 1 means the list box expects to have individual
|
||||||
* comfortable with). This is not guaranteed to work on a
|
* items selected, whereas 2 means it expects the user to
|
||||||
* drop-down list, so don't try it!
|
* want to select a large contiguous range at a time.
|
||||||
*/
|
*/
|
||||||
bool draglist;
|
int multisel;
|
||||||
/*
|
/*
|
||||||
* If this is non-zero, the list can have more than one
|
* Percentage of the dialog-box width used by the list
|
||||||
* element selected at a time. This is not guaranteed to
|
* box. If this is set to 100, the label is on its own
|
||||||
* work on a drop-down list, so don't try it!
|
* line; otherwise the label is on the same line as the
|
||||||
*
|
* box itself. Setting this to anything other than 100 is
|
||||||
* Different non-zero values request slightly different
|
* not guaranteed to work on a _non_-drop-down list, so
|
||||||
* types of multi-selection (this may well be meaningful
|
* don't try it!
|
||||||
* only in GTK, so everyone else can ignore it if they
|
*/
|
||||||
* want). 1 means the list box expects to have individual
|
int percentwidth;
|
||||||
* items selected, whereas 2 means it expects the user to
|
/*
|
||||||
* want to select a large contiguous range at a time.
|
* Some list boxes contain strings that contain tab
|
||||||
*/
|
* characters. If `ncols' is greater than 0, then
|
||||||
int multisel;
|
* `percentages' is expected to be non-zero and to contain
|
||||||
/*
|
* the respective widths of `ncols' columns, which
|
||||||
* Percentage of the dialog-box width used by the list box.
|
* together will exactly fit the width of the list box.
|
||||||
* If this is set to 100, the label is on its own line;
|
* Otherwise `percentages' must be NULL.
|
||||||
* otherwise the label is on the same line as the box
|
*
|
||||||
* itself. Setting this to anything other than 100 is not
|
* There should never be more than one column in a
|
||||||
* guaranteed to work on a _non_-drop-down list, so don't
|
* drop-down list (one with height==0), because front ends
|
||||||
* try it!
|
* may have to implement it as a special case of an
|
||||||
*/
|
* editable combo box.
|
||||||
int percentwidth;
|
*/
|
||||||
/*
|
int ncols; /* number of columns */
|
||||||
* Some list boxes contain strings that contain tab
|
int *percentages; /* % width of each column */
|
||||||
* characters. If `ncols' is greater than 0, then
|
/*
|
||||||
* `percentages' is expected to be non-zero and to contain
|
* Flag which can be set to false to suppress the
|
||||||
* the respective widths of `ncols' columns, which together
|
* horizontal scroll bar if a list box entry goes off the
|
||||||
* will exactly fit the width of the list box. Otherwise
|
* right-hand side.
|
||||||
* `percentages' must be NULL.
|
*/
|
||||||
*
|
bool hscroll;
|
||||||
* There should never be more than one column in a
|
} listbox;
|
||||||
* drop-down list (one with height==0), because front ends
|
struct { /* for CTRL_FILESELECT */
|
||||||
* may have to implement it as a special case of an
|
char shortcut;
|
||||||
* editable combo box.
|
/*
|
||||||
*/
|
* `filter' dictates what type of files will be selected
|
||||||
int ncols; /* number of columns */
|
* by default; for example, when selecting private key
|
||||||
int *percentages; /* % width of each column */
|
* files the file selector would do well to only show .PPK
|
||||||
/*
|
* files (on those systems where this is the chosen
|
||||||
* Flag which can be set to false to suppress the horizontal
|
* extension).
|
||||||
* scroll bar if a list box entry goes off the right-hand
|
*
|
||||||
* side.
|
* The precise contents of `filter' are platform-defined,
|
||||||
*/
|
* unfortunately. The special value NULL means `all files'
|
||||||
bool hscroll;
|
* and is always a valid fallback.
|
||||||
} listbox;
|
*
|
||||||
struct {
|
* Unlike almost all strings in this structure, this value
|
||||||
STANDARD_PREFIX;
|
* is NOT expected to require freeing (although of course
|
||||||
char shortcut;
|
* you can always use ctrl_alloc if you do need to create
|
||||||
/*
|
* one on the fly). This is because the likely mode of use
|
||||||
* `filter' dictates what type of files will be selected by
|
* is to define string constants in a platform-specific
|
||||||
* default; for example, when selecting private key files
|
* header file, and directly reference those. Or worse, a
|
||||||
* the file selector would do well to only show .PPK files
|
* particular platform might choose to cast integers into
|
||||||
* (on those systems where this is the chosen extension).
|
* this pointer type...
|
||||||
*
|
*/
|
||||||
* The precise contents of `filter' are platform-defined,
|
char const *filter;
|
||||||
* unfortunately. The special value NULL means `all files'
|
/*
|
||||||
* and is always a valid fallback.
|
* Some systems like to know whether a file selector is
|
||||||
*
|
* choosing a file to read or one to write (and possibly
|
||||||
* Unlike almost all strings in this structure, this value
|
* create).
|
||||||
* is NOT expected to require freeing (although of course
|
*/
|
||||||
* you can always use ctrl_alloc if you do need to create
|
bool for_writing;
|
||||||
* one on the fly). This is because the likely mode of use
|
/*
|
||||||
* is to define string constants in a platform-specific
|
* On at least some platforms, the file selector is a
|
||||||
* header file, and directly reference those. Or worse, a
|
* separate dialog box, and contains a user-settable
|
||||||
* particular platform might choose to cast integers into
|
* title.
|
||||||
* this pointer type...
|
*
|
||||||
*/
|
* This value _is_ expected to require freeing.
|
||||||
char const *filter;
|
*/
|
||||||
/*
|
char *title;
|
||||||
* Some systems like to know whether a file selector is
|
} fileselect;
|
||||||
* choosing a file to read or one to write (and possibly
|
struct { /* for CTRL_COLUMNS */
|
||||||
* create).
|
/* In this variant, `label' MUST be NULL. */
|
||||||
*/
|
int ncols; /* number of columns */
|
||||||
bool for_writing;
|
int *percentages; /* % width of each column */
|
||||||
/*
|
/*
|
||||||
* On at least some platforms, the file selector is a
|
* Every time this control type appears, exactly one of
|
||||||
* separate dialog box, and contains a user-settable title.
|
* `ncols' and the previous number of columns MUST be one.
|
||||||
*
|
* Attempting to allow a seamless transition from a four-
|
||||||
* This value _is_ expected to require freeing.
|
* to a five-column layout, for example, would be way more
|
||||||
*/
|
* trouble than it was worth. If you must lay things out
|
||||||
char *title;
|
* like that, define eight unevenly sized columns and use
|
||||||
} fileselect;
|
* column-spanning a lot. But better still, just don't.
|
||||||
struct {
|
*
|
||||||
/* In this variant, `label' MUST be NULL. */
|
* `percentages' may be NULL if ncols==1, to save space.
|
||||||
STANDARD_PREFIX;
|
*/
|
||||||
int ncols; /* number of columns */
|
} columns;
|
||||||
int *percentages; /* % width of each column */
|
struct { /* for CTRL_FONTSELECT */
|
||||||
/*
|
char shortcut;
|
||||||
* Every time this control type appears, exactly one of
|
} fontselect;
|
||||||
* `ncols' and the previous number of columns MUST be one.
|
};
|
||||||
* Attempting to allow a seamless transition from a four-
|
|
||||||
* to a five-column layout, for example, would be way more
|
|
||||||
* trouble than it was worth. If you must lay things out
|
|
||||||
* like that, define eight unevenly sized columns and use
|
|
||||||
* column-spanning a lot. But better still, just don't.
|
|
||||||
*
|
|
||||||
* `percentages' may be NULL if ncols==1, to save space.
|
|
||||||
*/
|
|
||||||
} columns;
|
|
||||||
struct {
|
|
||||||
STANDARD_PREFIX;
|
|
||||||
char shortcut;
|
|
||||||
} fontselect;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef STANDARD_PREFIX
|
#undef STANDARD_PREFIX
|
||||||
|
@ -14,7 +14,7 @@ static void about_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
if (event == EVENT_ACTION) {
|
if (event == EVENT_ACTION) {
|
||||||
about_box(ctrl->generic.context.p);
|
about_box(ctrl->context.p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ void gtk_setup_config_box(struct controlbox *b, bool midsession, void *win)
|
|||||||
s = ctrl_getset(b, "", "", "");
|
s = ctrl_getset(b, "", "", "");
|
||||||
c = ctrl_pushbutton(s, "About", 'a', HELPCTX(no_help),
|
c = ctrl_pushbutton(s, "About", 'a', HELPCTX(no_help),
|
||||||
about_handler, P(win));
|
about_handler, P(win));
|
||||||
c->generic.column = 0;
|
c->column = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -50,8 +50,8 @@ void gtk_setup_config_box(struct controlbox *b, bool midsession, void *win)
|
|||||||
*/
|
*/
|
||||||
for (i = 0; i < s->ncontrols; i++) {
|
for (i = 0; i < s->ncontrols; i++) {
|
||||||
c = s->ctrls[i];
|
c = s->ctrls[i];
|
||||||
if (c->generic.type == CTRL_CHECKBOX &&
|
if (c->type == CTRL_CHECKBOX &&
|
||||||
c->generic.context.i == CONF_scrollbar) {
|
c->context.i == CONF_scrollbar) {
|
||||||
/*
|
/*
|
||||||
* Control i is the scrollbar checkbox.
|
* Control i is the scrollbar checkbox.
|
||||||
* Control s->ncontrols-1 is the scrollbar-on-left one.
|
* Control s->ncontrols-1 is the scrollbar-on-left one.
|
||||||
|
@ -28,7 +28,7 @@ void unix_setup_config_box(struct controlbox *b, bool midsession, int protocol)
|
|||||||
* control.
|
* control.
|
||||||
*/
|
*/
|
||||||
s = ctrl_getset(b, "Terminal", "printing", "Remote-controlled printing");
|
s = ctrl_getset(b, "Terminal", "printing", "Remote-controlled printing");
|
||||||
assert(s->ncontrols == 1 && s->ctrls[0]->generic.type == CTRL_EDITBOX);
|
assert(s->ncontrols == 1 && s->ctrls[0]->type == CTRL_EDITBOX);
|
||||||
s->ctrls[0]->editbox.has_list = false;
|
s->ctrls[0]->editbox.has_list = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -39,9 +39,9 @@ void unix_setup_config_box(struct controlbox *b, bool midsession, int protocol)
|
|||||||
s = ctrl_getset(b, "Connection/Proxy", "basics", NULL);
|
s = ctrl_getset(b, "Connection/Proxy", "basics", NULL);
|
||||||
for (i = 0; i < s->ncontrols; i++) {
|
for (i = 0; i < s->ncontrols; i++) {
|
||||||
c = s->ctrls[i];
|
c = s->ctrls[i];
|
||||||
if (c->generic.type == CTRL_LISTBOX &&
|
if (c->type == CTRL_LISTBOX &&
|
||||||
c->generic.handler == proxy_type_handler) {
|
c->handler == proxy_type_handler) {
|
||||||
c->generic.context.i |= PROXY_UI_FLAG_LOCAL;
|
c->context.i |= PROXY_UI_FLAG_LOCAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
156
unix/dialog.c
156
unix/dialog.c
@ -268,7 +268,7 @@ dlgcontrol *dlg_last_focused(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
void dlg_radiobutton_set(dlgcontrol *ctrl, dlgparam *dp, int which)
|
void dlg_radiobutton_set(dlgcontrol *ctrl, dlgparam *dp, int which)
|
||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
assert(uc->ctrl->generic.type == CTRL_RADIO);
|
assert(uc->ctrl->type == CTRL_RADIO);
|
||||||
assert(uc->buttons != NULL);
|
assert(uc->buttons != NULL);
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(uc->buttons[which]), true);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(uc->buttons[which]), true);
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ int dlg_radiobutton_get(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
assert(uc->ctrl->generic.type == CTRL_RADIO);
|
assert(uc->ctrl->type == CTRL_RADIO);
|
||||||
assert(uc->buttons != NULL);
|
assert(uc->buttons != NULL);
|
||||||
for (i = 0; i < uc->nbuttons; i++)
|
for (i = 0; i < uc->nbuttons; i++)
|
||||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(uc->buttons[i])))
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(uc->buttons[i])))
|
||||||
@ -289,14 +289,14 @@ int dlg_radiobutton_get(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
void dlg_checkbox_set(dlgcontrol *ctrl, dlgparam *dp, bool checked)
|
void dlg_checkbox_set(dlgcontrol *ctrl, dlgparam *dp, bool checked)
|
||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
assert(uc->ctrl->generic.type == CTRL_CHECKBOX);
|
assert(uc->ctrl->type == CTRL_CHECKBOX);
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(uc->toplevel), checked);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(uc->toplevel), checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dlg_checkbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
bool dlg_checkbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
assert(uc->ctrl->generic.type == CTRL_CHECKBOX);
|
assert(uc->ctrl->type == CTRL_CHECKBOX);
|
||||||
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(uc->toplevel));
|
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(uc->toplevel));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ void dlg_editbox_set(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
|||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
char *tmpstring;
|
char *tmpstring;
|
||||||
assert(uc->ctrl->generic.type == CTRL_EDITBOX);
|
assert(uc->ctrl->type == CTRL_EDITBOX);
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,4,0)
|
#if GTK_CHECK_VERSION(2,4,0)
|
||||||
if (uc->combo)
|
if (uc->combo)
|
||||||
@ -341,7 +341,7 @@ void dlg_editbox_set(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
|||||||
char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
assert(uc->ctrl->generic.type == CTRL_EDITBOX);
|
assert(uc->ctrl->type == CTRL_EDITBOX);
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,4,0)
|
#if GTK_CHECK_VERSION(2,4,0)
|
||||||
if (uc->combo) {
|
if (uc->combo) {
|
||||||
@ -371,8 +371,8 @@ void dlg_listbox_clear(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
assert(uc->ctrl->generic.type == CTRL_EDITBOX ||
|
assert(uc->ctrl->type == CTRL_EDITBOX ||
|
||||||
uc->ctrl->generic.type == CTRL_LISTBOX);
|
uc->ctrl->type == CTRL_LISTBOX);
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION(2,4,0)
|
#if !GTK_CHECK_VERSION(2,4,0)
|
||||||
if (uc->menu) {
|
if (uc->menu) {
|
||||||
@ -399,8 +399,8 @@ void dlg_listbox_del(dlgcontrol *ctrl, dlgparam *dp, int index)
|
|||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
assert(uc->ctrl->generic.type == CTRL_EDITBOX ||
|
assert(uc->ctrl->type == CTRL_EDITBOX ||
|
||||||
uc->ctrl->generic.type == CTRL_LISTBOX);
|
uc->ctrl->type == CTRL_LISTBOX);
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION(2,4,0)
|
#if !GTK_CHECK_VERSION(2,4,0)
|
||||||
if (uc->menu) {
|
if (uc->menu) {
|
||||||
@ -446,8 +446,8 @@ void dlg_listbox_addwithid(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
assert(uc->ctrl->generic.type == CTRL_EDITBOX ||
|
assert(uc->ctrl->type == CTRL_EDITBOX ||
|
||||||
uc->ctrl->generic.type == CTRL_LISTBOX);
|
uc->ctrl->type == CTRL_LISTBOX);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This routine is long and complicated in both GTK 1 and 2,
|
* This routine is long and complicated in both GTK 1 and 2,
|
||||||
@ -569,7 +569,7 @@ void dlg_listbox_addwithid(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
* Now go through text and divide it into columns at the tabs,
|
* Now go through text and divide it into columns at the tabs,
|
||||||
* as necessary.
|
* as necessary.
|
||||||
*/
|
*/
|
||||||
cols = (uc->ctrl->generic.type == CTRL_LISTBOX ? ctrl->listbox.ncols : 1);
|
cols = (uc->ctrl->type == CTRL_LISTBOX ? ctrl->listbox.ncols : 1);
|
||||||
cols = cols ? cols : 1;
|
cols = cols ? cols : 1;
|
||||||
for (i = 0; i < cols; i++) {
|
for (i = 0; i < cols; i++) {
|
||||||
int collen = strcspn(text, "\t");
|
int collen = strcspn(text, "\t");
|
||||||
@ -593,8 +593,8 @@ int dlg_listbox_getid(dlgcontrol *ctrl, dlgparam *dp, int index)
|
|||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
assert(uc->ctrl->generic.type == CTRL_EDITBOX ||
|
assert(uc->ctrl->type == CTRL_EDITBOX ||
|
||||||
uc->ctrl->generic.type == CTRL_LISTBOX);
|
uc->ctrl->type == CTRL_LISTBOX);
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION(2,4,0)
|
#if !GTK_CHECK_VERSION(2,4,0)
|
||||||
if (uc->menu || uc->list) {
|
if (uc->menu || uc->list) {
|
||||||
@ -632,8 +632,8 @@ int dlg_listbox_index(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
assert(uc->ctrl->generic.type == CTRL_EDITBOX ||
|
assert(uc->ctrl->type == CTRL_EDITBOX ||
|
||||||
uc->ctrl->generic.type == CTRL_LISTBOX);
|
uc->ctrl->type == CTRL_LISTBOX);
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION(2,4,0)
|
#if !GTK_CHECK_VERSION(2,4,0)
|
||||||
if (uc->menu || uc->list) {
|
if (uc->menu || uc->list) {
|
||||||
@ -716,16 +716,16 @@ bool dlg_listbox_issel(dlgcontrol *ctrl, dlgparam *dp, int index)
|
|||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
assert(uc->ctrl->generic.type == CTRL_EDITBOX ||
|
assert(uc->ctrl->type == CTRL_EDITBOX ||
|
||||||
uc->ctrl->generic.type == CTRL_LISTBOX);
|
uc->ctrl->type == CTRL_LISTBOX);
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION(2,4,0)
|
#if !GTK_CHECK_VERSION(2,4,0)
|
||||||
if (uc->menu || uc->list) {
|
if (uc->menu || uc->list) {
|
||||||
GList *children;
|
GList *children;
|
||||||
GtkWidget *item, *activeitem;
|
GtkWidget *item, *activeitem;
|
||||||
|
|
||||||
assert(uc->ctrl->generic.type == CTRL_EDITBOX ||
|
assert(uc->ctrl->type == CTRL_EDITBOX ||
|
||||||
uc->ctrl->generic.type == CTRL_LISTBOX);
|
uc->ctrl->type == CTRL_LISTBOX);
|
||||||
assert(uc->menu != NULL || uc->list != NULL);
|
assert(uc->menu != NULL || uc->list != NULL);
|
||||||
|
|
||||||
children = gtk_container_children(GTK_CONTAINER(uc->menu ? uc->menu :
|
children = gtk_container_children(GTK_CONTAINER(uc->menu ? uc->menu :
|
||||||
@ -773,8 +773,8 @@ void dlg_listbox_select(dlgcontrol *ctrl, dlgparam *dp, int index)
|
|||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
assert(uc->ctrl->generic.type == CTRL_EDITBOX ||
|
assert(uc->ctrl->type == CTRL_EDITBOX ||
|
||||||
uc->ctrl->generic.type == CTRL_LISTBOX);
|
uc->ctrl->type == CTRL_LISTBOX);
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION(2,4,0)
|
#if !GTK_CHECK_VERSION(2,4,0)
|
||||||
if (uc->optmenu) {
|
if (uc->optmenu) {
|
||||||
@ -841,7 +841,7 @@ void dlg_text_set(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
|||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
assert(uc->ctrl->generic.type == CTRL_TEXT);
|
assert(uc->ctrl->type == CTRL_TEXT);
|
||||||
assert(uc->text != NULL);
|
assert(uc->text != NULL);
|
||||||
|
|
||||||
gtk_label_set_text(GTK_LABEL(uc->text), text);
|
gtk_label_set_text(GTK_LABEL(uc->text), text);
|
||||||
@ -851,7 +851,7 @@ void dlg_label_change(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
|||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
switch (uc->ctrl->generic.type) {
|
switch (uc->ctrl->type) {
|
||||||
case CTRL_BUTTON:
|
case CTRL_BUTTON:
|
||||||
gtk_label_set_text(GTK_LABEL(uc->toplevel), text);
|
gtk_label_set_text(GTK_LABEL(uc->toplevel), text);
|
||||||
shortcut_highlight(uc->toplevel, ctrl->button.shortcut);
|
shortcut_highlight(uc->toplevel, ctrl->button.shortcut);
|
||||||
@ -891,7 +891,7 @@ void dlg_filesel_set(dlgcontrol *ctrl, dlgparam *dp, Filename *fn)
|
|||||||
/* We must copy fn->path before passing it to gtk_entry_set_text.
|
/* We must copy fn->path before passing it to gtk_entry_set_text.
|
||||||
* See comment in dlg_editbox_set() for the reasons. */
|
* See comment in dlg_editbox_set() for the reasons. */
|
||||||
char *duppath = dupstr(fn->path);
|
char *duppath = dupstr(fn->path);
|
||||||
assert(uc->ctrl->generic.type == CTRL_FILESELECT);
|
assert(uc->ctrl->type == CTRL_FILESELECT);
|
||||||
assert(uc->entry != NULL);
|
assert(uc->entry != NULL);
|
||||||
gtk_entry_set_text(GTK_ENTRY(uc->entry), duppath);
|
gtk_entry_set_text(GTK_ENTRY(uc->entry), duppath);
|
||||||
sfree(duppath);
|
sfree(duppath);
|
||||||
@ -900,7 +900,7 @@ void dlg_filesel_set(dlgcontrol *ctrl, dlgparam *dp, Filename *fn)
|
|||||||
Filename *dlg_filesel_get(dlgcontrol *ctrl, dlgparam *dp)
|
Filename *dlg_filesel_get(dlgcontrol *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
assert(uc->ctrl->generic.type == CTRL_FILESELECT);
|
assert(uc->ctrl->type == CTRL_FILESELECT);
|
||||||
assert(uc->entry != NULL);
|
assert(uc->entry != NULL);
|
||||||
return filename_from_str(gtk_entry_get_text(GTK_ENTRY(uc->entry)));
|
return filename_from_str(gtk_entry_get_text(GTK_ENTRY(uc->entry)));
|
||||||
}
|
}
|
||||||
@ -911,7 +911,7 @@ void dlg_fontsel_set(dlgcontrol *ctrl, dlgparam *dp, FontSpec *fs)
|
|||||||
/* We must copy fs->name before passing it to gtk_entry_set_text.
|
/* We must copy fs->name before passing it to gtk_entry_set_text.
|
||||||
* See comment in dlg_editbox_set() for the reasons. */
|
* See comment in dlg_editbox_set() for the reasons. */
|
||||||
char *dupname = dupstr(fs->name);
|
char *dupname = dupstr(fs->name);
|
||||||
assert(uc->ctrl->generic.type == CTRL_FONTSELECT);
|
assert(uc->ctrl->type == CTRL_FONTSELECT);
|
||||||
assert(uc->entry != NULL);
|
assert(uc->entry != NULL);
|
||||||
gtk_entry_set_text(GTK_ENTRY(uc->entry), dupname);
|
gtk_entry_set_text(GTK_ENTRY(uc->entry), dupname);
|
||||||
sfree(dupname);
|
sfree(dupname);
|
||||||
@ -920,7 +920,7 @@ void dlg_fontsel_set(dlgcontrol *ctrl, dlgparam *dp, FontSpec *fs)
|
|||||||
FontSpec *dlg_fontsel_get(dlgcontrol *ctrl, dlgparam *dp)
|
FontSpec *dlg_fontsel_get(dlgcontrol *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
assert(uc->ctrl->generic.type == CTRL_FONTSELECT);
|
assert(uc->ctrl->type == CTRL_FONTSELECT);
|
||||||
assert(uc->entry != NULL);
|
assert(uc->entry != NULL);
|
||||||
return fontspec_new(gtk_entry_get_text(GTK_ENTRY(uc->entry)));
|
return fontspec_new(gtk_entry_get_text(GTK_ENTRY(uc->entry)));
|
||||||
}
|
}
|
||||||
@ -950,7 +950,7 @@ void dlg_set_focus(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
{
|
{
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
switch (ctrl->generic.type) {
|
switch (ctrl->type) {
|
||||||
case CTRL_CHECKBOX:
|
case CTRL_CHECKBOX:
|
||||||
case CTRL_BUTTON:
|
case CTRL_BUTTON:
|
||||||
/* Check boxes and buttons get the focus _and_ get toggled. */
|
/* Check boxes and buttons get the focus _and_ get toggled. */
|
||||||
@ -1082,15 +1082,15 @@ void dlg_refresh(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
struct uctrl *uc;
|
struct uctrl *uc;
|
||||||
|
|
||||||
if (ctrl) {
|
if (ctrl) {
|
||||||
if (ctrl->generic.handler != NULL)
|
if (ctrl->handler != NULL)
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_REFRESH);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_REFRESH);
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; (uc = index234(dp->byctrl, i)) != NULL; i++) {
|
for (i = 0; (uc = index234(dp->byctrl, i)) != NULL; i++) {
|
||||||
assert(uc->ctrl != NULL);
|
assert(uc->ctrl != NULL);
|
||||||
if (uc->ctrl->generic.handler != NULL)
|
if (uc->ctrl->handler != NULL)
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp,
|
uc->ctrl->handler(uc->ctrl, dp,
|
||||||
dp->data, EVENT_REFRESH);
|
dp->data, EVENT_REFRESH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1221,14 +1221,14 @@ static void button_clicked(GtkButton *button, gpointer data)
|
|||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)data;
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(button));
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(button));
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_ACTION);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_ACTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void button_toggled(GtkToggleButton *tb, gpointer data)
|
static void button_toggled(GtkToggleButton *tb, gpointer data)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)data;
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(tb));
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(tb));
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_VALCHANGE);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean editbox_key(GtkWidget *widget, GdkEventKey *event,
|
static gboolean editbox_key(GtkWidget *widget, GdkEventKey *event,
|
||||||
@ -1259,7 +1259,7 @@ static void editbox_changed(GtkEditable *ed, gpointer data)
|
|||||||
struct dlgparam *dp = (struct dlgparam *)data;
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
if (!(dp->flags & FLAG_UPDATING_COMBO_LIST)) {
|
if (!(dp->flags & FLAG_UPDATING_COMBO_LIST)) {
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(ed));
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(ed));
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_VALCHANGE);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1268,7 +1268,7 @@ static gboolean editbox_lostfocus(GtkWidget *ed, GdkEventFocus *event,
|
|||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)data;
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(ed));
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(ed));
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_REFRESH);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_REFRESH);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1404,7 +1404,7 @@ static gboolean listitem_button_release(GtkWidget *item, GdkEventButton *event,
|
|||||||
struct dlgparam *dp = (struct dlgparam *)data;
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(item));
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(item));
|
||||||
if (uc->nclicks>1) {
|
if (uc->nclicks>1) {
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_ACTION);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_ACTION);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1415,7 +1415,7 @@ static void list_selchange(GtkList *list, gpointer data)
|
|||||||
struct dlgparam *dp = (struct dlgparam *)data;
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(list));
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(list));
|
||||||
if (!uc) return;
|
if (!uc) return;
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_SELCHANGE);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_SELCHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draglist_move(struct dlgparam *dp, struct uctrl *uc, int direction)
|
static void draglist_move(struct dlgparam *dp, struct uctrl *uc, int direction)
|
||||||
@ -1440,7 +1440,7 @@ static void draglist_move(struct dlgparam *dp, struct uctrl *uc, int direction)
|
|||||||
children = g_list_append(children, child);
|
children = g_list_append(children, child);
|
||||||
gtk_list_insert_items(GTK_LIST(uc->list), children, index + direction);
|
gtk_list_insert_items(GTK_LIST(uc->list), children, index + direction);
|
||||||
gtk_list_select_item(GTK_LIST(uc->list), index + direction);
|
gtk_list_select_item(GTK_LIST(uc->list), index + direction);
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_VALCHANGE);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draglist_up(GtkButton *button, gpointer data)
|
static void draglist_up(GtkButton *button, gpointer data)
|
||||||
@ -1469,7 +1469,7 @@ static void listbox_doubleclick(GtkTreeView *treeview, GtkTreePath *path,
|
|||||||
struct dlgparam *dp = (struct dlgparam *)data;
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(treeview));
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(treeview));
|
||||||
if (uc)
|
if (uc)
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_ACTION);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_ACTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void listbox_selchange(GtkTreeSelection *treeselection,
|
static void listbox_selchange(GtkTreeSelection *treeselection,
|
||||||
@ -1479,7 +1479,7 @@ static void listbox_selchange(GtkTreeSelection *treeselection,
|
|||||||
GtkTreeView *tree = gtk_tree_selection_get_tree_view(treeselection);
|
GtkTreeView *tree = gtk_tree_selection_get_tree_view(treeselection);
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(tree));
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(tree));
|
||||||
if (uc)
|
if (uc)
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_SELCHANGE);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_SELCHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct draglist_valchange_ctx {
|
struct draglist_valchange_ctx {
|
||||||
@ -1492,7 +1492,7 @@ static gboolean draglist_valchange(gpointer data)
|
|||||||
struct draglist_valchange_ctx *ctx =
|
struct draglist_valchange_ctx *ctx =
|
||||||
(struct draglist_valchange_ctx *)data;
|
(struct draglist_valchange_ctx *)data;
|
||||||
|
|
||||||
ctx->uc->ctrl->generic.handler(ctx->uc->ctrl, ctx->dp,
|
ctx->uc->ctrl->handler(ctx->uc->ctrl, ctx->dp,
|
||||||
ctx->dp->data, EVENT_VALCHANGE);
|
ctx->dp->data, EVENT_VALCHANGE);
|
||||||
|
|
||||||
sfree(ctx);
|
sfree(ctx);
|
||||||
@ -1547,7 +1547,7 @@ static void menuitem_activate(GtkMenuItem *item, gpointer data)
|
|||||||
GtkWidget *menushell = GTK_WIDGET(item)->parent;
|
GtkWidget *menushell = GTK_WIDGET(item)->parent;
|
||||||
gpointer optmenu = g_object_get_data(G_OBJECT(menushell), "user-data");
|
gpointer optmenu = g_object_get_data(G_OBJECT(menushell), "user-data");
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(optmenu));
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(optmenu));
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_SELCHANGE);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_SELCHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -1557,7 +1557,7 @@ static void droplist_selchange(GtkComboBox *combo, gpointer data)
|
|||||||
struct dlgparam *dp = (struct dlgparam *)data;
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(combo));
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(combo));
|
||||||
if (uc)
|
if (uc)
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_SELCHANGE);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_SELCHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !GTK_CHECK_VERSION(2,4,0) */
|
#endif /* !GTK_CHECK_VERSION(2,4,0) */
|
||||||
@ -1631,7 +1631,7 @@ static void colourchoose_response(GtkDialog *dialog,
|
|||||||
dp->coloursel_result.ok = false;
|
dp->coloursel_result.ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK);
|
||||||
|
|
||||||
gtk_widget_destroy(GTK_WIDGET(dialog));
|
gtk_widget_destroy(GTK_WIDGET(dialog));
|
||||||
}
|
}
|
||||||
@ -1668,7 +1668,7 @@ static void coloursel_ok(GtkButton *button, gpointer data)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
dp->coloursel_result.ok = true;
|
dp->coloursel_result.ok = true;
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void coloursel_cancel(GtkButton *button, gpointer data)
|
static void coloursel_cancel(GtkButton *button, gpointer data)
|
||||||
@ -1677,7 +1677,7 @@ static void coloursel_cancel(GtkButton *button, gpointer data)
|
|||||||
gpointer coloursel = g_object_get_data(G_OBJECT(button), "user-data");
|
gpointer coloursel = g_object_get_data(G_OBJECT(button), "user-data");
|
||||||
struct uctrl *uc = g_object_get_data(G_OBJECT(coloursel), "user-data");
|
struct uctrl *uc = g_object_get_data(G_OBJECT(coloursel), "user-data");
|
||||||
dp->coloursel_result.ok = false;
|
dp->coloursel_result.ok = false;
|
||||||
uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK);
|
uc->ctrl->handler(uc->ctrl, dp, dp->data, EVENT_CALLBACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* end of coloursel response handlers */
|
#endif /* end of coloursel response handlers */
|
||||||
@ -1687,7 +1687,7 @@ static void filefont_clicked(GtkButton *button, gpointer data)
|
|||||||
struct dlgparam *dp = (struct dlgparam *)data;
|
struct dlgparam *dp = (struct dlgparam *)data;
|
||||||
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(button));
|
struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(button));
|
||||||
|
|
||||||
if (uc->ctrl->generic.type == CTRL_FILESELECT) {
|
if (uc->ctrl->type == CTRL_FILESELECT) {
|
||||||
#ifdef USE_GTK_FILE_CHOOSER_DIALOG
|
#ifdef USE_GTK_FILE_CHOOSER_DIALOG
|
||||||
GtkWidget *filechoose = gtk_file_chooser_dialog_new
|
GtkWidget *filechoose = gtk_file_chooser_dialog_new
|
||||||
(uc->ctrl->fileselect.title, GTK_WINDOW(dp->window),
|
(uc->ctrl->fileselect.title, GTK_WINDOW(dp->window),
|
||||||
@ -1723,7 +1723,7 @@ static void filefont_clicked(GtkButton *button, gpointer data)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uc->ctrl->generic.type == CTRL_FONTSELECT) {
|
if (uc->ctrl->type == CTRL_FONTSELECT) {
|
||||||
const gchar *fontname = gtk_entry_get_text(GTK_ENTRY(uc->entry));
|
const gchar *fontname = gtk_entry_get_text(GTK_ENTRY(uc->entry));
|
||||||
|
|
||||||
#if !GTK_CHECK_VERSION(2,0,0)
|
#if !GTK_CHECK_VERSION(2,0,0)
|
||||||
@ -1822,7 +1822,7 @@ static void label_sizealloc(GtkWidget *widget, GtkAllocation *alloc,
|
|||||||
struct uctrl *uc = dlg_find_bywidget(dp, widget);
|
struct uctrl *uc = dlg_find_bywidget(dp, widget);
|
||||||
|
|
||||||
gtk_widget_set_size_request(uc->text, alloc->width, -1);
|
gtk_widget_set_size_request(uc->text, alloc->width, -1);
|
||||||
gtk_label_set_text(GTK_LABEL(uc->text), uc->ctrl->generic.label);
|
gtk_label_set_text(GTK_LABEL(uc->text), uc->ctrl->label);
|
||||||
g_signal_handler_disconnect(G_OBJECT(uc->text), uc->textsig);
|
g_signal_handler_disconnect(G_OBJECT(uc->text), uc->textsig);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1882,7 +1882,7 @@ GtkWidget *layout_ctrls(
|
|||||||
bool left = false;
|
bool left = false;
|
||||||
GtkWidget *w = NULL;
|
GtkWidget *w = NULL;
|
||||||
|
|
||||||
switch (ctrl->generic.type) {
|
switch (ctrl->type) {
|
||||||
case CTRL_COLUMNS: {
|
case CTRL_COLUMNS: {
|
||||||
static const int simplecols[1] = { 100 };
|
static const int simplecols[1] = { 100 };
|
||||||
columns_set_cols(cols, ctrl->columns.ncols,
|
columns_set_cols(cols, ctrl->columns.ncols,
|
||||||
@ -1916,9 +1916,9 @@ GtkWidget *layout_ctrls(
|
|||||||
uc->label = NULL;
|
uc->label = NULL;
|
||||||
uc->nclicks = 0;
|
uc->nclicks = 0;
|
||||||
|
|
||||||
switch (ctrl->generic.type) {
|
switch (ctrl->type) {
|
||||||
case CTRL_BUTTON:
|
case CTRL_BUTTON:
|
||||||
w = gtk_button_new_with_label(ctrl->generic.label);
|
w = gtk_button_new_with_label(ctrl->label);
|
||||||
if (win) {
|
if (win) {
|
||||||
gtk_widget_set_can_default(w, true);
|
gtk_widget_set_can_default(w, true);
|
||||||
if (ctrl->button.isdefault)
|
if (ctrl->button.isdefault)
|
||||||
@ -1934,7 +1934,7 @@ GtkWidget *layout_ctrls(
|
|||||||
ctrl->button.shortcut, SHORTCUT_UCTRL, uc);
|
ctrl->button.shortcut, SHORTCUT_UCTRL, uc);
|
||||||
break;
|
break;
|
||||||
case CTRL_CHECKBOX:
|
case CTRL_CHECKBOX:
|
||||||
w = gtk_check_button_new_with_label(ctrl->generic.label);
|
w = gtk_check_button_new_with_label(ctrl->label);
|
||||||
g_signal_connect(G_OBJECT(w), "toggled",
|
g_signal_connect(G_OBJECT(w), "toggled",
|
||||||
G_CALLBACK(button_toggled), dp);
|
G_CALLBACK(button_toggled), dp);
|
||||||
g_signal_connect(G_OBJECT(w), "focus_in_event",
|
g_signal_connect(G_OBJECT(w), "focus_in_event",
|
||||||
@ -1952,8 +1952,8 @@ GtkWidget *layout_ctrls(
|
|||||||
GSList *group;
|
GSList *group;
|
||||||
|
|
||||||
w = columns_new(0);
|
w = columns_new(0);
|
||||||
if (ctrl->generic.label) {
|
if (ctrl->label) {
|
||||||
GtkWidget *label = gtk_label_new(ctrl->generic.label);
|
GtkWidget *label = gtk_label_new(ctrl->label);
|
||||||
columns_add(COLUMNS(w), label, 0, 1);
|
columns_add(COLUMNS(w), label, 0, 1);
|
||||||
columns_force_left_align(COLUMNS(w), label);
|
columns_force_left_align(COLUMNS(w), label);
|
||||||
gtk_widget_show(label);
|
gtk_widget_show(label);
|
||||||
@ -2069,10 +2069,10 @@ GtkWidget *layout_ctrls(
|
|||||||
gtk_entry_set_width_chars(GTK_ENTRY(w), 1);
|
gtk_entry_set_width_chars(GTK_ENTRY(w), 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ctrl->generic.label) {
|
if (ctrl->label) {
|
||||||
GtkWidget *label, *container;
|
GtkWidget *label, *container;
|
||||||
|
|
||||||
label = gtk_label_new(ctrl->generic.label);
|
label = gtk_label_new(ctrl->label);
|
||||||
|
|
||||||
shortcut_add(scs, label, ctrl->editbox.shortcut,
|
shortcut_add(scs, label, ctrl->editbox.shortcut,
|
||||||
SHORTCUT_FOCUS, uc->entry);
|
SHORTCUT_FOCUS, uc->entry);
|
||||||
@ -2105,20 +2105,20 @@ GtkWidget *layout_ctrls(
|
|||||||
case CTRL_FONTSELECT: {
|
case CTRL_FONTSELECT: {
|
||||||
GtkWidget *ww;
|
GtkWidget *ww;
|
||||||
const char *browsebtn =
|
const char *browsebtn =
|
||||||
(ctrl->generic.type == CTRL_FILESELECT ?
|
(ctrl->type == CTRL_FILESELECT ?
|
||||||
"Browse..." : "Change...");
|
"Browse..." : "Change...");
|
||||||
|
|
||||||
gint percentages[] = { 75, 25 };
|
gint percentages[] = { 75, 25 };
|
||||||
w = columns_new(4);
|
w = columns_new(4);
|
||||||
columns_set_cols(COLUMNS(w), 2, percentages);
|
columns_set_cols(COLUMNS(w), 2, percentages);
|
||||||
|
|
||||||
if (ctrl->generic.label) {
|
if (ctrl->label) {
|
||||||
ww = gtk_label_new(ctrl->generic.label);
|
ww = gtk_label_new(ctrl->label);
|
||||||
columns_add(COLUMNS(w), ww, 0, 2);
|
columns_add(COLUMNS(w), ww, 0, 2);
|
||||||
columns_force_left_align(COLUMNS(w), ww);
|
columns_force_left_align(COLUMNS(w), ww);
|
||||||
gtk_widget_show(ww);
|
gtk_widget_show(ww);
|
||||||
shortcut_add(scs, ww,
|
shortcut_add(scs, ww,
|
||||||
(ctrl->generic.type == CTRL_FILESELECT ?
|
(ctrl->type == CTRL_FILESELECT ?
|
||||||
ctrl->fileselect.shortcut :
|
ctrl->fileselect.shortcut :
|
||||||
ctrl->fontselect.shortcut),
|
ctrl->fontselect.shortcut),
|
||||||
SHORTCUT_UCTRL, uc);
|
SHORTCUT_UCTRL, uc);
|
||||||
@ -2404,10 +2404,10 @@ GtkWidget *layout_ctrls(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctrl->generic.label) {
|
if (ctrl->label) {
|
||||||
GtkWidget *label, *container;
|
GtkWidget *label, *container;
|
||||||
|
|
||||||
label = gtk_label_new(ctrl->generic.label);
|
label = gtk_label_new(ctrl->label);
|
||||||
#if GTK_CHECK_VERSION(3,0,0)
|
#if GTK_CHECK_VERSION(3,0,0)
|
||||||
gtk_label_set_width_chars(GTK_LABEL(label), 3);
|
gtk_label_set_width_chars(GTK_LABEL(label), 3);
|
||||||
#endif
|
#endif
|
||||||
@ -2477,7 +2477,7 @@ GtkWidget *layout_ctrls(
|
|||||||
* wrapping labels behave sensibly. So now we can just do
|
* wrapping labels behave sensibly. So now we can just do
|
||||||
* the obvious thing.
|
* the obvious thing.
|
||||||
*/
|
*/
|
||||||
uc->text = w = gtk_label_new(uc->ctrl->generic.label);
|
uc->text = w = gtk_label_new(uc->ctrl->label);
|
||||||
#endif
|
#endif
|
||||||
align_label_left(GTK_LABEL(w));
|
align_label_left(GTK_LABEL(w));
|
||||||
gtk_label_set_line_wrap(GTK_LABEL(w), true);
|
gtk_label_set_line_wrap(GTK_LABEL(w), true);
|
||||||
@ -2487,11 +2487,11 @@ GtkWidget *layout_ctrls(
|
|||||||
assert(w != NULL);
|
assert(w != NULL);
|
||||||
|
|
||||||
columns_add(cols, w,
|
columns_add(cols, w,
|
||||||
COLUMN_START(ctrl->generic.column),
|
COLUMN_START(ctrl->column),
|
||||||
COLUMN_SPAN(ctrl->generic.column));
|
COLUMN_SPAN(ctrl->column));
|
||||||
if (left)
|
if (left)
|
||||||
columns_force_left_align(cols, w);
|
columns_force_left_align(cols, w);
|
||||||
if (ctrl->generic.align_next_to) {
|
if (ctrl->align_next_to) {
|
||||||
/*
|
/*
|
||||||
* Implement align_next_to by simply forcing the two
|
* Implement align_next_to by simply forcing the two
|
||||||
* controls to have the same height of size allocation. At
|
* controls to have the same height of size allocation. At
|
||||||
@ -2502,7 +2502,7 @@ GtkWidget *layout_ctrls(
|
|||||||
* reasonably well.
|
* reasonably well.
|
||||||
*/
|
*/
|
||||||
struct uctrl *uc2 = dlg_find_byctrl(
|
struct uctrl *uc2 = dlg_find_byctrl(
|
||||||
dp, ctrl->generic.align_next_to);
|
dp, ctrl->align_next_to);
|
||||||
assert(uc2);
|
assert(uc2);
|
||||||
columns_force_same_height(cols, w, uc2->toplevel);
|
columns_force_same_height(cols, w, uc2->toplevel);
|
||||||
|
|
||||||
@ -2657,7 +2657,7 @@ gint win_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
|
|||||||
* Precisely what this is depends on the type of
|
* Precisely what this is depends on the type of
|
||||||
* control.
|
* control.
|
||||||
*/
|
*/
|
||||||
switch (sc->uc->ctrl->generic.type) {
|
switch (sc->uc->ctrl->type) {
|
||||||
case CTRL_CHECKBOX:
|
case CTRL_CHECKBOX:
|
||||||
case CTRL_BUTTON:
|
case CTRL_BUTTON:
|
||||||
/* Check boxes and buttons get the focus _and_ get toggled. */
|
/* Check boxes and buttons get the focus _and_ get toggled. */
|
||||||
@ -3243,9 +3243,9 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
|
|||||||
|
|
||||||
if (*s->pathname) {
|
if (*s->pathname) {
|
||||||
for (j = 0; j < s->ncontrols; j++)
|
for (j = 0; j < s->ncontrols; j++)
|
||||||
if (s->ctrls[j]->generic.type != CTRL_TABDELAY &&
|
if (s->ctrls[j]->type != CTRL_TABDELAY &&
|
||||||
s->ctrls[j]->generic.type != CTRL_COLUMNS &&
|
s->ctrls[j]->type != CTRL_COLUMNS &&
|
||||||
s->ctrls[j]->generic.type != CTRL_TEXT) {
|
s->ctrls[j]->type != CTRL_TEXT) {
|
||||||
dlg_set_focus(s->ctrls[j], dp);
|
dlg_set_focus(s->ctrls[j], dp);
|
||||||
dp->lastfocus = s->ctrls[j];
|
dp->lastfocus = s->ctrls[j];
|
||||||
done = true;
|
done = true;
|
||||||
@ -3287,7 +3287,7 @@ static void messagebox_handler(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
if (event == EVENT_ACTION)
|
if (event == EVENT_ACTION)
|
||||||
dlg_end(dp, ctrl->generic.context.i);
|
dlg_end(dp, ctrl->context.i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct message_box_button button_array_yn[] = {
|
static const struct message_box_button button_array_yn[] = {
|
||||||
@ -3355,7 +3355,7 @@ static GtkWidget *create_message_box_general(
|
|||||||
c = ctrl_pushbutton(s0, button->title, button->shortcut,
|
c = ctrl_pushbutton(s0, button->title, button->shortcut,
|
||||||
HELPCTX(no_help), messagebox_handler,
|
HELPCTX(no_help), messagebox_handler,
|
||||||
I(button->value));
|
I(button->value));
|
||||||
c->generic.column = index++;
|
c->column = index++;
|
||||||
if (button->type > 0)
|
if (button->type > 0)
|
||||||
c->button.isdefault = true;
|
c->button.isdefault = true;
|
||||||
|
|
||||||
@ -4025,7 +4025,7 @@ void showeventlog(eventlog_stuff *es, void *parentwin)
|
|||||||
ctrl_columns(s0, 3, 33, 34, 33);
|
ctrl_columns(s0, 3, 33, 34, 33);
|
||||||
c = ctrl_pushbutton(s0, "Close", 'c', HELPCTX(no_help),
|
c = ctrl_pushbutton(s0, "Close", 'c', HELPCTX(no_help),
|
||||||
eventlog_ok_handler, P(NULL));
|
eventlog_ok_handler, P(NULL));
|
||||||
c->button.column = 1;
|
c->column = 1;
|
||||||
c->button.isdefault = true;
|
c->button.isdefault = true;
|
||||||
|
|
||||||
s1 = ctrl_getset(es->eventbox, "x", "", "");
|
s1 = ctrl_getset(es->eventbox, "x", "", "");
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
static void about_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
static void about_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
HWND *hwndp = (HWND *)ctrl->generic.context.p;
|
HWND *hwndp = (HWND *)ctrl->context.p;
|
||||||
|
|
||||||
if (event == EVENT_ACTION) {
|
if (event == EVENT_ACTION) {
|
||||||
modal_about_box(*hwndp);
|
modal_about_box(*hwndp);
|
||||||
@ -23,7 +23,7 @@ static void about_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
|||||||
static void help_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
static void help_handler(dlgcontrol *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
HWND *hwndp = (HWND *)ctrl->generic.context.p;
|
HWND *hwndp = (HWND *)ctrl->context.p;
|
||||||
|
|
||||||
if (event == EVENT_ACTION) {
|
if (event == EVENT_ACTION) {
|
||||||
show_help(*hwndp);
|
show_help(*hwndp);
|
||||||
@ -56,11 +56,11 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help,
|
|||||||
s = ctrl_getset(b, "", "", "");
|
s = ctrl_getset(b, "", "", "");
|
||||||
c = ctrl_pushbutton(s, "About", 'a', HELPCTX(no_help),
|
c = ctrl_pushbutton(s, "About", 'a', HELPCTX(no_help),
|
||||||
about_handler, P(hwndp));
|
about_handler, P(hwndp));
|
||||||
c->generic.column = 0;
|
c->column = 0;
|
||||||
if (has_help) {
|
if (has_help) {
|
||||||
c = ctrl_pushbutton(s, "Help", 'h', HELPCTX(no_help),
|
c = ctrl_pushbutton(s, "Help", 'h', HELPCTX(no_help),
|
||||||
help_handler, P(hwndp));
|
help_handler, P(hwndp));
|
||||||
c->generic.column = 1;
|
c->column = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,8 +82,8 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help,
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < s->ncontrols; i++) {
|
for (i = 0; i < s->ncontrols; i++) {
|
||||||
c = s->ctrls[i];
|
c = s->ctrls[i];
|
||||||
if (c->generic.type == CTRL_CHECKBOX &&
|
if (c->type == CTRL_CHECKBOX &&
|
||||||
c->generic.context.i == CONF_scrollbar) {
|
c->context.i == CONF_scrollbar) {
|
||||||
/*
|
/*
|
||||||
* Control i is the scrollbar checkbox.
|
* Control i is the scrollbar checkbox.
|
||||||
* Control s->ncontrols-1 is the scrollbar-in-FS one.
|
* Control s->ncontrols-1 is the scrollbar-in-FS one.
|
||||||
@ -134,9 +134,9 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help,
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < s->ncontrols; i++) {
|
for (i = 0; i < s->ncontrols; i++) {
|
||||||
c = s->ctrls[i];
|
c = s->ctrls[i];
|
||||||
if (c->generic.type == CTRL_RADIO &&
|
if (c->type == CTRL_RADIO &&
|
||||||
c->generic.context.i == CONF_beep) {
|
c->context.i == CONF_beep) {
|
||||||
assert(c->generic.handler == conf_radiobutton_handler);
|
assert(c->handler == conf_radiobutton_handler);
|
||||||
c->radio.nbuttons += 2;
|
c->radio.nbuttons += 2;
|
||||||
c->radio.buttons =
|
c->radio.buttons =
|
||||||
sresize(c->radio.buttons, c->radio.nbuttons, char *);
|
sresize(c->radio.buttons, c->radio.nbuttons, char *);
|
||||||
@ -233,9 +233,9 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help,
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < s->ncontrols; i++) {
|
for (i = 0; i < s->ncontrols; i++) {
|
||||||
c = s->ctrls[i];
|
c = s->ctrls[i];
|
||||||
if (c->generic.type == CTRL_RADIO &&
|
if (c->type == CTRL_RADIO &&
|
||||||
c->generic.context.i == CONF_vtmode) {
|
c->context.i == CONF_vtmode) {
|
||||||
assert(c->generic.handler == conf_radiobutton_handler);
|
assert(c->handler == conf_radiobutton_handler);
|
||||||
c->radio.nbuttons += 3;
|
c->radio.nbuttons += 3;
|
||||||
c->radio.buttons =
|
c->radio.buttons =
|
||||||
sresize(c->radio.buttons, c->radio.nbuttons, char *);
|
sresize(c->radio.buttons, c->radio.nbuttons, char *);
|
||||||
@ -362,9 +362,9 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help,
|
|||||||
s = ctrl_getset(b, "Connection/Proxy", "basics", NULL);
|
s = ctrl_getset(b, "Connection/Proxy", "basics", NULL);
|
||||||
for (i = 0; i < s->ncontrols; i++) {
|
for (i = 0; i < s->ncontrols; i++) {
|
||||||
c = s->ctrls[i];
|
c = s->ctrls[i];
|
||||||
if (c->generic.type == CTRL_LISTBOX &&
|
if (c->type == CTRL_LISTBOX &&
|
||||||
c->generic.handler == proxy_type_handler) {
|
c->handler == proxy_type_handler) {
|
||||||
c->generic.context.i |= PROXY_UI_FLAG_LOCAL;
|
c->context.i |= PROXY_UI_FLAG_LOCAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1415,7 +1415,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
* CTRL_COLUMNS and doesn't require any control creation at
|
* CTRL_COLUMNS and doesn't require any control creation at
|
||||||
* all.
|
* all.
|
||||||
*/
|
*/
|
||||||
if (ctrl->generic.type == CTRL_COLUMNS) {
|
if (ctrl->type == CTRL_COLUMNS) {
|
||||||
assert((ctrl->columns.ncols == 1) ^ (ncols == 1));
|
assert((ctrl->columns.ncols == 1) ^ (ncols == 1));
|
||||||
|
|
||||||
if (ncols == 1) {
|
if (ncols == 1) {
|
||||||
@ -1455,10 +1455,10 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
} else if (ctrl->generic.type == CTRL_TABDELAY) {
|
} else if (ctrl->type == CTRL_TABDELAY) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
assert(!ctrl->generic.tabdelay);
|
assert(!ctrl->delay_taborder);
|
||||||
ctrl = ctrl->tabdelay.ctrl;
|
ctrl = ctrl->tabdelay.ctrl;
|
||||||
|
|
||||||
for (i = 0; i < ntabdelays; i++)
|
for (i = 0; i < ntabdelays; i++)
|
||||||
@ -1478,8 +1478,8 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
*/
|
*/
|
||||||
int col;
|
int col;
|
||||||
|
|
||||||
colstart = COLUMN_START(ctrl->generic.column);
|
colstart = COLUMN_START(ctrl->column);
|
||||||
colspan = COLUMN_SPAN(ctrl->generic.column);
|
colspan = COLUMN_SPAN(ctrl->column);
|
||||||
|
|
||||||
pos = columns[colstart]; /* structure copy */
|
pos = columns[colstart]; /* structure copy */
|
||||||
pos.width = columns[colstart+colspan-1].width +
|
pos.width = columns[colstart+colspan-1].width +
|
||||||
@ -1494,7 +1494,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
* tabdelay list, and unset pos.hwnd to inhibit actual
|
* tabdelay list, and unset pos.hwnd to inhibit actual
|
||||||
* control creation.
|
* control creation.
|
||||||
*/
|
*/
|
||||||
if (ctrl->generic.tabdelay) {
|
if (ctrl->delay_taborder) {
|
||||||
assert(ntabdelays < lenof(tabdelays));
|
assert(ntabdelays < lenof(tabdelays));
|
||||||
tabdelays[ntabdelays] = pos; /* structure copy */
|
tabdelays[ntabdelays] = pos; /* structure copy */
|
||||||
tabdelayed[ntabdelays] = ctrl;
|
tabdelayed[ntabdelays] = ctrl;
|
||||||
@ -1522,13 +1522,13 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
* Now we're ready to actually create the control, by
|
* Now we're ready to actually create the control, by
|
||||||
* switching on its type.
|
* switching on its type.
|
||||||
*/
|
*/
|
||||||
switch (ctrl->generic.type) {
|
switch (ctrl->type) {
|
||||||
case CTRL_TEXT: {
|
case CTRL_TEXT: {
|
||||||
char *wrapped, *escaped;
|
char *wrapped, *escaped;
|
||||||
int lines;
|
int lines;
|
||||||
num_ids = 1;
|
num_ids = 1;
|
||||||
wrapped = staticwrap(&pos, cp->hwnd,
|
wrapped = staticwrap(&pos, cp->hwnd,
|
||||||
ctrl->generic.label, &lines);
|
ctrl->label, &lines);
|
||||||
escaped = shortcut_escape(wrapped, NO_SHORTCUT);
|
escaped = shortcut_escape(wrapped, NO_SHORTCUT);
|
||||||
statictext(&pos, escaped, lines, base_id);
|
statictext(&pos, escaped, lines, base_id);
|
||||||
sfree(escaped);
|
sfree(escaped);
|
||||||
@ -1537,7 +1537,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
}
|
}
|
||||||
case CTRL_EDITBOX:
|
case CTRL_EDITBOX:
|
||||||
num_ids = 2; /* static, edit */
|
num_ids = 2; /* static, edit */
|
||||||
escaped = shortcut_escape(ctrl->editbox.label,
|
escaped = shortcut_escape(ctrl->label,
|
||||||
ctrl->editbox.shortcut);
|
ctrl->editbox.shortcut);
|
||||||
shortcuts[nshortcuts++] = ctrl->editbox.shortcut;
|
shortcuts[nshortcuts++] = ctrl->editbox.shortcut;
|
||||||
if (ctrl->editbox.percentwidth == 100) {
|
if (ctrl->editbox.percentwidth == 100) {
|
||||||
@ -1564,7 +1564,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
struct radio *buttons;
|
struct radio *buttons;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
escaped = shortcut_escape(ctrl->radio.label,
|
escaped = shortcut_escape(ctrl->label,
|
||||||
ctrl->radio.shortcut);
|
ctrl->radio.shortcut);
|
||||||
shortcuts[nshortcuts++] = ctrl->radio.shortcut;
|
shortcuts[nshortcuts++] = ctrl->radio.shortcut;
|
||||||
|
|
||||||
@ -1596,14 +1596,14 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
}
|
}
|
||||||
case CTRL_CHECKBOX:
|
case CTRL_CHECKBOX:
|
||||||
num_ids = 1;
|
num_ids = 1;
|
||||||
escaped = shortcut_escape(ctrl->checkbox.label,
|
escaped = shortcut_escape(ctrl->label,
|
||||||
ctrl->checkbox.shortcut);
|
ctrl->checkbox.shortcut);
|
||||||
shortcuts[nshortcuts++] = ctrl->checkbox.shortcut;
|
shortcuts[nshortcuts++] = ctrl->checkbox.shortcut;
|
||||||
checkbox(&pos, escaped, base_id);
|
checkbox(&pos, escaped, base_id);
|
||||||
sfree(escaped);
|
sfree(escaped);
|
||||||
break;
|
break;
|
||||||
case CTRL_BUTTON:
|
case CTRL_BUTTON:
|
||||||
escaped = shortcut_escape(ctrl->button.label,
|
escaped = shortcut_escape(ctrl->label,
|
||||||
ctrl->button.shortcut);
|
ctrl->button.shortcut);
|
||||||
shortcuts[nshortcuts++] = ctrl->button.shortcut;
|
shortcuts[nshortcuts++] = ctrl->button.shortcut;
|
||||||
if (ctrl->button.iscancel)
|
if (ctrl->button.iscancel)
|
||||||
@ -1614,7 +1614,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
break;
|
break;
|
||||||
case CTRL_LISTBOX:
|
case CTRL_LISTBOX:
|
||||||
num_ids = 2;
|
num_ids = 2;
|
||||||
escaped = shortcut_escape(ctrl->listbox.label,
|
escaped = shortcut_escape(ctrl->label,
|
||||||
ctrl->listbox.shortcut);
|
ctrl->listbox.shortcut);
|
||||||
shortcuts[nshortcuts++] = ctrl->listbox.shortcut;
|
shortcuts[nshortcuts++] = ctrl->listbox.shortcut;
|
||||||
if (ctrl->listbox.draglist) {
|
if (ctrl->listbox.draglist) {
|
||||||
@ -1664,7 +1664,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
break;
|
break;
|
||||||
case CTRL_FILESELECT:
|
case CTRL_FILESELECT:
|
||||||
num_ids = 3;
|
num_ids = 3;
|
||||||
escaped = shortcut_escape(ctrl->fileselect.label,
|
escaped = shortcut_escape(ctrl->label,
|
||||||
ctrl->fileselect.shortcut);
|
ctrl->fileselect.shortcut);
|
||||||
shortcuts[nshortcuts++] = ctrl->fileselect.shortcut;
|
shortcuts[nshortcuts++] = ctrl->fileselect.shortcut;
|
||||||
editbutton(&pos, escaped, base_id, base_id+1,
|
editbutton(&pos, escaped, base_id, base_id+1,
|
||||||
@ -1673,7 +1673,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
break;
|
break;
|
||||||
case CTRL_FONTSELECT:
|
case CTRL_FONTSELECT:
|
||||||
num_ids = 3;
|
num_ids = 3;
|
||||||
escaped = shortcut_escape(ctrl->fontselect.label,
|
escaped = shortcut_escape(ctrl->label,
|
||||||
ctrl->fontselect.shortcut);
|
ctrl->fontselect.shortcut);
|
||||||
shortcuts[nshortcuts++] = ctrl->fontselect.shortcut;
|
shortcuts[nshortcuts++] = ctrl->fontselect.shortcut;
|
||||||
statictext(&pos, escaped, 1, base_id);
|
statictext(&pos, escaped, 1, base_id);
|
||||||
@ -1708,7 +1708,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
if (actual_base_id == base_id)
|
if (actual_base_id == base_id)
|
||||||
base_id += num_ids;
|
base_id += num_ids;
|
||||||
|
|
||||||
if (ctrl->generic.align_next_to) {
|
if (ctrl->align_next_to) {
|
||||||
/*
|
/*
|
||||||
* Implement align_next_to by looking at the y extents
|
* Implement align_next_to by looking at the y extents
|
||||||
* of the two controls now that both are created, and
|
* of the two controls now that both are created, and
|
||||||
@ -1716,7 +1716,7 @@ void winctrl_layout(struct dlgparam *dp, struct winctrls *wc,
|
|||||||
* centred on a common horizontal line.
|
* centred on a common horizontal line.
|
||||||
*/
|
*/
|
||||||
struct winctrl *c2 = winctrl_findbyctrl(
|
struct winctrl *c2 = winctrl_findbyctrl(
|
||||||
wc, ctrl->generic.align_next_to);
|
wc, ctrl->align_next_to);
|
||||||
HWND win1 = GetDlgItem(pos.hwnd, c->align_id);
|
HWND win1 = GetDlgItem(pos.hwnd, c->align_id);
|
||||||
HWND win2 = GetDlgItem(pos.hwnd, c2->align_id);
|
HWND win2 = GetDlgItem(pos.hwnd, c2->align_id);
|
||||||
RECT rect1, rect2;
|
RECT rect1, rect2;
|
||||||
@ -1839,7 +1839,7 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
ctrl = c->ctrl;
|
ctrl = c->ctrl;
|
||||||
id = LOWORD(wParam) - c->base_id;
|
id = LOWORD(wParam) - c->base_id;
|
||||||
|
|
||||||
if (!ctrl || !ctrl->generic.handler)
|
if (!ctrl || !ctrl->handler)
|
||||||
return false; /* nothing we can do here */
|
return false; /* nothing we can do here */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1855,7 +1855,7 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
/*
|
/*
|
||||||
* Now switch on the control type and the message.
|
* Now switch on the control type and the message.
|
||||||
*/
|
*/
|
||||||
switch (ctrl->generic.type) {
|
switch (ctrl->type) {
|
||||||
case CTRL_EDITBOX:
|
case CTRL_EDITBOX:
|
||||||
if (msg == WM_COMMAND && !ctrl->editbox.has_list &&
|
if (msg == WM_COMMAND && !ctrl->editbox.has_list &&
|
||||||
(HIWORD(wParam) == EN_SETFOCUS || HIWORD(wParam) == EN_KILLFOCUS))
|
(HIWORD(wParam) == EN_SETFOCUS || HIWORD(wParam) == EN_KILLFOCUS))
|
||||||
@ -1866,7 +1866,7 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
|
|
||||||
if (msg == WM_COMMAND && !ctrl->editbox.has_list &&
|
if (msg == WM_COMMAND && !ctrl->editbox.has_list &&
|
||||||
HIWORD(wParam) == EN_CHANGE)
|
HIWORD(wParam) == EN_CHANGE)
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
if (msg == WM_COMMAND &&
|
if (msg == WM_COMMAND &&
|
||||||
ctrl->editbox.has_list) {
|
ctrl->editbox.has_list) {
|
||||||
if (HIWORD(wParam) == CBN_SELCHANGE) {
|
if (HIWORD(wParam) == CBN_SELCHANGE) {
|
||||||
@ -1882,11 +1882,11 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
index, (LPARAM)text);
|
index, (LPARAM)text);
|
||||||
SetDlgItemText(dp->hwnd, c->base_id+1, text);
|
SetDlgItemText(dp->hwnd, c->base_id+1, text);
|
||||||
sfree(text);
|
sfree(text);
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
} else if (HIWORD(wParam) == CBN_EDITCHANGE) {
|
} else if (HIWORD(wParam) == CBN_EDITCHANGE) {
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
} else if (HIWORD(wParam) == CBN_KILLFOCUS) {
|
} else if (HIWORD(wParam) == CBN_KILLFOCUS) {
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_REFRESH);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_REFRESH);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1906,7 +1906,7 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
(HIWORD(wParam) == BN_CLICKED ||
|
(HIWORD(wParam) == BN_CLICKED ||
|
||||||
HIWORD(wParam) == BN_DOUBLECLICKED) &&
|
HIWORD(wParam) == BN_DOUBLECLICKED) &&
|
||||||
IsDlgButtonChecked(dp->hwnd, LOWORD(wParam))) {
|
IsDlgButtonChecked(dp->hwnd, LOWORD(wParam))) {
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CTRL_CHECKBOX:
|
case CTRL_CHECKBOX:
|
||||||
@ -1916,7 +1916,7 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
if (msg == WM_COMMAND &&
|
if (msg == WM_COMMAND &&
|
||||||
(HIWORD(wParam) == BN_CLICKED ||
|
(HIWORD(wParam) == BN_CLICKED ||
|
||||||
HIWORD(wParam) == BN_DOUBLECLICKED)) {
|
HIWORD(wParam) == BN_DOUBLECLICKED)) {
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CTRL_BUTTON:
|
case CTRL_BUTTON:
|
||||||
@ -1926,7 +1926,7 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
if (msg == WM_COMMAND &&
|
if (msg == WM_COMMAND &&
|
||||||
(HIWORD(wParam) == BN_CLICKED ||
|
(HIWORD(wParam) == BN_CLICKED ||
|
||||||
HIWORD(wParam) == BN_DOUBLECLICKED)) {
|
HIWORD(wParam) == BN_DOUBLECLICKED)) {
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_ACTION);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_ACTION);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CTRL_LISTBOX:
|
case CTRL_LISTBOX:
|
||||||
@ -1944,14 +1944,14 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
pret = handle_prefslist(c->data, NULL, 0, (msg != WM_COMMAND),
|
pret = handle_prefslist(c->data, NULL, 0, (msg != WM_COMMAND),
|
||||||
dp->hwnd, wParam, lParam);
|
dp->hwnd, wParam, lParam);
|
||||||
if (pret & 2)
|
if (pret & 2)
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
ret = pret & 1;
|
ret = pret & 1;
|
||||||
} else {
|
} else {
|
||||||
if (msg == WM_COMMAND && HIWORD(wParam) == LBN_DBLCLK) {
|
if (msg == WM_COMMAND && HIWORD(wParam) == LBN_DBLCLK) {
|
||||||
SetCapture(dp->hwnd);
|
SetCapture(dp->hwnd);
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_ACTION);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_ACTION);
|
||||||
} else if (msg == WM_COMMAND && HIWORD(wParam) == LBN_SELCHANGE) {
|
} else if (msg == WM_COMMAND && HIWORD(wParam) == LBN_SELCHANGE) {
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_SELCHANGE);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_SELCHANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1963,7 +1963,7 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
(HIWORD(wParam) == BN_SETFOCUS || HIWORD(wParam) == BN_KILLFOCUS))
|
(HIWORD(wParam) == BN_SETFOCUS || HIWORD(wParam) == BN_KILLFOCUS))
|
||||||
winctrl_set_focus(ctrl, dp, HIWORD(wParam) == BN_SETFOCUS);
|
winctrl_set_focus(ctrl, dp, HIWORD(wParam) == BN_SETFOCUS);
|
||||||
if (msg == WM_COMMAND && id == 1 && HIWORD(wParam) == EN_CHANGE)
|
if (msg == WM_COMMAND && id == 1 && HIWORD(wParam) == EN_CHANGE)
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
if (id == 2 &&
|
if (id == 2 &&
|
||||||
(msg == WM_COMMAND &&
|
(msg == WM_COMMAND &&
|
||||||
(HIWORD(wParam) == BN_CLICKED ||
|
(HIWORD(wParam) == BN_CLICKED ||
|
||||||
@ -1988,7 +1988,7 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
of.Flags = 0;
|
of.Flags = 0;
|
||||||
if (request_file(NULL, &of, false, ctrl->fileselect.for_writing)) {
|
if (request_file(NULL, &of, false, ctrl->fileselect.for_writing)) {
|
||||||
SetDlgItemText(dp->hwnd, c->base_id + 1, filename);
|
SetDlgItemText(dp->hwnd, c->base_id + 1, filename);
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2033,7 +2033,7 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
dlg_fontsel_set(ctrl, dp, fs);
|
dlg_fontsel_set(ctrl, dp, fs);
|
||||||
fontspec_free(fs);
|
fontspec_free(fs);
|
||||||
|
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_VALCHANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2064,7 +2064,7 @@ bool winctrl_handle_command(struct dlgparam *dp, UINT msg,
|
|||||||
dp->coloursel_result.ok = true;
|
dp->coloursel_result.ok = true;
|
||||||
} else
|
} else
|
||||||
dp->coloursel_result.ok = false;
|
dp->coloursel_result.ok = false;
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_CALLBACK);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_CALLBACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -2095,10 +2095,10 @@ bool winctrl_context_help(struct dlgparam *dp, HWND hwnd, int id)
|
|||||||
* This is the Windows front end, so we're allowed to assume
|
* This is the Windows front end, so we're allowed to assume
|
||||||
* `helpctx.p' is a context string.
|
* `helpctx.p' is a context string.
|
||||||
*/
|
*/
|
||||||
if (!c->ctrl || !c->ctrl->generic.helpctx.p)
|
if (!c->ctrl || !c->ctrl->helpctx.p)
|
||||||
return false; /* no help available for this ctrl */
|
return false; /* no help available for this ctrl */
|
||||||
|
|
||||||
launch_help(hwnd, c->ctrl->generic.helpctx.p);
|
launch_help(hwnd, c->ctrl->helpctx.p);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2133,7 +2133,7 @@ bool dlg_is_visible(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
void dlg_radiobutton_set(dlgcontrol *ctrl, dlgparam *dp, int whichbutton)
|
void dlg_radiobutton_set(dlgcontrol *ctrl, dlgparam *dp, int whichbutton)
|
||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
assert(c && c->ctrl->generic.type == CTRL_RADIO);
|
assert(c && c->ctrl->type == CTRL_RADIO);
|
||||||
CheckRadioButton(dp->hwnd,
|
CheckRadioButton(dp->hwnd,
|
||||||
c->base_id + 1,
|
c->base_id + 1,
|
||||||
c->base_id + c->ctrl->radio.nbuttons,
|
c->base_id + c->ctrl->radio.nbuttons,
|
||||||
@ -2144,7 +2144,7 @@ int dlg_radiobutton_get(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int i;
|
int i;
|
||||||
assert(c && c->ctrl->generic.type == CTRL_RADIO);
|
assert(c && c->ctrl->type == CTRL_RADIO);
|
||||||
for (i = 0; i < c->ctrl->radio.nbuttons; i++)
|
for (i = 0; i < c->ctrl->radio.nbuttons; i++)
|
||||||
if (IsDlgButtonChecked(dp->hwnd, c->base_id + 1 + i))
|
if (IsDlgButtonChecked(dp->hwnd, c->base_id + 1 + i))
|
||||||
return i;
|
return i;
|
||||||
@ -2154,28 +2154,28 @@ int dlg_radiobutton_get(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
void dlg_checkbox_set(dlgcontrol *ctrl, dlgparam *dp, bool checked)
|
void dlg_checkbox_set(dlgcontrol *ctrl, dlgparam *dp, bool checked)
|
||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
assert(c && c->ctrl->generic.type == CTRL_CHECKBOX);
|
assert(c && c->ctrl->type == CTRL_CHECKBOX);
|
||||||
CheckDlgButton(dp->hwnd, c->base_id, checked);
|
CheckDlgButton(dp->hwnd, c->base_id, checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dlg_checkbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
bool dlg_checkbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
assert(c && c->ctrl->generic.type == CTRL_CHECKBOX);
|
assert(c && c->ctrl->type == CTRL_CHECKBOX);
|
||||||
return 0 != IsDlgButtonChecked(dp->hwnd, c->base_id);
|
return 0 != IsDlgButtonChecked(dp->hwnd, c->base_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_editbox_set(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
void dlg_editbox_set(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
assert(c && c->ctrl->generic.type == CTRL_EDITBOX);
|
assert(c && c->ctrl->type == CTRL_EDITBOX);
|
||||||
SetDlgItemText(dp->hwnd, c->base_id+1, text);
|
SetDlgItemText(dp->hwnd, c->base_id+1, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
assert(c && c->ctrl->generic.type == CTRL_EDITBOX);
|
assert(c && c->ctrl->type == CTRL_EDITBOX);
|
||||||
return GetDlgItemText_alloc(dp->hwnd, c->base_id+1);
|
return GetDlgItemText_alloc(dp->hwnd, c->base_id+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2185,10 +2185,10 @@ void dlg_listbox_clear(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int msg;
|
int msg;
|
||||||
assert(c &&
|
assert(c &&
|
||||||
(c->ctrl->generic.type == CTRL_LISTBOX ||
|
(c->ctrl->type == CTRL_LISTBOX ||
|
||||||
(c->ctrl->generic.type == CTRL_EDITBOX &&
|
(c->ctrl->type == CTRL_EDITBOX &&
|
||||||
c->ctrl->editbox.has_list)));
|
c->ctrl->editbox.has_list)));
|
||||||
msg = (c->ctrl->generic.type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ?
|
msg = (c->ctrl->type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ?
|
||||||
LB_RESETCONTENT : CB_RESETCONTENT);
|
LB_RESETCONTENT : CB_RESETCONTENT);
|
||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, 0, 0);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, 0, 0);
|
||||||
}
|
}
|
||||||
@ -2198,10 +2198,10 @@ void dlg_listbox_del(dlgcontrol *ctrl, dlgparam *dp, int index)
|
|||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int msg;
|
int msg;
|
||||||
assert(c &&
|
assert(c &&
|
||||||
(c->ctrl->generic.type == CTRL_LISTBOX ||
|
(c->ctrl->type == CTRL_LISTBOX ||
|
||||||
(c->ctrl->generic.type == CTRL_EDITBOX &&
|
(c->ctrl->type == CTRL_EDITBOX &&
|
||||||
c->ctrl->editbox.has_list)));
|
c->ctrl->editbox.has_list)));
|
||||||
msg = (c->ctrl->generic.type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ?
|
msg = (c->ctrl->type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ?
|
||||||
LB_DELETESTRING : CB_DELETESTRING);
|
LB_DELETESTRING : CB_DELETESTRING);
|
||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0);
|
||||||
}
|
}
|
||||||
@ -2211,10 +2211,10 @@ void dlg_listbox_add(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
|||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int msg;
|
int msg;
|
||||||
assert(c &&
|
assert(c &&
|
||||||
(c->ctrl->generic.type == CTRL_LISTBOX ||
|
(c->ctrl->type == CTRL_LISTBOX ||
|
||||||
(c->ctrl->generic.type == CTRL_EDITBOX &&
|
(c->ctrl->type == CTRL_EDITBOX &&
|
||||||
c->ctrl->editbox.has_list)));
|
c->ctrl->editbox.has_list)));
|
||||||
msg = (c->ctrl->generic.type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ?
|
msg = (c->ctrl->type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ?
|
||||||
LB_ADDSTRING : CB_ADDSTRING);
|
LB_ADDSTRING : CB_ADDSTRING);
|
||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, 0, (LPARAM)text);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, 0, (LPARAM)text);
|
||||||
}
|
}
|
||||||
@ -2232,12 +2232,12 @@ void dlg_listbox_addwithid(dlgcontrol *ctrl, dlgparam *dp,
|
|||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int msg, msg2, index;
|
int msg, msg2, index;
|
||||||
assert(c &&
|
assert(c &&
|
||||||
(c->ctrl->generic.type == CTRL_LISTBOX ||
|
(c->ctrl->type == CTRL_LISTBOX ||
|
||||||
(c->ctrl->generic.type == CTRL_EDITBOX &&
|
(c->ctrl->type == CTRL_EDITBOX &&
|
||||||
c->ctrl->editbox.has_list)));
|
c->ctrl->editbox.has_list)));
|
||||||
msg = (c->ctrl->generic.type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ?
|
msg = (c->ctrl->type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ?
|
||||||
LB_ADDSTRING : CB_ADDSTRING);
|
LB_ADDSTRING : CB_ADDSTRING);
|
||||||
msg2 = (c->ctrl->generic.type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ?
|
msg2 = (c->ctrl->type==CTRL_LISTBOX && c->ctrl->listbox.height!=0 ?
|
||||||
LB_SETITEMDATA : CB_SETITEMDATA);
|
LB_SETITEMDATA : CB_SETITEMDATA);
|
||||||
index = SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, 0, (LPARAM)text);
|
index = SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, 0, (LPARAM)text);
|
||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg2, index, (LPARAM)id);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg2, index, (LPARAM)id);
|
||||||
@ -2247,7 +2247,7 @@ int dlg_listbox_getid(dlgcontrol *ctrl, dlgparam *dp, int index)
|
|||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int msg;
|
int msg;
|
||||||
assert(c && c->ctrl->generic.type == CTRL_LISTBOX);
|
assert(c && c->ctrl->type == CTRL_LISTBOX);
|
||||||
msg = (c->ctrl->listbox.height != 0 ? LB_GETITEMDATA : CB_GETITEMDATA);
|
msg = (c->ctrl->listbox.height != 0 ? LB_GETITEMDATA : CB_GETITEMDATA);
|
||||||
return
|
return
|
||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0);
|
||||||
@ -2258,7 +2258,7 @@ int dlg_listbox_index(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int msg, ret;
|
int msg, ret;
|
||||||
assert(c && c->ctrl->generic.type == CTRL_LISTBOX);
|
assert(c && c->ctrl->type == CTRL_LISTBOX);
|
||||||
if (c->ctrl->listbox.multisel) {
|
if (c->ctrl->listbox.multisel) {
|
||||||
assert(c->ctrl->listbox.height != 0); /* not combo box */
|
assert(c->ctrl->listbox.height != 0); /* not combo box */
|
||||||
ret = SendDlgItemMessage(dp->hwnd, c->base_id+1, LB_GETSELCOUNT, 0, 0);
|
ret = SendDlgItemMessage(dp->hwnd, c->base_id+1, LB_GETSELCOUNT, 0, 0);
|
||||||
@ -2276,7 +2276,7 @@ int dlg_listbox_index(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
bool dlg_listbox_issel(dlgcontrol *ctrl, dlgparam *dp, int index)
|
bool dlg_listbox_issel(dlgcontrol *ctrl, dlgparam *dp, int index)
|
||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
assert(c && c->ctrl->generic.type == CTRL_LISTBOX &&
|
assert(c && c->ctrl->type == CTRL_LISTBOX &&
|
||||||
c->ctrl->listbox.multisel &&
|
c->ctrl->listbox.multisel &&
|
||||||
c->ctrl->listbox.height != 0);
|
c->ctrl->listbox.height != 0);
|
||||||
return
|
return
|
||||||
@ -2287,7 +2287,7 @@ void dlg_listbox_select(dlgcontrol *ctrl, dlgparam *dp, int index)
|
|||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int msg;
|
int msg;
|
||||||
assert(c && c->ctrl->generic.type == CTRL_LISTBOX &&
|
assert(c && c->ctrl->type == CTRL_LISTBOX &&
|
||||||
!c->ctrl->listbox.multisel);
|
!c->ctrl->listbox.multisel);
|
||||||
msg = (c->ctrl->listbox.height != 0 ? LB_SETCURSEL : CB_SETCURSEL);
|
msg = (c->ctrl->listbox.height != 0 ? LB_SETCURSEL : CB_SETCURSEL);
|
||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0);
|
||||||
@ -2296,7 +2296,7 @@ void dlg_listbox_select(dlgcontrol *ctrl, dlgparam *dp, int index)
|
|||||||
void dlg_text_set(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
void dlg_text_set(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
assert(c && c->ctrl->generic.type == CTRL_TEXT);
|
assert(c && c->ctrl->type == CTRL_TEXT);
|
||||||
SetDlgItemText(dp->hwnd, c->base_id, text);
|
SetDlgItemText(dp->hwnd, c->base_id, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2307,7 +2307,7 @@ void dlg_label_change(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
|||||||
int id = -1;
|
int id = -1;
|
||||||
|
|
||||||
assert(c);
|
assert(c);
|
||||||
switch (c->ctrl->generic.type) {
|
switch (c->ctrl->type) {
|
||||||
case CTRL_EDITBOX:
|
case CTRL_EDITBOX:
|
||||||
escaped = shortcut_escape(text, c->ctrl->editbox.shortcut);
|
escaped = shortcut_escape(text, c->ctrl->editbox.shortcut);
|
||||||
id = c->base_id;
|
id = c->base_id;
|
||||||
@ -2348,7 +2348,7 @@ void dlg_label_change(dlgcontrol *ctrl, dlgparam *dp, char const *text)
|
|||||||
void dlg_filesel_set(dlgcontrol *ctrl, dlgparam *dp, Filename *fn)
|
void dlg_filesel_set(dlgcontrol *ctrl, dlgparam *dp, Filename *fn)
|
||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
assert(c && c->ctrl->generic.type == CTRL_FILESELECT);
|
assert(c && c->ctrl->type == CTRL_FILESELECT);
|
||||||
SetDlgItemText(dp->hwnd, c->base_id+1, fn->path);
|
SetDlgItemText(dp->hwnd, c->base_id+1, fn->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2357,7 +2357,7 @@ Filename *dlg_filesel_get(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
char *tmp;
|
char *tmp;
|
||||||
Filename *ret;
|
Filename *ret;
|
||||||
assert(c && c->ctrl->generic.type == CTRL_FILESELECT);
|
assert(c && c->ctrl->type == CTRL_FILESELECT);
|
||||||
tmp = GetDlgItemText_alloc(dp->hwnd, c->base_id+1);
|
tmp = GetDlgItemText_alloc(dp->hwnd, c->base_id+1);
|
||||||
ret = filename_from_str(tmp);
|
ret = filename_from_str(tmp);
|
||||||
sfree(tmp);
|
sfree(tmp);
|
||||||
@ -2368,7 +2368,7 @@ void dlg_fontsel_set(dlgcontrol *ctrl, dlgparam *dp, FontSpec *fs)
|
|||||||
{
|
{
|
||||||
char *buf, *boldstr;
|
char *buf, *boldstr;
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
assert(c && c->ctrl->generic.type == CTRL_FONTSELECT);
|
assert(c && c->ctrl->type == CTRL_FONTSELECT);
|
||||||
|
|
||||||
fontspec_free((FontSpec *)c->data);
|
fontspec_free((FontSpec *)c->data);
|
||||||
c->data = fontspec_copy(fs);
|
c->data = fontspec_copy(fs);
|
||||||
@ -2389,7 +2389,7 @@ void dlg_fontsel_set(dlgcontrol *ctrl, dlgparam *dp, FontSpec *fs)
|
|||||||
FontSpec *dlg_fontsel_get(dlgcontrol *ctrl, dlgparam *dp)
|
FontSpec *dlg_fontsel_get(dlgcontrol *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
assert(c && c->ctrl->generic.type == CTRL_FONTSELECT);
|
assert(c && c->ctrl->type == CTRL_FONTSELECT);
|
||||||
return fontspec_copy((FontSpec *)c->data);
|
return fontspec_copy((FontSpec *)c->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2401,7 +2401,7 @@ FontSpec *dlg_fontsel_get(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
void dlg_update_start(dlgcontrol *ctrl, dlgparam *dp)
|
void dlg_update_start(dlgcontrol *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
if (c && c->ctrl->generic.type == CTRL_LISTBOX) {
|
if (c && c->ctrl->type == CTRL_LISTBOX) {
|
||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, WM_SETREDRAW, false, 0);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, WM_SETREDRAW, false, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2409,7 +2409,7 @@ void dlg_update_start(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
void dlg_update_done(dlgcontrol *ctrl, dlgparam *dp)
|
void dlg_update_done(dlgcontrol *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
if (c && c->ctrl->generic.type == CTRL_LISTBOX) {
|
if (c && c->ctrl->type == CTRL_LISTBOX) {
|
||||||
HWND hw = GetDlgItem(dp->hwnd, c->base_id+1);
|
HWND hw = GetDlgItem(dp->hwnd, c->base_id+1);
|
||||||
SendMessage(hw, WM_SETREDRAW, true, 0);
|
SendMessage(hw, WM_SETREDRAW, true, 0);
|
||||||
InvalidateRect(hw, NULL, true);
|
InvalidateRect(hw, NULL, true);
|
||||||
@ -2423,7 +2423,7 @@ void dlg_set_focus(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
HWND ctl;
|
HWND ctl;
|
||||||
if (!c)
|
if (!c)
|
||||||
return;
|
return;
|
||||||
switch (ctrl->generic.type) {
|
switch (ctrl->type) {
|
||||||
case CTRL_EDITBOX: id = c->base_id + 1; break;
|
case CTRL_EDITBOX: id = c->base_id + 1; break;
|
||||||
case CTRL_RADIO:
|
case CTRL_RADIO:
|
||||||
for (id = c->base_id + ctrl->radio.nbuttons; id > 1; id--)
|
for (id = c->base_id + ctrl->radio.nbuttons; id > 1; id--)
|
||||||
@ -2487,8 +2487,8 @@ void dlg_refresh(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
for (i = 0;
|
for (i = 0;
|
||||||
(c = winctrl_findbyindex(dp->controltrees[j], i)) != NULL;
|
(c = winctrl_findbyindex(dp->controltrees[j], i)) != NULL;
|
||||||
i++) {
|
i++) {
|
||||||
if (c->ctrl && c->ctrl->generic.handler != NULL)
|
if (c->ctrl && c->ctrl->handler != NULL)
|
||||||
c->ctrl->generic.handler(c->ctrl, dp,
|
c->ctrl->handler(c->ctrl, dp,
|
||||||
dp->data, EVENT_REFRESH);
|
dp->data, EVENT_REFRESH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2496,8 +2496,8 @@ void dlg_refresh(dlgcontrol *ctrl, dlgparam *dp)
|
|||||||
/*
|
/*
|
||||||
* Send EVENT_REFRESH to a specific control.
|
* Send EVENT_REFRESH to a specific control.
|
||||||
*/
|
*/
|
||||||
if (ctrl->generic.handler != NULL)
|
if (ctrl->handler != NULL)
|
||||||
ctrl->generic.handler(ctrl, dp, dp->data, EVENT_REFRESH);
|
ctrl->handler(ctrl, dp, dp->data, EVENT_REFRESH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user