Skip to content

Commit

Permalink
Add a data parameter to the menu_item function signature.
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Jan 24, 2025
1 parent 44a7cca commit da79b2a
Show file tree
Hide file tree
Showing 28 changed files with 52 additions and 51 deletions.
2 changes: 1 addition & 1 deletion src/mged/buttons.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ f_press(ClientData clientData,
/* It's up to the menu_func to set menu_state->ms_flag = 0
* if no arrow is desired */
if (mptr->menu_func != NULL)
(*(mptr->menu_func))(s, mptr->menu_arg, menu, item);
(*(mptr->menu_func))(s, mptr->menu_arg, menu, item, s);

goto next;
}
Expand Down
15 changes: 8 additions & 7 deletions src/mged/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
#include "ged.h"


extern void sl_halt_scroll(struct mged_state *s, int, int, int); /* in scroll.c */
extern void sl_halt_scroll(struct mged_state *s, int, int, int, void *); /* in scroll.c */

extern void sl_toggle_scroll(struct mged_state *s, int, int, int);
extern void sl_toggle_scroll(struct mged_state *s, int, int, int, void *);

void btn_head_menu(struct mged_state *s, int i, int menu, int item);
void btn_item_hit(struct mged_state *s, int arg, int menu, int item);
void btn_head_menu(struct mged_state *s, int i, int menu, int item, void *data);
void btn_item_hit(struct mged_state *s, int arg, int menu, int item, void *data);

struct menu_item first_menu[] = {
{ "BUTTON MENU", btn_head_menu, 1 }, /* chg to 2nd menu */
Expand Down Expand Up @@ -96,7 +96,7 @@ struct menu_item oed_menu[] = {
* Called when a menu item is hit
*/
void
btn_item_hit(struct mged_state *s, int arg, int menu, int UNUSED(item))
btn_item_hit(struct mged_state *s, int arg, int menu, int UNUSED(item), void *UNUSED(data))
{
button(s, arg);
if (menu == MENU_GEN &&
Expand All @@ -109,7 +109,8 @@ btn_item_hit(struct mged_state *s, int arg, int menu, int UNUSED(item))
* Also called from main() with arg 0 in init.
*/
void
btn_head_menu(struct mged_state *s, int i, int UNUSED(menu), int UNUSED(item)) {
btn_head_menu(struct mged_state *s, int i, int UNUSED(menu), int UNUSED(item), void *UNUSED(data))
{
switch (i) {
case 0:
mmenu_set(s, MENU_GEN, first_menu);
Expand Down Expand Up @@ -440,7 +441,7 @@ mmenu_select(struct mged_state *s, int pen_y, int do_func)
/* It's up to the menu_func to set menu_state->ms_flag=0
* if no arrow is desired */
if (do_func && mptr->menu_func != NULL)
(*(mptr->menu_func))(s, mptr->menu_arg, menu, item);
(*(mptr->menu_func))(s, mptr->menu_arg, menu, item, s);

return 1; /* menu claims pen value */
}
Expand Down
4 changes: 2 additions & 2 deletions src/mged/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ __BEGIN_DECLS
*/
struct menu_item {
char *menu_string;
void (*menu_func)(struct mged_state *, int, int, int);
void (*menu_func)(struct mged_state *, int, int, int, void *);
int menu_arg;
};

Expand All @@ -62,7 +62,7 @@ struct menu_item {
extern struct menu_item sed_menu[];
extern struct menu_item oed_menu[];

void btn_head_menu(struct mged_state *s, int i, int menu, int item);
void btn_head_menu(struct mged_state *s, int i, int menu, int item, void *data);
void chg_l2menu(struct mged_state *s, int i);

extern void mmenu_init(struct mged_state *s);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/mged.c
Original file line number Diff line number Diff line change
Expand Up @@ -2150,7 +2150,7 @@ main(int argc, char *argv[])
new_mats(s);

mmenu_init(s);
btn_head_menu(s, 0, 0, 0);
btn_head_menu(s, 0, 0, 0, s);
mged_link_vars(s->mged_curr_dm);

bu_vls_printf(&s->input_str, "set version \"%s\"", brlcad_ident("Geometry Editor (MGED)"));
Expand Down
32 changes: 16 additions & 16 deletions src/mged/primitives/edarb.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int newedge;
short int fixv; /* used in ECMD_ARB_ROTATE_FACE, f_eqn(): fixed vertex */

static void
arb8_edge(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb8_edge(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
s->s_edit.edit_flag = EARB;
Expand Down Expand Up @@ -96,7 +96,7 @@ struct menu_item edge8_menu[] = {


static void
arb7_edge(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb7_edge(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
s->s_edit.edit_flag = EARB;
Expand Down Expand Up @@ -135,7 +135,7 @@ struct menu_item edge7_menu[] = {
};

static void
arb6_edge(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb6_edge(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
s->s_edit.edit_flag = EARB;
Expand Down Expand Up @@ -177,7 +177,7 @@ struct menu_item edge6_menu[] = {
};

static void
arb5_edge(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb5_edge(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
s->s_edit.edit_flag = EARB;
Expand Down Expand Up @@ -213,7 +213,7 @@ struct menu_item edge5_menu[] = {
};

static void
arb4_point(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb4_point(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
s->s_edit.edit_flag = PTARB;
Expand All @@ -239,7 +239,7 @@ struct menu_item point4_menu[] = {
};

static void
arb8_mv_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb8_mv_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg - 1;
s->s_edit.edit_flag = ECMD_ARB_MOVE_FACE;
Expand Down Expand Up @@ -267,7 +267,7 @@ struct menu_item mv8_menu[] = {
};

static void
arb7_mv_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb7_mv_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg - 1;
s->s_edit.edit_flag = ECMD_ARB_MOVE_FACE;
Expand All @@ -291,7 +291,7 @@ struct menu_item mv7_menu[] = {
};

static void
arb6_mv_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb6_mv_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg - 1;
s->s_edit.edit_flag = ECMD_ARB_MOVE_FACE;
Expand All @@ -318,7 +318,7 @@ struct menu_item mv6_menu[] = {
};

static void
arb5_mv_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb5_mv_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg - 1;
s->s_edit.edit_flag = ECMD_ARB_MOVE_FACE;
Expand All @@ -345,7 +345,7 @@ struct menu_item mv5_menu[] = {
};

static void
arb4_mv_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb4_mv_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg - 1;
s->s_edit.edit_flag = ECMD_ARB_MOVE_FACE;
Expand All @@ -371,7 +371,7 @@ struct menu_item mv4_menu[] = {
};

static void
arb8_rot_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb8_rot_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg - 1;
mged_set_edflag(s, ECMD_ARB_SETUP_ROTFACE);
Expand All @@ -393,7 +393,7 @@ struct menu_item rot8_menu[] = {
};

static void
arb7_rot_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb7_rot_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg - 1;
mged_set_edflag(s, ECMD_ARB_SETUP_ROTFACE);
Expand All @@ -415,7 +415,7 @@ struct menu_item rot7_menu[] = {
};

static void
arb6_rot_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb6_rot_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg - 1;
mged_set_edflag(s, ECMD_ARB_SETUP_ROTFACE);
Expand All @@ -436,7 +436,7 @@ struct menu_item rot6_menu[] = {
};

static void
arb5_rot_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb5_rot_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg - 1;
mged_set_edflag(s, ECMD_ARB_SETUP_ROTFACE);
Expand All @@ -458,7 +458,7 @@ struct menu_item rot5_menu[] = {
};

static void
arb4_rot_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb4_rot_face(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg - 1;
mged_set_edflag(s, ECMD_ARB_SETUP_ROTFACE);
Expand All @@ -478,7 +478,7 @@ struct menu_item rot4_menu[] = {
};

static void
arb_control(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
arb_control(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
mged_set_edflag(s, ECMD_ARB_SPECIFIC_MENU);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edars.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ find_ars_nearest_pnt(

/*ARGSUSED*/
static void
ars_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
ars_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_flag = arg;

Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edbot.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
int bot_verts[3]; /* vertices for the BOT solid */

static void
bot_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
bot_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
s->s_edit.edit_flag = arg;
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edbspline.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static int spl_vi;

/*ARGSUSED*/
static void
spline_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
spline_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
/* XXX Why wasn't this done by setting edit_flag = ECMD_SPLINE_VPICK? */
if (arg < 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edcline.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#define MENU_CLINE_SCALE_T 29110

static void
cline_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
cline_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_flag = arg;

Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/eddsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
extern const char * get_file_name(struct mged_state *s, char *str);

static void
dsp_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
dsp_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
mged_set_edflag(s, -1);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edebm.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
extern const char * get_file_name(struct mged_state *s, char *str);

static void
ebm_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
ebm_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
mged_set_edflag(s, -1);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edehy.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#define MENU_EHY_C 20056

static void
ehy_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
ehy_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
mged_set_edflag(s, PSCALE);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edell.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#define MENU_ELL_SCALE_ABC 3042

static void
ell_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
ell_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
mged_set_edflag(s, PSCALE);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edepa.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define MENU_EPA_R2 19052

static void
epa_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
epa_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
mged_set_edflag(s, PSCALE);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edeto.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#define MENU_ETO_ROT_C 21060

static void
eto_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
eto_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
mged_set_edflag(s, PSCALE);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edextrude.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extern char * get_sketch_name(struct mged_state *s, const char *sk_n);

/*ARGSUSED*/
static void
extr_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
extr_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_flag = arg;

Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edhyp.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#define MENU_HYP_ROT_H 38131

static void
hyp_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
hyp_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
switch (arg) {
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edmetaball.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
struct wdb_metaball_pnt *es_metaball_pnt=(struct wdb_metaball_pnt *)NULL; /* Currently selected METABALL Point */

static void
metaball_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
metaball_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
struct wdb_metaball_pnt *next, *prev;

Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/ednmg.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ point_t lu_keypoint; /* keypoint of lu_copy for extrusion */
*/
/*ARGSUSED*/
static void
nmg_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
nmg_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
switch (arg) {
default:
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edpart.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define MENU_PART_h 16090

static void
part_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
part_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
mged_set_edflag(s, PSCALE);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edpipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
struct wdb_pipe_pnt *es_pipe_pnt=(struct wdb_pipe_pnt *)NULL; /* Currently selected PIPE segment */

static void
pipe_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
pipe_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
struct wdb_pipe_pnt *next;
struct wdb_pipe_pnt *prev;
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edrhc.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#define MENU_RHC_C 18049

static void
rhc_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
rhc_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
mged_set_edflag(s, PSCALE);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define MENU_RPC_R 17045

static void
rpc_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b))
rpc_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data))
{
s->s_edit.edit_menu = arg;
mged_set_edflag(s, PSCALE);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edsuperell.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#define MENU_SUPERELL_SCALE_ABC 35116

static void
superell_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b)) {
superell_ed(struct mged_state *s, int arg, int UNUSED(a), int UNUSED(b), void *UNUSED(data)) {
s->s_edit.edit_menu = arg;
mged_set_edflag(s, PSCALE);
set_e_axes_pos(s, 1);
Expand Down
Loading

0 comments on commit da79b2a

Please sign in to comment.