⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abtool_ui.c

📁 lpc 2400 bps语音编解码程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
 * abtool_ui.c - User interface object initialization functions.
 * This file was generated by `gxv' from `abtool.G'.
 * DO NOT EDIT BY HAND.
 */

#include <stdio.h>
#include <sys/param.h>
#include <sys/types.h>
#include <xview/xview.h>
#include <xview/canvas.h>
#include <xview/panel.h>
#include <xview/scrollbar.h>
#include <xview/svrimage.h>
#include <xview/termsw.h>
#include <xview/text.h>
#include <xview/tty.h>
#include <xview/xv_xrect.h>
#include <xview/dragdrop.h>
#include <xview/cursor.h>
#include <gdd.h>
#include <gcm.h>
#include "abtool_ui.h"

/*
 * Create object `file_menu' in the specified instance.
 */
Xv_opaque
abtool_file_menu_create(caddr_t ip, Xv_opaque owner)
{
	Xv_opaque	obj;
	
	obj = xv_create(XV_NULL, MENU_COMMAND_MENU,
		XV_KEY_DATA, INSTANCE, ip,
		MENU_ITEM,
			XV_KEY_DATA, INSTANCE, ip,
			MENU_STRING, "Load SPD",
			NULL,
		MENU_ITEM,
			XV_KEY_DATA, INSTANCE, ip,
			MENU_STRING, "Load Segs",
			NULL,
		MENU_ITEM,
			XV_KEY_DATA, INSTANCE, ip,
			MENU_STRING, "Store Segs",
			NULL,
		MENU_GEN_PIN_WINDOW, owner, "",
		NULL);
	return obj;
}

/*
 * Create object `filenames_menu' in the specified instance.
 */
Xv_opaque
abtool_filenames_menu_create(caddr_t ip, Xv_opaque owner)
{
	extern Menu		ab_filenames(Menu, Menu_generate);
	Xv_opaque	obj;
	
	obj = xv_create(XV_NULL, MENU_COMMAND_MENU,
		XV_KEY_DATA, INSTANCE, ip,
		MENU_GEN_PROC, ab_filenames,
		MENU_ITEM,
			XV_KEY_DATA, INSTANCE, ip,
			MENU_STRING, "Play",
			NULL,
		MENU_ITEM,
			XV_KEY_DATA, INSTANCE, ip,
			MENU_STRING, "Close",
			NULL,
		MENU_ITEM,
			XV_KEY_DATA, INSTANCE, ip,
			MENU_STRING, "Graph",
			NULL,
		MENU_ITEM,
			XV_KEY_DATA, INSTANCE, ip,
			MENU_STRING, "Segment",
			NULL,
		NULL);
	return obj;
}

/*
 * Initialize an instance of object `win'.
 */
abtool_win_objects *
abtool_win_objects_initialize(abtool_win_objects *ip, Xv_opaque owner)
{
	if (!ip && !(ip = (abtool_win_objects *) calloc(1, sizeof (abtool_win_objects))))
		return (abtool_win_objects *) NULL;
	if (!ip->win)
		ip->win = abtool_win_win_create(ip, owner);
	if (!ip->controls1)
		ip->controls1 = abtool_win_controls1_create(ip, ip->win);
	if (!ip->file_button)
		ip->file_button = abtool_win_file_button_create(ip, ip->controls1);
	if (!ip->audio_button)
		ip->audio_button = abtool_win_audio_button_create(ip, ip->controls1);
	if (!ip->props_button)
		ip->props_button = abtool_win_props_button_create(ip, ip->controls1);
	if (!ip->drop_target1)
		ip->drop_target1 = abtool_win_drop_target1_create(ip, ip->controls1);
	if (!ip->quit_button)
		ip->quit_button = abtool_win_quit_button_create(ip, ip->controls1);
	if (!ip->play_button)
		ip->play_button = abtool_win_play_button_create(ip, ip->controls1);
	if (!ip->list1)
		ip->list1 = abtool_win_list1_create(ip, ip->controls1);
	if (!ip->ab_text)
		ip->ab_text = abtool_win_ab_text_create(ip, ip->controls1);
	if (!ip->seg_text)
		ip->seg_text = abtool_win_seg_text_create(ip, ip->controls1);
	if (!ip->message1)
		ip->message1 = abtool_win_message1_create(ip, ip->controls1);
	if (!ip->nsegs_text)
		ip->nsegs_text = abtool_win_nsegs_text_create(ip, ip->controls1);
	if (!ip->canvas1)
		ip->canvas1 = abtool_win_canvas1_create(ip, ip->win);
	return ip;
}

/*
 * Create object `win' in the specified instance.
 */
Xv_opaque
abtool_win_win_create(abtool_win_objects *ip, Xv_opaque owner)
{
	Xv_opaque	obj;
	
	obj = xv_create(owner, FRAME,
		XV_KEY_DATA, INSTANCE, ip,
		XV_WIDTH, 517,
		XV_HEIGHT, 256,
		XV_LABEL, "A/B Tool",
		FRAME_SHOW_FOOTER, TRUE,
		FRAME_SHOW_RESIZE_CORNER, FALSE,
		NULL);
	return obj;
}

/*
 * Create object `controls1' in the specified instance.
 */
Xv_opaque
abtool_win_controls1_create(abtool_win_objects *ip, Xv_opaque owner)
{
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 0,
		XV_Y, 0,
		XV_WIDTH, WIN_EXTEND_TO_EDGE,
		XV_HEIGHT, 132,
		WIN_BORDER, FALSE,
		NULL);
	return obj;
}

/*
 * Create object `file_button' in the specified instance.
 */
Xv_opaque
abtool_win_file_button_create(abtool_win_objects *ip, Xv_opaque owner)
{
	extern Xv_opaque	abtool_file_menu_create(caddr_t, Xv_opaque);
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_BUTTON,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 8,
		XV_Y, 8,
		PANEL_LABEL_STRING, "File",
		PANEL_ITEM_MENU, abtool_file_menu_create((caddr_t) ip, ip->win),
		NULL);
	return obj;
}

/*
 * Create object `audio_button' in the specified instance.
 */
Xv_opaque
abtool_win_audio_button_create(abtool_win_objects *ip, Xv_opaque owner)
{
	extern void		ab_audio(Panel_item, Event *);
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_BUTTON,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 68,
		XV_Y, 8,
		PANEL_LABEL_STRING, "Audio...",
		PANEL_NOTIFY_PROC, ab_audio,
		NULL);
	return obj;
}

/*
 * Create object `props_button' in the specified instance.
 */
Xv_opaque
abtool_win_props_button_create(abtool_win_objects *ip, Xv_opaque owner)
{
	extern void		abtool_win_props_button_notify_callback(Panel_item, Event *);
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_BUTTON,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 136,
		XV_Y, 8,
		PANEL_LABEL_STRING, "Properties...",
		PANEL_NOTIFY_PROC, abtool_win_props_button_notify_callback,
		NULL);
	return obj;
}

/*
 * Create object `drop_target1' in the specified instance.
 */
Xv_opaque
abtool_win_drop_target1_create(abtool_win_objects *ip, Xv_opaque owner)
{
	extern void	canvas_drop_function(Xv_opaque, Event *, GDD_DROP_INFO *);
	extern void	ab_drag_function(Xv_opaque, Event *, GDD_DROP_INFO *, int);
	Xv_opaque	obj;
	Drag_drop	dnd;
	Selection_item	sel_item;
	
	obj = xv_create(owner, PANEL_DROP_TARGET,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 360,
		XV_Y, 8,
		NULL);
	
	dnd = xv_create(owner, DRAGDROP,
		NULL);
		
	sel_item = xv_create(dnd, SELECTION_ITEM, NULL);
	
	xv_set(obj,
		PANEL_NOTIFY_PROC, gdd_drop_target_notify_proc,
		PANEL_DROP_DND, dnd,
		XV_KEY_DATA, SELECTION_ITEM, sel_item,
		NULL);
		
	gdd_register_drop_target(obj, canvas_drop_function, ab_drag_function);
	return obj;
}

/*
 * Create object `quit_button' in the specified instance.
 */
Xv_opaque
abtool_win_quit_button_create(abtool_win_objects *ip, Xv_opaque owner)
{
	extern void		ab_quit(Panel_item, Event *);
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_BUTTON,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 388,
		XV_Y, 8,
		PANEL_LABEL_STRING, "Quit",
		PANEL_NOTIFY_PROC, ab_quit,
		NULL);
	return obj;
}

/*
 * Create object `play_button' in the specified instance.
 */
Xv_opaque
abtool_win_play_button_create(abtool_win_objects *ip, Xv_opaque owner)
{
	extern void		ab_play(Panel_item, Event *);
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_BUTTON,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 440,
		XV_Y, 8,
		PANEL_LABEL_STRING, "Play A/B",
		PANEL_NOTIFY_PROC, ab_play,
		NULL);
	return obj;
}

/*
 * Create object `list1' in the specified instance.
 */
Xv_opaque
abtool_win_list1_create(abtool_win_objects *ip, Xv_opaque owner)
{
	extern int		flist(Panel_item, char *, Xv_opaque, Panel_list_op, Event *, int);
	extern Xv_opaque	abtool_filenames_menu_create(caddr_t, Xv_opaque);
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_LIST,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 8,
		XV_Y, 36,
		PANEL_LIST_WIDTH, 365,
		PANEL_LIST_DISPLAY_ROWS, 4,
		PANEL_LAYOUT, PANEL_HORIZONTAL,
		PANEL_READ_ONLY, TRUE,
		PANEL_CHOOSE_ONE, TRUE,
		PANEL_CHOOSE_NONE, TRUE,
		PANEL_ITEM_MENU, abtool_filenames_menu_create((caddr_t) ip, ip->win),
		PANEL_NOTIFY_PROC, flist,
		NULL);
	return obj;
}

/*
 * Create object `ab_text' in the specified instance.
 */
Xv_opaque
abtool_win_ab_text_create(abtool_win_objects *ip, Xv_opaque owner)
{
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_TEXT,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 414,
		XV_Y, 36,
		PANEL_VALUE_DISPLAY_LENGTH, 8,
		PANEL_VALUE_STORED_LENGTH, 8,
		PANEL_LABEL_STRING, "AB:",
		PANEL_LAYOUT, PANEL_HORIZONTAL,
		PANEL_READ_ONLY, FALSE,
		NULL);
	return obj;
}

/*
 * Create object `seg_text' in the specified instance.
 */
Xv_opaque
abtool_win_seg_text_create(abtool_win_objects *ip, Xv_opaque owner)
{
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_TEXT,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 408,
		XV_Y, 57,
		PANEL_VALUE_DISPLAY_LENGTH, 8,
		PANEL_VALUE_STORED_LENGTH, 8,
		PANEL_LABEL_STRING, "Seg:",
		PANEL_LAYOUT, PANEL_HORIZONTAL,
		PANEL_READ_ONLY, FALSE,
		NULL);
	return obj;
}

/*
 * Create object `message1' in the specified instance.
 */
Xv_opaque
abtool_win_message1_create(abtool_win_objects *ip, Xv_opaque owner)
{
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_MESSAGE,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 400,
		XV_Y, 78,
		PANEL_LABEL_STRING, "Segs:",
		PANEL_LABEL_BOLD, TRUE,
		NULL);
	return obj;
}

/*
 * Create object `nsegs_text' in the specified instance.
 */
Xv_opaque
abtool_win_nsegs_text_create(abtool_win_objects *ip, Xv_opaque owner)
{
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_MESSAGE,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 444,
		XV_Y, 78,
		PANEL_LABEL_STRING, "0",
		PANEL_LABEL_BOLD, FALSE,
		NULL);
	return obj;
}

/*
 * Create object `canvas1' in the specified instance.
 */
Xv_opaque
abtool_win_canvas1_create(abtool_win_objects *ip, Xv_opaque owner)
{
	extern Notify_value	abtool_win_canvas1_event_callback(Xv_window, Event *, Notify_arg, Notify_event_type);
	extern void	ab_canvas_repaint(Canvas, Xv_window, Display *, Window, Xv_xrectlist *);
	extern void	canvas_drop_function(Xv_opaque, Event *, GDD_DROP_INFO *);
	Xv_opaque	obj;
	Xv_drop_site	drop_site;
	Rect		rectlist[2];
	
	obj = xv_create(owner, CANVAS,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 0,
		XV_Y, (int)xv_get(ip->controls1, XV_Y) +
		      (int)xv_get(ip->controls1, XV_HEIGHT),
		XV_WIDTH, WIN_EXTEND_TO_EDGE,
		XV_HEIGHT, WIN_EXTEND_TO_EDGE,
		CANVAS_REPAINT_PROC, ab_canvas_repaint,
		CANVAS_X_PAINT_WINDOW, TRUE,
		NULL);
	xv_create(obj, SCROLLBAR, SCROLLBAR_DIRECTION, SCROLLBAR_HORIZONTAL, NULL);
	gcm_initialize_colors(obj, "BG1", "Foreground");
	xv_set(canvas_paint_window(obj), WIN_CONSUME_EVENTS,
		WIN_ASCII_EVENTS,
		WIN_LEFT_KEYS,
		WIN_RIGHT_KEYS,
		WIN_TOP_KEYS,
		NULL, NULL);
	notify_interpose_event_func(canvas_paint_window(obj),
		(Notify_func) abtool_win_canvas1_event_callback, NOTIFY_SAFE);
	notify_interpose_event_func(canvas_paint_window(obj),
		(Notify_func) gdd_load_event_proc, NOTIFY_SAFE);
	notify_interpose_event_func(canvas_paint_window(obj),
		(Notify_func) gdd_load_event_proc, NOTIFY_IMMEDIATE);
	/*
	 * This line is here for backwards compatibility. It will be
	 * removed for the next release.
	 */
	xv_set(canvas_paint_window(obj), XV_KEY_DATA, INSTANCE, ip, NULL);
	
	drop_site = xv_create(canvas_paint_window(obj), DROP_SITE_ITEM,
		DROP_SITE_ID, 1,
		DROP_SITE_EVENT_MASK, DND_ENTERLEAVE | DND_MOTION,
		NULL);
		
	xv_set(canvas_paint_window(obj),
		XV_KEY_DATA, DROP_SITE_ITEM, drop_site,
		NULL);
	
	rectlist[0] = *(Rect *) xv_get(obj, XV_RECT);
	rectlist[0].r_left = 0;
	rectlist[0].r_top = 0;
	rectlist[1].r_width = 0;
	rectlist[1].r_height = 0;
	gdd_register_drop_site(drop_site, canvas_drop_function);
	gdd_activate_drop_site(drop_site, rectlist);
	return obj;
}

/*
 * Initialize an instance of object `pwin'.
 */
abtool_pwin_objects *
abtool_pwin_objects_initialize(abtool_pwin_objects *ip, Xv_opaque owner)
{
	if (!ip && !(ip = (abtool_pwin_objects *) calloc(1, sizeof (abtool_pwin_objects))))
		return (abtool_pwin_objects *) NULL;
	if (!ip->pwin)
		ip->pwin = abtool_pwin_pwin_create(ip, owner);
	if (!ip->controls3)
		ip->controls3 = abtool_pwin_controls3_create(ip, ip->pwin);
	if (!ip->graph)
		ip->graph = abtool_pwin_graph_create(ip, ip->controls3);
	if (!ip->time)
		ip->time = abtool_pwin_time_create(ip, ip->controls3);
	if (!ip->autoscale)
		ip->autoscale = abtool_pwin_autoscale_create(ip, ip->controls3);
	if (!ip->fname)
		ip->fname = abtool_pwin_fname_create(ip, ip->controls3);
	if (!ip->gain)
		ip->gain = abtool_pwin_gain_create(ip, ip->controls3);
	if (!ip->ref_h)
		ip->ref_h = abtool_pwin_ref_h_create(ip, ip->controls3);
	if (!ip->ref)
		ip->ref = abtool_pwin_ref_create(ip, ip->controls3);
	if (!ip->file_h)
		ip->file_h = abtool_pwin_file_h_create(ip, ip->controls3);
	if (!ip->file)
		ip->file = abtool_pwin_file_create(ip, ip->controls3);
	if (!ip->delay)
		ip->delay = abtool_pwin_delay_create(ip, ip->controls3);
	if (!ip->corr_h)
		ip->corr_h = abtool_pwin_corr_h_create(ip, ip->controls3);
	if (!ip->corr)
		ip->corr = abtool_pwin_corr_create(ip, ip->controls3);
	if (!ip->maxdelay)
		ip->maxdelay = abtool_pwin_maxdelay_create(ip, ip->controls3);
	if (!ip->thresh)
		ip->thresh = abtool_pwin_thresh_create(ip, ip->controls3);
	if (!ip->gap)
		ip->gap = abtool_pwin_gap_create(ip, ip->controls3);
	if (!ip->pad)
		ip->pad = abtool_pwin_pad_create(ip, ip->controls3);
	if (!ip->audio_io)
		ip->audio_io = abtool_pwin_audio_io_create(ip, ip->controls3);
	if (!ip->audio_hold)
		ip->audio_hold = abtool_pwin_audio_hold_create(ip, ip->controls3);

⌨️ 快捷键说明

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