mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
convert lfun arguments to docstring
* src/support/docstring.[Ch] (from_ascii): new conversion function (from_utf8): new conversion function (to_utf8): new conversion function (operator==) new, compare docstring and ASCII C string (operator!=) new, compare docstring and ASCII C string * src/support/Makefile.am: add new file docstring.C * development/scons/scons_manifest.py: ditto * src/funcrequest.[Ch] (argument): change name to argument_ and type to docstring, add an accessor (FuncRequest): Add two new constructors taking a docstring argument * all other files: adjust to the FuncRequest changes above git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14861 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b486b53f8f
commit
1fc0c01877
@ -133,6 +133,7 @@ src_support_files = Split('''
|
||||
chdir.C
|
||||
convert.C
|
||||
copy.C
|
||||
docstring.C
|
||||
environment.C
|
||||
filefilterlist.C
|
||||
filename.C
|
||||
|
@ -898,13 +898,13 @@ FuncStatus BufferView::Pimpl::getStatus(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_LABEL_GOTO: {
|
||||
flag.enabled(!cmd.argument.empty()
|
||||
flag.enabled(!cmd.argument().empty()
|
||||
|| getInsetByCode<InsetRef>(cursor_, InsetBase::REF_CODE));
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_BOOKMARK_GOTO:
|
||||
flag.enabled(isSavedPosition(convert<unsigned int>(cmd.argument)));
|
||||
flag.enabled(isSavedPosition(convert<unsigned int>(lyx::to_utf8(cmd.argument()))));
|
||||
break;
|
||||
case LFUN_CHANGES_TRACK:
|
||||
flag.enabled(true);
|
||||
@ -950,7 +950,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
||||
// Make sure that the cached BufferView is correct.
|
||||
lyxerr[Debug::ACTION] << BOOST_CURRENT_FUNCTION
|
||||
<< " action[" << cmd.action << ']'
|
||||
<< " arg[" << cmd.argument << ']'
|
||||
<< " arg[" << lyx::to_utf8(cmd.argument()) << ']'
|
||||
<< " x[" << cmd.x << ']'
|
||||
<< " y[" << cmd.y << ']'
|
||||
<< " button[" << cmd.button() << ']'
|
||||
@ -983,15 +983,18 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_FILE_INSERT:
|
||||
menuInsertLyXFile(cmd.argument);
|
||||
// FIXME: We don't know the encoding of filenames
|
||||
menuInsertLyXFile(lyx::to_utf8(cmd.argument()));
|
||||
break;
|
||||
|
||||
case LFUN_FILE_INSERT_ASCII_PARA:
|
||||
insertAsciiFile(bv_, cmd.argument, true);
|
||||
// FIXME: We don't know the encoding of filenames
|
||||
insertAsciiFile(bv_, lyx::to_utf8(cmd.argument()), true);
|
||||
break;
|
||||
|
||||
case LFUN_FILE_INSERT_ASCII:
|
||||
insertAsciiFile(bv_, cmd.argument, false);
|
||||
// FIXME: We don't know the encoding of filenames
|
||||
insertAsciiFile(bv_, lyx::to_utf8(cmd.argument()), false);
|
||||
break;
|
||||
|
||||
case LFUN_FONT_STATE:
|
||||
@ -999,15 +1002,15 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_BOOKMARK_SAVE:
|
||||
savePosition(convert<unsigned int>(cmd.argument));
|
||||
savePosition(convert<unsigned int>(lyx::to_utf8(cmd.argument())));
|
||||
break;
|
||||
|
||||
case LFUN_BOOKMARK_GOTO:
|
||||
restorePosition(convert<unsigned int>(cmd.argument));
|
||||
restorePosition(convert<unsigned int>(lyx::to_utf8(cmd.argument())));
|
||||
break;
|
||||
|
||||
case LFUN_LABEL_GOTO: {
|
||||
string label = cmd.argument;
|
||||
string label = lyx::to_utf8(cmd.argument());
|
||||
if (label.empty()) {
|
||||
InsetRef * inset =
|
||||
getInsetByCode<InsetRef>(cursor_,
|
||||
@ -1024,7 +1027,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case LFUN_PARAGRAPH_GOTO: {
|
||||
int const id = convert<int>(cmd.argument);
|
||||
int const id = convert<int>(lyx::to_utf8(cmd.argument()));
|
||||
ParIterator par = buffer_->getParFromID(id);
|
||||
if (par == buffer_->par_iterator_end()) {
|
||||
lyxerr[Debug::INFO] << "No matching paragraph found! ["
|
||||
@ -1153,7 +1156,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
||||
InsetBibtex * inset = getInsetByCode<InsetBibtex>(tmpcur,
|
||||
InsetBase::BIBTEX_CODE);
|
||||
if (inset) {
|
||||
if (inset->addDatabase(cmd.argument))
|
||||
if (inset->addDatabase(lyx::to_utf8(cmd.argument())))
|
||||
buffer_->updateBibfilesCache();
|
||||
}
|
||||
break;
|
||||
@ -1165,7 +1168,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
|
||||
InsetBibtex * inset = getInsetByCode<InsetBibtex>(tmpcur,
|
||||
InsetBase::BIBTEX_CODE);
|
||||
if (inset) {
|
||||
if (inset->delDatabase(cmd.argument))
|
||||
if (inset->delDatabase(lyx::to_utf8(cmd.argument())))
|
||||
buffer_->updateBibfilesCache();
|
||||
}
|
||||
break;
|
||||
|
@ -147,7 +147,7 @@ string const MenuItem::binding() const
|
||||
lyxerr[Debug::KBMAP]
|
||||
<< "No binding for "
|
||||
<< lyxaction.getActionName(func_.action)
|
||||
<< '(' << func_.argument << ')' << endl;
|
||||
<< '(' << lyx::to_utf8(func_.argument()) << ')' << endl;
|
||||
return string();
|
||||
}
|
||||
|
||||
|
@ -219,19 +219,19 @@ string const ToolbarBackend::getIcon(FuncRequest const & f)
|
||||
|
||||
switch (f.action) {
|
||||
case LFUN_MATH_INSERT:
|
||||
if (!f.argument.empty())
|
||||
fullname = find_xpm(f.argument.substr(1));
|
||||
if (!f.argument().empty())
|
||||
fullname = find_xpm(lyx::to_utf8(f.argument()).substr(1));
|
||||
break;
|
||||
case LFUN_MATH_DELIM:
|
||||
case LFUN_MATH_BIGDELIM:
|
||||
fullname = find_xpm(f.argument);
|
||||
fullname = find_xpm(lyx::to_utf8(f.argument()));
|
||||
break;
|
||||
default:
|
||||
string const name = lyxaction.getActionName(f.action);
|
||||
string xpm_name(name);
|
||||
|
||||
if (!f.argument.empty())
|
||||
xpm_name = subst(name + ' ' + f.argument, ' ', '_');
|
||||
if (!f.argument().empty())
|
||||
xpm_name = subst(name + ' ' + lyx::to_utf8(f.argument()), ' ', '_');
|
||||
|
||||
fullname = libFileSearch("images", xpm_name, "xpm");
|
||||
|
||||
@ -249,6 +249,6 @@ string const ToolbarBackend::getIcon(FuncRequest const & f)
|
||||
|
||||
lyxerr[Debug::GUI] << "Cannot find icon for command \""
|
||||
<< lyxaction.getActionName(f.action)
|
||||
<< '(' << f.argument << ")\"" << endl;
|
||||
<< '(' << lyx::to_utf8(f.argument()) << ")\"" << endl;
|
||||
return libFileSearch("images", "unknown", "xpm");
|
||||
}
|
||||
|
@ -1275,7 +1275,7 @@ bool Buffer::dispatch(FuncRequest const & func, bool * result)
|
||||
|
||||
switch (func.action) {
|
||||
case LFUN_BUFFER_EXPORT: {
|
||||
bool const tmp = Exporter::Export(this, func.argument, false);
|
||||
bool const tmp = Exporter::Export(this, lyx::to_utf8(func.argument()), false);
|
||||
if (result)
|
||||
*result = tmp;
|
||||
break;
|
||||
|
@ -130,43 +130,49 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
case LFUN_BIBITEM_INSERT:
|
||||
return new InsetBibitem(InsetCommandParams("bibitem"));
|
||||
|
||||
case LFUN_FLOAT_INSERT:
|
||||
case LFUN_FLOAT_INSERT: {
|
||||
// check if the float type exists
|
||||
if (params.getLyXTextClass().floats().typeExist(cmd.argument))
|
||||
return new InsetFloat(params, cmd.argument);
|
||||
lyxerr << "Non-existent float type: " << cmd.argument << endl;
|
||||
string const argument = lyx::to_utf8(cmd.argument());
|
||||
if (params.getLyXTextClass().floats().typeExist(argument))
|
||||
return new InsetFloat(params, argument);
|
||||
lyxerr << "Non-existent float type: " << argument << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
case LFUN_FLOAT_WIDE_INSERT:
|
||||
case LFUN_FLOAT_WIDE_INSERT: {
|
||||
// check if the float type exists
|
||||
if (params.getLyXTextClass().floats().typeExist(cmd.argument)) {
|
||||
auto_ptr<InsetFloat> p(new InsetFloat(params, cmd.argument));
|
||||
string const argument = lyx::to_utf8(cmd.argument());
|
||||
if (params.getLyXTextClass().floats().typeExist(argument)) {
|
||||
auto_ptr<InsetFloat> p(new InsetFloat(params, argument));
|
||||
p->wide(true, params);
|
||||
return p.release();
|
||||
}
|
||||
lyxerr << "Non-existent float type: " << cmd.argument << endl;
|
||||
lyxerr << "Non-existent float type: " << argument << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
case LFUN_WRAP_INSERT:
|
||||
if (cmd.argument == "figure")
|
||||
return new InsetWrap(params, cmd.argument);
|
||||
lyxerr << "Non-existent floatflt type: " << cmd.argument << endl;
|
||||
case LFUN_WRAP_INSERT: {
|
||||
string const argument = lyx::to_utf8(cmd.argument());
|
||||
if (argument == "figure")
|
||||
return new InsetWrap(params, argument);
|
||||
lyxerr << "Non-existent floatflt type: " << argument << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
case LFUN_INDEX_INSERT: {
|
||||
// Try and generate a valid index entry.
|
||||
InsetCommandParams icp("index");
|
||||
string const contents = cmd.argument.empty() ?
|
||||
string const contents = cmd.argument().empty() ?
|
||||
bv->getLyXText()->getStringToIndex(bv->cursor()) :
|
||||
cmd.argument;
|
||||
lyx::to_utf8(cmd.argument());
|
||||
icp.setContents(contents);
|
||||
return new InsetIndex(icp);
|
||||
}
|
||||
|
||||
case LFUN_TABULAR_INSERT: {
|
||||
if (cmd.argument.empty())
|
||||
if (cmd.argument().empty())
|
||||
return 0;
|
||||
std::istringstream ss(cmd.argument);
|
||||
std::istringstream ss(lyx::to_utf8(cmd.argument()));
|
||||
int r = 0, c = 0;
|
||||
ss >> r >> c;
|
||||
if (r <= 0)
|
||||
@ -191,7 +197,7 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
return new InsetTOC(InsetCommandParams("tableofcontents"));
|
||||
|
||||
case LFUN_ENVIRONMENT_INSERT:
|
||||
return new InsetEnvironment(params, cmd.argument);
|
||||
return new InsetEnvironment(params, lyx::to_utf8(cmd.argument()));
|
||||
|
||||
#if 0
|
||||
case LFUN_LIST_INSERT:
|
||||
@ -206,31 +212,31 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
|
||||
if (name == "bibitem") {
|
||||
InsetCommandParams icp;
|
||||
InsetCommandMailer::string2params(name, cmd.argument,
|
||||
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()),
|
||||
icp);
|
||||
return new InsetBibitem(icp);
|
||||
|
||||
} else if (name == "bibtex") {
|
||||
InsetCommandParams icp;
|
||||
InsetCommandMailer::string2params(name, cmd.argument,
|
||||
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()),
|
||||
icp);
|
||||
return new InsetBibtex(icp);
|
||||
|
||||
} else if (name == "citation") {
|
||||
InsetCommandParams icp;
|
||||
InsetCommandMailer::string2params(name, cmd.argument,
|
||||
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()),
|
||||
icp);
|
||||
return new InsetCitation(icp);
|
||||
|
||||
} else if (name == "ert") {
|
||||
InsetCollapsable::CollapseStatus st;
|
||||
InsetERTMailer::string2params(cmd.argument, st);
|
||||
InsetERTMailer::string2params(lyx::to_utf8(cmd.argument()), st);
|
||||
return new InsetERT(params, st);
|
||||
|
||||
} else if (name == "external") {
|
||||
Buffer const & buffer = *bv->buffer();
|
||||
InsetExternalParams iep;
|
||||
InsetExternalMailer::string2params(cmd.argument,
|
||||
InsetExternalMailer::string2params(lyx::to_utf8(cmd.argument()),
|
||||
buffer, iep);
|
||||
auto_ptr<InsetExternal> inset(new InsetExternal);
|
||||
inset->setParams(iep, buffer);
|
||||
@ -239,7 +245,7 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
} else if (name == "graphics") {
|
||||
Buffer const & buffer = *bv->buffer();
|
||||
InsetGraphicsParams igp;
|
||||
InsetGraphicsMailer::string2params(cmd.argument,
|
||||
InsetGraphicsMailer::string2params(lyx::to_utf8(cmd.argument()),
|
||||
buffer, igp);
|
||||
auto_ptr<InsetGraphics> inset(new InsetGraphics);
|
||||
inset->setParams(igp);
|
||||
@ -247,48 +253,48 @@ InsetBase * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
|
||||
} else if (name == "include") {
|
||||
InsetCommandParams iip;
|
||||
InsetIncludeMailer::string2params(cmd.argument, iip);
|
||||
InsetIncludeMailer::string2params(lyx::to_utf8(cmd.argument()), iip);
|
||||
return new InsetInclude(iip);
|
||||
|
||||
} else if (name == "index") {
|
||||
InsetCommandParams icp;
|
||||
InsetCommandMailer::string2params(name, cmd.argument,
|
||||
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()),
|
||||
icp);
|
||||
return new InsetIndex(icp);
|
||||
|
||||
} else if (name == "label") {
|
||||
InsetCommandParams icp;
|
||||
InsetCommandMailer::string2params(name, cmd.argument,
|
||||
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()),
|
||||
icp);
|
||||
return new InsetLabel(icp);
|
||||
|
||||
} else if (name == "ref") {
|
||||
InsetCommandParams icp;
|
||||
InsetCommandMailer::string2params(name, cmd.argument,
|
||||
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()),
|
||||
icp);
|
||||
return new InsetRef(icp, *bv->buffer());
|
||||
|
||||
} else if (name == "toc") {
|
||||
InsetCommandParams icp;
|
||||
InsetCommandMailer::string2params(name, cmd.argument,
|
||||
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()),
|
||||
icp);
|
||||
return new InsetTOC(icp);
|
||||
|
||||
} else if (name == "url") {
|
||||
InsetCommandParams icp;
|
||||
InsetCommandMailer::string2params(name, cmd.argument,
|
||||
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()),
|
||||
icp);
|
||||
return new InsetUrl(icp);
|
||||
|
||||
} else if (name == "vspace") {
|
||||
VSpace vspace;
|
||||
InsetVSpaceMailer::string2params(cmd.argument, vspace);
|
||||
InsetVSpaceMailer::string2params(lyx::to_utf8(cmd.argument()), vspace);
|
||||
return new InsetVSpace(vspace);
|
||||
}
|
||||
}
|
||||
|
||||
case LFUN_SPACE_INSERT: {
|
||||
string const name = cmd.argument;
|
||||
string const name = lyx::to_utf8(cmd.argument());
|
||||
if (name == "normal")
|
||||
return new InsetSpace(InsetSpace::NORMAL);
|
||||
else if (name == "protected")
|
||||
|
@ -68,17 +68,17 @@ Gtk::BuiltinStockID getGTKStockIcon(FuncRequest const & func)
|
||||
case LFUN_ALL_CHANGES_ACCEPT: return Gtk::Stock::APPLY;
|
||||
case LFUN_ALL_CHANGES_REJECT: return Gtk::Stock::CANCEL;
|
||||
case LFUN_DIALOG_SHOW:
|
||||
if (func.argument == "findreplace")
|
||||
if (func.argument() == "findreplace")
|
||||
return Gtk::Stock::FIND_AND_REPLACE;
|
||||
else if (func.argument == "print")
|
||||
else if (func.argument() == "print")
|
||||
return Gtk::Stock::PRINT;
|
||||
else if (func.argument == "spellchecker")
|
||||
else if (func.argument() == "spellchecker")
|
||||
return Gtk::Stock::SPELL_CHECK;
|
||||
else if (func.argument == "prefs")
|
||||
else if (func.argument() == "prefs")
|
||||
return Gtk::Stock::PREFERENCES;
|
||||
else if (func.argument == "document")
|
||||
else if (func.argument() == "document")
|
||||
return Gtk::Stock::PROPERTIES;
|
||||
else if (func.argument == "aboutlyx")
|
||||
else if (func.argument() == "aboutlyx")
|
||||
return Gtk::Stock::ABOUT;
|
||||
else
|
||||
return Gtk::Stock::MISSING_IMAGE;
|
||||
@ -95,48 +95,48 @@ Glib::ustring getGTKThemeIcon(FuncRequest const & func)
|
||||
case LFUN_MATH_MODE: return "stock_insert-math-object";
|
||||
case LFUN_FONT_EMPH: return "stock_text_italic";
|
||||
case LFUN_DIALOG_SHOW_NEW_INSET:
|
||||
if (func.argument == "graphics")
|
||||
if (func.argument() == "graphics")
|
||||
return "stock_placeholder-picture";
|
||||
if (func.argument == "include")
|
||||
if (func.argument() == "include")
|
||||
return "stock_insert-file";
|
||||
break;
|
||||
case LFUN_DIALOG_SHOW:
|
||||
if (func.argument == "spellchecker")
|
||||
if (func.argument() == "spellchecker")
|
||||
return "stock_spellcheck";
|
||||
else if (func.argument == "character")
|
||||
else if (func.argument() == "character")
|
||||
return "stock_font";
|
||||
break;
|
||||
case LFUN_DEPTH_INCREMENT: return "format-indent-more";
|
||||
case LFUN_DEPTH_DECREMENT: return "format-indent-less";
|
||||
case LFUN_LAYOUT:
|
||||
if (func.argument == "Enumerate")
|
||||
if (func.argument() == "Enumerate")
|
||||
return "stock_list_enum";
|
||||
else if (func.argument == "Itemize")
|
||||
else if (func.argument() == "Itemize")
|
||||
return "stock_list_bullet";
|
||||
break;
|
||||
case LFUN_FONT_FREE_APPLY: return "stock_font-formatting-toggle";
|
||||
case LFUN_THESAURUS_ENTRY: return "stock_thesaurus";
|
||||
case LFUN_URL_INSERT: return "stock_insert-url";
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
if (func.argument == "append-row")
|
||||
if (func.argument() == "append-row")
|
||||
return "stock_insert-rows";
|
||||
else if (func.argument == "append-column")
|
||||
else if (func.argument() == "append-column")
|
||||
return "stock_insert-columns";
|
||||
else if (func.argument == "delete-row")
|
||||
else if (func.argument() == "delete-row")
|
||||
return "stock_delete-row";
|
||||
else if (func.argument == "delete-column")
|
||||
else if (func.argument() == "delete-column")
|
||||
return "stock_delete-column";
|
||||
else if (func.argument == "valign-top")
|
||||
else if (func.argument() == "valign-top")
|
||||
return "stock_cell-align-top";
|
||||
else if (func.argument == "valign-middle")
|
||||
else if (func.argument() == "valign-middle")
|
||||
return "stock_cell-align-center";
|
||||
else if (func.argument == "valign-bottom")
|
||||
else if (func.argument() == "valign-bottom")
|
||||
return "stock_cell-align-bottom";
|
||||
else if (func.argument == "align-left")
|
||||
else if (func.argument() == "align-left")
|
||||
return "gtk-justify-left";
|
||||
else if (func.argument == "align-center")
|
||||
else if (func.argument() == "align-center")
|
||||
return "gtk-justify-center";
|
||||
else if (func.argument == "align-right")
|
||||
else if (func.argument() == "align-right")
|
||||
return "gtk-justify-right";
|
||||
break;
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::getline;
|
||||
|
||||
using std::istringstream;
|
||||
@ -34,8 +36,14 @@ FuncRequest::FuncRequest(kb_action act, Origin o)
|
||||
{}
|
||||
|
||||
|
||||
FuncRequest::FuncRequest(kb_action act, docstring const & arg, Origin o)
|
||||
: action(act), argument_(arg), origin(o), x(0), y(0),
|
||||
button_(mouse_button::none)
|
||||
{}
|
||||
|
||||
|
||||
FuncRequest::FuncRequest(kb_action act, string const & arg, Origin o)
|
||||
: action(act), argument(arg), origin(o), x(0), y(0),
|
||||
: action(act), argument_(lyx::from_utf8(arg)), origin(o), x(0), y(0),
|
||||
button_(mouse_button::none)
|
||||
{}
|
||||
|
||||
@ -46,8 +54,14 @@ FuncRequest::FuncRequest(kb_action act, int ax, int ay,
|
||||
{}
|
||||
|
||||
|
||||
FuncRequest::FuncRequest(FuncRequest const & cmd, docstring const & arg, Origin o)
|
||||
: action(cmd.action), argument_(arg), origin(o),
|
||||
x(cmd.x), y(cmd.y), button_(cmd.button_)
|
||||
{}
|
||||
|
||||
|
||||
FuncRequest::FuncRequest(FuncRequest const & cmd, string const & arg, Origin o)
|
||||
: action(cmd.action), argument(arg), origin(o),
|
||||
: action(cmd.action), argument_(lyx::from_utf8(arg)), origin(o),
|
||||
x(cmd.x), y(cmd.y), button_(cmd.button_)
|
||||
{}
|
||||
|
||||
@ -81,14 +95,14 @@ void split(vector<string> & args, string const & str)
|
||||
string FuncRequest::getArg(unsigned int i) const
|
||||
{
|
||||
vector<string> args;
|
||||
split(args, argument);
|
||||
split(args, lyx::to_utf8(argument_));
|
||||
return i < args.size() ? args[i] : string();
|
||||
}
|
||||
|
||||
|
||||
bool operator==(FuncRequest const & lhs, FuncRequest const & rhs)
|
||||
{
|
||||
return lhs.action == rhs.action && lhs.argument == rhs.argument;
|
||||
return lhs.action == rhs.action && lhs.argument() == rhs.argument();
|
||||
}
|
||||
|
||||
|
||||
@ -96,7 +110,7 @@ std::ostream & operator<<(std::ostream & os, FuncRequest const & cmd)
|
||||
{
|
||||
return os
|
||||
<< " action: " << cmd.action
|
||||
<< " arg: '" << cmd.argument << "'"
|
||||
<< " arg: '" << lyx::to_utf8(cmd.argument()) << "'"
|
||||
<< " x: " << cmd.x
|
||||
<< " y: " << cmd.y;
|
||||
}
|
||||
|
@ -15,7 +15,8 @@
|
||||
#include "lfuns.h"
|
||||
#include "frontends/mouse_state.h"
|
||||
|
||||
#include <string>
|
||||
#include "support/docstring.h"
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
|
||||
@ -41,9 +42,15 @@ public:
|
||||
FuncRequest(kb_action act, int x, int y, mouse_button::state button,
|
||||
Origin o = INTERNAL);
|
||||
/// actions with extra argument
|
||||
FuncRequest(kb_action act, lyx::docstring const & arg,
|
||||
Origin o = INTERNAL);
|
||||
/// actions with extra argument. FIXME: remove this
|
||||
FuncRequest(kb_action act, std::string const & arg,
|
||||
Origin o = INTERNAL);
|
||||
/// for changing requests a bit
|
||||
FuncRequest(FuncRequest const & cmd, lyx::docstring const & arg,
|
||||
Origin o = INTERNAL);
|
||||
/// for changing requests a bit. FIXME: remove this
|
||||
FuncRequest(FuncRequest const & cmd, std::string const & arg,
|
||||
Origin o = INTERNAL);
|
||||
|
||||
@ -53,11 +60,16 @@ public:
|
||||
/// argument parsing, extract argument i as std::string
|
||||
std::string getArg(unsigned int i) const;
|
||||
|
||||
/// access the whole argument
|
||||
lyx::docstring const & argument() const { return argument_; }
|
||||
|
||||
public: // should be private
|
||||
/// the action
|
||||
kb_action action;
|
||||
/// the action's std::string argument
|
||||
std::string argument;
|
||||
private:
|
||||
/// the action's string argument
|
||||
lyx::docstring argument_;
|
||||
public: // should be private
|
||||
/// who initiated the action
|
||||
Origin origin;
|
||||
/// the x coordinate of a mouse press
|
||||
|
@ -61,7 +61,7 @@ void InsetBibitem::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params("bibitem", cmd.argument, p);
|
||||
InsetCommandMailer::string2params("bibitem", lyx::to_utf8(cmd.argument()), p);
|
||||
if (!p.getCmdName().empty())
|
||||
setParams(p);
|
||||
else
|
||||
|
@ -85,7 +85,7 @@ void InsetBibtex::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params("bibtex", cmd.argument, p);
|
||||
InsetCommandMailer::string2params("bibtex", lyx::to_utf8(cmd.argument()), p);
|
||||
if (!p.getCmdName().empty()) {
|
||||
setParams(p);
|
||||
cur.buffer().updateBibfilesCache();
|
||||
|
@ -182,7 +182,7 @@ void InsetBox::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
lyxerr << "InsetBox::dispatch MODIFY" << endl;
|
||||
InsetBoxMailer::string2params(cmd.argument, params_);
|
||||
InsetBoxMailer::string2params(lyx::to_utf8(cmd.argument()), params_);
|
||||
setButtonLabel();
|
||||
break;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ void InsetBranch::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetBranchParams params;
|
||||
InsetBranchMailer::string2params(cmd.argument, params);
|
||||
InsetBranchMailer::string2params(lyx::to_utf8(cmd.argument()), params);
|
||||
params_.branch = params.branch;
|
||||
setButtonLabel();
|
||||
break;
|
||||
@ -148,7 +148,7 @@ void InsetBranch::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
if (cmd.argument == "assign" || cmd.argument.empty()) {
|
||||
if (cmd.argument() == "assign" || cmd.argument().empty()) {
|
||||
// The branch inset uses "assign".
|
||||
if (isBranchSelected(cur.buffer())) {
|
||||
if (status() != Open)
|
||||
@ -183,11 +183,11 @@ bool InsetBranch::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
break;
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
if (cmd.argument == "open" || cmd.argument == "close" ||
|
||||
cmd.argument == "toggle")
|
||||
if (cmd.argument() == "open" || cmd.argument() == "close" ||
|
||||
cmd.argument() == "toggle")
|
||||
flag.enabled(true);
|
||||
else if (cmd.argument == "assign"
|
||||
|| cmd.argument.empty()) {
|
||||
else if (cmd.argument() == "assign"
|
||||
|| cmd.argument().empty()) {
|
||||
if (isBranchSelected(cur.buffer()))
|
||||
flag.enabled(status() != Open);
|
||||
else
|
||||
|
@ -344,11 +344,11 @@ void InsetCollapsable::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
if (cmd.argument == "open")
|
||||
if (cmd.argument() == "open")
|
||||
setStatus(cur, Open);
|
||||
else if (cmd.argument == "close")
|
||||
else if (cmd.argument() == "close")
|
||||
setStatus(cur, Collapsed);
|
||||
else if (cmd.argument == "toggle" || cmd.argument.empty())
|
||||
else if (cmd.argument() == "toggle" || cmd.argument().empty())
|
||||
if (isOpen()) {
|
||||
setStatus(cur, Collapsed);
|
||||
cur.forwardPosNoDescend();
|
||||
@ -373,8 +373,8 @@ bool InsetCollapsable::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_TOGGLE:
|
||||
if (cmd.argument == "open" || cmd.argument == "close" ||
|
||||
cmd.argument == "toggle")
|
||||
if (cmd.argument() == "open" || cmd.argument() == "close" ||
|
||||
cmd.argument() == "toggle")
|
||||
flag.enabled(true);
|
||||
else
|
||||
flag.enabled(false);
|
||||
|
@ -101,7 +101,7 @@ void InsetCommand::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(mailer_name_, cmd.argument, p);
|
||||
InsetCommandMailer::string2params(mailer_name_, lyx::to_utf8(cmd.argument()), p);
|
||||
if (p.getCmdName().empty())
|
||||
cur.noUpdate();
|
||||
else
|
||||
@ -109,9 +109,11 @@ void InsetCommand::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_INSET_DIALOG_UPDATE:
|
||||
InsetCommandMailer(cmd.argument, *this).updateDialog(&cur.bv());
|
||||
case LFUN_INSET_DIALOG_UPDATE: {
|
||||
string const name = lyx::to_utf8(cmd.argument());
|
||||
InsetCommandMailer(name, *this).updateDialog(&cur.bv());
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_MOUSE_RELEASE: {
|
||||
if (!mailer_name_.empty())
|
||||
|
@ -212,7 +212,7 @@ void InsetERT::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCollapsable::CollapseStatus st;
|
||||
InsetERTMailer::string2params(cmd.argument, st);
|
||||
InsetERTMailer::string2params(lyx::to_utf8(cmd.argument()), st);
|
||||
setStatus(cur, st);
|
||||
break;
|
||||
}
|
||||
@ -368,7 +368,7 @@ bool InsetERT::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
// solution, we consider only the first action of the sequence
|
||||
case LFUN_COMMAND_SEQUENCE: {
|
||||
// argument contains ';'-terminated commands
|
||||
string const firstcmd = token(cmd.argument, ';', 0);
|
||||
string const firstcmd = token(lyx::to_utf8(cmd.argument()), ';', 0);
|
||||
FuncRequest func(lyxaction.lookupFunc(firstcmd));
|
||||
func.origin = cmd.origin;
|
||||
return getStatus(cur, func, status);
|
||||
|
@ -438,7 +438,7 @@ void InsetExternal::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_EXTERNAL_EDIT: {
|
||||
Buffer const & buffer = cur.buffer();
|
||||
InsetExternalParams p;
|
||||
InsetExternalMailer::string2params(cmd.argument, buffer, p);
|
||||
InsetExternalMailer::string2params(lyx::to_utf8(cmd.argument()), buffer, p);
|
||||
external::editExternal(p, buffer);
|
||||
break;
|
||||
}
|
||||
@ -446,7 +446,7 @@ void InsetExternal::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_INSET_MODIFY: {
|
||||
Buffer const & buffer = cur.buffer();
|
||||
InsetExternalParams p;
|
||||
InsetExternalMailer::string2params(cmd.argument, buffer, p);
|
||||
InsetExternalMailer::string2params(lyx::to_utf8(cmd.argument()), buffer, p);
|
||||
setParams(p, buffer);
|
||||
break;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ void InsetFloat::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetFloatParams params;
|
||||
InsetFloatMailer::string2params(cmd.argument, params);
|
||||
InsetFloatMailer::string2params(lyx::to_utf8(cmd.argument()), params);
|
||||
params_.placement = params.placement;
|
||||
params_.wide = params.wide;
|
||||
params_.sideways = params.sideways;
|
||||
|
@ -182,7 +182,7 @@ void InsetGraphics::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_GRAPHICS_EDIT: {
|
||||
Buffer const & buffer = *cur.bv().buffer();
|
||||
InsetGraphicsParams p;
|
||||
InsetGraphicsMailer::string2params(cmd.argument, buffer, p);
|
||||
InsetGraphicsMailer::string2params(lyx::to_utf8(cmd.argument()), buffer, p);
|
||||
editGraphics(p, buffer);
|
||||
break;
|
||||
}
|
||||
@ -190,7 +190,7 @@ void InsetGraphics::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_INSET_MODIFY: {
|
||||
Buffer const & buffer = cur.buffer();
|
||||
InsetGraphicsParams p;
|
||||
InsetGraphicsMailer::string2params(cmd.argument, buffer, p);
|
||||
InsetGraphicsMailer::string2params(lyx::to_utf8(cmd.argument()), buffer, p);
|
||||
if (!p.filename.empty())
|
||||
setParams(p);
|
||||
else
|
||||
|
@ -127,7 +127,7 @@ void InsetInclude::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetIncludeMailer::string2params(cmd.argument, p);
|
||||
InsetIncludeMailer::string2params(lyx::to_utf8(cmd.argument()), p);
|
||||
if (!p.getCmdName().empty()) {
|
||||
set(p, cur.buffer());
|
||||
cur.buffer().updateBibfilesCache();
|
||||
|
@ -64,7 +64,7 @@ void InsetLabel::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params("label", cmd.argument, p);
|
||||
InsetCommandMailer::string2params("label", lyx::to_utf8(cmd.argument()), p);
|
||||
if (p.getCmdName().empty()) {
|
||||
cur.noUpdate();
|
||||
break;
|
||||
|
@ -204,7 +204,7 @@ void InsetNote::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_MODIFY:
|
||||
InsetNoteMailer::string2params(cmd.argument, params_);
|
||||
InsetNoteMailer::string2params(lyx::to_utf8(cmd.argument()), params_);
|
||||
setButtonLabel();
|
||||
break;
|
||||
|
||||
|
@ -649,14 +649,15 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
if (!tabularFeatures(cur, cmd.argument))
|
||||
if (!tabularFeatures(cur, lyx::to_utf8(cmd.argument())))
|
||||
cur.undispatched();
|
||||
break;
|
||||
|
||||
// insert file functions
|
||||
case LFUN_FILE_INSERT_ASCII_PARA:
|
||||
case LFUN_FILE_INSERT_ASCII: {
|
||||
string const tmpstr = getContentsOfAsciiFile(&cur.bv(), cmd.argument, false);
|
||||
// FIXME: We don't know the encoding of filenames
|
||||
string const tmpstr = getContentsOfAsciiFile(&cur.bv(), lyx::to_utf8(cmd.argument()), false);
|
||||
if (!tmpstr.empty() && !insertAsciiString(cur.bv(), tmpstr, false))
|
||||
cur.undispatched();
|
||||
break;
|
||||
@ -801,7 +802,7 @@ bool InsetTabular::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
int i = 0;
|
||||
for (; tabularFeature[i].action != LyXTabular::LAST_ACTION; ++i) {
|
||||
string const tmp = tabularFeature[i].feature;
|
||||
if (tmp == cmd.argument.substr(0, tmp.length())) {
|
||||
if (tmp == lyx::to_utf8(cmd.argument()).substr(0, tmp.length())) {
|
||||
action = tabularFeature[i].action;
|
||||
break;
|
||||
}
|
||||
@ -813,7 +814,7 @@ bool InsetTabular::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
}
|
||||
|
||||
string const argument
|
||||
= ltrim(cmd.argument.substr(tabularFeature[i].feature.length()));
|
||||
= ltrim(lyx::to_utf8(cmd.argument()).substr(tabularFeature[i].feature.length()));
|
||||
|
||||
row_type sel_row_start = 0;
|
||||
row_type sel_row_end = 0;
|
||||
|
@ -67,7 +67,7 @@ void InsetVSpace::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
switch (cmd.action) {
|
||||
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetVSpaceMailer::string2params(cmd.argument, space_);
|
||||
InsetVSpaceMailer::string2params(lyx::to_utf8(cmd.argument()), space_);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ void InsetWrap::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
switch (cmd.action) {
|
||||
case LFUN_INSET_MODIFY: {
|
||||
InsetWrapParams params;
|
||||
InsetWrapMailer::string2params(cmd.argument, params);
|
||||
InsetWrapMailer::string2params(lyx::to_utf8(cmd.argument()), params);
|
||||
params_.placement = params.placement;
|
||||
params_.width = params.width;
|
||||
break;
|
||||
|
@ -278,7 +278,7 @@ void find(BufferView * bv, FuncRequest const & ev)
|
||||
// "<search>
|
||||
// <casesensitive> <matchword> <forward>"
|
||||
string search;
|
||||
string howto = split(ev.argument, search, '\n');
|
||||
string howto = split(lyx::to_utf8(ev.argument()), search, '\n');
|
||||
|
||||
bool casesensitive = parse_bool(howto);
|
||||
bool matchword = parse_bool(howto);
|
||||
@ -304,7 +304,7 @@ void replace(BufferView * bv, FuncRequest const & ev)
|
||||
// <casesensitive> <matchword> <all> <forward>"
|
||||
string search;
|
||||
string replace;
|
||||
string howto = split(ev.argument, search, '\n');
|
||||
string howto = split(lyx::to_utf8(ev.argument()), search, '\n');
|
||||
howto = split(howto, replace, '\n');
|
||||
|
||||
bool casesensitive = parse_bool(howto);
|
||||
|
@ -92,7 +92,6 @@
|
||||
#include "support/systemcall.h"
|
||||
#include "support/convert.h"
|
||||
#include "support/os.h"
|
||||
#include "support/unicode.h"
|
||||
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
@ -101,6 +100,8 @@
|
||||
|
||||
using bv_funcs::freefont2string;
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using lyx::support::absolutePath;
|
||||
using lyx::support::addName;
|
||||
using lyx::support::addPath;
|
||||
@ -323,12 +324,11 @@ void LyXFunc::processKeySym(LyXKeySymPtr keysym, key_modifier::state state)
|
||||
|
||||
if (func.action == LFUN_SELF_INSERT) {
|
||||
if (encoded_last_key != 0) {
|
||||
std::vector<char> tmp = ucs4_to_utf8(encoded_last_key);
|
||||
string const arg(tmp.begin(), tmp.end());
|
||||
docstring const arg(1, encoded_last_key);
|
||||
dispatch(FuncRequest(LFUN_SELF_INSERT, arg,
|
||||
FuncRequest::KEYBOARD));
|
||||
lyxerr[Debug::KEY]
|
||||
<< "SelfInsert arg[`" << arg << "']" << endl;
|
||||
<< "SelfInsert arg[`" << lyx::to_utf8(arg) << "']" << endl;
|
||||
}
|
||||
} else {
|
||||
dispatch(func);
|
||||
@ -411,13 +411,13 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
case LFUN_BUFFER_SWITCH:
|
||||
// toggle on the current buffer, but do not toggle off
|
||||
// the other ones (is that a good idea?)
|
||||
if (cmd.argument == buf->fileName())
|
||||
if (lyx::to_utf8(cmd.argument()) == buf->fileName())
|
||||
flag.setOnOff(true);
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_EXPORT:
|
||||
enable = cmd.argument == "custom"
|
||||
|| Exporter::isExportable(*buf, cmd.argument);
|
||||
enable = cmd.argument() == "custom"
|
||||
|| Exporter::isExportable(*buf, lyx::to_utf8(cmd.argument()));
|
||||
break;
|
||||
|
||||
case LFUN_BUFFER_CHKTEX:
|
||||
@ -461,25 +461,25 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
InsetBase::Code code = cur.inset().lyxCode();
|
||||
switch (code) {
|
||||
case InsetBase::TABULAR_CODE:
|
||||
enable = cmd.argument == "tabular";
|
||||
enable = cmd.argument() == "tabular";
|
||||
break;
|
||||
case InsetBase::ERT_CODE:
|
||||
enable = cmd.argument == "ert";
|
||||
enable = cmd.argument() == "ert";
|
||||
break;
|
||||
case InsetBase::FLOAT_CODE:
|
||||
enable = cmd.argument == "float";
|
||||
enable = cmd.argument() == "float";
|
||||
break;
|
||||
case InsetBase::WRAP_CODE:
|
||||
enable = cmd.argument == "wrap";
|
||||
enable = cmd.argument() == "wrap";
|
||||
break;
|
||||
case InsetBase::NOTE_CODE:
|
||||
enable = cmd.argument == "note";
|
||||
enable = cmd.argument() == "note";
|
||||
break;
|
||||
case InsetBase::BRANCH_CODE:
|
||||
enable = cmd.argument == "branch";
|
||||
enable = cmd.argument() == "branch";
|
||||
break;
|
||||
case InsetBase::BOX_CODE:
|
||||
enable = cmd.argument == "box";
|
||||
enable = cmd.argument() == "box";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -491,14 +491,14 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
string const name = cmd.getArg(0);
|
||||
InsetBase * inset = owner->getDialogs().getOpenInset(name);
|
||||
if (inset) {
|
||||
FuncRequest fr(LFUN_INSET_MODIFY, cmd.argument);
|
||||
FuncRequest fr(LFUN_INSET_MODIFY, cmd.argument());
|
||||
FuncStatus fs;
|
||||
bool const success = inset->getStatus(cur, fr, fs);
|
||||
// Every inset is supposed to handle this
|
||||
BOOST_ASSERT(success);
|
||||
flag |= fs;
|
||||
} else {
|
||||
FuncRequest fr(LFUN_INSET_INSERT, cmd.argument);
|
||||
FuncRequest fr(LFUN_INSET_INSERT, cmd.argument());
|
||||
flag |= getStatus(fr);
|
||||
}
|
||||
enable = flag.enabled();
|
||||
@ -558,7 +558,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
// solution, we consider only the first action of the sequence
|
||||
case LFUN_COMMAND_SEQUENCE: {
|
||||
// argument contains ';'-terminated commands
|
||||
string const firstcmd = token(cmd.argument, ';', 0);
|
||||
string const firstcmd = token(lyx::to_utf8(cmd.argument()), ';', 0);
|
||||
FuncRequest func(lyxaction.lookupFunc(firstcmd));
|
||||
func.origin = cmd.origin;
|
||||
flag = getStatus(func);
|
||||
@ -716,7 +716,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new);
|
||||
void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
{
|
||||
BOOST_ASSERT(view());
|
||||
string const argument = cmd.argument;
|
||||
string const argument = lyx::to_utf8(cmd.argument());
|
||||
kb_action const action = cmd.action;
|
||||
|
||||
lyxerr[Debug::ACTION] << "LyXFunc::dispatch: cmd: " << cmd << endl;
|
||||
@ -1155,7 +1155,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_DIALOG_SHOW: {
|
||||
string const name = cmd.getArg(0);
|
||||
string data = trim(cmd.argument.substr(name.size()));
|
||||
string data = trim(lyx::to_utf8(cmd.argument()).substr(name.size()));
|
||||
|
||||
if (name == "character") {
|
||||
data = freefont2string();
|
||||
@ -1185,7 +1185,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
|
||||
case LFUN_DIALOG_SHOW_NEW_INSET: {
|
||||
string const name = cmd.getArg(0);
|
||||
string data = trim(cmd.argument.substr(name.size()));
|
||||
string data = trim(lyx::to_utf8(cmd.argument()).substr(name.size()));
|
||||
if (name == "bibitem" ||
|
||||
name == "bibtex" ||
|
||||
name == "index" ||
|
||||
@ -1243,7 +1243,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
|
||||
// Can only update a dialog connected to an existing inset
|
||||
InsetBase * inset = owner->getDialogs().getOpenInset(name);
|
||||
if (inset) {
|
||||
FuncRequest fr(LFUN_INSET_DIALOG_UPDATE, cmd.argument);
|
||||
FuncRequest fr(LFUN_INSET_DIALOG_UPDATE, cmd.argument());
|
||||
inset->dispatch(view()->cursor(), fr);
|
||||
} else if (name == "paragraph") {
|
||||
dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
|
||||
@ -1652,9 +1652,9 @@ void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & cmd)
|
||||
|
||||
bool argsadded = false;
|
||||
|
||||
if (!cmd.argument.empty()) {
|
||||
if (!cmd.argument().empty()) {
|
||||
if (cmd.action != LFUN_UNKNOWN_ACTION) {
|
||||
comname += ' ' + cmd.argument;
|
||||
comname += ' ' + lyx::to_utf8(cmd.argument());
|
||||
argsadded = true;
|
||||
}
|
||||
}
|
||||
@ -1663,8 +1663,8 @@ void LyXFunc::sendDispatchMessage(string const & msg, FuncRequest const & cmd)
|
||||
|
||||
if (!shortcuts.empty())
|
||||
comname += ": " + shortcuts;
|
||||
else if (!argsadded && !cmd.argument.empty())
|
||||
comname += ' ' + cmd.argument;
|
||||
else if (!argsadded && !cmd.argument().empty())
|
||||
comname += ' ' + lyx::to_utf8(cmd.argument());
|
||||
|
||||
if (!comname.empty()) {
|
||||
comname = rtrim(comname);
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
using lyx::support::bformat;
|
||||
@ -103,7 +105,7 @@ bool MathAMSArrayInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
string const s = cmd.argument;
|
||||
docstring const & s = cmd.argument();
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
N_("Can't add vertical grid lines in '%1$s'"),
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::bformat;
|
||||
|
||||
using std::endl;
|
||||
@ -69,7 +70,7 @@ void MathCasesInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
recordUndo(cur);
|
||||
string const s = cmd.argument;
|
||||
docstring const & s = cmd.argument();
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
cur.undispatched();
|
||||
break;
|
||||
@ -86,11 +87,11 @@ bool MathCasesInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
string const s = cmd.argument;
|
||||
docstring const & s = cmd.argument();
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.enabled(false);
|
||||
flag.message(bformat(
|
||||
N_("No vertical grid lines in '%1$s'"), s));
|
||||
N_("No vertical grid lines in '%1$s'"), lyx::to_utf8(s)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1112,8 +1112,8 @@ void MathGridInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
recordUndoInset(cur);
|
||||
//lyxerr << "handling tabular-feature " << cmd.argument << endl;
|
||||
istringstream is(cmd.argument);
|
||||
//lyxerr << "handling tabular-feature " << lyx::to_utf8(cmd.argument()) << endl;
|
||||
istringstream is(lyx::to_utf8(cmd.argument()));
|
||||
string s;
|
||||
is >> s;
|
||||
if (s == "valign-top")
|
||||
@ -1206,7 +1206,7 @@ void MathGridInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_PASTE: {
|
||||
cur.message(_("Paste"));
|
||||
lyx::cap::replaceSelection(cur);
|
||||
istringstream is(cmd.argument);
|
||||
istringstream is(lyx::to_utf8(cmd.argument()));
|
||||
int n = 0;
|
||||
is >> n;
|
||||
MathGridInset grid(1, 1);
|
||||
@ -1299,7 +1299,7 @@ bool MathGridInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
string const s = cmd.argument;
|
||||
string const s = lyx::to_utf8(cmd.argument());
|
||||
if (nrows() <= 1 && (s == "delete-row" || s == "swap-row")) {
|
||||
status.enabled(false);
|
||||
status.message(N_("Only one row"));
|
||||
@ -1361,15 +1361,15 @@ bool MathGridInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
status.enable(true);
|
||||
break;
|
||||
}
|
||||
if (cmd.argument.empty()) {
|
||||
if (cmd.argument().empty()) {
|
||||
status.enable(false);
|
||||
break;
|
||||
}
|
||||
if (!lyx::support::contains("tcb", cmd.argument[0])) {
|
||||
if (!lyx::support::contains("tcb", cmd.argument()[0])) {
|
||||
status.enable(false);
|
||||
break;
|
||||
}
|
||||
status.setOnOff(cmd.argument[0] == v_align_);
|
||||
status.setOnOff(cmd.argument()[0] == v_align_);
|
||||
status.enabled(true);
|
||||
#endif
|
||||
return true;
|
||||
|
@ -913,7 +913,7 @@ void MathHullInset::doExtern(LCursor & cur, FuncRequest & func)
|
||||
{
|
||||
string lang;
|
||||
string extra;
|
||||
istringstream iss(func.argument);
|
||||
istringstream iss(lyx::to_utf8(func.argument()));
|
||||
iss >> lang >> extra;
|
||||
if (extra.empty())
|
||||
extra = "noextra";
|
||||
@ -1052,15 +1052,15 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
(lyxrc.label_init_length >= 0) ? "eq:" : "";
|
||||
if (old_label.empty())
|
||||
old_label = default_label;
|
||||
string const contents = cmd.argument.empty() ?
|
||||
old_label : cmd.argument;
|
||||
string const contents = cmd.argument().empty() ?
|
||||
old_label : lyx::to_utf8(cmd.argument());
|
||||
|
||||
InsetCommandParams p("label", contents);
|
||||
string const data = InsetCommandMailer::params2string("label", p);
|
||||
|
||||
if (cmd.argument.empty()) {
|
||||
if (cmd.argument().empty())
|
||||
cur.bv().owner()->getDialogs().show("label", data, 0);
|
||||
} else {
|
||||
else {
|
||||
FuncRequest fr(LFUN_INSET_INSERT, data);
|
||||
dispatch(cur, fr);
|
||||
}
|
||||
@ -1068,11 +1068,11 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
|
||||
case LFUN_INSET_INSERT: {
|
||||
//lyxerr << "arg: " << cmd.argument << endl;
|
||||
//lyxerr << "arg: " << lyx::to_utf8(cmd.argument()) << endl;
|
||||
string const name = cmd.getArg(0);
|
||||
if (name == "label") {
|
||||
InsetCommandParams p;
|
||||
InsetCommandMailer::string2params(name, cmd.argument, p);
|
||||
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()), p);
|
||||
string str = p.getContents();
|
||||
recordUndoInset(cur);
|
||||
row_type const r = (type_ == "multline") ? nrows() - 1 : cur.row();
|
||||
@ -1087,7 +1087,7 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
break;
|
||||
}
|
||||
MathArray ar;
|
||||
if (createMathInset_fromDialogStr(cmd.argument, ar)) {
|
||||
if (createMathInset_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) {
|
||||
recordUndo(cur);
|
||||
cur.insert(ar);
|
||||
} else
|
||||
@ -1104,7 +1104,7 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
recordUndoInset(cur);
|
||||
row_type row = cur.row();
|
||||
col_type col = cur.col();
|
||||
mutate(cmd.argument);
|
||||
mutate(lyx::to_utf8(cmd.argument()));
|
||||
cur.idx() = row * ncols() + col;
|
||||
if (cur.idx() > cur.lastidx()) {
|
||||
cur.idx() = cur.lastidx();
|
||||
@ -1164,7 +1164,7 @@ bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
break;
|
||||
}
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
istringstream is(cmd.argument);
|
||||
istringstream is(lyx::to_utf8(cmd.argument()));
|
||||
string s;
|
||||
is >> s;
|
||||
if (!rowChangeOK()
|
||||
|
@ -424,7 +424,7 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
cur.message(_("Paste"));
|
||||
replaceSelection(cur);
|
||||
size_t n = 0;
|
||||
istringstream is(cmd.argument);
|
||||
istringstream is(lyx::to_utf8(cmd.argument()));
|
||||
is >> n;
|
||||
string const selection = lyx::cap::getSelection(cur.buffer(), n);
|
||||
cur.niceInsert(selection);
|
||||
@ -663,10 +663,11 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_SELF_INSERT:
|
||||
if (cmd.argument.size() != 1) {
|
||||
if (cmd.argument().size() != 1) {
|
||||
recordUndo(cur);
|
||||
if (!interpret(cur, cmd.argument))
|
||||
cur.insert(cmd.argument);
|
||||
string const arg = lyx::to_utf8(cmd.argument());
|
||||
if (!interpret(cur, arg))
|
||||
cur.insert(arg);
|
||||
break;
|
||||
}
|
||||
// Don't record undo steps if we are in macro mode and
|
||||
@ -684,7 +685,7 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
// spacial handling of space. If we insert an inset
|
||||
// via macro mode, we want to put the cursor inside it
|
||||
// if relevant. Think typing "\frac<space>".
|
||||
if (cmd.argument[0] == ' '
|
||||
if (cmd.argument()[0] == ' '
|
||||
&& cur.inMacroMode() && cur.macroName() != "\\"
|
||||
&& cur.macroModeClose()) {
|
||||
MathAtom const atom = cur.prevAtom();
|
||||
@ -692,7 +693,10 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
cur.posLeft();
|
||||
cur.pushLeft(*cur.nextInset());
|
||||
}
|
||||
} else if (!interpret(cur, cmd.argument[0])) {
|
||||
// FIXME: Change to
|
||||
// } else if (!interpret(cur, cmd.argument()[0])) {
|
||||
// when interpret accepts UCS4 characters
|
||||
} else if (!interpret(cur, lyx::to_utf8(cmd.argument()))) {
|
||||
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
|
||||
cur.undispatched();
|
||||
}
|
||||
@ -706,7 +710,7 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
lyxerr << "LFUN_SERVER_SET_XY broken!" << endl;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
istringstream is(cmd.argument);
|
||||
istringstream is(lyx::to_utf8(cmd.argument()));
|
||||
is >> x >> y;
|
||||
cur.setScreenPos(x, y);
|
||||
break;
|
||||
@ -715,7 +719,7 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
// Special casing for superscript in case of LyX handling
|
||||
// dead-keys:
|
||||
case LFUN_ACCENT_CIRCUMFLEX:
|
||||
if (cmd.argument.empty()) {
|
||||
if (cmd.argument().empty()) {
|
||||
// do superscript if LyX handles
|
||||
// deadkeys
|
||||
recordUndo(cur, Undo::ATOMIC);
|
||||
@ -742,66 +746,66 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
// Math fonts
|
||||
case LFUN_FONT_FREE_APPLY:
|
||||
case LFUN_FONT_FREE_UPDATE:
|
||||
handleFont2(cur, cmd.argument);
|
||||
handleFont2(cur, lyx::to_utf8(cmd.argument()));
|
||||
break;
|
||||
|
||||
case LFUN_FONT_BOLD:
|
||||
if (currentMode() == TEXT_MODE)
|
||||
handleFont(cur, cmd.argument, "textbf");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "textbf");
|
||||
else
|
||||
handleFont(cur, cmd.argument, "mathbf");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "mathbf");
|
||||
break;
|
||||
case LFUN_FONT_SANS:
|
||||
if (currentMode() == TEXT_MODE)
|
||||
handleFont(cur, cmd.argument, "textsf");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "textsf");
|
||||
else
|
||||
handleFont(cur, cmd.argument, "mathsf");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "mathsf");
|
||||
break;
|
||||
case LFUN_FONT_EMPH:
|
||||
if (currentMode() == TEXT_MODE)
|
||||
handleFont(cur, cmd.argument, "emph");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "emph");
|
||||
else
|
||||
handleFont(cur, cmd.argument, "mathcal");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "mathcal");
|
||||
break;
|
||||
case LFUN_FONT_ROMAN:
|
||||
if (currentMode() == TEXT_MODE)
|
||||
handleFont(cur, cmd.argument, "textrm");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "textrm");
|
||||
else
|
||||
handleFont(cur, cmd.argument, "mathrm");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "mathrm");
|
||||
break;
|
||||
case LFUN_FONT_CODE:
|
||||
if (currentMode() == TEXT_MODE)
|
||||
handleFont(cur, cmd.argument, "texttt");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "texttt");
|
||||
else
|
||||
handleFont(cur, cmd.argument, "mathtt");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "mathtt");
|
||||
break;
|
||||
case LFUN_FONT_FRAK:
|
||||
handleFont(cur, cmd.argument, "mathfrak");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "mathfrak");
|
||||
break;
|
||||
case LFUN_FONT_ITAL:
|
||||
if (currentMode() == TEXT_MODE)
|
||||
handleFont(cur, cmd.argument, "textit");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "textit");
|
||||
else
|
||||
handleFont(cur, cmd.argument, "mathit");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "mathit");
|
||||
break;
|
||||
case LFUN_FONT_NOUN:
|
||||
if (currentMode() == TEXT_MODE)
|
||||
// FIXME: should be "noun"
|
||||
handleFont(cur, cmd.argument, "textsc");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "textsc");
|
||||
else
|
||||
handleFont(cur, cmd.argument, "mathbb");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "mathbb");
|
||||
break;
|
||||
//case LFUN_FONT_FREE_APPLY:
|
||||
handleFont(cur, cmd.argument, "textrm");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "textrm");
|
||||
break;
|
||||
case LFUN_FONT_DEFAULT:
|
||||
handleFont(cur, cmd.argument, "textnormal");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "textnormal");
|
||||
break;
|
||||
|
||||
case LFUN_MATH_MODE: {
|
||||
#if 1
|
||||
// ignore math-mode on when already in math mode
|
||||
if (currentMode() == InsetBase::MATH_MODE && cmd.argument == "on")
|
||||
if (currentMode() == InsetBase::MATH_MODE && cmd.argument() == "on")
|
||||
break;
|
||||
cur.macroModeClose();
|
||||
string const save_selection = grabAndEraseSelection(cur);
|
||||
@ -816,7 +820,7 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
cur.niceInsert(MathAtom(new MathHullInset("simple")));
|
||||
cur.message(_("create new math text environment ($...$)"));
|
||||
} else {
|
||||
handleFont(cur, cmd.argument, "textrm");
|
||||
handleFont(cur, lyx::to_utf8(cmd.argument()), "textrm");
|
||||
cur.message(_("entered math text mode (textrm)"));
|
||||
}
|
||||
#endif
|
||||
@ -836,7 +840,7 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
unsigned int n = 1;
|
||||
string v_align;
|
||||
string h_align;
|
||||
istringstream is(cmd.argument);
|
||||
istringstream is(lyx::to_utf8(cmd.argument()));
|
||||
is >> m >> n >> v_align >> h_align;
|
||||
if (m < 1)
|
||||
m = 1;
|
||||
@ -850,7 +854,7 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_MATH_DELIM: {
|
||||
string ls;
|
||||
string rs = lyx::support::split(cmd.argument, ls, ' ');
|
||||
string rs = lyx::support::split(lyx::to_utf8(cmd.argument()), ls, ' ');
|
||||
// Reasonable default values
|
||||
if (ls.empty())
|
||||
ls = '(';
|
||||
@ -920,15 +924,15 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
// math-insert only handles special math things like "matrix".
|
||||
case LFUN_MATH_INSERT: {
|
||||
recordUndo(cur, Undo::ATOMIC);
|
||||
if (cmd.argument == "^" || cmd.argument == "_") {
|
||||
interpret(cur, cmd.argument[0]);
|
||||
} else
|
||||
cur.niceInsert(cmd.argument);
|
||||
if (cmd.argument() == "^" || cmd.argument() == "_")
|
||||
interpret(cur, cmd.argument()[0]);
|
||||
else
|
||||
cur.niceInsert(lyx::to_utf8(cmd.argument()));
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_DIALOG_SHOW_NEW_INSET: {
|
||||
string const & name = cmd.argument;
|
||||
string const & name = lyx::to_utf8(cmd.argument());
|
||||
string data;
|
||||
if (name == "ref") {
|
||||
RefInset tmp(name);
|
||||
@ -951,7 +955,7 @@ bool MathNestInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
// the font related toggles
|
||||
//string tc = "mathnormal";
|
||||
bool ret = true;
|
||||
string const arg = cmd.argument;
|
||||
string const arg = lyx::to_utf8(cmd.argument());
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE:
|
||||
flag.enabled(false);
|
||||
@ -965,15 +969,15 @@ bool MathNestInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
enable = false;
|
||||
break;
|
||||
}
|
||||
if (cmd.argument.empty()) {
|
||||
if (cmd.argument().empty()) {
|
||||
flag.clear();
|
||||
break;
|
||||
}
|
||||
if (!contains("tcb", cmd.argument[0])) {
|
||||
if (!contains("tcb", cmd.argument()[0])) {
|
||||
enable = false;
|
||||
break;
|
||||
}
|
||||
flag.setOnOff(cmd.argument[0] == align);
|
||||
flag.setOnOff(cmd.argument()[0] == align);
|
||||
break;
|
||||
#endif
|
||||
/// We have to handle them since 1.4 blocks all unhandled actions
|
||||
@ -988,7 +992,7 @@ bool MathNestInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
flag.enabled(true);
|
||||
break;
|
||||
case LFUN_MATH_MUTATE:
|
||||
//flag.setOnOff(mathcursor::formula()->hullType() == cmd.argument);
|
||||
//flag.setOnOff(mathcursor::formula()->hullType() == lyx::to_utf8(cmd.argument()));
|
||||
flag.setOnOff(false);
|
||||
break;
|
||||
|
||||
|
@ -606,10 +606,10 @@ void MathScriptInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
//lyxerr << "MathScriptInset: request: " << cmd << std::endl;
|
||||
|
||||
if (cmd.action == LFUN_MATH_LIMITS) {
|
||||
if (!cmd.argument.empty()) {
|
||||
if (cmd.argument == "limits")
|
||||
if (!cmd.argument().empty()) {
|
||||
if (cmd.argument() == "limits")
|
||||
limits_ = 1;
|
||||
else if (cmd.argument == "nolimits")
|
||||
else if (cmd.argument() == "nolimits")
|
||||
limits_ = -1;
|
||||
else
|
||||
limits_ = 0;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "support/std_ostream.h"
|
||||
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::bformat;
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
@ -68,7 +69,7 @@ bool MathSplitInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
{
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
string const s = cmd.argument;
|
||||
docstring const & s = cmd.argument();
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
N_("Can't add vertical grid lines in '%1$s'"),
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
||||
using lyx::docstring;
|
||||
using lyx::support::bformat;
|
||||
using std::string;
|
||||
using std::auto_ptr;
|
||||
@ -63,7 +64,7 @@ bool MathSubstackInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
switch (cmd.action) {
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
string const name("substack");
|
||||
string const s = cmd.argument;
|
||||
docstring const & s = cmd.argument();
|
||||
if (s == "add-vline-left" || s == "add-vline-right") {
|
||||
flag.message(bformat(
|
||||
N_("Can't add vertical grid lines in '%1$s'"), name));
|
||||
|
@ -63,7 +63,7 @@ void RefInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_INSET_MODIFY:
|
||||
if (cmd.getArg(0) == "ref") {
|
||||
MathArray ar;
|
||||
if (createMathInset_fromDialogStr(cmd.argument, ar)) {
|
||||
if (createMathInset_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) {
|
||||
*this = *ar[0].nucleus()->asRefInset();
|
||||
break;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ libsupport_la_SOURCES = \
|
||||
copied_ptr.h \
|
||||
cow_ptr.h \
|
||||
debugstream.h \
|
||||
docstring.C \
|
||||
docstring.h \
|
||||
environment.h \
|
||||
environment.C \
|
||||
|
70
src/support/docstring.C
Normal file
70
src/support/docstring.C
Normal file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* \file docstring.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Georg Baum
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "docstring.h"
|
||||
#include "unicode.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
docstring const from_ascii(char const * ascii)
|
||||
{
|
||||
docstring s;
|
||||
for (char const * c = ascii; *c; ++c) {
|
||||
BOOST_ASSERT(static_cast<unsigned char>(*c) < 0x80);
|
||||
s.push_back(*c);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
docstring const from_ascii(std::string const & ascii)
|
||||
{
|
||||
int const len = ascii.length();
|
||||
for (int i = 0; i < len; ++i)
|
||||
BOOST_ASSERT(static_cast<unsigned char>(ascii[i]) < 0x80);
|
||||
return docstring(ascii.begin(), ascii.end());
|
||||
}
|
||||
|
||||
|
||||
docstring const from_utf8(std::string const & utf8)
|
||||
{
|
||||
std::vector<boost::uint32_t> const ucs4 =
|
||||
utf8_to_ucs4(std::vector<char>(utf8.begin(), utf8.end()));
|
||||
return docstring(ucs4.begin(), ucs4.end());
|
||||
}
|
||||
|
||||
|
||||
std::string const to_utf8(docstring const & ucs4)
|
||||
{
|
||||
std::vector<char> const utf8 =
|
||||
ucs4_to_utf8(std::vector<boost::uint32_t>(ucs4.begin(), ucs4.end()));
|
||||
return std::string(utf8.begin(), utf8.end());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool operator==(lyx::docstring const & l, char const * r)
|
||||
{
|
||||
int const len = l.length();
|
||||
for (int i = 0; i < len; ++i) {
|
||||
BOOST_ASSERT(static_cast<unsigned char>(r[i]) < 0x80);
|
||||
if (!r[i])
|
||||
return false;
|
||||
if (l[i] != lyx::docstring::value_type(r[i]))
|
||||
return false;
|
||||
}
|
||||
return r[len] == '\0';
|
||||
}
|
@ -4,11 +4,8 @@
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* Provide a set of typedefs for commonly used things like sizes and
|
||||
* indices wile trying to stay compatible with types used
|
||||
* by the standard containers.
|
||||
*
|
||||
* \author André Pönitz
|
||||
* \author Lars Gullik Bjønnes
|
||||
* \author Georg Baum
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
@ -21,10 +18,34 @@
|
||||
|
||||
namespace lyx {
|
||||
|
||||
/// String type for storing the main text in UCS4 encoding
|
||||
typedef std::basic_string<boost::uint32_t> docstring;
|
||||
|
||||
/// Creates a docstring from a C string of ASCII characters
|
||||
docstring const from_ascii(char const *);
|
||||
|
||||
/// Creates a docstring from a std::string of ASCII characters
|
||||
docstring const from_ascii(std::string const &);
|
||||
|
||||
/// Creates a docstring from a UTF8 string. This should go eventually.
|
||||
docstring const from_utf8(std::string const &);
|
||||
|
||||
/// Creates a UTF8 string from a docstring. This should go eventually.
|
||||
std::string const to_utf8(docstring const &);
|
||||
|
||||
}
|
||||
|
||||
/// Compare a docstring with a C string of ASCII characters
|
||||
bool operator==(lyx::docstring const &, char const *);
|
||||
|
||||
/// Compare a C string of ASCII characters with a docstring
|
||||
inline bool operator==(char const * l, lyx::docstring const & r) { return r == l; }
|
||||
|
||||
/// Compare a docstring with a C string of ASCII characters
|
||||
inline bool operator!=(lyx::docstring const & l, char const * r) { return !(l == r); }
|
||||
|
||||
/// Compare a C string of ASCII characters with a docstring
|
||||
inline bool operator!=(char const * l, lyx::docstring const & r) { return !(r == l); }
|
||||
|
||||
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && __GNUC__ == 3 && __GNUC_MINOR__ < 4
|
||||
// Missing char_traits methods in gcc 3.3 and older. Taken from gcc 4.2svn.
|
||||
|
120
src/text3.C
120
src/text3.C
@ -64,7 +64,6 @@
|
||||
#include "support/lyxlib.h"
|
||||
#include "support/convert.h"
|
||||
#include "support/lyxtime.h"
|
||||
#include "support/unicode.h"
|
||||
|
||||
#include "mathed/math_hullinset.h"
|
||||
#include "mathed/math_macrotemplate.h"
|
||||
@ -75,6 +74,7 @@
|
||||
#include <sstream>
|
||||
|
||||
using lyx::char_type;
|
||||
using lyx::docstring;
|
||||
using lyx::pos_type;
|
||||
|
||||
using lyx::cap::copySelection;
|
||||
@ -163,9 +163,9 @@ namespace {
|
||||
cur.dispatch(FuncRequest(LFUN_MATH_DISPLAY));
|
||||
// Avoid an unnecessary undo step if cmd.argument
|
||||
// is empty
|
||||
if (!cmd.argument.empty())
|
||||
if (!cmd.argument().empty())
|
||||
cur.dispatch(FuncRequest(LFUN_MATH_INSERT,
|
||||
cmd.argument));
|
||||
cmd.argument()));
|
||||
} else {
|
||||
// create a macro if we see "\\newcommand"
|
||||
// somewhere, and an ordinary formula
|
||||
@ -667,7 +667,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
if (cur_spacing == Spacing::Other)
|
||||
cur_value = par.params().spacing().getValueAsString();
|
||||
|
||||
istringstream is(cmd.argument);
|
||||
istringstream is(lyx::to_utf8(cmd.argument()));
|
||||
string tmp;
|
||||
is >> tmp;
|
||||
Spacing::Space new_spacing = cur_spacing;
|
||||
@ -692,7 +692,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
new_spacing = Spacing::Default;
|
||||
} else {
|
||||
lyxerr << _("Unknown spacing argument: ")
|
||||
<< cmd.argument << endl;
|
||||
<< lyx::to_utf8(cmd.argument()) << endl;
|
||||
}
|
||||
if (cur_spacing != new_spacing || cur_value != new_value)
|
||||
par.params().spacing(Spacing(new_spacing, new_value));
|
||||
@ -791,9 +791,9 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_PASTE:
|
||||
cur.message(_("Paste"));
|
||||
lyx::cap::replaceSelection(cur);
|
||||
if (isStrUnsignedInt(cmd.argument))
|
||||
if (isStrUnsignedInt(lyx::to_utf8(cmd.argument())))
|
||||
pasteSelection(cur, bv->buffer()->errorList("Paste"),
|
||||
convert<unsigned int>(cmd.argument));
|
||||
convert<unsigned int>(lyx::to_utf8(cmd.argument())));
|
||||
else
|
||||
pasteSelection(cur, bv->buffer()->errorList("Paste"),
|
||||
0);
|
||||
@ -821,11 +821,11 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_SERVER_SET_XY: {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
istringstream is(cmd.argument);
|
||||
istringstream is(lyx::to_utf8(cmd.argument()));
|
||||
is >> x >> y;
|
||||
if (!is)
|
||||
lyxerr << "SETXY: Could not parse coordinates in '"
|
||||
<< cmd.argument << std::endl;
|
||||
<< lyx::to_utf8(cmd.argument()) << std::endl;
|
||||
else
|
||||
setCursorFromCoordinates(cur, x, y);
|
||||
break;
|
||||
@ -846,14 +846,14 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_LAYOUT: {
|
||||
lyxerr[Debug::INFO] << "LFUN_LAYOUT: (arg) "
|
||||
<< cmd.argument << endl;
|
||||
<< lyx::to_utf8(cmd.argument()) << endl;
|
||||
|
||||
// This is not the good solution to the empty argument
|
||||
// problem, but it will hopefully suffice for 1.2.0.
|
||||
// The correct solution would be to augument the
|
||||
// function list/array with information about what
|
||||
// functions needs arguments and their type.
|
||||
if (cmd.argument.empty()) {
|
||||
if (cmd.argument().empty()) {
|
||||
cur.errorMessage(_("LyX function 'layout' needs an argument."));
|
||||
break;
|
||||
}
|
||||
@ -861,8 +861,8 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
// Derive layout number from given argument (string)
|
||||
// and current buffer's textclass (number)
|
||||
LyXTextClass const & tclass = bv->buffer()->params().getLyXTextClass();
|
||||
bool hasLayout = tclass.hasLayout(cmd.argument);
|
||||
string layout = cmd.argument;
|
||||
bool hasLayout = tclass.hasLayout(lyx::to_utf8(cmd.argument()));
|
||||
string layout = lyx::to_utf8(cmd.argument());
|
||||
|
||||
// If the entry is obsolete, use the new one instead.
|
||||
if (hasLayout) {
|
||||
@ -872,7 +872,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
|
||||
if (!hasLayout) {
|
||||
cur.errorMessage(string(N_("Layout ")) + cmd.argument +
|
||||
cur.errorMessage(string(N_("Layout ")) + lyx::to_utf8(cmd.argument()) +
|
||||
N_(" not known"));
|
||||
break;
|
||||
}
|
||||
@ -907,7 +907,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
string const clip = bv->owner()->gui().clipboard().get();
|
||||
if (!clip.empty()) {
|
||||
recordUndo(cur);
|
||||
if (cmd.argument == "paragraph")
|
||||
if (cmd.argument() == "paragraph")
|
||||
insertStringAsParagraphs(cur, clip);
|
||||
else
|
||||
insertStringAsLines(cur, clip);
|
||||
@ -920,7 +920,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
string const clip = bv->owner()->gui().selection().get();
|
||||
if (!clip.empty()) {
|
||||
recordUndo(cur);
|
||||
if (cmd.argument == "paragraph")
|
||||
if (cmd.argument() == "paragraph")
|
||||
insertStringAsParagraphs(cur, clip);
|
||||
else
|
||||
insertStringAsLines(cur, clip);
|
||||
@ -945,7 +945,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
BufferParams const & bufparams = bv->buffer()->params();
|
||||
if (!style->pass_thru
|
||||
&& par.getFontSettings(bufparams, pos).language()->lang() != "hebrew") {
|
||||
string arg = cmd.argument;
|
||||
string arg = lyx::to_utf8(cmd.argument());
|
||||
if (arg == "single")
|
||||
cur.insert(new InsetQuotes(c,
|
||||
bufparams.quotes_language,
|
||||
@ -962,12 +962,12 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
|
||||
case LFUN_DATE_INSERT:
|
||||
if (cmd.argument.empty())
|
||||
if (cmd.argument().empty())
|
||||
bv->owner()->dispatch(FuncRequest(LFUN_SELF_INSERT,
|
||||
lyx::formatted_time(lyx::current_time())));
|
||||
else
|
||||
bv->owner()->dispatch(FuncRequest(LFUN_SELF_INSERT,
|
||||
lyx::formatted_time(lyx::current_time(), cmd.argument)));
|
||||
lyx::formatted_time(lyx::current_time(), lyx::to_utf8(cmd.argument()))));
|
||||
break;
|
||||
|
||||
case LFUN_MOUSE_TRIPLE:
|
||||
@ -1076,7 +1076,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
|
||||
case LFUN_SELF_INSERT: {
|
||||
if (cmd.argument.empty())
|
||||
if (cmd.argument().empty())
|
||||
break;
|
||||
|
||||
// Automatically delete the currently selected
|
||||
@ -1094,18 +1094,13 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
cur.clearSelection();
|
||||
LyXFont const old_font = real_current_font;
|
||||
|
||||
#if 0
|
||||
string::const_iterator cit = cmd.argument.begin();
|
||||
string::const_iterator end = cmd.argument.end();
|
||||
docstring::const_iterator cit = cmd.argument().begin();
|
||||
docstring::const_iterator end = cmd.argument().end();
|
||||
for (; cit != end; ++cit)
|
||||
#if 0
|
||||
bv->owner()->getIntl().getTransManager().
|
||||
translateAndInsert(*cit, this);
|
||||
#else
|
||||
std::vector<char> in(cmd.argument.begin(), cmd.argument.end());
|
||||
std::vector<boost::uint32_t> const res = utf8_to_ucs4(in);
|
||||
std::vector<boost::uint32_t>::const_iterator cit = res.begin();
|
||||
std::vector<boost::uint32_t>::const_iterator end = res.end();
|
||||
for (; cit != end; ++cit)
|
||||
insertChar(bv->cursor(), *cit);
|
||||
#endif
|
||||
|
||||
@ -1130,13 +1125,13 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_LABEL_INSERT: {
|
||||
// Try to generate a valid label
|
||||
string const contents = cmd.argument.empty() ?
|
||||
cur.getPossibleLabel() : cmd.argument;
|
||||
string const contents = cmd.argument().empty() ?
|
||||
cur.getPossibleLabel() : lyx::to_utf8(cmd.argument());
|
||||
|
||||
InsetCommandParams p("label", contents);
|
||||
string const data = InsetCommandMailer::params2string("label", p);
|
||||
|
||||
if (cmd.argument.empty()) {
|
||||
if (cmd.argument().empty()) {
|
||||
bv->owner()->getDialogs().show("label", data, 0);
|
||||
} else {
|
||||
FuncRequest fr(LFUN_INSET_INSERT, data);
|
||||
@ -1223,7 +1218,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_MATH_IMPORT_SELECTION:
|
||||
case LFUN_MATH_MODE:
|
||||
if (cmd.argument == "on")
|
||||
if (cmd.argument() == "on")
|
||||
// don't pass "on" as argument
|
||||
mathDispatch(cur, FuncRequest(LFUN_MATH_MODE), false);
|
||||
else
|
||||
@ -1231,10 +1226,10 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
break;
|
||||
|
||||
case LFUN_MATH_MACRO:
|
||||
if (cmd.argument.empty())
|
||||
if (cmd.argument().empty())
|
||||
cur.errorMessage(N_("Missing argument"));
|
||||
else {
|
||||
string s = cmd.argument;
|
||||
string s = lyx::to_utf8(cmd.argument());
|
||||
string const s1 = token(s, ' ', 1);
|
||||
int const nargs = s1.empty() ? 0 : convert<int>(s1);
|
||||
string const s2 = token(s, ' ', 2);
|
||||
@ -1319,13 +1314,13 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_FONT_SIZE: {
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
font.setLyXSize(cmd.argument);
|
||||
font.setLyXSize(lyx::to_utf8(cmd.argument()));
|
||||
toggleAndShow(cur, this, font);
|
||||
break;
|
||||
}
|
||||
|
||||
case LFUN_LANGUAGE: {
|
||||
Language const * lang = languages.getLanguage(cmd.argument);
|
||||
Language const * lang = languages.getLanguage(lyx::to_utf8(cmd.argument()));
|
||||
if (!lang)
|
||||
break;
|
||||
LyXFont font(LyXFont::ALL_IGNORE);
|
||||
@ -1345,7 +1340,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_FONT_FREE_UPDATE: {
|
||||
LyXFont font;
|
||||
bool toggle;
|
||||
if (bv_funcs::string2font(cmd.argument, font, toggle)) {
|
||||
if (bv_funcs::string2font(lyx::to_utf8(cmd.argument()), font, toggle)) {
|
||||
freefont = font;
|
||||
toggleall = toggle;
|
||||
toggleAndShow(cur, this, freefont, toggleall);
|
||||
@ -1413,14 +1408,15 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
case LFUN_ACCENT_CIRCLE:
|
||||
case LFUN_ACCENT_OGONEK:
|
||||
bv->owner()->getLyXFunc().handleKeyFunc(cmd.action);
|
||||
if (!cmd.argument.empty())
|
||||
if (!cmd.argument().empty())
|
||||
// FIXME: Are all these characters encoded in one byte in utf8?
|
||||
bv->owner()->getIntl().getTransManager()
|
||||
.translateAndInsert(cmd.argument[0], this);
|
||||
.translateAndInsert(cmd.argument()[0], this);
|
||||
break;
|
||||
|
||||
case LFUN_FLOAT_LIST: {
|
||||
LyXTextClass const & tclass = bv->buffer()->params().getLyXTextClass();
|
||||
if (tclass.floats().typeExist(cmd.argument)) {
|
||||
if (tclass.floats().typeExist(lyx::to_utf8(cmd.argument()))) {
|
||||
// not quite sure if we want this...
|
||||
recordUndo(cur);
|
||||
cur.clearSelection();
|
||||
@ -1433,11 +1429,11 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
|
||||
setLayout(cur, tclass.defaultLayoutName());
|
||||
setParagraph(cur, Spacing(), LYX_ALIGN_LAYOUT, string(), 0);
|
||||
insertInset(cur, new InsetFloatList(cmd.argument));
|
||||
insertInset(cur, new InsetFloatList(lyx::to_utf8(cmd.argument())));
|
||||
cur.posRight();
|
||||
} else {
|
||||
lyxerr << "Non-existent float type: "
|
||||
<< cmd.argument << endl;
|
||||
<< lyx::to_utf8(cmd.argument()) << endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1453,7 +1449,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
|
||||
case LFUN_THESAURUS_ENTRY: {
|
||||
string arg = cmd.argument;
|
||||
string arg = lyx::to_utf8(cmd.argument());
|
||||
if (arg.empty()) {
|
||||
arg = cur.selectionAsString(false);
|
||||
// FIXME
|
||||
@ -1471,7 +1467,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
|
||||
// Given data, an encoding of the ParagraphParameters
|
||||
// generated in the Paragraph dialog, this function sets
|
||||
// the current paragraph appropriately.
|
||||
istringstream is(cmd.argument);
|
||||
istringstream is(lyx::to_utf8(cmd.argument()));
|
||||
LyXLex lex(0, 0);
|
||||
lex.setStream(is);
|
||||
ParagraphParameters params;
|
||||
@ -1554,41 +1550,41 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
|
||||
break;
|
||||
|
||||
case LFUN_DIALOG_SHOW_NEW_INSET:
|
||||
if (cmd.argument == "bibitem")
|
||||
if (cmd.argument() == "bibitem")
|
||||
code = InsetBase::BIBITEM_CODE;
|
||||
else if (cmd.argument == "bibtex")
|
||||
else if (cmd.argument() == "bibtex")
|
||||
code = InsetBase::BIBTEX_CODE;
|
||||
else if (cmd.argument == "box")
|
||||
else if (cmd.argument() == "box")
|
||||
code = InsetBase::BOX_CODE;
|
||||
else if (cmd.argument == "branch")
|
||||
else if (cmd.argument() == "branch")
|
||||
code = InsetBase::BRANCH_CODE;
|
||||
else if (cmd.argument == "citation")
|
||||
else if (cmd.argument() == "citation")
|
||||
code = InsetBase::CITE_CODE;
|
||||
else if (cmd.argument == "ert")
|
||||
else if (cmd.argument() == "ert")
|
||||
code = InsetBase::ERT_CODE;
|
||||
else if (cmd.argument == "external")
|
||||
else if (cmd.argument() == "external")
|
||||
code = InsetBase::EXTERNAL_CODE;
|
||||
else if (cmd.argument == "float")
|
||||
else if (cmd.argument() == "float")
|
||||
code = InsetBase::FLOAT_CODE;
|
||||
else if (cmd.argument == "graphics")
|
||||
else if (cmd.argument() == "graphics")
|
||||
code = InsetBase::GRAPHICS_CODE;
|
||||
else if (cmd.argument == "include")
|
||||
else if (cmd.argument() == "include")
|
||||
code = InsetBase::INCLUDE_CODE;
|
||||
else if (cmd.argument == "index")
|
||||
else if (cmd.argument() == "index")
|
||||
code = InsetBase::INDEX_CODE;
|
||||
else if (cmd.argument == "label")
|
||||
else if (cmd.argument() == "label")
|
||||
code = InsetBase::LABEL_CODE;
|
||||
else if (cmd.argument == "note")
|
||||
else if (cmd.argument() == "note")
|
||||
code = InsetBase::NOTE_CODE;
|
||||
else if (cmd.argument == "ref")
|
||||
else if (cmd.argument() == "ref")
|
||||
code = InsetBase::REF_CODE;
|
||||
else if (cmd.argument == "toc")
|
||||
else if (cmd.argument() == "toc")
|
||||
code = InsetBase::TOC_CODE;
|
||||
else if (cmd.argument == "url")
|
||||
else if (cmd.argument() == "url")
|
||||
code = InsetBase::URL_CODE;
|
||||
else if (cmd.argument == "vspace")
|
||||
else if (cmd.argument() == "vspace")
|
||||
code = InsetBase::VSPACE_CODE;
|
||||
else if (cmd.argument == "wrap")
|
||||
else if (cmd.argument() == "wrap")
|
||||
code = InsetBase::WRAP_CODE;
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user