GrafX2 2.9.3227
The ultimate 256-color painting program
readini.h File Reference

Reading settings in gfx2.ini. More...

+ This graph shows which files directly or indirectly include this file:

Functions

int Load_INI (T_Config *conf)
 Load config from the gfx2.ini file. More...
 
int Load_INI_seek_pattern (const char *buffer, const char *pattern)
 Search for a substring in a string. More...
 
void Load_INI_clear_string (char *str, byte keep_comments)
 Clean a line of the ini file. More...
 

Detailed Description

Reading settings in gfx2.ini.

Function Documentation

◆ Load_INI()

int Load_INI ( T_Config conf)

Load config from the gfx2.ini file.

Parameters
[out]confthe configuration to read to
Returns
0 when OK
ERROR_INI_CORRUPTED for any error

References T_Config::Adjust_brush_pick, T_Config::Allow_multi_shortcuts, T_Config::Auto_discontinuous, T_Config::Auto_nb_used, T_Config::Auto_save, T_Config::Auto_set_res, T_Components::B, T_Config::Backup, T_Config::Bookmark_directory, T_Config::Bookmark_label, T_Config::Clear_palette, T_Config::Clear_with_stencil, Config_directory, Convert_videomode_arg(), T_Config::Coords_rel, T_Config::Cursor, Data_directory, DEFAULT_FONT_FILENAME, T_Config::Default_mode_layers, T_Config::Default_resolution, DEFAULT_SKIN_FILENAME, Default_window_height, Default_window_width, T_Config::Delay_left_click_on_slider, T_Config::Delay_right_click_on_slider, T_Config::Display_image_limits, T_Config::Double_click_speed, T_Config::Double_key_speed, ERROR_INI_CORRUPTED, ERROR_INI_MISSING, T_Config::Fast_zoom, T_Config::Fav_menu_colors, Filepath_append_to_dir(), T_Config::Find_file_fast, T_Config::Font_file, T_Config::FX_Feedback, T_Components::G, GFX2_DEBUG, GFX2_ERROR, GFX2_Log(), GFX2_malloc, GFX2_MOD_ALT, GFX2_MOD_CTRL, T_Video_mode::Height, INI_FILENAME, INIDEF_FILENAME, Line_number_in_INI_file, Load_INI_get_string(), Load_INI_get_values(), Load_INI_reach_group(), T_Config::Max_undo_pages, T_Config::Maximize_preview, Menu_bars, MENUBAR_ANIMATION, MENUBAR_LAYERS, MENUBAR_TOOLS, mode, T_Config::MOTO_gamma, T_Config::Mouse_merge_movement, T_Config::Mouse_motion_debounce, T_Config::Mouse_sensitivity_index_x, T_Config::Mouse_sensitivity_index_y, NB_BOOKMARKS, T_Config::Nb_max_vertices_per_polygon, NULL, T_Config::Opening_message, T_Config::Palette_cells_X, T_Config::Palette_cells_Y, T_Config::Palette_vertical, PIXEL_DOUBLE, PIXEL_QUAD, Pixel_ratio, PIXEL_SIMPLE, PIXEL_TALL, PIXEL_TALL2, PIXEL_TALL3, PIXEL_TRIPLE, PIXEL_WIDE, PIXEL_WIDE2, T_Components::R, T_Config::Ratio, Realpath(), T_Config::Right_click_colorpick, T_Config::Safety_colors, T_Config::Screen_size_in_GIF, T_Config::Scripts_directory, SCRIPTS_SUBDIRECTORY, T_Config::Separate_colors, T_Config::Set_resolution_according_to, T_Config::Show_hidden_directories, T_Config::Show_hidden_files, T_Config::Skin_file, T_Config::Stylus_mode, T_Config::Swap_buttons, T_Config::Sync_views, T_Config::Tilemap_allow_flipped_x, T_Config::Tilemap_allow_flipped_y, T_Config::Tilemap_show_count, T_Config::Timer_delay, T_Config::Use_virtual_keyboard, Video_mode, T_Menu_Bar::Visible, T_Video_mode::Width, T_Config::Window_pos_x, and T_Config::Window_pos_y.

Referenced by Init_program(), and Settings_load_config().

◆ Load_INI_seek_pattern()

int Load_INI_seek_pattern ( const char *  buffer,
const char *  pattern 
)

Search for a substring in a string.

Parameters
bufferthe string to search into
patternthe string to search for
Returns
0 if the pattern was not found
>0 the position (+1) where the pattern was found

Referenced by Load_INI_get_string(), Load_INI_get_value(), Load_INI_get_values(), Load_INI_reach_group(), Save_INI_reach_group(), Save_INI_set_strings(), and Save_INI_set_values().

◆ Load_INI_clear_string()

void Load_INI_clear_string ( char *  str,
byte  keep_comments 
)

Clean a line of the ini file.

  • Suppress all leading and trailing spaces
  • convert the key to uppercase

Comments start with ";". The result will be in the following format : KEY=value

Parameters
[in,out]str
[in]keep_commentsif set, the comments are kept

Referenced by Load_INI_get_string(), Load_INI_get_values(), Load_INI_reach_group(), Save_INI_reach_group(), Save_INI_set_strings(), and Save_INI_set_values().