this diff removes most of the get/set command function calls from the
lyx code. I didn't touch cite stuff, as we decided.
On 10/19/06, Ozgur Ugras BARAN <[EMAIL PROTECTED]> wrote:
By the way, I am starting to cleanup of get/set options/contents stuff
from Lyx code (excluding cite related files). However, tomorrow I am
going to holidays for a week. I will send you the patch as much as I
can finish. I can do the rest as I return back form holidays.
ugras
Index: src/insets/insetindex.C
===================================================================
--- src/insets/insetindex.C (revision 15365)
+++ src/insets/insetindex.C (working copy)
@@ -45,7 +45,7 @@
int InsetIndex::docbook(Buffer const &, ostream & os,
OutputParams const &) const
{
- os << "<indexterm><primary>" << sgml::escapeString(getContents())
+ os << "<indexterm><primary>" << sgml::escapeString(lyx::to_utf8(getParam("name")))
<< "</primary></indexterm>";
return 0;
}
Index: src/insets/insetbibtex.C
===================================================================
--- src/insets/insetbibtex.C (revision 15365)
+++ src/insets/insetbibtex.C (working copy)
@@ -153,7 +153,8 @@
typedef boost::tokenizer<Separator> Tokenizer;
Separator const separator(",");
- Tokenizer const tokens(getContents(), separator);
+ Tokenizer const tokens(lyx::to_utf8(
+ getParam("bibfiles")), separator);
Tokenizer::const_iterator const begin = tokens.begin();
Tokenizer::const_iterator const end = tokens.end();
@@ -200,7 +201,7 @@
}
// Style-Options
- string style = getOptions(); // maybe empty! and with bibtotoc
+ string style = lyx::to_utf8(getParam("options")); // maybe empty! and with bibtotoc
string bibtotoc;
if (prefixIs(style, "bibtotoc")) {
bibtotoc = "bibtotoc";
@@ -252,7 +253,7 @@
if (!db_out.empty() && buffer.params().use_bibtopic){
os << "\\begin{btSect}{" << db_out << "}\n";
- string btprint = getSecOptions();
+ string btprint = lyx::to_utf8(getParam("btprint"));
if (btprint.empty())
// default
btprint = "btPrintCited";
@@ -302,7 +303,7 @@
vector<string> vec;
string tmp;
- string bibfiles = getContents();
+ string bibfiles = lyx::to_utf8(getParam("bibfiles"));
bibfiles = split(bibfiles, tmp, ',');
while (!tmp.empty()) {
string file = findtexfile(changeExtension(tmp, "bib"), "bib");
@@ -359,11 +360,11 @@
bool InsetBibtex::addDatabase(string const & db)
{
- string contents(getContents());
+ string contents(lyx::to_utf8(getParam("bibfiles")));
if (tokenPos(contents, ',', db) == -1) {
if (!contents.empty())
contents += ',';
- setContents(contents + db);
+ setParam("bibfiles", lyx::from_utf8(contents + db));
return true;
}
return false;
@@ -372,17 +373,17 @@
bool InsetBibtex::delDatabase(string const & db)
{
- string contents(getContents());
+ string contents(lyx::to_utf8(getParam("bibfiles")));
if (contains(contents, db)) {
int const n = tokenPos(contents, ',', db);
string bd = db;
if (n > 0) {
// this is not the first database
string tmp = ',' + bd;
- setContents(subst(contents, tmp, ""));
+ setParam("bibfiles", lyx::from_utf8(subst(contents, tmp, "")));
} else if (n == 0)
// this is the first (or only) database
- setContents(split(contents, bd, ','));
+ setParam("bibfiles", lyx::from_utf8(split(contents, bd, ',')));
else
return false;
}
Index: src/insets/insetbibitem.C
===================================================================
--- src/insets/insetbibitem.C (revision 15365)
+++ src/insets/insetbibitem.C (working copy)
@@ -39,8 +39,8 @@
InsetBibitem::InsetBibitem(InsetCommandParams const & p)
: InsetCommand(p, "bibitem"), counter(1)
{
- if (getContents().empty())
- setContents(key_prefix + convert<string>(++key_counter));
+ if (getParam("key").empty())
+ setParam("key", lyx::from_utf8(key_prefix + convert<string>(++key_counter)));
}
@@ -63,9 +63,9 @@
cur.noUpdate();
break;
}
- if (p.getContents() != params().getContents())
- cur.bv().buffer()->changeRefsIfUnique(params().getContents(),
- p.getContents(), InsetBase::CITE_CODE);
+ if (p["key"] != params()["key"])
+ cur.bv().buffer()->changeRefsIfUnique(lyx::to_utf8(params()["key"]),
+ lyx::to_utf8(p["key"]), InsetBase::CITE_CODE);
setParams(p);
}
@@ -86,8 +86,8 @@
{
InsetCommand::read(buf, lex);
- if (prefixIs(getContents(), key_prefix)) {
- int const key = convert<int>(getContents().substr(key_prefix.length()));
+ if (prefixIs(lyx::to_utf8(getParam("key")), key_prefix)) {
+ int const key = convert<int>(lyx::to_utf8(getParam("key")).substr(key_prefix.length()));
key_counter = max(key_counter, key);
}
}
@@ -96,16 +96,16 @@
docstring const InsetBibitem::getBibLabel() const
{
// FIXME UNICODE
- return getOptions().empty() ?
+ return getParam("label").empty() ?
convert<docstring>(counter) :
- lyx::from_utf8(getOptions());
+ getParam("label");
}
docstring const InsetBibitem::getScreenLabel(Buffer const &) const
{
// FIXME UNICODE
- return lyx::from_utf8(getContents()) + " [" + getBibLabel() + ']';
+ return getParam("key") + " [" + getBibLabel() + ']';
}
Index: src/insets/insetlabel.C
===================================================================
--- src/insets/insetlabel.C (revision 15365)
+++ src/insets/insetlabel.C (working copy)
@@ -48,14 +48,14 @@
void InsetLabel::getLabelList(Buffer const &, std::vector<docstring> & list) const
{
// FIXME UNICODE
- list.push_back(lyx::from_utf8(getContents()));
+ list.push_back(getParam("name"));
}
docstring const InsetLabel::getScreenLabel(Buffer const &) const
{
// FIXME UNICODE
- return lyx::from_utf8(getContents());
+ return getParam("name");
}
@@ -70,9 +70,9 @@
cur.noUpdate();
break;
}
- if (p.getContents() != params().getContents())
- cur.bv().buffer()->changeRefsIfUnique(params().getContents(),
- p.getContents(), InsetBase::REF_CODE);
+ if (p["name"] != params()["name"])
+ cur.bv().buffer()->changeRefsIfUnique(lyx::to_utf8(params()["name"]),
+ lyx::to_utf8(p["name"]), InsetBase::REF_CODE);
setParams(p);
break;
}
@@ -96,7 +96,7 @@
OutputParams const &) const
{
// FIXME UNICODE
- os << '<' << lyx::from_utf8(getContents()) << '>';
+ os << '<' << getParam("name") << '>';
return 0;
}
@@ -104,6 +104,6 @@
int InsetLabel::docbook(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
- os << "<!-- anchor id=\"" << sgml::cleanID(buf, runparams, getContents()) << "\" -->";
+ os << "<!-- anchor id=\"" << sgml::cleanID(buf, runparams, lyx::to_utf8(getParam("name"))) << "\" -->";
return 0;
}
Index: src/insets/insethfill.C
===================================================================
--- src/insets/insethfill.C (revision 15365)
+++ src/insets/insethfill.C (working copy)
@@ -41,7 +41,7 @@
docstring const InsetHFill::getScreenLabel(Buffer const &) const
{
- return lyx::from_ascii(getContents());
+ return getParam("");
}
Index: src/insets/inseturl.C
===================================================================
--- src/insets/inseturl.C (revision 15365)
+++ src/insets/inseturl.C (working copy)
@@ -39,12 +39,13 @@
docstring const temp =
(getCmdName() == "url") ? _("Url: ") : _("HtmlUrl: ");
+ //TODO docstring
string url;
- if (!getOptions().empty())
- url += getOptions();
+ if (!getParam("name").empty())
+ url += lyx::to_utf8(getParam("name"));
else
- url += getContents();
+ url += lyx::to_utf8(getParam("target"));
// elide if long
if (url.length() > 30) {
@@ -59,11 +60,11 @@
int InsetUrl::latex(Buffer const &, ostream & os,
OutputParams const & runparams) const
{
- if (!getOptions().empty())
- os << getOptions() + ' ';
+ if (!getParam("name").empty())
+ os << lyx::to_utf8(getParam("name")) + ' ';
if (runparams.moving_arg)
os << "\\protect";
- os << "\\url{" << getContents() << '}';
+ os << "\\url{" << lyx::to_utf8(getParam("target")) << '}';
return 0;
}
@@ -72,12 +73,12 @@
OutputParams const &) const
{
// FIXME UNICODE
- os << '[' << lyx::from_utf8(getContents());
- if (getOptions().empty())
+ os << '[' << getParam("target");
+ if (getParam("name").empty())
os << ']';
else
// FIXME UNICODE
- os << "||" << lyx::from_utf8(getOptions()) << ']';
+ os << "||" << getParam("name") << ']';
return 0;
}
@@ -85,8 +86,8 @@
int InsetUrl::docbook(Buffer const &, ostream & os,
OutputParams const &) const
{
- os << "<ulink url=\"" << subst(getContents(),"&","&")
- << "\">" << getOptions() << "</ulink>";
+ os << "<ulink url=\"" << subst(lyx::to_utf8(getParam("target")),"&","&")
+ << "\">" << lyx::to_utf8(getParam("name")) << "</ulink>";
return 0;
}
Index: src/insets/insetref.C
===================================================================
--- src/insets/insetref.C (revision 15365)
+++ src/insets/insetref.C (working copy)
@@ -47,7 +47,7 @@
case LFUN_MOUSE_PRESS:
// Eventually trigger dialog with button 3 not 1
if (cmd.button() == mouse_button::button3)
- lyx::dispatch(FuncRequest(LFUN_LABEL_GOTO, getContents()));
+ lyx::dispatch(FuncRequest(LFUN_LABEL_GOTO, getParam("reference")));
else {
InsetCommandMailer("ref", *this).showDialog(&cur.bv());
cur.undispatched();
@@ -73,12 +73,12 @@
}
}
// FIXME UNICODE
- temp += lyx::from_utf8(getContents());
+ temp += getParam("reference");
- if (!isLatex && !getOptions().empty()) {
+ if (!isLatex && !getParam("name").empty()) {
temp += "||";
// FIXME UNICODE
- temp += lyx::from_utf8(getOptions());
+ temp += getParam("name");
}
return temp;
}
@@ -99,7 +99,7 @@
OutputParams const &) const
{
// FIXME UNICODE
- os << '[' << lyx::from_utf8(getContents()) << ']';
+ os << '[' << getParam("reference") << ']';
return 0;
}
@@ -107,13 +107,13 @@
int InsetRef::docbook(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
- if (getOptions().empty() && runparams.flavor == OutputParams::XML) {
- os << "<xref linkend=\"" << sgml::cleanID(buf, runparams, getContents()) << "\" />";
- } else if (getOptions().empty()) {
- os << "<xref linkend=\"" << sgml::cleanID(buf, runparams, getContents()) << "\">";
+ if (getParam("name").empty() && runparams.flavor == OutputParams::XML) {
+ os << "<xref linkend=\"" << sgml::cleanID(buf, runparams, lyx::to_utf8(getParam("reference"))) << "\" />";
+ } else if (getParam("name").empty()) {
+ os << "<xref linkend=\"" << sgml::cleanID(buf, runparams, lyx::to_utf8(getParam("reference"))) << "\">";
} else {
- os << "<link linkend=\"" << sgml::cleanID(buf, runparams, getContents())
- << "\">" << getOptions() << "</link>";
+ os << "<link linkend=\"" << sgml::cleanID(buf, runparams, lyx::to_utf8(getParam("reference")))
+ << "\">" << lyx::to_utf8(getParam("name")) << "</link>";
}
return 0;
Index: src/insets/insetinclude.C
===================================================================
--- src/insets/insetinclude.C (revision 15365)
+++ src/insets/insetinclude.C (working copy)
@@ -221,7 +221,7 @@
string const includedFilename(Buffer const & buffer,
InsetCommandParams const & params)
{
- return makeAbsPath(params.getContents(),
+ return makeAbsPath(lyx::to_utf8(params["filename"]),
onlyPath(parentFilename(buffer)));
}
@@ -296,11 +296,11 @@
temp += ": ";
- if (params_.getContents().empty())
+ if (params_["filename"].empty())
temp += "???";
else
// FIXME: We don't know the encoding of the filename
- temp += lyx::from_ascii(onlyFilename(params_.getContents()));
+ temp += lyx::from_ascii(onlyFilename(lyx::to_utf8(params_["filename"])));
return temp;
}
@@ -353,7 +353,7 @@
int InsetInclude::latex(Buffer const & buffer, ostream & os,
OutputParams const & runparams) const
{
- string incfile(params_.getContents());
+ string incfile(lyx::to_utf8(params_["filename"]));
// Do nothing if no file name has been specified
if (incfile.empty())
@@ -486,7 +486,7 @@
int InsetInclude::docbook(Buffer const & buffer, ostream & os,
OutputParams const & runparams) const
{
- string incfile(params_.getContents());
+ string incfile(lyx::to_utf8(params_["filename"]));
// Do nothing if no file name has been specified
if (incfile.empty())
@@ -532,7 +532,7 @@
void InsetInclude::validate(LaTeXFeatures & features) const
{
- string incfile(params_.getContents());
+ string incfile(lyx::to_utf8(params_["filename"]));
string writefile;
Buffer const & buffer = features.buffer();
Index: src/mathed/InsetMathHull.C
===================================================================
--- src/mathed/InsetMathHull.C (revision 15365)
+++ src/mathed/InsetMathHull.C (working copy)
@@ -55,6 +55,7 @@
#include "support/lyxlib.h"
#include "support/lstrings.h"
+#include "support/docstring.h"
#include <boost/bind.hpp>
@@ -1114,17 +1115,17 @@
if (name == "label") {
InsetCommandParams p("label");
InsetCommandMailer::string2params(name, lyx::to_utf8(cmd.argument()), p);
- string str = p.getContents();
+ docstring str = p["name"];
recordUndoInset(cur);
row_type const r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
str = lyx::support::trim(str);
if (!str.empty())
numbered(r, true);
- string old = label(r);
+ docstring old = lyx::from_utf8(label(r));
if (str != old) {
- cur.bv().buffer()->changeRefsIfUnique(old, str,
+ cur.bv().buffer()->changeRefsIfUnique(lyx::to_utf8(old), lyx::to_utf8(str),
InsetBase::REF_CODE);
- label(r, str);
+ label(r, lyx::to_utf8(str));
}
break;
}
Index: src/factory.C
===================================================================
--- src/factory.C (revision 15365)
+++ src/factory.C (working copy)
@@ -165,7 +165,7 @@
string const contents = cmd.argument().empty() ?
bv->getLyXText()->getStringToIndex(bv->cursor()) :
lyx::to_utf8(cmd.argument());
- icp.setContents(contents);
+ icp["name"] = lyx::from_utf8(contents);
return new InsetIndex(icp);
}
@@ -380,8 +380,8 @@
|| cmdName == "vref"
|| cmdName == "vpageref"
|| cmdName == "prettyref") {
- if (!inscmd.getOptions().empty()
- || !inscmd.getContents().empty()) {
+ if (!inscmd["name"].empty()
+ || !inscmd["reference"].empty()) {
inset.reset(new InsetRef(inscmd, buf));
}
} else if (cmdName == "tableofcontents") {
Index: src/frontends/gtk/GBibItem.C
===================================================================
--- src/frontends/gtk/GBibItem.C (revision 15365)
+++ src/frontends/gtk/GBibItem.C (working copy)
@@ -62,15 +62,17 @@
{
bc().refreshReadOnly();
- keyentry_->set_text (controller().params().getContents());
- labelentry_->set_text (controller().params().getOptions());
+ keyentry_->set_text (lyx::to_utf8(controller().params()["key"]));
+ labelentry_->set_text (lyx::to_utf8(controller().params()["label"]));
}
void GBibItem::apply()
{
- controller().params().setContents(keyentry_->get_text());
- controller().params().setOptions(labelentry_->get_text());
+ controller().params()["key"] = lyx::from_utf8(
+ Glib::locale_to_utf8(keyentry_->get_text()));
+ controller().params()["label"] = lyx::from_utf8(
+ Glib::locale_to_utf8(labelentry_->get_text()));
}
void GBibItem::changed()
Index: src/frontends/gtk/GBibtex.C
===================================================================
--- src/frontends/gtk/GBibtex.C (revision 15365)
+++ src/frontends/gtk/GBibtex.C (working copy)
@@ -95,7 +95,7 @@
void GBibtex::update()
{
- string bibs(controller().params().getContents());
+ string bibs(lyx::to_utf8(controller().params()["bibfiles"]));
string bib;
databasesstore_->clear();
@@ -118,7 +118,7 @@
toccheck_->set_sensitive(!bibtopic);
- string btprint(controller().params().getSecOptions());
+ string btprint(lyx::to_utf8(controller().params()["btprint"]));
int btp = 0;
if (btprint == "btPrintNotCited")
btp = 1;
@@ -169,7 +169,8 @@
dblist += ",";
}
- controller().params().setContents(dblist);
+ controller().params()["bibfiles"] = lyx::from_utf8(
+ Glib::locale_to_utf8(dblist));
string const bibstyle = stylecombo_.get_active_text();
bool const bibtotoc = toccheck_->get_active();
@@ -177,15 +178,18 @@
if (!bibtopic && bibtotoc && (!bibstyle.empty())) {
// both bibtotoc and style
- controller().params().setOptions("bibtotoc," + bibstyle);
+ controller().params()["options"] = lyx::from_utf8(
+ Glib::locale_to_utf8("bibtotoc," + bibstyle));
} else if (!bibtopic && bibtotoc) {
// bibtotoc and no style
- controller().params().setOptions("bibtotoc");
+ controller().params()["options"] = lyx::from_utf8(
+ Glib::locale_to_utf8("bibtotoc"));
} else {
// only style. An empty one is valid, because some
// documentclasses have an own \bibliographystyle{}
// command!
- controller().params().setOptions(bibstyle);
+ controller().params()["options"] = lyx::from_utf8(
+ Glib::locale_to_utf8(bibstyle));
}
// bibtopic allows three kinds of sections:
@@ -196,18 +200,25 @@
switch (btp) {
case 0:
- controller().params().setSecOptions("btPrintCited");
+ controller().params()["btprint"] = lyx::from_utf8(
+ Glib::locale_to_utf8("btPrintCited"));
break;
case 1:
- controller().params().setSecOptions("btPrintNotCited");
+
+ controller().params()["btprint"] = lyx::from_utf8(
+ Glib::locale_to_utf8("btPrintNotCited"));
break;
case 2:
- controller().params().setSecOptions("btPrintAll");
+
+ controller().params()["btprint"] = lyx::from_utf8(
+ Glib::locale_to_utf8("btPrintAll"));
break;
}
if (!bibtopic)
- controller().params().setSecOptions("");
+
+ controller().params()["btprint"] = lyx::from_utf8(
+ Glib::locale_to_utf8(""));
}
Index: src/frontends/gtk/GInclude.C
===================================================================
--- src/frontends/gtk/GInclude.C (revision 15365)
+++ src/frontends/gtk/GInclude.C (working copy)
@@ -72,7 +72,7 @@
void GInclude::update()
{
- string const filename = controller().params().getContents();
+ string const filename = lyx::to_utf8(controller().params()["filename"]);
fileentry_->set_text(filename);
string const cmdname = controller().params().getCmdName();
@@ -113,7 +113,8 @@
InsetCommandParams params = controller().params();
params.preview(previewcheck_->get_active());
- params.setContents(fileentry_->get_text());
+ params["filename"] =
+ lyx::from_utf8(Glib::locale_from_utf8(fileentry_->get_text()));
if (includeradio_->get_active())
params.setCmdName("include");
Index: src/frontends/gtk/GRef.C
===================================================================
--- src/frontends/gtk/GRef.C (revision 15365)
+++ src/frontends/gtk/GRef.C (working copy)
@@ -168,8 +168,10 @@
bc().refreshReadOnly();
jumptobutton_->set_sensitive(true);
backbutton_->set_sensitive(false);
- labelentry_->set_text(controller().params().getContents());
- nameentry_->set_text(controller().params().getOptions());
+ labelentry_->set_text(lyx::to_utf8(
+ controller().params()["reference"]));
+ nameentry_->set_text(lyx::to_utf8(
+ controller().params()["name"]));
// Name is irrelevant to LaTeX/Literate documents
Kernel::DocType doctype = kernel().docType();
@@ -240,8 +242,10 @@
if (applylock_)
return;
- controller().params().setContents(labelentry_->get_text());
- controller().params().setOptions(nameentry_->get_text());
+ controller().params()["reference"] = lyx::from_utf8(
+ Glib::locale_to_utf8(labelentry_->get_text()));
+ controller().params()["name"] = lyx::from_utf8(
+ Glib::locale_to_utf8(nameentry_->get_text()));
int const type = formatcombo_->get_active_row_number();
controller().params().setCmdName(InsetRef::getName(type));
}
Index: src/frontends/gtk/GUrl.C
===================================================================
--- src/frontends/gtk/GUrl.C (revision 15365)
+++ src/frontends/gtk/GUrl.C (working copy)
@@ -77,10 +77,10 @@
void GUrl::update()
{
- url_->set_text(Glib::locale_to_utf8(
- controller().params().getContents()));
- name_->set_text(Glib::locale_to_utf8(
- controller().params().getOptions()));
+ url_->set_text(lyx::to_utf8(
+ controller().params()["target"]));
+ name_->set_text(lyx::to_utf8(
+ controller().params()["name"]));
if (controller().params().getCmdName() == "url")
htmlType_->set_active(false);
else
@@ -90,9 +90,9 @@
void GUrl::apply()
{
- controller().params().setContents(
+ controller().params()["target"] = lyx::from_utf8(
Glib::locale_to_utf8(url_->get_text()));
- controller().params().setOptions(
+ controller().params()["name"] = lyx::from_utf8(
Glib::locale_to_utf8(name_->get_text()));
if (htmlType_->get_active())
controller().params().setCmdName("htmlurl");
Index: src/frontends/gtk/GText.C
===================================================================
--- src/frontends/gtk/GText.C (revision 15365)
+++ src/frontends/gtk/GText.C (working copy)
@@ -44,14 +44,15 @@
void GText::apply()
{
- controller().params().setContents(entry_->get_text());
+ controller().params()["name"] = lyx::from_utf8(
+ Glib::locale_to_utf8(entry_->get_text()));
}
void GText::update()
{
string const contents = support::trim(
- controller().params().getContents());
+ lyx::to_utf8(controller().params()["name"]));
entry_->set_text(contents);
}
Index: src/frontends/qt3/QBibitem.C
===================================================================
--- src/frontends/qt3/QBibitem.C (revision 15365)
+++ src/frontends/qt3/QBibitem.C (working copy)
@@ -46,15 +46,17 @@
void QBibitem::update_contents()
{
- dialog_->keyED->setText(toqstr(controller().params().getContents()));
- dialog_->labelED->setText(toqstr(controller().params().getOptions()));
+ dialog_->keyED->setText(toqstr(controller().params()["key"]));
+ dialog_->labelED->setText(toqstr(controller().params()["label"]));
}
void QBibitem::apply()
{
- controller().params().setContents(fromqstr(dialog_->keyED->text()));
- controller().params().setOptions(fromqstr(dialog_->labelED->text()));
+ controller().params()["key"] =
+ lyx::from_utf8(fromqstr(dialog_->keyED->text()));
+ controller().params()["label"] =
+ lyx::from_utf8(fromqstr(dialog_->labelED->text()));
}
Index: src/frontends/qt3/QBibtex.C
===================================================================
--- src/frontends/qt3/QBibtex.C (revision 15365)
+++ src/frontends/qt3/QBibtex.C (working copy)
@@ -76,7 +76,7 @@
dialog_->databaseLB->clear();
- string bibs(controller().params().getContents());
+ string bibs(lyx::to_utf8(controller().params()["bibfiles"]));
string bib;
while (!bibs.empty()) {
@@ -99,7 +99,7 @@
dialog_->bibtocCB->setChecked(controller().bibtotoc() && !bibtopic);
dialog_->bibtocCB->setEnabled(!bibtopic);
- string btprint(controller().params().getSecOptions());
+ string bibs(lyx::to_utf8(controller().params()["bibfiles"]));
int btp = 0;
if (btprint == "btPrintNotCited")
btp = 1;
@@ -146,22 +146,22 @@
dbs += fromqstr(dialog_->databaseLB->text(i));
}
- controller().params().setContents(dbs);
+ controller().params()["bibfiles"] = lyx::from_utf8(dbs);
string const bibstyle(fromqstr(dialog_->styleCB->currentText()));
bool const bibtotoc(dialog_->bibtocCB->isChecked());
if (bibtotoc && (!bibstyle.empty())) {
// both bibtotoc and style
- controller().params().setOptions("bibtotoc," + bibstyle);
+ controller().params()["options"] = lyx::from_utf8("bibtotoc," + bibstyle);
} else if (bibtotoc) {
// bibtotoc and no style
- controller().params().setOptions("bibtotoc");
+ controller().params()["options"] = lyx::from_utf8("bibtotoc," );
} else {
// only style. An empty one is valid, because some
// documentclasses have an own \bibliographystyle{}
// command!
- controller().params().setOptions(bibstyle);
+ controller().params()["options"] = lyx::from_utf8(bibstyle);
}
// bibtopic allows three kinds of sections:
@@ -172,18 +172,18 @@
switch (btp) {
case 0:
- controller().params().setSecOptions("btPrintCited");
+ controller().params()["btprint"] = lyx::from_utf8("btPrintCited");
break;
case 1:
- controller().params().setSecOptions("btPrintNotCited");
+ controller().params()["btprint"]= lyx::from_utf8("btPrintNotCited");
break;
case 2:
- controller().params().setSecOptions("btPrintAll");
+ controller().params()["btprint"]= lyx::from_utf8("btPrintAll");
break;
}
if (!controller().usingBibtopic())
- controller().params().setSecOptions("");
+ controller().params()["btprint"]= lyx::from_utf8("");
}
Index: src/frontends/qt3/QURL.C
===================================================================
--- src/frontends/qt3/QURL.C (revision 15365)
+++ src/frontends/qt3/QURL.C (working copy)
@@ -51,8 +51,8 @@
{
InsetCommandParams const & params = controller().params();
- dialog_->urlED->setText(toqstr(params.getContents()));
- dialog_->nameED->setText(toqstr(params.getOptions()));
+ dialog_->urlED->setText(toqstr(params["target"]));
+ dialog_->nameED->setText(toqstr(params["name"]));
dialog_->hyperlinkCB->setChecked(params.getCmdName() != "url");
bc().valid(isValid());
@@ -63,8 +63,10 @@
{
InsetCommandParams & params = controller().params();
- params.setContents(fromqstr(dialog_->urlED->text()));
- params.setOptions(fromqstr(dialog_->nameED->text()));
+ params["target"] =
+ lyx::from_utf8(fromqstr(dialog_->urlED->text()));
+ params["name"] =
+ lyx::from_utf8(fromqstr(dialog_->nameED->text()));
if (dialog_->hyperlinkCB->isChecked())
params.setCmdName("htmlurl");
Index: src/frontends/qt3/QRef.C
===================================================================
--- src/frontends/qt3/QRef.C (revision 15365)
+++ src/frontends/qt3/QRef.C (working copy)
@@ -71,13 +71,13 @@
int orig_type = dialog_->typeCO->currentItem();
- dialog_->referenceED->setText(toqstr(params.getContents()));
+ dialog_->referenceED->setText(toqstr(params["reference"]));
- dialog_->nameED->setText(toqstr(params.getOptions()));
+ dialog_->nameED->setText(toqstr(params["name"]));
dialog_->nameED->setReadOnly(!nameAllowed() && !readOnly());
// restore type settings for new insets
- if (params.getContents().empty())
+ if (params["reference"].empty())
dialog_->typeCO->setCurrentItem(orig_type);
else
dialog_->typeCO->setCurrentItem(InsetRef::getType(params.getCmdName()));
@@ -95,7 +95,7 @@
dialog_->bufferCO->insertItem(toqstr(*it));
}
// restore the buffer combo setting for new insets
- if (params.getContents().empty() && restored_buffer_ != -1
+ if (params["reference"].empty() && restored_buffer_ != -1
&& restored_buffer_ < dialog_->bufferCO->count())
dialog_->bufferCO->setCurrentItem(restored_buffer_);
else
@@ -111,8 +111,10 @@
InsetCommandParams & params = controller().params();
params.setCmdName(InsetRef::getName(dialog_->typeCO->currentItem()));
- params.setContents(fromqstr(dialog_->referenceED->text()));
- params.setOptions(fromqstr(dialog_->nameED->text()));
+ params["reference"] =
+ lyx::from_utf8(fromqstr(dialog_->referenceED->text()));
+ params["name"] =
+ lyx::from_utf8(fromqstr(dialog_->nameED->text()));
restored_buffer_ = dialog_->bufferCO->currentItem();
}
Index: src/frontends/qt3/QInclude.C
===================================================================
--- src/frontends/qt3/QInclude.C (revision 15365)
+++ src/frontends/qt3/QInclude.C (working copy)
@@ -63,7 +63,7 @@
InsetCommandParams const & params = controller().params();
- dialog_->filenameED->setText(toqstr(params.getContents()));
+ dialog_->filenameED->setText(toqstr(params["filename"]));
dialog_->visiblespaceCB->setChecked(false);
dialog_->visiblespaceCB->setEnabled(false);
@@ -100,7 +100,8 @@
{
InsetCommandParams params = controller().params();
- params.setContents(fromqstr(dialog_->filenameED->text()));
+ params["filename"] =
+ lyx::from_utf8(fromqstr(dialog_->filenameED->text()));
params.preview(dialog_->previewCB->isChecked());
int const item = dialog_->typeCO->currentItem();
Index: src/frontends/qt3/QIndex.C
===================================================================
--- src/frontends/qt3/QIndex.C (revision 15365)
+++ src/frontends/qt3/QIndex.C (working copy)
@@ -50,7 +50,7 @@
void QIndex::update_contents()
{
- string const contents = controller().params().getContents();
+ docstring const contents = controller().params()["name"];
dialog_->keywordED->setText(toqstr(contents));
bc().valid(!contents.empty());
@@ -59,7 +59,8 @@
void QIndex::apply()
{
- controller().params().setContents(fromqstr(dialog_->keywordED->text()));
+ controller().params()["name"] =
+ lyx::from_utf8(fromqstr(dialog_->keywordED->text()));
}
Index: src/frontends/qt4/QBibitem.C
===================================================================
--- src/frontends/qt4/QBibitem.C (revision 15365)
+++ src/frontends/qt4/QBibitem.C (working copy)
@@ -46,15 +46,17 @@
void QBibitem::update_contents()
{
- dialog_->keyED->setText(toqstr(controller().params().getContents()));
- dialog_->labelED->setText(toqstr(controller().params().getOptions()));
+ dialog_->keyED->setText(toqstr(controller().params()["key"]));
+ dialog_->labelED->setText(toqstr(controller().params()["label"]));
}
void QBibitem::apply()
{
- controller().params().setContents(fromqstr(dialog_->keyED->text()));
- controller().params().setOptions(fromqstr(dialog_->labelED->text()));
+ controller().params()["key"] =
+ lyx::from_utf8(fromqstr(dialog_->keyED->text()));
+ controller().params()["label"] =
+ lyx::from_utf8(fromqstr(dialog_->labelED->text()));
}
Index: src/frontends/qt4/QBibtex.C
===================================================================
--- src/frontends/qt4/QBibtex.C (revision 15365)
+++ src/frontends/qt4/QBibtex.C (working copy)
@@ -75,7 +75,7 @@
dialog_->databaseLW->clear();
- string bibs(controller().params().getContents());
+ string bibs(lyx::to_utf8(controller().params()["bibfiles"]));
string bib;
while (!bibs.empty()) {
@@ -100,7 +100,7 @@
dialog_->bibtocCB->setChecked(controller().bibtotoc() && !bibtopic);
dialog_->bibtocCB->setEnabled(!bibtopic);
- string btprint(controller().params().getSecOptions());
+ string btprint(lyx::to_utf8(controller().params()["btprint"]));
int btp = 0;
if (btprint == "btPrintNotCited")
btp = 1;
@@ -146,22 +146,22 @@
dbs += fromqstr(dialog_->databaseLW->item(i)->text());
}
- controller().params().setContents(dbs);
+ controller().params()["bibfiles"] = lyx::from_utf8(dbs);
string const bibstyle(fromqstr(dialog_->styleCB->currentText()));
bool const bibtotoc(dialog_->bibtocCB->isChecked());
if (bibtotoc && (!bibstyle.empty())) {
// both bibtotoc and style
- controller().params().setOptions("bibtotoc," + bibstyle);
+ controller().params()["options"] = lyx::from_utf8("bibtotoc," + bibstyle);
} else if (bibtotoc) {
// bibtotoc and no style
- controller().params().setOptions("bibtotoc");
+ controller().params()["options"] = lyx::from_utf8("bibtotoc");
} else {
// only style. An empty one is valid, because some
// documentclasses have an own \bibliographystyle{}
// command!
- controller().params().setOptions(bibstyle);
+ controller().params()["options"] = lyx::from_utf8(bibstyle);
}
// bibtopic allows three kinds of sections:
@@ -172,18 +172,18 @@
switch (btp) {
case 0:
- controller().params().setSecOptions("btPrintCited");
+ controller().params()["btprint"]= lyx::from_utf8("btPrintCited");
break;
case 1:
- controller().params().setSecOptions("btPrintNotCited");
+ controller().params()["btprint"]= lyx::from_utf8("btPrintNotCited");
break;
case 2:
- controller().params().setSecOptions("btPrintAll");
+ controller().params()["btprint"]= lyx::from_utf8("btPrintAll");
break;
}
if (!controller().usingBibtopic())
- controller().params().setSecOptions("");
+ controller().params()["btprint"]= lyx::from_utf8("");
}
Index: src/frontends/qt4/QRef.C
===================================================================
--- src/frontends/qt4/QRef.C (revision 15365)
+++ src/frontends/qt4/QRef.C (working copy)
@@ -72,13 +72,13 @@
int orig_type = dialog_->typeCO->currentIndex();
- dialog_->referenceED->setText(toqstr(params.getContents()));
+ dialog_->referenceED->setText(toqstr(params["reference"]));
- dialog_->nameED->setText(toqstr(params.getOptions()));
+ dialog_->nameED->setText(toqstr(params["name"]));
dialog_->nameED->setReadOnly(!nameAllowed() && !readOnly());
// restore type settings for new insets
- if (params.getContents().empty())
+ if (params["reference"].empty())
dialog_->typeCO->setCurrentIndex(orig_type);
else
dialog_->typeCO->setCurrentIndex(InsetRef::getType(params.getCmdName()));
@@ -96,7 +96,7 @@
dialog_->bufferCO->addItem(toqstr(*it));
}
// restore the buffer combo setting for new insets
- if (params.getContents().empty() && restored_buffer_ != -1
+ if (params["reference"].empty() && restored_buffer_ != -1
&& restored_buffer_ < dialog_->bufferCO->count())
dialog_->bufferCO->setCurrentIndex(restored_buffer_);
else
@@ -112,8 +112,10 @@
InsetCommandParams & params = controller().params();
params.setCmdName(InsetRef::getName(dialog_->typeCO->currentIndex()));
- params.setContents(fromqstr(dialog_->referenceED->text()));
- params.setOptions(fromqstr(dialog_->nameED->text()));
+ params["reference"] =
+ lyx::from_utf8(fromqstr(dialog_->referenceED->text()));
+ params["name"] =
+ lyx::from_utf8(fromqstr(dialog_->nameED->text()));
restored_buffer_ = dialog_->bufferCO->currentIndex();
}
Index: src/frontends/qt4/UrlView.C
===================================================================
--- src/frontends/qt4/UrlView.C (revision 15365)
+++ src/frontends/qt4/UrlView.C (working copy)
@@ -51,8 +51,8 @@
{
InsetCommandParams const & params = controller().params();
- dialog_->urlED->setText(toqstr(params.getContents()));
- dialog_->nameED->setText(toqstr(params.getOptions()));
+ dialog_->urlED->setText(toqstr(params["target"]));
+ dialog_->nameED->setText(toqstr(params["name"]));
dialog_->hyperlinkCB->setChecked(params.getCmdName() != "url");
bc().valid(isValid());
@@ -63,8 +63,10 @@
{
InsetCommandParams & params = controller().params();
- params.setContents(fromqstr(dialog_->urlED->text()));
- params.setOptions(fromqstr(dialog_->nameED->text()));
+ params["target"] =
+ lyx::from_utf8(fromqstr(dialog_->urlED->text()));
+ params["name"] =
+ lyx::from_utf8(fromqstr(dialog_->nameED->text()));
if (dialog_->hyperlinkCB->isChecked())
params.setCmdName("htmlurl");
Index: src/frontends/qt4/QInclude.C
===================================================================
--- src/frontends/qt4/QInclude.C (revision 15365)
+++ src/frontends/qt4/QInclude.C (working copy)
@@ -62,7 +62,7 @@
InsetCommandParams const & params = controller().params();
- dialog_->filenameED->setText(toqstr(params.getContents()));
+ dialog_->filenameED->setText(toqstr(params["filename"]));
dialog_->visiblespaceCB->setChecked(false);
dialog_->visiblespaceCB->setEnabled(false);
@@ -99,7 +99,8 @@
{
InsetCommandParams params = controller().params();
- params.setContents(fromqstr(dialog_->filenameED->text()));
+ params["filename"] =
+ lyx::from_utf8(fromqstr(dialog_->filenameED->text()));
params.preview(dialog_->previewCB->isChecked());
int const item = dialog_->typeCO->currentIndex();
Index: src/frontends/qt4/QIndex.C
===================================================================
--- src/frontends/qt4/QIndex.C (revision 15365)
+++ src/frontends/qt4/QIndex.C (working copy)
@@ -50,7 +50,7 @@
void QIndex::update_contents()
{
- string const contents = controller().params().getContents();
+ docstring const contents = controller().params()["name"];
dialog_->keywordED->setText(toqstr(contents));
bc().valid(!contents.empty());
@@ -59,7 +59,8 @@
void QIndex::apply()
{
- controller().params().setContents(fromqstr(dialog_->keywordED->text()));
+ controller().params()["name"] =
+ lyx::from_utf8(fromqstr(dialog_->keywordED->text()));
}
Index: src/frontends/controllers/ControlBibtex.C
===================================================================
--- src/frontends/controllers/ControlBibtex.C (revision 15365)
+++ src/frontends/controllers/ControlBibtex.C (working copy)
@@ -125,7 +125,7 @@
bool ControlBibtex::bibtotoc() const
{
- return prefixIs(params().getOptions(), "bibtotoc");
+ return prefixIs(lyx::to_utf8(params()["options"]), "bibtotoc");
}
@@ -151,7 +151,7 @@
break;
}
- string bst = params().getOptions();
+ string bst = lyx::to_utf8(params()["btprint"]);
if (bibtotoc()){
// bibstyle exists?
if (contains(bst,',')) {
@@ -164,7 +164,7 @@
// propose default style file for new insets
// existing insets might have (legally) no bst files
// (if the class already provides a style)
- if (bst.empty() && params().getContents().empty())
+ if (bst.empty() && params()["bibfiles"].empty())
bst = defaultstyle;
return bst;
Index: src/BufferView.C
===================================================================
--- src/BufferView.C (revision 15365)
+++ src/BufferView.C (working copy)
@@ -772,7 +772,7 @@
getInsetByCode<InsetRef>(cursor_,
InsetBase::REF_CODE);
if (inset) {
- label = lyx::from_utf8(inset->getContents());
+ label = inset->getParam("reference");
savePosition(0);
}
}