p3dinter.c

来自「speech signal process tools」· C语言 代码 · 共 2,114 行 · 第 1/4 页

C
2,114
字号
/* * This material contains unpublished, proprietary software of  * Entropic Research Laboratory, Inc. Any reproduction, distribution,  * or publication of this work must be authorized in writing by Entropic  * Research Laboratory, Inc., and must bear the notice:  * *    "Copyright (c) 1986-1990  Entropic Speech, Inc.  *    "Copyright (c) 1990-1993  Entropic Research Laboratory, Inc.  *                   All rights reserved" * * The copyright notice above does not evidence any actual or intended  * publication of this source code.      * * Written by:  Rodney W. Johnson, Entropic Speech, Inc. * Checked by: * Revised by: * * Display interactive X window and handle interactions. * */static char *sccs_id = "@(#)p3dinter.c	1.28	11/11/94	ESI/ERL";#include <stdio.h>#include <esps/esps.h>#include <esps/unix.h>#include <esps/epaths.h>#include <xview/xview.h>#include <xview/panel.h>#include <xview/canvas.h>#include <xview/svrimage.h>#include <xview/xv_xrect.h>#include <xview/cms.h>#include <xview/scrollbar.h>#include <xview/font.h>#include <xview/notice.h>#include <xview/cursor.h>#include <xview/svrimage.h>#include <esps/constants.h>#include <esps/exview.h>#include "plot3d.h"#define _NO_PROTO#include <X11/Intrinsic.h>#include <X11/Shell.h>#include <Xp.h>#include <XpMacros.h>extern int              data_loaded;extern char		*ProgName;extern int  		debug_level;extern int              force_monochrome_plot;extern char		*iname;		/* input file name */static Xv_Window	paintwin;static Display		*display;static Window		xwin;static GC		gc;static Xv_Font		font;int			do_color;int			want_box;static int		want_axes, want_cpanel, want_plot;static unsigned long	*xcolors;static int 	color_status();static void	sca_notify();static void	ori_notify();static void	len_notify(),	dep_notify(),	rot_notify();static void	wid_notify(),	hsk_notify(),	bea_notify();static void	hgt_notify(),	vsk_notify(),	ele_notify();static int	plot_notify(),	box_notify(),	axis_notify(),	clea_notify();static int	hcop_notify(),	help_notify(),	quit_notify();static int	file_notify(),  screen_plot_notify(), hardcp_plot_notify();static int	hardcp_setup_notify();static Xv_opaque		plot_item_notify(),		box_item_notify(),		axis_item_notify(),		clea_item_notify();void            no_data_notice(), 		xprinter_error_notice();extern Xv_opaque		load_data_notify(),		load_params_notify(),		enable_waves_cursors(),		disable_waves_cursors(),		save_params_notify();extern void	show_print_window();		extern void	init_file_windows();extern void     init_print_window();extern void	init_readout_bar();static void	init_graphics();static void	repaint_proc();static void	resize();static void	canv_event_proc();void		repaint();void		clear_window();void		do_box(), do_axes();static void	do_plot();void		string_extents();extern void	clear_readouts(), post_readouts();extern void	set_canv_dimens();extern void	set_box_len(),	set_box_wid(),	set_box_hgt();extern int	get_box_len(),	get_box_wid(),	get_box_hgt();extern void	set_hskew(),	set_vskew(),	set_finv();extern double	get_hskew(),	get_vskew(),	get_finv();extern void	set_ori();extern int	get_ori();extern void	set_rot(),	set_bear(),	set_elev();extern double	get_rot(),	get_bear(),	get_elev();extern void	draw_axes();extern void	draw_box();extern void	make_rmat(),	update_rmat();extern void	draw_plot();extern void	draw_testplot();extern void	draw_pointplot();extern void	xyz_vals();Frame		    canvas_frame;static Canvas	    canvas;static Menu	    canv_menu;static Scrollbar    h_scrollbar, v_scrollbar;Frame		    panel_frame=XV_NULL;Panel	            panel;Panel		    print_setup_panel;static Panel_item   sca_slider;static Panel_item   file_button;static Menu	    file_menu;Panel_item	    ori_setting;Panel_item	    len_slider, dep_slider, rot_slider;Panel_item	    wid_slider, hsk_slider, bea_slider;Panel_item	    hgt_slider, vsk_slider, ele_slider;static Panel_item   plot_button, box_button;static Panel_item   axis_button;static Menu	    axis_menu, rec_ax_men_gen(), itm_ax_men_gen();static Menu	    plot_menu;static Xv_opaque    axes_toggle_notify();static Panel_item   clea_button;static Panel_item   hcop_button, help_button, quit_button;Menu_item    	    waves_on, waves_off;int		    xv_not_running=1;extern int	    send_to_waves;static Xv_Cursor    default_cursor, blank_cursor;XFontStruct	    *Xpxfs;	#define HELPFILE_LEN 100static char 	    man_page[HELPFILE_LEN];#define HELPFILE "/plot3d.man"static short cursor_bits[] = {	/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16 	0x0000, 0x03E0, 0x0C18, 0x1004, 0x2006, 0x201A, 0x4021, 0x40C1,	0x4101, 0x4201, 0x4C01, 0x3002, 0x2002, 0x1004, 0x0C18, 0x03E0 */	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,	0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000	};voidgr_init(ac, av)    int	    *ac;    char    **av;{    xv_init(XV_INIT_ARGC_PTR_ARGV, ac, av, 0);}voidset_frame_title(name)    char    *name;{    xv_set(canvas_frame,			XV_LABEL,		    name,			0);}voidinteract(i_axes, i_box, i_cpanel, i_plot)    int		    i_axes, i_box, i_cpanel, i_plot;{    Cms		    cms;    static Xv_singlecolor  ffg = {0x00, 0x00, 0x00};    static Xv_singlecolor  fbg = {0xf0, 0xff, 0xff};#define SPSLIB (char*)build_esps_path("lib")    if ( (strlen(SPSLIB)+strlen(HELPFILE)+1) > HELPFILE_LEN)	(void)strcpy(man_page,(char *)FIND_ESPS_LIB(NULL,"plot3d.man"));    else {        (void)strcpy(man_page,SPSLIB);        (void)strcat(man_page,HELPFILE);    }    want_axes = i_axes;    want_box = i_box;    want_cpanel = i_cpanel;    want_plot = i_plot;    /* This call seems to make the system observe the -Wp xview option       correctly.  Without it, some systems (e.g. Indigo) just ignore -Wp and       -WG! */    (void)xv_find(XV_NULL, FONT,		  FONT_FAMILY, FONT_FAMILY_DEFAULT_FIXEDWIDTH,		  0);    /* Create control panel */        if (i_cpanel) {	/* Create panel frame */		panel_frame = xv_create(XV_NULL, FRAME,				XV_LABEL,    "ESPS 3-D Plot Conrol Panel",				XV_X,		    0,				XV_Y,		    0,				XV_WIDTH,		    929,				XV_HEIGHT,		    212,				FRAME_CLOSED,	 	    FALSE,				FRAME_SHOW_FOOTER,	    FALSE,				0);	(void) exv_attach_icon(panel_frame, P3D_ICON, "plot3d", TRANSPARENT);	/* Create panel. */		panel = xv_create(panel_frame, PANEL,			  XV_X,			    0,			  XV_Y,			    0,			  XV_WIDTH,		    WIN_EXTEND_TO_EDGE,			  XV_HEIGHT,		    WIN_EXTEND_TO_EDGE,			  OPENWIN_SHOW_BORDERS,   FALSE,			  0);		/* Was setting background on control panel.  Violates Open	   Look GUI standard and led to smeared tracks of a different	   color when sliders were moved. */	/*	  if (do_color)	  xv_set(panel,	  WIN_CMS,		    cms,	  WIN_FOREGROUND_COLOR,	    COL_PANEL_FG,	  WIN_BACKGROUND_COLOR,	    COL_PANEL_BG,	  0);	  */		/* Create choice item. */	ori_setting = xv_create(panel, PANEL_CHOICE,				XV_X,			    649,				XV_Y,			    15,				XV_WIDTH,		    170,				XV_HEIGHT,		    21,				PANEL_VALUE_X,		    733,				PANEL_VALUE_Y,		    15,				PANEL_LAYOUT,		    PANEL_HORIZONTAL,				PANEL_CHOICE_STRINGS,				"Left",				"Right",				0,				PANEL_VALUE,		    (get_ori() == ORI_LEFT)				? 0 : 1,				PANEL_LABEL_STRING,	    "orientation",				PANEL_NOTIFY_PROC,	    ori_notify,				0);		/* Create sliders. */		sca_slider = xv_create(panel, PANEL_SLIDER,			       XV_X,			    18,			       XV_Y,			    19,			       XV_WIDTH,		    252,			       XV_HEIGHT,		    15,			       PANEL_VALUE_X,		    62,			       PANEL_VALUE_Y,		    19,			       PANEL_SLIDER_WIDTH,	    100,			       PANEL_LABEL_STRING,	    "scale",			       PANEL_LAYOUT,		    PANEL_HORIZONTAL,			       PANEL_SHOW_RANGE,	    TRUE,			       PANEL_SHOW_VALUE,	    TRUE,			       PANEL_MIN_VALUE,	    0,			       PANEL_MAX_VALUE,	    500,			       PANEL_VALUE,		    100,			       PANEL_NOTIFY_LEVEL,	    PANEL_ALL,			       PANEL_NOTIFY_PROC,	    sca_notify,			       0);		len_slider = xv_create(panel, PANEL_SLIDER,			       XV_X,			    10,			       XV_Y,			    57,			       XV_WIDTH,		    260,			       XV_HEIGHT,		    15,			       PANEL_VALUE_X,		    62,			       PANEL_VALUE_Y,		    57,			       PANEL_SLIDER_WIDTH,	    100,			       PANEL_LABEL_STRING,	    "length",			       PANEL_LAYOUT,		    PANEL_HORIZONTAL,			       PANEL_SHOW_RANGE,	    TRUE,			       PANEL_SHOW_VALUE,	    TRUE,			       PANEL_MIN_VALUE,	    0,			       PANEL_MAX_VALUE,	    500,			       PANEL_VALUE,		    get_box_len(),			       PANEL_NOTIFY_LEVEL,	    PANEL_ALL,			       PANEL_NOTIFY_PROC,	    len_notify,			       0);		dep_slider = xv_create(panel, PANEL_SLIDER,			       XV_X,			    328,			       XV_Y,			    57,			       XV_WIDTH,		    255,			       XV_HEIGHT,		    15,			       PANEL_VALUE_X,		    375,			       PANEL_VALUE_Y,		    57,			       PANEL_SLIDER_WIDTH,	    100,			       PANEL_LABEL_STRING,	    "depth",			       PANEL_LAYOUT,		    PANEL_HORIZONTAL,			       PANEL_SHOW_RANGE,	    TRUE,			       PANEL_SHOW_VALUE,	    TRUE,			       PANEL_MIN_VALUE,	    0,			       PANEL_MAX_VALUE,	    500,			       PANEL_VALUE,		    ROUND(get_finv()),			       PANEL_NOTIFY_LEVEL,	    PANEL_ALL,			       PANEL_NOTIFY_PROC,	    dep_notify,			       0);		rot_slider = xv_create(panel, PANEL_SLIDER,			       XV_X,			    631,			       XV_Y,			    57,			       XV_WIDTH,		    282,			       XV_HEIGHT,		    15,			       PANEL_VALUE_X,		    693,			       PANEL_VALUE_Y,		    57,			       PANEL_SLIDER_WIDTH,	    96,			       PANEL_LABEL_STRING,	    "rotation",			       PANEL_LAYOUT,		    PANEL_HORIZONTAL,			       PANEL_SHOW_RANGE,	    TRUE,			       PANEL_SHOW_VALUE,	    TRUE,			       PANEL_MIN_VALUE,	    -180,			       PANEL_MAX_VALUE,	    180,			       PANEL_VALUE,		    ROUND(180.0/PI*get_rot()),			       PANEL_NOTIFY_LEVEL,	    PANEL_ALL,			       PANEL_NOTIFY_PROC,	    rot_notify,			       0);		wid_slider = xv_create(panel, PANEL_SLIDER,			       XV_X,			    16,			       XV_Y,			    95,			       XV_WIDTH,		    254,			       XV_HEIGHT,		    15,			       PANEL_VALUE_X,		    62,			       PANEL_VALUE_Y,		    95,			       PANEL_SLIDER_WIDTH,	    100,			       PANEL_LABEL_STRING,	    "width",			       PANEL_LAYOUT,		    PANEL_HORIZONTAL,			       PANEL_SHOW_RANGE,	    TRUE,			       PANEL_SHOW_VALUE,	    TRUE,			       PANEL_MIN_VALUE,	    0,			       PANEL_MAX_VALUE,	    500,			       PANEL_VALUE,		    get_box_wid(),			       PANEL_NOTIFY_LEVEL,	    PANEL_ALL,			       PANEL_NOTIFY_PROC,	    wid_notify,			       0);		hsk_slider = xv_create(panel, PANEL_SLIDER,			       XV_X,			    307,			       XV_Y,			    95,			       XV_WIDTH,		    284,			       XV_HEIGHT,		    15,			       PANEL_VALUE_X,		    367,			       PANEL_VALUE_Y,		    95,			       PANEL_SLIDER_WIDTH,	    100,			       PANEL_LABEL_STRING,	    "H. skew",			       PANEL_LAYOUT,		    PANEL_HORIZONTAL,			       PANEL_SHOW_RANGE,	    TRUE,			       PANEL_SHOW_VALUE,	    TRUE,			       PANEL_MIN_VALUE,	    -200,			       PANEL_MAX_VALUE,	    200,			       PANEL_VALUE,		    ROUND(100.0*get_hskew()),			       PANEL_NOTIFY_LEVEL,	    PANEL_ALL,			       PANEL_NOTIFY_PROC,	    hsk_notify,			       0);		bea_slider = xv_create(panel, PANEL_SLIDER,			       XV_X,			    632,			       XV_Y,			    95,			       XV_WIDTH,		    281,			       XV_HEIGHT,		    15,			       PANEL_VALUE_X,		    693,			       PANEL_VALUE_Y,		    95,			       PANEL_SLIDER_WIDTH,	    96,			       PANEL_LABEL_STRING,	    "bearing",			       PANEL_LAYOUT,		    PANEL_HORIZONTAL,			       PANEL_SHOW_RANGE,	    TRUE,			       PANEL_SHOW_VALUE,	    TRUE,			       PANEL_MIN_VALUE,	    -180,			       PANEL_MAX_VALUE,	    180,			       PANEL_VALUE,		    ROUND(180.0/PI*get_bear()),			       PANEL_NOTIFY_LEVEL,	    PANEL_ALL,			       PANEL_NOTIFY_PROC,	    bea_notify,			       0);		hgt_slider = xv_create(panel, PANEL_SLIDER,			       XV_X,			    10,			       XV_Y,			    133,			       XV_WIDTH,		    260,			       XV_HEIGHT,		    15,			       PANEL_VALUE_X,		    62,			       PANEL_VALUE_Y,		    133,			       PANEL_SLIDER_WIDTH,	    100,			       PANEL_LABEL_STRING,	    "height",			       PANEL_LAYOUT,		    PANEL_HORIZONTAL,			       PANEL_SHOW_RANGE,	    TRUE,			       PANEL_SHOW_VALUE,	    TRUE,			       PANEL_MIN_VALUE,	    0,			       PANEL_MAX_VALUE,	    500,			       PANEL_VALUE,		    get_box_hgt(),			       PANEL_NOTIFY_LEVEL,	    PANEL_ALL,			       PANEL_NOTIFY_PROC,	    hgt_notify,			       0);		vsk_slider = xv_create(panel, PANEL_SLIDER,			       XV_X,			    308,			       XV_Y,			    133,			       XV_WIDTH,		    283,			       XV_HEIGHT,		    15,			       PANEL_VALUE_X,		    367,			       PANEL_VALUE_Y,		    133,			       PANEL_SLIDER_WIDTH,	    100,			       PANEL_LABEL_STRING,	    "V. skew",			       PANEL_LAYOUT,		    PANEL_HORIZONTAL,			       PANEL_SHOW_RANGE,	    TRUE,			       PANEL_SHOW_VALUE,	    TRUE,			       PANEL_MIN_VALUE,	    -200,			       PANEL_MAX_VALUE,	    200,			       PANEL_VALUE,		    ROUND(100.0*get_vskew()),			       PANEL_NOTIFY_LEVEL,	    PANEL_ALL,			       PANEL_NOTIFY_PROC,	    vsk_notify,			       0);		ele_slider = xv_create(panel, PANEL_SLIDER,			       XV_X,			    629,			       XV_Y,			    133,			       XV_WIDTH,		    276,			       XV_HEIGHT,		    15,			       PANEL_VALUE_X,		    701,			       PANEL_VALUE_Y,		    133,			       PANEL_SLIDER_WIDTH,	    96,			       PANEL_LABEL_STRING,	    "elevation",			       PANEL_LAYOUT,		    PANEL_HORIZONTAL,			       PANEL_SHOW_RANGE,	    TRUE,			       PANEL_SHOW_VALUE,	    TRUE,			       PANEL_MIN_VALUE,	    -90,			       PANEL_MAX_VALUE,	    90,			       PANEL_VALUE,		    ROUND(180.0/PI*get_elev()),			       PANEL_NOTIFY_LEVEL,	    PANEL_ALL,			       PANEL_NOTIFY_PROC,	    ele_notify,			       0);		/* Create button menus and associated windows. */		file_menu = xv_create(XV_NULL, MENU_COMMAND_MENU,			      MENU_ITEM,			      MENU_STRING,		"load data",			      MENU_NOTIFY_PROC,		load_data_notify,			      0,			      MENU_ITEM,			      MENU_STRING,		"load params",			      MENU_NOTIFY_PROC,		load_params_notify,			      0,			      MENU_ITEM,			      MENU_STRING,		"save params",			      MENU_NOTIFY_PROC,		save_params_notify,			      0,			      MENU_DEFAULT,		    1,			      MENU_GEN_PIN_WINDOW,	    panel_frame,			      "",			      0);		/*!*//* Postpone creating windows until first needed? */	init_file_windows(cms);	plot_menu = xv_create(XV_NULL, MENU_COMMAND_MENU,			      MENU_ITEM,			      MENU_STRING,		"screen",			      MENU_NOTIFY_PROC,		screen_plot_notify,			      0,			      MENU_ITEM,			      MENU_STRING,		"print setup",			      MENU_NOTIFY_PROC,	        hardcp_setup_notify,			      0,			      MENU_ITEM,			      MENU_STRING,		"print graphic",			      MENU_NOTIFY_PROC,	        hardcp_plot_notify,			      0,			      0);	init_print_window(cms);		axis_menu = xv_create(XV_NULL, MENU_COMMAND_MENU,			      MENU_ITEM,			      MENU_STRING,		"on/off",			      MENU_NOTIFY_PROC,		axes_toggle_notify,			      0,			      MENU_ITEM,			      MENU_STRING,		"record labeling",			      MENU_GEN_PULLRIGHT,		rec_ax_men_gen,			      0,			      MENU_ITEM,			      MENU_STRING,		"item labeling",			      MENU_GEN_PULLRIGHT,		itm_ax_men_gen,			      0,			      0);		waves_on = (Menu_item) xv_create(XV_NULL, MENUITEM,					 MENU_STRING,		    "enable xwaves cursors",					 MENU_NOTIFY_PROC,	    enable_waves_cursors,					 MENU_RELEASE,					 0);		waves_off = (Menu_item) xv_create(XV_NULL, MENUITEM,					  MENU_STRING,		    "disable xwaves cursors",					  MENU_NOTIFY_PROC,	    disable_waves_cursors,

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?