Esempio n. 1
0
void Index::setColor(string const & str)
{
	if (str.size() == 7 && str[0] == '#')
		color_ = rgbFromHexName(str);
	else {
		// no color set or invalid color -- use predefined color
		// no theApp() with command line export
		if (theApp())
			theApp()->getRgbColor(Color_indexlabel, color_);
		else
			frontend::Application::getRgbColorUncached(Color_indexlabel, color_);
	}
}
Esempio n. 2
0
void Branch::setColor(string const & str)
{
	if (str.size() == 7 && str[0] == '#')
		color_ = rgbFromHexName(str);
	else {
		// no color set or invalid color - use normal background
		// no theApp() with command line export
		if (theApp())
			theApp()->getRgbColor(Color_background, color_);
		else
			frontend::Application::getRgbColorUncached(Color_background, color_);
	}
}
Esempio n. 3
0
docstring const LaTeXFeatures::getMacros() const
{
	odocstringstream macros;

	if (!preamble_snippets_.empty()) {
		macros << '\n';
		macros << from_utf8(getPreambleSnippets());
	}

	if (mustProvide("papersize")) {
		if (runparams_.flavor == OutputParams::LATEX)
			macros << papersizedvi_def << '\n';
		else
			macros << papersizepdf_def << '\n';
	}

	if (mustProvide("LyX"))
		macros << lyx_def << '\n';

	if (mustProvide("lyxline"))
		macros << lyxline_def << '\n';

	if (mustProvide("noun"))
		macros << noun_def << '\n';

	if (mustProvide("lyxarrow"))
		macros << lyxarrow_def << '\n';

	if (mustProvide("textgreek")) {
		// Avoid a LaTeX error if times fonts are used and the grtimes
		// package is installed but actual fonts are not (bug 6469).
		if (params_.fontsRoman == "times")
			macros << subst(textgreek_def,
					from_ascii("\\greektext #1"),
					from_ascii("%\n  \\IfFileExists"
						   "{grtm10.tfm}{}{\\fontfamily"
						   "{cmr}}\\greektext #1"))
			       << '\n';
		else
			macros << textgreek_def << '\n';
	}

	if (mustProvide("textcyr"))
		macros << textcyr_def << '\n';

	if (mustProvide("lyxmathsym"))
		macros << lyxmathsym_def << '\n';

	if (mustProvide("cedilla"))
		macros << cedilla_def << '\n';

	if (mustProvide("subring"))
		macros << subring_def << '\n';

	if (mustProvide("subdot"))
		macros << subdot_def << '\n';

	if (mustProvide("subhat"))
		macros << subhat_def << '\n';

	if (mustProvide("subtilde"))
		macros << subtilde_def << '\n';

	if (mustProvide("dacute"))
		macros << dacute_def << '\n';

	if (mustProvide("tipasymb"))
		macros << tipasymb_def << '\n';

	if (mustProvide("dgrave"))
		macros << dgrave_def << '\n';

	if (mustProvide("rcap"))
		macros << rcap_def << '\n';

	if (mustProvide("ogonek"))
		macros << ogonek_def << '\n';

	// quotes.
	if (mustProvide("quotesinglbase"))
		macros << quotesinglbase_def << '\n';
	if (mustProvide("quotedblbase"))
		macros << quotedblbase_def << '\n';
	if (mustProvide("guilsinglleft"))
		macros << guilsinglleft_def << '\n';
	if (mustProvide("guilsinglright"))
		macros << guilsinglright_def << '\n';
	if (mustProvide("guillemotleft"))
		macros << guillemotleft_def << '\n';
	if (mustProvide("guillemotright"))
		macros << guillemotright_def << '\n';

	// Math mode
	if (mustProvide("binom") && !isRequired("amsmath"))
		macros << binom_def << '\n';
	if (mustProvide("mathcircumflex"))
		macros << mathcircumflex_def << '\n';

	// other
	if (mustProvide("ParagraphLeftIndent"))
		macros << paragraphleftindent_def;
	if (mustProvide("NeedLyXFootnoteCode"))
		macros << floatingfootnote_def;

	// some problems with tex->html converters
	if (mustProvide("NeedTabularnewline"))
		macros << tabularnewline_def;

	// greyed-out environment (note inset)
	// the color is specified in the routine
	// getColorOptions() to avoid LaTeX-package clashes
	if (mustProvide("lyxgreyedout"))
		macros << lyxgreyedout_def;

	if (mustProvide("lyxdot"))
		macros << lyxdot_def << '\n';

	// floats
	getFloatDefinitions(macros);

	// change tracking
	if (mustProvide("ct-dvipost"))
		macros << changetracking_dvipost_def;

	if (mustProvide("ct-xcolor-ulem")) {
		int const prec = macros.precision(2);
	
		RGBColor cadd = rgbFromHexName(lcolor.getX11Name(Color_addedtext));
		macros << "\\providecolor{lyxadded}{rgb}{"
		       << cadd.r / 255.0 << ',' << cadd.g / 255.0 << ',' << cadd.b / 255.0 << "}\n";

		RGBColor cdel = rgbFromHexName(lcolor.getX11Name(Color_deletedtext));
		macros << "\\providecolor{lyxdeleted}{rgb}{"
		       << cdel.r / 255.0 << ',' << cdel.g / 255.0 << ',' << cdel.b / 255.0 << "}\n";

		macros.precision(prec);
		
		if (isRequired("hyperref"))
			macros << changetracking_xcolor_ulem_hyperref_def;
		else
			macros << changetracking_xcolor_ulem_def;
	}

	if (mustProvide("ct-none"))
		macros << changetracking_none_def;

	return macros.str();
}