d_text.cpp
/* Version of init_text_input that allows overlaying.
 * Does not test for other text nearby.
 */
Version of init_text_input that allows overlaying.
Does not test for other text nearby.
Version of init_text_input that allows overlaying . Does not test for other text nearby .
static void
overlay_text_input(int x, int y)
{
    cur_x = x;
    cur_y = y;
    set_action_on();
    set_mousefun("new text", "finish text", "cancel", "", "paste text", "");
    draw_mousefun_kbd();
    draw_mousefun_canvas();
    canvas_kbd_proc = (FCallBack)char_handler;
    canvas_middlebut_proc = finish_text_input;
    canvas_leftbut_proc = (FCallBack)finish_n_start;
    canvas_rightbut_proc = (FCallBack)cancel_text_input;
    cur_t=NULL;
    leng_prefix = leng_suffix = 0;
    *suffix = 0;
    prefix[leng_prefix] = '\0';
    base_x = cur_x;
    base_y = cur_y;
#ifdef I18N
    save_base_x = base_x;
    save_base_y = base_y;
#endif 
    if (is_newline) {	
	is_newline = False;
    } else {		
	work_textcolor = cur_pencolor;
	work_font     = using_ps ? cur_ps_font : cur_latex_font;
	work_psflag   = using_ps;
	work_flags    = cur_textflags;
	work_textjust = cur_textjust;
	work_depth    = cur_depth;
	work_angle    = cur_elltextangle*M_PI/180.0;
	while (work_angle < 0.0)
	    work_angle += M_2PI;
	sin_t = sin((double)work_angle);
	cos_t = cos((double)work_angle);
	canvas_font = lookfont(x_fontnum(work_psflag, work_font), 
			   work_fontsize);
	canvas_zoomed_font = lookfont(x_fontnum(work_psflag, work_font), 
				  round(work_fontsize*display_zoomscale));
	work_fontstruct = canvas_zoomed_font;
    }
    put_msg("Ready for text input (from keyboard)");
    char_ht = ZOOM_FACTOR * max_char_height(canvas_font);
    initialize_char_handler(canvas_win, (IntFunc)finish_text_input,
			  base_x, base_y);
    draw_char_string();
}
static void overlay_text_input ( int x , int y ) { cur_x = x ; cur_y = y ; set_action_on ( ) ; set_mousefun ( " " , " " , " " , " " , " " , " " ) ; draw_mousefun_kbd ( ) ; draw_mousefun_canvas ( ) ; canvas_kbd_proc = ( FCallBack ) char_handler ; canvas_middlebut_proc = finish_text_input ; canvas_leftbut_proc = ( FCallBack ) finish_n_start ; canvas_rightbut_proc = ( FCallBack ) cancel_text_input ; cur_t = NULL ; leng_prefix = leng_suffix = 0 ; * suffix = 0 ; prefix [ leng_prefix ] = ' \0 ' ; base_x = cur_x ; base_y = cur_y ; #ifdef I18N save_base_x = base_x ; save_base_y = base_y ; #endif if ( is_newline ) { is_newline = False ; } else { work_textcolor = cur_pencolor ; work_font = using_ps ? cur_ps_font : cur_latex_font ; work_psflag = using_ps ; work_flags = cur_textflags ; work_textjust = cur_textjust ; work_depth = cur_depth ; work_angle = cur_elltextangle * M_PI / 180.0 ; while ( work_angle < 0.0 ) work_angle += M_2PI ; sin_t = sin ( ( double ) work_angle ) ; cos_t = cos ( ( double ) work_angle ) ; canvas_font = lookfont ( x_fontnum ( work_psflag , work_font ) , work_fontsize ) ; canvas_zoomed_font = lookfont ( x_fontnum ( work_psflag , work_font ) , round ( work_fontsize * display_zoomscale ) ) ; work_fontstruct = canvas_zoomed_font ; } put_msg ( " " ) ; char_ht = ZOOM_FACTOR * max_char_height ( canvas_font ) ; initialize_char_handler ( canvas_win , ( IntFunc ) finish_text_input , base_x , base_y ) ; draw_char_string ( ) ; }
Version of init_text_input that allows overlaying.
Version of init_text_input that allows overlaying .
/*
   * set working font info to current settings. This allows user to change
   * font settings while we are in the middle of accepting text without
   * affecting this text i.e. we don't allow the text to change midway
   * through
   */ /* I18N */ /* working settings already set */ /* set working settings from ind panel */ /* load the X font and get its id for this font and size UNZOOMED */ /* this is to get widths etc for the unzoomed chars */ /* get the ZOOMED font for actually drawing on the canvas */ /* save the working font structure */