mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 16:37:28 +00:00
Improved appearence of regexp insets (at least I hope so), also suggested in #6498 (Regex looks like math).
- added a frame around regexp insets, with a customizable dedicated color code - regexp insets font turned to texttt - recovered back the preamble snippet allowing for latex compilation of regexp insets, something that happens if you have instant preview on. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33329 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d652a84f4b
commit
9e057e7533
@ -241,6 +241,7 @@ ColorSet::ColorSet()
|
||||
{ Color_buttonhoverbg, N_("button background under focus"), "buttonhoverbg", "#C7C7CA", "buttonhoverbg" },
|
||||
{ Color_paragraphmarker, N_("paragraph marker"), "paragraphmarker", grey80, "paragraphmarker"},
|
||||
{ Color_inherit, N_("inherit"), "inherit", "black", "inherit" },
|
||||
{ Color_regexpframe, N_("regexp frame"), "regexpframe", "green", "regexpframe" },
|
||||
{ Color_ignore, N_("ignore"), "ignore", "black", "ignore" },
|
||||
{ Color_ignore, 0, 0, 0, 0 }
|
||||
};
|
||||
|
@ -196,6 +196,8 @@ enum ColorCode
|
||||
|
||||
/// Color is inherited
|
||||
Color_inherit,
|
||||
/// Color for regexp frame
|
||||
Color_regexpframe,
|
||||
/// For ignoring updates of a color
|
||||
Color_ignore
|
||||
};
|
||||
|
@ -312,7 +312,18 @@ int InsetMathHull::defaultColSpace(col_type col)
|
||||
|
||||
docstring InsetMathHull::standardFont() const
|
||||
{
|
||||
return from_ascii(type_ == hullNone ? "lyxnochange" : "mathnormal");
|
||||
const char *font_name;
|
||||
switch (type_) {
|
||||
case hullRegexp:
|
||||
font_name = "texttt";
|
||||
break;
|
||||
case hullNone:
|
||||
font_name = "lyxnochange";
|
||||
break;
|
||||
default:
|
||||
font_name = "mathnormal";
|
||||
}
|
||||
return from_ascii(font_name);
|
||||
}
|
||||
|
||||
|
||||
@ -393,6 +404,11 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
use_preview_ = previewState(pi.base.bv);
|
||||
|
||||
if (type_ == hullRegexp) {
|
||||
Dimension const dim = dimension(*pi.base.bv);
|
||||
pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
|
||||
dim.width() - 2, dim.height() - 2, Color_regexpframe);
|
||||
}
|
||||
if (use_preview_) {
|
||||
// one pixel gap in front
|
||||
preview_->draw(pi, x + 1, y);
|
||||
@ -620,6 +636,10 @@ void InsetMathHull::validate(LaTeXFeatures & features) const
|
||||
if (ams())
|
||||
features.require("amsmath");
|
||||
|
||||
if (type_ == hullRegexp)
|
||||
features.addPreambleSnippet(
|
||||
"\\newcommand{\\regexp}[1]{\\fbox{\\texttt{#1}}}");
|
||||
|
||||
// Validation is necessary only if not using AMS math.
|
||||
// To be safe, we will always run mathedvalidate.
|
||||
//if (features.amsstyle)
|
||||
|
Loading…
x
Reference in New Issue
Block a user