cursor_ = LCursor(*bv_);
anchor_ref_ = 0;
offset_ref_ = 0;
-
+
// if we're quitting lyx, don't bother updating stuff
if (quitting)
anchor_ref_ = int(t.paragraphs().size()) - 1;
offset_ref_ = 0;
}
-
+
lyxerr[Debug::GUI]
<< "Updating scrollbar: height: " << t.paragraphs().size()
<< " curr par: " << bv_->cursor().bottom().pit()
int const first = height;
int const last = workarea().workHeight() - height;
LCursor & cur = bv_->cursor();
-
+
bv_funcs::CurStatus st = bv_funcs::status(bv_, cur);
switch (st) {
{
lyxerr << "BufferView::Pimpl::update(fc=" << fitcursor << ", fu="
<< forceupdate << ") buffer: " << buffer_ << endl;
-
+
// check needed to survive LyX startup
if (buffer_) {
// update macro store
bv_->cursor().paragraph().id(),
bv_->cursor().pos());
if (i > 0)
- owner_->message(bformat(_("Saved bookmark %1$s"), tostr(i)));
+ owner_->message(bformat(_("Saved bookmark %1$d"), i));
}
min(par->size(), saved_positions[i].par_pos));
if (i > 0)
- owner_->message(bformat(_("Moved to bookmark %1$s"), tostr(i)));
+ owner_->message(bformat(_("Moved to bookmark %1$d"), i));
}
case LFUN_WORDS_COUNT:
flag.enabled(true);
break;
-
+
case LFUN_BOOKMARK_GOTO:
flag.enabled(bv_->isSavedPosition(strToUnsignedInt(cmd.argument)));
break;
string message;
if (count != 1) {
if (cur.selection())
- message = bformat(_("%1$s words in selection."),
- tostr(count));
+ message = bformat(_("%1$d words in selection."),
+ count);
else
- message = bformat(_("%1$s words in document."),
- tostr(count));
+ message = bformat(_("%1$d words in document."),
+ count);
}
else {
if (cur.selection())
message = _("One word in selection.");
- else
+ else
message = _("One word in document.");
}
int pit1 = pit;
int pit2 = pit;
size_t npit = text->paragraphs().size();
- lyxerr << "npit: " << npit << " pit1: " << pit1
+ lyxerr << "npit: " << npit << " pit1: " << pit1
<< " pit2: " << pit2 << endl;
- // rebreak anchor par
+ // rebreak anchor par
text->redoParagraph(pit);
int y0 = text->getPar(pit1).ascent() - offset_ref_;
-
+
// redo paragraphs above cursor if necessary
int y1 = y0;
while (y1 > 0 && pit1 > 0) {
y1 -= text->getPar(pit1).descent();
}
-
+
// take care of ascent of first line
y1 -= text->getPar(pit1).ascent();
y1 = 0;
anchor_ref_ = 0;
}
-
+
// redo paragraphs below cursor if necessary
int y2 = y0;
while (y2 < bv.workHeight() && pit2 < int(npit) - 1) {
y2 += text->getPar(pit2).ascent();
}
- // take care of descent of last line
+ // take care of descent of last line
y2 += text->getPar(pit2).descent();
// the coordinates of all these paragraphs are correct, cache them
theCoords.pars_[text][pit] = Point(0, y);
y += text->getPar(pit).descent();
}
-
+
lyxerr << "bv:metrics: y1: " << y1 << " y2: " << y2 << endl;
return ViewMetricsInfo(pit1, pit2, y1, y2);
}
+2005-01-06 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * tabular.C: make all write_attributes templates, tostr -> convert
+
+ * paragraph.C (simpleLinuxDocOnePar): fix type for ret from getChar
+ (emptyTag): and -> &&, and fix type for ret from getChar
+ (getFirstWord): fix type for ret from getChar
+ (onlyText): and -> &&
+ (simpleDocBookOnePar): and not -> && !, fix type for ret from
+ getChar
+
+ * toc.C (goTo, action):
+ * text3.C (dispatch):
+ * text.C (currentState):
+ * tex-accent.C (DoAccent):
+ * sgml.C:
+ * lyxrc.C:
+ * lyxfunc.C (menuNew):
+ * lyxfinc.C (replace):
+ * counters.C (laberItem):
+ * bufferview_funcs.C (font2string):
+ * bufferparams.C (writeFile):
+ * buffer.C (readFile):
+ * Spacing.C (set):
+ * MenuBackend.C: tostr -> convert
+
+ * LaTeX.C (runMessage): fix format
+ (scanAuxFiles): tostr -> convert
+
+ * BufferView_pimpl.C (savePosition): fix format
+ (restorePosition): ditto
+ (dispatch): ditto
+
2005-01-06 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* Spacing.[Ch]: New method getValueAsString().
* Spacing.[Ch]:
* bufferparams.C:
- * ParagraphParameters.C:
- * lyxlayout.C:
+ * ParagraphParameters.C:
+ * lyxlayout.C:
* text.C:
* text3.C: store/read spacing value as string.
-
+
* rowpainter.C: change float value (spacing_val) to double.
-
+
* bufferparams.C: add Spacing::Other to spacetranslator (fixes
broken custom document spacing).
* lyxfunc.C (getStatus): moved from lyxfunc.C put into anon
namespace, also more use of temp references and const
-
+
* cursor.[Ch] (getStatus): move to lyxfunc.C
* bufferparams.C: reformat slightly
string runMessage(unsigned int count)
{
- return bformat(_("Waiting for LaTeX run number %1$s"), tostr(count));
+ return bformat(_("Waiting for LaTeX run number %1$d"), count);
}
} // anon namespace
result.push_back(scanAuxFile(file));
for (int i = 1; i < 1000; ++i) {
- string file2 = ChangeExtension(file, "") + '.' + tostr(i)
+ string file2 = ChangeExtension(file, "") + '.' + convert<string>(i)
+ ".aux";
FileInfo fi(file2);
if (!fi.exist())
LastFiles::const_iterator end = lastfiles.end();
for (; lfit != end && ii < 10; ++lfit, ++ii) {
- string const label = tostr(ii) + ". "
+ string const label = convert<string>(ii) + ". "
+ MakeDisplayPath((*lfit), 30)
- + '|' + tostr(ii);
+ + '|' + convert<string>(ii);
tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_FILE_OPEN, (*lfit))), view);
}
}
+
void expandDocuments(Menu & tomenu, LyXView const * view)
{
typedef vector<string> Strings;
for (; docit != end; ++docit, ++ii) {
string label = MakeDisplayPath(*docit, 20);
if (ii < 10)
- label = tostr(ii) + ". " + label + '|' + tostr(ii);
+ label = convert<string>(ii) + ". " + label + '|' + convert<string>(ii);
tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_SWITCHBUFFER, *docit)), view);
}
}
label += limit_string_length(toc_list[i].str);
if (toc_list[i].depth == depth
&& shortcut_count < 9) {
- if (label.find(tostr(shortcut_count + 1)) != string::npos)
- label += '|' + tostr(++shortcut_count);
+ if (label.find(convert<string>(shortcut_count + 1)) != string::npos)
+ label += '|' + convert<string>(++shortcut_count);
}
tomenu.add(MenuItem(MenuItem::Command, label,
FuncRequest(toc_list[i].action())));
label += limit_string_length(toc_list[pos].str);
if (toc_list[pos].depth == depth &&
shortcut_count < 9) {
- if (label.find(tostr(shortcut_count + 1)) != string::npos)
- label += '|' + tostr(++shortcut_count);
+ if (label.find(convert<string>(shortcut_count + 1)) != string::npos)
+ label += '|' + convert<string>(++shortcut_count);
}
if (new_pos == pos + 1) {
tomenu.add(MenuItem(MenuItem::Command,
for (unsigned int index = 0; cit != end; ++cit, ++index) {
tomenu.add(MenuItem(MenuItem::Command, *cit,
- FuncRequest(LFUN_PASTE, tostr(index))));
+ FuncRequest(LFUN_PASTE, convert<string>(index))));
}
}
for (int ii = 1; cit != end; ++cit, ++ii) {
string label = cit->getBranch();
if (ii < 10)
- label = tostr(ii) + ". " + label + "|" + tostr(ii);
+ label = convert<string>(ii) + ". " + label + "|" + convert<string>(ii);
tomenu.add(MenuItem(MenuItem::Command, label,
FuncRequest(LFUN_INSERT_BRANCH,
cit->getBranch())), view);
void Spacing::set(Spacing::Space sp, float val)
{
- set(sp, tostr(val));
+ set(sp, convert<string>(val));
}
space = sp;
if (sp == Other) {
switch (int(strToDbl(val) * 1000 + 0.5)) {
- case 1000:
- space = Single;
+ case 1000:
+ space = Single;
break;
- case 1250:
- space = Onehalf;
+ case 1250:
+ space = Onehalf;
break;
- case 1667:
- space = Double;
+ case 1667:
+ space = Double;
break;
- default:
- value = val;
+ default:
+ value = val;
break;
}
}
return false;
}
command += " -t"
- + tostr(LYX_FORMAT)
+ + convert<string>(LYX_FORMAT)
+ " -o " + tmpfile + ' '
+ QuoteName(filename);
lyxerr[Debug::INFO] << "Running '"
os << "\\papersize " << string_papersize[papersize2]
<< "\n\\paperpackage " << string_paperpackages[paperpackage]
- << "\n\\use_geometry " << tostr(use_geometry)
+ << "\n\\use_geometry " << convert<string>(use_geometry)
<< "\n\\use_amsmath " << use_amsmath
<< "\n\\cite_engine " << citeenginetranslator().find(cite_engine)
- << "\n\\use_bibtopic " << tostr(use_bibtopic)
+ << "\n\\use_bibtopic " << convert<string>(use_bibtopic)
<< "\n\\paperorientation " << string_orientation[orientation]
<< '\n';
}
}
- os << "\\tracking_changes " << tostr(tracking_changes) << "\n";
+ os << "\\tracking_changes " << convert<string>(tracking_changes) << "\n";
if (tracking_changes) {
AuthorList::Authors::const_iterator it = pimpl_->authorlist.begin();
<< "number " << font.number() << '\n'
<< "color " << font.color() << '\n'
<< "language " << lang << '\n'
- << "toggleall " << tostr(toggle);
+ << "toggleall " << convert<string>(toggle);
data = os.str();
return true;
}
// the next two should probably go elsewhere
// this give the position relative to (0, baseline) of outermost
// paragraph
-Point coordOffset(DocIterator const & dit)
+Point coordOffset(DocIterator const & dit)
{
int x = 0;
int y = 0;
-
+
// Contribution of nested insets
for (size_t i = 1; i != dit.size(); ++i) {
CursorSlice const & sl = dit[i];
CurStatus status(BufferView const * bv, DocIterator const & dit)
{
CoordCache::InnerParPosCache & cache = theCoords.pars_[dit.bottom().text()];
-
+
if (cache.find(dit.bottom().pit()) != cache.end())
return CUR_INSIDE;
else if (dit.bottom().pit() < bv->anchor_ref())
if (numbertype == "Roman")
return romanCounter(value(ctr));
- return tostr(value(ctr));
+ return convert<string>(value(ctr));
}
+2005-01-06 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * ControlTabularCreate.C (dispatchParams):
+ * ControlSpellchekcer.C (showSummary):
+ * ControlPrint.C (dispatchParams):
+ * ControlGraphics.C (readBB):
+ * ControlExternal.C (readBB): tostr -> convert
+
2004-12-17 Martin Vermeer <martin.vermeer@hut.fi>
* ControlMath.C: fixed Ångström, Ørsted.
}
}
- return ("0 0 " + tostr(width) + ' ' + tostr(height));
+ return ("0 0 " + convert<string>(width) + ' ' + convert<string>(height));
}
} // namespace frontend
}
}
- return ("0 0 " + tostr(width) + ' ' + tostr(height));
+ return ("0 0 " + convert<string>(width) + ' ' + convert<string>(height));
}
if (!pp.all_pages && pp.from_page) {
command += lyxrc.print_pagerange_flag + ' ';
- command += tostr(pp.from_page);
+ command += convert<string>(pp.from_page);
if (pp.to_page) {
// we have a range "from-to"
command += '-'
- + tostr(pp.to_page);
+ + convert<string>(pp.to_page);
}
command += ' ';
}
command += lyxrc.print_copies_flag;
}
command += ' '
- + tostr(pp.count_copies)
+ + convert<string>(pp.count_copies)
+ ' ';
}
string message;
if (count_ != 1)
- message = bformat(_("%1$s words checked."), tostr(count_));
+ message = bformat(_("%1$d words checked."), count_);
else
message = _("One word checked.");
void ControlTabularCreate::dispatchParams()
{
- string data = tostr(params().first) + ' ' + tostr(params().second);
+ string data = convert<string>(params().first) + ' ' + convert<string>(params().second);
kernel().dispatch(FuncRequest(LFUN_TABULAR_INSERT, data));
}
+2005-01-06 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * GParagraph.C: drop unused include tostr.h
+
+ * GSpellchecker.C:
+ * GPrint.C:
+ * GGraphics.C (apply): tostr -> convert
+
2005-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* xftFontLoader.C: lyxrc.font_sizes is a string now.
-
+
* lyx_gui.C: change getDVI() to int.
2005-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
2004-12-08 John Spray <spray_john@users.sourceforge.net>
- * FileDialogPrivate.C: use Gtk::FileChooser.set_current_name
+ * FileDialogPrivate.C: use Gtk::FileChooser.set_current_name
to make suggested filenames work when saving
2004-12-07 John Spray <spray_john@users.sourceforge.net>
- * glade/: improve layouts, set spinbuttons to display 2
+ * glade/: improve layouts, set spinbuttons to display 2
decimal places where apropriate
* GSearch.C: focus 'find' entry on update()
- * GParagraph.C: don't require that 'ControlBox' widget
+ * GParagraph.C: don't require that 'ControlBox' widget
be an HBox.
* The Include Dialog:
Dialogs.C, Makefile.am, GInclude.[Ch], glade/include.glade
if (setscalingradio_->get_active()) {
float scaleValue = outputscalespin_->get_adjustment()->get_value();
- igp.scale = tostr(scaleValue);
+ igp.scale = convert<string>(scaleValue);
if (float_equal(scaleValue, 0.0, 0.05))
igp.scale = string();
igp.width = LyXLength();
igp.clip = clipcheck_->get_active();
// the extra section
- igp.rotateAngle = tostr(anglespin_->get_adjustment()->get_value());
+ igp.rotateAngle = convert<string>(anglespin_->get_adjustment()->get_value());
int const origin_pos = origincombo_->get_active_row_number();
igp.rotateOrigin = origins_[origin_pos];
unitsComboFromLength(heightunitscombo_, stringcol_,
igp.height, defaultUnit);
- if (!igp.scale.empty()
+ if (!igp.scale.empty()
&& !float_equal(strToDbl(igp.scale), 0.0, 0.05)) {
// scaling sizing mode
setscalingradio_->set_active(true);
#include "ParagraphParameters.h"
#include "Spacing.h"
#include "support/lstrings.h"
-#include "support/tostr.h"
using std::string;
+
namespace lyx {
namespace frontend {
fileEntry_->set_text(pp.file_name);
all_->set_active(pp.all_pages);
- string const from = ( pp.from_page ? tostr(pp.from_page) : string() );
- string const to = ( pp.to_page ? tostr(pp.to_page) : string() );
+ string const from = ( pp.from_page ? convert<string>(pp.from_page) : string() );
+ string const to = ( pp.to_page ? convert<string>(pp.to_page) : string() );
fromEntry_->set_text(from);
toEntry_->set_text(to);
odd_->set_active(pp.odd_pages);
int const progress = controller().getProgress();
if (progress != 0) {
progress_->set_fraction(float(progress)/100.0f);
- progress_->set_text(tostr(progress) + "% " + _("checked"));
+ progress_->set_text(convert<string>(progress) + "% " + _("checked"));
}
}
+2005-01-06 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * QDocument.C:
+ * QBox.C: drop unused include tostr.h
+
+ * qt_helpers.C:
+ * QWrap.C:
+ * QVSpace.C
+ * QTabular.C:
+ * QParagraph.C:
+ * QGraphics.C:
+ * QExternal.C: tostr -> convert
+
2005-01-06 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
- * QDocument.C:
+ * QDocument.C:
* QParagraph.C: store all float/double values as strings.
2005-01-05 Lars Gullik Bjonnes <larsbj@gullik.net>
#include "insets/insetbox.h"
#include "support/lstrings.h"
-#include "support/tostr.h"
#include <qpushbutton.h>
#include <qlineedit.h>
bcview().setOK(dialog_->okPB);
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
-
+
// initialize the length validator
addCheckedLineEdit(bcview(), dialog_->widthED, dialog_->widthLA);
addCheckedLineEdit(bcview(), dialog_->heightED, dialog_->heightLA);
} else if (special == qt_("Width")) {
i = 4;
spec = true;
- }
+ }
// the user might insert a non-special value in the line edit
if (isValidLength(fromqstr(value))) {
i = 0;
#include "lyxtextclasslist.h"
#include "tex-strings.h" // tex_graphics
-#include "support/tostr.h"
#include "support/lstrings.h"
#include "controllers/ControlDocument.h"
bcview().setApply(dialog_->applyPB);
bcview().setCancel(dialog_->closePB);
bcview().setRestore(dialog_->restorePB);
-
+
// initialize the length validator
addCheckedLineEdit(bcview(), dialog_->textLayoutModule->skipLE);
- addCheckedLineEdit(bcview(), dialog_->pageLayoutModule->paperheightLE,
+ addCheckedLineEdit(bcview(), dialog_->pageLayoutModule->paperheightLE,
dialog_->pageLayoutModule->paperheightL);
- addCheckedLineEdit(bcview(), dialog_->pageLayoutModule->paperwidthLE,
+ addCheckedLineEdit(bcview(), dialog_->pageLayoutModule->paperwidthLE,
dialog_->pageLayoutModule->paperwidthL);
- addCheckedLineEdit(bcview(), dialog_->marginsModule->topLE,
+ addCheckedLineEdit(bcview(), dialog_->marginsModule->topLE,
dialog_->marginsModule->topL);
- addCheckedLineEdit(bcview(), dialog_->marginsModule->bottomLE,
+ addCheckedLineEdit(bcview(), dialog_->marginsModule->bottomLE,
dialog_->marginsModule->bottomL);
- addCheckedLineEdit(bcview(), dialog_->marginsModule->innerLE,
+ addCheckedLineEdit(bcview(), dialog_->marginsModule->innerLE,
dialog_->marginsModule->innerL);
- addCheckedLineEdit(bcview(), dialog_->marginsModule->outerLE,
+ addCheckedLineEdit(bcview(), dialog_->marginsModule->outerLE,
dialog_->marginsModule->outerL);
- addCheckedLineEdit(bcview(), dialog_->marginsModule->headsepLE,
+ addCheckedLineEdit(bcview(), dialog_->marginsModule->headsepLE,
dialog_->marginsModule->headsepL);
- addCheckedLineEdit(bcview(), dialog_->marginsModule->headheightLE,
+ addCheckedLineEdit(bcview(), dialog_->marginsModule->headheightLE,
dialog_->marginsModule->headheightL);
- addCheckedLineEdit(bcview(), dialog_->marginsModule->footskipLE,
+ addCheckedLineEdit(bcview(), dialog_->marginsModule->footskipLE,
dialog_->marginsModule->footskipL);
}
case 3:
{
VSpace vs = VSpace(
- widgetsToLength(dialog_->textLayoutModule->skipLE,
+ widgetsToLength(dialog_->textLayoutModule->skipLE,
dialog_->textLayoutModule->skipLengthCO)
);
params.setDefSkip(vs);
dialog_->textLayoutModule->lspacingCO->setCurrentItem(nitem);
if (params.spacing().getSpace() == Spacing::Other) {
dialog_->textLayoutModule->lspacingLE->setText(
- toqstr(params.spacing().getValueAsString()));
+ toqstr(params.spacing().getValueAsString()));
}
dialog_->setLSpacing(nitem);
{
skip = 3;
string const length = params.getDefSkip().asLyXCommand();
- lengthToWidgets(dialog_->textLayoutModule->skipLE,
- dialog_->textLayoutModule->skipLengthCO,
+ lengthToWidgets(dialog_->textLayoutModule->skipLE,
+ dialog_->textLayoutModule->skipLengthCO,
length, defaultUnit);
break;
}
showCO.setEnabled(!no_display && !read_only);
displayCB.setChecked(!no_display);
scaleED.setEnabled(!no_display && !read_only);
- scaleED.setText(toqstr(tostr(scale)));
+ scaleED.setText(toqstr(convert<string>(scale)));
}
widthED.setText(toqstr(scale));
widthUnitCO.setCurrentItem(0);
} else {
- widthED.setText(toqstr(tostr(data.width.value())));
+ widthED.setText(toqstr(convert<string>(data.width.value())));
// Because 'Scale' is position 0...
// Note also that width cannot be zero here, so
// we don't need to worry about the default unit.
{
clipCB.setChecked(data.clip);
graphics::BoundingBox const & bbox = data.bbox;
- xlED.setText(toqstr(tostr(bbox.xl)));
- ybED.setText(toqstr(tostr(bbox.yb)));
- xrED.setText(toqstr(tostr(bbox.xr)));
- ytED.setText(toqstr(tostr(bbox.yt)));
+ xlED.setText(toqstr(convert<string>(bbox.xl)));
+ ybED.setText(toqstr(convert<string>(bbox.yb)));
+ xrED.setText(toqstr(convert<string>(bbox.xr)));
+ ytED.setText(toqstr(convert<string>(bbox.yt)));
}
bcview().addReadOnly(dialog_->origin);
bcview().addReadOnly(dialog_->latexoptions);
bcview().addReadOnly(dialog_->getPB);
-
+
// initialize the length validator
addCheckedLineEdit(bcview(), dialog_->width, dialog_->sizewidthL_2);
addCheckedLineEdit(bcview(), dialog_->height, dialog_->sizeheightL_2);
string const xr(token(igp.bb, ' ', 2));
string const yr(token(igp.bb, ' ', 3));
if (isValidLength(xl, &anyLength)) {
- dialog_->lbX->setText(toqstr(tostr(anyLength.value())));
+ dialog_->lbX->setText(toqstr(convert<string>(anyLength.value())));
string const unit(unit_name[anyLength.unit()]);
dialog_->lbXunit->setCurrentItem(getItemNo(bb_units, unit));
} else {
dialog_->lbX->setText(toqstr(xl));
}
if (isValidLength(yl, &anyLength)) {
- dialog_->lbY->setText(toqstr(tostr(anyLength.value())));
+ dialog_->lbY->setText(toqstr(convert<string>(anyLength.value())));
string const unit(unit_name[anyLength.unit()]);
dialog_->lbYunit->setCurrentItem(getItemNo(bb_units, unit));
} else {
dialog_->lbY->setText(toqstr(xl));
}
if (isValidLength(xr, &anyLength)) {
- dialog_->rtX->setText(toqstr(tostr(anyLength.value())));
+ dialog_->rtX->setText(toqstr(convert<string>(anyLength.value())));
string const unit(unit_name[anyLength.unit()]);
dialog_->rtXunit->setCurrentItem(getItemNo(bb_units, unit));
} else {
dialog_->rtX->setText(toqstr(xl));
}
if (isValidLength(yr, &anyLength)) {
- dialog_->rtY->setText(toqstr(tostr(anyLength.value())));
+ dialog_->rtY->setText(toqstr(convert<string>(anyLength.value())));
string const unit(unit_name[anyLength.unit()]);
dialog_->rtYunit->setCurrentItem(getItemNo(bb_units, unit));
} else {
dialog_->showCB->setEnabled(igp.display != lyx::graphics::NoDisplay && !readOnly());
dialog_->displayCB->setChecked(igp.display != lyx::graphics::NoDisplay);
dialog_->displayscale->setEnabled(igp.display != lyx::graphics::NoDisplay && !readOnly());
- dialog_->displayscale->setText(toqstr(tostr(igp.lyxscale)));
+ dialog_->displayscale->setText(toqstr(convert<string>(igp.lyxscale)));
//// the output section (width/height)
// set the length combo boxes
for (int i = 0; i < num_units; i++)
dialog_->widthUnit->insertItem(unit_name_gui[i], -1);
- if (!igp.scale.empty()
+ if (!igp.scale.empty()
&& !float_equal(strToDbl(igp.scale), 0.0, 0.05)) {
dialog_->width->setText(toqstr(igp.scale));
dialog_->widthUnit->setCurrentItem(0);
} else {
// no scale means default width/height
- dialog_->width->setText(toqstr(tostr(igp.width.value())));
+ dialog_->width->setText(toqstr(convert<string>(igp.width.value())));
// the width cannot have a unitDefault, because
// it is a "Scale%" or another user defined unit!
// +1 instead of the "Scale%" option
dialog_->widthUnit->setCurrentItem(unit_ + 1);
}
// 2. the height (a lengthgcombo type)
- lengthToWidgets(dialog_->height, dialog_->heightUnit,
+ lengthToWidgets(dialog_->height, dialog_->heightUnit,
igp.height.asString(), unitDefault);
// enable height input in case of non "Scale%" as width-unit
string value = fromqstr(dialog_->width->text());
if (dialog_->widthUnit->currentItem() > 0 || isValidLength(value)) {
// width/height combination
- igp.width =
+ igp.width =
widgetsToLength(dialog_->width, dialog_->widthUnit);
igp.scale = string();
} else {
igp.width = LyXLength();
}
value = fromqstr(dialog_->height->text());
- igp.height =
+ igp.height =
LyXLength(widgetsToLength(dialog_->height, dialog_->heightUnit));
igp.keepAspectRatio = dialog_->aspectratio->isChecked();
float rotAngle = strToDbl(igp.rotateAngle);
if (std::abs(rotAngle) > 360.0) {
rotAngle -= 360.0 * floor(rotAngle / 360.0);
- igp.rotateAngle = tostr(rotAngle);
+ igp.rotateAngle = convert<string>(rotAngle);
}
// save the latex name for the origin. If it is the default
#include "controllers/ControlParagraph.h"
#include "controllers/helper_funcs.h"
-#include "support/tostr.h"
-
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qcombobox.h>
bcview().addReadOnly(dialog_->lastfooterBorderBelowCB);
bcview().addReadOnly(dialog_->lastfooterNoContentsCB);
bcview().addReadOnly(dialog_->newpageCB);
-
+
// initialize the length validator
- addCheckedLineEdit(bcview(), dialog_->widthED,
+ addCheckedLineEdit(bcview(), dialog_->widthED,
dialog_->fixedWidthColLA);
}
LyXTabular::row_type const row(tabular.row_of_cell(cell));
LyXTabular::col_type const col(tabular.column_of_cell(cell));
- dialog_->tabularRowED->setText(toqstr(tostr(row + 1)));
- dialog_->tabularColumnED->setText(toqstr(tostr(col + 1)));
+ dialog_->tabularRowED->setText(toqstr(convert<string>(row + 1)));
+ dialog_->tabularColumnED->setText(toqstr(convert<string>(col + 1)));
bool const multicol(tabular.isMultiColumn(cell));
#include "controllers/helper_funcs.h"
#include "support/lstrings.h"
-#include "support/tostr.h"
#include <qcombobox.h>
#include <qlineedit.h>
namespace {
string const numtostr(double val) {
- string a(tostr(val));
+ string a(convert<string>(val));
+#warning Will this test ever trigger? (Lgb)
if (a == "0")
a.erase();
return a;
return LyXLength(fromqstr(length));
LyXLength::UNIT unit = unitFromString(fromqstr(combo->currentText()));
-
+
return LyXLength(length.toDouble(), unit);
}
input->setText(toqstr(len));
} else {
combo->setCurrentItem(LyXLength(len).unit());
- input->setText(toqstr(tostr(LyXLength(len).value())));
+ input->setText(toqstr(convert<string>(LyXLength(len).value())));
}
}
+2005-01-06 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * xforms_helpers.C:
+ * XFormsMenubar.C:
+ * FormWrap.C:
+ * FormSpellchecker.C:
+ * FormPrint.C:
+ * FormGraphics.C:
+ * FormFiledialog.C:
+ * FormExternal.C:
+ * FormColorPicker.C:
+ * FormBox.C:
+ * FontInfo.C:
+ * ColorHandler.C: convert -> tostr
+
2005-01-06 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
- * FormDocument.C:
+ * FormDocument.C:
* FormParagraph.C: store all float/double values as strings.
2005-01-05 Lars Gullik Bjonnes <larsbj@gullik.net>
string tostr(XColor const & col)
{
return bformat("(%1$s,%2$s,%3$s)",
- ::tostr(col.red),
- ::tostr(col.green),
- ::tostr(col.blue));
+ ::convert<string>(col.red),
+ ::convert<string>(col.green),
+ ::convert<string>(col.blue));
}
} // namespace
lyxerr << bformat(
_(" Using closest allocated color with (r,g,b)=%1$s instead.\n"
"Pixel [%2$s] is used."),
- tostr(cmap[closest_pixel]), ::tostr(closest_pixel)) << endl;
+ tostr(cmap[closest_pixel]), convert<string>(closest_pixel)) << endl;
val.foreground = cmap[closest_pixel].pixel;
}
break;
}
}
- ret.replace(before, after, tostr(size));
+ ret.replace(before, after, convert<string>(size));
return ret;
}
setEnabled(dialog_->radio_minipage, controller().params().inner_box);
LyXLength len(controller().params().width);
- fl_set_input(dialog_->input_width, tostr(len.value()).c_str());
+ fl_set_input(dialog_->input_width, convert<string>(len.value()).c_str());
fl_set_choice(dialog_->choice_width_unit, len.unit() + 1);
string special(controller().params().special);
for (unsigned int i = 0; i < gui_names_spec_.size(); ++i) {
setEnabled(dialog_->choice_special, !controller().params().inner_box);
LyXLength ht(controller().params().height);
- fl_set_input(dialog_->input_height, tostr(ht.value()).c_str());
+ fl_set_input(dialog_->input_height, convert<string>(ht.value()).c_str());
fl_set_choice(dialog_->choice_height_unit, ht.unit() + 1);
string const height_special(controller().params().height_special);
for (unsigned int i = 0; i < gui_names_spec_.size(); ++i) {
string const fillLabel(RGBColor const & rgb)
{
- return tostr(rgb.r) + ", " + tostr(rgb.g) + ", " + tostr(rgb.b);
+ return convert<string>(rgb.r) + ", " + convert<string>(rgb.g) + ", " + convert<string>(rgb.b);
}
int const s = int(100.0 * hsv.s);
int const v = int(100.0 * hsv.v);
- return tostr(h) + ", " + tostr(s) + ", " + tostr(v);
+ return convert<string>(h) + ", " + convert<string>(s) + ", " + convert<string>(v);
}
} // namespace anon
fl_set_button(displayCB, !no_display);
- fl_set_input(scaleED, tostr(scale).c_str());
+ fl_set_input(scaleED, convert<string>(scale).c_str());
setEnabled(scaleED, !no_display && !read_only);
}
fl_set_input(widthED, scale.c_str());
fl_set_choice(widthUnitCO, 1);
} else {
- fl_set_input(widthED, tostr(data.width.value()).c_str());
+ fl_set_input(widthED, convert<string>(data.width.value()).c_str());
// Because 'Scale' is position 1...
// Note also that width cannot be zero here, so
// we don't need to worry about the default unit.
fl_set_button(clipCB, data.clip);
graphics::BoundingBox const & bbox = data.bbox;
- fl_set_input(xlED, tostr(bbox.xl).c_str());
- fl_set_input(ybED, tostr(bbox.yb).c_str());
- fl_set_input(xrED, tostr(bbox.xr).c_str());
- fl_set_input(ytED, tostr(bbox.yt).c_str());
+ fl_set_input(xlED, convert<string>(bbox.xl).c_str());
+ fl_set_input(ybED, convert<string>(bbox.yb).c_str());
+ fl_set_input(xrED, convert<string>(bbox.xr).c_str());
+ fl_set_input(ytED, convert<string>(bbox.yt).c_str());
}
void UserCache::add(uid_t ID) const
{
struct passwd const * entry = getpwuid(ID);
- users[ID] = entry ? entry->pw_name : tostr(int(ID));
+ users[ID] = entry ? entry->pw_name : convert<string>(int(ID));
}
void GroupCache::add(gid_t ID) const
{
struct group const * entry = getgrgid(ID);
- groups[ID] = entry ? entry->gr_name : tostr(int(ID));
+ groups[ID] = entry ? entry->gr_name : convert<string>(int(ID));
}
+
// local instances
UserCache lyxUserCache;
GroupCache lyxGroupCache;
// first item in choice_width means scaling
if (fl_get_choice(file_->choice_width) == 1) {
igp.scale = getString(file_->input_width);
- if (igp.scale.empty()
- || float_equal(strToDbl(igp.scale), 0.0, 0.05)
+ if (igp.scale.empty()
+ || float_equal(strToDbl(igp.scale), 0.0, 0.05)
|| float_equal(strToDbl(igp.scale), 100.0, 0.05)) {
igp.scale = string();
}
float rotAngle = strToDbl(igp.rotateAngle);
if (std::abs(rotAngle) > 360.0) {
rotAngle -= 360.0 * floor(rotAngle / 360.0);
- igp.rotateAngle = tostr(rotAngle);
+ igp.rotateAngle = convert<string>(rotAngle);
}
fl_set_input(extra_->input_rotate_angle, igp.rotateAngle.c_str());
string const name =
igp.filename.outputFilename(kernel().bufferFilepath());
fl_set_input(file_->input_filename, name.c_str());
- fl_set_input(file_->input_lyxscale, tostr(igp.lyxscale).c_str());
+ fl_set_input(file_->input_lyxscale, convert<string>(igp.lyxscale).c_str());
switch (igp.display) {
case graphics::NoDisplay:
igp.height, defaultUnit);
// disable height input in case of scaling
- bool const disable_height = (!igp.scale.empty()
+ bool const disable_height = (!igp.scale.empty()
&& !float_equal(strToDbl(igp.scale), 0.0, 0.05));
setEnabled(file_->input_height, !disable_height);
setEnabled(file_->choice_height, !disable_height);
bool const spacing_other = space.getSpace() == Spacing::Other;
setEnabled(dialog_->input_linespacing, spacing_other);
if (spacing_other) {
- fl_set_input(dialog_->input_linespacing,
+ fl_set_input(dialog_->input_linespacing,
space.getValueAsString().c_str());
} else {
fl_set_input(dialog_->input_linespacing, "");
// we might just be remembering the last time this was printed.
all_pages_.set(pp.all_pages);
- string const from = ( pp.from_page ? tostr(pp.from_page) : string() );
- string const to = ( pp.to_page ? tostr(pp.to_page) : string() );
+ string const from = ( pp.from_page ? convert<string>(pp.from_page) : string() );
+ string const to = ( pp.to_page ? convert<string>(pp.to_page) : string() );
fl_set_input(dialog_->input_from_page, from.c_str());
fl_set_input(dialog_->input_to_page, to.c_str());
double const wordcount = controller().getCount();
double const total = 100.0 * wordcount / progress;
- string const label = tostr(progress) + " %";
+ string const label = convert<string>(progress) + " %";
fl_set_slider_bounds(dialog_->slider_progress, 0.0, total);
fl_set_slider_value(dialog_->slider_progress, wordcount);
{
InsetWrapParams const & params = controller().params();
LyXLength len(params.width);
- fl_set_input(dialog_->input_width, tostr(len.value()).c_str());
+ fl_set_input(dialog_->input_width, convert<string>(len.value()).c_str());
fl_set_choice(dialog_->choice_width_units, len.unit() + 1);
if (params.placement.empty())
*item.submenu(), smn, funcs);
if (submenuid == -1)
return -1;
- label += "%x" + tostr(smn.size());
+ label += "%x" + convert<string>(smn.size());
lyxerr[Debug::GUI]
<< "Menu: " << submenuid
<< " (at index " << smn.size()
int const action_count =
distance(funcs.begin(), fit);
- label += "%x" + tostr(action_count + action_offset);
+ label += "%x" + convert<string>(action_count + action_offset);
lyxerr[Debug::GUI] << "Action: \""
<< item.func().action
<< "(" << item.func().argument
fl_set_input(input, "");
fl_set_choice_text(choice, default_unit.c_str());
} else {
- fl_set_input(input, tostr(len.value()).c_str());
+ fl_set_input(input, convert<string>(len.value()).c_str());
// Set the choice to the desired unit, if present in the choice.
// Else set the choice to the default unit.
+2005-01-06 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * PreviewLoader.C (unique_filename): tostr -> convert
+
2005-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* PreviewLoader.C: lyxrc.preview_scale_factor is a string now.
// Output the script to file.
static int counter = 0;
script_file_ = OnlyPath(to_file_base) + "lyxconvert" +
- tostr(counter++) + ".sh";
+ convert<string>(counter++) + ".sh";
std::ofstream fs(script_file_.c_str());
if (!fs.good()) {
// Create a temporary base file-name for all intermediate steps.
// Remember to remove the temp file because we only want the name...
static int counter = 0;
- string const tmp = "gconvert" + tostr(counter++);
+ string const tmp = "gconvert" + convert<string>(counter++);
string const to_base = tempName(string(), tmp);
unlink(to_base);
string const unique_filename(string const bufferpath)
{
static int theCounter = 0;
- string const filename = tostr(theCounter++) + "lyxpreview";
+ string const filename = convert<string>(theCounter++) + "lyxpreview";
return support::AddName(bufferpath, filename);
}
+2005-01-06 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * insetwrap.C:
+ * insettabular.C:
+ * insetinclude.C:
+ * insetfloat.C:
+ * insetexternal.C:
+ * insetbibitem.C:
+ * ExternalTransforms.C (adjAngle): tostr -> convert
+
2005-01-05 Lars Gullik Bjonnes <larsbj@gullik.net>
* inset.[Ch] (forceDefaultParagraphs): delete since it is same as
double rotAngle = strToDbl(angle);
if (std::abs(rotAngle) > 360.0) {
rotAngle -= 360.0 * floor(rotAngle / 360.0);
- return tostr(rotAngle);
+ return convert<string>(rotAngle);
}
return angle;
}
: InsetCommand(p, "bibitem"), counter(1)
{
if (getContents().empty())
- setContents(key_prefix + tostr(++key_counter));
+ setContents(key_prefix + convert<string>(++key_counter));
}
string const InsetBibitem::getBibLabel() const
{
- return getOptions().empty() ? tostr(counter) : getOptions();
+ return getOptions().empty() ? convert<string>(counter) : getOptions();
}
<< '\n';
if (lyxscale != defaultLyxScale)
- os << "\tlyxscale " << tostr(lyxscale) << '\n';
+ os << "\tlyxscale " << convert<string>(lyxscale) << '\n';
if (draft)
os << "\tdraft\n";
if (pit->layout()->name() == caplayout) {
string const name = floatname(params_.type, buf.params());
string const str =
- tostr(toclist[name].size() + 1)
+ convert<string>(toclist[name].size() + 1)
+ ". " + pit->asString(buf, false);
lyx::toc::TocItem const item(pit->id(), 0 , str);
toclist[name].push_back(item);
string const uniqueID()
{
static unsigned int seed = 1000;
- return "file" + tostr(++seed);
+ return "file" + convert<string>(++seed);
}
} // namespace anon
void InsetInclude::write(ostream & os) const
{
os << "Include " << params_.getCommand() << '\n'
- << "preview " << tostr(params_.preview()) << '\n';
+ << "preview " << convert<string>(params_.preview()) << '\n';
}
x += scroll();
x += ADD_TO_TABULAR_WIDTH;
-
+
if (tablemode(cur)) {
row_type rs, re;
col_type cs, ce;
pi.pain.fillRectangle(xx, y - a, w, h,
LColor::selection);
xx += w;
-
+
}
y += h;
}
-
+
} else {
cur.text()->drawSelection(pi, x + getCellXPos(cur.idx()) + tabular.getBeginningOfTextInCell(cur.idx()), 0 /*this value is ignored */);
}
namespace {
-
+
// Manhattan distance to nearest corner
int dist(InsetOld const & inset, int x, int y)
if (tmp->layout()->name() == caplayout) {
string const name = floatname(params_.type, buf.params());
string const str =
- tostr(toclist[name].size() + 1)
+ convert<string>(toclist[name].size() + 1)
+ ". " + tmp->asString(buf, false);
lyx::toc::TocItem const item(tmp->id(), 0 , str);
toclist[name].push_back(item);
if (replace_count == 1) {
lv->message(_("String has been replaced."));
} else {
- string str = tostr(replace_count);
+ string str = convert<string>(replace_count);
str += _(" strings have been replaced.");
lv->message(str);
}
if (filename.empty()) {
filename = AddName(lyxrc.document_path,
- "newfile" + tostr(++newfile_number) + ".lyx");
+ "newfile" + convert<string>(++newfile_number) + ".lyx");
FileInfo fi(filename);
while (bufferlist.exists(filename) || fi.readable()) {
++newfile_number;
filename = AddName(lyxrc.document_path,
- "newfile" + tostr(newfile_number) +
+ "newfile" + convert<string>(newfile_number) +
".lyx");
fi.newFile(filename);
}
auto_region_delete != system_lyxrc.auto_region_delete) {
os << "# Set to false to inhibit automatic replacement of\n"
<< "# the current selection.\n"
- << "\\auto_region_delete " << tostr(auto_region_delete)
+ << "\\auto_region_delete " << convert<string>(auto_region_delete)
<< '\n';
}
case RC_AUTORESET_OPTIONS:
auto_reset_options != system_lyxrc.auto_reset_options) {
os << "# Set to false to inhibit automatic reset of\n"
<< "# the class options to defaults on class change.\n"
- << "\\auto_reset_options " << tostr(auto_reset_options)
+ << "\\auto_reset_options "
+ << convert<string>(auto_reset_options)
<< '\n';
}
case RC_AUTOSAVE:
case RC_KBMAP:
if (ignore_system_lyxrc ||
use_kbmap != system_lyxrc.use_kbmap) {
- os << "\\kbmap " << tostr(use_kbmap) << '\n';
+ os << "\\kbmap " << convert<string>(use_kbmap) << '\n';
}
case RC_KBMAP_PRIMARY:
if (ignore_system_lyxrc ||
case RC_SHOW_BANNER:
if (ignore_system_lyxrc ||
show_banner != system_lyxrc.show_banner) {
- os << "\\show_banner " << tostr(show_banner) << '\n';
+ os << "\\show_banner " << convert<string>(show_banner) << '\n';
}
case RC_PREVIEW:
preview_hashed_labels !=
system_lyxrc.preview_hashed_labels) {
os << "\\preview_hashed_labels "
- << tostr(preview_hashed_labels) << '\n';
+ << convert<string>(preview_hashed_labels) << '\n';
}
case RC_PREVIEW_SCALE_FACTOR:
cursor_follows_scrollbar
!= system_lyxrc.cursor_follows_scrollbar) {
os << "\\cursor_follows_scrollbar "
- << tostr(cursor_follows_scrollbar) << '\n';
+ << convert<string>(cursor_follows_scrollbar) << '\n';
}
case RC_DIALOGS_ICONIFY_WITH_MAIN:
if (ignore_system_lyxrc ||
dialogs_iconify_with_main
!= system_lyxrc.dialogs_iconify_with_main) {
os << "\\dialogs_iconify_with_main "
- << tostr(dialogs_iconify_with_main) << '\n';
+ << convert<string>(dialogs_iconify_with_main) << '\n';
}
case RC_SCREEN_FONT_ROMAN:
if (ignore_system_lyxrc ||
if (ignore_system_lyxrc ||
use_scalable_fonts != system_lyxrc.use_scalable_fonts) {
os << "\\screen_font_scalable "
- << tostr(use_scalable_fonts)
+ << convert<string>(use_scalable_fonts)
<< '\n';
}
case RC_SCREEN_FONT_ENCODING:
if (ignore_system_lyxrc ||
print_adapt_output != system_lyxrc.print_adapt_output) {
os << "\\print_adapt_output "
- << tostr(print_adapt_output)
+ << convert<string>(print_adapt_output)
<< '\n';
}
case RC_PRINT_COMMAND:
case RC_CHECKLASTFILES:
if (ignore_system_lyxrc ||
check_lastfiles != system_lyxrc.check_lastfiles) {
- os << "\\check_lastfiles " << tostr(check_lastfiles)
+ os << "\\check_lastfiles " << convert<string>(check_lastfiles)
<< '\n';
}
case RC_TEMPLATEPATH:
case RC_MAKE_BACKUP:
if (ignore_system_lyxrc ||
make_backup != system_lyxrc.make_backup) {
- os << "\\make_backup " << tostr(make_backup) << '\n';
+ os << "\\make_backup " << convert<string>(make_backup) << '\n';
}
case RC_BACKUPDIR_PATH:
if (ignore_system_lyxrc ||
case RC_USE_SPELL_LIB:
if (ignore_system_lyxrc ||
use_spell_lib != system_lyxrc.use_spell_lib) {
- os << "\\use_spell_lib " << tostr(use_spell_lib) << '\n';
+ os << "\\use_spell_lib " << convert<string>(use_spell_lib) << '\n';
}
case RC_SPELL_COMMAND:
if (ignore_system_lyxrc ||
case RC_ACCEPT_COMPOUND:
if (ignore_system_lyxrc ||
isp_accept_compound != system_lyxrc.isp_accept_compound) {
- os << "\\accept_compound " << tostr(isp_accept_compound)
+ os << "\\accept_compound " << convert<string>(isp_accept_compound)
<< '\n';
}
case RC_USE_ALT_LANG:
if (ignore_system_lyxrc ||
isp_use_alt_lang != system_lyxrc.isp_use_alt_lang) {
- os << "\\use_alt_language " << tostr(isp_use_alt_lang)
+ os << "\\use_alt_language " << convert<string>(isp_use_alt_lang)
<< '\n';
}
case RC_ALT_LANG:
case RC_USE_ESC_CHARS:
if (ignore_system_lyxrc ||
isp_use_esc_chars != system_lyxrc.isp_use_esc_chars) {
- os << "\\use_escape_chars " << tostr(isp_use_esc_chars)
+ os << "\\use_escape_chars " << convert<string>(isp_use_esc_chars)
<< '\n';
}
case RC_ESC_CHARS:
if (ignore_system_lyxrc ||
isp_use_pers_dict != system_lyxrc.isp_use_pers_dict) {
os << "\\use_personal_dictionary "
- << tostr(isp_use_pers_dict)
+ << convert<string>(isp_use_pers_dict)
<< '\n';
}
case RC_PERS_DICT:
isp_use_input_encoding
!= system_lyxrc.isp_use_input_encoding) {
os << "\\use_input_encoding "
- << tostr(isp_use_input_encoding)
+ << convert<string>(isp_use_input_encoding)
<< '\n';
}
case RC_RTL_SUPPORT:
if (ignore_system_lyxrc ||
rtl_support != system_lyxrc.rtl_support) {
- os << "\\rtl " << tostr(rtl_support) << '\n';
+ os << "\\rtl " << convert<string>(rtl_support) << '\n';
}
case RC_LANGUAGE_PACKAGE:
if (ignore_system_lyxrc ||
language_global_options
!= system_lyxrc.language_global_options) {
os << "\\language_global_options \""
- << tostr(language_global_options)
+ << convert<string>(language_global_options)
<< "\"\n";
}
case RC_LANGUAGE_USE_BABEL:
if (ignore_system_lyxrc ||
language_use_babel != system_lyxrc.language_use_babel) {
os << "\\language_use_babel \""
- << tostr(language_use_babel)
+ << convert<string>(language_use_babel)
<< "\"\n";
}
case RC_LANGUAGE_COMMAND_BEGIN:
if (ignore_system_lyxrc ||
language_auto_begin != system_lyxrc.language_auto_begin) {
os << "\\language_auto_begin "
- << tostr(language_auto_begin) << '\n';
+ << convert<string>(language_auto_begin) << '\n';
}
case RC_LANGUAGE_AUTO_END:
if (ignore_system_lyxrc ||
language_auto_end != system_lyxrc.language_auto_end) {
os << "\\language_auto_end "
- << tostr(language_auto_end) << '\n';
+ << convert<string>(language_auto_end) << '\n';
}
case RC_MARK_FOREIGN_LANGUAGE:
if (ignore_system_lyxrc ||
mark_foreign_language
!= system_lyxrc.mark_foreign_language) {
os << "\\mark_foreign_language " <<
- tostr(mark_foreign_language) << '\n';
+ convert<string>(mark_foreign_language) << '\n';
}
os << "\n#\n"
case RC_AUTO_NUMBER:
if (ignore_system_lyxrc ||
auto_number != system_lyxrc.auto_number) {
- os << "\\auto_number " << tostr(auto_number) << '\n';
+ os << "\\auto_number " << convert<string>(auto_number) << '\n';
}
case RC_DEFAULT_LANGUAGE:
if (ignore_system_lyxrc ||
break;
case RC_NUMLASTFILES:
- str = bformat(_("Maximal number of lastfiles. Up to %1$s can appear in the file menu."), tostr(maxlastfiles));
+ str = bformat(_("Maximal number of lastfiles. Up to %1$d can appear in the file menu."), maxlastfiles);
break;
case RC_CHECKLASTFILES:
sgml::closeTag(os, bstyle->labeltag());
}
- // Opend inner tag and close inner tags
+ // Opend inner tag and close inner tags
sgml::openTag(os, bstyle->innertag());
par->simpleDocBookOnePar(buf, os, runparams, outerFont(par - paragraphs.begin(), paragraphs));
sgml::closeTag(os, bstyle->innertag());
os << '<' << tag_name(*j) << '>';
}
- char c = getChar(i);
+ value_type c = getChar(i);
if (c == Paragraph::META_INSET) {
if (isInset(i)) {
InsetBase const * inset = getInset(i);
InsetBase::Code lyx_code = inset->lyxCode();
- if (lyx_code != InsetBase::TOC_CODE and
- lyx_code != InsetBase::INCLUDE_CODE and
- lyx_code != InsetBase::GRAPHICS_CODE and
- lyx_code != InsetBase::ERT_CODE and
- lyx_code != InsetBase::FLOAT_CODE and
+ if (lyx_code != InsetBase::TOC_CODE &&
+ lyx_code != InsetBase::INCLUDE_CODE &&
+ lyx_code != InsetBase::GRAPHICS_CODE &&
+ lyx_code != InsetBase::ERT_CODE &&
+ lyx_code != InsetBase::FLOAT_CODE &&
lyx_code != InsetBase::TABULAR_CODE) {
return false;
}
} else {
- char c = getChar(i);
- if(c!= ' ' and c!= '\t')
+ value_type c = getChar(i);
+ if (c != ' ' && c != '\t')
return false;
}
-
}
return true;
}
InsetBase const * inset = getInset(i);
inset->docbook(buf, os, runparams);
} else {
- char c = getChar(i);
+ value_type c = getChar(i);
if (c == ' ')
break;
bool ws;
LyXFont font = getFont(buf.params(), i, outerfont);
if (isInset(i))
return false;
- if ( i != initial and font != font_old)
+ if (i != initial && font != font_old)
return false;
font_old = font;
}
LyXFont font_old =
style->labeltype == LABEL_MANUAL ? style->labelfont : style->font;
- if (style->pass_thru and not onlyText(buf, outerfont, initial))
+ if (style->pass_thru && !onlyText(buf, outerfont, initial))
os << "]]>";
+
// parsing main loop
for (pos_type i = initial; i < size(); ++i) {
LyXFont font = getFont(buf.params(), i, outerfont);
InsetBase const * inset = getInset(i);
inset->docbook(buf, os, runparams);
} else {
- char c = getChar(i);
+ value_type c = getChar(i);
bool ws;
string str;
boost::tie(ws, str) = sgml::escapeChar(c);
if (style->free_spacing)
os << '\n';
- if (style->pass_thru and not onlyText(buf, outerfont, initial))
+ if (style->pass_thru && !onlyText(buf, outerfont, initial))
os << "<![CDATA[";
}
//void draw(PainterInfo & pi, int x, int y, LyXText & text) const
//{
//}
-
} else {
spacing_val = buffer.params().spacing().getValue();
}
-#warning Look is this correct?
+#warning Look is this correct?
int const labeladdon = int(font_metrics::maxHeight(font) * layout->spacing.getValue() * spacing_val);
int const maxdesc = int(font_metrics::maxDescent(font) * layout->spacing.getValue() * spacing_val)
// if we reach the end of a struck out range, paint it
// we also don't paint across things like tables
if (running_strikeout && (highly_editable_inset || !is_struckout)) {
- // FIXME this should take real text height into account, not
+ // FIXME this should take real text height into account, not
// the whole row including padding whitespace
//int const middle = yo_ + (- row_.ascent() + row_.top_of_text()) / 2;
int const middle = yo_ - row_.ascent() / 2;
static NullPainter nop;
static PainterInfo nullpi(pi.base.bv, nop);
int const ww = pi.base.bv->workHeight();
-
+
Paragraph & par = text.paragraphs()[pit];
RowList::iterator const rb = par.rows().begin();
bool const inside = (y + rit->descent() >= 0
&& y - rit->ascent() < ww);
RowPainter rp(inside ? pi : nullpi, text, pit, *rit, x, y);
-
+
y += rit->descent();
rp.paintAppendix();
rp.paintDepthBar();
paintPar(pi, *bv.text(), pit, 0, yy);
yy += text->getPar(pit).descent();
}
-
+
// paint one paragraph above and one below
if (vi.p1 > 0) {
string const uniqueID(string const label)
{
static unsigned int seed = 1000;
- return label + tostr(++seed);
+ return label + convert<string>(++seed);
}
}
}
if (mangle) {
- content += "-" + tostr(mangleID++);
+ content += "-" + convert<string>(mangleID++);
}
- else if (isdigit(content[content.size()-1])) {
+ else if (isdigit(content[content.size() - 1])) {
content += ".";
}
else
counters.step(style->latexname());
int i = counters.value(name);
- attribute = subst(param, "#", tostr(i));
+ attribute = subst(param, "#", convert<string>(i));
} else {
attribute = param;
}
+2005-01-06 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * lstrings.[Ch]: change bformat to be a template
+
+ * tostr.[Ch]: tostr -> convert, convert is a template
+
+ * tempname.C:
+ * filetools.C (createBufferTmpDir): tostr -> convert
+
2005-01-05 Angus Leeming <leeming@lyx.org>
* os_win32.C (external_path, internal_path): s/MAX_PATH/PATH_MAX/.
// We are in our own directory. Why bother to mangle name?
// In fact I wrote this code to circumvent a problematic behaviour (bug?)
// of EMX mkstemp().
- string const tmpfl = os::getTmpDir() + "/lyx_tmpbuf" + tostr(count++);
+ string const tmpfl = os::getTmpDir() + "/lyx_tmpbuf" + convert<string>(count++);
if (mkdir(tmpfl, 0777)) {
lyxerr << "LyX could not create the temporary directory '"
<< tmpfl << "'" << endl;
#include <boost/tokenizer.hpp>
#include <boost/assert.hpp>
+
+#ifndef I_AM_NOT_AFRAID_OF_HEADER_LIBRARIES
+#if USE_BOOST_FORMAT
#include <boost/format.hpp>
+#endif
+#endif
#include <cctype>
#include <cstdlib>
#else
boost::char_separator<char> sep(delim.c_str());
boost::tokenizer<boost::char_separator<char> > tokens(str, sep);
-#ifndef USE_INCLUDED_STRING
return vector<string>(tokens.begin(), tokens.end());
-#else
- vector<string> vec;
- using boost::tokenizer;
- using boost::char_separator;
-
- tokenizer<char_separator<char> >::iterator it = tokens.begin();
- tokenizer<char_separator<char> >::iterator end = tokens.end();
- for (; it != end; ++it) {
- vec.push_back(STRCONV((*it)));
- }
- return vec;
-#endif
#endif
}
}
+#ifndef I_AM_NOT_AFRAID_OF_HEADER_LIBRARIES
#if USE_BOOST_FORMAT
-string bformat(string const & fmt, string const & arg1)
+template<>
+string bformat(string const & fmt, int arg1)
{
return (boost::format(fmt) % arg1).str();
}
-string bformat(string const & fmt, string const & arg1, string const & arg2)
+template<>
+string bformat(string const & fmt, long arg1)
{
- return (boost::format(fmt) % arg1 % arg2).str();
+ return (boost::format(fmt) % arg1).str();
+}
+
+
+template<>
+string bformat(string const & fmt, unsigned int arg1)
+{
+ return (boost::format(fmt) % arg1).str();
+}
+
+
+template<>
+string bformat<string>(string const & fmt, string arg1)
+{
+ return (boost::format(fmt) % arg1).str();
+}
+
+
+template<>
+string bformat(string const & fmt, char * arg1)
+{
+ return (boost::format(fmt) % arg1).str();
}
+template<>
string bformat(string const & fmt, int arg1, int arg2)
{
return (boost::format(fmt) % arg1 % arg2).str();
}
-string bformat(string const & fmt, string const & arg1, string const & arg2,
- string const & arg3)
+template<>
+string bformat(string const & fmt, string arg1, string arg2)
+{
+ return (boost::format(fmt) % arg1 % arg2).str();
+}
+
+
+template<>
+string bformat(string const & fmt, char const * arg1, string arg2)
+{
+ return (boost::format(fmt) % arg1 % arg2).str();
+}
+
+
+template<>
+string bformat(string const & fmt, string arg1, string arg2, string arg3)
{
return (boost::format(fmt) % arg1 % arg2 % arg3).str();
}
-string bformat(string const & fmt, string const & arg1, string const & arg2,
- string const & arg3, string const & arg4)
+template<>
+string bformat(string const & fmt,
+ string arg1, string arg2, string arg3, string arg4)
{
return (boost::format(fmt) % arg1 % arg2 % arg3 % arg4).str();
}
+#else
+
+template<>
+string bformat(string const & fmt, int arg1)
+{
+ BOOST_ASSERT(contains(fmt, "%1$d"));
+ string const str = subst(fmt, "%1$d", convert<string>(arg1));
+ return subst(str, "%%", "%");
+}
+
-string bformat(string const & fmt, string const & arg1, string const & arg2,
- string const & arg3, string const & arg4, string const & arg5)
+template<>
+string bformat(string const & fmt, long arg1)
{
- return (boost::format(fmt) % arg1 % arg2 % arg3 % arg4 % arg5).str();
+ BOOST_ASSERT(contains(fmt, "%1$d"));
+ string const str = subst(fmt, "%1$d", convert<string>(arg1));
+ return subst(str, "%%", "%");
}
-#else
-string bformat(string const & fmt, string const & arg1)
+template<>
+string bformat(string const & fmt, unsigned int arg1)
+{
+ BOOST_ASSERT(contains(fmt, "%1$d"));
+ string const str = subst(fmt, "%1$d", convert<string>(arg1));
+ return subst(str, "%%", "%");
+}
+
+
+template<>
+string bformat(string const & fmt, string arg1)
{
BOOST_ASSERT(contains(fmt, "%1$s"));
string const str = subst(fmt, "%1$s", arg1);
}
-string bformat(string const & fmt, string const & arg1, string const & arg2)
+template<>
+string bformat(string const & fmt, char * arg1)
+{
+ BOOST_ASSERT(contains(fmt, "%1$s"));
+ string const str = subst(fmt, "%1$s", arg1);
+ return subst(str, "%%", "%");
+}
+template<>
+string bformat(string const & fmt, string arg1, string arg2)
{
BOOST_ASSERT(contains(fmt, "%1$s"));
BOOST_ASSERT(contains(fmt, "%2$s"));
}
-string bformat(string const & fmt, int arg1, int arg2)
+template<>
+string bformat(string const & fmt, char const * arg1, string arg2)
{
- BOOST_ASSERT(contains(fmt, "%1$d"));
- BOOST_ASSERT(contains(fmt, "%2$d"));
- string str = subst(fmt, "%1$d", tostr(arg1));
- str = subst(str, "%2$d", tostr(arg2));
+ BOOST_ASSERT(contains(fmt, "%1$s"));
+ BOOST_ASSERT(contains(fmt, "%2$s"));
+ string str = subst(fmt, "%1$s", arg1);
+ str = subst(fmt, "%2$s", arg2);
return subst(str, "%%", "%");
}
-string bformat(string const & fmt, string const & arg1, string const & arg2,
- string const & arg3)
+template<>
+string bformat(string const & fmt, int arg1, int arg2)
{
- BOOST_ASSERT(contains(fmt, "%1$s"));
- BOOST_ASSERT(contains(fmt, "%2$s"));
- BOOST_ASSERT(contains(fmt, "%3$s"));
- string str = subst(fmt, "%1$s", arg1);
- str = subst(str, "%2$s", arg2);
- str = subst(str, "%3$s", arg3);
+ BOOST_ASSERT(contains(fmt, "%1$d"));
+ BOOST_ASSERT(contains(fmt, "%2$d"));
+ string str = subst(fmt, "%1$d", convert<string>(arg1));
+ str = subst(str, "%2$d", convert<string>(arg2));
return subst(str, "%%", "%");
}
-string bformat(string const & fmt, string const & arg1, string const & arg2,
- string const & arg3, string const & arg4)
+template<>
+string bformat(string const & fmt, string arg1, string arg2, string arg3)
{
BOOST_ASSERT(contains(fmt, "%1$s"));
BOOST_ASSERT(contains(fmt, "%2$s"));
BOOST_ASSERT(contains(fmt, "%3$s"));
- BOOST_ASSERT(contains(fmt, "%4$s"));
string str = subst(fmt, "%1$s", arg1);
str = subst(str, "%2$s", arg2);
str = subst(str, "%3$s", arg3);
- str = subst(str, "%4$s", arg4);
return subst(str, "%%", "%");
}
-string bformat(string const & fmt, string const & arg1, string const & arg2,
- string const & arg3, string const & arg4, string const & arg5)
+template<>
+string bformat(string const & fmt,
+ string arg1, string arg2, string arg3, string arg4)
{
BOOST_ASSERT(contains(fmt, "%1$s"));
BOOST_ASSERT(contains(fmt, "%2$s"));
BOOST_ASSERT(contains(fmt, "%3$s"));
BOOST_ASSERT(contains(fmt, "%4$s"));
- BOOST_ASSERT(contains(fmt, "%5$s"));
string str = subst(fmt, "%1$s", arg1);
str = subst(str, "%2$s", arg2);
str = subst(str, "%3$s", arg3);
str = subst(str, "%4$s", arg4);
- str = subst(str, "%5$s", arg5);
return subst(str, "%%", "%");
}
+#endif
#endif
} // namespace support
std::string const getStringFromVector(std::vector<std::string> const & vec,
std::string const & delim = std::string(","));
-// wrapper around boost::format using one argument %1$s
-std::string bformat(std::string const & fmt, std::string const & arg1);
-// arguments %1$s and %2$s
-std::string bformat(std::string const & fmt, std::string const & arg1, std::string const & arg2);
-// arguments %1$d and %2$d
-std::string bformat(std::string const & fmt, int arg1, int arg2);
-// arguments %1$s and %2$s and %3$s
-std::string bformat(std::string const & fmt, std::string const & arg1, std::string const & arg2,
- std::string const & arg3);
-// arguments %1$s and %2$s and %3$s and %4$s
-std::string bformat(std::string const & fmt, std::string const & arg1, std::string const & arg2,
- std::string const & arg3, std::string const & arg4);
+
+#ifdef I_AM_NOT_AFRAID_OF_HEADER_LIBRARIES
+
+#include <boost/format.hpp>
+
+template<class Arg1>
+string bformat(string const & fmt, Arg1 arg1)
+{
+ return (boost::format(fmt) % arg1).str();
+}
+
+
+template<class Arg1, class Arg2>
+string bformat(string const & fmt, Arg1 arg1, Arg2 arg2)
+{
+ return (boost::format(fmt) % arg1 % arg2).str();
+}
+
+
+template<class Arg1, class Arg2, class Arg3>
+string bformat(string const & fmt, Arg1 arg1, Arg2 arg2, Arg3 arg3)
+{
+ return (boost::format(fmt) % arg1 % arg2 % arg3).str();
+}
+
+
+template<class Arg1, class Arg2, class Arg3, class Arg4>
+string bformat(string const & fmt, Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
+{
+ return (boost::format(fmt) % arg1 % arg2 % arg3 % arg4).str();
+}
+
+#else
+
+template <class Arg1>
+std::string bformat(std::string const & fmt, Arg1);
+
+template <class Arg1, class Arg2>
+std::string bformat(std::string const & fmt, Arg1, Arg2);
+
+template <class Arg1, class Arg2, class Arg3>
+std::string bformat(std::string const & fmt, Arg1, Arg2, Arg3);
+
+template <class Arg1, class Arg2, class Arg3, class Arg4>
+std::string bformat(std::string const & fmt, Arg1, Arg2, Arg3, Arg4);
+
+#endif
} // namespace support
} // namespace lyx
{
string const tmpdir(dir.empty() ? os::getTmpDir() : dir);
string tmpfl(AddName(tmpdir, mask));
- tmpfl += tostr(getpid());
+ tmpfl += convert<string>(getpid());
tmpfl += "XXXXXX";
// The supposedly safe mkstemp version
#include <config.h>
-#include <boost/lexical_cast.hpp>
+#include "tostr.h"
+#include <boost/lexical_cast.hpp>
using boost::lexical_cast;
using std::string;
-string const tostr(bool b)
+template<>
+string convert<string>(bool b)
{
return (b ? "true" : "false");
}
-string const tostr(unsigned int i)
+template<>
+string convert<string>(char c)
{
- return lexical_cast<string>(i);
+ return string(1, c);
}
-string const tostr(long int i)
+template<>
+string convert<string>(short unsigned int sui)
{
- return lexical_cast<string>(i);
+ return lexical_cast<string>(sui);
}
-string const tostr(double d)
+template<>
+string convert<string>(int i)
{
- return lexical_cast<string>(d);
+ return lexical_cast<string>(i);
}
-string const tostr(int i)
+template<>
+string convert<string>(unsigned int ui)
{
- return lexical_cast<string>(i);
+ return lexical_cast<string>(ui);
}
-string const tostr(string const & s)
+template<>
+string convert<string>(float f)
{
- return s;
+ return lexical_cast<string>(f);
}
-string const tostr(long unsigned int i)
+template<>
+string convert<string>(double d)
{
- return lexical_cast<string>(i);
+ return lexical_cast<string>(d);
}
* Licence details can be found in the file COPYING.
*
* \author André Pönitz
+ * \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*
#ifndef TOSTR_H
#define TOSTR_H
+#include <boost/static_assert.hpp>
+
#include <string>
-/// convert things to strings
-std::string const tostr(bool b);
-///
-std::string const tostr(int);
-///
-std::string const tostr(unsigned int);
-///
-std::string const tostr(long int);
-///
-std::string const tostr(double);
-///
-std::string const tostr(std::string const & s);
-///
-std::string const tostr(long unsigned int);
+template <class Target, class Source>
+Target convert(Source arg)
+{
+ // We use a static assert here since we want all instances of
+ // this template to be specializations.
+ BOOST_STATIC_ASSERT(sizeof(bool) == 0);
+ return Target();
+}
+
+template<>
+std::string convert<std::string>(bool);
+
+template<>
+std::string convert<std::string>(char);
+
+template<>
+std::string convert<std::string>(unsigned short);
+
+template<>
+std::string convert<std::string>(int);
+
+template<>
+std::string convert<std::string>(unsigned int);
+
+template<>
+std::string convert<std::string>(float);
+
+template<>
+std::string convert<std::string>(double);
+
+template<>
+std::string convert<std::string>(std::string);
#endif
return s.empty() ? s : " " + name + "=\"" + s + "\"";
}
+template <>
string const write_attribute(string const & name, string const & t)
{
return t.empty() ? t : " " + name + "=\"" + t + "\"";
}
+template <>
string const write_attribute(string const & name, bool const & b)
{
// we write only true attribute values so we remove a bit of the
// file format bloat for tabulars.
- return b ? write_attribute(name, tostr(b)) : string();
+ return b ? write_attribute(name, convert<string>(b)) : string();
}
+template <>
string const write_attribute(string const & name, int const & i)
{
// we write only true attribute values so we remove a bit of the
// file format bloat for tabulars.
- return i ? write_attribute(name, tostr(i)) : string();
+ return i ? write_attribute(name, convert<string>(i)) : string();
}
+template <>
string const write_attribute(string const & name, LyXTabular::idx_type const & i)
{
// we write only true attribute values so we remove a bit of the
// file format bloat for tabulars.
- return i ? write_attribute(name, tostr(i)) : string();
+ return i ? write_attribute(name, convert<string>(i)) : string();
}
+template <>
string const write_attribute(string const & name, LyXLength const & value)
{
// we write only the value if we really have one same reson as above.
string const DoAccent(char c, tex_accent accent)
{
- return DoAccent(tostr(c), accent);
+ return DoAccent(convert<string>(c), accent);
}
+2005-01-06 Lars Gullik Bjonnes <larsbj@gullik.net>
+
+ * text.C: tostr -> convert
+
2005-01-06 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* Spacing.h: adapt dummy file to the changes in src/Spacing.h.
if (p.next_token().asInput() == "[") {
os << "placement " << p.getArg('[', ']') << '\n';
}
- os << "wide " << tostr(is_starred)
+ os << "wide " << convert<string>(is_starred)
<< "\nsideways false"
<< "\nstatus open\n\n";
parse_text_in_inset(p, os, FLAG_END, outer, parent_context);
// incalculate the layout spaces
maxasc += int(layoutasc * 2 / (2 + pars_[pit].getDepth()));
maxdesc += int(layoutdesc * 2 / (2 + pars_[pit].getDepth()));
-
+
row.ascent(maxasc + labeladdon);
row.descent(maxdesc);
}
z = row.endpos();
} while (z < par.size());
- dim.asc += par.rows()[0].ascent();
- dim.des -= par.rows()[0].ascent();
+ dim.asc += par.rows()[0].ascent();
+ dim.des -= par.rows()[0].ascent();
par.dim_ = dim;
//lyxerr << "redoParagraph: " << par.rows().size() << " rows\n";
}
beg.top() = cur.selBegin();
end.top() = cur.selEnd();
-
+
// the selection doesn't touch the visible screen
if (bv_funcs::status(pi.base.bv, beg) == bv_funcs::CUR_BELOW
|| bv_funcs::status(pi.base.bv, end) == bv_funcs::CUR_ABOVE)
Paragraph const & par1 = pars_[beg.pit()];
Paragraph const & par2 = pars_[end.pit()];
-
+
Row const & row1 = par1.getRow(beg.pos());
Row const & row2 = par2.getRow(end.pos());
-
+
int y1,x1,x2;
if (bv_funcs::status(pi.base.bv, beg) == bv_funcs::CUR_ABOVE) {
y1 = 0;
X1 = isRTL(par2) ? 0 : endx;
X2 = isRTL(par2) ? endx : 0 + dim_.wid;
}
-
+
lyxerr << " y1: " << y1 << " y2: " << y2
- << " xo: " << xo_ << " wid: " << dim_.wid
+ << " xo: " << xo_ << " wid: " << dim_.wid
<< endl;
// paint big rectangle in one go
beg.top() = cur.selBegin();
end.top() = cur.selEnd();
-
+
// the selection doesn't touch the visible screen
if (bv_funcs::status(pi.base.bv, beg) == bv_funcs::CUR_BELOW
|| bv_funcs::status(pi.base.bv, end) == bv_funcs::CUR_ABOVE)
Paragraph const & par1 = pars_[beg.pit()];
Paragraph const & par2 = pars_[end.pit()];
-
+
bool const above = (bv_funcs::status(pi.base.bv, beg)
== bv_funcs::CUR_ABOVE);
bool const below = (bv_funcs::status(pi.base.bv, end)
// The paragraph depth
int depth = cur.paragraph().getDepth();
if (depth > 0)
- os << bformat(_(", Depth: %1$s"), tostr(depth));
+ os << bformat(_(", Depth: %1$d"), depth);
// The paragraph spacing, but only if different from
// buffer spacing.
// Paragraph const & par = pars_[pit];
// Row const & r = par.rows()[row];
// int x = 0;
-// pos -= r.pos();
+// pos -= r.pos();
//}
{
pit_type pit = getPitNearY(y);
int yy = theCoords.get(this, pit).y_ - pars_[pit].ascent();
- lyxerr << "setCursorFromCoordinates: x: " << x << " y: " << y
+ lyxerr << "setCursorFromCoordinates: x: " << x << " y: " << y
<< " pit: " << pit << " yy: " << yy << endl;
Paragraph const & par = pars_[pit];
}
Row const & row = par.rows()[r];
-
+
lyxerr << "setCursorFromCoordinates: row " << r
<< " from pos: " << row.pos() << endl;
-
+
bool bound = false;
int xx = x;
pos_type const pos = row.pos() + getColumnNearX(pit, row, xx, bound);
const_cast<LyXText *>(this)->setCurrentFont(cur);
return 0;
}
-
+
// This should be just before or just behind the
// cursor position set above.
BOOST_ASSERT((pos != 0 && inset == pars_[pit].getInset(pos - 1))
} else if (cur.pit() > 0) {
--cur.pit();
setCursor(cur, cur.pit(), x2pos(cur.pit(), cur.paragraph().rows().size() - 1, x));
-
+
}
cur.x_target() = x;
void LyXText::cursorDown(LCursor & cur)
{
-
+
Paragraph const & par = cur.paragraph();
int const row = par.pos2row(cur.pos());
editXY(cur, x, y + par.rows()[row].descent() + 1);
return;
}
-
+
if (row + 1 < int(par.rows().size())) {
setCursor(cur, cur.pit(), x2pos(cur.pit(), row + 1, x));
} else if (cur.pit() + 1 < int(paragraphs().size())) {
++cur.pit();
setCursor(cur, cur.pit(), x2pos(cur.pit(), 0, x));
}
-
+
cur.x_target() = x;
}
cur.undispatched();
}
break;
-
+
case LFUN_ENDBUFSEL:
if (cur.size() == 1) {
if (!cur.selection())
lyxerr << _("Unknown spacing argument: ")
<< cmd.argument << endl;
}
- if (cur_spacing != new_spacing || cur_value != new_value)
+ if (cur_spacing != new_spacing || cur_value != new_value)
par.params().spacing(Spacing(new_spacing, new_value));
break;
}
break;
case LFUN_GETXY:
- cur.message(tostr(cursorX(cur.top())) + ' '
- + tostr(cursorY(cur.top())));
+ cur.message(convert<string>(cursorX(cur.top())) + ' '
+ + convert<string>(cursorY(cur.top())));
break;
case LFUN_SETXY: {
int const wh = bv->workHeight();
int const y = std::max(0, std::min(wh - 1, cmd.y));
-
+
setCursorFromCoordinates(cur, cmd.x, y);
cur.x_target() = cmd.x;
if (cmd.y >= wh)
bvcur.selection() = true;
lyxerr << "MOTION: " << bv->cursor() << endl;
}
-
+
} else
cur.undispatched();
break;
//cur.nextInset()->edit(cur, true);
}
break;
-
+
// passthrough hat and underscore outside mathed:
case LFUN_SUBSCRIPT:
mathDispatch(cur, FuncRequest(LFUN_SELFINSERT, "_"), false);
InsetBase & inset = cur.inset();
bool const accept = !inset.forceDefaultParagraphs(&inset);
- data = "update " + tostr(accept) + '\n' + data;
+ data = "update " + convert<string>(accept) + '\n' + data;
bv->owner()->getDialogs().update("paragraph", data);
break;
}
void TocItem::goTo(LyXView & lv_) const
{
- string const tmp = tostr(id_);
+ string const tmp = convert<string>(id_);
lv_.dispatch(FuncRequest(LFUN_GOTO_PARAGRAPH, tmp));
}
FuncRequest TocItem::action() const
{
- return FuncRequest(LFUN_GOTO_PARAGRAPH, tostr(id_));
+ return FuncRequest(LFUN_GOTO_PARAGRAPH, convert<string>(id_));
}