void toc_open( void ) { OBJECT *tool; WINDOW * win; int w, h, dummy; if( toc_win ) { WindSet( toc_win, WF_TOP ); } else { rsrc_gaddr( 0, TRACK_TB, &tool ); toc_win = WindCreate( DEFAULT_FLAGS|SIZER|UPARROW|DNARROW|VSLIDE, 0, 0, 0, 0 ); win = toc_win; if( win ) { toc_popup.object = TTB_SOURCE; toc_popup.item = toc_popup_items; gen_dev_popup( &toc_popup, 0, 1 ); toc_default( tool ); WindCalc( WC_BORDER, win, 0, 0, 472, tool->ob_height, &dummy, &dummy, &w, &h ); WindSet( win, WF_NAME, get_string( "TXT_TOCWIN" ) ); WindSet( win, WF_TOOLBAR, tool, toolbar_mgr ); win->w_min = w; win->h_min = h; win->w_max = w; win->h_max = h; WindOpen( win, -1, -1, w, h ); EvntAttach( win, WM_DESTROY, toc_destroy ); EvntAttach( win, UE_CLICKED, toc_clicked ); EvntAttach( win, UE_TOOLBAR, toc_toolbar ); toc_gestion_acces( win ); } } }
void copy_open( void ) { const static int thbut[] = {CB_ONG1, CB_ONG2}; const static int thsub[] = {CB_FD1, CB_FD2}; OBJECT * tree; WINDOW * win; gen_dev_popup( &srcdev_popup, 0, 1 ); gen_dev_popup( &dstdev_popup, DSF_SUP_DAO_WR, 1 ); rsrc_gaddr( 0, COPY_BOX, &tree ); copy_default( tree ); copy_gestion_acces( tree ); win = open_dialog( tree, get_string( "TXT_COPY" ) ); FormThumb( win, thsub, thbut, (int)(sizeof( thbut ) / sizeof( int )) ); EvntAttach( win, UE_CLICKED, copy_clicked ); }
/* Bind global and menu events to event handler functions, create accelerators */ void bind_global_events( void ) { int i, len; int maxlen[NUM_MENU_TITLES]={0}; char * m, *u, *t; char spare[128]; memset( (void*)&evnt_data, 0, sizeof(struct s_evnt_data) ); EvntDataAttach( NULL, WM_XKEYBD, global_evnt_keybd, (void*)&evnt_data ); EvntAttach( NULL, AP_TERM, global_evnt_apterm ); EvntAttach( NULL, MN_SELECTED, global_evnt_menu ); EvntAttach( NULL, WM_XM1, global_evnt_m1 ); /* parse and update menu items: */ i = 0; while( menu_evnt_tbl[i].rid != -1 ) { char * str = ObjcString( h_gem_menu, menu_evnt_tbl[i].rid, NULL ); register_menu_str( &menu_evnt_tbl[i] ); if( menu_evnt_tbl[i].menustr != NULL ){ MenuText( NULL, menu_evnt_tbl[i].rid, menu_evnt_tbl[i].menustr ); } i++; } main_menu_update(); }
void tao_window_open( void ) { static char txt[MAX_FRED_DEST+1]; OBJECT * tree; WINDOW * win; gen_dev_popup( &tao_popup, DSF_IS_WRITER, 1 ); rsrc_gaddr( 0, TAO_BOX, &tree ); sprintf( txt, "%-40s", get_string( "TXT_ISOFILE" ) ); tao_popup.item[0].text = txt; tao_default( tree ); tao_gestion_acces( tree ); win = open_dialog( tree, get_string( "TXT_TAOTITLE" ) ); EvntAttach( win, UE_CLICKED, tao_clicked ); }
int toc_readtoc( WINDOW * win ) { struct _toc_data * data; struct idao_stream * in; const static char * type[] = { "Audio", "Data mode 1", "Data mode 2", "Data" }; long beg, end; int m, s, f; int i, entry, mode; data = DataSearch( win, TW_MAGIC ); if( data == NULL ) { data = new_toc_data( ); if( !data ) return -1; } busybee(); if( toc_popup.selected == 0 ) in = idao_open_file( toc_info.toc_file ); else in = idao_open_cd( toc_popup.item[toc_popup.selected].info ); if( !in ) goto readerr; data->toc = in->toc; /* Analyse de la toc */ entry = get_toc_entry( &data->toc, 0xa1, data->toc.head.last_track ); data->n_tracks = desc( data->toc, entry ).pmin; if( toc_gen_tree( data ) ) goto readerr2; for( i=0; i<data->n_tracks; i++ ) { sprintf( data->f[i].tno, "%2d", i + 1 ); beg = get_track_offset( &data->toc, i + 1, &end ); msf( beg, &m, &s, &f ); sprintf( data->f[i].beg_time, "%02d%02d%02d", m, s, f ); msf( end - 1, &m, &s, &f ); mode = get_mode( &data->toc, i + 1 ); if( mode < 0 ) mode = 3; objc_enable( data->tree, i*data->n_obj + 1 + TF_CK, mode == 0 /*mode != 3*/ ); data->tree[ i*data->n_obj + 1 + TF_TYPE ].ob_spec.free_string = type[ mode ]; sprintf( data->f[i].end_time, "%02d%02d%02d", m, s, f ); data->tree[ i*data->n_obj + 1 + TF_TNO ].ob_spec.free_string = data->f[i].tno; } idao_close( in ); FormAttach( win, data->tree, form_mgr ); DataAttach( win, TW_MAGIC, data ); EvntAttach( win, WM_DESTROY, toc_destroy ); wind_center( win, -1, data->tree->ob_height ); objc_redraw( data->tree, 0 ); arrow(); return 0; readerr2: idao_close( in ); readerr: free( data ); arrow(); alert_msg( "AL_CANTREAD", 1 ); return -1; }