Switch pref init to ctor.

This commit is contained in:
2026-01-08 06:53:38 -05:00
parent 554db55dc1
commit 17b0807681
3 changed files with 91 additions and 92 deletions
-3
View File
@@ -345,9 +345,6 @@ int main(int argc, char **argv)
} }
} }
// set the default values for the preferences
a_Prefs_init();
// create ~/.flenser if not present // create ~/.flenser if not present
Paths::init(); Paths::init();
+89 -89
View File
@@ -36,98 +36,98 @@ DilloPrefs prefs;
* Sets the default settings. * Sets the default settings.
*/ */
void a_Prefs_init(void) DilloPrefs::DilloPrefs()
{ {
prefs.allow_white_bg = TRUE; allow_white_bg = TRUE;
prefs.white_bg_replacement = 0xe0e0a3; // 0xdcd1ba; white_bg_replacement = 0xe0e0a3; // 0xdcd1ba;
prefs.bg_color = 0xdcd1ba; bg_color = 0xdcd1ba;
prefs.buffered_drawing = 1; buffered_drawing = 1;
prefs.contrast_visited_color = TRUE; contrast_visited_color = TRUE;
prefs.enterpress_forces_submit = FALSE; enterpress_forces_submit = FALSE;
prefs.focus_new_tab = FALSE; focus_new_tab = FALSE;
prefs.font_cursive = (PREFS_FONT_CURSIVE); font_cursive = (PREFS_FONT_CURSIVE);
prefs.font_factor = 1.0; font_factor = 1.0;
prefs.zoom_factor = 1.0; zoom_factor = 1.0;
prefs.font_max_size = 100; font_max_size = 100;
prefs.font_min_size = 6; font_min_size = 6;
prefs.font_fantasy = (PREFS_FONT_FANTASY); font_fantasy = (PREFS_FONT_FANTASY);
prefs.font_monospace = (PREFS_FONT_MONOSPACE); font_monospace = (PREFS_FONT_MONOSPACE);
prefs.font_sans_serif = (PREFS_FONT_SANS_SERIF); font_sans_serif = (PREFS_FONT_SANS_SERIF);
prefs.font_serif = (PREFS_FONT_SERIF); font_serif = (PREFS_FONT_SERIF);
prefs.fullwindow_start = FALSE; fullwindow_start = FALSE;
/* these four constitute the geometry */ /* these four constitute the geometry */
prefs.width = PREFS_GEOMETRY_DEFAULT_WIDTH; width = PREFS_GEOMETRY_DEFAULT_WIDTH;
prefs.height = PREFS_GEOMETRY_DEFAULT_HEIGHT; height = PREFS_GEOMETRY_DEFAULT_HEIGHT;
prefs.xpos = PREFS_GEOMETRY_DEFAULT_XPOS; xpos = PREFS_GEOMETRY_DEFAULT_XPOS;
prefs.ypos = PREFS_GEOMETRY_DEFAULT_YPOS; ypos = PREFS_GEOMETRY_DEFAULT_YPOS;
prefs.home = a_Url_new(PREFS_HOME, NULL); home = a_Url_new(PREFS_HOME, NULL);
prefs.http_max_conns = 6; http_max_conns = 6;
prefs.http_persistent_conns = TRUE; http_persistent_conns = TRUE;
prefs.http_referer = PREFS_HTTP_REFERER; http_referer = PREFS_HTTP_REFERER;
prefs.http_strict_transport_security = TRUE; http_strict_transport_security = TRUE;
prefs.http_force_https = FALSE; http_force_https = FALSE;
prefs.http_user_agent = PREFS_HTTP_USER_AGENT; http_user_agent = PREFS_HTTP_USER_AGENT;
prefs.limit_text_width = FALSE; limit_text_width = FALSE;
prefs.adjust_min_width = TRUE; adjust_min_width = TRUE;
prefs.adjust_table_min_width = TRUE; adjust_table_min_width = TRUE;
prefs.load_images=TRUE; load_images=TRUE;
prefs.load_background_images=FALSE; load_background_images=FALSE;
prefs.load_stylesheets=TRUE; load_stylesheets=TRUE;
prefs.middle_click_drags_page = TRUE; middle_click_drags_page = TRUE;
prefs.middle_click_opens_new_tab = TRUE; middle_click_opens_new_tab = TRUE;
prefs.right_click_closes_tab = TRUE; right_click_closes_tab = TRUE;
prefs.scroll_switches_tabs = TRUE; scroll_switches_tabs = TRUE;
prefs.scroll_switches_tabs_reverse = FALSE; scroll_switches_tabs_reverse = FALSE;
prefs.no_proxy = PREFS_NO_PROXY; no_proxy = PREFS_NO_PROXY;
prefs.panel_size = P_medium; panel_size = P_medium;
prefs.parse_embedded_css=TRUE; parse_embedded_css=TRUE;
prefs.save_dir = PREFS_SAVE_DIR; save_dir = PREFS_SAVE_DIR;
prefs.scroll_step = 100; scroll_step = 100;
prefs.scroll_page_overlap = 50; scroll_page_overlap = 50;
prefs.search_urls.push_back(PREFS_SEARCH_URL); search_urls.push_back(PREFS_SEARCH_URL);
prefs.search_url_idx = 0; search_url_idx = 0;
prefs.scrollbar_on_left = FALSE; scrollbar_on_left = FALSE;
prefs.scrollbar_page_mode = FALSE; scrollbar_page_mode = FALSE;
prefs.show_back = TRUE; show_back = TRUE;
prefs.show_bookmarks = TRUE; show_bookmarks = TRUE;
prefs.show_clear_url = TRUE; show_clear_url = TRUE;
prefs.show_extra_warnings = FALSE; show_extra_warnings = FALSE;
prefs.show_filemenu=TRUE; show_filemenu=TRUE;
prefs.show_forw = TRUE; show_forw = TRUE;
prefs.show_help = TRUE; show_help = TRUE;
prefs.show_home = TRUE; show_home = TRUE;
prefs.show_msg = TRUE; show_msg = TRUE;
prefs.show_progress_box = TRUE; show_progress_box = TRUE;
prefs.show_quit_dialog = FALSE; show_quit_dialog = FALSE;
prefs.show_reload = TRUE; show_reload = TRUE;
prefs.show_save = TRUE; show_save = TRUE;
prefs.show_url = TRUE; show_url = TRUE;
prefs.show_search = TRUE; show_search = TRUE;
prefs.show_stop = TRUE; show_stop = TRUE;
prefs.show_tools = TRUE; show_tools = TRUE;
prefs.show_tooltip = TRUE; show_tooltip = TRUE;
prefs.show_ui_tooltip = TRUE; show_ui_tooltip = TRUE;
prefs.small_icons = FALSE; small_icons = FALSE;
prefs.start_page = a_Url_new(PREFS_START_PAGE, NULL); start_page = a_Url_new(PREFS_START_PAGE, NULL);
prefs.new_tab_page = a_Url_new(PREFS_NEW_TAB_PAGE, NULL); new_tab_page = a_Url_new(PREFS_NEW_TAB_PAGE, NULL);
prefs.theme = PREFS_THEME; theme = PREFS_THEME;
prefs.ui_button_highlight_color = -1; ui_button_highlight_color = -1;
prefs.ui_fg_color = -1; ui_fg_color = -1;
prefs.ui_main_bg_color = -1; ui_main_bg_color = -1;
prefs.ui_selection_color = -1; ui_selection_color = -1;
prefs.ui_tab_active_bg_color = -1; ui_tab_active_bg_color = -1;
prefs.ui_tab_bg_color = -1; ui_tab_bg_color = -1;
prefs.ui_tab_active_fg_color = -1; ui_tab_active_fg_color = -1;
prefs.ui_tab_height = 20; ui_tab_height = 20;
prefs.ui_tab_fg_color = -1; ui_tab_fg_color = -1;
prefs.ui_text_bg_color = -1; ui_text_bg_color = -1;
prefs.penalty_hyphen = 100; penalty_hyphen = 100;
prefs.penalty_hyphen_2 = 800; penalty_hyphen_2 = 800;
prefs.penalty_em_dash_left = 800; penalty_em_dash_left = 800;
prefs.penalty_em_dash_right = 100; penalty_em_dash_right = 100;
prefs.penalty_em_dash_right_2 = 800; penalty_em_dash_right_2 = 800;
prefs.stretchability_factor = 100; stretchability_factor = 100;
} }
+2
View File
@@ -131,6 +131,8 @@ struct DilloPrefs
int penalty_em_dash_left, penalty_em_dash_right, penalty_em_dash_right_2; int penalty_em_dash_left, penalty_em_dash_right, penalty_em_dash_right_2;
int stretchability_factor; int stretchability_factor;
std::vector< char * > link_actions; std::vector< char * > link_actions;
DilloPrefs();
}; };
/** Global Data */ /** Global Data */