/* Set map style variables */ void set_map_vars(void) { SET_BOOL(show_page_border); SET_BOOL(show_page_title); SET_BOOL(show_map_border); SET_BOOL(show_map_title); SET_BOOL(show_tags); SET_COLOUR(map_background_colour); SET_COLOUR(map_border_colour); SET_COLOUR(map_title_colour); SET_COLOUR(page_background_colour); SET_COLOUR(page_border_colour); SET_COLOUR(page_title_colour); SET_FONT(map_title_font); SET_FONT(page_title_font); SET_REAL(font_scale); font_scale = V_MAX(font_scale, 0.1); SET_REAL(page_margin); SET_FONTSIZE(map_title_fontsize); SET_FONTSIZE(page_title_fontsize); SET_STRING(page_size); if (!get_papersize(page_size, &page_width, &page_height)) fatal("invalid paper size: %s", page_size); if (VAR_DEF("page_width")) SET_REAL(page_width); if (VAR_DEF("page_height")) SET_REAL(page_height); SET_REAL(room_size); room_size = V_MAX(room_size, 0.1); SET_REAL(room_width); SET_REAL(room_height); }
void TASARIM_DESIGN_WIDGET::SET_SELECTED_FONT_SIZE(int size_pt) { if (m_last_selected_variable EQ NULL) { return; } SET_FONT(m_last_selected_variable,size_pt); }
void Settings::ProcessINI(){ // Extra stuff to make life easier #define GET_INT(a, b, c) m_appIni.GetInteger(a, b, c) #define SET_COLOR(a, b) m_colors.SetColor(a, RGB2COLORREF(b)) // Load colors SET_COLOR(Colors::SEL_COLOR, GET_INT("colors", "sel_color", 0)); SET_COLOR(Colors::INACTIVE_SEL_COLOR, GET_INT("colors", "inactive_sel_color", 0)); SET_COLOR(Colors::BK_COLOR, GET_INT("colors", "bk_color", 0)); SET_COLOR(Colors::CODELIST_ITEM_COLOR, GET_INT("colors", "codelist_item_color", 0)); SET_COLOR(Colors::CODELIST_CURRENTLINE_COLOR, GET_INT("colors", "codelist_currentline_color", 0)); // Load animate speed m_nums.SetNum(Nums::ANIMATE_SPEED, GET_INT("numbers", "animate_speed", 10)); m_nums.SetNum(Nums::STEP_INTO_EXTERN_INT, GET_INT("numbers", "step_into_extern_int", 0)); m_nums.SetNum(Nums::STEP_INTO_INT, GET_INT("numbers", "step_into_int", 0)); #undef SET_COLOR #define SET_FONT(a, b) m_fonts.SetFont(a, b); // Load fonts // TODO : Load fonts from INI file SET_FONT(Fonts::GUI_FONT, (HFONT)GetStockObject(DEFAULT_GUI_FONT)); SET_FONT(Fonts::MONOSPACE_FONT, (HFONT)GetStockObject(ANSI_FIXED_FONT)); #undef SET_FONT #undef GET_INT #define GET_STR(a, b, c) m_appIni.Get(a, b, c) #define SET_PATH(a, b) m_paths.SetPath(a, b) SET_PATH(Paths::BIOS_PATH, GET_STR("paths", "bios_path", "")); #undef SET_PATH #undef GET_STR }
/* Set room style variables */ void set_room_vars(void) { SET_BOOL(room_border_dashed); SET_BOOL(show_items); SET_COLOUR(item_text_colour); SET_COLOUR(room_border_colour); SET_COLOUR(room_colour); SET_COLOUR(room_exit_colour); SET_COLOUR(room_shadow_colour); SET_COLOUR(room_text_colour); SET_FONT(item_text_font); SET_FONT(room_text_font); SET_FONTSIZE(item_text_fontsize); SET_FONTSIZE(room_text_fontsize); SET_REAL(room_border_width); SET_REAL(room_exit_width); SET_REAL(room_shadow_xoff); SET_REAL(room_shadow_yoff); }
/* Set link style variables */ void set_link_vars(void) { SET_BOOL(link_dashed); SET_BOOL(link_spline); SET_COLOUR(link_colour); SET_COLOUR(link_text_colour); SET_FONT(link_text_font); SET_FONTSIZE(link_text_fontsize); SET_REAL(link_arrow_size); SET_REAL(link_line_width); SET_STRING(link_inout_string); SET_STRING(link_updown_string); }
void ptoc_init(enum ptoc_client_t cli, enum ptoc_font_t font, enum ptoc_term_t term) { const int *fadelvl; int fademax; unsigned char **color_map; int bg, fg, grad, rgrad, *rgb; #define R(a) (color_map[(a)][0]) #define G(a) (color_map[(a)][1]) #define B(a) (color_map[(a)][2]) #define SET_CLI(a)\ case cli_##a:\ color_map = map_##a;\ current_format = format_##a;\ fgcount = fgcount_##a;\ bgcount = bgcount_##a;\ break current_client = cli; switch (cli) { SET_CLI(irssi); SET_CLI(silc); SET_CLI(bitchx); SET_CLI(mirc); SET_CLI(ansi); SET_CLI(safeansi); SET_CLI(ansiplus); default: puts("you fail bigtime, unknown client type"); exit(EXIT_FAILURE); break; } #undef SET_MAP_IF #define SET_FONT(a)\ case font_##a:\ fadelvl = fadelvl_##a;\ fademax = fademax_##a;\ break switch (font) { SET_FONT(courier); SET_FONT(terminal); SET_FONT(fixedsys); SET_FONT(average); default: puts("you fail bigtime, unknown font type"); exit(EXIT_FAILURE); break; } #undef SET_FONT #if USE_FAST_RGB_CACHE memset(fastrtoa, 0, sizeof(fastrtoa)); #endif for (bg = bgcount; bg--;) { for (fg = fgcount; fg--;) { #if USE_NEAREST_CONVEX ansicdelta[bg][fg] = (R(bg) - R(fg)) * (R(bg) - R(fg)); ansicdelta[bg][fg] += (G(bg) - G(fg)) * (G(bg) - G(fg)); ansicdelta[bg][fg] += (B(bg) - B(fg)) * (B(bg) - B(fg)); #endif for (grad = LEVELS; grad--;) { rgrad = LEVELS - grad; rgb = ansi2rgb[bg][fg][grad]; /* * * calculate rgb mappings for given fg/bg/grad * */ rgb[0] = (R(bg) * (fademax - fadelvl[grad]) + R(fg) * fadelvl[grad]) / fademax; rgb[1] = (G(bg) * (fademax - fadelvl[grad]) + G(fg) * fadelvl[grad]) / fademax; rgb[2] = (B(bg) * (fademax - fadelvl[grad]) + B(fg) * fadelvl[grad]) / fademax; } } } #undef R #undef G #undef B }
void nsgtk_options_load(void) { GtkBox *box; const char *default_accept_language = "en"; const char *default_homepage_url = ""; const char *default_http_proxy_host = ""; const char *default_http_proxy_auth_user = ""; const char *default_http_proxy_auth_pass = ""; int combo_row_count = 0; int active_language = 0; int proxytype = 0; FILE *fp; char buf[50]; /* get widget text */ if (nsoption_charp(accept_language) != NULL) { default_accept_language = nsoption_charp(accept_language); } if (nsoption_charp(homepage_url) != NULL) { default_homepage_url = nsoption_charp(homepage_url); } if (nsoption_charp(http_proxy_host) != NULL) { default_http_proxy_host = nsoption_charp(http_proxy_host); } if (nsoption_charp(http_proxy_auth_user) != NULL) { default_http_proxy_auth_user = nsoption_charp(http_proxy_auth_user); } if (nsoption_charp(http_proxy_auth_pass) != NULL) { default_http_proxy_auth_pass = nsoption_charp(http_proxy_auth_pass); } if (nsoption_bool(http_proxy) == true) { proxytype = nsoption_int(http_proxy_auth) + 1; } /* Create combobox */ box = GTK_BOX(gtk_builder_get_object(gladeFile, "combolanguagevbox")); comboLanguage = nsgtk_combo_box_text_new(); /* Populate combobox from languages file */ if ((languages_file_location != NULL) && ((fp = fopen(languages_file_location, "r")) != NULL)) { LOG(("Used %s for languages", languages_file_location)); while (fgets(buf, sizeof(buf), fp)) { /* Ignore blank lines */ if (buf[0] == '\0') continue; /* Remove trailing \n */ buf[strlen(buf) - 1] = '\0'; nsgtk_combo_box_text_append_text(comboLanguage, buf); if (strcmp(buf, default_accept_language) == 0) active_language = combo_row_count; combo_row_count++; } fclose(fp); } else { LOG(("Failed opening languages file")); warn_user("FileError", languages_file_location); nsgtk_combo_box_text_append_text(comboLanguage, "en"); } gtk_combo_box_set_active(GTK_COMBO_BOX(comboLanguage), active_language); /** \todo localisation */ gtk_widget_set_tooltip_text(GTK_WIDGET(comboLanguage), "set preferred language for web pages"); gtk_box_pack_start(box, comboLanguage, FALSE, FALSE, 0); gtk_widget_show(comboLanguage); nsgtk_options_theme_combo(); SET_ENTRY(entryHomePageURL, default_homepage_url); SET_BUTTON(setCurrentPage); SET_BUTTON(setDefaultPage); SET_CHECK(checkHideAdverts, nsoption_bool(block_ads)); SET_CHECK(checkDisablePopups, nsoption_bool(disable_popups)); SET_CHECK(checkDisablePlugins, nsoption_bool(disable_plugins)); SET_SPIN(spinHistoryAge, nsoption_int(history_age)); SET_CHECK(checkHoverURLs, nsoption_bool(hover_urls)); SET_CHECK(checkDisplayRecentURLs, nsoption_bool(url_suggestion)); SET_CHECK(checkSendReferer, nsoption_bool(send_referer)); SET_CHECK(checkShowSingleTab, nsoption_bool(show_single_tab)); SET_COMBO(comboProxyType, proxytype); SET_ENTRY(entryProxyHost, default_http_proxy_host); gtk_widget_set_sensitive(entryProxyHost, proxytype != 0); snprintf(buf, sizeof(buf), "%d", nsoption_int(http_proxy_port)); SET_ENTRY(entryProxyPort, buf); gtk_widget_set_sensitive(entryProxyPort, proxytype != 0); SET_ENTRY(entryProxyUser, default_http_proxy_auth_user); gtk_widget_set_sensitive(entryProxyUser, proxytype != 0); SET_ENTRY(entryProxyPassword, default_http_proxy_auth_pass); gtk_widget_set_sensitive(entryProxyPassword, proxytype != 0); SET_SPIN(spinMaxFetchers, nsoption_int(max_fetchers)); SET_SPIN(spinFetchesPerHost, nsoption_int(max_fetchers_per_host)); SET_SPIN(spinCachedConnections, nsoption_int(max_cached_fetch_handles)); SET_CHECK(checkResampleImages, nsoption_bool(render_resample)); SET_SPIN(spinAnimationSpeed, nsoption_int(minimum_gif_delay) / 100.0); SET_CHECK(checkDisableAnimations, !nsoption_bool(animate_images)); SET_FONT(fontSansSerif, nsoption_charp(font_sans)); SET_FONT(fontSerif, nsoption_charp(font_serif)); SET_FONT(fontMonospace, nsoption_charp(font_mono)); SET_FONT(fontCursive, nsoption_charp(font_cursive)); SET_FONT(fontFantasy, nsoption_charp(font_fantasy)); SET_COMBO(comboDefault, nsoption_int(font_default)); SET_SPIN(spinDefaultSize, nsoption_int(font_size) / 10); SET_SPIN(spinMinimumSize, nsoption_bool(font_min_size) / 10); SET_BUTTON(fontPreview); SET_COMBO(comboButtonType, nsoption_int(button_type) -1); SET_COMBO(comboTabPosition, nsoption_int(position_tab)); SET_SPIN(spinMemoryCacheSize, nsoption_int(memory_cache_size) >> 20); SET_SPIN(spinDiscCacheAge, nsoption_int(disc_cache_age)); SET_CHECK(checkClearDownloads, nsoption_bool(downloads_clear)); SET_CHECK(checkRequestOverwrite, nsoption_bool(request_overwrite)); SET_FILE_CHOOSER(fileChooserDownloads, nsoption_charp(downloads_directory)); SET_CHECK(checkFocusNew, nsoption_bool(focus_new)); SET_CHECK(checkNewBlank, nsoption_bool(new_blank)); SET_CHECK(checkUrlSearch, nsoption_bool(search_url_bar)); SET_COMBO(comboSearch, nsoption_int(search_provider)); SET_BUTTON(buttonaddtheme); SET_CHECK(sourceButtonTab, nsoption_bool(source_tab)); SET_SPIN(spinMarginTop, nsoption_int(margin_top)); SET_SPIN(spinMarginBottom, nsoption_int(margin_bottom)); SET_SPIN(spinMarginLeft, nsoption_int(margin_left)); SET_SPIN(spinMarginRight, nsoption_int(margin_right)); SET_SPIN(spinExportScale, nsoption_int(export_scale)); SET_CHECK(checkSuppressImages, nsoption_bool(suppress_images)); SET_CHECK(checkRemoveBackgrounds, nsoption_bool(remove_backgrounds)); SET_CHECK(checkFitPage, nsoption_bool(enable_loosening)); SET_CHECK(checkCompressPDF, nsoption_bool(enable_PDF_compression)); SET_CHECK(checkPasswordPDF, nsoption_bool(enable_PDF_password)); SET_BUTTON(setDefaultExportOptions); }
void nsgtk_options_load(void) { GtkBox *box; char languagefile[strlen(res_dir_location) + SLEN("languages") + 1]; const char *default_accept_language = option_accept_language ? option_accept_language : "en"; int combo_row_count = 0; int active_language = 0; int proxytype = 0; FILE *fp; char buf[50]; /* Create combobox */ box = GTK_BOX(glade_xml_get_widget(gladeFile, "combolanguagevbox")); comboLanguage = gtk_combo_box_new_text(); sprintf(languagefile, "%slanguages", res_dir_location); /* Populate combobox from languages file */ fp = fopen((const char *) languagefile, "r"); if (fp == NULL) { LOG(("Failed opening languages file")); warn_user("FileError", (const char *) languagefile); return; } while (fgets(buf, sizeof(buf), fp)) { /* Ignore blank lines */ if (buf[0] == '\0') continue; /* Remove trailing \n */ buf[strlen(buf) - 1] = '\0'; gtk_combo_box_append_text(GTK_COMBO_BOX(comboLanguage), buf); if (strcmp(buf, default_accept_language) == 0) active_language = combo_row_count; combo_row_count++; } fclose(fp); gtk_combo_box_set_active(GTK_COMBO_BOX(comboLanguage), active_language); /** \todo localisation */ gtk_widget_set_tooltip_text(GTK_WIDGET(comboLanguage), "set preferred language for web pages"); gtk_box_pack_start(box, comboLanguage, FALSE, FALSE, 0); gtk_widget_show(comboLanguage); nsgtk_options_theme_combo(); SET_ENTRY(entryHomePageURL, option_homepage_url ? option_homepage_url : ""); SET_BUTTON(setCurrentPage); SET_BUTTON(setDefaultPage); SET_CHECK(checkHideAdverts, option_block_ads); SET_CHECK(checkDisablePopups, option_disable_popups); SET_CHECK(checkDisablePlugins, option_disable_plugins); SET_SPIN(spinHistoryAge, option_history_age); SET_CHECK(checkHoverURLs, option_hover_urls); SET_CHECK(checkDisplayRecentURLs, option_url_suggestion); SET_CHECK(checkSendReferer, option_send_referer); SET_CHECK(checkShowSingleTab, option_show_single_tab); if (option_http_proxy == false) proxytype = 0; else proxytype = option_http_proxy_auth + 1; SET_COMBO(comboProxyType, proxytype); SET_ENTRY(entryProxyHost, option_http_proxy_host ? option_http_proxy_host : ""); gtk_widget_set_sensitive(entryProxyHost, proxytype != 0); snprintf(buf, sizeof(buf), "%d", option_http_proxy_port); SET_ENTRY(entryProxyPort, buf); gtk_widget_set_sensitive(entryProxyPort, proxytype != 0); SET_ENTRY(entryProxyUser, option_http_proxy_auth_user ? option_http_proxy_auth_user : ""); gtk_widget_set_sensitive(entryProxyUser, proxytype != 0); SET_ENTRY(entryProxyPassword, option_http_proxy_auth_pass ? option_http_proxy_auth_pass : ""); gtk_widget_set_sensitive(entryProxyPassword, proxytype != 0); SET_SPIN(spinMaxFetchers, option_max_fetchers); SET_SPIN(spinFetchesPerHost, option_max_fetchers_per_host); SET_SPIN(spinCachedConnections, option_max_cached_fetch_handles); SET_CHECK(checkResampleImages, option_render_resample); SET_SPIN(spinAnimationSpeed, option_minimum_gif_delay / 100.0); SET_CHECK(checkDisableAnimations, !option_animate_images); SET_FONT(fontSansSerif, option_font_sans); SET_FONT(fontSerif, option_font_serif); SET_FONT(fontMonospace, option_font_mono); SET_FONT(fontCursive, option_font_cursive); SET_FONT(fontFantasy, option_font_fantasy); SET_COMBO(comboDefault, option_font_default); SET_SPIN(spinDefaultSize, option_font_size / 10); SET_SPIN(spinMinimumSize, option_font_min_size / 10); SET_BUTTON(fontPreview); SET_COMBO(comboButtonType, option_button_type -1); SET_SPIN(spinMemoryCacheSize, option_memory_cache_size >> 20); SET_SPIN(spinDiscCacheAge, option_disc_cache_age); SET_CHECK(checkClearDownloads, option_downloads_clear); SET_CHECK(checkRequestOverwrite, option_request_overwrite); SET_FILE_CHOOSER(fileChooserDownloads, option_downloads_directory); SET_CHECK(checkFocusNew, option_focus_new); SET_CHECK(checkNewBlank, option_new_blank); SET_CHECK(checkUrlSearch, option_search_url_bar); SET_COMBO(comboSearch, option_search_provider); SET_BUTTON(buttonaddtheme); SET_CHECK(sourceButtonTab, option_source_tab); SET_SPIN(spinMarginTop, option_margin_top); SET_SPIN(spinMarginBottom, option_margin_bottom); SET_SPIN(spinMarginLeft, option_margin_left); SET_SPIN(spinMarginRight, option_margin_right); SET_SPIN(spinExportScale, option_export_scale); SET_CHECK(checkSuppressImages, option_suppress_images); SET_CHECK(checkRemoveBackgrounds, option_remove_backgrounds); SET_CHECK(checkFitPage, option_enable_loosening); SET_CHECK(checkCompressPDF, option_enable_PDF_compression); SET_CHECK(checkPasswordPDF, option_enable_PDF_password); SET_BUTTON(setDefaultExportOptions); }