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

📄 main.c

📁 xmms-1.2.10.tar.gz学习使用的就下吧
💻 C
📖 第 1 页 / 共 5 页
字号:
		show_widget(mainwin_svis);		vis_clear_data(mainwin_vis);		show_widget(mainwin_srew);		show_widget(mainwin_splay);		show_widget(mainwin_spause);		show_widget(mainwin_sstop);		show_widget(mainwin_sfwd);		show_widget(mainwin_seject);		show_widget(mainwin_stime_min);		show_widget(mainwin_stime_sec);		if (get_input_playing() && playlist_get_current_length() != -1)			show_widget(mainwin_sposition);		mainwin_shade->pb_ny = mainwin_shade->pb_py = 27;	}	else	{		dock_shade(dock_window_list, mainwin, 116 * (cfg.doublesize + 1));		hide_widget(mainwin_svis);		svis_clear_data(mainwin_svis);		hide_widget(mainwin_srew);		hide_widget(mainwin_splay);		hide_widget(mainwin_spause);		hide_widget(mainwin_sstop);		hide_widget(mainwin_sfwd);		hide_widget(mainwin_seject);		hide_widget(mainwin_stime_min);		hide_widget(mainwin_stime_sec);		hide_widget(mainwin_sposition);		mainwin_shade->pb_ny = mainwin_shade->pb_py = 18;	}	draw_main_window(TRUE);}enum{	MAINWIN_VIS_ACTIVE_MAINWIN, MAINWIN_VIS_ACTIVE_PLAYLISTWIN};void mainwin_vis_set_active_vis(gint new_vis){	switch (new_vis)	{		case MAINWIN_VIS_ACTIVE_MAINWIN:			playlistwin_vis_disable();			active_vis = mainwin_vis;			break;		case MAINWIN_VIS_ACTIVE_PLAYLISTWIN:			playlistwin_vis_enable();			active_vis = playlistwin_vis;			break;	}}void mainwin_vis_set_refresh(RefreshRate rate){	cfg.vis_refresh = rate;}void mainwin_vis_set_afalloff(FalloffSpeed speed){	cfg.analyzer_falloff = speed;}void mainwin_vis_set_pfalloff(FalloffSpeed speed){	cfg.peaks_falloff = speed;}void mainwin_vis_set_analyzer_mode(AnalyzerMode mode){	cfg.analyzer_mode = mode;}void mainwin_vis_set_analyzer_type(AnalyzerType mode){	cfg.analyzer_type = mode;}void mainwin_vis_set_type(VisType mode){	char* path = mainwin_vis_menu_entries[MAINWIN_VIS_MENU_VIS_MODE + mode].path;	GtkWidget *widget = gtk_item_factory_get_widget(mainwin_vis_menu, path);	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), TRUE);}static void mainwin_vis_set_type_menu_cb(VisType mode){	cfg.vis_type = mode;	if (mode == VIS_OFF)	{		if (cfg.player_shaded && cfg.player_visible)			svis_clear(mainwin_svis);		else			vis_clear(active_vis);	}	if (mode == VIS_ANALYZER)	{		vis_clear_data(active_vis);		svis_clear_data(mainwin_svis);	}}void mainwin_menubtn_cb(void){	gint x, y;	dock_get_widget_pos(mainwin, &x, &y);	util_item_factory_popup(mainwin_general_menu, x + 6 * (1 + cfg.doublesize),				y + 14 * (1 + cfg.doublesize), 1, GDK_CURRENT_TIME);}void mainwin_minimize_cb(void){	Window xwindow;	if (!mainwin->window)		return;	xwindow = GDK_WINDOW_XWINDOW(mainwin->window);	XIconifyWindow(GDK_DISPLAY(), xwindow, DefaultScreen(GDK_DISPLAY()));}void mainwin_shade_toggle(void){	mainwin_set_shade(!cfg.player_shaded);}void mainwin_quit_cb(void){	input_stop();	gtk_widget_hide(equalizerwin);	gtk_widget_hide(playlistwin);	gtk_widget_hide(mainwin);	gdk_flush();	util_dump_menu_rc();	gtk_timeout_remove(mainwin_timeout_tag);	util_set_cursor(NULL);	save_config();	cleanup_ctrlsocket();	playlist_stop_get_info_thread();	playlist_clear();	cleanup_plugins();	sm_cleanup();	gtk_exit(0);}void mainwin_destroy(GtkWidget * widget, gpointer data){	mainwin_quit_cb();}void draw_mainwin_titlebar(int focus){	if (focus || !cfg.dim_titlebar)		skin_draw_pixmap(mainwin_bg, mainwin_gc, SKIN_TITLEBAR,				 27, 29 * cfg.player_shaded, 0, 0, 275, 14);	else		skin_draw_pixmap(mainwin_bg, mainwin_gc, SKIN_TITLEBAR,				 27, (27 * cfg.player_shaded) + 15, 0, 0, 275, 14);}void draw_main_window(gboolean force){	GdkImage *img, *img2;	GList *wl;	Widget *w;	gboolean redraw;	if (!cfg.player_visible)		return;	lock_widget_list(mainwin_wlist);	if (force)	{		skin_draw_pixmap(mainwin_bg, mainwin_gc, SKIN_MAIN,				 0, 0, 0, 0, 275, cfg.player_shaded ? 14 : 116);		draw_mainwin_titlebar(mainwin_focus);		draw_widget_list(mainwin_wlist, &redraw, TRUE);	}	else		draw_widget_list(mainwin_wlist, &redraw, FALSE);	if (redraw || force)	{		if (force)		{			if (cfg.doublesize)			{				img = gdk_image_get(mainwin_bg, 0, 0, 275, cfg.player_shaded ? 14 : 116);				img2 = create_dblsize_image(img);				gdk_draw_image(mainwin_bg_dblsize, mainwin_gc, img2, 0, 0, 0, 0, 550, cfg.player_shaded ? 28 : 232);				gdk_image_destroy(img2);				gdk_image_destroy(img);			}		}		else		{			wl = mainwin_wlist;			while (wl)			{				w = (Widget *) wl->data;				if (w->redraw && w->visible)				{					if (cfg.doublesize)					{						img = gdk_image_get(mainwin_bg, w->x, w->y, w->width, w->height);						img2 = create_dblsize_image(img);						gdk_draw_image(mainwin_bg_dblsize, mainwin_gc, img2, 0, 0, w->x << 1, w->y << 1, w->width << 1, w->height << 1);						gdk_image_destroy(img2);						gdk_image_destroy(img);						gdk_window_clear_area(mainwin->window, w->x << 1, w->y << 1, w->width << 1, w->height << 1);					}					else						gdk_window_clear_area(mainwin->window, w->x, w->y, w->width, w->height);					w->redraw = FALSE;				}				wl = wl->next;			}		}		if (force)			gdk_window_clear(mainwin->window);		gdk_flush();	}	unlock_widget_list(mainwin_wlist);}void mainwin_set_info_text(void){	gchar *text;	if (mainwin_info_text_locked)		return;	if ((text = input_get_info_text()) != NULL)	{		textbox_set_text(mainwin_info, text);	}	else if ((text = playlist_get_info_text()) != NULL)	{		textbox_set_text(mainwin_info, text);		g_free(text);	}	else	{		text = g_strdup_printf("%s %s", PACKAGE, VERSION);		textbox_set_text(mainwin_info, text);		g_free(text);	}}void mainwin_lock_info_text(gchar * text){	mainwin_info_text_locked = TRUE;	textbox_set_text(mainwin_info, text);}void mainwin_release_info_text(void){	mainwin_info_text_locked = FALSE;	mainwin_set_info_text();}void mainwin_set_song_info(int rate, int freq, int nch){	char *tmp;	bitrate = rate;	frequency = freq;	numchannels = nch;	tmp = playlist_get_info_text();	pthread_mutex_lock(&title_mutex);	g_free(mainwin_title_text);	if (tmp != NULL)	{		mainwin_title_text = g_strdup_printf("XMMS - %s", tmp);		g_free(tmp);	}	else		mainwin_title_text = g_strdup("XMMS");	pthread_mutex_unlock(&title_mutex);}void mainwin_get_song_info(int *rate, int *freq, int *nch){	*rate = bitrate;	*freq = frequency;	*nch = numchannels;}static void mainwin_update_song_info(void){	char text[10];	if (bitrate != -1)	{		int rate = bitrate / 1000;		if (rate < 1000)		{			sprintf(text, "%3d", rate);			textbox_set_text(mainwin_rate_text, text);		}		else		{			rate /= 100;			sprintf(text, "%2dH", rate);			textbox_set_text(mainwin_rate_text, text);		}	}	else		textbox_set_text(mainwin_rate_text, "VBR");	sprintf(text, "%2d", frequency / 1000);	textbox_set_text(mainwin_freq_text, text);	monostereo_set_num_channels(mainwin_monostereo, numchannels);	show_widget(mainwin_minus_num);	show_widget(mainwin_10min_num);	show_widget(mainwin_min_num);	show_widget(mainwin_10sec_num);	show_widget(mainwin_sec_num);	if (!get_input_paused())		playstatus_set_status(mainwin_playstatus, STATUS_PLAY);	if (playlist_get_current_length() != -1)	{		if (cfg.player_shaded)			show_widget(mainwin_sposition);		show_widget(mainwin_position);	}	else	{		hide_widget(mainwin_position);		hide_widget(mainwin_sposition);		mainwin_force_redraw = TRUE;	}}void mainwin_clear_song_info(void){	pthread_mutex_lock(&title_mutex);	g_free(mainwin_title_text);	mainwin_title_text = NULL;	pthread_mutex_unlock(&title_mutex);	bitrate = 0;	frequency = 0;	numchannels = 0;	mainwin_position->hs_pressed = FALSE;	mainwin_sposition->hs_pressed = FALSE;	textbox_set_text(mainwin_rate_text, "   ");	textbox_set_text(mainwin_freq_text, "  ");	monostereo_set_num_channels(mainwin_monostereo, 0);	playstatus_set_status(mainwin_playstatus, STATUS_STOP);	hide_widget(mainwin_minus_num);	hide_widget(mainwin_10min_num);	hide_widget(mainwin_min_num);	hide_widget(mainwin_10sec_num);	hide_widget(mainwin_sec_num);	textbox_set_text(mainwin_stime_min, "   ");	textbox_set_text(mainwin_stime_sec, "  ");

⌨️ 快捷键说明

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