コード例 #1
0
ファイル: gendraw4.c プロジェクト: daemqn/Atari_ST_Sources
void  add_child( Custom_couple* Cc_ptr, int ref, short *rightmost_position, short left_update_limit )
{
	Custom_person* Cp_ptr ;
	short previous_children = 0 ;
	int* child_ptr ;
	int* new_child_ptr ;
	int* child_numbers ;
	GRECT update_area ;

			/* add position is fairly arbitrary, relying on user to position	*/
	Cp_ptr = add_custom_person( ref, *rightmost_position, Cc_ptr->y + 2 * generation_gap, NULL, Cc_ptr->list_number ) ;

	if( Cp_ptr )
	{
		Cp_ptr->x += sibling_gap + Cp_ptr->box.g_w / 2 ;
		Cp_ptr->box.g_x += sibling_gap + Cp_ptr->box.g_w / 2 ;
					/* extend hline to new right hand limit position	*/
		Cc_ptr->hline_x1 = Cp_ptr->x ;
		
		
		if( ( child_ptr = Cc_ptr->child_numbers ) != NULL )
			while( *child_ptr++ != 0 )  previous_children++ ; 

		child_numbers = checked_malloc( ( previous_children + 2 ) * sizeof( int ) ) ;
		if( ( new_child_ptr = child_numbers ) != NULL )
		{
			if( ( child_ptr = Cc_ptr->child_numbers ) != NULL )
			{
				while( *child_ptr )  *new_child_ptr++ = *child_ptr++ ;
				free( Cc_ptr->child_numbers ) ;
			}
			Cc_ptr->child_numbers = child_numbers ;

			*rightmost_position = Cp_ptr->box.g_x + Cp_ptr->box.g_w ;
		
			*new_child_ptr++ = Cp_ptr->list_number ;
			*new_child_ptr = 0 ;	/* terminate list	*/
			
					/* screen area to update is width of person, but height	*/
					/* includes distance down from couple as well			*/
			update_area.g_x = mm2pix( left_update_limit, custom_display.x_start, XPOS, &custom_display ) ;
			update_area.g_w = mm2pix( Cp_ptr->box.g_x - left_update_limit + Cp_ptr->box.g_w, 0, XDIST, &custom_display ) ;
			update_area.g_y = mm2pix( Cc_ptr->y, custom_display.y_start, YPOS, &custom_display ) ; ;
			update_area.g_h = mm2pix( Cp_ptr->box.g_h + ( Cp_ptr->box.g_y - Cc_ptr->y ), 0, YDIST, &custom_display ) ;
			
			send_redraw_message( &update_area, custom_form.fm_handle ) ;
		}
		else  remove_custom_person( Cp_ptr ) ;
	}
}
コード例 #2
0
ファイル: AspCell.C プロジェクト: DanIverson/OpenVnmrJ
double AspCell::val2pix(int dim, double val, bool mm) {
//Winfoprintf("##-convert %d %f %f %f %f %f %f",dim,psty,val,vsty,vht,pht,vht);
 if(mm) {
   return mm2pix(dim,val);
 } else {
   if(dim == VERT && vht < 0) return psty + (val-vsty+vht) * (pht / vht);
   else if(dim == VERT) return psty + pht - (vsty-val) *(pht / vht);
   else return pstx + (vstx-val) *(pwd / vwd);
 }
}