mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
small stuff, whitespace & consistent naming
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7942 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
de039bb341
commit
5c3d9a2546
@ -17,56 +17,56 @@ FuncStatus::FuncStatus() : v_(OK)
|
||||
}
|
||||
|
||||
|
||||
FuncStatus & FuncStatus::clear ()
|
||||
void FuncStatus::clear()
|
||||
{
|
||||
v_ = OK;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void FuncStatus::operator |= (FuncStatus const & f)
|
||||
|
||||
void FuncStatus::operator|=(FuncStatus const & f)
|
||||
{
|
||||
v_ |= f.v_;
|
||||
}
|
||||
|
||||
FuncStatus & FuncStatus::unknown (bool b)
|
||||
|
||||
void FuncStatus::unknown(bool b)
|
||||
{
|
||||
if (b)
|
||||
v_ |= UNKNOWN;
|
||||
else
|
||||
v_ &= !UNKNOWN;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool FuncStatus::unknown () const
|
||||
|
||||
bool FuncStatus::unknown() const
|
||||
{
|
||||
return (v_ & UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
FuncStatus & FuncStatus::disabled (bool b)
|
||||
void FuncStatus::disabled(bool b)
|
||||
{
|
||||
if (b)
|
||||
v_ |= DISABLED;
|
||||
else
|
||||
v_ &= !DISABLED;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
bool FuncStatus::disabled () const
|
||||
bool FuncStatus::disabled() const
|
||||
{
|
||||
return (v_ & DISABLED);
|
||||
}
|
||||
|
||||
|
||||
void FuncStatus::setOnOff (bool b)
|
||||
void FuncStatus::setOnOff(bool b)
|
||||
{
|
||||
v_ |= (b ? ON : OFF);
|
||||
}
|
||||
|
||||
|
||||
bool FuncStatus::onoff (bool b) const
|
||||
bool FuncStatus::onoff(bool b) const
|
||||
{
|
||||
if (b)
|
||||
return (v_ & ON);
|
||||
|
@ -37,23 +37,23 @@ public:
|
||||
///
|
||||
FuncStatus();
|
||||
//
|
||||
FuncStatus & clear ();
|
||||
void clear();
|
||||
///
|
||||
void operator |= (FuncStatus const & f);
|
||||
void operator|=(FuncStatus const & f);
|
||||
///
|
||||
FuncStatus & unknown(bool b);
|
||||
void unknown(bool b);
|
||||
///
|
||||
bool unknown() const;
|
||||
|
||||
///
|
||||
FuncStatus & disabled (bool b);
|
||||
void disabled(bool b);
|
||||
///
|
||||
bool disabled () const;
|
||||
bool disabled() const;
|
||||
|
||||
///
|
||||
void setOnOff (bool b);
|
||||
void setOnOff(bool b);
|
||||
///
|
||||
bool onoff (bool b) const;
|
||||
bool onoff(bool b) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -19,6 +19,7 @@ InsetBase::dispatch(FuncRequest const & f, idx_type & i, pos_type & p)
|
||||
return priv_dispatch(f, i, p);
|
||||
}
|
||||
|
||||
|
||||
dispatch_result
|
||||
InsetBase::dispatch(FuncRequest const & f)
|
||||
{
|
||||
|
@ -7,6 +7,7 @@
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "insetbibitem.h"
|
||||
|
@ -2057,7 +2057,8 @@ FuncStatus InsetTabular::getStatus(string const & what) const
|
||||
}
|
||||
if (action == LyXTabular::LAST_ACTION) {
|
||||
status.clear();
|
||||
return status.unknown(true);
|
||||
status.unknown(true);
|
||||
return status;
|
||||
}
|
||||
|
||||
string const argument
|
||||
@ -2085,7 +2086,8 @@ FuncStatus InsetTabular::getStatus(string const & what) const
|
||||
case LyXTabular::DELETE_COLUMN:
|
||||
case LyXTabular::SET_ALL_LINES:
|
||||
case LyXTabular::UNSET_ALL_LINES:
|
||||
return status.clear();
|
||||
status.clear();
|
||||
return status;
|
||||
|
||||
case LyXTabular::MULTICOLUMN:
|
||||
status.setOnOff(tabular.isMultiColumn(actcell));
|
||||
|
@ -29,7 +29,7 @@ void MailInset::showDialog(BufferView * bv) const
|
||||
void MailInset::updateDialog(BufferView * bv) const
|
||||
{
|
||||
BOOST_ASSERT(bv);
|
||||
if(bv->owner()->getDialogs().visible(name()))
|
||||
if (bv->owner()->getDialogs().visible(name()))
|
||||
bv->owner()->getDialogs().update(name(),
|
||||
inset2string(*bv->buffer()));
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "lyxrc.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include "support/std_sstream.h"
|
||||
|
||||
using lyx::support::ascii_lowercase;
|
||||
@ -946,7 +945,23 @@ LyXFont::FONT_SHAPE LyXFont::realShape() const
|
||||
}
|
||||
|
||||
|
||||
ostream & operator<<(ostream & o, LyXFont::FONT_MISC_STATE fms)
|
||||
ostream & operator<<(ostream & os, LyXFont::FONT_MISC_STATE fms)
|
||||
{
|
||||
return o << int(fms);
|
||||
return os << int(fms);
|
||||
}
|
||||
|
||||
|
||||
std::ostream & operator<<(std::ostream & os, LyXFont const & font)
|
||||
{
|
||||
return os << "font:"
|
||||
<< " family " << font.bits.family
|
||||
<< " series " << font.bits.series
|
||||
<< " shape " << font.bits.shape
|
||||
<< " size " << font.bits.size
|
||||
<< " color " << font.bits.color
|
||||
<< " emph " << font.bits.emph
|
||||
<< " underbar " << font.bits.underbar
|
||||
<< " noun " << font.bits.noun
|
||||
<< " number " << font.bits.number
|
||||
<< " lang: " << (font.lang ? font.lang->lang() : 0);
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ public:
|
||||
int latexWriteStartChanges(std::ostream &, LyXFont const & base,
|
||||
LyXFont const & prev) const;
|
||||
|
||||
/** Writes tha tail of the LaTeX needed to chagne to this font.
|
||||
/** Writes the tail of the LaTeX needed to change to this font.
|
||||
Returns number of chars written. Base is the font state we want
|
||||
to achieve.
|
||||
*/
|
||||
@ -305,6 +305,9 @@ public:
|
||||
///
|
||||
friend
|
||||
bool operator==(LyXFont const & font1, LyXFont const & font2);
|
||||
///
|
||||
friend
|
||||
std::ostream & operator<<(std::ostream & os, LyXFont const & font);
|
||||
|
||||
/// Converts logical attributes to concrete shape attribute
|
||||
LyXFont::FONT_SHAPE realShape() const;
|
||||
@ -335,22 +338,16 @@ public:
|
||||
FONT_MISC_STATE number;
|
||||
};
|
||||
private:
|
||||
|
||||
///
|
||||
FontBits bits;
|
||||
|
||||
///
|
||||
Language const * lang;
|
||||
|
||||
/// Sane font
|
||||
static FontBits sane;
|
||||
|
||||
/// All inherit font
|
||||
static FontBits inherit;
|
||||
|
||||
/// All ignore font
|
||||
static FontBits ignore;
|
||||
|
||||
/// Updates a misc setting according to request
|
||||
LyXFont::FONT_MISC_STATE setMisc(LyXFont::FONT_MISC_STATE newfont,
|
||||
LyXFont::FONT_MISC_STATE org);
|
||||
@ -362,10 +359,14 @@ private:
|
||||
* having to expose lyxfont.h.
|
||||
*/
|
||||
class LyXFont_size {
|
||||
LyXFont::FONT_SIZE val_;
|
||||
public:
|
||||
///
|
||||
LyXFont_size(LyXFont::FONT_SIZE val) : val_(val) {}
|
||||
operator LyXFont::FONT_SIZE() const{ return val_; }
|
||||
///
|
||||
operator LyXFont::FONT_SIZE() const { return val_; }
|
||||
private:
|
||||
///
|
||||
LyXFont::FONT_SIZE val_;
|
||||
};
|
||||
|
||||
|
||||
@ -444,8 +445,7 @@ bool operator!=(LyXFont::FontBits const & lhs, LyXFont::FontBits const & rhs)
|
||||
inline
|
||||
bool operator==(LyXFont const & font1, LyXFont const & font2)
|
||||
{
|
||||
return font1.bits == font2.bits &&
|
||||
font1.lang == font2.lang;
|
||||
return font1.bits == font2.bits && font1.lang == font2.lang;
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -278,7 +278,8 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
|
||||
|
||||
if (ev.action == LFUN_NOACTION) {
|
||||
setStatusMessage(N_("Nothing to do"));
|
||||
return flag.disabled(true);
|
||||
flag.disabled(true);
|
||||
return flag;
|
||||
}
|
||||
|
||||
switch (ev.action) {
|
||||
@ -318,7 +319,8 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & ev) const
|
||||
// no
|
||||
setStatusMessage(N_("Command not allowed with"
|
||||
"out any document open"));
|
||||
return flag.disabled(true);
|
||||
flag.disabled(true);
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,10 +61,9 @@ int numberOfHfills(Paragraph const & par, Row const & row)
|
||||
pos_type first = row.pos();
|
||||
|
||||
// hfill *DO* count at the beginning of paragraphs!
|
||||
if (first) {
|
||||
if (first)
|
||||
while (first < last && par.isHfill(first))
|
||||
++first;
|
||||
}
|
||||
|
||||
first = max(first, par.beginningOfBody());
|
||||
|
||||
@ -88,10 +87,9 @@ int numberOfLabelHfills(Paragraph const & par, Row const & row)
|
||||
pos_type first = row.pos();
|
||||
|
||||
// hfill *DO* count at the beginning of paragraphs!
|
||||
if (first) {
|
||||
if (first)
|
||||
while (first < last && par.isHfill(first))
|
||||
++first;
|
||||
}
|
||||
|
||||
last = min(last, par.beginningOfBody());
|
||||
int n = 0;
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
/// our buffer's default layout font
|
||||
LyXFont defaultfont_;
|
||||
private:
|
||||
/// offset of dran area to document start.
|
||||
/// offset of drawn area to document start.
|
||||
int anchor_y_;
|
||||
public:
|
||||
/// update all cached row positions
|
||||
|
@ -374,12 +374,12 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
|
||||
else
|
||||
layoutfont = lout->font;
|
||||
|
||||
LyXFont tmpfont = getFontSettings(bparams, pos);
|
||||
tmpfont.realize(layoutfont);
|
||||
tmpfont.realize(outerfont);
|
||||
tmpfont.realize(bparams.getLyXTextClass().defaultfont());
|
||||
LyXFont font = getFontSettings(bparams, pos);
|
||||
font.realize(layoutfont);
|
||||
font.realize(outerfont);
|
||||
font.realize(bparams.getLyXTextClass().defaultfont());
|
||||
|
||||
return tmpfont;
|
||||
return font;
|
||||
}
|
||||
|
||||
|
||||
|
46
src/text.C
46
src/text.C
@ -201,7 +201,7 @@ int LyXText::singleWidth(ParagraphList::iterator pit,
|
||||
|
||||
// The most common case is handled first (Asger)
|
||||
if (IsPrintable(c)) {
|
||||
if (font.language()->RightToLeft()) {
|
||||
if (!font.language()->RightToLeft()) {
|
||||
if ((lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
|
||||
lyxrc.font_norm_type == LyXRC::ISO_10646_1)
|
||||
&& font.language()->lang() == "arabic") {
|
||||
@ -234,35 +234,25 @@ int LyXText::singleWidth(ParagraphList::iterator pit,
|
||||
|
||||
lyx::pos_type LyXText::log2vis(lyx::pos_type pos) const
|
||||
{
|
||||
if (bidi_start == -1)
|
||||
return pos;
|
||||
else
|
||||
return log2vis_list[pos - bidi_start];
|
||||
return (bidi_start == -1) ? pos : log2vis_list[pos - bidi_start];
|
||||
}
|
||||
|
||||
|
||||
lyx::pos_type LyXText::vis2log(lyx::pos_type pos) const
|
||||
{
|
||||
if (bidi_start == -1)
|
||||
return pos;
|
||||
else
|
||||
return vis2log_list[pos - bidi_start];
|
||||
return (bidi_start == -1) ? pos : vis2log_list[pos - bidi_start];
|
||||
}
|
||||
|
||||
|
||||
lyx::pos_type LyXText::bidi_level(lyx::pos_type pos) const
|
||||
{
|
||||
if (bidi_start == -1)
|
||||
return 0;
|
||||
else
|
||||
return bidi_levels[pos - bidi_start];
|
||||
return (bidi_start == -1) ? 0 : bidi_levels[pos - bidi_start];
|
||||
}
|
||||
|
||||
|
||||
bool LyXText::bidi_InRange(lyx::pos_type pos) const
|
||||
{
|
||||
return bidi_start == -1 ||
|
||||
(bidi_start <= pos && pos <= bidi_end);
|
||||
return bidi_start == -1 || (bidi_start <= pos && pos <= bidi_end);
|
||||
}
|
||||
|
||||
|
||||
@ -327,7 +317,6 @@ void LyXText::computeBidiTables(Paragraph const & par,
|
||||
is_space = false;
|
||||
}
|
||||
|
||||
|
||||
bool new_rtl = font.isVisibleRightToLeft();
|
||||
bool new_rtl0 = font.isRightToLeft();
|
||||
int new_level;
|
||||
@ -402,8 +391,8 @@ bool LyXText::isBoundary(Buffer const & buf, Paragraph const & par,
|
||||
return false;
|
||||
|
||||
if (!bidi_InRange(pos - 1)) {
|
||||
/// This can happen if pos is the first char of a row.
|
||||
/// Returning false in this case is incorrect!
|
||||
// This can happen if pos is the first char of a row.
|
||||
// Returning false in this case is incorrect!
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1086,7 +1075,6 @@ void LyXText::setHeightOfRow(ParagraphList::iterator pit, Row & row)
|
||||
prev->getLabelWidthString() == pit->getLabelWidthString())
|
||||
{
|
||||
layoutasc = (layout->itemsep * defaultRowHeight());
|
||||
// } else if (rit != firstRow()) {
|
||||
} else if (pit != ownerParagraphs().begin() || row.pos() != 0) {
|
||||
tmptop = layout->topsep;
|
||||
|
||||
@ -1485,7 +1473,7 @@ void LyXText::prepareToPrint(ParagraphList::iterator pit,
|
||||
// par, does not end in newline, and is not row above a
|
||||
// display inset... then stretch it
|
||||
if (ns
|
||||
&& next_row != pit->rows.end()
|
||||
&& rit->end() < pit->size()
|
||||
&& !pit->isNewline(next_row->pos() - 1)
|
||||
&& !disp_inset
|
||||
) {
|
||||
@ -1619,7 +1607,8 @@ void LyXText::rejectChange()
|
||||
WordLangTuple const LyXText::selectNextWordToSpellcheck(float & value)
|
||||
{
|
||||
if (the_locking_inset) {
|
||||
WordLangTuple word = the_locking_inset->selectNextWordToSpellcheck(bv(), value);
|
||||
WordLangTuple word =
|
||||
the_locking_inset->selectNextWordToSpellcheck(bv(), value);
|
||||
if (!word.word().empty()) {
|
||||
value += float(cursor.y());
|
||||
value /= float(height);
|
||||
@ -1700,8 +1689,7 @@ WordLangTuple const LyXText::selectNextWordToSpellcheck(float & value)
|
||||
// Finally, we copy the word to a string and return it
|
||||
string str;
|
||||
if (selection.cursor.pos() < cursor.pos()) {
|
||||
pos_type i;
|
||||
for (i = selection.cursor.pos(); i < cursor.pos(); ++i) {
|
||||
for (pos_type i = selection.cursor.pos(); i < cursor.pos(); ++i) {
|
||||
if (!cursorPar()->isInset(i))
|
||||
str += cursorPar()->getChar(i);
|
||||
}
|
||||
@ -1748,8 +1736,6 @@ void LyXText::deleteWordForward()
|
||||
selection.cursor = cursor;
|
||||
cursor = tmpcursor;
|
||||
setSelection();
|
||||
|
||||
// Great, CutSelection() gets rid of multiple spaces.
|
||||
cutSelection(true, false);
|
||||
}
|
||||
}
|
||||
@ -2158,11 +2144,7 @@ int LyXText::redoParagraphInternal(ParagraphList::iterator pit)
|
||||
z = rowBreakPoint(pit, row) + 1;
|
||||
row.end(z);
|
||||
pit->rows.push_back(row);
|
||||
}
|
||||
|
||||
RowList::iterator rit = pit->rows.begin();
|
||||
RowList::iterator end = pit->rows.end();
|
||||
for (rit = pit->rows.begin(); rit != end; ++rit) {
|
||||
RowList::iterator rit = boost::prior(pit->rows.end());
|
||||
int const f = fill(pit, *rit, ww);
|
||||
int const w = ww - f;
|
||||
par_width = std::max(par_width, w);
|
||||
@ -2210,8 +2192,8 @@ void LyXText::fullRebreak()
|
||||
|
||||
void LyXText::metrics(MetricsInfo & mi, Dimension & dim)
|
||||
{
|
||||
//lyxerr << "LyXText::metrics: width: " << mi.base.textwidth
|
||||
// << " workWidth: " << workWidth() << endl;
|
||||
lyxerr << "LyXText::metrics: width: " << mi.base.textwidth
|
||||
<< " workWidth: " << workWidth() << "\nfont: " << mi.base.font << endl;
|
||||
//BOOST_ASSERT(mi.base.textwidth);
|
||||
|
||||
// rebuild row cache
|
||||
|
41
src/text2.C
41
src/text2.C
@ -113,47 +113,37 @@ LyXFont LyXText::getFont(ParagraphList::iterator pit, pos_type pos) const
|
||||
LyXLayout_ptr const & layout = pit->layout();
|
||||
#warning broken?
|
||||
BufferParams const & params = bv()->buffer()->params();
|
||||
pos_type const body_pos = pit->beginningOfBody();
|
||||
|
||||
// We specialize the 95% common case:
|
||||
if (!pit->getDepth()) {
|
||||
if (layout->labeltype == LABEL_MANUAL
|
||||
&& pos < pit->beginningOfBody()) {
|
||||
// 1% goes here
|
||||
LyXFont f = pit->getFontSettings(params, pos);
|
||||
if (pit->inInset())
|
||||
pit->inInset()->getDrawFont(f);
|
||||
LyXFont f = pit->getFontSettings(params, pos);
|
||||
if (pit->inInset())
|
||||
pit->inInset()->getDrawFont(f);
|
||||
if (layout->labeltype == LABEL_MANUAL && pos < body_pos)
|
||||
return f.realize(layout->reslabelfont);
|
||||
} else {
|
||||
LyXFont f = pit->getFontSettings(params, pos);
|
||||
if (pit->inInset())
|
||||
pit->inInset()->getDrawFont(f);
|
||||
else
|
||||
return f.realize(layout->resfont);
|
||||
}
|
||||
}
|
||||
|
||||
// The uncommon case need not be optimized as much
|
||||
|
||||
LyXFont layoutfont;
|
||||
|
||||
if (pos < pit->beginningOfBody()) {
|
||||
// 1% goes here
|
||||
if (pos < body_pos)
|
||||
layoutfont = layout->labelfont;
|
||||
} else {
|
||||
// 99% goes here
|
||||
else
|
||||
layoutfont = layout->font;
|
||||
}
|
||||
|
||||
LyXFont tmpfont = pit->getFontSettings(params, pos);
|
||||
tmpfont.realize(layoutfont);
|
||||
LyXFont font = pit->getFontSettings(params, pos);
|
||||
font.realize(layoutfont);
|
||||
|
||||
if (pit->inInset())
|
||||
pit->inInset()->getDrawFont(tmpfont);
|
||||
pit->inInset()->getDrawFont(font);
|
||||
|
||||
// Realize with the fonts of lesser depth.
|
||||
tmpfont.realize(outerFont(pit, ownerParagraphs()));
|
||||
tmpfont.realize(defaultfont_);
|
||||
//font.realize(outerFont(pit, ownerParagraphs()));
|
||||
font.realize(defaultfont_);
|
||||
|
||||
return tmpfont;
|
||||
return font;
|
||||
}
|
||||
|
||||
|
||||
@ -166,7 +156,7 @@ LyXFont LyXText::getLayoutFont(ParagraphList::iterator pit) const
|
||||
|
||||
LyXFont font = layout->font;
|
||||
// Realize with the fonts of lesser depth.
|
||||
font.realize(outerFont(pit, ownerParagraphs()));
|
||||
//font.realize(outerFont(pit, ownerParagraphs()));
|
||||
font.realize(defaultfont_);
|
||||
|
||||
return font;
|
||||
@ -549,7 +539,6 @@ void LyXText::setFont(LyXFont const & font, bool toggleall)
|
||||
|
||||
// the cursor set functions have a special mechanism. When they
|
||||
// realize, that you left an empty paragraph, they will delete it.
|
||||
// They also delete the corresponding row
|
||||
|
||||
// need the selection cursor:
|
||||
void LyXText::setSelection()
|
||||
|
Loading…
Reference in New Issue
Block a user