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

📄 rcfile.c

📁 Gqview,Linux下基于GTK+库写成的轻量级而能丰富的图像浏览程序。
💻 C
📖 第 1 页 / 共 2 页
字号:
	fprintf(f,"\n##### Window Positions #####\n\n");	write_bool_option(f, "restore_window_positions", save_window_positions);	fprintf(f,"\n");	write_int_option(f, "main_window_x", main_window_x);	write_int_option(f, "main_window_y", main_window_y);	write_int_option(f, "main_window_width", main_window_w);	write_int_option(f, "main_window_height", main_window_h);	write_bool_option(f, "main_window_maximized", main_window_maximized);	write_int_option(f, "float_window_x", float_window_x);	write_int_option(f, "float_window_y", float_window_y);	write_int_option(f, "float_window_width", float_window_w);	write_int_option(f, "float_window_height", float_window_h);	write_int_option(f, "float_window_divider", float_window_divider);	write_int_option(f, "divider_position_h", window_hdivider_pos);	write_int_option(f, "divider_position_v", window_vdivider_pos);	fprintf(f,"######################################################################\n");	fprintf(f,"#                      end of GQview config file                     #\n");	fprintf(f,"######################################################################\n");	fclose(f);	g_free(rc_path);}/* *----------------------------------------------------------------------------- * load configuration (public) *----------------------------------------------------------------------------- */ void load_options(void){	FILE *f;	gchar *rc_path;	gchar *rc_pathl;	gchar s_buf[1024];	gchar *s_buf_ptr;	gchar option[1024];	gchar value[1024];	gchar value_all[1024];	gint c,l,i;	rc_path = g_strconcat(homedir(), "/", GQVIEW_RC_DIR, "/", RC_FILE_NAME, NULL);	rc_pathl = path_from_utf8(rc_path);	f = fopen(rc_pathl,"r");	g_free(rc_pathl);	if (!f)		{		g_free(rc_path);		return;		}	while (fgets(s_buf,1024,f))		{		if (s_buf[0]=='#') continue;		if (s_buf[0]=='\n') continue;		c = 0;		l = strlen(s_buf);		while (s_buf[c] != ':' && c < l) c++;		if (c >= l) continue;		s_buf[c] = '\0';		c++;		while ((s_buf[c] == ' ' || s_buf[c] == 8) && c < l) c++;		s_buf_ptr = s_buf + c;		strncpy(value_all, s_buf_ptr, sizeof(value_all));		while (s_buf[c] != 8 && s_buf[c] != ' ' && s_buf[c] != '\n' && c < l) c++;		s_buf[c] = '\0';		strncpy(option, s_buf, sizeof(option));		strncpy(value, s_buf_ptr, sizeof(value));		/* general options */		layout_style = read_int_option(f, option,			"layout_style", value, layout_style);		layout_order = read_char_option(f, option,			"layout_order", value, layout_order);		layout_view_icons = read_bool_option(f, option,			"layout_view_as_icons", value, layout_view_icons);		layout_view_tree = read_bool_option(f, option,			"layout_view_as_tree", value, layout_view_tree);		show_icon_names = read_bool_option(f, option,			"show_icon_names", value, show_icon_names);		tree_descend_subdirs = read_bool_option(f, option,			"tree_descend_folders", value, tree_descend_subdirs);		lazy_image_sync = read_bool_option(f, option,			"lazy_image_sync", value, lazy_image_sync);		update_on_time_change = read_bool_option(f, option,			"update_on_time_change", value, update_on_time_change);		exif_rotate_enable = read_bool_option(f, option,			"exif_auto_rotate", value, exif_rotate_enable);		startup_path_enable = read_bool_option(f, option,			"enable_startup_path", value, startup_path_enable);		startup_path = read_char_option(f, option,			"startup_path", value_all, startup_path);		if (strcasecmp(option,"zoom_mode") == 0)                        {                        if (strcasecmp(value, "original") == 0) zoom_mode = ZOOM_RESET_ORIGINAL;                        if (strcasecmp(value, "fit") == 0) zoom_mode = ZOOM_RESET_FIT_WINDOW;                        if (strcasecmp(value, "dont_change") == 0) zoom_mode = ZOOM_RESET_NONE;                        }		two_pass_zoom = read_bool_option(f, option,			"two_pass_scaling", value, two_pass_zoom);		zoom_to_fit_expands = read_bool_option(f, option,			"zoom_to_fit_allow_expand", value, zoom_to_fit_expands);		fit_window = read_bool_option(f, option,			"fit_window_to_image", value, fit_window);		limit_window_size = read_bool_option(f, option,			"limit_window_size", value, limit_window_size);		max_window_size = read_int_option(f, option,			"max_window_size", value, max_window_size);		progressive_key_scrolling = read_bool_option(f, option,			"progressive_keyboard_scrolling", value, progressive_key_scrolling);		scroll_reset_method = read_int_option(f, option,			"scroll_reset_method", value, scroll_reset_method);		thumbnails_enabled = read_bool_option(f, option,			"enable_thumbnails", value, thumbnails_enabled);		thumb_max_width = read_int_option(f, option,			"thumbnail_width", value, thumb_max_width);		thumb_max_height = read_int_option(f, option,			"thumbnail_height", value, thumb_max_height);		enable_thumb_caching = read_bool_option(f, option,			"cache_thumbnails", value, enable_thumb_caching);		enable_thumb_dirs = read_bool_option(f, option,			"cache_thumbnails_into_dirs", value, enable_thumb_dirs);		thumbnail_fast = read_bool_option(f, option,			"thumbnail_fast", value, thumbnail_fast);		use_xvpics_thumbnails = read_bool_option(f, option,			"use_xvpics_thumbnails", value, use_xvpics_thumbnails);		thumbnail_spec_standard = read_bool_option(f, option,			"thumbnail_spec_standard", value, thumbnail_spec_standard);		enable_metadata_dirs = read_bool_option(f, option,			"local_metadata", value, enable_metadata_dirs);		file_sort_method = (SortType)read_int_option(f, option,			"sort_method", value, (gint)file_sort_method);		file_sort_ascending = read_bool_option(f, option,			"sort_ascending", value, file_sort_ascending);		file_sort_case_sensitive = read_bool_option(f, option,			"sort_case_sensitive", value, file_sort_case_sensitive);		confirm_delete = read_bool_option(f, option,			"confirm_delete", value, confirm_delete);		enable_delete_key = read_bool_option(f, option,			"enable_delete_key", value, enable_delete_key);		safe_delete_enable = read_bool_option(f, option,			"safe_delete",  value, safe_delete_enable);		safe_delete_path = read_char_option(f, option,			"safe_delete_path", value, safe_delete_path);		safe_delete_size = read_int_option(f, option,			"safe_delete_size", value, safe_delete_size);		tools_float = read_bool_option(f, option,			"tools_float", value, tools_float);		tools_hidden = read_bool_option(f, option,			"tools_hidden", value, tools_hidden);		restore_tool = read_bool_option(f, option,			"restore_tool_state", value, restore_tool);		toolbar_hidden = read_bool_option(f, option,			"toolbar_hidden", value, toolbar_hidden);		mousewheel_scrolls = read_bool_option(f, option,			"mouse_wheel_scrolls", value, mousewheel_scrolls);		enable_in_place_rename = read_bool_option(f, option,			"in_place_rename", value, enable_in_place_rename);		recent_list_max = read_int_option(f, option,			"open_recent_max", value, recent_list_max);		tile_cache_max = read_int_option(f, option,			"image_cache_size_max", value, tile_cache_max);		thumbnail_quality = CLAMP(read_int_option(f, option,			"thumbnail_quality", value, thumbnail_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER);		zoom_quality = CLAMP(read_int_option(f, option,			"zoom_quality", value, zoom_quality), GDK_INTERP_NEAREST, GDK_INTERP_HYPER);		dither_quality = CLAMP(read_int_option(f, option,			"dither_quality", value, dither_quality), GDK_RGB_DITHER_NONE, GDK_RGB_DITHER_MAX);		zoom_increment = read_int_option(f, option,			"zoom_increment", value, zoom_increment);		enable_read_ahead = read_bool_option(f, option,			"enable_read_ahead", value, enable_read_ahead);		place_dialogs_under_mouse = read_bool_option(f, option,			"display_dialogs_under_mouse", value, place_dialogs_under_mouse);		black_window_background = read_bool_option(f, option,			"black_window_background", value, black_window_background);		fullscreen_screen = read_int_option(f, option,			"fullscreen_screen", value, fullscreen_screen);		fullscreen_clean_flip = read_bool_option(f, option,			"fullscreen_clean_flip", value, fullscreen_clean_flip);		fullscreen_disable_saver = read_bool_option(f, option,			"fullscreen_disable_saver", value, fullscreen_disable_saver);		fullscreen_above = read_bool_option(f, option,			"fullscreen_above", value, fullscreen_above);		dupe_custom_threshold = read_int_option(f, option,			"custom_similarity_threshold", value, dupe_custom_threshold);		/* slideshow options */		slideshow_delay = read_int_unit_option(f, option,			"slideshow_delay", value, slideshow_delay, SLIDESHOW_SUBSECOND_PRECISION);		slideshow_random = read_bool_option(f, option,			"slideshow_random", value, slideshow_random);		slideshow_repeat = read_bool_option(f, option,			"slideshow_repeat", value, slideshow_repeat);		/* filtering options */		show_dot_files = read_bool_option(f, option,			"show_dotfiles", value, show_dot_files);		file_filter_disable = read_bool_option(f, option,			"disable_filtering", value, file_filter_disable);		if (strcasecmp(option, "filter_ext") == 0)			{			filter_parse(value_all);			}		/* External Programs */		if (strncasecmp(option, "external_", 9) == 0)			{			i = strtol(option + 9, NULL, 0);			if (i > 0 && i <= GQVIEW_EDITOR_SLOTS)				{				gchar *ptr1, *ptr2;				i--;				c = 0;				l = strlen(value_all);				ptr1 = value_all;				g_free(editor_name[i]);				editor_name[i] = NULL;				g_free(editor_command[i]);				editor_command[i] = NULL;				while (c<l && value_all[c] !='"') c++;				if (ptr1[c] == '"')					{					c++;					ptr2 = ptr1 + c;					while (c<l && value_all[c] !='"') c++;					if (ptr1[c] == '"')						{						ptr1[c] = '\0';						if (ptr1 + c - 1 != ptr2)							editor_name[i] = g_strdup(ptr2);						c++;						while (c<l && value_all[c] !='"') c++;						if (ptr1[c] == '"')							{							c++;							ptr2 = ptr1 + c;							while (value_all[c] != '\0') c++;							while (c > 0 && value_all[c] != '"') c--;							if (ptr1[c] == '"' && ptr1 + c > ptr2)								{								ptr1[c] = '\0';								editor_command[i] = g_strdup(ptr2);								}							}						}					}				}			}		/* colection options */		collection_rectangular_selection = read_bool_option(f, option,			"rectangular_selections", value, collection_rectangular_selection);		/* window positions */		save_window_positions = read_bool_option(f, option,			"restore_window_positions", value, save_window_positions);		main_window_x = read_int_option(f, option,			"main_window_x", value, main_window_x);		main_window_y = read_int_option(f, option,			"main_window_y", value, main_window_y);		main_window_w = read_int_option(f, option,			"main_window_width", value, main_window_w);		main_window_h = read_int_option(f, option,			"main_window_height", value, main_window_h);		main_window_maximized = read_bool_option(f, option,			"main_window_maximized", value, main_window_maximized);		float_window_x = read_int_option(f, option,			"float_window_x", value, float_window_x);		float_window_y = read_int_option(f, option,			"float_window_y", value, float_window_y);		float_window_w = read_int_option(f, option,			"float_window_width", value, float_window_w);		float_window_h = read_int_option(f, option,			"float_window_height", value, float_window_h);		float_window_divider = read_int_option(f, option,			"float_window_divider", value, float_window_divider);		window_hdivider_pos = read_int_option(f, option,			"divider_position_h", value, window_hdivider_pos);		window_vdivider_pos = read_int_option(f, option,			"divider_position_v", value, window_vdivider_pos);		}	fclose(f);	g_free(rc_path);}

⌨️ 快捷键说明

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