src/liflines/tandem.c
/*==================================================
 * browse_2fam -- Handle two family browse operation
 *================================================*/
- Handle two family browse operation
- Handle two family browse operation
INT browse_2fam (RECORD *prec1, RECORD *prec2, INDISEQ *pseq)
{
	RECORD current1, current2;
	INT nkey1p, nkey2p, modep;
	RECORD tmp, tmp2;
	INT c;
	BOOLEAN reuse=FALSE;
	static INT mode = 'n';
	ASSERT(prec1);
	ASSERT(*prec1);
	ASSERT(nztype(*prec1)=='F');
	ASSERT(prec2);
	ASSERT(*prec2);
	ASSERT(nztype(*prec2)=='F');
	ASSERT(!*pseq);
	current1 = *prec1;
	current2 = *prec2;
	*prec1 = 0;
	*prec2 = 0;
	*pseq = 0;
	show_reset_scroll();
	nkey1p = 0; 
    nkey2p = 0;
	modep = mode;
	while (TRUE) {
		if (nzkeynum(current1) != nkey1p
			|| nzkeynum(current2) != nkey2p
			|| mode != modep) {
			show_reset_scroll();
		}
		display_2fam(current1, current2, mode);
		c = interact_2fam();
		nkey1p = nzkeynum(current1);
		nkey2p = nzkeynum(current2);
		modep = mode;
		if (handle_menu_cmds(c, &reuse))
			continue;
		if (handle_fam_mode_cmds(c, &mode))
			continue;
		if (handle_tandem_scroll_cmds(c))
			continue;
		switch (c)
		{
		case CMD_EDIT:	
			edit_family(current1, &disp_long_rfmt);
			break;
		case CMD_TOP:	
			*prec1 = current1;
			return BROWSE_FAM;
		case CMD_BOTTOM:	
			*prec1 = current2;
			return BROWSE_FAM;
		case CMD_BOTH_FATHERS:	
			{
				RECORD fam1=0, fam2=0;
				if (fam_to_husb(current1, &fam1) == 1
					&& fam_to_husb(current2, &fam2) == 1) {
					*prec1 = fam1;
					*prec2 = fam2;
					return BROWSE_TAND;
				}
			}
			message("%s", _(qStwohsb));
			break;
		case CMD_BOTH_MOTHERS:	
			if ((tmp = choose_mother(NULL, current1, _(qSnowife),
				_(qSid1wbr), NOASK1)) != 0) {
				if ((tmp2 = choose_mother(NULL, current2, _(qSnowife), 
					_(qSid2wbr), NOASK1)) != 0) {
					*prec1 = tmp;
					*prec2 = tmp2;
					return BROWSE_TAND;
				}
			}
			message("%s", _(qStwowif));
			break;
		case CMD_MERGE_BOTTOM_TO_TOP:	
			if ((tmp = merge_two_fams(nztop(current2), nztop(current1))) != 0) {
				*prec1 = tmp;
				return BROWSE_FAM;
			}
			break;
		case CMD_SWAPTOPBOTTOM:	
			tmp = current1;
			current1 = current2;
			current2 = tmp;
			break;
		case CMD_TOGGLE_CHILDNUMS:       
			show_childnumbers();
			break;
		case CMD_QUIT:	
			return BROWSE_QUIT;
		}
	}
}
INT browse_2fam ( RECORD * prec1 , RECORD * prec2 , INDISEQ * pseq ) { RECORD current1 , current2 ; INT nkey1p , nkey2p , modep ; RECORD tmp , tmp2 ; INT c ; BOOLEAN reuse = FALSE ; static INT mode = ' ' ; ASSERT ( prec1 ) ; ASSERT ( * prec1 ) ; ASSERT ( nztype ( * prec1 ) == ' ' ) ; ASSERT ( prec2 ) ; ASSERT ( * prec2 ) ; ASSERT ( nztype ( * prec2 ) == ' ' ) ; ASSERT ( ! * pseq ) ; current1 = * prec1 ; current2 = * prec2 ; * prec1 = 0 ; * prec2 = 0 ; * pseq = 0 ; show_reset_scroll ( ) ; nkey1p = 0 ; nkey2p = 0 ; modep = mode ; while ( TRUE ) { if ( nzkeynum ( current1 ) != nkey1p || nzkeynum ( current2 ) != nkey2p || mode != modep ) { show_reset_scroll ( ) ; } display_2fam ( current1 , current2 , mode ) ; c = interact_2fam ( ) ; nkey1p = nzkeynum ( current1 ) ; nkey2p = nzkeynum ( current2 ) ; modep = mode ; if ( handle_menu_cmds ( c , & reuse ) ) continue ; if ( handle_fam_mode_cmds ( c , & mode ) ) continue ; if ( handle_tandem_scroll_cmds ( c ) ) continue ; switch ( c ) { case CMD_EDIT : edit_family ( current1 , & disp_long_rfmt ) ; break ; case CMD_TOP : * prec1 = current1 ; return BROWSE_FAM ; case CMD_BOTTOM : * prec1 = current2 ; return BROWSE_FAM ; case CMD_BOTH_FATHERS : { RECORD fam1 = 0 , fam2 = 0 ; if ( fam_to_husb ( current1 , & fam1 ) == 1 && fam_to_husb ( current2 , & fam2 ) == 1 ) { * prec1 = fam1 ; * prec2 = fam2 ; return BROWSE_TAND ; } } message ( " " , _ ( qStwohsb ) ) ; break ; case CMD_BOTH_MOTHERS : if ( ( tmp = choose_mother ( NULL , current1 , _ ( qSnowife ) , _ ( qSid1wbr ) , NOASK1 ) ) != 0 ) { if ( ( tmp2 = choose_mother ( NULL , current2 , _ ( qSnowife ) , _ ( qSid2wbr ) , NOASK1 ) ) != 0 ) { * prec1 = tmp ; * prec2 = tmp2 ; return BROWSE_TAND ; } } message ( " " , _ ( qStwowif ) ) ; break ; case CMD_MERGE_BOTTOM_TO_TOP : if ( ( tmp = merge_two_fams ( nztop ( current2 ) , nztop ( current1 ) ) ) != 0 ) { * prec1 = tmp ; return BROWSE_FAM ; } break ; case CMD_SWAPTOPBOTTOM : tmp = current1 ; current1 = current2 ; current2 = tmp ; break ; case CMD_TOGGLE_CHILDNUMS : show_childnumbers ( ) ; break ; case CMD_QUIT : return BROWSE_QUIT ; } } }
browse_2fam -- Handle two family browse operation
browse_2fam -- Handle two family browse operation
/* force redraw */ /* last keynum & mode, so can tell if changed */ /* edit top fam */ /* browse top fam */ /* browse bottom fam */ /* browse to husbs/faths */ /* browse to wives/moths */ /* merge two fams */ /* swap two fams */ /* toggle children numbers */ /* Return to main menu */