mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-16 12:03:03 -05:00
Expose the structure tag 'dlgparam'.
This continues my ongoing crusade against dangerous 'void *' parameters.
This commit is contained in:
parent
fc375c0b6a
commit
3aae1f9d76
52
config.c
52
config.c
@ -15,7 +15,7 @@
|
|||||||
#define HOST_BOX_TITLE "Host Name (or IP address)"
|
#define HOST_BOX_TITLE "Host Name (or IP address)"
|
||||||
#define PORT_BOX_TITLE "Port"
|
#define PORT_BOX_TITLE "Port"
|
||||||
|
|
||||||
void conf_radiobutton_handler(union control *ctrl, void *dlg,
|
void conf_radiobutton_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
@ -44,7 +44,7 @@ void conf_radiobutton_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define CHECKBOX_INVERT (1<<30)
|
#define CHECKBOX_INVERT (1<<30)
|
||||||
void conf_checkbox_handler(union control *ctrl, void *dlg,
|
void conf_checkbox_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
int key, invert;
|
int key, invert;
|
||||||
@ -75,7 +75,7 @@ void conf_checkbox_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void conf_editbox_handler(union control *ctrl, void *dlg,
|
void conf_editbox_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -124,7 +124,7 @@ void conf_editbox_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void conf_filesel_handler(union control *ctrl, void *dlg,
|
void conf_filesel_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
int key = ctrl->fileselect.context.i;
|
int key = ctrl->fileselect.context.i;
|
||||||
@ -139,7 +139,7 @@ void conf_filesel_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void conf_fontsel_handler(union control *ctrl, void *dlg,
|
void conf_fontsel_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
int key = ctrl->fontselect.context.i;
|
int key = ctrl->fontselect.context.i;
|
||||||
@ -154,7 +154,7 @@ void conf_fontsel_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void config_host_handler(union control *ctrl, void *dlg,
|
static void config_host_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -186,7 +186,7 @@ static void config_host_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void config_port_handler(union control *ctrl, void *dlg,
|
static void config_port_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -235,7 +235,7 @@ struct hostport {
|
|||||||
* routines can use it to conveniently identify the protocol radio
|
* routines can use it to conveniently identify the protocol radio
|
||||||
* buttons in order to add to them.
|
* buttons in order to add to them.
|
||||||
*/
|
*/
|
||||||
void config_protocolbuttons_handler(union control *ctrl, void *dlg,
|
void config_protocolbuttons_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
@ -289,7 +289,7 @@ void config_protocolbuttons_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void loggingbuttons_handler(union control *ctrl, void *dlg,
|
static void loggingbuttons_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
@ -318,7 +318,7 @@ static void loggingbuttons_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void numeric_keypad_handler(union control *ctrl, void *dlg,
|
static void numeric_keypad_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
@ -349,7 +349,7 @@ static void numeric_keypad_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cipherlist_handler(union control *ctrl, void *dlg,
|
static void cipherlist_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -395,7 +395,7 @@ static void cipherlist_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_GSSAPI
|
#ifndef NO_GSSAPI
|
||||||
static void gsslist_handler(union control *ctrl, void *dlg,
|
static void gsslist_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -422,7 +422,7 @@ static void gsslist_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void kexlist_handler(union control *ctrl, void *dlg,
|
static void kexlist_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -466,7 +466,7 @@ static void kexlist_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void hklist_handler(union control *ctrl, void *dlg,
|
static void hklist_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -509,7 +509,7 @@ static void hklist_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printerbox_handler(union control *ctrl, void *dlg,
|
static void printerbox_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -545,7 +545,7 @@ static void printerbox_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void codepage_handler(union control *ctrl, void *dlg,
|
static void codepage_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -569,7 +569,7 @@ static void codepage_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sshbug_handler(union control *ctrl, void *dlg,
|
static void sshbug_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -624,7 +624,7 @@ static void sessionsaver_data_free(void *ssdv)
|
|||||||
* failure.
|
* failure.
|
||||||
*/
|
*/
|
||||||
static int load_selected_session(struct sessionsaver_data *ssd,
|
static int load_selected_session(struct sessionsaver_data *ssd,
|
||||||
void *dlg, Conf *conf, int *maybe_launch)
|
dlgparam *dlg, Conf *conf, int *maybe_launch)
|
||||||
{
|
{
|
||||||
int i = dlg_listbox_index(ssd->listbox, dlg);
|
int i = dlg_listbox_index(ssd->listbox, dlg);
|
||||||
int isdef;
|
int isdef;
|
||||||
@ -645,7 +645,7 @@ static int load_selected_session(struct sessionsaver_data *ssd,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sessionsaver_handler(union control *ctrl, void *dlg,
|
static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -786,7 +786,7 @@ struct charclass_data {
|
|||||||
union control *listbox, *editbox, *button;
|
union control *listbox, *editbox, *button;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void charclass_handler(union control *ctrl, void *dlg,
|
static void charclass_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -841,7 +841,7 @@ static const char *const colours[] = {
|
|||||||
"ANSI White", "ANSI White Bold"
|
"ANSI White", "ANSI White Bold"
|
||||||
};
|
};
|
||||||
|
|
||||||
static void colour_handler(union control *ctrl, void *dlg,
|
static void colour_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -949,7 +949,7 @@ struct ttymodes_data {
|
|||||||
union control *valradio, *valbox, *setbutton, *listbox;
|
union control *valradio, *valbox, *setbutton, *listbox;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ttymodes_handler(union control *ctrl, void *dlg,
|
static void ttymodes_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -1034,7 +1034,7 @@ struct environ_data {
|
|||||||
union control *varbox, *valbox, *addbutton, *rembutton, *listbox;
|
union control *varbox, *valbox, *addbutton, *rembutton, *listbox;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void environ_handler(union control *ctrl, void *dlg,
|
static void environ_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -1110,7 +1110,7 @@ struct portfwd_data {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static void portfwd_handler(union control *ctrl, void *dlg,
|
static void portfwd_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -1274,7 +1274,7 @@ struct manual_hostkey_data {
|
|||||||
union control *addbutton, *rembutton, *listbox, *keybox;
|
union control *addbutton, *rembutton, *listbox, *keybox;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void manual_hostkey_handler(union control *ctrl, void *dlg,
|
static void manual_hostkey_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
@ -1337,7 +1337,7 @@ static void manual_hostkey_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clipboard_selector_handler(union control *ctrl, void *dlg,
|
static void clipboard_selector_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
Conf *conf = (Conf *)data;
|
Conf *conf = (Conf *)data;
|
||||||
|
2
defs.h
2
defs.h
@ -59,6 +59,8 @@ typedef struct ssh_sharing_state ssh_sharing_state;
|
|||||||
typedef struct ssh_sharing_connstate ssh_sharing_connstate;
|
typedef struct ssh_sharing_connstate ssh_sharing_connstate;
|
||||||
typedef struct share_channel share_channel;
|
typedef struct share_channel share_channel;
|
||||||
|
|
||||||
|
typedef struct dlgparam dlgparam;
|
||||||
|
|
||||||
/* Note indirection: for historical reasons (it used to be closer to
|
/* Note indirection: for historical reasons (it used to be closer to
|
||||||
* the OS socket type), the type that most code uses for a socket is
|
* the OS socket type), the type that most code uses for a socket is
|
||||||
* 'Socket', not 'Socket *'. So an implementation of Socket or Plug
|
* 'Socket', not 'Socket *'. So an implementation of Socket or Plug
|
||||||
|
62
dialog.h
62
dialog.h
@ -103,7 +103,7 @@ enum {
|
|||||||
EVENT_SELCHANGE,
|
EVENT_SELCHANGE,
|
||||||
EVENT_CALLBACK
|
EVENT_CALLBACK
|
||||||
};
|
};
|
||||||
typedef void (*handler_fn)(union control *ctrl, void *dlg,
|
typedef void (*handler_fn)(union control *ctrl, dlgparam *dp,
|
||||||
void *data, int event);
|
void *data, int event);
|
||||||
|
|
||||||
#define STANDARD_PREFIX \
|
#define STANDARD_PREFIX \
|
||||||
@ -534,16 +534,16 @@ union control *ctrl_tabdelay(struct controlset *, union control *);
|
|||||||
* Routines the platform-independent dialog code can call to read
|
* Routines the platform-independent dialog code can call to read
|
||||||
* and write the values of controls.
|
* and write the values of controls.
|
||||||
*/
|
*/
|
||||||
void dlg_radiobutton_set(union control *ctrl, void *dlg, int whichbutton);
|
void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int whichbutton);
|
||||||
int dlg_radiobutton_get(union control *ctrl, void *dlg);
|
int dlg_radiobutton_get(union control *ctrl, dlgparam *dp);
|
||||||
void dlg_checkbox_set(union control *ctrl, void *dlg, int checked);
|
void dlg_checkbox_set(union control *ctrl, dlgparam *dp, int checked);
|
||||||
int dlg_checkbox_get(union control *ctrl, void *dlg);
|
int dlg_checkbox_get(union control *ctrl, dlgparam *dp);
|
||||||
void dlg_editbox_set(union control *ctrl, void *dlg, char const *text);
|
void dlg_editbox_set(union control *ctrl, dlgparam *dp, char const *text);
|
||||||
char *dlg_editbox_get(union control *ctrl, void *dlg); /* result must be freed by caller */
|
char *dlg_editbox_get(union control *ctrl, dlgparam *dp); /* result must be freed by caller */
|
||||||
/* The `listbox' functions can also apply to combo boxes. */
|
/* The `listbox' functions can also apply to combo boxes. */
|
||||||
void dlg_listbox_clear(union control *ctrl, void *dlg);
|
void dlg_listbox_clear(union control *ctrl, dlgparam *dp);
|
||||||
void dlg_listbox_del(union control *ctrl, void *dlg, int index);
|
void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index);
|
||||||
void dlg_listbox_add(union control *ctrl, void *dlg, char const *text);
|
void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text);
|
||||||
/*
|
/*
|
||||||
* Each listbox entry may have a numeric id associated with it.
|
* Each listbox entry may have a numeric id associated with it.
|
||||||
* Note that some front ends only permit a string to be stored at
|
* Note that some front ends only permit a string to be stored at
|
||||||
@ -551,53 +551,53 @@ void dlg_listbox_add(union control *ctrl, void *dlg, char const *text);
|
|||||||
* strings in any listbox then you MUST not assign them different
|
* strings in any listbox then you MUST not assign them different
|
||||||
* IDs and expect to get meaningful results back.
|
* IDs and expect to get meaningful results back.
|
||||||
*/
|
*/
|
||||||
void dlg_listbox_addwithid(union control *ctrl, void *dlg,
|
void dlg_listbox_addwithid(union control *ctrl, dlgparam *dp,
|
||||||
char const *text, int id);
|
char const *text, int id);
|
||||||
int dlg_listbox_getid(union control *ctrl, void *dlg, int index);
|
int dlg_listbox_getid(union control *ctrl, dlgparam *dp, int index);
|
||||||
/* dlg_listbox_index returns <0 if no single element is selected. */
|
/* dlg_listbox_index returns <0 if no single element is selected. */
|
||||||
int dlg_listbox_index(union control *ctrl, void *dlg);
|
int dlg_listbox_index(union control *ctrl, dlgparam *dp);
|
||||||
int dlg_listbox_issel(union control *ctrl, void *dlg, int index);
|
int dlg_listbox_issel(union control *ctrl, dlgparam *dp, int index);
|
||||||
void dlg_listbox_select(union control *ctrl, void *dlg, int index);
|
void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index);
|
||||||
void dlg_text_set(union control *ctrl, void *dlg, char const *text);
|
void dlg_text_set(union control *ctrl, dlgparam *dp, char const *text);
|
||||||
void dlg_filesel_set(union control *ctrl, void *dlg, Filename *fn);
|
void dlg_filesel_set(union control *ctrl, dlgparam *dp, Filename *fn);
|
||||||
Filename *dlg_filesel_get(union control *ctrl, void *dlg);
|
Filename *dlg_filesel_get(union control *ctrl, dlgparam *dp);
|
||||||
void dlg_fontsel_set(union control *ctrl, void *dlg, FontSpec *fn);
|
void dlg_fontsel_set(union control *ctrl, dlgparam *dp, FontSpec *fn);
|
||||||
FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg);
|
FontSpec *dlg_fontsel_get(union control *ctrl, dlgparam *dp);
|
||||||
/*
|
/*
|
||||||
* Bracketing a large set of updates in these two functions will
|
* Bracketing a large set of updates in these two functions will
|
||||||
* cause the front end (if possible) to delay updating the screen
|
* cause the front end (if possible) to delay updating the screen
|
||||||
* until it's all complete, thus avoiding flicker.
|
* until it's all complete, thus avoiding flicker.
|
||||||
*/
|
*/
|
||||||
void dlg_update_start(union control *ctrl, void *dlg);
|
void dlg_update_start(union control *ctrl, dlgparam *dp);
|
||||||
void dlg_update_done(union control *ctrl, void *dlg);
|
void dlg_update_done(union control *ctrl, dlgparam *dp);
|
||||||
/*
|
/*
|
||||||
* Set input focus into a particular control.
|
* Set input focus into a particular control.
|
||||||
*/
|
*/
|
||||||
void dlg_set_focus(union control *ctrl, void *dlg);
|
void dlg_set_focus(union control *ctrl, dlgparam *dp);
|
||||||
/*
|
/*
|
||||||
* Change the label text on a control.
|
* Change the label text on a control.
|
||||||
*/
|
*/
|
||||||
void dlg_label_change(union control *ctrl, void *dlg, char const *text);
|
void dlg_label_change(union control *ctrl, dlgparam *dp, char const *text);
|
||||||
/*
|
/*
|
||||||
* Return the `ctrl' structure for the most recent control that had
|
* Return the `ctrl' structure for the most recent control that had
|
||||||
* the input focus apart from the one mentioned. This is NOT
|
* the input focus apart from the one mentioned. This is NOT
|
||||||
* GUARANTEED to work on all platforms, so don't base any critical
|
* GUARANTEED to work on all platforms, so don't base any critical
|
||||||
* functionality on it!
|
* functionality on it!
|
||||||
*/
|
*/
|
||||||
union control *dlg_last_focused(union control *ctrl, void *dlg);
|
union control *dlg_last_focused(union control *ctrl, dlgparam *dp);
|
||||||
/*
|
/*
|
||||||
* During event processing, you might well want to give an error
|
* During event processing, you might well want to give an error
|
||||||
* indication to the user. dlg_beep() is a quick and easy generic
|
* indication to the user. dlg_beep() is a quick and easy generic
|
||||||
* error; dlg_error() puts up a message-box or equivalent.
|
* error; dlg_error() puts up a message-box or equivalent.
|
||||||
*/
|
*/
|
||||||
void dlg_beep(void *dlg);
|
void dlg_beep(dlgparam *dp);
|
||||||
void dlg_error_msg(void *dlg, const char *msg);
|
void dlg_error_msg(dlgparam *dp, const char *msg);
|
||||||
/*
|
/*
|
||||||
* This function signals to the front end that the dialog's
|
* This function signals to the front end that the dialog's
|
||||||
* processing is completed, and passes an integer value (typically
|
* processing is completed, and passes an integer value (typically
|
||||||
* a success status).
|
* a success status).
|
||||||
*/
|
*/
|
||||||
void dlg_end(void *dlg, int value);
|
void dlg_end(dlgparam *dp, int value);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routines to manage a (per-platform) colour selector.
|
* Routines to manage a (per-platform) colour selector.
|
||||||
@ -612,9 +612,9 @@ void dlg_end(void *dlg, int value);
|
|||||||
* dlg_coloursel_start() accepts an RGB triple which is used to
|
* dlg_coloursel_start() accepts an RGB triple which is used to
|
||||||
* initialise the colour selector to its starting value.
|
* initialise the colour selector to its starting value.
|
||||||
*/
|
*/
|
||||||
void dlg_coloursel_start(union control *ctrl, void *dlg,
|
void dlg_coloursel_start(union control *ctrl, dlgparam *dp,
|
||||||
int r, int g, int b);
|
int r, int g, int b);
|
||||||
int dlg_coloursel_results(union control *ctrl, void *dlg,
|
int dlg_coloursel_results(union control *ctrl, dlgparam *dp,
|
||||||
int *r, int *g, int *b);
|
int *r, int *g, int *b);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -626,7 +626,7 @@ int dlg_coloursel_results(union control *ctrl, void *dlg,
|
|||||||
* If `ctrl' is NULL, _all_ controls in the dialog get refreshed
|
* If `ctrl' is NULL, _all_ controls in the dialog get refreshed
|
||||||
* (for loading or saving entire sets of settings).
|
* (for loading or saving entire sets of settings).
|
||||||
*/
|
*/
|
||||||
void dlg_refresh(union control *ctrl, void *dlg);
|
void dlg_refresh(union control *ctrl, dlgparam *dp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Standard helper functions for reading a controlbox structure.
|
* Standard helper functions for reading a controlbox structure.
|
||||||
|
10
putty.h
10
putty.h
@ -1421,16 +1421,16 @@ void cmdline_error(const char *, ...);
|
|||||||
*/
|
*/
|
||||||
struct controlbox;
|
struct controlbox;
|
||||||
union control;
|
union control;
|
||||||
void conf_radiobutton_handler(union control *ctrl, void *dlg,
|
void conf_radiobutton_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event);
|
void *data, int event);
|
||||||
#define CHECKBOX_INVERT (1<<30)
|
#define CHECKBOX_INVERT (1<<30)
|
||||||
void conf_checkbox_handler(union control *ctrl, void *dlg,
|
void conf_checkbox_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event);
|
void *data, int event);
|
||||||
void conf_editbox_handler(union control *ctrl, void *dlg,
|
void conf_editbox_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event);
|
void *data, int event);
|
||||||
void conf_filesel_handler(union control *ctrl, void *dlg,
|
void conf_filesel_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event);
|
void *data, int event);
|
||||||
void conf_fontsel_handler(union control *ctrl, void *dlg,
|
void conf_fontsel_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event);
|
void *data, int event);
|
||||||
void setup_config_box(struct controlbox *b, int midsession,
|
void setup_config_box(struct controlbox *b, int midsession,
|
||||||
int protocol, int protcfginfo);
|
int protocol, int protcfginfo);
|
||||||
|
6
sercfg.c
6
sercfg.c
@ -16,7 +16,7 @@
|
|||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
|
|
||||||
static void serial_parity_handler(union control *ctrl, void *dlg,
|
static void serial_parity_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
static const struct {
|
static const struct {
|
||||||
@ -71,7 +71,7 @@ static void serial_parity_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void serial_flow_handler(union control *ctrl, void *dlg,
|
static void serial_flow_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
static const struct {
|
static const struct {
|
||||||
@ -132,7 +132,7 @@ void ser_setup_config_box(struct controlbox *b, int midsession,
|
|||||||
|
|
||||||
if (!midsession) {
|
if (!midsession) {
|
||||||
int i;
|
int i;
|
||||||
extern void config_protocolbuttons_handler(union control *, void *,
|
extern void config_protocolbuttons_handler(union control *, dlgparam *,
|
||||||
void *, int);
|
void *, int);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
|
|
||||||
static void about_handler(union control *ctrl, void *dlg,
|
static void about_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
if (event == EVENT_ACTION) {
|
if (event == EVENT_ACTION) {
|
||||||
|
112
unix/gtkdlg.c
112
unix/gtkdlg.c
@ -252,27 +252,24 @@ static struct uctrl *dlg_find_bywidget(struct dlgparam *dp, GtkWidget *w)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
union control *dlg_last_focused(union control *ctrl, void *dlg)
|
union control *dlg_last_focused(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
if (dp->currfocus != ctrl)
|
if (dp->currfocus != ctrl)
|
||||||
return dp->currfocus;
|
return dp->currfocus;
|
||||||
else
|
else
|
||||||
return dp->lastfocus;
|
return dp->lastfocus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_radiobutton_set(union control *ctrl, void *dlg, int which)
|
void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int which)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.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);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlg_radiobutton_get(union control *ctrl, void *dlg)
|
int dlg_radiobutton_get(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -284,25 +281,22 @@ int dlg_radiobutton_get(union control *ctrl, void *dlg)
|
|||||||
return 0; /* got to return something */
|
return 0; /* got to return something */
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_checkbox_set(union control *ctrl, void *dlg, int checked)
|
void dlg_checkbox_set(union control *ctrl, dlgparam *dp, int checked)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.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);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlg_checkbox_get(union control *ctrl, void *dlg)
|
int dlg_checkbox_get(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.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));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_editbox_set(union control *ctrl, void *dlg, char const *text)
|
void dlg_editbox_set(union control *ctrl, dlgparam *dp, char const *text)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
GtkWidget *entry;
|
GtkWidget *entry;
|
||||||
char *tmpstring;
|
char *tmpstring;
|
||||||
@ -339,9 +333,8 @@ void dlg_editbox_set(union control *ctrl, void *dlg, char const *text)
|
|||||||
sfree(tmpstring);
|
sfree(tmpstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *dlg_editbox_get(union control *ctrl, void *dlg)
|
char *dlg_editbox_get(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_EDITBOX);
|
||||||
|
|
||||||
@ -369,9 +362,8 @@ static void container_remove_and_destroy(GtkWidget *w, gpointer data)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The `listbox' functions can also apply to combo boxes. */
|
/* The `listbox' functions can also apply to combo boxes. */
|
||||||
void dlg_listbox_clear(union control *ctrl, void *dlg)
|
void dlg_listbox_clear(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_EDITBOX ||
|
||||||
@ -398,9 +390,8 @@ void dlg_listbox_clear(union control *ctrl, void *dlg)
|
|||||||
assert(!"We shouldn't get here");
|
assert(!"We shouldn't get here");
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_listbox_del(union control *ctrl, void *dlg, int index)
|
void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_EDITBOX ||
|
||||||
@ -433,9 +424,9 @@ void dlg_listbox_del(union control *ctrl, void *dlg, int index)
|
|||||||
assert(!"We shouldn't get here");
|
assert(!"We shouldn't get here");
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_listbox_add(union control *ctrl, void *dlg, char const *text)
|
void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text)
|
||||||
{
|
{
|
||||||
dlg_listbox_addwithid(ctrl, dlg, text, 0);
|
dlg_listbox_addwithid(ctrl, dp, text, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -445,10 +436,9 @@ void dlg_listbox_add(union control *ctrl, void *dlg, char const *text)
|
|||||||
* strings in any listbox then you MUST not assign them different
|
* strings in any listbox then you MUST not assign them different
|
||||||
* IDs and expect to get meaningful results back.
|
* IDs and expect to get meaningful results back.
|
||||||
*/
|
*/
|
||||||
void dlg_listbox_addwithid(union control *ctrl, void *dlg,
|
void dlg_listbox_addwithid(union control *ctrl, dlgparam *dp,
|
||||||
char const *text, int id)
|
char const *text, int id)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_EDITBOX ||
|
||||||
@ -594,9 +584,8 @@ void dlg_listbox_addwithid(union control *ctrl, void *dlg,
|
|||||||
dp->flags &= ~FLAG_UPDATING_COMBO_LIST;
|
dp->flags &= ~FLAG_UPDATING_COMBO_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlg_listbox_getid(union control *ctrl, void *dlg, int index)
|
int dlg_listbox_getid(union control *ctrl, dlgparam *dp, int index)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_EDITBOX ||
|
||||||
@ -634,9 +623,8 @@ int dlg_listbox_getid(union control *ctrl, void *dlg, int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* dlg_listbox_index returns <0 if no single element is selected. */
|
/* dlg_listbox_index returns <0 if no single element is selected. */
|
||||||
int dlg_listbox_index(union control *ctrl, void *dlg)
|
int dlg_listbox_index(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_EDITBOX ||
|
||||||
@ -719,9 +707,8 @@ int dlg_listbox_index(union control *ctrl, void *dlg)
|
|||||||
return -1; /* placate dataflow analysis */
|
return -1; /* placate dataflow analysis */
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlg_listbox_issel(union control *ctrl, void *dlg, int index)
|
int dlg_listbox_issel(union control *ctrl, dlgparam *dp, int index)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_EDITBOX ||
|
||||||
@ -777,9 +764,8 @@ int dlg_listbox_issel(union control *ctrl, void *dlg, int index)
|
|||||||
return -1; /* placate dataflow analysis */
|
return -1; /* placate dataflow analysis */
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_listbox_select(union control *ctrl, void *dlg, int index)
|
void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_EDITBOX ||
|
||||||
@ -846,9 +832,8 @@ void dlg_listbox_select(union control *ctrl, void *dlg, int index)
|
|||||||
assert(!"We shouldn't get here");
|
assert(!"We shouldn't get here");
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_text_set(union control *ctrl, void *dlg, char const *text)
|
void dlg_text_set(union control *ctrl, dlgparam *dp, char const *text)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_TEXT);
|
||||||
@ -857,9 +842,8 @@ void dlg_text_set(union control *ctrl, void *dlg, char const *text)
|
|||||||
gtk_label_set_text(GTK_LABEL(uc->text), text);
|
gtk_label_set_text(GTK_LABEL(uc->text), text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_label_change(union control *ctrl, void *dlg, char const *text)
|
void dlg_label_change(union control *ctrl, dlgparam *dp, char const *text)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
switch (uc->ctrl->generic.type) {
|
switch (uc->ctrl->generic.type) {
|
||||||
@ -897,9 +881,8 @@ void dlg_label_change(union control *ctrl, void *dlg, char const *text)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_filesel_set(union control *ctrl, void *dlg, Filename *fn)
|
void dlg_filesel_set(union control *ctrl, dlgparam *dp, Filename *fn)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
/* 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. */
|
||||||
@ -910,18 +893,16 @@ void dlg_filesel_set(union control *ctrl, void *dlg, Filename *fn)
|
|||||||
sfree(duppath);
|
sfree(duppath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Filename *dlg_filesel_get(union control *ctrl, void *dlg)
|
Filename *dlg_filesel_get(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.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)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_fontsel_set(union control *ctrl, void *dlg, FontSpec *fs)
|
void dlg_fontsel_set(union control *ctrl, dlgparam *dp, FontSpec *fs)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
/* 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. */
|
||||||
@ -932,9 +913,8 @@ void dlg_fontsel_set(union control *ctrl, void *dlg, FontSpec *fs)
|
|||||||
sfree(dupname);
|
sfree(dupname);
|
||||||
}
|
}
|
||||||
|
|
||||||
FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg)
|
FontSpec *dlg_fontsel_get(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_FONTSELECT);
|
||||||
assert(uc->entry != NULL);
|
assert(uc->entry != NULL);
|
||||||
@ -946,7 +926,7 @@ FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg)
|
|||||||
* cause the front end (if possible) to delay updating the screen
|
* cause the front end (if possible) to delay updating the screen
|
||||||
* until it's all complete, thus avoiding flicker.
|
* until it's all complete, thus avoiding flicker.
|
||||||
*/
|
*/
|
||||||
void dlg_update_start(union control *ctrl, void *dlg)
|
void dlg_update_start(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Apparently we can't do this at all in GTK. GtkCList supports
|
* Apparently we can't do this at all in GTK. GtkCList supports
|
||||||
@ -954,7 +934,7 @@ void dlg_update_start(union control *ctrl, void *dlg)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_update_done(union control *ctrl, void *dlg)
|
void dlg_update_done(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Apparently we can't do this at all in GTK. GtkCList supports
|
* Apparently we can't do this at all in GTK. GtkCList supports
|
||||||
@ -962,9 +942,8 @@ void dlg_update_done(union control *ctrl, void *dlg)
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_set_focus(union control *ctrl, void *dlg)
|
void dlg_set_focus(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
switch (ctrl->generic.type) {
|
switch (ctrl->generic.type) {
|
||||||
@ -1039,7 +1018,7 @@ void dlg_set_focus(union control *ctrl, void *dlg)
|
|||||||
* indication to the user. dlg_beep() is a quick and easy generic
|
* indication to the user. dlg_beep() is a quick and easy generic
|
||||||
* error; dlg_error() puts up a message-box or equivalent.
|
* error; dlg_error() puts up a message-box or equivalent.
|
||||||
*/
|
*/
|
||||||
void dlg_beep(void *dlg)
|
void dlg_beep(dlgparam *dp)
|
||||||
{
|
{
|
||||||
gdk_display_beep(gdk_display_get_default());
|
gdk_display_beep(gdk_display_get_default());
|
||||||
}
|
}
|
||||||
@ -1079,9 +1058,8 @@ void trivial_post_dialog_fn(void *vctx, int result)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_error_msg(void *dlg, const char *msg)
|
void dlg_error_msg(dlgparam *dp, const char *msg)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
create_message_box(
|
create_message_box(
|
||||||
dp->window, "Error", msg,
|
dp->window, "Error", msg,
|
||||||
string_width("Some sort of text about a config-box error message"),
|
string_width("Some sort of text about a config-box error message"),
|
||||||
@ -1093,16 +1071,14 @@ void dlg_error_msg(void *dlg, const char *msg)
|
|||||||
* processing is completed, and passes an integer value (typically
|
* processing is completed, and passes an integer value (typically
|
||||||
* a success status).
|
* a success status).
|
||||||
*/
|
*/
|
||||||
void dlg_end(void *dlg, int value)
|
void dlg_end(dlgparam *dp, int value)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
dp->retval = value;
|
dp->retval = value;
|
||||||
gtk_widget_destroy(dp->window);
|
gtk_widget_destroy(dp->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_refresh(union control *ctrl, void *dlg)
|
void dlg_refresh(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct uctrl *uc;
|
struct uctrl *uc;
|
||||||
|
|
||||||
if (ctrl) {
|
if (ctrl) {
|
||||||
@ -1120,9 +1096,8 @@ void dlg_refresh(union control *ctrl, void *dlg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_coloursel_start(union control *ctrl, void *dlg, int r, int g, int b)
|
void dlg_coloursel_start(union control *ctrl, dlgparam *dp, int r, int g, int b)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
struct uctrl *uc = dlg_find_byctrl(dp, ctrl);
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(3,0,0)
|
#if GTK_CHECK_VERSION(3,0,0)
|
||||||
@ -1206,10 +1181,9 @@ void dlg_coloursel_start(union control *ctrl, void *dlg, int r, int g, int b)
|
|||||||
gtk_widget_show(coloursel);
|
gtk_widget_show(coloursel);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlg_coloursel_results(union control *ctrl, void *dlg,
|
int dlg_coloursel_results(union control *ctrl, dlgparam *dp,
|
||||||
int *r, int *g, int *b)
|
int *r, int *g, int *b)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
if (dp->coloursel_result.ok) {
|
if (dp->coloursel_result.ok) {
|
||||||
*r = dp->coloursel_result.r;
|
*r = dp->coloursel_result.r;
|
||||||
*g = dp->coloursel_result.g;
|
*g = dp->coloursel_result.g;
|
||||||
@ -3283,11 +3257,11 @@ static void dlgparam_destroy(GtkWidget *widget, gpointer data)
|
|||||||
sfree(dp);
|
sfree(dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void messagebox_handler(union control *ctrl, void *dlg,
|
static void messagebox_handler(union control *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
if (event == EVENT_ACTION)
|
if (event == EVENT_ACTION)
|
||||||
dlg_end(dlg, ctrl->generic.context.i);
|
dlg_end(dp, ctrl->generic.context.i);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct message_box_button button_array_yn[] = {
|
const struct message_box_button button_array_yn[] = {
|
||||||
@ -3806,13 +3780,13 @@ static void eventlog_destroy(GtkWidget *widget, gpointer data)
|
|||||||
dlg_cleanup(&es->dp);
|
dlg_cleanup(&es->dp);
|
||||||
ctrl_free_box(es->eventbox);
|
ctrl_free_box(es->eventbox);
|
||||||
}
|
}
|
||||||
static void eventlog_ok_handler(union control *ctrl, void *dlg,
|
static void eventlog_ok_handler(union control *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
if (event == EVENT_ACTION)
|
if (event == EVENT_ACTION)
|
||||||
dlg_end(dlg, 0);
|
dlg_end(dp, 0);
|
||||||
}
|
}
|
||||||
static void eventlog_list_handler(union control *ctrl, void *dlg,
|
static void eventlog_list_handler(union control *ctrl, dlgparam *dp,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
struct eventlog_stuff *es = (struct eventlog_stuff *)data;
|
struct eventlog_stuff *es = (struct eventlog_stuff *)data;
|
||||||
@ -3820,15 +3794,15 @@ static void eventlog_list_handler(union control *ctrl, void *dlg,
|
|||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
dlg_update_start(ctrl, dlg);
|
dlg_update_start(ctrl, dp);
|
||||||
dlg_listbox_clear(ctrl, dlg);
|
dlg_listbox_clear(ctrl, dp);
|
||||||
for (i = 0; i < es->ninitial; i++) {
|
for (i = 0; i < es->ninitial; i++) {
|
||||||
dlg_listbox_add(ctrl, dlg, es->events_initial[i]);
|
dlg_listbox_add(ctrl, dp, es->events_initial[i]);
|
||||||
}
|
}
|
||||||
for (i = 0; i < es->ncircular; i++) {
|
for (i = 0; i < es->ncircular; i++) {
|
||||||
dlg_listbox_add(ctrl, dlg, es->events_circular[(es->circular_first + i) % LOGEVENT_CIRCULAR_MAX]);
|
dlg_listbox_add(ctrl, dp, es->events_circular[(es->circular_first + i) % LOGEVENT_CIRCULAR_MAX]);
|
||||||
}
|
}
|
||||||
dlg_update_done(ctrl, dlg);
|
dlg_update_done(ctrl, dp);
|
||||||
} else if (event == EVENT_SELCHANGE) {
|
} else if (event == EVENT_SELCHANGE) {
|
||||||
int i;
|
int i;
|
||||||
int selsize = 0;
|
int selsize = 0;
|
||||||
@ -3849,7 +3823,7 @@ static void eventlog_list_handler(union control *ctrl, void *dlg,
|
|||||||
es->seldata = NULL;
|
es->seldata = NULL;
|
||||||
es->sellen = 0;
|
es->sellen = 0;
|
||||||
for (i = 0; i < es->ninitial; i++) {
|
for (i = 0; i < es->ninitial; i++) {
|
||||||
if (dlg_listbox_issel(ctrl, dlg, i)) {
|
if (dlg_listbox_issel(ctrl, dp, i)) {
|
||||||
int extralen = strlen(es->events_initial[i]);
|
int extralen = strlen(es->events_initial[i]);
|
||||||
|
|
||||||
if (es->sellen + extralen + 2 > selsize) {
|
if (es->sellen + extralen + 2 > selsize) {
|
||||||
@ -3863,7 +3837,7 @@ static void eventlog_list_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < es->ncircular; i++) {
|
for (i = 0; i < es->ncircular; i++) {
|
||||||
if (dlg_listbox_issel(ctrl, dlg, es->ninitial + i)) {
|
if (dlg_listbox_issel(ctrl, dp, es->ninitial + i)) {
|
||||||
int j = (es->circular_first + i) % LOGEVENT_CIRCULAR_MAX;
|
int j = (es->circular_first + i) % LOGEVENT_CIRCULAR_MAX;
|
||||||
int extralen = strlen(es->events_circular[j]);
|
int extralen = strlen(es->events_circular[j]);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
|
|
||||||
static void about_handler(union control *ctrl, void *dlg,
|
static void about_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
HWND *hwndp = (HWND *)ctrl->generic.context.p;
|
HWND *hwndp = (HWND *)ctrl->generic.context.p;
|
||||||
@ -20,7 +20,7 @@ static void about_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void help_handler(union control *ctrl, void *dlg,
|
static void help_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
HWND *hwndp = (HWND *)ctrl->generic.context.p;
|
HWND *hwndp = (HWND *)ctrl->generic.context.p;
|
||||||
@ -30,7 +30,7 @@ static void help_handler(union control *ctrl, void *dlg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void variable_pitch_handler(union control *ctrl, void *dlg,
|
static void variable_pitch_handler(union control *ctrl, dlgparam *dlg,
|
||||||
void *data, int event)
|
void *data, int event)
|
||||||
{
|
{
|
||||||
if (event == EVENT_REFRESH) {
|
if (event == EVENT_REFRESH) {
|
||||||
|
@ -1722,9 +1722,8 @@ static void winctrl_set_focus(union control *ctrl, struct dlgparam *dp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
union control *dlg_last_focused(union control *ctrl, void *dlg)
|
union control *dlg_last_focused(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
return dp->focused == ctrl ? dp->lastfocused : dp->focused;
|
return dp->focused == ctrl ? dp->lastfocused : dp->focused;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2067,9 +2066,8 @@ static struct winctrl *dlg_findbyctrl(struct dlgparam *dp, union control *ctrl)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_radiobutton_set(union control *ctrl, void *dlg, int whichbutton)
|
void dlg_radiobutton_set(union control *ctrl, dlgparam *dp, int whichbutton)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_RADIO);
|
||||||
CheckRadioButton(dp->hwnd,
|
CheckRadioButton(dp->hwnd,
|
||||||
@ -2078,9 +2076,8 @@ void dlg_radiobutton_set(union control *ctrl, void *dlg, int whichbutton)
|
|||||||
c->base_id + 1 + whichbutton);
|
c->base_id + 1 + whichbutton);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlg_radiobutton_get(union control *ctrl, void *dlg)
|
int dlg_radiobutton_get(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_RADIO);
|
||||||
@ -2091,42 +2088,37 @@ int dlg_radiobutton_get(union control *ctrl, void *dlg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_checkbox_set(union control *ctrl, void *dlg, int checked)
|
void dlg_checkbox_set(union control *ctrl, dlgparam *dp, int checked)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_CHECKBOX);
|
||||||
CheckDlgButton(dp->hwnd, c->base_id, (checked != 0));
|
CheckDlgButton(dp->hwnd, c->base_id, (checked != 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlg_checkbox_get(union control *ctrl, void *dlg)
|
int dlg_checkbox_get(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_CHECKBOX);
|
||||||
return 0 != IsDlgButtonChecked(dp->hwnd, c->base_id);
|
return 0 != IsDlgButtonChecked(dp->hwnd, c->base_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_editbox_set(union control *ctrl, void *dlg, char const *text)
|
void dlg_editbox_set(union control *ctrl, dlgparam *dp, char const *text)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_EDITBOX);
|
||||||
SetDlgItemText(dp->hwnd, c->base_id+1, text);
|
SetDlgItemText(dp->hwnd, c->base_id+1, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *dlg_editbox_get(union control *ctrl, void *dlg)
|
char *dlg_editbox_get(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_EDITBOX);
|
||||||
return GetDlgItemText_alloc(dp->hwnd, c->base_id+1);
|
return GetDlgItemText_alloc(dp->hwnd, c->base_id+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The `listbox' functions can also apply to combo boxes. */
|
/* The `listbox' functions can also apply to combo boxes. */
|
||||||
void dlg_listbox_clear(union control *ctrl, void *dlg)
|
void dlg_listbox_clear(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int msg;
|
int msg;
|
||||||
assert(c &&
|
assert(c &&
|
||||||
@ -2138,9 +2130,8 @@ void dlg_listbox_clear(union control *ctrl, void *dlg)
|
|||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, 0, 0);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_listbox_del(union control *ctrl, void *dlg, int index)
|
void dlg_listbox_del(union control *ctrl, dlgparam *dp, int index)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int msg;
|
int msg;
|
||||||
assert(c &&
|
assert(c &&
|
||||||
@ -2152,9 +2143,8 @@ void dlg_listbox_del(union control *ctrl, void *dlg, int index)
|
|||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_listbox_add(union control *ctrl, void *dlg, char const *text)
|
void dlg_listbox_add(union control *ctrl, dlgparam *dp, char const *text)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int msg;
|
int msg;
|
||||||
assert(c &&
|
assert(c &&
|
||||||
@ -2173,10 +2163,9 @@ void dlg_listbox_add(union control *ctrl, void *dlg, char const *text)
|
|||||||
* strings in any listbox then you MUST not assign them different
|
* strings in any listbox then you MUST not assign them different
|
||||||
* IDs and expect to get meaningful results back.
|
* IDs and expect to get meaningful results back.
|
||||||
*/
|
*/
|
||||||
void dlg_listbox_addwithid(union control *ctrl, void *dlg,
|
void dlg_listbox_addwithid(union control *ctrl, dlgparam *dp,
|
||||||
char const *text, int id)
|
char const *text, int id)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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 &&
|
||||||
@ -2191,9 +2180,8 @@ void dlg_listbox_addwithid(union control *ctrl, void *dlg,
|
|||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg2, index, (LPARAM)id);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg2, index, (LPARAM)id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlg_listbox_getid(union control *ctrl, void *dlg, int index)
|
int dlg_listbox_getid(union control *ctrl, dlgparam *dp, int index)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_LISTBOX);
|
||||||
@ -2203,9 +2191,8 @@ int dlg_listbox_getid(union control *ctrl, void *dlg, int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* dlg_listbox_index returns <0 if no single element is selected. */
|
/* dlg_listbox_index returns <0 if no single element is selected. */
|
||||||
int dlg_listbox_index(union control *ctrl, void *dlg)
|
int dlg_listbox_index(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_LISTBOX);
|
||||||
@ -2223,9 +2210,8 @@ int dlg_listbox_index(union control *ctrl, void *dlg)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlg_listbox_issel(union control *ctrl, void *dlg, int index)
|
int dlg_listbox_issel(union control *ctrl, dlgparam *dp, int index)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_LISTBOX &&
|
||||||
c->ctrl->listbox.multisel &&
|
c->ctrl->listbox.multisel &&
|
||||||
@ -2234,9 +2220,8 @@ int dlg_listbox_issel(union control *ctrl, void *dlg, int index)
|
|||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, LB_GETSEL, index, 0);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, LB_GETSEL, index, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_listbox_select(union control *ctrl, void *dlg, int index)
|
void dlg_listbox_select(union control *ctrl, dlgparam *dp, int index)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_LISTBOX &&
|
||||||
@ -2245,17 +2230,15 @@ void dlg_listbox_select(union control *ctrl, void *dlg, int index)
|
|||||||
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0);
|
SendDlgItemMessage(dp->hwnd, c->base_id+1, msg, index, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_text_set(union control *ctrl, void *dlg, char const *text)
|
void dlg_text_set(union control *ctrl, dlgparam *dp, char const *text)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_TEXT);
|
||||||
SetDlgItemText(dp->hwnd, c->base_id, text);
|
SetDlgItemText(dp->hwnd, c->base_id, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_label_change(union control *ctrl, void *dlg, char const *text)
|
void dlg_label_change(union control *ctrl, dlgparam *dp, char const *text)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
char *escaped = NULL;
|
char *escaped = NULL;
|
||||||
int id = -1;
|
int id = -1;
|
||||||
@ -2300,17 +2283,15 @@ void dlg_label_change(union control *ctrl, void *dlg, char const *text)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_filesel_set(union control *ctrl, void *dlg, Filename *fn)
|
void dlg_filesel_set(union control *ctrl, dlgparam *dp, Filename *fn)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_FILESELECT);
|
||||||
SetDlgItemText(dp->hwnd, c->base_id+1, fn->path);
|
SetDlgItemText(dp->hwnd, c->base_id+1, fn->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Filename *dlg_filesel_get(union control *ctrl, void *dlg)
|
Filename *dlg_filesel_get(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
char *tmp;
|
char *tmp;
|
||||||
Filename *ret;
|
Filename *ret;
|
||||||
@ -2321,10 +2302,9 @@ Filename *dlg_filesel_get(union control *ctrl, void *dlg)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_fontsel_set(union control *ctrl, void *dlg, FontSpec *fs)
|
void dlg_fontsel_set(union control *ctrl, dlgparam *dp, FontSpec *fs)
|
||||||
{
|
{
|
||||||
char *buf, *boldstr;
|
char *buf, *boldstr;
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_FONTSELECT);
|
||||||
|
|
||||||
@ -2344,9 +2324,8 @@ void dlg_fontsel_set(union control *ctrl, void *dlg, FontSpec *fs)
|
|||||||
dlg_auto_set_fixed_pitch_flag(dp);
|
dlg_auto_set_fixed_pitch_flag(dp);
|
||||||
}
|
}
|
||||||
|
|
||||||
FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg)
|
FontSpec *dlg_fontsel_get(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_FONTSELECT);
|
||||||
return fontspec_copy((FontSpec *)c->data);
|
return fontspec_copy((FontSpec *)c->data);
|
||||||
@ -2357,18 +2336,16 @@ FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg)
|
|||||||
* cause the front end (if possible) to delay updating the screen
|
* cause the front end (if possible) to delay updating the screen
|
||||||
* until it's all complete, thus avoiding flicker.
|
* until it's all complete, thus avoiding flicker.
|
||||||
*/
|
*/
|
||||||
void dlg_update_start(union control *ctrl, void *dlg)
|
void dlg_update_start(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_update_done(union control *ctrl, void *dlg)
|
void dlg_update_done(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
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->generic.type == CTRL_LISTBOX) {
|
||||||
HWND hw = GetDlgItem(dp->hwnd, c->base_id+1);
|
HWND hw = GetDlgItem(dp->hwnd, c->base_id+1);
|
||||||
@ -2377,9 +2354,8 @@ void dlg_update_done(union control *ctrl, void *dlg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_set_focus(union control *ctrl, void *dlg)
|
void dlg_set_focus(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
struct winctrl *c = dlg_findbyctrl(dp, ctrl);
|
||||||
int id;
|
int id;
|
||||||
HWND ctl;
|
HWND ctl;
|
||||||
@ -2413,15 +2389,13 @@ void dlg_set_focus(union control *ctrl, void *dlg)
|
|||||||
* indication to the user. dlg_beep() is a quick and easy generic
|
* indication to the user. dlg_beep() is a quick and easy generic
|
||||||
* error; dlg_error() puts up a message-box or equivalent.
|
* error; dlg_error() puts up a message-box or equivalent.
|
||||||
*/
|
*/
|
||||||
void dlg_beep(void *dlg)
|
void dlg_beep(dlgparam *dp)
|
||||||
{
|
{
|
||||||
/* struct dlgparam *dp = (struct dlgparam *)dlg; */
|
|
||||||
MessageBeep(0);
|
MessageBeep(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_error_msg(void *dlg, const char *msg)
|
void dlg_error_msg(dlgparam *dp, const char *msg)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
MessageBox(dp->hwnd, msg,
|
MessageBox(dp->hwnd, msg,
|
||||||
dp->errtitle ? dp->errtitle : NULL,
|
dp->errtitle ? dp->errtitle : NULL,
|
||||||
MB_OK | MB_ICONERROR);
|
MB_OK | MB_ICONERROR);
|
||||||
@ -2432,16 +2406,14 @@ void dlg_error_msg(void *dlg, const char *msg)
|
|||||||
* processing is completed, and passes an integer value (typically
|
* processing is completed, and passes an integer value (typically
|
||||||
* a success status).
|
* a success status).
|
||||||
*/
|
*/
|
||||||
void dlg_end(void *dlg, int value)
|
void dlg_end(dlgparam *dp, int value)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
dp->ended = TRUE;
|
dp->ended = TRUE;
|
||||||
dp->endresult = value;
|
dp->endresult = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_refresh(union control *ctrl, void *dlg)
|
void dlg_refresh(union control *ctrl, dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
int i, j;
|
int i, j;
|
||||||
struct winctrl *c;
|
struct winctrl *c;
|
||||||
|
|
||||||
@ -2467,19 +2439,17 @@ void dlg_refresh(union control *ctrl, void *dlg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_coloursel_start(union control *ctrl, void *dlg, int r, int g, int b)
|
void dlg_coloursel_start(union control *ctrl, dlgparam *dp, int r, int g, int b)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
dp->coloursel_wanted = TRUE;
|
dp->coloursel_wanted = TRUE;
|
||||||
dp->coloursel_result.r = r;
|
dp->coloursel_result.r = r;
|
||||||
dp->coloursel_result.g = g;
|
dp->coloursel_result.g = g;
|
||||||
dp->coloursel_result.b = b;
|
dp->coloursel_result.b = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlg_coloursel_results(union control *ctrl, void *dlg,
|
int dlg_coloursel_results(union control *ctrl, dlgparam *dp,
|
||||||
int *r, int *g, int *b)
|
int *r, int *g, int *b)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
if (dp->coloursel_result.ok) {
|
if (dp->coloursel_result.ok) {
|
||||||
*r = dp->coloursel_result.r;
|
*r = dp->coloursel_result.r;
|
||||||
*g = dp->coloursel_result.g;
|
*g = dp->coloursel_result.g;
|
||||||
@ -2489,9 +2459,8 @@ int dlg_coloursel_results(union control *ctrl, void *dlg,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_auto_set_fixed_pitch_flag(void *dlg)
|
void dlg_auto_set_fixed_pitch_flag(dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
Conf *conf = (Conf *)dp->data;
|
Conf *conf = (Conf *)dp->data;
|
||||||
FontSpec *fs;
|
FontSpec *fs;
|
||||||
int quality;
|
int quality;
|
||||||
@ -2533,15 +2502,13 @@ void dlg_auto_set_fixed_pitch_flag(void *dlg)
|
|||||||
dp->fixed_pitch_fonts = FALSE;
|
dp->fixed_pitch_fonts = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlg_get_fixed_pitch_flag(void *dlg)
|
int dlg_get_fixed_pitch_flag(dlgparam *dp)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
return dp->fixed_pitch_fonts;
|
return dp->fixed_pitch_fonts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlg_set_fixed_pitch_flag(void *dlg, int flag)
|
void dlg_set_fixed_pitch_flag(dlgparam *dp, int flag)
|
||||||
{
|
{
|
||||||
struct dlgparam *dp = (struct dlgparam *)dlg;
|
|
||||||
dp->fixed_pitch_fonts = flag;
|
dp->fixed_pitch_fonts = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,9 +437,9 @@ void fwdsetter(struct ctlpos *cp, int listid, char *stext, int sid,
|
|||||||
char *btext, int bid,
|
char *btext, int bid,
|
||||||
char *r1text, int r1id, char *r2text, int r2id);
|
char *r1text, int r1id, char *r2text, int r2id);
|
||||||
|
|
||||||
void dlg_auto_set_fixed_pitch_flag(void *dlg);
|
void dlg_auto_set_fixed_pitch_flag(dlgparam *dlg);
|
||||||
int dlg_get_fixed_pitch_flag(void *dlg);
|
int dlg_get_fixed_pitch_flag(dlgparam *dlg);
|
||||||
void dlg_set_fixed_pitch_flag(void *dlg, int flag);
|
void dlg_set_fixed_pitch_flag(dlgparam *dlg, int flag);
|
||||||
|
|
||||||
#define MAX_SHORTCUTS_PER_CTRL 16
|
#define MAX_SHORTCUTS_PER_CTRL 16
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user