/* * radio_stubs.c - Notify and event callback function stubs. * This file was generated by `gxv' from `radio.G'. * DO NOT EDIT BY HAND. */ #include #include #include #include #include #include #include #include #include #include #include #include #include "radio_ui.h" #ifdef MAIN /* * Instance XV_KEY_DATA key. An instance is a set of related * user interface objects. A pointer to an object's instance * is stored under this key in every object. This must be a * global variable. */ int INSTANCE; radio_popup_host_list_objects *radio_popup_host_list; radio_frame_objects *radio_frame; Notify_value destroy_n_cleanup(); static int from_file = 1; Notify_value icon_drop(); void main(argc, argv) int argc; char **argv; { char **all_hosts(); int i; /* * Initialize XView. */ xv_init(XV_INIT_ARGS, argc, argv, 0); INSTANCE = xv_unique_key(); /* * Initialize user interface components. */ radio_frame = radio_frame_objects_initialize(NULL, NULL); radio_popup_host_list = radio_popup_host_list_objects_initialize(NULL, radio_frame->frame); connect_to_machines( (Display *) xv_get(radio_frame->frame,XV_DISPLAY), argc - 1, &argv[1]); start_file(NULL, from_file, 0); xv_set(radio_frame->input_setting, PANEL_VALUE, from_file, PANEL_DEFAULT_VALUE, from_file, 0); xv_set(radio_frame->play_vol, PANEL_VALUE, 27, 0); xv_set(radio_frame->rec_vol, PANEL_VALUE, 20, 0); (void) notify_interpose_event_func(xv_get(radio_frame->frame, FRAME_ICON) , icon_drop, NOTIFY_SAFE); (void) notify_interpose_destroy_func(radio_frame->frame, destroy_n_cleanup, NOTIFY_SAFE); set_timer(radio_frame->frame, 1); window_main_loop(radio_frame->frame); exit(0); } #endif /* * Menu handler for `file_menu (Input from Microphone)'. */ Menu_item menu_input_mic(item, op) Menu_item item; Menu_generate op; { Xv_opaque ip = (Xv_opaque) xv_get(item, XV_KEY_DATA, INSTANCE); switch (op) { case MENU_DISPLAY: break; case MENU_DISPLAY_DONE: break; case MENU_NOTIFY: fputs("radio: menu_input_mic: MENU_NOTIFY\n", stderr); break; case MENU_NOTIFY_DONE: break; } return item; } /* * Menu handler for `file_menu (Input from file)'. */ Menu_item menu_input_file(item, op) Menu_item item; Menu_generate op; { Xv_opaque ip = (Xv_opaque) xv_get(item, XV_KEY_DATA, INSTANCE); switch (op) { case MENU_DISPLAY: break; case MENU_DISPLAY_DONE: break; case MENU_NOTIFY: fputs("radio: menu_input_file: MENU_NOTIFY\n", stderr); break; case MENU_NOTIFY_DONE: break; } return item; } /* * Menu handler for `edit_menu (Add host)'. */ Menu_item menu_add_host_proc(item, op) Menu_item item; Menu_generate op; { radio_frame_objects * ip = (radio_frame_objects *) xv_get(item, XV_KEY_DATA, INSTANCE); switch (op) { case MENU_DISPLAY: break; case MENU_DISPLAY_DONE: break; case MENU_NOTIFY: fputs("radio: menu_add_host_proc: MENU_NOTIFY\n", stderr); break; case MENU_NOTIFY_DONE: break; } return item; } /* * Menu handler for `edit_menu (Delete host)'. */ Menu_item menu_del_host_proc(item, op) Menu_item item; Menu_generate op; { radio_frame_objects * ip = (radio_frame_objects *) xv_get(item, XV_KEY_DATA, INSTANCE); switch (op) { case MENU_DISPLAY: break; case MENU_DISPLAY_DONE: break; case MENU_NOTIFY: fputs("radio: menu_del_host_proc: MENU_NOTIFY\n", stderr); break; case MENU_NOTIFY_DONE: break; } return item; } /* * Event callback function for `panel'. */ Notify_value file_input_proc(win, event, arg, type) Xv_Window win; Event *event; Notify_arg arg; Notify_event_type type; { radio_frame_objects *ip = (radio_frame_objects *) xv_get(win, XV_KEY_DATA, INSTANCE); char filename[200]; switch(event_action(event)) { case ACTION_DRAG_LOAD: get_seln(filename); xv_set( radio_frame->file_name_text, PANEL_VALUE, filename, 0 ); start_file(filename, from_file, 1); break; case ACTION_MENU: if (event_action(event) == ACTION_MENU && event_is_down(event)) { Menu menu = (Menu) xv_get(win, WIN_MENU); if (menu) menu_show(menu, win, event, 0); } default: return notify_next_event_func(win, event, arg, type); break; } } /* * Notify callback function for `view_but'. */ void view_but_proc(item, event) Panel_item item; Event *event; { radio_frame_objects *ip = (radio_frame_objects *) xv_get(item, XV_KEY_DATA, INSTANCE); xv_set(radio_popup_host_list->popup_host_list, WIN_SHOW, TRUE,0); fill_host_list( radio_popup_host_list->host_list ); } /* * Notify callback function for `input_setting'. */ void input_setting_proc(item, value, event) Panel_item item; int value; Event *event; { radio_frame_objects *ip = (radio_frame_objects *) xv_get(item, XV_KEY_DATA, INSTANCE); from_file = value ; start_file(NULL, from_file, 0); } /* * Notify callback function for `play_vol'. */ void play_vol_proc(item, value, event) Panel_item item; int value; Event *event; { radio_frame_objects *ip = (radio_frame_objects *) xv_get(item, XV_KEY_DATA, INSTANCE); change_volume(0,value); } /* * Notify callback function for `rec_vol'. */ void rec_vol_proc(item, value, event) Panel_item item; int value; Event *event; { radio_frame_objects *ip = (radio_frame_objects *) xv_get(item, XV_KEY_DATA, INSTANCE); change_volume(1,value); } /***************************************** Independent XView code - ahould be another file *****************************************/ char * get_file_name(item) Xv_opaque item; { radio_frame_objects * ip = (radio_frame_objects *) xv_get(item, XV_KEY_DATA, INSTANCE); return(xv_get( ip->file_name_text, PANEL_VALUE)); } /* Read the current primary selection */ get_seln(data) char *data; { Seln_holder holder; Seln_request *buffer; holder = seln_inquire(SELN_PRIMARY); buffer = seln_ask( &holder, SELN_REQ_CONTENTS_ASCII, 0, 0); strcpy( data, ((buffer->data) + sizeof(Seln_attribute)) ); } Notify_value destroy_n_cleanup(frame,status) Frame frame; Destroy_status status; { if (status!=DESTROY_CHECKING) { quit_proc(); window_set(frame, WIN_SHOW, FALSE, 0); } return( notify_next_destroy_func(frame,status) ); } static Notify_value a_second(); /* waits up once a second */ set_timer( me , on) Notify_client me; { struct itimerval sec_timer; /* initial value */ if (on) { sec_timer.it_interval.tv_sec = 1; sec_timer.it_interval.tv_usec = 0; /* initial value */ sec_timer.it_value.tv_sec = 1; sec_timer.it_value.tv_usec = 0; (void) notify_set_itimer_func( me, a_second, ITIMER_REAL, &sec_timer, (struct itimerval *)0); } else (void) notify_set_itimer_func( me, a_second, ITIMER_REAL, (struct itimerval *) 0, (struct itimerval *)0); } static Notify_value a_second( me, which) Notify_client me; int which; { do_audio(); } fill_host_list( list_item ) Xv_opaque list_item; { static int first = 1; char **all_hosts(); int p=0,i=0, t=0; char **hosts; if (!first) return; hosts = all_hosts(&i); for (p =0; p< i; p++) { xv_set( list_item, PANEL_LIST_INSERT, p , 0); xv_set( list_item, PANEL_LIST_STRING, p , hosts[p], 0 ); } first = 0; } Notify_value icon_drop(frame, event, arg, type) Frame frame; Event *event; Notify_arg arg; Notify_event_type type; { char filename[100]; if(event_action(event) == ACTION_DRAG_LOAD ) { get_seln(filename); xv_set( radio_frame->file_name_text, PANEL_VALUE, filename, 0 ); start_file(filename, from_file, 1); return( 0); } else return( notify_next_event_func (frame, event, arg, type)); } clear_file_name() { xv_set( radio_frame->file_name_text, PANEL_VALUE, "", 0 ); }