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

📄 config.c

📁 系统任务管理器
💻 C
📖 第 1 页 / 共 5 页
字号:
	for ( ; list; list = list->next, name_list = name_list->next)		destroy_piximage((GkrellmPiximage **) (&list->data));	}static voiddestroy_monitor_specific_piximages(void)	{	GkrellmMonitor	*mon;	GList			*list;	for (list = gkrellm_monitor_list; list; list = list->next)		{		mon = (GkrellmMonitor *) list->data;		destroy_piximage(&mon->privat->top_spacer.piximage);		destroy_piximage(&mon->privat->bottom_spacer.piximage);			}	}voidgkrellm_load_theme_piximages(void)	{	GkrellmMonitor	*mon;	gint			n_base, n_default;	/* Free up all custom images from old theme.	*/	destroy_piximage_list(_GK.bg_chart_piximage_list, _GK.chart_name_list,				"bg_chart");	destroy_piximage_list(_GK.bg_grid_piximage_list, _GK.chart_name_list,				"bg_grid");	destroy_piximage_list(_GK.bg_panel_piximage_list, _GK.chart_name_list,				"bg_panel");	destroy_piximage_list(_GK.bg_meter_piximage_list, _GK.meter_name_list,				"bg_meter");	destroy_piximage_list(_GK.krell_panel_piximage_list, _GK.chart_name_list,				"krell_panel");	destroy_piximage_list(_GK.krell_meter_piximage_list, _GK.meter_name_list,				"krell_meter");	destroy_monitor_specific_piximages();	clean_base_piximage_table();	/* This loads the base images in the top level of the theme directory.	|  For backward compatibility, it also loads monitor specific name	|  qualified images in the top level directory.  The new way is for	|  monitor specific images to be in subdirectories, loaded below.	*/	n_base = sizeof(base_theme_piximages) / sizeof(ImageTable);	load_piximage_table(&base_theme_piximages[0], n_base, NULL);	if (gkrellm_using_default_theme())		{		n_default = sizeof(default_theme_piximages) / sizeof(ImageTable);		load_piximage_table(&default_theme_piximages[0], n_default, NULL);		if (_GK.theme_alternative == 2 || _GK.theme_alternative == 5)			{			n_default =					sizeof(default_theme_alt2_piximages) / sizeof(ImageTable);			load_piximage_table(&default_theme_alt2_piximages[0],					n_default, NULL);			}		else if (_GK.theme_alternative == 1 || _GK.theme_alternative == 4)			{			n_default =					sizeof(default_theme_alt1_piximages) / sizeof(ImageTable);			load_piximage_table(&default_theme_alt1_piximages[0],					n_default, NULL);			}		else			{			n_default =					sizeof(default_theme_alt0_piximages) / sizeof(ImageTable);			load_piximage_table(&default_theme_alt0_piximages[0],					n_default, NULL);			}		if ((mon = gkrellm_monitor_from_style_name("timers")) != NULL)			{			gkrellm_load_piximage(NULL, spacer_top_timers_xpm,						&mon->privat->top_spacer.piximage, NULL);			gkrellm_load_piximage(NULL, spacer_bottom_timers_xpm,						&mon->privat->bottom_spacer.piximage, NULL);			}		if ((mon = gkrellm_monitor_from_style_name("volume")) != NULL)			{			gkrellm_load_piximage(NULL, spacer_top_volume_xpm,						&mon->privat->top_spacer.piximage, NULL);			gkrellm_load_piximage(NULL, spacer_bottom_volume_xpm,						&mon->privat->bottom_spacer.piximage, NULL);			}		if ((mon = gkrellm_monitor_from_style_name("gkrellmms")) != NULL)			{			gkrellm_load_piximage(NULL, spacer_top_gkrellmms_xpm,						&mon->privat->top_spacer.piximage, NULL);			gkrellm_load_piximage(NULL, spacer_bottom_gkrellmms_xpm,						&mon->privat->bottom_spacer.piximage, NULL);			}		if ((mon = gkrellm_monitor_from_style_name("pmu")) != NULL)			{			gkrellm_load_piximage(NULL, spacer_top_pmu_xpm,						&mon->privat->top_spacer.piximage, NULL);			gkrellm_load_piximage(NULL, spacer_bottom_pmu_xpm,						&mon->privat->bottom_spacer.piximage, NULL);			}		if ((mon = gkrellm_monitor_from_style_name(FS_STYLE_NAME)) != NULL)			{			gkrellm_load_piximage(NULL, spacer_top_fs_xpm,						&mon->privat->top_spacer.piximage, NULL);			gkrellm_load_piximage(NULL, spacer_bottom_fs_xpm,						&mon->privat->bottom_spacer.piximage, NULL);			}		}	else		{		load_monitor_specific_piximages();		}	setup_piximages();	}  /* Borders for things that are not primary background parts of a monitor,  |  and so are not set by a style line.  */static gchar			*frame_top_border,			*frame_bottom_border,			*frame_left_border,			*frame_right_border,			*button_panel_border,			*button_meter_border,			*krell_slider_expand,			*frame_left_chart_border,			*frame_right_chart_border,			*frame_left_panel_border,			*frame_right_panel_border,			*spacer_top_border,			*spacer_bottom_border;gint		krell_slider_depth,			krell_slider_x_hot;static struct	_config	{	gchar	*option;	gint	*value;	gchar	**arg;	gint	minimum;	}	theme_config []	=	{	{"author",				NULL,		NULL,			-100 },	{"theme_alternatives",	&_GK.theme_n_alternatives,	NULL,		0  },	{"frame_top_height",	&_GK.frame_top_height,		NULL,		0  },	{"frame_bottom_height",	&_GK.frame_bottom_height,	NULL,		0  },	{"frame_left_width",	&_GK.frame_left_width,		NULL,		0  },	{"frame_right_width",	&_GK.frame_right_width,		NULL,		0  },	{"frame_left_chart_overlap",  &_GK.frame_left_chart_overlap,   NULL, 0  },	{"frame_right_chart_overlap", &_GK.frame_right_chart_overlap,  NULL, 0  },	{"frame_left_panel_overlap",  &_GK.frame_left_panel_overlap,   NULL, 0  },	{"frame_right_panel_overlap", &_GK.frame_right_panel_overlap,  NULL, 0  },	{"frame_left_spacer_overlap",  &_GK.frame_left_spacer_overlap,   NULL, 0 },	{"frame_right_spacer_overlap", &_GK.frame_right_spacer_overlap,  NULL, 0 },	{"chart_width_ref",		&_GK.chart_width_ref,		NULL,		30 },	{"chart_height_min",	&_GK.chart_height_min,		NULL,		2 },	{"chart_height_max",	&_GK.chart_height_max,		NULL,		20 },	{"bg_separator_height", &_GK.bg_separator_height,	NULL,		0  },	{"allow_scaling",		&_GK.allow_scaling,			NULL,		0 },	{"rx_led_x",			&_GK.rx_led_x,				NULL,		-99 },	{"rx_led_y",			&_GK.rx_led_y,				NULL,		0   },	{"tx_led_x",			&_GK.tx_led_x,				NULL,		-99 },	{"tx_led_y",			&_GK.tx_led_y,				NULL,		0   },	/* These two are handled as a service for mail.c because of historical	|  reasons.  They should be set with set_integer in the gkrellmrc.	*/	{"decal_mail_frames",	&_GK.decal_mail_frames,	NULL,			1  },	{"decal_mail_delay",	&_GK.decal_mail_delay,	NULL,			1  },	{"decal_alarm_frames",	&_GK.decal_alarm_frames,	NULL,			1  },	{"decal_warn_frames",	&_GK.decal_warn_frames,	NULL,			1  },	{"chart_in_color",		NULL,		&_GK.chart_in_color,		-100 },	{"chart_in_color_grid",	NULL,		&_GK.chart_in_color_grid,	-100 },	{"chart_out_color",		NULL,		&_GK.chart_out_color,		-100 },	{"chart_out_color_grid",NULL,		&_GK.chart_out_color_grid,	-100 },	{"chart_text_no_fill",	&_GK.chart_text_no_fill,	NULL,			0  },	{"bg_grid_mode",		&_GK.bg_grid_mode,		NULL,			0  },	{"frame_top_border",	NULL,		&frame_top_border,			-100 },	{"frame_bottom_border",	NULL,		&frame_bottom_border,		-100 },	{"frame_left_border",	NULL,		&frame_left_border,			-100 },	{"frame_right_border",	NULL,		&frame_right_border,		-100 },	{"button_panel_border", NULL,		&button_panel_border,		-100 },	{"button_meter_border", NULL,		&button_meter_border,		-100 },	{"frame_left_chart_border", NULL,	&frame_left_chart_border,	-100 },	{"frame_right_chart_border", NULL,	&frame_right_chart_border,	-100 },	{"frame_left_panel_border", NULL,	&frame_left_panel_border,	-100 },	{"frame_right_panel_border", NULL,	&frame_right_panel_border,	-100 },	{"spacer_top_border",	NULL,		&spacer_top_border,			-100 },	{"spacer_bottom_border",	NULL,	&spacer_bottom_border,		-100 },	{"krell_slider_depth",	&krell_slider_depth,	NULL,			1  },	{"krell_slider_x_hot",	&krell_slider_x_hot,	NULL,			-1  },	{"krell_slider_expand",	NULL, 		&krell_slider_expand,		-1  },	};  /* Handle borders set in gkrellmrc which are not set by a style line.  */static voidcleanup_gkrellmrc(void)	{	set_border(&_GK.frame_top_border, frame_top_border);	set_border(&_GK.frame_bottom_border, frame_bottom_border);	set_border(&_GK.frame_left_border, frame_left_border);	set_border(&_GK.frame_right_border, frame_right_border);	set_border(&_GK.frame_left_chart_border, frame_left_chart_border);	set_border(&_GK.frame_right_chart_border, frame_right_chart_border);	set_border(&_GK.frame_left_panel_border, frame_left_panel_border);	set_border(&_GK.frame_right_panel_border, frame_right_panel_border);	set_border(&_GK.spacer_top_border, spacer_top_border);	set_border(&_GK.spacer_bottom_border, spacer_bottom_border);	set_border(&_GK.button_panel_border, button_panel_border);	set_border(&_GK.button_meter_border, button_meter_border);	_GK.krell_slider_style->krell_x_hot  = krell_slider_x_hot;	_GK.krell_slider_style->krell_depth  = krell_slider_depth;	gkrellm_set_krell_expand(_GK.krell_slider_style, krell_slider_expand);	_GK.rx_led_x = _GK.rx_led_x * _GK.theme_scale / 100;	_GK.rx_led_y = _GK.rx_led_y * _GK.theme_scale / 100;	_GK.tx_led_x = _GK.tx_led_x * _GK.theme_scale / 100;	_GK.tx_led_y = _GK.tx_led_y * _GK.theme_scale / 100;	}static GList	*gkrellmrc_border_list,				*gkrellmrc_integer_list,				*gkrellmrc_string_list;static GkrellmBorder	zero_border;gbooleangkrellm_set_gkrellmrc_piximage_border(gchar *image_name,			GkrellmPiximage *image, GkrellmStyle *style)	{	static GkrellmBorder	b;	GList					*list;	gchar					name[64], border_string[32];	gchar					*s, *r;	if (style)		style->border = zero_border;	if (!image || !image_name)		return FALSE;	for (list = gkrellmrc_border_list; list; list = list->next)		{		s = list->data;		if ((r = strchr(s, '=')) != NULL)			*r = ' ';		sscanf(s, "%63s %31s", name, border_string);		if (!strcmp(name, image_name))			{			set_border(&b, border_string);			gkrellm_set_piximage_border(image, &b);			if (style)				style->border = b;			return TRUE;			}		}	return FALSE;	}gbooleangkrellm_get_gkrellmrc_piximage_border(gchar *image_name, GkrellmPiximage *image,				GkrellmBorder *border)	{	GkrellmBorder	b;	GList			*list;	gchar			name[64], border_string[32];	gchar			*s, *r;	if (!image || !image_name)		return FALSE;	for (list = gkrellmrc_border_list; list; list = list->next)		{		s = list->data;		if ((r = strchr(s, '=')) != NULL)			*r = ' ';		sscanf(s, "%63s %31s", name, border_string);		if (!strcmp(name, image_name))			{			set_border(&b, border_string);			gkrellm_set_piximage_border(image, &b);			if (border)				*border = b;			return TRUE;			}		}	return FALSE;	}gbooleangkrellm_get_gkrellmrc_integer(gchar *int_name, gint *result)	{	GList		*list;	gchar		name[64], string[64];	gchar		*s, *r;	gboolean	found = FALSE;	if (!int_name || !result)		return FALSE;	for (list = gkrellmrc_integer_list; list; list = list->next)		{		s = list->data;		if ((r = strchr(s, '=')) != NULL)			*r = ' ';		sscanf(s, "%63s %63s", name, string);		if (!strcmp(name, int_name) && sscanf(string, "%d", result) == 1)			found = TRUE;		}	return found;	}gchar *gkrellm_get_gkrellmrc_string(gchar *string_name)	{	GList	*list;	gchar	name[64], string[CFG_BUFSIZE];	gchar	*s, *r;	if (!string_name)		return NULL;	for (list = gkrellmrc_string_list; list; list = list->next)		{		s = list->data;		if ((r = strchr(s, '=')) != NULL)			*r = ' ';		sscanf(s, "%63s %[^\n]", name, string);		if (!strcmp(name, string_name))			{			if ((s = gkrellm_cut_quoted_string(string, NULL)) != NULL)				return g_strdup(s);			break;			}		}	return NULL;	}static gbooleanparse_monitor_config_keyword(gchar *line)	{	GList			*list;	GkrellmMonitor	*mon;	gchar			*keyword;	gboolean		result = FALSE;	keyword = gkrellm_dup_token(&line, NULL);	if (!*keyword)		{		g_free(keyword);		return FALSE;		}	for (list = gkrellm_monitor_list; list; list = list->next)		{		mon = (GkrellmMonitor *) list->data;		if (!mon->config_keyword || strcmp(mon->config_keyword, keyword))			continue;		while (*line == ' ' || *line == '\t')			++line;		if (*line && mon->load_user_config && mon->privat->enabled)			{			gkrellm_record_state(LOAD_CONFIG, mon);			(*(mon->load_user_config))(line);			gkrellm_record_state(INTERNAL, NULL);			}		result = TRUE;		}	g_free(keyword);	return result;	}static gbooleanparse_gkrellmrc_keyword(gchar *line)	{	GkrellmMonitor	*mon;	gchar			buf[CFG_BUFSIZE];	gchar			*s, *arg;	strncpy(buf, line, CFG_BUFSIZE);	/* strtok() is destructive */	buf[CFG_BUFSIZE - 1] = '\0';	s = strtok(buf, " \t:=\n");	if (!s || *s == '#' || *s == '\n' || *s == '\0')		return FALSE;	arg = strtok(NULL, "\n");	if (strncmp(line, "Style", 5) == 0)	/* StyleChart ... */		assign_gkrellmrc_style(line, s, arg);	else if (   !strncmp(s, "spacer_top_height", 17)			 || !strncmp(s, "spacer_bottom_height", 20)			)		assign_gkrellmrc_spacer(line, s, arg);	else if (!strcmp(s, "cap_images_off"))		{		mon = gkrellm_monitor_from_style_name(arg);		if (mon)			mon->privat->cap_images_off = TRUE;		}	else if (!strcmp(s, "spacer_overlap_off"))		{		mon = gkrellm_monitor_from_style_name(arg);		if (mon)

⌨️ 快捷键说明

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