#include "support/lstrings.h"
#include "support/lyxlib.h"
-#include "support/tostr.h"
+#include "support/convert.h"
#include "mathed/math_hullinset.h"
#include "mathed/math_macrotemplate.h"
using lyx::cap::replaceSelection;
using lyx::support::isStrUnsignedInt;
-using lyx::support::strToUnsignedInt;
-using lyx::support::atoi;
using lyx::support::token;
using std::endl;
cur.undispatched();
}
break;
-
+
case LFUN_ENDBUFSEL:
if (cur.size() == 1) {
if (!cur.selection())
case LFUN_PARAGRAPH_SPACING: {
Paragraph & par = cur.paragraph();
Spacing::Space cur_spacing = par.params().spacing().getSpace();
- float cur_value = 1.0;
+ string cur_value = "1.0";
if (cur_spacing == Spacing::Other)
- cur_value = par.params().spacing().getValue();
+ cur_value = par.params().spacing().getValueAsString();
istringstream is(cmd.argument);
string tmp;
is >> tmp;
Spacing::Space new_spacing = cur_spacing;
- float new_value = cur_value;
+ string new_value = cur_value;
if (tmp.empty()) {
lyxerr << "Missing argument to `paragraph-spacing'"
<< endl;
new_spacing = Spacing::Double;
} else if (tmp == "other") {
new_spacing = Spacing::Other;
- float tmpval = 0.0;
+ string tmpval = "0.0";
is >> tmpval;
lyxerr << "new_value = " << tmpval << endl;
- if (tmpval != 0.0)
+ if (tmpval != "0.0")
new_value = tmpval;
} else if (tmp == "default") {
new_spacing = Spacing::Default;
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;
}
#warning FIXME Check if the arg is in the domain of available selections.
#endif
if (isStrUnsignedInt(cmd.argument))
- pasteSelection(cur, strToUnsignedInt(cmd.argument));
+ pasteSelection(cur, convert<unsigned int>(cmd.argument));
else
pasteSelection(cur, 0);
cur.clearSelection(); // bug 393
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;
else {
string s = cmd.argument;
string const s1 = token(s, ' ', 1);
- int const nargs = s1.empty() ? 0 : atoi(s1);
+ int const nargs = s1.empty() ? 0 : convert<int>(s1);
string const s2 = token(s, ' ', 2);
string const type = s2.empty() ? "newcommand" : s2;
cur.insert(new MathMacroTemplate(token(s, ' ', 0), nargs, s2));
//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;
}