int nuov_processor(int cmd, MSGNO_S *msgmap, SCROLL_S *sparms) { int rv = 0; switch(cmd){ /*----------- Print all the help ------------*/ case MC_PRINTMSG : if(open_printer(sparms->text.desc) == 0){ print_help(sparms->proc.data.p); close_printer(); } break; case MC_RELNOTES : helper(h_news, "ALPINE RELEASE NOTES", 0); ps_global->mangled_screen = 1; break; case MC_EXIT : rv = 1; break; default : panic("Unhandled case"); } return(rv); }
void print_people( int ref ) { int reference ; /* person selected for printing */ char *alert_ptr, alert_str[200] ; short i, count = 0 ; Str_prt_params params ; while( !count ) { if( !ref ) { reference = get_person_reference( NULL, TRUE ) ; if( !reference ) return ; /* exit if nobody selected */ count = entries ; /* entries is number of people selected */ if( count > 1 ) { rsrc_gaddr( R_STRING, PRINT_MANY, &alert_ptr ) ; sprintf( alert_str, alert_ptr, count ) ; if( form_alert( 0, alert_str ) == 2 ) count = 0 ; } } else { matches[0] = ref ; /* force selector list */ count = 1 ; } if( count ) { if( open_printer( ¶ms ) ) { params.ref2 = 0 ; /* Do not print second reference. */ if( params.use_gdos ) setup_font( ¶ms, fontinfo ) ; if( params.chs_across < 40 ) { rsrc_gaddr( R_STRING, GROSS_FONT, &alert_ptr ) ; rsrc_form_alert( 1, GROSS_FONT ) ; } else { busy( BUSY_MORE ) ; start_print_checking( ¶ms ) ; i = 0 ; while( printing_ok( ¶ms ) && ( reference = matches[i++] ) ) print_person( reference, ¶ms ) ; close_printer( ¶ms ) ; busy( BUSY_LESS ) ; } } } } }
void print_index( void ) { int ref ; short print_all = FALSE ; short print_list = FALSE ; Str_prt_params params ; short i ; char *start_str, *end_str ; int start_index, end_index ; short button ; if( rsrc_form_alert( 0, PRINT_ALL ) == 1 ) print_all = TRUE ; else if( ref = get_person_reference( NULL, TRUE ) ) print_list = TRUE ; if( !print_all && !print_list ) return ; if( open_printer( ¶ms ) ) { params.ref1 = 0 ; /* Do not print references. */ params.ref2 = 0 ; params.align = LEFT ; /* printout alignment */ params.max_len = 0 ; /* maximum length in character widths */ params.last_x_end = 0 ; params.y_pos = 0 ; params.tabpos = 0 ; /* relative position of second string */ if( print_all ) { start_str = FORM_TEXT( range_ptr, START_INDEX ) ; end_str = FORM_TEXT( range_ptr, END_INDEX ) ; sprintf( start_str, "%d", 1 ) ; sprintf( end_str, "%d", next_person - 1 ) ; app_modal_init( range_ptr, "", TITLED ) ; button = app_modal_do() ; if( button != APP_MODAL_TERM ) { range_ptr[INDEX_RANGE_OK].ob_state &= ~SELECTED ; start_index = atoi( start_str ) ; end_index = atoi( end_str ) ; } app_modal_end() ; if( button != APP_MODAL_TERM ) { if( start_index < 1 || end_index > next_person - 1 || end_index < start_index ) rsrc_form_alert( 1, INVALID_RANGE ) ; else { busy( BUSY_MORE ) ; start_print_checking( ¶ms ) ; for( i=start_index; printing_ok( ¶ms ) && i<=end_index; i++ ) if( people[i].birth_date != DELETED_DATE ) print_idx_person( i, ¶ms ) ; busy( BUSY_LESS ) ; } } } else if( print_list ) { busy( BUSY_MORE ) ; start_print_checking( ¶ms ) ; i = 0 ; while( printing_ok( ¶ms ) && ( ref = matches[i++] ) ) print_idx_person( ref, ¶ms ) ; busy( BUSY_LESS ) ; } end_page( ¶ms, FALSE ) ; close_printer( ¶ms ) ; } }
void tree_print( int trunk ) { Tree_params tree_params ; Str_prt_params params ; short max_gens ; short x_offset ; char underlines[80] ; short sidestep ; short verts[MAX_GENS+1] ; short val, offset ; /* temporary values used in */ /* optimisation of x_offset */ short generation ; short i ; int x ; /* int needed as max lines returned for */ /* file is 7FFF, and extra 2 would go */ /* negative */ if( !trunk ) trunk = get_person_reference( NULL, FALSE ) ; if( !trunk ) return ; /* exit if nobody selected */ if( open_printer( ¶ms ) ) { start_print_checking( ¶ms ) ; params.ref1 = trunk ; params.ref2 = 0 ; /* Do not print second reference. */ busy( BUSY_MORE ) ; x = (int) params.chs_up + 2 ; /* calculate max generations vertically */ max_gens = 0 ; while( x > 3 && max_gens < MAX_GENS ) { x >>= 1 ; max_gens++ ; } tree_params.ref = trunk ; tree_params.generation = 1 ; tree_params.max_generations = max_gens ; /* temporary values */ tree_params.position = 1 ; tree_params.right_limit = params.chs_across * params.cell_width ; for( i=0; i<MAX_TREE_SIZE; i++ ) { tree_names[i][0] = '\0' ; tree_dates[i][0] = '\0' ; } load_tree_strings( tree_params ) ; /* For each generation find value of offset which */ /* would just allow name to fit. The offset is set */ /* to the minimum of these to ensure that all */ /* generations fit. Normally but not always it will */ /* be the last generation that is critical. */ /* Space allowed is width minus 2 to allow for */ /* spaces at start and end of print. */ offset = params.chs_across ; /* initialise to excessive value */ for( generation = 2; generation <= max_gens; generation++ ) { val = ( params.chs_across - 2 - name_max_found[generation] ) / ( generation - 1 ) ; if( val < offset ) offset = val ; } if( offset <= 0 ) offset = 1 ; x_offset = params.cell_width * offset ; tree_params.x_offsets = x_offset ; if( printing_ok( ¶ms ) && params.prn_handle ) { tree_params.ch_width = params.cell_width ; tree_params.x_position = params.cell_width + params.x_offset ; tree_params.ch_height = params.cell_height ; tree_params.y_min = 2 + params.y_offset ; tree_params.y_max = params.chs_up * params.cell_height - 2 + params.y_offset ; tree_params.line_start_x = 0 ; tree_params.line_start_y = 0 ; draw_person( params.prn_handle, tree_params ) ; } else if( printing_ok( ¶ms ) && params.fp ) { if( x_offset > 16 ) sidestep = 8 ; else sidestep = x_offset / 2 ; for( i=0; i < x_offset - sidestep - 1; i++ ) underlines[i] = '_' ; underlines[i] = '\0' ; for( i=0; i<MAX_GENS + 1; i++ ) verts[i] = 0 ; params.y_pos = 0 ; params.downlines = 1 ; params.tabpos = x_offset - sidestep - 1 ; params.align = LEFT ; params.x_pos = 0 ; params.last_x_end = 0 ; std_print_tree_person( tree_params, ¶ms, verts, underlines, sidestep ) ; } end_page( ¶ms, FALSE ) ; close_printer( ¶ms ) ; busy( BUSY_LESS ) ; }