mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
Introduce strikeout text style (strike-through)
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg150743.html Somewhat related to http://www.lyx.org/trac/ticket/4248 . git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29523 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e4d9adc87c
commit
381b86788d
@ -62,6 +62,7 @@
|
|||||||
#\bind "C-k" "font-noun" # 'k' for capitals
|
#\bind "C-k" "font-noun" # 'k' for capitals
|
||||||
\bind "C-u" "font-underline"
|
\bind "C-u" "font-underline"
|
||||||
\bind "C-S-P" "font-typewriter" # 'P' for Program
|
\bind "C-S-P" "font-typewriter" # 'P' for Program
|
||||||
|
\bind "C-S-O" "font-strikeout"
|
||||||
|
|
||||||
\bind "C-m" "math-mode"
|
\bind "C-m" "math-mode"
|
||||||
\bind "C-S-M" "math-display"
|
\bind "C-S-M" "math-display"
|
||||||
|
@ -604,6 +604,14 @@ def revert_printindexall(document):
|
|||||||
document.body[i:k+1] = subst
|
document.body[i:k+1] = subst
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
|
def revert_strikeout(document):
|
||||||
|
" Reverts \\strike character style "
|
||||||
|
while True:
|
||||||
|
i = find_token(document.body, '\\strikeout', 0)
|
||||||
|
if i == -1:
|
||||||
|
return
|
||||||
|
del document.body[i]
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Conversion hub
|
# Conversion hub
|
||||||
@ -618,10 +626,12 @@ convert = [[346, []],
|
|||||||
[351, []],
|
[351, []],
|
||||||
[352, [convert_splitindex]],
|
[352, [convert_splitindex]],
|
||||||
[353, []],
|
[353, []],
|
||||||
[354, []]
|
[354, []],
|
||||||
|
[355, []]
|
||||||
]
|
]
|
||||||
|
|
||||||
revert = [[353, [revert_printindexall]],
|
revert = [[354, [revert_strikeout]],
|
||||||
|
[353, [revert_printindexall]],
|
||||||
[352, [revert_subindex]],
|
[352, [revert_subindex]],
|
||||||
[351, [revert_splitindex]],
|
[351, [revert_splitindex]],
|
||||||
[350, [revert_backgroundcolor]],
|
[350, [revert_backgroundcolor]],
|
||||||
|
@ -125,7 +125,7 @@ namespace {
|
|||||||
|
|
||||||
// Do not remove the comment below, so we get merge conflict in
|
// Do not remove the comment below, so we get merge conflict in
|
||||||
// independent branches. Instead add your own.
|
// independent branches. Instead add your own.
|
||||||
int const LYX_FORMAT = 354; // jspitzm: support for \print[sub]index*
|
int const LYX_FORMAT = 355; // sanda: support for \\sout
|
||||||
|
|
||||||
typedef map<string, bool> DepClean;
|
typedef map<string, bool> DepClean;
|
||||||
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
|
typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
|
||||||
|
32
src/Font.cpp
32
src/Font.cpp
@ -175,6 +175,9 @@ docstring const stateText(FontInfo const & f)
|
|||||||
if (f.underbar() != FONT_INHERIT)
|
if (f.underbar() != FONT_INHERIT)
|
||||||
os << bformat(_("Underline %1$s, "),
|
os << bformat(_("Underline %1$s, "),
|
||||||
_(GUIMiscNames[f.underbar()]));
|
_(GUIMiscNames[f.underbar()]));
|
||||||
|
if (f.strikeout() != FONT_INHERIT)
|
||||||
|
os << bformat(_("Strikeout %1$s, "),
|
||||||
|
_(GUIMiscNames[f.strikeout()]));
|
||||||
if (f.noun() != FONT_INHERIT)
|
if (f.noun() != FONT_INHERIT)
|
||||||
os << bformat(_("Noun %1$s, "),
|
os << bformat(_("Noun %1$s, "),
|
||||||
_(GUIMiscNames[f.noun()]));
|
_(GUIMiscNames[f.noun()]));
|
||||||
@ -329,6 +332,8 @@ FontInfo lyxRead(Lexer & lex, FontInfo const & fi)
|
|||||||
|
|
||||||
if (ttok == "no_bar") {
|
if (ttok == "no_bar") {
|
||||||
f.setUnderbar(FONT_OFF);
|
f.setUnderbar(FONT_OFF);
|
||||||
|
} else if (ttok == "no_strikeout") {
|
||||||
|
f.setStrikeout(FONT_OFF);
|
||||||
} else if (ttok == "no_emph") {
|
} else if (ttok == "no_emph") {
|
||||||
f.setEmph(FONT_OFF);
|
f.setEmph(FONT_OFF);
|
||||||
} else if (ttok == "no_noun") {
|
} else if (ttok == "no_noun") {
|
||||||
@ -337,6 +342,8 @@ FontInfo lyxRead(Lexer & lex, FontInfo const & fi)
|
|||||||
f.setEmph(FONT_ON);
|
f.setEmph(FONT_ON);
|
||||||
} else if (ttok == "underbar") {
|
} else if (ttok == "underbar") {
|
||||||
f.setUnderbar(FONT_ON);
|
f.setUnderbar(FONT_ON);
|
||||||
|
} else if (ttok == "strikeout") {
|
||||||
|
f.setStrikeout(FONT_ON);
|
||||||
} else if (ttok == "noun") {
|
} else if (ttok == "noun") {
|
||||||
f.setNoun(FONT_ON);
|
f.setNoun(FONT_ON);
|
||||||
} else {
|
} else {
|
||||||
@ -388,6 +395,9 @@ void Font::lyxWriteChanges(Font const & orgfont,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (orgfont.fontInfo().strikeout() != bits_.strikeout()) {
|
||||||
|
os << "\\strikeout " << LyXMiscNames[bits_.strikeout()] << "\n";
|
||||||
|
}
|
||||||
if (orgfont.fontInfo().noun() != bits_.noun()) {
|
if (orgfont.fontInfo().noun() != bits_.noun()) {
|
||||||
os << "\\noun " << LyXMiscNames[bits_.noun()] << "\n";
|
os << "\\noun " << LyXMiscNames[bits_.noun()] << "\n";
|
||||||
}
|
}
|
||||||
@ -526,6 +536,11 @@ int Font::latexWriteStartChanges(odocstream & os, BufferParams const & bparams,
|
|||||||
count += 10;
|
count += 10;
|
||||||
env = true; //We have opened a new environment
|
env = true; //We have opened a new environment
|
||||||
}
|
}
|
||||||
|
if (f.strikeout() == FONT_ON) {
|
||||||
|
os << "\\sout{";
|
||||||
|
count += 6;
|
||||||
|
env = true; //We have opened a new environment
|
||||||
|
}
|
||||||
// \noun{} is a LyX special macro
|
// \noun{} is a LyX special macro
|
||||||
if (f.noun() == FONT_ON) {
|
if (f.noun() == FONT_ON) {
|
||||||
os << "\\noun{";
|
os << "\\noun{";
|
||||||
@ -595,6 +610,11 @@ int Font::latexWriteEndChanges(odocstream & os, BufferParams const & bparams,
|
|||||||
++count;
|
++count;
|
||||||
env = true; // Size change need not bother about closing env.
|
env = true; // Size change need not bother about closing env.
|
||||||
}
|
}
|
||||||
|
if (f.strikeout() == FONT_ON) {
|
||||||
|
os << '}';
|
||||||
|
++count;
|
||||||
|
env = true; // Size change need not bother about closing env.
|
||||||
|
}
|
||||||
if (f.noun() == FONT_ON) {
|
if (f.noun() == FONT_ON) {
|
||||||
os << '}';
|
os << '}';
|
||||||
++count;
|
++count;
|
||||||
@ -654,6 +674,7 @@ string Font::toString(bool const toggle) const
|
|||||||
<< "size " << bits_.size() << '\n'
|
<< "size " << bits_.size() << '\n'
|
||||||
<< "emph " << bits_.emph() << '\n'
|
<< "emph " << bits_.emph() << '\n'
|
||||||
<< "underbar " << bits_.underbar() << '\n'
|
<< "underbar " << bits_.underbar() << '\n'
|
||||||
|
<< "strikeout " << bits_.strikeout() << '\n'
|
||||||
<< "noun " << bits_.noun() << '\n'
|
<< "noun " << bits_.noun() << '\n'
|
||||||
<< "number " << bits_.number() << '\n'
|
<< "number " << bits_.number() << '\n'
|
||||||
<< "color " << bits_.color() << '\n'
|
<< "color " << bits_.color() << '\n'
|
||||||
@ -695,7 +716,8 @@ bool Font::fromString(string const & data, bool & toggle)
|
|||||||
bits_.setSize(FontSize(next));
|
bits_.setSize(FontSize(next));
|
||||||
|
|
||||||
} else if (token == "emph" || token == "underbar" ||
|
} else if (token == "emph" || token == "underbar" ||
|
||||||
token == "noun" || token == "number") {
|
token == "noun" || token == "number" ||
|
||||||
|
token == "strikeout") {
|
||||||
|
|
||||||
int const next = lex.getInteger();
|
int const next = lex.getInteger();
|
||||||
FontState const misc = FontState(next);
|
FontState const misc = FontState(next);
|
||||||
@ -704,6 +726,8 @@ bool Font::fromString(string const & data, bool & toggle)
|
|||||||
bits_.setEmph(misc);
|
bits_.setEmph(misc);
|
||||||
else if (token == "underbar")
|
else if (token == "underbar")
|
||||||
bits_.setUnderbar(misc);
|
bits_.setUnderbar(misc);
|
||||||
|
else if (token == "strikeout")
|
||||||
|
bits_.setStrikeout(misc);
|
||||||
else if (token == "noun")
|
else if (token == "noun")
|
||||||
bits_.setNoun(misc);
|
bits_.setNoun(misc);
|
||||||
else if (token == "number")
|
else if (token == "number")
|
||||||
@ -747,6 +771,11 @@ void Font::validate(LaTeXFeatures & features) const
|
|||||||
features.require("noun");
|
features.require("noun");
|
||||||
LYXERR(Debug::LATEX, "Noun enabled. Font: " << to_utf8(stateText(0)));
|
LYXERR(Debug::LATEX, "Noun enabled. Font: " << to_utf8(stateText(0)));
|
||||||
}
|
}
|
||||||
|
if (bits_.strikeout() == FONT_ON) {
|
||||||
|
LYXERR(Debug::LATEX, "font.strikeout: " << bits_.strikeout());
|
||||||
|
features.require("ulem");
|
||||||
|
LYXERR(Debug::LATEX, "Strikeout enabled. Font: " << to_utf8(stateText(0)));
|
||||||
|
}
|
||||||
switch (bits_.color()) {
|
switch (bits_.color()) {
|
||||||
case Color_none:
|
case Color_none:
|
||||||
case Color_inherit:
|
case Color_inherit:
|
||||||
@ -791,6 +820,7 @@ ostream & operator<<(ostream & os, FontInfo const & f)
|
|||||||
//<< " background " << f.background()
|
//<< " background " << f.background()
|
||||||
<< " emph " << f.emph()
|
<< " emph " << f.emph()
|
||||||
<< " underbar " << f.underbar()
|
<< " underbar " << f.underbar()
|
||||||
|
<< " strikeout " << f.strikeout()
|
||||||
<< " noun " << f.noun()
|
<< " noun " << f.noun()
|
||||||
<< " number " << f.number();
|
<< " number " << f.number();
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ FontInfo const sane_font(
|
|||||||
FONT_OFF,
|
FONT_OFF,
|
||||||
FONT_OFF,
|
FONT_OFF,
|
||||||
FONT_OFF,
|
FONT_OFF,
|
||||||
|
FONT_OFF,
|
||||||
FONT_OFF);
|
FONT_OFF);
|
||||||
|
|
||||||
FontInfo const inherit_font(
|
FontInfo const inherit_font(
|
||||||
@ -44,6 +45,7 @@ FontInfo const inherit_font(
|
|||||||
FONT_INHERIT,
|
FONT_INHERIT,
|
||||||
FONT_INHERIT,
|
FONT_INHERIT,
|
||||||
FONT_INHERIT,
|
FONT_INHERIT,
|
||||||
|
FONT_INHERIT,
|
||||||
FONT_OFF);
|
FONT_OFF);
|
||||||
|
|
||||||
FontInfo const ignore_font(
|
FontInfo const ignore_font(
|
||||||
@ -56,6 +58,7 @@ FontInfo const ignore_font(
|
|||||||
FONT_IGNORE,
|
FONT_IGNORE,
|
||||||
FONT_IGNORE,
|
FONT_IGNORE,
|
||||||
FONT_IGNORE,
|
FONT_IGNORE,
|
||||||
|
FONT_IGNORE,
|
||||||
FONT_IGNORE);
|
FONT_IGNORE);
|
||||||
|
|
||||||
|
|
||||||
@ -141,6 +144,8 @@ void FontInfo::reduce(FontInfo const & tmplt)
|
|||||||
emph_ = FONT_INHERIT;
|
emph_ = FONT_INHERIT;
|
||||||
if (underbar_ == tmplt.underbar_)
|
if (underbar_ == tmplt.underbar_)
|
||||||
underbar_ = FONT_INHERIT;
|
underbar_ = FONT_INHERIT;
|
||||||
|
if (strikeout_ == tmplt.strikeout_)
|
||||||
|
strikeout_ = FONT_INHERIT;
|
||||||
if (noun_ == tmplt.noun_)
|
if (noun_ == tmplt.noun_)
|
||||||
noun_ = FONT_INHERIT;
|
noun_ = FONT_INHERIT;
|
||||||
if (color_ == tmplt.color_)
|
if (color_ == tmplt.color_)
|
||||||
@ -176,6 +181,9 @@ FontInfo & FontInfo::realize(FontInfo const & tmplt)
|
|||||||
if (underbar_ == FONT_INHERIT)
|
if (underbar_ == FONT_INHERIT)
|
||||||
underbar_ = tmplt.underbar_;
|
underbar_ = tmplt.underbar_;
|
||||||
|
|
||||||
|
if (strikeout_ == FONT_INHERIT)
|
||||||
|
strikeout_ = tmplt.strikeout_;
|
||||||
|
|
||||||
if (noun_ == FONT_INHERIT)
|
if (noun_ == FONT_INHERIT)
|
||||||
noun_ = tmplt.noun_;
|
noun_ = tmplt.noun_;
|
||||||
|
|
||||||
@ -252,6 +260,7 @@ void FontInfo::update(FontInfo const & newfont, bool toggleall)
|
|||||||
|
|
||||||
setEmph(setMisc(newfont.emph_, emph_));
|
setEmph(setMisc(newfont.emph_, emph_));
|
||||||
setUnderbar(setMisc(newfont.underbar_, underbar_));
|
setUnderbar(setMisc(newfont.underbar_, underbar_));
|
||||||
|
setStrikeout(setMisc(newfont.strikeout_, strikeout_));
|
||||||
setNoun(setMisc(newfont.noun_, noun_));
|
setNoun(setMisc(newfont.noun_, noun_));
|
||||||
setNumber(setMisc(newfont.number_, number_));
|
setNumber(setMisc(newfont.number_, number_));
|
||||||
|
|
||||||
@ -272,7 +281,7 @@ bool FontInfo::resolved() const
|
|||||||
return (family_ != INHERIT_FAMILY && series_ != INHERIT_SERIES
|
return (family_ != INHERIT_FAMILY && series_ != INHERIT_SERIES
|
||||||
&& shape_ != INHERIT_SHAPE && size_ != FONT_SIZE_INHERIT
|
&& shape_ != INHERIT_SHAPE && size_ != FONT_SIZE_INHERIT
|
||||||
&& emph_ != FONT_INHERIT && underbar_ != FONT_INHERIT
|
&& emph_ != FONT_INHERIT && underbar_ != FONT_INHERIT
|
||||||
&& noun_ != FONT_INHERIT
|
&& strikeout_ != FONT_INHERIT && noun_ != FONT_INHERIT
|
||||||
&& color_ != Color_inherit
|
&& color_ != Color_inherit
|
||||||
&& background_ != Color_inherit);
|
&& background_ != Color_inherit);
|
||||||
}
|
}
|
||||||
|
@ -41,11 +41,12 @@ public:
|
|||||||
ColorCode background,
|
ColorCode background,
|
||||||
FontState emph,
|
FontState emph,
|
||||||
FontState underbar,
|
FontState underbar,
|
||||||
|
FontState strikeout,
|
||||||
FontState noun,
|
FontState noun,
|
||||||
FontState number)
|
FontState number)
|
||||||
: family_(family), series_(series), shape_(shape), size_(size),
|
: family_(family), series_(series), shape_(shape), size_(size),
|
||||||
color_(color), background_(background), paint_color_(), emph_(emph),
|
color_(color), background_(background), paint_color_(), emph_(emph),
|
||||||
underbar_(underbar), noun_(noun), number_(number)
|
underbar_(underbar), strikeout_(strikeout), noun_(noun), number_(number)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/// Decreases font size by one
|
/// Decreases font size by one
|
||||||
@ -67,6 +68,8 @@ public:
|
|||||||
void setEmph(FontState e) { emph_ = e; }
|
void setEmph(FontState e) { emph_ = e; }
|
||||||
FontState underbar() const { return underbar_; }
|
FontState underbar() const { return underbar_; }
|
||||||
void setUnderbar(FontState u) { underbar_ = u; }
|
void setUnderbar(FontState u) { underbar_ = u; }
|
||||||
|
FontState strikeout() const { return strikeout_; }
|
||||||
|
void setStrikeout(FontState s) { strikeout_ = s; }
|
||||||
FontState noun() const { return noun_; }
|
FontState noun() const { return noun_; }
|
||||||
void setNoun(FontState n) { noun_ = n; }
|
void setNoun(FontState n) { noun_ = n; }
|
||||||
FontState number() const { return number_; }
|
FontState number() const { return number_; }
|
||||||
@ -145,6 +148,8 @@ private:
|
|||||||
///
|
///
|
||||||
FontState underbar_;
|
FontState underbar_;
|
||||||
///
|
///
|
||||||
|
FontState strikeout_;
|
||||||
|
///
|
||||||
FontState noun_;
|
FontState noun_;
|
||||||
///
|
///
|
||||||
FontState number_;
|
FontState number_;
|
||||||
@ -161,6 +166,7 @@ inline bool operator==(FontInfo const & lhs, FontInfo const & rhs)
|
|||||||
&& lhs.background_ == rhs.background_
|
&& lhs.background_ == rhs.background_
|
||||||
&& lhs.emph_ == rhs.emph_
|
&& lhs.emph_ == rhs.emph_
|
||||||
&& lhs.underbar_ == rhs.underbar_
|
&& lhs.underbar_ == rhs.underbar_
|
||||||
|
&& lhs.strikeout_ == rhs.strikeout_
|
||||||
&& lhs.noun_ == rhs.noun_
|
&& lhs.noun_ == rhs.noun_
|
||||||
&& lhs.number_ == rhs.number_;
|
&& lhs.number_ == rhs.number_;
|
||||||
}
|
}
|
||||||
|
@ -181,13 +181,13 @@ enum FuncCode
|
|||||||
LFUN_FONT_DEFAULT,
|
LFUN_FONT_DEFAULT,
|
||||||
// 125
|
// 125
|
||||||
LFUN_FONT_UNDERLINE,
|
LFUN_FONT_UNDERLINE,
|
||||||
|
LFUN_FONT_STRIKEOUT,
|
||||||
LFUN_FONT_SIZE,
|
LFUN_FONT_SIZE,
|
||||||
LFUN_FONT_STATE,
|
LFUN_FONT_STATE,
|
||||||
LFUN_WORD_UPCASE,
|
LFUN_WORD_UPCASE,
|
||||||
LFUN_WORD_LOWCASE,
|
|
||||||
// 130
|
// 130
|
||||||
|
LFUN_WORD_LOWCASE,
|
||||||
LFUN_WORD_CAPITALIZE,
|
LFUN_WORD_CAPITALIZE,
|
||||||
LFUN_LABEL_INSERT,
|
|
||||||
LFUN_DEPTH_DECREMENT,
|
LFUN_DEPTH_DECREMENT,
|
||||||
LFUN_DEPTH_INCREMENT,
|
LFUN_DEPTH_INCREMENT,
|
||||||
LFUN_MENU_OPEN, // used in bindings as of 20060905
|
LFUN_MENU_OPEN, // used in bindings as of 20060905
|
||||||
@ -429,7 +429,7 @@ enum FuncCode
|
|||||||
LFUN_MATH_BIGDELIM,
|
LFUN_MATH_BIGDELIM,
|
||||||
LFUN_MATH_FONT_STYLE,
|
LFUN_MATH_FONT_STYLE,
|
||||||
LFUN_SECTION_SELECT, // vfr, 20090503
|
LFUN_SECTION_SELECT, // vfr, 20090503
|
||||||
|
LFUN_LABEL_INSERT,
|
||||||
|
|
||||||
LFUN_LASTACTION // end of the table
|
LFUN_LASTACTION // end of the table
|
||||||
};
|
};
|
||||||
|
@ -1227,6 +1227,14 @@ void LyXAction::init()
|
|||||||
* \endvar
|
* \endvar
|
||||||
*/
|
*/
|
||||||
{ LFUN_FONT_UNDERLINE, "font-underline", Noop, Layout },
|
{ LFUN_FONT_UNDERLINE, "font-underline", Noop, Layout },
|
||||||
|
/*!
|
||||||
|
* \var lyx::FuncCode lyx::LFUN_FONT_STRIKEOUT
|
||||||
|
* \li Action: Toggles strikeout (strike-through) in the font (selection-wise).
|
||||||
|
* \li Syntax: font-strikeout
|
||||||
|
* \li Origin: sanda, 3 May 2009
|
||||||
|
* \endvar
|
||||||
|
*/
|
||||||
|
{ LFUN_FONT_STRIKEOUT, "font-strikeout", Noop, Layout },
|
||||||
/*!
|
/*!
|
||||||
* \var lyx::FuncCode lyx::LFUN_FONT_EMPH
|
* \var lyx::FuncCode lyx::LFUN_FONT_EMPH
|
||||||
* \li Action: Toggles the emphasis font style (selection-wise).
|
* \li Action: Toggles the emphasis font style (selection-wise).
|
||||||
|
@ -188,6 +188,9 @@ void readParToken(Buffer const & buf, Paragraph & par, Lexer & lex,
|
|||||||
else
|
else
|
||||||
lex.printError("Unknown bar font flag "
|
lex.printError("Unknown bar font flag "
|
||||||
"`$$Token'");
|
"`$$Token'");
|
||||||
|
} else if (token == "\\strikeout") {
|
||||||
|
lex.next();
|
||||||
|
font.fontInfo().setStrikeout(font.setLyXMisc(lex.getString()));
|
||||||
} else if (token == "\\noun") {
|
} else if (token == "\\noun") {
|
||||||
lex.next();
|
lex.next();
|
||||||
font.fontInfo().setNoun(font.setLyXMisc(lex.getString()));
|
font.fontInfo().setNoun(font.setLyXMisc(lex.getString()));
|
||||||
|
@ -1722,6 +1722,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LFUN_FONT_STRIKEOUT: {
|
||||||
|
Font font(ignore_font, ignore_language);
|
||||||
|
font.fontInfo().setStrikeout(FONT_TOGGLE);
|
||||||
|
toggleAndShow(cur, this, font);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case LFUN_FONT_UNDERLINE: {
|
case LFUN_FONT_UNDERLINE: {
|
||||||
Font font(ignore_font, ignore_language);
|
Font font(ignore_font, ignore_language);
|
||||||
font.fontInfo().setUnderbar(FONT_TOGGLE);
|
font.fontInfo().setUnderbar(FONT_TOGGLE);
|
||||||
@ -2423,6 +2429,7 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
case LFUN_MATH_SUPERSCRIPT:
|
case LFUN_MATH_SUPERSCRIPT:
|
||||||
case LFUN_FONT_DEFAULT:
|
case LFUN_FONT_DEFAULT:
|
||||||
case LFUN_FONT_UNDERLINE:
|
case LFUN_FONT_UNDERLINE:
|
||||||
|
case LFUN_FONT_STRIKEOUT:
|
||||||
case LFUN_FONT_SIZE:
|
case LFUN_FONT_SIZE:
|
||||||
case LFUN_LANGUAGE:
|
case LFUN_LANGUAGE:
|
||||||
case LFUN_TEXTSTYLE_APPLY:
|
case LFUN_TEXTSTYLE_APPLY:
|
||||||
|
@ -76,6 +76,7 @@ static QList<BarPair> barData()
|
|||||||
bars << BarPair(qt_("No change"), IGNORE);
|
bars << BarPair(qt_("No change"), IGNORE);
|
||||||
bars << BarPair(qt_("Emph"), EMPH_TOGGLE);
|
bars << BarPair(qt_("Emph"), EMPH_TOGGLE);
|
||||||
bars << BarPair(qt_("Underbar"), UNDERBAR_TOGGLE);
|
bars << BarPair(qt_("Underbar"), UNDERBAR_TOGGLE);
|
||||||
|
bars << BarPair(qt_("Strikeout"), STRIKEOUT_TOGGLE);
|
||||||
bars << BarPair(qt_("Noun"), NOUN_TOGGLE);
|
bars << BarPair(qt_("Noun"), NOUN_TOGGLE);
|
||||||
bars << BarPair(qt_("Reset"), INHERIT);
|
bars << BarPair(qt_("Reset"), INHERIT);
|
||||||
return bars;
|
return bars;
|
||||||
@ -276,6 +277,9 @@ static FontState getBar(FontInfo const & fi)
|
|||||||
if (fi.underbar() == FONT_TOGGLE)
|
if (fi.underbar() == FONT_TOGGLE)
|
||||||
return UNDERBAR_TOGGLE;
|
return UNDERBAR_TOGGLE;
|
||||||
|
|
||||||
|
if (fi.strikeout() == FONT_TOGGLE)
|
||||||
|
return STRIKEOUT_TOGGLE;
|
||||||
|
|
||||||
if (fi.noun() == FONT_TOGGLE)
|
if (fi.noun() == FONT_TOGGLE)
|
||||||
return NOUN_TOGGLE;
|
return NOUN_TOGGLE;
|
||||||
|
|
||||||
@ -294,6 +298,7 @@ static void setBar(FontInfo & fi, FontState val)
|
|||||||
case IGNORE:
|
case IGNORE:
|
||||||
fi.setEmph(FONT_IGNORE);
|
fi.setEmph(FONT_IGNORE);
|
||||||
fi.setUnderbar(FONT_IGNORE);
|
fi.setUnderbar(FONT_IGNORE);
|
||||||
|
fi.setStrikeout(FONT_IGNORE);
|
||||||
fi.setNoun(FONT_IGNORE);
|
fi.setNoun(FONT_IGNORE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -305,6 +310,10 @@ static void setBar(FontInfo & fi, FontState val)
|
|||||||
fi.setUnderbar(FONT_TOGGLE);
|
fi.setUnderbar(FONT_TOGGLE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case STRIKEOUT_TOGGLE:
|
||||||
|
fi.setStrikeout(FONT_TOGGLE);
|
||||||
|
break;
|
||||||
|
|
||||||
case NOUN_TOGGLE:
|
case NOUN_TOGGLE:
|
||||||
fi.setNoun(FONT_TOGGLE);
|
fi.setNoun(FONT_TOGGLE);
|
||||||
break;
|
break;
|
||||||
@ -312,6 +321,7 @@ static void setBar(FontInfo & fi, FontState val)
|
|||||||
case INHERIT:
|
case INHERIT:
|
||||||
fi.setEmph(FONT_INHERIT);
|
fi.setEmph(FONT_INHERIT);
|
||||||
fi.setUnderbar(FONT_INHERIT);
|
fi.setUnderbar(FONT_INHERIT);
|
||||||
|
fi.setStrikeout(FONT_INHERIT);
|
||||||
fi.setNoun(FONT_INHERIT);
|
fi.setNoun(FONT_INHERIT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,8 @@ enum FontState {
|
|||||||
///
|
///
|
||||||
NOUN_TOGGLE,
|
NOUN_TOGGLE,
|
||||||
///
|
///
|
||||||
|
STRIKEOUT_TOGGLE,
|
||||||
|
///
|
||||||
INHERIT
|
INHERIT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -336,6 +336,8 @@ int GuiPainter::text(int x, int y, docstring const & s,
|
|||||||
textwidth = smallCapsText(x, y, str, f);
|
textwidth = smallCapsText(x, y, str, f);
|
||||||
if (f.underbar() == FONT_ON)
|
if (f.underbar() == FONT_ON)
|
||||||
underline(f, x, y, textwidth);
|
underline(f, x, y, textwidth);
|
||||||
|
if (f.strikeout() == FONT_ON)
|
||||||
|
strikeoutLine(f, x, y, textwidth);
|
||||||
return textwidth;
|
return textwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,6 +347,8 @@ int GuiPainter::text(int x, int y, docstring const & s,
|
|||||||
textwidth = fm.width(s);
|
textwidth = fm.width(s);
|
||||||
if (f.underbar() == FONT_ON)
|
if (f.underbar() == FONT_ON)
|
||||||
underline(f, x, y, textwidth);
|
underline(f, x, y, textwidth);
|
||||||
|
if (f.strikeout() == FONT_ON)
|
||||||
|
strikeoutLine(f, x, y, textwidth);
|
||||||
|
|
||||||
if (!isDrawingEnabled())
|
if (!isDrawingEnabled())
|
||||||
return textwidth;
|
return textwidth;
|
||||||
@ -534,6 +538,20 @@ void GuiPainter::underline(FontInfo const & f, int x, int y, int width)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GuiPainter::strikeoutLine(FontInfo const & f, int x, int y, int width)
|
||||||
|
{
|
||||||
|
FontMetrics const & fm = theFontMetrics(f);
|
||||||
|
|
||||||
|
int const middle = max((fm.maxHeight() / 4), 1);
|
||||||
|
int const height = middle/3;
|
||||||
|
|
||||||
|
if (height < 2)
|
||||||
|
line(x, y - middle, x + width, y - middle, f.realColor());
|
||||||
|
else
|
||||||
|
fillRectangle(x, y - middle, width, height, f.realColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiPainter::dashedUnderline(FontInfo const & f, int x, int y, int width)
|
void GuiPainter::dashedUnderline(FontInfo const & f, int x, int y, int width)
|
||||||
{
|
{
|
||||||
FontMetrics const & fm = theFontMetrics(f);
|
FontMetrics const & fm = theFontMetrics(f);
|
||||||
|
@ -129,6 +129,9 @@ private:
|
|||||||
/// check the font, and if set, draw an dashed underline
|
/// check the font, and if set, draw an dashed underline
|
||||||
void dashedUnderline(FontInfo const & f,
|
void dashedUnderline(FontInfo const & f,
|
||||||
int x, int y, int width);
|
int x, int y, int width);
|
||||||
|
/// check the font, and if set, draw an strike-through line
|
||||||
|
void strikeoutLine(FontInfo const & f,
|
||||||
|
int x, int y, int width);
|
||||||
|
|
||||||
/// draw a bevelled button border
|
/// draw a bevelled button border
|
||||||
void buttonFrame(int x, int y, int w, int h);
|
void buttonFrame(int x, int y, int w, int h);
|
||||||
|
@ -688,6 +688,7 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
case LFUN_FONT_SIZE:
|
case LFUN_FONT_SIZE:
|
||||||
case LFUN_FONT_STATE:
|
case LFUN_FONT_STATE:
|
||||||
case LFUN_FONT_UNDERLINE:
|
case LFUN_FONT_UNDERLINE:
|
||||||
|
case LFUN_FONT_STRIKEOUT:
|
||||||
case LFUN_FOOTNOTE_INSERT:
|
case LFUN_FOOTNOTE_INSERT:
|
||||||
case LFUN_HYPERLINK_INSERT:
|
case LFUN_HYPERLINK_INSERT:
|
||||||
case LFUN_INDEX_INSERT:
|
case LFUN_INDEX_INSERT:
|
||||||
|
@ -3712,6 +3712,7 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_TEXTSTYLE_UPDATE:
|
case LFUN_TEXTSTYLE_UPDATE:
|
||||||
case LFUN_FONT_SIZE:
|
case LFUN_FONT_SIZE:
|
||||||
case LFUN_FONT_UNDERLINE:
|
case LFUN_FONT_UNDERLINE:
|
||||||
|
case LFUN_FONT_STRIKEOUT:
|
||||||
case LFUN_LANGUAGE:
|
case LFUN_LANGUAGE:
|
||||||
case LFUN_WORD_CAPITALIZE:
|
case LFUN_WORD_CAPITALIZE:
|
||||||
case LFUN_WORD_UPCASE:
|
case LFUN_WORD_UPCASE:
|
||||||
|
Loading…
Reference in New Issue
Block a user