14 files changed:
-FuncStatus & FuncStatus::clear ()
+void FuncStatus::clear()
-void FuncStatus::operator |= (FuncStatus const & f)
+
+void FuncStatus::operator|=(FuncStatus const & f)
-FuncStatus & FuncStatus::unknown (bool b)
+
+void FuncStatus::unknown(bool b)
{
if (b)
v_ |= UNKNOWN;
else
v_ &= !UNKNOWN;
{
if (b)
v_ |= UNKNOWN;
else
v_ &= !UNKNOWN;
-bool FuncStatus::unknown () const
+
+bool FuncStatus::unknown() const
{
return (v_ & UNKNOWN);
}
{
return (v_ & UNKNOWN);
}
-FuncStatus & FuncStatus::disabled (bool b)
+void FuncStatus::disabled(bool b)
{
if (b)
v_ |= DISABLED;
else
v_ &= !DISABLED;
{
if (b)
v_ |= DISABLED;
else
v_ &= !DISABLED;
-bool FuncStatus::disabled () const
+bool FuncStatus::disabled() const
{
return (v_ & DISABLED);
}
{
return (v_ & DISABLED);
}
-void FuncStatus::setOnOff (bool b)
+void FuncStatus::setOnOff(bool b)
{
v_ |= (b ? ON : OFF);
}
{
v_ |= (b ? ON : OFF);
}
-bool FuncStatus::onoff (bool b) const
+bool FuncStatus::onoff(bool b) const
{
if (b)
return (v_ & ON);
{
if (b)
return (v_ & ON);
- void operator |= (FuncStatus const & f);
+ void operator|=(FuncStatus const & f);
- FuncStatus & unknown(bool b);
///
bool unknown() const;
///
///
bool unknown() const;
///
- FuncStatus & disabled (bool b);
- bool disabled () const;
- void setOnOff (bool b);
- bool onoff (bool b) const;
+ bool onoff(bool b) const;
return priv_dispatch(f, i, p);
}
return priv_dispatch(f, i, p);
}
dispatch_result
InsetBase::dispatch(FuncRequest const & f)
{
dispatch_result
InsetBase::dispatch(FuncRequest const & f)
{
*
* Full author contact details are available in file CREDITS.
*/
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "insetbibitem.h"
#include <config.h>
#include "insetbibitem.h"
}
if (action == LyXTabular::LAST_ACTION) {
status.clear();
}
if (action == LyXTabular::LAST_ACTION) {
status.clear();
- return status.unknown(true);
+ status.unknown(true);
+ return status;
case LyXTabular::DELETE_COLUMN:
case LyXTabular::SET_ALL_LINES:
case LyXTabular::UNSET_ALL_LINES:
case LyXTabular::DELETE_COLUMN:
case LyXTabular::SET_ALL_LINES:
case LyXTabular::UNSET_ALL_LINES:
+ status.clear();
+ return status;
case LyXTabular::MULTICOLUMN:
status.setOnOff(tabular.isMultiColumn(actcell));
case LyXTabular::MULTICOLUMN:
status.setOnOff(tabular.isMultiColumn(actcell));
void MailInset::updateDialog(BufferView * bv) const
{
BOOST_ASSERT(bv);
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()));
}
bv->owner()->getDialogs().update(name(),
inset2string(*bv->buffer()));
}
#include "lyxrc.h"
#include "support/lstrings.h"
#include "lyxrc.h"
#include "support/lstrings.h"
#include "support/std_sstream.h"
using lyx::support::ascii_lowercase;
#include "support/std_sstream.h"
using lyx::support::ascii_lowercase;
-ostream & operator<<(ostream & o, LyXFont::FONT_MISC_STATE fms)
+ostream & operator<<(ostream & os, LyXFont::FONT_MISC_STATE 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);
int latexWriteStartChanges(std::ostream &, LyXFont const & base,
LyXFont const & prev) const;
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.
*/
Returns number of chars written. Base is the font state we want
to achieve.
*/
///
friend
bool operator==(LyXFont const & font1, LyXFont const & font2);
///
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;
/// Converts logical attributes to concrete shape attribute
LyXFont::FONT_SHAPE realShape() const;
FONT_MISC_STATE number;
};
private:
FONT_MISC_STATE number;
};
private:
///
Language const * lang;
///
Language const * lang;
/// Sane font
static FontBits sane;
/// Sane font
static FontBits sane;
/// All inherit font
static FontBits inherit;
/// All inherit font
static FontBits inherit;
/// All ignore font
static FontBits ignore;
/// 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);
/// Updates a misc setting according to request
LyXFont::FONT_MISC_STATE setMisc(LyXFont::FONT_MISC_STATE newfont,
LyXFont::FONT_MISC_STATE org);
* having to expose lyxfont.h.
*/
class LyXFont_size {
* having to expose lyxfont.h.
*/
class LyXFont_size {
- LyXFont::FONT_SIZE val_;
LyXFont_size(LyXFont::FONT_SIZE val) : val_(val) {}
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_;
inline
bool operator==(LyXFont const & font1, LyXFont const & font2)
{
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;
if (ev.action == LFUN_NOACTION) {
setStatusMessage(N_("Nothing to do"));
if (ev.action == LFUN_NOACTION) {
setStatusMessage(N_("Nothing to do"));
- return flag.disabled(true);
+ flag.disabled(true);
+ return flag;
// no
setStatusMessage(N_("Command not allowed with"
"out any document open"));
// no
setStatusMessage(N_("Command not allowed with"
"out any document open"));
- return flag.disabled(true);
+ flag.disabled(true);
+ return flag;
pos_type first = row.pos();
// hfill *DO* count at the beginning of paragraphs!
pos_type first = row.pos();
// hfill *DO* count at the beginning of paragraphs!
while (first < last && par.isHfill(first))
++first;
while (first < last && par.isHfill(first))
++first;
first = max(first, par.beginningOfBody());
first = max(first, par.beginningOfBody());
pos_type first = row.pos();
// hfill *DO* count at the beginning of paragraphs!
pos_type first = row.pos();
// hfill *DO* count at the beginning of paragraphs!
while (first < last && par.isHfill(first))
++first;
while (first < last && par.isHfill(first))
++first;
last = min(last, par.beginningOfBody());
int n = 0;
last = min(last, par.beginningOfBody());
int n = 0;
/// our buffer's default layout font
LyXFont defaultfont_;
private:
/// 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
int anchor_y_;
public:
/// update all cached row positions
else
layoutfont = lout->font;
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());
// The most common case is handled first (Asger)
if (IsPrintable(c)) {
// 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") {
if ((lyxrc.font_norm_type == LyXRC::ISO_8859_6_8 ||
lyxrc.font_norm_type == LyXRC::ISO_10646_1)
&& font.language()->lang() == "arabic") {
lyx::pos_type LyXText::log2vis(lyx::pos_type pos) const
{
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
{
}
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
{
}
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
{
}
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);
bool new_rtl = font.isVisibleRightToLeft();
bool new_rtl0 = font.isRightToLeft();
int new_level;
bool new_rtl = font.isVisibleRightToLeft();
bool new_rtl0 = font.isRightToLeft();
int new_level;
return false;
if (!bidi_InRange(pos - 1)) {
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!
prev->getLabelWidthString() == pit->getLabelWidthString())
{
layoutasc = (layout->itemsep * defaultRowHeight());
prev->getLabelWidthString() == pit->getLabelWidthString())
{
layoutasc = (layout->itemsep * defaultRowHeight());
-// } else if (rit != firstRow()) {
} else if (pit != ownerParagraphs().begin() || row.pos() != 0) {
tmptop = layout->topsep;
} else if (pit != ownerParagraphs().begin() || row.pos() != 0) {
tmptop = layout->topsep;
// par, does not end in newline, and is not row above a
// display inset... then stretch it
if (ns
// 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
) {
&& !pit->isNewline(next_row->pos() - 1)
&& !disp_inset
) {
WordLangTuple const LyXText::selectNextWordToSpellcheck(float & value)
{
if (the_locking_inset) {
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);
if (!word.word().empty()) {
value += float(cursor.y());
value /= float(height);
// Finally, we copy the word to a string and return it
string str;
if (selection.cursor.pos() < cursor.pos()) {
// 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);
}
if (!cursorPar()->isInset(i))
str += cursorPar()->getChar(i);
}
selection.cursor = cursor;
cursor = tmpcursor;
setSelection();
selection.cursor = cursor;
cursor = tmpcursor;
setSelection();
-
- // Great, CutSelection() gets rid of multiple spaces.
cutSelection(true, false);
}
}
cutSelection(true, false);
}
}
z = rowBreakPoint(pit, row) + 1;
row.end(z);
pit->rows.push_back(row);
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);
int const f = fill(pit, *rit, ww);
int const w = ww - f;
par_width = std::max(par_width, w);
void LyXText::metrics(MetricsInfo & mi, Dimension & dim)
{
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
//BOOST_ASSERT(mi.base.textwidth);
// rebuild row cache
LyXLayout_ptr const & layout = pit->layout();
#warning broken?
BufferParams const & params = bv()->buffer()->params();
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()) {
// 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);
return f.realize(layout->reslabelfont);
- } else {
- LyXFont f = pit->getFontSettings(params, pos);
- if (pit->inInset())
- pit->inInset()->getDrawFont(f);
return f.realize(layout->resfont);
return f.realize(layout->resfont);
}
// The uncommon case need not be optimized as much
}
// The uncommon case need not be optimized as much
-
- if (pos < pit->beginningOfBody()) {
- // 1% goes here
layoutfont = layout->labelfont;
layoutfont = layout->labelfont;
- } else {
- // 99% goes here
layoutfont = layout->font;
layoutfont = layout->font;
- LyXFont tmpfont = pit->getFontSettings(params, pos);
- tmpfont.realize(layoutfont);
+ LyXFont font = pit->getFontSettings(params, pos);
+ font.realize(layoutfont);
- pit->inInset()->getDrawFont(tmpfont);
+ pit->inInset()->getDrawFont(font);
// Realize with the fonts of lesser depth.
// Realize with the fonts of lesser depth.
- tmpfont.realize(outerFont(pit, ownerParagraphs()));
- tmpfont.realize(defaultfont_);
+ //font.realize(outerFont(pit, ownerParagraphs()));
+ font.realize(defaultfont_);
LyXFont font = layout->font;
// Realize with the fonts of lesser depth.
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;
font.realize(defaultfont_);
return font;
// the cursor set functions have a special mechanism. When they
// realize, that you left an empty paragraph, they will delete it.
// 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()
// need the selection cursor:
void LyXText::setSelection()