Beispiel #1
0
END_HANDLER

BUTTON_CLICKED(setDefaultExportOptions)
{
	nsoption_set_int(margin_top, DEFAULT_MARGIN_TOP_MM);
	nsoption_set_int(margin_bottom, DEFAULT_MARGIN_BOTTOM_MM);
	nsoption_set_int(margin_left, DEFAULT_MARGIN_LEFT_MM);
	nsoption_set_int(margin_right, DEFAULT_MARGIN_RIGHT_MM);
	nsoption_set_int(export_scale, DEFAULT_EXPORT_SCALE * 100);		
	nsoption_set_bool(suppress_images, false);
	nsoption_set_bool(remove_backgrounds, false);
	nsoption_set_bool(enable_loosening, true);
	nsoption_set_bool(enable_PDF_compression, true);
	nsoption_set_bool(enable_PDF_password, false);
			
	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(checkCompressPDF, nsoption_bool(enable_PDF_compression));
	SET_CHECK(checkPasswordPDF, nsoption_bool(enable_PDF_password));
	SET_CHECK(checkFitPage, nsoption_bool(enable_loosening));
}
Beispiel #2
0
END_HANDLER

COMBO_CHANGED(comboProxyType, http_proxy_auth)
{
	LOG(("proxy auth: %d", nsoption_int(http_proxy_auth)));
	switch (nsoption_int(http_proxy_auth)) {
	case 0:
		nsoption_set_bool(http_proxy, false);
		nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_NONE);
		break;
	case 1:
		nsoption_set_bool(http_proxy, true);
		nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_NONE);
		break;
	case 2:
		nsoption_set_bool(http_proxy, true);
		nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_BASIC);
		break;
	case 3:
		nsoption_set_bool(http_proxy, true);
		nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_NTLM);
		break;
	}
	gboolean sensitive = (!proxy_type == 0);
	gtk_widget_set_sensitive(entryProxyHost, sensitive);
	gtk_widget_set_sensitive(entryProxyPort, sensitive);
	gtk_widget_set_sensitive(entryProxyUser, sensitive);
	gtk_widget_set_sensitive(entryProxyPassword, sensitive);
}	
Beispiel #3
0
static void
gui_init(int argc, char** argv)
{
	nsfb_t *nsfb;

	/* Override, since we have no support for non-core SELECT menu */
	nsoption_set_bool(core_select_menu, true);

	if (process_cmdline(argc,argv) != true)
		die("unable to process command line.\n");

	nsfb = framebuffer_initialise(fename, fewidth, feheight, febpp);
	if (nsfb == NULL)
		die("Unable to initialise framebuffer");

	framebuffer_set_cursor(&pointer_image);

	if (fb_font_init() == false)
		die("Unable to initialise the font system");

	fbtk = fbtk_init(nsfb);

	fbtk_enable_oskb(fbtk);

	urldb_load_cookies(nsoption_charp(cookie_file));
}
Beispiel #4
0
bool ro_gui_options_content_ok(wimp_w w)
{
	nsoption_set_bool(block_ads,
			  ro_gui_get_icon_selected_state(w, CONTENT_BLOCK_ADVERTISEMENTS));

	nsoption_set_bool(block_popups,
			  ro_gui_get_icon_selected_state(w, CONTENT_BLOCK_POPUPS));
	nsoption_set_bool(no_plugins,
			  ro_gui_get_icon_selected_state(w, CONTENT_NO_PLUGINS));

	nsoption_set_bool(target_blank,
			  ro_gui_get_icon_selected_state(w, CONTENT_TARGET_BLANK));

	ro_gui_save_options();
  	return true;
}
Beispiel #5
0
HOOKF(void, ami_menu_item_browser_backimg, APTR, window, struct IntuiMessage *)
{
	struct Menu *menustrip;
	bool checked = false;

	GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
	if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
	
	nsoption_set_bool(background_images, checked);
	ami_menu_set_check_toggled();
}
Beispiel #6
0
static void ami_menu_item_browser_enablejs(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
	struct Menu *menustrip;
	bool checked = false;

	GetAttr(WINDOW_MenuStrip, (Object *)window, (ULONG *)&menustrip);
	if(ItemAddress(menustrip, msg->Code)->Flags & CHECKED) checked = true;
	
	nsoption_set_bool(enable_javascript, checked);
	ami_menu_check_toggled = true;
}
Beispiel #7
0
bool ro_gui_options_security_ok(wimp_w w)
{
	nsoption_set_bool(send_referer,
			  ro_gui_get_icon_selected_state(w, SECURITY_REFERRER));

	nsoption_set_int(expire_url,
			 ro_gui_get_icon_decimal(w,SECURITY_DURATION_FIELD, 0));

	ro_gui_save_options();
  	return true;
}
Beispiel #8
0
bool ro_gui_options_home_ok(wimp_w w)
{
	nsoption_set_charp(homepage_url,
		       strdup(ro_gui_get_icon_string(w, HOME_URL_FIELD)));

	nsoption_set_bool(open_browser_at_startup,
			  ro_gui_get_icon_selected_state(w, HOME_OPEN_STARTUP));

	ro_gui_save_options();
  	return true;
}
Beispiel #9
0
bool ro_gui_options_interface_ok(wimp_w w)
{
	nsoption_set_bool(strip_extensions, 
			ro_gui_get_icon_selected_state(w, 
					INTERFACE_STRIP_EXTNS_OPTION));
	nsoption_set_bool(confirm_overwrite, 
                          ro_gui_get_icon_selected_state(w,
                                        INTERFACE_CONFIRM_OVWR_OPTION));
	nsoption_set_bool(url_suggestion, 
                          ro_gui_get_icon_selected_state(w,
                                        INTERFACE_URL_COMPLETE_OPTION));
	nsoption_set_bool(history_tooltip, 
                          ro_gui_get_icon_selected_state(w,
                                        INTERFACE_HISTORY_TOOLTIP_OPTION));
	nsoption_set_bool(thumbnail_iconise, 
                          ro_gui_get_icon_selected_state(w,
                                        INTERFACE_THUMBNAIL_ICONISE_OPTION));
	nsoption_set_bool(external_hotlists, 
                          ro_gui_get_icon_selected_state(w,
                                        INTERFACE_USE_EXTERNAL_HOTLIST));
	nsoption_set_charp(external_hotlist_app,
                           strdup(ro_gui_get_icon_string(w,
                                        INTERFACE_EXTERNAL_HOTLIST_APP)));

	ro_gui_save_options();
	return true;
}
Beispiel #10
0
bool ro_gui_options_image_ok(wimp_w w)
{
	ro_gui_options_image_read(w, 
				  (unsigned int *)&nsoption_int(plot_bg_quality),
				  (unsigned int *)&nsoption_int(plot_fg_quality));

	nsoption_set_int(minimum_gif_delay,
			 ro_gui_get_icon_decimal(w, IMAGE_SPEED_FIELD, 2));

	nsoption_set_bool(animate_images,
			  !ro_gui_get_icon_selected_state(w,
					IMAGE_DISABLE_ANIMATION));
	ro_gui_save_options();

	return true;
}
Beispiel #11
0
static void __CDECL menu_bg_images(WINDOW *win, int item, int title, void *data)
{
	nsoption_set_bool(background_images, !nsoption_bool(background_images));
	MenuIcheck( NULL, MAINMENU_M_BG_IMAGES, (nsoption_bool(background_images)) ? 1 : 0);
}
Beispiel #12
0
/**
 * Initialise atari gui.
 */
static void gui_init(int argc, char** argv)
{
    char buf[PATH_MAX];
    OBJECT * cursors;

    atari_find_resource(buf, "netsurf.rsc", "./res/netsurf.rsc");
    LOG("Using RSC file: %s ", (char *)&buf);
    if (rsrc_load(buf)==0) {

	char msg[1024];

	snprintf(msg, 1024, "Unable to open GEM Resource file (%s)!", buf);
	die(msg);
    }

    wind_get_grect(0, WF_WORKXYWH, &desk_area);

    create_cursor(0, POINT_HAND, NULL, &gem_cursors.hand );
    create_cursor(0, TEXT_CRSR,  NULL, &gem_cursors.ibeam );
    create_cursor(0, THIN_CROSS, NULL, &gem_cursors.cross);
    create_cursor(0, BUSY_BEE, NULL, &gem_cursors.wait);
    create_cursor(0, ARROW, NULL, &gem_cursors.arrow);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizeall);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenesw);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenwse);
    cursors = gemtk_obj_get_tree(CURSOR);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_APPSTART,
		  cursors, &gem_cursors.appstarting);
    gem_set_cursor( &gem_cursors.appstarting );
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZEWE,
		  cursors, &gem_cursors.sizewe);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZENS,
		  cursors, &gem_cursors.sizens);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_NODROP,
		  cursors, &gem_cursors.nodrop);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_DENY,
		  cursors, &gem_cursors.deny);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_MENU,
		  cursors, &gem_cursors.menu);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_HELP,
		  cursors, &gem_cursors.help);

    LOG("Enabling core select menu");
    nsoption_set_bool(core_select_menu, true);

    LOG("Loading url.db from: %s", nsoption_charp(url_file));
    if( strlen(nsoption_charp(url_file)) ) {
	urldb_load(nsoption_charp(url_file));
    }

    LOG("Loading cookies from: %s", nsoption_charp(cookie_file));
    if( strlen(nsoption_charp(cookie_file)) ) {
	urldb_load_cookies(nsoption_charp(cookie_file));
    }

    if (process_cmdline(argc,argv) != true)
	die("unable to process command line.\n");

    LOG("Initializing NKC...");
    nkc_init();

    LOG("Initializing plotters...");
    plot_init(nsoption_charp(atari_font_driver));

    aes_event_in.emi_m1leave = MO_LEAVE;
    aes_event_in.emi_m1.g_w = 1;
    aes_event_in.emi_m1.g_h = 1;
    //next_poll = clock() + (CLOCKS_PER_SEC>>3);

    deskmenu_init();
    menu_register( -1, theapp);
    if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) {
	menu_register( _AESapid, (char*)"  NetSurf ");
    }
    gemtk_wm_init();

    /* Initialize the specific treeview windows: */
    atari_global_history_init();
    atari_hotlist_init();
    atari_cookie_manager_init();

    /* Initialize the toolbar framework: */
    toolbar_init();
}
Beispiel #13
0
static void apply_settings(void)
{
    /* "Network" tab: */
    nsoption_set_bool(http_proxy, OBJ_SELECTED(SETTINGS_CB_USE_PROXY));
    if ( OBJ_SELECTED(SETTINGS_CB_PROXY_AUTH) ) {
        nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_BASIC);
    } else {
        nsoption_set_int(http_proxy_auth, OPTION_HTTP_PROXY_AUTH_NONE);
    }
    nsoption_set_charp(http_proxy_auth_pass,
                       gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_PASSWORD));
    nsoption_set_charp(http_proxy_auth_user,
                       gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_USERNAME));
    nsoption_set_charp(http_proxy_host,
                       gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_HOST));
    nsoption_set_int(http_proxy_port,
                     atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_PROXY_PORT) ));
    nsoption_set_int(max_fetchers_per_host,
                     atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_MAX_FETCHERS_PER_HOST)));
    nsoption_set_int(max_cached_fetch_handles,
                     atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_MAX_CACHED_CONNECTIONS)));
    nsoption_set_int(max_fetchers,
                     atoi( gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_MAX_FETCHERS) ));
    nsoption_set_bool(foreground_images,
                      OBJ_SELECTED( SETTINGS_CB_FG_IMAGES ));
    nsoption_set_bool(background_images,
                      OBJ_SELECTED( SETTINGS_CB_BG_IMAGES ));

    /* "Style" tab: */
    nsoption_set_int(font_min_size, tmp_option_font_min_size);
    nsoption_set_int(font_size, tmp_option_font_size);

    /* "Rendering" tab: */
    nsoption_set_charp(atari_font_driver,
                       gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_FONT_RENDERER));
    nsoption_set_bool(atari_transparency,
                      OBJ_SELECTED(SETTINGS_CB_TRANSPARENCY));
    nsoption_set_bool(animate_images,
                      OBJ_SELECTED(SETTINGS_CB_ENABLE_ANIMATION));
    nsoption_set_int(minimum_gif_delay,
                     (int)(tmp_option_minimum_gif_delay*100+0.5));
    /*	nsoption_set_bool(incremental_reflow,
    			  OBJ_SELECTED(SETTINGS_CB_INCREMENTAL_REFLOW));*/
    nsoption_set_int(min_reflow_period, tmp_option_min_reflow_period);
    nsoption_set_int(atari_font_monochrom,
                     !OBJ_SELECTED( SETTINGS_CB_ANTI_ALIASING ));

    /* "Paths" tabs: */
    nsoption_set_charp(ca_bundle,
                       gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_BUNDLE));
    nsoption_set_charp(ca_path,
                       gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH));
    nsoption_set_charp(homepage_url,
                       gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_CA_CERTS_PATH));
    nsoption_set_charp(hotlist_file,
                       gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HOTLIST_FILE));
    nsoption_set_charp(atari_editor,
                       gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_EDITOR));
    nsoption_set_charp(downloads_path,
                       gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_DOWNLOAD_PATH));

    /* "Cache" tab: */
    nsoption_set_int(memory_cache_size,
                     tmp_option_memory_cache_size * 1000000);

    /* "Browser" tab: */
    nsoption_set_bool(target_blank,
                      !OBJ_SELECTED(SETTINGS_CB_DISABLE_POPUP_WINDOWS));
    nsoption_set_bool(block_ads,
                      OBJ_SELECTED(SETTINGS_CB_HIDE_ADVERTISEMENT));
    nsoption_set_charp(accept_language,
                       gemtk_obj_get_text(dlgtree, SETTINGS_BT_SEL_LOCALE));
    nsoption_set_int(expire_url,
                     atoi(gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HISTORY_AGE)));
    nsoption_set_bool(send_referer,
                      OBJ_SELECTED(SETTINGS_CB_SEND_HTTP_REFERRER));
    nsoption_set_bool(do_not_track,
                      OBJ_SELECTED(SETTINGS_CB_SEND_DO_NOT_TRACK));
    nsoption_set_charp(homepage_url,
                       gemtk_obj_get_text(dlgtree, SETTINGS_EDIT_HOMEPAGE));
}
Beispiel #14
0
CHECK_CHANGED(checkDisableAnimations, animate_images)
{
	nsoption_set_bool(animate_images, !nsoption_bool(animate_images));
}
Beispiel #15
0
static void gui_init(int argc, char** argv)
{
	const char *addr;
	nsurl *url;
	nserror error;
	char buf[PATH_MAX];

	if (pipe(sEventPipe) < 0)
		return;
	if (!replicated) {
		sBAppThreadID = spawn_thread(bapp_thread, "BApplication(NetSurf)", B_NORMAL_PRIORITY, (void *)find_thread(NULL));
		if (sBAppThreadID < B_OK)
			return; /* #### handle errors */
		if (resume_thread(sBAppThreadID) < B_OK)
			return;
	}

	nsbeos_update_system_ui_colors();

	fetch_rsrc_register();

	check_homedir();

	// make sure the cache dir exists
	create_directory(TEMP_FILENAME_PREFIX, 0700);

	//nsbeos_completion_init();


	/* This is an ugly hack to just get the new-style throbber going.
	 * It, along with the PNG throbber loader, need making more generic.
	 */
	{
#define STROF(n) #n
#define FIND_THROB(n) filenames[(n)] = \
				"throbber/throbber" STROF(n) ".png";
		const char *filenames[9];
		FIND_THROB(0);
		FIND_THROB(1);
		FIND_THROB(2);
		FIND_THROB(3);
		FIND_THROB(4);
		FIND_THROB(5);
		FIND_THROB(6);
		FIND_THROB(7);
		FIND_THROB(8);
		nsbeos_throbber_initialise_from_png(9,
			filenames[0], filenames[1], filenames[2], filenames[3],
			filenames[4], filenames[5], filenames[6], filenames[7], 
			filenames[8]);
#undef FIND_THROB
#undef STROF
	}

	if (nsbeos_throbber == NULL)
		die("Unable to load throbber image.\n");

	find_resource(buf, "Choices", "%/Choices");
	LOG("Using '%s' as Preferences file", buf);
	options_file_location = strdup(buf);
	nsoption_read(buf, NULL);


	/* check what the font settings are, setting them to a default font
	 * if they're not set - stops Pango whinging
	 */
#define SETFONTDEFAULT(OPTION,y) if (nsoption_charp(OPTION) == NULL) nsoption_set_charp(OPTION, strdup((y)))

	//XXX: use be_plain_font & friends, when we can check if font is serif or not.
/*
	font_family family;
	font_style style;
	be_plain_font->GetFamilyAndStyle(&family, &style);
	SETFONTDEFAULT(font_sans, family);
	SETFONTDEFAULT(font_serif, family);
	SETFONTDEFAULT(font_mono, family);
	SETFONTDEFAULT(font_cursive, family);
	SETFONTDEFAULT(font_fantasy, family);
*/
#ifdef __HAIKU__
	SETFONTDEFAULT(font_sans, "DejaVu Sans");
	SETFONTDEFAULT(font_serif, "DejaVu Serif");
	SETFONTDEFAULT(font_mono, "DejaVu Mono");
	SETFONTDEFAULT(font_cursive, "DejaVu Sans");
	SETFONTDEFAULT(font_fantasy, "DejaVu Sans");
#else
	SETFONTDEFAULT(font_sans, "Bitstream Vera Sans");
	SETFONTDEFAULT(font_serif, "Bitstream Vera Serif");
	SETFONTDEFAULT(font_mono, "Bitstream Vera Sans Mono");
	SETFONTDEFAULT(font_cursive, "Bitstream Vera Serif");
	SETFONTDEFAULT(font_fantasy, "Bitstream Vera Serif");
#endif

	nsbeos_options_init();

	/* We don't yet have an implementation of "select" form elements (they should use a popup menu)
	 * So we use the cross-platform code instead. */
	nsoption_set_bool(core_select_menu, true);

	if (nsoption_charp(cookie_file) == NULL) {
		find_resource(buf, "Cookies", "%/Cookies");
		LOG("Using '%s' as Cookies file", buf);
		nsoption_set_charp(cookie_file, strdup(buf));
	}
	if (nsoption_charp(cookie_jar) == NULL) {
		find_resource(buf, "Cookies", "%/Cookies");
		LOG("Using '%s' as Cookie Jar file", buf);
		nsoption_set_charp(cookie_jar, strdup(buf));
	}
	if ((nsoption_charp(cookie_file) == NULL) || 
	    (nsoption_charp(cookie_jar) == NULL))
		die("Failed initialising cookie options");

	if (nsoption_charp(url_file) == NULL) {
		find_resource(buf, "URLs", "%/URLs");
		LOG("Using '%s' as URL file", buf);
		nsoption_set_charp(url_file, strdup(buf));
	}

        if (nsoption_charp(ca_path) == NULL) {
                find_resource(buf, "certs", "/etc/ssl/certs");
                LOG("Using '%s' as certificate path", buf);
                nsoption_set_charp(ca_path, strdup(buf));
        }

	//find_resource(buf, "mime.types", "/etc/mime.types");
	beos_fetch_filetype_init();

	urldb_load(nsoption_charp(url_file));
	urldb_load_cookies(nsoption_charp(cookie_file));

	//nsbeos_download_initialise();

	if (!replicated)
		be_app->Unlock();

	if (argc > 1) {
		addr = argv[1];
	} else if (nsoption_charp(homepage_url) != NULL) {
		addr = nsoption_charp(homepage_url);
	} else {
		addr = NETSURF_HOMEPAGE;
	}

	/* create an initial browser window */
	error = nsurl_create(addr, &url);
	if (error == NSERROR_OK) {
		error = browser_window_create(
			BW_CREATE_HISTORY,
			url,
			NULL,
			NULL,
			NULL);
		nsurl_unref(url);
	}
	if (error != NSERROR_OK) {
		beos_warn_user(messages_get_errorcode(error), 0);
	}

	if (gFirstRefsReceived) {
		// resend the refs we got before having a window to send them to
		be_app_messenger.SendMessage(gFirstRefsReceived);
		delete gFirstRefsReceived;
		gFirstRefsReceived = NULL;
	}

}
Beispiel #16
0
static void check_options(char **respath)
{
	char *hdir = getenv("HOME");
	char buf[PATH_MAX];

	nsoption_set_bool(core_select_menu, true);

	/* Attempt to handle nonsense status bar widths.  These may exist
	 * in people's Choices as the GTK front end used to abuse the
	 * status bar width option by using it for an absolute value in px.
	 * The GTK front end now correctly uses it as a proportion of window
	 * width.  Here we assume that a value of less than 15% is wrong
	 * and set to the default two thirds. */
	if (nsoption_int(toolbar_status_width) < 1500) {
		nsoption_set_int(toolbar_status_width, 6667);
	}

	/* user options should be stored in the users home directory */
	snprintf(buf, PATH_MAX, "%s/.netsurf/Choices", hdir);      
	options_file_location = strdup(buf);

        /* VRS - I do not beleive these setting should search the
	 * resource path, they should just be set to the default
	 * values! 
	 */
	if (nsoption_charp(cookie_file) == NULL) {
		filepath_sfinddef(respath, buf, "Cookies", "~/.netsurf/");
		LOG(("Using '%s' as Cookies file", buf));
		nsoption_set_charp(cookie_file, strdup(buf));
	}
	if (nsoption_charp(cookie_jar) == NULL) {
		filepath_sfinddef(respath, buf, "Cookies", "~/.netsurf/");
		LOG(("Using '%s' as Cookie Jar file", buf));
		nsoption_set_charp(cookie_jar, strdup(buf));
	}
	if (nsoption_charp(cookie_file) == NULL || 
	    nsoption_charp(cookie_jar) == NULL)
		die("Failed initialising cookie options");

	if (nsoption_charp(url_file) == NULL) {
		filepath_sfinddef(respath, buf, "URLs", "~/.netsurf/");
		LOG(("Using '%s' as URL file", buf));
		nsoption_set_charp(url_file, strdup(buf));
	}

        if (nsoption_charp(ca_path) == NULL) {
		filepath_sfinddef(respath, buf, "certs", "/etc/ssl/");
                LOG(("Using '%s' as certificate path", buf));
                nsoption_set_charp(ca_path, strdup(buf));
        }

        if (nsoption_charp(downloads_directory) == NULL) {
        	LOG(("Using '%s' as download directory", hdir));
        	nsoption_set_charp(downloads_directory, strdup(hdir));
	}
	
	filepath_sfinddef(respath, buf, "icons/", "~/.netsurf/");
	LOG(("Using '%s' as Tree icons dir", buf));
	tree_set_icon_dir(strdup(buf));

	if (nsoption_charp(hotlist_path) == NULL) {
		filepath_sfinddef(respath, buf, "Hotlist", "~/.netsurf/");
		LOG(("Using '%s' as Hotlist file", buf));
		nsoption_set_charp(hotlist_path, strdup(buf));	
	}
	if (nsoption_charp(hotlist_path) == NULL)
		die("Failed initialising hotlist option");	
	

	filepath_sfinddef(respath, buf, "Print", "~/.netsurf/");
	LOG(("Using '%s' as Print Settings file", buf));
	print_options_file_location = strdup(buf);

	/* check what the font settings are, setting them to a default font
	 * if they're not set - stops Pango whinging
	 */
#define SETFONTDEFAULT(OPTION,y) if (nsoption_charp(OPTION) == NULL) nsoption_set_charp(OPTION, strdup((y)))
	SETFONTDEFAULT(font_sans, "Sans");
	SETFONTDEFAULT(font_serif, "Serif");
	SETFONTDEFAULT(font_mono, "Monospace");
	SETFONTDEFAULT(font_cursive, "Serif");
	SETFONTDEFAULT(font_fantasy, "Serif");

}
Beispiel #17
0
static void __CDECL menu_bg_images(short item, short title, void *data)
{
	nsoption_set_bool(background_images, !nsoption_bool(background_images));
	menu_icheck(h_gem_menu, MAINMENU_M_BG_IMAGES,
				(nsoption_bool(background_images)) ? 1 : 0);
}
Beispiel #18
0
/** Entry point from OS.
 *
 * /param argc The number of arguments in the string vector.
 * /param argv The argument string vector.
 * /return The return code to the OS
 */
int
main(int argc, char** argv)
{
	struct browser_window *bw;
	char *options;
	char *messages;
	nsurl *url;
	nserror ret;
	nsfb_t *nsfb;
	struct gui_table framebuffer_gui_table = {
		.browser = &framebuffer_browser_table,
		.window = &framebuffer_window_table,
		.clipboard = framebuffer_clipboard_table,
		.fetch = framebuffer_fetch_table,
		.utf8 = framebuffer_utf8_table,
	};

	respaths = fb_init_resource(NETSURF_FB_RESPATH":"NETSURF_FB_FONTPATH);

	/* initialise logging. Not fatal if it fails but not much we
	 * can do about it either.
	 */
	nslog_init(nslog_stream_configure, &argc, argv);

	/* user options setup */
	ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
	if (ret != NSERROR_OK) {
		die("Options failed to initialise");
	}
	options = filepath_find(respaths, "Choices");
	nsoption_read(options, nsoptions);
	free(options);
	nsoption_commandline(&argc, argv, nsoptions);

	/* common initialisation */
	messages = filepath_find(respaths, "Messages");
	ret = netsurf_init(messages, &framebuffer_gui_table);
	free(messages);
	if (ret != NSERROR_OK) {
		die("NetSurf failed to initialise");
	}

	/* Override, since we have no support for non-core SELECT menu */
	nsoption_set_bool(core_select_menu, true);

	if (process_cmdline(argc,argv) != true)
		die("unable to process command line.\n");

	nsfb = framebuffer_initialise(fename, fewidth, feheight, febpp);
	if (nsfb == NULL)
		die("Unable to initialise framebuffer");

	framebuffer_set_cursor(&pointer_image);

	if (fb_font_init() == false)
		die("Unable to initialise the font system");

	fbtk = fbtk_init(nsfb);

	fbtk_enable_oskb(fbtk);

	urldb_load_cookies(nsoption_charp(cookie_file));

	/* create an initial browser window */

	LOG(("calling browser_window_create"));

	ret = nsurl_create(feurl, &url);
	if (ret == NSERROR_OK) {
		ret = browser_window_create(BW_CREATE_HISTORY,
					      url,
					      NULL,
					      NULL,
					      &bw);
		nsurl_unref(url);
	}
	if (ret != NSERROR_OK) {
		warn_user(messages_get_errorcode(ret), 0);
	} else {
		netsurf_main_loop();

		browser_window_destroy(bw);
	}

	netsurf_exit();

	if (fb_font_finalise() == false)
		LOG(("Font finalisation failed."));

	/* finalise options */
	nsoption_finalise(nsoptions, nsoptions_default);

	return 0;
}
Beispiel #19
0
/**
 * Entry point from operating system
 **/
int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
{
	char **argv = NULL;
	int argc = 0, argctemp = 0;
	size_t len;
	LPWSTR *argvw;
	char *messages;
	nserror ret;
	const char *addr;
	nsurl *url;
	nserror error;

	if (SLEN(lpcli) > 0) {
		argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
	}

	setbuf(stderr, NULL);

	/* Construct a unix style argc/argv */
	argv = malloc(sizeof(char *) * argc);
	while (argctemp < argc) {
		len = wcstombs(NULL, argvw[argctemp], 0) + 1;
		if (len > 0) {
			argv[argctemp] = malloc(len);
		}

		if (argv[argctemp] != NULL) {
			wcstombs(argv[argctemp], argvw[argctemp], len);
			/* alter windows-style forward slash flags to
			 * hyphen flags.
			 */
			if (argv[argctemp][0] == '/')
				argv[argctemp][0] = '-';
		}
		argctemp++;
	}

	respaths = nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);

	messages = filepath_find(respaths, "messages");

	options_file_location = filepath_find(respaths, "preferences");

	/* initialise netsurf */
	netsurf_init(&argc, &argv, options_file_location, messages);

	free(messages);

	ret = nsws_create_main_class(hInstance);
	ret = nsws_create_drawable_class(hInstance);
	ret = nsws_create_localhistory_class(hInstance);

	nsoption_set_bool(target_blank, false);

	nsws_window_init_pointers(hInstance);

	/* If there is a url specified on the command line use it */
	if (argc > 1) {
		addr = argv[1];
	} else if (nsoption_charp(homepage_url) != NULL) {
		addr = nsoption_charp(homepage_url);
	} else {
		addr = NETSURF_HOMEPAGE;
	}

	LOG(("calling browser_window_create"));

	error = nsurl_create(addr, &url);
	if (error == NSERROR_OK) {
		error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
					      BROWSER_WINDOW_HISTORY,
					      url,
					      NULL,
					      NULL,
					      NULL);
		nsurl_unref(url);

	}
	if (error != NSERROR_OK) {
		warn_user(messages_get_errorcode(error), 0);
	} else {
		netsurf_main_loop();
	}

	netsurf_exit();

	free(options_file_location);

	return 0;
}
Beispiel #20
0
static void gui_init(int argc, char** argv)
{
    char buf[PATH_MAX];
    OBJECT * cursors;

    atari_find_resource(buf, "netsurf.rsc", "./res/netsurf.rsc");
    LOG(("%s ", (char*)&buf));
    if (rsrc_load(buf)==0) {
        die("Uable to open GEM Resource file!");
    }

    wind_get_grect(0, WF_WORKXYWH, &desk_area);

    create_cursor(0, POINT_HAND, NULL, &gem_cursors.hand );
    create_cursor(0, TEXT_CRSR,  NULL, &gem_cursors.ibeam );
    create_cursor(0, THIN_CROSS, NULL, &gem_cursors.cross);
    create_cursor(0, BUSY_BEE, NULL, &gem_cursors.wait);
    create_cursor(0, ARROW, NULL, &gem_cursors.arrow);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizeall);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenesw);
    create_cursor(0, OUTLN_CROSS, NULL, &gem_cursors.sizenwse);
    cursors = gemtk_obj_get_tree(CURSOR);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_APPSTART,
                  cursors, &gem_cursors.appstarting);
    gem_set_cursor( &gem_cursors.appstarting );
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZEWE,
                  cursors, &gem_cursors.sizewe);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_SIZENS,
                  cursors, &gem_cursors.sizens);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_NODROP,
                  cursors, &gem_cursors.nodrop);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_DENY,
                  cursors, &gem_cursors.deny);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_MENU,
                  cursors, &gem_cursors.menu);
    create_cursor(MFORM_EX_FLAG_USERFORM, CURSOR_HELP,
                  cursors, &gem_cursors.help);

    LOG(("Enabling core select menu"));
    nsoption_set_bool(core_select_menu, true);

    LOG(("Loading url.db from: %s", nsoption_charp(url_file) ));
    if( strlen(nsoption_charp(url_file)) ) {
        urldb_load(nsoption_charp(url_file));
    }

    LOG(("Loading cookies from: %s", nsoption_charp(cookie_file) ));
    if( strlen(nsoption_charp(cookie_file)) ) {
        urldb_load_cookies(nsoption_charp(cookie_file));
    }

    if (process_cmdline(argc,argv) != true)
        die("unable to process command line.\n");

    LOG(("Initializing NKC..."));
    nkc_init();


    LOG(("Initializing plotters..."));
    plot_init(nsoption_charp(atari_font_driver));

    tree_set_icon_dir(nsoption_charp(tree_icons_path));

    aes_event_in.emi_m1leave = MO_LEAVE;
    aes_event_in.emi_m1.g_w = 1;
    aes_event_in.emi_m1.g_h = 1;
    //next_poll = clock() + (CLOCKS_PER_SEC>>3);
}
Beispiel #21
0
static BOOL CALLBACK options_general_dialog_handler(HWND hwnd,
		UINT msg, WPARAM wparam, LPARAM lParam)
{
	HWND sub;

	LOG_WIN_MSG(hwnd, msg, wparam, lParam);

	switch (msg) {
	case WM_INITDIALOG:
		/* homepage url */
		sub = GetDlgItem(hwnd, IDC_PREFS_HOMEPAGE);
		SendMessage(sub, WM_SETTEXT, 0, (LPARAM)nsoption_charp(homepage_url));

		/* Display images */
		sub = GetDlgItem(hwnd, IDC_PREFS_IMAGES);
		SendMessage(sub, BM_SETCHECK, 
			    (WPARAM) ((nsoption_bool(suppress_images)) ? 
				  BST_CHECKED : BST_UNCHECKED), 0);

		/* advert blocking */
		sub = GetDlgItem(hwnd, IDC_PREFS_ADVERTS);
		SendMessage(sub, BM_SETCHECK, 
			    (WPARAM) ((nsoption_bool(block_ads)) ? 
				  BST_CHECKED : BST_UNCHECKED), 0);

		/* Referrer sending */
		sub = GetDlgItem(hwnd, IDC_PREFS_REFERER);
		SendMessage(sub, BM_SETCHECK, 
			    (WPARAM)((nsoption_bool(send_referer)) ?
				 BST_CHECKED : BST_UNCHECKED), 0);
		break;

	case WM_NOTIFY:
		switch (((NMHDR FAR *)lParam)->code) {
		case PSN_APPLY:
			/* homepage */
			sub = GetDlgItem(hwnd, IDC_PREFS_HOMEPAGE);
			if (sub != NULL) {
				int text_length;
				char *text;
				text_length = SendMessage(sub, 
						  WM_GETTEXTLENGTH, 0, 0);
				text = malloc(text_length + 1);
				if (text != NULL) {
					SendMessage(sub, WM_GETTEXT,
						    (WPARAM)text_length + 1,
						    (LPARAM)text);
					nsoption_set_charp(homepage_url, text);
				}
			}

			nsoption_set_bool(suppress_images,
					  (IsDlgButtonChecked(hwnd, IDC_PREFS_IMAGES) == BST_CHECKED) ? true : false);

			nsoption_set_bool(block_ads, (IsDlgButtonChecked(hwnd, 
									 IDC_PREFS_ADVERTS) == BST_CHECKED) ? true : false);

			nsoption_set_bool(send_referer, (IsDlgButtonChecked(hwnd, 
									    IDC_PREFS_REFERER) == BST_CHECKED) ? true : false);

			break;
			
		}
	}
	return FALSE;
}
Beispiel #22
0
static BOOL CALLBACK options_appearance_dialog_handler(HWND hwnd,
		UINT msg, WPARAM wparam, LPARAM lParam)
{
	int len;
	char *temp, number[6];
	HWND sub;

	LOG_WIN_MSG(hwnd, msg, wparam, lParam);

	switch (msg) {
	case WM_INITDIALOG:
		sub = GetDlgItem(hwnd, IDC_PREFS_FONTDEF);
		SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)"Sans serif");
		SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)"Serif");
		SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)"Monospace");
		SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)"Cursive");
		SendMessage(sub, CB_ADDSTRING, 0, (LPARAM)"Fantasy");
		SendMessage(sub, CB_SETCURSEL,
			    (WPARAM) (nsoption_int(font_default) - 1), 0);

		if ((nsoption_charp(font_sans) != NULL) &&
		    (nsoption_charp(font_sans)[0] != '\0')) {
			sub = GetDlgItem(hwnd, IDC_PREFS_SANS);
			SendMessage(sub, WM_SETTEXT, 0,
				    (LPARAM)nsoption_charp(font_sans));
		}
		if ((nsoption_charp(font_serif) != NULL) &&
		    (nsoption_charp(font_serif)[0] != '\0')) {
			sub = GetDlgItem(hwnd, IDC_PREFS_SERIF);
			SendMessage(sub, WM_SETTEXT, 0,
				    (LPARAM)nsoption_charp(font_serif));
		}
		if ((nsoption_charp(font_mono) != NULL) &&
		    (nsoption_charp(font_mono)[0] != '\0')) {
			sub = GetDlgItem(hwnd, IDC_PREFS_MONO);
			SendMessage(sub, WM_SETTEXT, 0,
				    (LPARAM)nsoption_charp(font_mono));
		}
		if ((nsoption_charp(font_cursive) != NULL) &&
		    (nsoption_charp(font_cursive)[0] != '\0')) {
			sub = GetDlgItem(hwnd, IDC_PREFS_CURSIVE);
			SendMessage(sub, WM_SETTEXT, 0,
				    (LPARAM)nsoption_charp(font_cursive));
		}
		if ((nsoption_charp(font_fantasy) != NULL) &&
		    (nsoption_charp(font_fantasy)[0] != '\0')) {
			sub = GetDlgItem(hwnd, IDC_PREFS_FANTASY);
			SendMessage(sub, WM_SETTEXT, 0,
				    (LPARAM)nsoption_charp(font_fantasy));
		}
		if (nsoption_int(font_min_size) != 0) {
			sub = GetDlgItem(hwnd, IDC_PREFS_FONT_MINSIZE);
			snprintf(number, 6, "%.1f", nsoption_int(font_min_size) / 10.0);
			SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
		}
		if (nsoption_int(font_size) != 0) {
			sub = GetDlgItem(hwnd, IDC_PREFS_FONT_SIZE);
			snprintf(number, 6, "%.1f", nsoption_int(font_size) / 10.0);
			SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
		}
		if (nsoption_int(max_fetchers) != 0) {
			sub = GetDlgItem(hwnd, IDC_PREFS_FETCHERS);
			snprintf(number, 6, "%d", nsoption_int(max_fetchers));
			SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
		}
		if (nsoption_int(max_fetchers_per_host) != 0) {
			sub = GetDlgItem(hwnd, IDC_PREFS_FETCH_HOST);
			snprintf(number, 6, "%d",
				 nsoption_int(max_fetchers_per_host));
			SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
		}
		if (nsoption_int(max_cached_fetch_handles) != 0) {
			sub = GetDlgItem(hwnd, IDC_PREFS_FETCH_HANDLES);
			snprintf(number, 6, "%d",
				 nsoption_int(max_cached_fetch_handles));
			SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
		}


		/* animation */
		sub = GetDlgItem(hwnd, IDC_PREFS_NOANIMATION);
		SendMessage(sub, BM_SETCHECK, (WPARAM)((nsoption_bool(animate_images))
				       ? BST_UNCHECKED : BST_CHECKED),	0);

		if (nsoption_int(minimum_gif_delay) != 0) {
			sub = GetDlgItem(hwnd, IDC_PREFS_ANIMATIONDELAY);
			snprintf(number, 6, "%.1f", nsoption_int(minimum_gif_delay) /
				 100.0);
			SendMessage(sub, WM_SETTEXT, 0, (LPARAM)number);
		}
		break;

	case WM_NOTIFY:
		switch (((NMHDR FAR *)lParam)->code) {
		case PSN_APPLY:
			sub = GetDlgItem(hwnd, IDC_PREFS_FONT_SIZE);
			len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
			temp = malloc(len + 1);
			if (temp != NULL) {
				SendMessage(sub, WM_GETTEXT, (WPARAM)
					    (len + 1), (LPARAM) temp);
				nsoption_int(font_size) = (int)
					(10 * strtod(temp, NULL));
				free(temp);
			}

			sub = GetDlgItem(hwnd, IDC_PREFS_FONT_MINSIZE);
			len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
			temp = malloc(len + 1);
			if (temp != NULL) {
				SendMessage(sub, WM_GETTEXT, (WPARAM)
					    (len + 1), (LPARAM) temp);
				nsoption_set_int(font_min_size, 
						 (int)(10 * strtod(temp, NULL)));
				free(temp);
			}

			/* animation */
			nsoption_set_bool(animate_images, 
					  (IsDlgButtonChecked(hwnd, IDC_PREFS_NOANIMATION) == BST_CHECKED) ? true : false);


			sub = GetDlgItem(hwnd, IDC_PREFS_ANIMATIONDELAY);
			len = SendMessage(sub, WM_GETTEXTLENGTH, 0, 0);
			temp = malloc(len + 1);
			if (temp != NULL) {
				SendMessage(sub, WM_GETTEXT, (WPARAM)
					    (len + 1), (LPARAM) temp);
				nsoption_set_int(minimum_gif_delay,
						 (int)(100 * strtod(temp, NULL)));
				free(temp);
			}

			break;

		case UDN_DELTAPOS: {
			NMUPDOWN *ud = (NMUPDOWN *)lParam;
			switch(((NMHDR *)lParam)->idFrom) {
			case IDC_PREFS_FONT_SIZE_SPIN:
				change_spinner(GetDlgItem(hwnd, IDC_PREFS_FONT_SIZE), 0.1  * ud->iDelta, 1.0, 50.0);
				return TRUE;

			case IDC_PREFS_FONT_MINSIZE_SPIN:
				change_spinner(GetDlgItem(hwnd, IDC_PREFS_FONT_MINSIZE), 0.1  * ud->iDelta, 1.0, 50.0);
				return TRUE;

			case IDC_PREFS_ANIMATIONDELAY_SPIN:
				change_spinner(GetDlgItem(hwnd, IDC_PREFS_ANIMATIONDELAY), 0.1  * ud->iDelta, 0.1, 100.0);
				return TRUE;
				
			}
		}
			break;
		}


	case WM_COMMAND:
		LOG(("WM_COMMAND Identifier 0x%x",LOWORD(wparam)));

		switch(LOWORD(wparam)) {
		case IDC_PREFS_PROXYTYPE:
			sub = GetDlgItem(hwnd, IDC_PREFS_PROXYTYPE);
			nsoption_set_int(http_proxy_auth,
					 SendMessage(sub, CB_GETCURSEL, 0, 0) - 1);
			nsoption_set_bool(http_proxy,
					  (nsoption_int(http_proxy_auth) != -1));
			nsoption_set_int(http_proxy_auth,  
					 nsoption_int(http_proxy_auth) + 
					 (nsoption_bool(http_proxy)) ? 0 : 1);
			break;

		case IDC_PREFS_SANS: {
			CHOOSEFONT *cf = nsws_prefs_font_prepare(FF_SWISS, hwnd);
			if (cf == NULL) {
				break;
			}

			if (ChooseFont(cf) == TRUE) {
				nsoption_set_charp(font_sans, 
						   strdup(cf->lpLogFont->lfFaceName));
			}

			free(cf->lpLogFont);
			free(cf);
			if ((nsoption_charp(font_sans) != NULL) &&
			    (nsoption_charp(font_sans)[0] != '\0')) {
				sub = GetDlgItem(hwnd, IDC_PREFS_SANS);
				SendMessage(sub, WM_SETTEXT, 0,
					    (LPARAM)nsoption_charp(font_sans));
			}
			break;
		}

		case IDC_PREFS_SERIF: {
			CHOOSEFONT *cf = nsws_prefs_font_prepare(FF_ROMAN, hwnd);
			if (cf == NULL) {
				break;
			}

			if (ChooseFont(cf) == TRUE) {
				nsoption_set_charp(font_serif,
						   strdup(cf->lpLogFont->lfFaceName));
			}

			free(cf->lpLogFont);
			free(cf);
			if ((nsoption_charp(font_serif) != NULL) &&
			    (nsoption_charp(font_serif)[0] != '\0')) {
				sub = GetDlgItem(hwnd, IDC_PREFS_SERIF);
				SendMessage(sub, WM_SETTEXT, 0,
					    (LPARAM)nsoption_charp(font_serif));
			}
			break;
		}

		case IDC_PREFS_MONO: {
			CHOOSEFONT *cf = nsws_prefs_font_prepare(FF_MODERN, hwnd);
			if (cf == NULL) {
				break;
			}

			if (ChooseFont(cf) == TRUE) {
				nsoption_set_charp(font_mono,
						   strdup(cf->lpLogFont->lfFaceName));
			}

			free(cf->lpLogFont);
			free(cf);

			if ((nsoption_charp(font_mono) != NULL) &&
			    (nsoption_charp(font_mono)[0] != '\0')) {
				sub = GetDlgItem(hwnd, IDC_PREFS_MONO);
				SendMessage(sub, WM_SETTEXT, 0,
					    (LPARAM)nsoption_charp(font_mono));
			}
			break;
		}

		case IDC_PREFS_CURSIVE: {
			CHOOSEFONT *cf = nsws_prefs_font_prepare(FF_SCRIPT, hwnd);
			if (cf == NULL) {
				break;
			}

			if (ChooseFont(cf) == TRUE) {
				nsoption_set_charp(font_cursive,
						   strdup(cf->lpLogFont->lfFaceName));
			}
			free(cf->lpLogFont);
			free(cf);
			if ((nsoption_charp(font_cursive) != NULL) &&
			    (nsoption_charp(font_cursive)[0] != '\0')) {
				sub = GetDlgItem(hwnd, IDC_PREFS_CURSIVE);
				SendMessage(sub, WM_SETTEXT, 0,
					    (LPARAM)nsoption_charp(font_cursive));
			}
			break;
		}

		case IDC_PREFS_FANTASY: {
			CHOOSEFONT *cf = nsws_prefs_font_prepare(FF_DECORATIVE, hwnd);
			if (cf == NULL) {
				break;
			}

			if (ChooseFont(cf) == TRUE) {
				nsoption_set_charp(font_fantasy,
						   strdup(cf->lpLogFont->lfFaceName));
			}
			free(cf->lpLogFont);
			free(cf);
			if ((nsoption_charp(font_fantasy) != NULL) &&
			    (nsoption_charp(font_fantasy)[0] != '\0')) {
				sub = GetDlgItem(hwnd, IDC_PREFS_FANTASY);
				SendMessage(sub, WM_SETTEXT, 0,
					    (LPARAM)nsoption_charp(font_fantasy));
			}
			break;
		}

		case IDC_PREFS_FONTDEF: 
			sub = GetDlgItem(hwnd, IDC_PREFS_FONTDEF);
			nsoption_set_int(font_default,
					 SendMessage(sub, CB_GETCURSEL, 0, 0) + 1);
			break;
		
		}
		break;

	}
	return FALSE;
}