Ejemplo n.º 1
0
static void __CDECL menu_new_win(short item, short title, void *data)
{
	nsurl *url;
	nserror error;
	const char *addr;

	LOG(("%s", __FUNCTION__));
		
	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(BROWSER_WINDOW_VERIFIABLE |
					      BROWSER_WINDOW_HISTORY,
					      url,
					      NULL,
					      NULL,
					      NULL);
		nsurl_unref(url);

	}
	if (error != NSERROR_OK) {
		warn_user(messages_get_errorcode(error), 0);
	}
}
Ejemplo n.º 2
0
Archivo: gui.c Proyecto: mmuman/NetSurf
static void gui_quit(void)
{
	nserror res;

	LOG("Quitting GUI");

	/* Ensure all scaffoldings are destroyed before we go into exit */
	nsgtk_download_destroy();
	urldb_save_cookies(nsoption_charp(cookie_jar));
	urldb_save(nsoption_charp(url_file));

	res = nsgtk_cookies_destroy();
	if (res != NSERROR_OK) {
		LOG("Error finalising cookie viewer: %s",
		    messages_get_errorcode(res));
	}

	res = nsgtk_global_history_destroy();
	if (res != NSERROR_OK) {
		LOG("Error finalising global history viewer: %s",
		    messages_get_errorcode(res));
	}

	res = nsgtk_hotlist_destroy();
	if (res != NSERROR_OK) {
		LOG("Error finalising hotlist viewer: %s",
		    messages_get_errorcode(res));
	}

	free(nsgtk_config_home);

	gtk_fetch_filetype_fin();
}
Ejemplo n.º 3
0
bool ro_gui_options_interface_initialise(wimp_w w)
{
	/* set the current values */
	ro_gui_set_icon_selected_state(w, INTERFACE_STRIP_EXTNS_OPTION,
                                       nsoption_bool(strip_extensions));
	ro_gui_set_icon_selected_state(w, INTERFACE_CONFIRM_OVWR_OPTION,
                                       nsoption_bool(confirm_overwrite));
	ro_gui_set_icon_selected_state(w, INTERFACE_URL_COMPLETE_OPTION,
                                       nsoption_bool(url_suggestion));
	ro_gui_set_icon_selected_state(w, INTERFACE_HISTORY_TOOLTIP_OPTION,
                                       nsoption_bool(history_tooltip));
	ro_gui_set_icon_selected_state(w, INTERFACE_THUMBNAIL_ICONISE_OPTION,
                                       nsoption_bool(thumbnail_iconise));
	ro_gui_set_icon_selected_state(w, INTERFACE_USE_EXTERNAL_HOTLIST,
                                       nsoption_bool(external_hotlists));
	ro_gui_set_icon_string(w, INTERFACE_EXTERNAL_HOTLIST_APP,
                               (nsoption_charp(external_hotlist_app)) ?
                               nsoption_charp(external_hotlist_app) : "", false);

	ro_gui_set_icon_shaded_state(w, INTERFACE_EXTERNAL_HOTLIST_APP,
                                     !nsoption_bool(external_hotlists));

	/* initialise all functions for a newly created window */
	ro_gui_wimp_event_register_mouse_click(w,
			ro_gui_options_interface_click);
	ro_gui_wimp_event_register_button(w, INTERFACE_DEFAULT_BUTTON,
			ro_gui_options_interface_default);
	ro_gui_wimp_event_register_cancel(w, INTERFACE_CANCEL_BUTTON);
	ro_gui_wimp_event_register_ok(w, INTERFACE_OK_BUTTON,
			ro_gui_options_interface_ok);
	ro_gui_wimp_event_set_help_prefix(w, "HelpInterfaceConfig");
	ro_gui_wimp_event_memorise(w);
	return true;

}
Ejemplo n.º 4
0
void gui_quit(void)
{
    LOG((""));

    struct gui_window * gw = window_list;
    struct gui_window * tmp = window_list;

    while( gw ) {
        tmp = gw->next;
        browser_window_destroy(gw->browser->bw);
        gw = tmp;
    }

    global_history_destroy();
    hotlist_destroy();
    toolbar_exit();

    urldb_save_cookies(nsoption_charp(cookie_file));
    urldb_save(nsoption_charp(url_file));

    deskmenu_destroy();
    gemtk_wm_exit();

    rsrc_free();

    LOG(("Shutting down plotter"));
    plot_finalise();
    LOG(("done"));
}
Ejemplo n.º 5
0
bool ro_gui_options_language_initialise(wimp_w w)
{
	/* set the current values */
	ro_gui_set_icon_string(w, LANGUAGE_INTERFACE_FIELD,
		ro_gui_options_language_name(nsoption_charp(language) ?
			nsoption_charp(language) : "en"), true);
	ro_gui_set_icon_string(w, LANGUAGE_WEB_PAGES_FIELD,
		ro_gui_options_language_name(nsoption_charp(accept_language) ?
			nsoption_charp(accept_language) : "en"), true);

	/* initialise all functions for a newly created window */
	ro_gui_wimp_event_register_menu_gright(w, LANGUAGE_INTERFACE_FIELD,
			LANGUAGE_INTERFACE_GRIGHT, languages_menu);
	ro_gui_wimp_event_register_menu_gright(w, LANGUAGE_WEB_PAGES_FIELD,
			LANGUAGE_WEB_PAGES_GRIGHT, languages_menu);
	ro_gui_wimp_event_register_button(w, LANGUAGE_DEFAULT_BUTTON,
			ro_gui_options_language_default);
	ro_gui_wimp_event_register_cancel(w, LANGUAGE_CANCEL_BUTTON);
	ro_gui_wimp_event_register_ok(w, LANGUAGE_OK_BUTTON,
			ro_gui_options_language_ok);
	ro_gui_wimp_event_set_help_prefix(w, "HelpLanguageConfig");
	ro_gui_wimp_event_memorise(w);
	return true;

}
Ejemplo n.º 6
0
void ami_theme_init(void)
{
	char themefile[1024];
	char searchico[1024];
	BPTR lock = 0;

	strcpy(themefile,nsoption_charp(theme));
	AddPart(themefile,"Theme",100);

	lock = Lock(themefile,ACCESS_READ);

	if(!lock)
	{
		warn_user("ThemeApplyErr",nsoption_charp(theme));
		strcpy(themefile,"PROGDIR:Resources/Themes/Default/Theme");
		nsoption_set_charp(theme, (char *)strdup("PROGDIR:Resources/Themes/Default"));
	}
	else
	{
		UnLock(lock);
	}

	lock = Lock(themefile,ACCESS_READ);
	if(lock)
	{
		UnLock(lock);
		messages_load(themefile);
	}

	ami_get_theme_filename(searchico, "theme_search", false);
	search_default_ico_location = (char *)strdup(searchico);
}
Ejemplo n.º 7
0
Archivo: gui.c Proyecto: mmuman/NetSurf
static void gui_quit(void)
{
    LOG("quitting");

    struct gui_window *gw = window_list;
    struct gui_window *tmp = window_list;

    /* Destroy all remaining browser windows: */
    while (gw) {
	tmp = gw->next;
	browser_window_destroy(gw->browser->bw);
	gw = tmp;
    }

    /* destroy the treeview windows: */
    atari_global_history_destroy();
    atari_hotlist_destroy();
    atari_cookie_manager_destroy();

    /* shutdown the toolbar framework: */
    toolbar_exit();

    /* save persistent informations: */
    urldb_save_cookies(nsoption_charp(cookie_file));
    urldb_save(nsoption_charp(url_file));

    deskmenu_destroy();
    gemtk_wm_exit();

    rsrc_free();

    LOG("Shutting down plotter");
    plot_finalise();
    LOG("done");
}
Ejemplo n.º 8
0
bool ro_gui_options_home_initialise(wimp_w w)
{
	/* set the current values */
	ro_gui_set_icon_string(w, HOME_URL_FIELD,
                               nsoption_charp(homepage_url) ? 
                               nsoption_charp(homepage_url) : "", true);

	ro_gui_set_icon_selected_state(w, HOME_OPEN_STARTUP,
                                       nsoption_bool(open_browser_at_startup));

	ro_gui_set_icon_shaded_state(w,
			HOME_URL_GRIGHT, !ro_gui_url_suggest_prepare_menu());

	/* initialise all functions for a newly created window */
	ro_gui_wimp_event_register_menu_gright(w, HOME_URL_FIELD,
			HOME_URL_GRIGHT, ro_gui_url_suggest_menu);
	ro_gui_wimp_event_register_checkbox(w, HOME_OPEN_STARTUP);
	ro_gui_wimp_event_register_button(w, HOME_DEFAULT_BUTTON,
			ro_gui_options_home_default);
	ro_gui_wimp_event_register_cancel(w, HOME_CANCEL_BUTTON);
	ro_gui_wimp_event_register_ok(w, HOME_OK_BUTTON,
			ro_gui_options_home_ok);
	ro_gui_wimp_event_register_menu_prepare(w,
			ro_gui_options_home_menu_prepare);
	ro_gui_wimp_event_set_help_prefix(w, "HelpHomeConfig");
	ro_gui_wimp_event_memorise(w);
	return true;

}
Ejemplo n.º 9
0
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
	/* Set defaults for absent option strings */
	nsoption_setnull_charp(cookie_file, strdup("~/.netsurf/Cookies"));
	nsoption_setnull_charp(cookie_jar, strdup("~/.netsurf/Cookies"));

	if (nsoption_charp(cookie_file) == NULL ||
			nsoption_charp(cookie_jar == NULL)) {
		die("Failed initialising cookie options");
	}
}
Ejemplo n.º 10
0
static void gui_quit(void)
{
	urldb_save_cookies(nsoption_charp(cookie_jar));
	urldb_save(nsoption_charp(url_file));
	//options_save_tree(hotlist,nsoption_charp(hotlist_file),messages_get("TreeHotlist"));

	free(nsoption_charp(cookie_file));
	free(nsoption_charp(cookie_jar));
	beos_fetch_filetype_fin();
	fetch_rsrc_unregister();
}
Ejemplo n.º 11
0
void gui_quit(void)
{
	nsgtk_download_destroy();
	urldb_save_cookies(nsoption_charp(cookie_jar));
	urldb_save(nsoption_charp(url_file));
	nsgtk_cookies_destroy();
	nsgtk_history_destroy();
	nsgtk_hotlist_destroy();
	sslcert_cleanup();
	free(print_options_file_location);
	free(search_engines_file_location);
	free(search_default_ico_location);
	free(toolbar_indices_file_location);
	gtk_fetch_filetype_fin();
}
Ejemplo n.º 12
0
/* exported interface documented in gtk/layout_pango.h */
PangoFontDescription *
nsfont_style_to_description(const plot_font_style_t *fstyle)
{
	unsigned int size;
	PangoFontDescription *desc;
	PangoStyle style = PANGO_STYLE_NORMAL;

	switch (fstyle->family) {
	case PLOT_FONT_FAMILY_SERIF:
		desc = pango_font_description_from_string(nsoption_charp(font_serif));
		break;
	case PLOT_FONT_FAMILY_MONOSPACE:
		desc = pango_font_description_from_string(nsoption_charp(font_mono));
		break;
	case PLOT_FONT_FAMILY_CURSIVE:
		desc = pango_font_description_from_string(nsoption_charp(font_cursive));
		break;
	case PLOT_FONT_FAMILY_FANTASY:
		desc = pango_font_description_from_string(nsoption_charp(font_fantasy));
		break;
	case PLOT_FONT_FAMILY_SANS_SERIF:
	default:
		desc = pango_font_description_from_string(nsoption_charp(font_sans));
		break;
	}

	size = (fstyle->size * PANGO_SCALE) / FONT_SIZE_SCALE;

	if (fstyle->flags & FONTF_ITALIC)
		style = PANGO_STYLE_ITALIC;
	else if (fstyle->flags & FONTF_OBLIQUE)
		style = PANGO_STYLE_OBLIQUE;

	pango_font_description_set_style(desc, style);

	pango_font_description_set_weight(desc, (PangoWeight) fstyle->weight);

	pango_font_description_set_size(desc, size);

	if (fstyle->flags & FONTF_SMALLCAPS) {
		pango_font_description_set_variant(desc, 
				PANGO_VARIANT_SMALL_CAPS);
	} else {
		pango_font_description_set_variant(desc, PANGO_VARIANT_NORMAL);
	}

	return desc;
}
Ejemplo n.º 13
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));
}
Ejemplo n.º 14
0
END_HANDLER

COMBO_CHANGED(comboSearch, search_provider)	
{
	nsgtk_scaffolding *current = scaf_list;
	char *name;

	/* refresh web search prefs from file */
	search_web_provider_details(nsoption_charp(search_provider));

	/* retrieve ico */
	search_web_retrieve_ico(false);

	/* callback may handle changing gui */
	if (search_web_ico() != NULL)
		gui_window_set_search_ico(search_web_ico());

	/* set entry */
	name = search_web_provider_name();
	if (name == NULL) {
		warn_user(messages_get("NoMemory"), 0);
		continue;
	}
	char content[strlen(name) + SLEN("Search ") + 1];
	sprintf(content, "Search %s", name);
	free(name);
	while (current) {
		nsgtk_scaffolding_set_websearch(current, content);
		current = nsgtk_scaffolding_iterate(current);
	}
}
Ejemplo n.º 15
0
Archivo: menu.c Proyecto: ysei/NetSurf
static void ami_menu_item_arexx_execute(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
	char *temp;
	struct gui_window_2 *gwin;
	GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);

	if(AslRequestTags(filereq,
						ASLFR_Window, gwin->win,
						ASLFR_SleepWindow, TRUE,
						ASLFR_TitleText, messages_get("NetSurf"),
						ASLFR_Screen, scrn,
						ASLFR_DoSaveMode, FALSE,
						ASLFR_InitialDrawer, nsoption_charp(arexx_dir),
						ASLFR_InitialPattern, "#?.nsrx",
						TAG_DONE))
	{
		if(temp = AllocVecTagList(1024, NULL))
		{
			strlcpy(temp, filereq->fr_Drawer, 1024);
			AddPart(temp, filereq->fr_File, 1024);
			ami_arexx_execute(temp);
			FreeVec(temp);
		}
	}
}
Ejemplo n.º 16
0
static CHOOSEFONT *nsws_prefs_font_prepare(int fontfamily, HWND parent)
{
	CHOOSEFONT *cf = malloc(sizeof(CHOOSEFONT));
	if (cf == NULL) {
		warn_user(messages_get("NoMemory"),0);
		return NULL;
	}
	LOGFONT *lf = malloc(sizeof(LOGFONT));
	if (lf == NULL) {
		warn_user(messages_get("NoMemory"),0);
		free(cf);
		return NULL;
	}
	switch(fontfamily) {
	case FF_ROMAN:
		snprintf(lf->lfFaceName, LF_FACESIZE, "%s",
			 nsoption_charp(font_serif));
		break;
	case FF_MODERN:
		snprintf(lf->lfFaceName, LF_FACESIZE, "%s",
			 nsoption_charp(font_mono));
		break;
	case FF_SCRIPT:
		snprintf(lf->lfFaceName, LF_FACESIZE, "%s",
			 nsoption_charp(font_cursive));
		break;
	case FF_DECORATIVE:
		snprintf(lf->lfFaceName, LF_FACESIZE, "%s",
			 nsoption_charp(font_fantasy));
		break;
	case FF_SWISS:
	default:
		snprintf(lf->lfFaceName, LF_FACESIZE, "%s",
			 nsoption_charp(font_sans));
		break;
	}

	cf->lStructSize = sizeof(CHOOSEFONT);
	cf->hwndOwner = parent;
	cf->lpLogFont = lf;
	cf->Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT | CF_LIMITSIZE;
	cf->nSizeMin = 16;
	cf->nSizeMax = 24;

	return cf;
}
Ejemplo n.º 17
0
static void __CDECL menu_ghistory(WINDOW *win, int item, int title, void *data)
{
	LOG(("%s", __FUNCTION__));
	char buf[PATH_MAX];
	strcpy((char*)&buf, "file://");
	strncat((char*)&buf, nsoption_charp(url_file), PATH_MAX - (strlen("file://")+1) );
	browser_window_create((char*)&buf, 0, 0, true, false);
}
Ejemplo n.º 18
0
static void gui_quit(void)
{
	LOG(("gui_quit"));

	urldb_save_cookies(nsoption_charp(cookie_jar));

	framebuffer_finalise();
}
Ejemplo n.º 19
0
Archivo: menu.c Proyecto: ysei/NetSurf
void ami_menu_arexx_scan(struct gui_window_2 *gwin)
{
	int item = AMI_MENU_AREXX;
	BPTR lock = 0;
	UBYTE *buffer;
	struct ExAllControl *ctrl;
	char matchpatt[16];
	LONG cont;
	struct ExAllData *ead;
	char *menu_lab;

	if(lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))
	{
		if(buffer = AllocVecTagList(1024, NULL))
		{
			if(ctrl = AllocDosObject(DOS_EXALLCONTROL,NULL))
			{
				ctrl->eac_LastKey = 0;

				if(ParsePatternNoCase("#?.nsrx",(char *)&matchpatt,16) != -1)
				{
					ctrl->eac_MatchString = (char *)&matchpatt;
				}

				do
				{
					cont = ExAll(lock,(struct ExAllData *)buffer,1024,ED_COMMENT,ctrl);
					if((!cont) && (IoErr() != ERROR_NO_MORE_ENTRIES)) break;
					if(!ctrl->eac_Entries) continue;

					for(ead = (struct ExAllData *)buffer; ead; ead = ead->ed_Next)
					{
						if(item >= AMI_MENU_AREXX_MAX) continue;
						if(EAD_IS_FILE(ead))
						{
							gwin->menu[item].nm_Type = NM_ITEM;
							if(ead->ed_Comment[0] != '\0')
								menu_lab = ead->ed_Comment;
							else
								menu_lab = ead->ed_Name;

							ami_menu_alloc_item(gwin, item, NM_ITEM, menu_lab, 0, NULL,
								ami_menu_item_arexx_entries, (void *)strdup(ead->ed_Name));

							item++;
						}
					}
				}while(cont);
				FreeDosObject(DOS_EXALLCONTROL,ctrl);
			}
			FreeVec(buffer);
		}
		UnLock(lock);
	}

	gwin->menu[item].nm_Type = NM_END;
	gwin->menu[item].nm_Label = NULL;
}
Ejemplo n.º 20
0
static void gui_quit(void)
{
	LOG("Quitting GUI");

	/* Ensure all scaffoldings are destroyed before we go into exit */
	nsgtk_download_destroy();
	urldb_save_cookies(nsoption_charp(cookie_jar));
	urldb_save(nsoption_charp(url_file));
	nsgtk_cookies_destroy();
	nsgtk_history_destroy();
	nsgtk_hotlist_destroy();

	free(toolbar_indices_file_location);

	free(nsgtk_config_home);

	gtk_fetch_filetype_fin();
}
Ejemplo n.º 21
0
/**
 * Set option defaults for framebuffer frontend
 *
 * @param defaults The option table to update.
 * @return error status.
 */
static nserror set_defaults(struct nsoption_s *defaults)
{
	/* Set defaults for absent option strings */
	nsoption_setnull_charp(cookie_file, strdup("~/.netsurf/Cookies"));
	nsoption_setnull_charp(cookie_jar, strdup("~/.netsurf/Cookies"));

	if (nsoption_charp(cookie_file) == NULL ||
	    nsoption_charp(cookie_jar) == NULL) {
		LOG(("Failed initialising cookie options"));
		return NSERROR_BAD_PARAMETER;
	}

	/* set system colours for framebuffer ui */
	nsoption_set_colour(sys_colour_ActiveBorder, 0x00000000);
	nsoption_set_colour(sys_colour_ActiveCaption, 0x00ddddcc);
	nsoption_set_colour(sys_colour_AppWorkspace, 0x00eeeeee);
	nsoption_set_colour(sys_colour_Background, 0x00aa0000);
	nsoption_set_colour(sys_colour_ButtonFace, 0x00dddddd);
	nsoption_set_colour(sys_colour_ButtonHighlight, 0x00cccccc);
	nsoption_set_colour(sys_colour_ButtonShadow, 0x00bbbbbb);
	nsoption_set_colour(sys_colour_ButtonText, 0x00000000);
	nsoption_set_colour(sys_colour_CaptionText, 0x00000000);
	nsoption_set_colour(sys_colour_GrayText, 0x00777777);
	nsoption_set_colour(sys_colour_Highlight, 0x00ee0000);
	nsoption_set_colour(sys_colour_HighlightText, 0x00000000);
	nsoption_set_colour(sys_colour_InactiveBorder, 0x00000000);
	nsoption_set_colour(sys_colour_InactiveCaption, 0x00ffffff);
	nsoption_set_colour(sys_colour_InactiveCaptionText, 0x00cccccc);
	nsoption_set_colour(sys_colour_InfoBackground, 0x00aaaaaa);
	nsoption_set_colour(sys_colour_InfoText, 0x00000000);
	nsoption_set_colour(sys_colour_Menu, 0x00aaaaaa);
	nsoption_set_colour(sys_colour_MenuText, 0x00000000);
	nsoption_set_colour(sys_colour_Scrollbar, 0x00aaaaaa);
	nsoption_set_colour(sys_colour_ThreeDDarkShadow, 0x00555555);
	nsoption_set_colour(sys_colour_ThreeDFace, 0x00dddddd);
	nsoption_set_colour(sys_colour_ThreeDHighlight, 0x00aaaaaa);
	nsoption_set_colour(sys_colour_ThreeDLightShadow, 0x00999999);
	nsoption_set_colour(sys_colour_ThreeDShadow, 0x00777777);
	nsoption_set_colour(sys_colour_Window, 0x00aaaaaa);
	nsoption_set_colour(sys_colour_WindowFrame, 0x00000000);
	nsoption_set_colour(sys_colour_WindowText, 0x00000000);

	return NSERROR_OK;
}
Ejemplo n.º 22
0
Archivo: gui.c Proyecto: mmuman/NetSurf
/**
 * Set option defaults for atari frontend
 *
 * @param defaults The option table to update.
 * @return error status.
 */
static nserror set_defaults(struct nsoption_s *defaults)
{
    /* Set defaults for absent option strings */
    nsoption_setnull_charp(cookie_file, strdup("cookies"));
    if (nsoption_charp(cookie_file) == NULL) {
	LOG("Failed initialising string options");
	return NSERROR_BAD_PARAMETER;
    }
    return NSERROR_OK;
}
Ejemplo n.º 23
0
bool ro_gui_options_fonts_initialise(wimp_w w)
{
	/* set the current values */
	ro_gui_set_icon_decimal(w, FONT_DEFAULT_SIZE, nsoption_int(font_size), 1);
	ro_gui_set_icon_decimal(w, FONT_MINIMUM_SIZE, nsoption_int(font_min_size), 1);
	ro_gui_set_icon_string(w, FONT_SANS_FIELD, nsoption_charp(font_sans), true);
	ro_gui_set_icon_string(w, FONT_SERIF_FIELD, nsoption_charp(font_serif), true);
	ro_gui_set_icon_string(w, FONT_MONOSPACE_FIELD, nsoption_charp(font_mono), true);
	ro_gui_set_icon_string(w, FONT_CURSIVE_FIELD, nsoption_charp(font_cursive), true);
	ro_gui_set_icon_string(w, FONT_FANTASY_FIELD, nsoption_charp(font_fantasy), true);
	ro_gui_set_icon_string(w, FONT_DEFAULT_FIELD,
			       font_names[nsoption_int(font_default)], true);

	if (!ro_gui_options_fonts_init_menu())
		return false;

	/* initialise all functions for a newly created window */
	ro_gui_wimp_event_register_menu_gright(w, FONT_SANS_FIELD,
			FONT_SANS_MENU, rufl_family_menu);
	ro_gui_wimp_event_register_menu_gright(w, FONT_SERIF_FIELD,
			FONT_SERIF_MENU, rufl_family_menu);
	ro_gui_wimp_event_register_menu_gright(w, FONT_MONOSPACE_FIELD,
			FONT_MONOSPACE_MENU, rufl_family_menu);
	ro_gui_wimp_event_register_menu_gright(w, FONT_CURSIVE_FIELD,
			FONT_CURSIVE_MENU, rufl_family_menu);
	ro_gui_wimp_event_register_menu_gright(w, FONT_FANTASY_FIELD,
			FONT_FANTASY_MENU, rufl_family_menu);
	ro_gui_wimp_event_register_menu_gright(w, FONT_DEFAULT_FIELD,
			FONT_DEFAULT_MENU, default_menu);
	ro_gui_wimp_event_register_numeric_field(w, FONT_DEFAULT_SIZE,
			FONT_DEFAULT_INC, FONT_DEFAULT_DEC, 50, 1000, 1, 1);
	ro_gui_wimp_event_register_numeric_field(w, FONT_MINIMUM_SIZE,
			FONT_MINIMUM_INC, FONT_MINIMUM_DEC, 10, 500, 1, 1);
	ro_gui_wimp_event_register_button(w, FONT_DEFAULT_BUTTON,
			ro_gui_options_fonts_default);
	ro_gui_wimp_event_register_cancel(w, FONT_CANCEL_BUTTON);
	ro_gui_wimp_event_register_ok(w, FONT_OK_BUTTON,
			ro_gui_options_fonts_ok);
	ro_gui_wimp_event_set_help_prefix(w, "HelpFontConfig");
	ro_gui_wimp_event_memorise(w);
	return true;

}
Ejemplo n.º 24
0
/* Documented in desktop/options.h */
void gui_options_init_defaults(void)
{
    /* Set defaults for absent option strings */
    nsoption_setnull_charp(cookie_file, strdup("cookies"));
    if (nsoption_charp(cookie_file) == NULL) {
        die("Failed initialising string options");
    }

    nsoption_set_int(min_reflow_period, 350);
}
Ejemplo n.º 25
0
bool ro_gui_theme_install_apply(wimp_w w)
{
	char theme_save[256];
	char *theme_file;
	struct theme_descriptor *theme_install;
	os_error *error;
	char *fix;
	const char *source_data;
	unsigned long source_size;

	assert(theme_install_content);

	/* convert spaces to hard spaces */
	theme_file = strdup(theme_install_descriptor.name);
	if (!theme_file) {
	  	LOG(("malloc failed"));
	  	warn_user("NoMemory", 0);
		return false;
	}
	for (fix = theme_file; *fix != '\0'; fix++)
		if (*fix == ' ')
			*fix = 160;	/* hard space */

	/* simply overwrite previous theme versions */
	snprintf(theme_save, sizeof theme_save, "%s.%s",
                 nsoption_charp(theme_save), theme_file);

	theme_save[sizeof theme_save - 1] = '\0';

	source_data = content_get_source_data(theme_install_content, 
			&source_size);

	error = xosfile_save_stamped(theme_save, 0xffd,
			(byte *) source_data,
			(byte *) source_data + source_size);
	if (error) {
		LOG(("xosfile_save_stamped: 0x%x: %s",
				error->errnum, error->errmess));
		warn_user("ThemeInstallErr", 0);
		free(theme_file);
		return false;
	}

	/* apply the new theme */
	ro_gui_theme_get_available();
	theme_install = ro_gui_theme_find(theme_file);
	if (!theme_install || !ro_gui_theme_apply(theme_install)) {
		warn_user("ThemeApplyErr", 0);
	} else {
            nsoption_set_charp(theme, strdup(theme_install->leafname));
	}
	free(theme_file);
	ro_gui_save_options();
	return true;
}
Ejemplo n.º 26
0
void gui_drag_save_object(struct gui_window *g, struct hlcache_handle *c,
		gui_save_type type)
{
	const char *filetype = NULL;

	/* Check we are running on Workbench */
	if(nsoption_charp(pubscreen_name) == NULL) return;
	if(strcmp(nsoption_charp(pubscreen_name), "Workbench")) return;

	switch(type) {
		case GUI_SAVE_OBJECT_ORIG: // object
		case GUI_SAVE_SOURCE:
			filetype = ami_mime_content_to_filetype(c);
		break;
		case GUI_SAVE_COMPLETE:
			filetype = "drawer";
		break;
		case GUI_SAVE_OBJECT_NATIVE:
#ifdef WITH_NS_SVG
			if(ami_mime_compare(c, "svg") == true)
			{
				filetype = "dr2d";
			}
			else
#endif
			{
				filetype = "ilbm";
			}
		break;

		default:
		break;
	}

	ami_drag_icon_show(g->shared->win, filetype);

	drag_save_data = c;
	drag_save_gui = g;
	drag_save = type;
}
Ejemplo n.º 27
0
Archivo: gui.c Proyecto: mmuman/NetSurf
/**
 * Set option defaults for gtk frontend.
 *
 * @param defaults The option table to update.
 * @return error status.
 */
static nserror set_defaults(struct nsoption_s *defaults)
{
	char *fname;

	/* cookie file default */
	fname = NULL;
	netsurf_mkpath(&fname, NULL, 2, nsgtk_config_home, "Cookies");
	if (fname != NULL) {
		nsoption_setnull_charp(cookie_file, fname);
	}

	/* cookie jar default */
	fname = NULL;
	netsurf_mkpath(&fname, NULL, 2, nsgtk_config_home, "Cookies");
	if (fname != NULL) {
		nsoption_setnull_charp(cookie_jar, fname);
	}

	/* url database default */
	fname = NULL;
	netsurf_mkpath(&fname, NULL, 2, nsgtk_config_home, "URLs");
	if (fname != NULL) {
		nsoption_setnull_charp(url_file, fname);
	}

	/* bookmark database default */
	fname = NULL;
	netsurf_mkpath(&fname, NULL, 2, nsgtk_config_home, "Hotlist");
	if (fname != NULL) {
		nsoption_setnull_charp(hotlist_path, fname);
	}

	/* download directory default */
	fname = getenv("HOME");
	if (fname != NULL) {
		nsoption_setnull_charp(downloads_directory, strdup(fname));
	}

	/* default path to certificates */
	nsoption_setnull_charp(ca_path, strdup("/etc/ssl/certs"));

	if ((nsoption_charp(cookie_file) == NULL) ||
	    (nsoption_charp(cookie_jar) == NULL) ||
	    (nsoption_charp(url_file) == NULL) ||
	    (nsoption_charp(hotlist_path) == NULL) ||
	    (nsoption_charp(downloads_directory) == NULL) ||
	    (nsoption_charp(ca_path) == NULL)) {
		LOG("Failed initialising default resource paths");
		return NSERROR_BAD_PARAMETER;
	}

	/* set default font names */
	nsoption_set_charp(font_sans, strdup("Sans"));
	nsoption_set_charp(font_serif, strdup("Serif"));
	nsoption_set_charp(font_mono, strdup("Monospace"));
	nsoption_set_charp(font_cursive, strdup("Serif"));
	nsoption_set_charp(font_fantasy, strdup("Serif"));

	return NSERROR_OK;
}
Ejemplo n.º 28
0
/**
 * Initialize font handling.
 *
 * Exits through die() on error.
 */
void nsfont_init(void)
{
	const char *fallback;
	rufl_code code;

	nsfont_check_fonts();

	LOG("Initialise RUfl");
	code = rufl_init();
	if (code != rufl_OK) {
		if (code == rufl_FONT_MANAGER_ERROR)
			LOG("rufl_init: rufl_FONT_MANAGER_ERROR: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess);
		else
			LOG("rufl_init: 0x%x", code);
		die("The Unicode font library could not be initialized. "
				"Please report this to the developers.");
	}
	LOG("RUfl initialised");

	if (rufl_family_list_entries == 0)
		die("No fonts could be found. At least one font must be "
				"installed.");

	fallback = nsfont_fallback_font();

	nsfont_check_option(&nsoption_charp(font_sans), "Homerton", fallback);
	nsfont_check_option(&nsoption_charp(font_serif), "Trinity", fallback);
	nsfont_check_option(&nsoption_charp(font_mono), "Corpus", fallback);
	nsfont_check_option(&nsoption_charp(font_cursive), "Churchill", fallback);
	nsfont_check_option(&nsoption_charp(font_fantasy), "Sassoon", fallback);

	if (nsoption_int(font_default) != PLOT_FONT_FAMILY_SANS_SERIF &&
            nsoption_int(font_default) != PLOT_FONT_FAMILY_SERIF &&
            nsoption_int(font_default) != PLOT_FONT_FAMILY_MONOSPACE &&
            nsoption_int(font_default) != PLOT_FONT_FAMILY_CURSIVE &&
            nsoption_int(font_default) != PLOT_FONT_FAMILY_FANTASY) {
            nsoption_set_int(font_default, PLOT_FONT_FAMILY_SANS_SERIF);
        }
}
Ejemplo n.º 29
0
void ami_file_req_init(void)
{
	filereq = (struct FileRequester *)AllocAslRequest(ASL_FileRequest, NULL);
	savereq = (struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
							ASLFR_DoSaveMode, TRUE,
							ASLFR_RejectIcons, TRUE,
							ASLFR_InitialDrawer, nsoption_charp(download_dir),
							TAG_DONE);

	aslhookfunc.h_Entry = (void *)&ami_file_asl_mime_hook;
	aslhookfunc.h_SubEntry = NULL;
	aslhookfunc.h_Data = NULL;
}
Ejemplo n.º 30
0
bool ro_gui_options_language_ok(wimp_w w)
{
	const char *code;
	char *temp;

	code = ro_gui_menu_find_menu_entry_key(languages_menu,
			ro_gui_get_icon_string(w, LANGUAGE_INTERFACE_FIELD));
	if (code) {
		code += 5;	/* skip 'lang_' */
		if ((!nsoption_charp(language)) || 
                    (strcmp(nsoption_charp(language), code))) {
			temp = strdup(code);
			if (temp) {
				nsoption_set_charp(language, temp);
			} else {
				LOG("No memory to duplicate language code");
				warn_user("NoMemory", 0);
			}
		}
	}
	code = ro_gui_menu_find_menu_entry_key(languages_menu,
			ro_gui_get_icon_string(w, LANGUAGE_WEB_PAGES_FIELD));
	if (code) {
		code += 5;	/* skip 'lang_' */
		if ((!nsoption_charp(accept_language)) ||
                    (strcmp(nsoption_charp(accept_language), code))) {
			temp = strdup(code);
			if (temp) {
				nsoption_set_charp(accept_language,temp);
			} else {
				LOG("No memory to duplicate language code");
				warn_user("NoMemory", 0);
			}
		}
	}
	ro_gui_save_options();
	return true;
}