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

📄 config.c

📁 系统任务管理器
💻 C
📖 第 1 页 / 共 5 页
字号:
			mon->privat->spacer_overlap_off = TRUE;		}	else if (strcmp(s, "set_image_border") == 0)		gkrellmrc_border_list = g_list_append(gkrellmrc_border_list,				g_strdup(arg));	else if (strcmp(s, "set_integer") == 0)		gkrellmrc_integer_list = g_list_append(gkrellmrc_integer_list,				g_strdup(arg));	else if (strcmp(s, "set_string") == 0)		gkrellmrc_string_list = g_list_prepend(gkrellmrc_string_list,				g_strdup(arg));	else		return FALSE;	return TRUE;	}static gbooleanparse_config_line(gchar *line, struct _config *cf, gint size)	{	struct _config	*conf;	gchar			*s, *ss;	gint			i, val, len;	s = line;	while (*s && *s != ' ' && *s != '\t' && *s != '=')		++s;	if (s == line || !*s || *s == '\n')		return FALSE;	for (i = 0; i < size; ++i)		{		conf = cf + i;		len = strlen(conf->option);		if (strncmp(conf->option, line, len) || len != s - line)			continue;		while (*s == ' ' || *s == '\t' || *s == '=')			++s;		if (!*s || *s == '\n')			{			printf(_("Incomplete config line:\n    %s\n"), line);			continue;			}		if (conf->value)			{			if (isdigit(*s) || *s == '-')				val = atoi(s);			else if (!strcmp(s, "on") || !strcmp(s, "true"))				val = 1;			else				val = 0;			if (conf->minimum > -100 && val < conf->minimum)				val = conf->minimum;			*(conf->value) = val;			}		else if (conf->arg)			{			if (*s == '"')				{				++s;				ss = strchr(s, '"');				}			else				{				ss = s;				while (*ss && *ss != ' ' && *ss != '\t' && *ss != '\n')					++ss;				if (*ss == '\0')					ss = NULL;				}			if (ss)				*(conf->arg) = g_strndup(s, ss - s);			else				*(conf->arg) = g_strdup(s);			}		return TRUE;		}	return FALSE;	}static voidparse_gkrellmrc_line(gchar *line)	{	if (!parse_gkrellmrc_keyword(line))		parse_config_line(line, &theme_config[0],					sizeof(theme_config) / sizeof (struct _config));	}static voidclear_style_list(GList *list, GList *name_list)	{	GkrellmStyle	*style;	for ( ; list; list = list->next, name_list = name_list->next)		{		style = (GkrellmStyle *) list->data;		if (style)			memset(style, 0, sizeof(GkrellmStyle));		}	}static gchar	*base_theme[]	=	{	"StyleChart *.border = 0,0,0,0",	"StyleChart *.margins = 0,0,0,0",	"StyleChart *.font = normal_font",	"StyleChart *.alt_font = small_font",	"StyleChart *.textcolor = #efd097 #000000 shadow",	"StyleChart *.alt_textcolor = #c0c0c0 #181818 shadow",	"StylePanel *.border = 0,0,2,1",	"StylePanel *.font = normal_font",	"StylePanel *.alt_font = normal_font",	"StylePanel *.textcolor = white #000000 shadow",	"StylePanel *.alt_textcolor = #d8e0c8 #000000 shadow",	"StylePanel *.label_position = 50",	"StylePanel *.margins = 1,1,2,2",	"StylePanel *.krell_yoff = 0",	"StylePanel *.krell_yoff_not_scalable = false",	"StylePanel *.krell_x_hot = 3",	"StylePanel *.krell_depth = 4",	"StylePanel *.krell_expand = 0",	"StylePanel *.krell_ema_period = 3",	"StyleMeter *.border = 3,3,3,2",	"StyleMeter *.font = normal_font",	"StyleMeter *.alt_font = small_font",	"StyleMeter *.textcolor = #ffeac4 #000000 shadow",	"StyleMeter *.alt_textcolor = wheat #000000 shadow",	"StyleMeter *.label_position = 50",	"StyleMeter *.margins = 2,2,2,2",	"StyleMeter *.krell_yoff = 1",	"StyleMeter *.krell_yoff_not_scalable = false",	"StyleMeter *.krell_expand = 0",	"StyleMeter *.krell_x_hot = -1",	"StyleMeter *.krell_depth = 1",	"StyleMeter *.krell_ema_period = 1",	/* These have an override effect */	"StyleMeter apm.bottom_margin = 2",	"StyleMeter mail.krell_depth = 15",	"StyleMeter mail.krell_yoff = 0",	"StyleMeter mail.krell_x_hot = -1",	"StyleMeter mail.krell_expand = 0",	"StyleMeter mail.label_position = 70",	"StyleChart net.alt_font = small_font",	};static voidgkrellm_init_theme(void)	{	GkrellmMonitor	*mon;	GList			*list;	GkrellmStyle	*style;	gint			i, style_id;	_GK.theme_n_alternatives = 0;	_GK.frame_top_height = 0;		/* use image height. */	_GK.frame_bottom_height = 0;	/* use image height. */	_GK.frame_left_width = 0;	_GK.frame_right_width = 0;	_GK.frame_left_chart_overlap = 0;	_GK.frame_right_chart_overlap = 0;	_GK.frame_left_panel_overlap = 0;	_GK.frame_right_panel_overlap = 0;	_GK.frame_left_spacer_overlap = 0;	_GK.frame_right_spacer_overlap = 0;	_GK.chart_height_min = 5;	_GK.chart_height_max = 200;	_GK.chart_width_ref = 60;	_GK.chart_text_no_fill = FALSE;	_GK.bg_separator_height = 2;	_GK.allow_scaling = FALSE;	_GK.bg_grid_mode = GRID_MODE_NORMAL;	_GK.spacer_top_height_chart = 3;	_GK.spacer_bottom_height_chart = 3;	_GK.spacer_top_height_meter = 3;	_GK.spacer_bottom_height_meter = 3;	_GK.decal_mail_frames = 18;	_GK.decal_mail_delay = 1;	_GK.decal_alarm_frames = 10;	_GK.decal_warn_frames = 10;	_GK.rx_led_x = 3;	_GK.rx_led_y = 6;	_GK.tx_led_x = -3;	_GK.tx_led_y = 6;	gkrellm_dup_string(&_GK.large_font_string,				gkrellm_get_large_font_string());	gkrellm_dup_string(&_GK.normal_font_string,				gkrellm_get_normal_font_string());	gkrellm_dup_string(&_GK.small_font_string,				gkrellm_get_small_font_string());	gkrellm_dup_string(&_GK.chart_in_color, "#10d3d3");	gkrellm_dup_string(&_GK.chart_in_color_grid, "#00a3a3");	gkrellm_dup_string(&_GK.chart_out_color, "#f4ac4a");	gkrellm_dup_string(&_GK.chart_out_color_grid, "#b47c20");	/* Setup the default styles.  Substyles may be set in gkrellmrc.  If	|  they are not, then they will be set to point to the default after	|  parsing the gkrellmrc file.	*/	clear_style_list(_GK.chart_style_list, _GK.chart_name_list);	clear_style_list(_GK.panel_style_list, _GK.chart_name_list);	clear_style_list(_GK.meter_style_list, _GK.meter_name_list);	gkrellm_free_glist_and_data(&_GK.custom_name_list);	gkrellm_free_glist_and_data(&_GK.custom_style_list);	for (i = 0; i < sizeof(base_theme) / sizeof(gchar *); ++i)		parse_gkrellmrc_line(base_theme[i]);	/* Allow themes to transition to using top/bottom margins. */	_GK.use_top_bottom_margins = FALSE;	/* I set some base theme parameters with no override.  The idea is if	|  a theme does not bother to set anything, these will remain in effect,	|  but if the theme sets any "*" settings, they can wipe these out.	|  This is probably a mistake, I am contributing to theme author	|  laziness and should move these to the default theme.	*/	style_id = gkrellm_lookup_meter_style_id(BATTERY_STYLE_NAME);	assign_meter_style(style_id, "3,3,2,2", GKRELLMSTYLE_BORDER, 0);	style_id = gkrellm_lookup_meter_style_id(CAL_STYLE_NAME);	assign_meter_style(style_id,  "small_font", GKRELLMSTYLE_TEXTFONT_A, 0);	assign_meter_style(style_id,  "large_font", GKRELLMSTYLE_TEXTFONT_B, 0);	style_id = gkrellm_lookup_meter_style_id(CLOCK_STYLE_NAME);	assign_meter_style(style_id,"large_font", GKRELLMSTYLE_TEXTFONT_A, 0);	style_id = gkrellm_lookup_meter_style_id(FS_STYLE_NAME);	assign_meter_style(style_id, "0", GKRELLMSTYLE_LABEL_POSITION, 0);	if (_GK.krell_slider_style)		g_free(_GK.krell_slider_style);	_GK.krell_slider_style = gkrellm_style_new0();	style = (GkrellmStyle *) _GK.meter_style_list->data;	*_GK.krell_slider_style = *style;	if (_GK.krell_mini_style)		g_free(_GK.krell_mini_style);	_GK.krell_mini_style = gkrellm_style_new0();	*_GK.krell_mini_style = *style;	gkrellm_dup_string(&frame_top_border, "0,0,0,0");	gkrellm_dup_string(&frame_bottom_border, "0,0,0,0");	gkrellm_dup_string(&frame_left_border, "0,0,0,0");	gkrellm_dup_string(&frame_right_border, "0,0,0,0");	gkrellm_dup_string(&button_panel_border, "2,2,2,2");	gkrellm_dup_string(&button_meter_border, "2,2,2,2");	gkrellm_dup_string(&frame_left_chart_border, "0,0,0,0");	gkrellm_dup_string(&frame_right_chart_border, "0,0,0,0");	gkrellm_dup_string(&frame_left_panel_border, "0,0,0,0");	gkrellm_dup_string(&frame_right_panel_border, "0,0,0,0");	gkrellm_dup_string(&spacer_top_border, "0,0,0,0");	gkrellm_dup_string(&spacer_bottom_border, "0,0,0,0");	krell_slider_x_hot = -1;	krell_slider_depth = 6;	gkrellm_dup_string(&krell_slider_expand, "none");	gkrellm_free_glist_and_data(&gkrellmrc_border_list);	gkrellm_free_glist_and_data(&gkrellmrc_integer_list);	gkrellm_free_glist_and_data(&gkrellmrc_string_list);	for (list = gkrellm_monitor_list; list; list = list->next)		{		mon = (GkrellmMonitor *) list->data;		mon->privat->top_spacer.height = -1;		mon->privat->bottom_spacer.height = -1;		mon->privat->cap_images_off = FALSE;		mon->privat->spacer_overlap_off = FALSE;		}	}static gchar	*default_theme[]	=	{	"frame_left_border = 0,0,42,16",	"frame_right_border = 0,0,42,16",	"StyleChart *.textcolor = #efd097 #000000 shadow",	"StyleChart *.alt_textcolor = #a8e4e2 #000000 shadow",	"StylePanel *.margins = 1,1,2,1",	"StylePanel *.textcolor = white #000000 shadow",	"StylePanel *.alt_textcolor = #60fff0 #000000 shadow",	"StylePanel cpu.margins = 0,0,2,1",	"StyleMeter *.border = 4,4,3,2",	"StyleMeter *.margins = 2,2,2,2",	"StyleMeter *.krell_yoff = 1",	"StyleMeter *.textcolor = #c8e4e2 #000000 shadow",	"StyleMeter *.alt_textcolor = #e8e4d2 #000000 shadow",	"StyleMeter cal.textcolor = #c8e4e2 #000000 shadow",	"StyleMeter clock.textcolor = #e8e4d2 #000000 shadow",	"StyleMeter clock.alt_textcolor = #c8e4e2 #000000 shadow",	"StyleMeter sensors.textcolor = #60fff0 #000000 shadow",	"StyleMeter sensors.alt_textcolor = #c8e4e2 #000000 shadow",	"StyleMeter fs.border = 4,4,3,1",	"StyleMeter fs.bottom_margin = 1",	"StyleMeter fs.label_position = 0",	"StyleMeter fs.alt_font = normal_font",	"StyleMeter fs.alt_textcolor = #c8e4e2 #000000 shadow",	"StyleMeter mem.alt_textcolor = #c8e4e2 #000000 shadow",	"StyleMeter swap.alt_textcolor = #c8e4e2 #000000 shadow",	"StyleMeter host.textcolor = #c8d4d2 #000000 shadow",	"StyleMeter host.top_margin = 1",	"StyleMeter host.bottom_margin = 1",	"StyleMeter mail.alt_textcolor = #ffc0c0 #000000 shadow",	"StyleMeter mem.krell_yoff = 0",	"StyleMeter mem.alt_font = normal_font",	"StyleMeter mem.top_margin = 2",	"StyleMeter mem.bottom_margin = 0",	"StyleMeter swap.top_margin = 2",	"StyleMeter swap.bottom_margin = 1",	"StyleMeter swap.krell_yoff = -2",		/* Bottom justify */	"StyleMeter swap.alt_font = normal_font",	"StyleMeter sensors.alt_textcolor = #d8e0c8 #000000 shadow",	"StyleMeter sensors.top_margin = 3",	"StyleMeter sensors.bottom_margin = 3",	"set_image_border sensors_bg_volt 1,1,1,1",	"StyleMeter timer.textcolor = #e8e4d2 #000000 shadow",	"StyleMeter timer.alt_textcolor = #c8e4e2 #000000 shadow",	"StyleMeter timer.margins = 1,1,1,2",	"set_image_border timer_bg_timer 1,1,2,2",	"StyleMeter uptime.textcolor = #e8e4d2 #000000 shadow",	"StyleMeter uptime.border = 3,3,2,2",	"StyleMeter uptime.bottom_margin = 1",	/* ---- plugins ---- */	"spacer_top_height pmu 3",	"spacer_bottom_height pmu 2",	/* GKrellMMS scroll bar panel */	"spacer_top_height gkrellmms 3",	"spacer_bottom_height gkrellmms 3",	"set_image_border gkrellmms_bg_scroll 3,3,2,2",	"set_integer gkrellmms_scroll_margin 3",	"set_integer gkrellmms_scroll_top_margin 2",	"set_integer gkrellmms_scroll_bottom_margin 1",	/* GKrellMMS control (button) bar panel*/	"StyleMeter gkrellmms.alt_textcolor = black #dcdccc shadow",	"StyleMeter gkrellmms.margins = 2,2,2,0",	"StyleMeter gkrellmms.border = 2,2,4,0",	"StyleMeter gkrellmms.krell_yoff = 0",	"StyleMeter gkrellmms.krell_x_hot = 59",	"StyleMeter gkrellmms.krell_expand = left",	"StyleMeter gkrellmms.krell_left_margin = 3",	"StyleMeter gkrellmms.krell_right_margin = 2",	"set_string gkrellmms_play_button_position \"-27 4 0 0 c\"",	"set_string gkrellmms_prev_button_position \"-25 20 0 0 c\"",	"set_string gkrellmms_stop_button_position \"-13 21 0 0 c\"",	"set_string gkrellmms_next_button_position \"9 20 0 0 c\"",	"set_string gkrellmms_eject_button_position \"17 12 0 0 c\"",	"set_string gkrellmms_led_position \"7 7 c\"",	"set_string gkrellmms_label_position \"-25 7 c\"",	/* Timers panels */	"spacer_top_height timers 3",	"spacer_bottom_height timers 3",	"StyleMeter timers.border = 6,6,2,2",	"StyleMeter timers.font = large_font",	"StyleMeter timers.textcolor = #d8e4d2 #000000 shadow",	"StyleMeter timers.alt_textcolor = #c8e4e2 #000000 shadow",	/* All volume panels */	"spacer_top_height volume 3",	"spacer_bottom_height volume 3",	"StyleMeter volume.label_position = 0",	"StyleMeter volume.border = 26,3,0,0",	"StyleMeter volume.top_margin = 1",	"StyleMeter volume.bottom_margin = 0",	};static gchar	*default_theme_1[]	=	{	"StyleChart *.textcolor #efd097 #000000 shadow",	"StyleChart *.alt_textcolor #e4e4e2 #000000 shadow",	"StylePanel *.textcolor white #000000 shadow",	"StylePanel *.alt_textcolor #f0f080 #000000 shadow",	"StyleMeter *.textcolor = #f2f4d8 #000000 shadow",	"StyleMeter *.alt_textcolor #e8e4b2 #000000 shadow",	"StyleMeter cal.textcolor #f2f4d8 #000000 shadow",	"StyleMeter clock.textcolor #e8e4b2 #000000 shadow",	"StyleMeter clock.alt_textcolor #f2f4d8 #000000 shadow",	"StyleMeter fs.alt_textcolor = #f2f4d8 #000000 shadow",	"StyleMeter host.textcolor #b8c4c2 #000000 shadow",	"StyleMeter mail.alt_textcolor #e0c0c0 #000000 shadow",	"StyleMeter mem.alt_textcolor = #f2f4d8 #000000 shadow",	"StyleMeter swap.alt_textcolor = #f2f4d8 #000000 shadow",	"StyleMeter sensors.textcolor = #f0f08

⌨️ 快捷键说明

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