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