LyX file-format changes
-----------------------
+2004-02-23 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * format incremented to 230.
+ * Support for a second optional argument in insetcommand.
+ currently, citation uses this to support natbibs second
+ optional argument \cite[before][after]{key}.
+ I think there's nothing to convert upwards. Downwards, the
+ commands need to be converted to ERT I suppose.
+
2003-12-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* format incremented to 229.
+2004-02-25 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * lyx2lyx: up the format to 230.
+
2004-02-04 José Matos <jamatos@lyx.org>
* lyxconvert_210.py: add two new transforms:
remove_empty_insets and remove_formula_latex
format = re.compile(r"(\d)[\.,]?(\d\d)")
fileformat = re.compile(r"\\lyxformat\s*(\S*)")
-lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225, 226, 227, 228, 229]
+lst_ft = [210, 215, 216, 217, 218, 220, 221, 223, 224, 225, 226, 227, 228, 229, 230]
def usage():
print """Usage: lyx2lyx [options] [file]
--- /dev/null
+# This file is part of lyx2lyx
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2003 José Matos <jamatos@fep.up.pt>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+
+import sys
+from parser_tools import find_token
+
+
+def convert(header, body):
+ pass
+
+if __name__ == "__main__":
+ pass
--- /dev/null
+# This file is part of lyx2lyx
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2003 José Matos <jamatos@fep.up.pt>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+
+import sys
+from parser_tools import find_token
+
+
+def convert(header, body):
+ pass
+
+if __name__ == "__main__":
+ pass
src/paragraph_funcs.C
src/rowpainter.C
src/support/globbing.C
+src/support/path_defines.C
+src/tex2lyx/lengthcommon.C
src/text.C
src/text2.C
src/text3.C
+2004-03-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * buffer.C: increment file format to 230.
+
2004-03-04 Alfredo Braunstein <abraunst@lyx.org>
* cursor.C (dispatch): avoid infinite loops
namespace {
-const int LYX_FORMAT = 229;
+const int LYX_FORMAT = 230;
} // namespace anon
2004-03-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+ * QCitation.C:
+ * ui/QCitationDialogBase.ui: Support second \cite option.
+
* QDocumentDialog.C (branches): Don't deselect branch
after button press.
* QBranch.C: fix off-by-one-error.
controller().params().setCmdName(command);
controller().params().setContents(getStringFromVector(citekeys));
+ string const before = fromqstr(dialog_->textBeforeED->text());
+ controller().params().setSecOptions(before);
+
string const after = fromqstr(dialog_->textAfterED->text());
controller().params().setOptions(after);
bcview().addReadOnly(dialog_->citationStyleCO);
bcview().addReadOnly(dialog_->forceuppercaseCB);
bcview().addReadOnly(dialog_->fulllistCB);
- // add when enabled !
- //bcview().addReadOnly(dialog_->textBeforeED);
+ bcview().addReadOnly(dialog_->textBeforeED);
bcview().addReadOnly(dialog_->textAfterED);
open_find_ = true;
dialog_->fulllistCB->setEnabled(natbib);
dialog_->forceuppercaseCB->setEnabled(natbib);
+ dialog_->textBeforeED->setEnabled(natbib);
string const & command = controller().params().getCmdName();
dialog_->infoML->clear();
dialog_->setButtons();
- dialog_->textAfterED->setText(toqstr(controller().params().getOptions()));
+ dialog_->textBeforeED->setText(
+ toqstr(controller().params().getSecOptions()));
+ dialog_->textAfterED->setText(
+ toqstr(controller().params().getOptions()));
fillStyles();
updateStyle();
<rect>
<x>0</x>
<y>0</y>
- <width>404</width>
- <height>287</height>
+ <width>400</width>
+ <height>310</height>
</rect>
</property>
<property stdset="1">
<string>Citation entry</string>
</property>
</widget>
- <widget row="1" column="1" >
- <class>QGroupBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>GroupBox8</cstring>
- </property>
- <property stdset="1">
- <name>title</name>
- <string>Style</string>
- </property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>11</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <widget row="0" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>citationStyleLA</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Citation &style:</string>
- </property>
- <property>
- <name>buddy</name>
- <cstring>citationStyleCO</cstring>
- </property>
- </widget>
- <widget row="1" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>textAfterED</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- <property>
- <name>toolTip</name>
- <string>Text to place after citation</string>
- </property>
- </widget>
- <widget row="2" column="0" rowspan="1" colspan="2" >
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>fulllistCB</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>&Full author list</string>
- </property>
- <property>
- <name>toolTip</name>
- <string>List all authors</string>
- </property>
- </widget>
- <widget row="0" column="1" >
- <class>QComboBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>citationStyleCO</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>3</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- <property>
- <name>toolTip</name>
- <string>Natbib citation style to use</string>
- </property>
- </widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>textAfterLA</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>&Text after:</string>
- </property>
- <property>
- <name>buddy</name>
- <cstring>textAfterED</cstring>
- </property>
- </widget>
- <widget row="3" column="0" rowspan="1" colspan="2" >
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>forceuppercaseCB</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Force &upper case</string>
- </property>
- <property>
- <name>toolTip</name>
- <string>Force upper case in citation</string>
- </property>
- </widget>
- </grid>
- </widget>
<widget row="0" column="0" rowspan="2" colspan="1" >
<class>QLayoutWidget</class>
<property stdset="1">
</widget>
</hbox>
</widget>
+ <widget row="1" column="1" >
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox8</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Style</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>citationStyleLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Citation &style:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>citationStyleCO</cstring>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QComboBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>citationStyleCO</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Natbib citation style to use</string>
+ </property>
+ </widget>
+ <widget row="4" column="0" rowspan="1" colspan="2" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>forceuppercaseCB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Force &upper case</string>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Force upper case in citation</string>
+ </property>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>textAfterLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Text after:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>textAfterED</cstring>
+ </property>
+ </widget>
+ <widget row="2" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>textAfterED</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Text to place after citation</string>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>textBeforeED</cstring>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Text to place after citation</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>textBeforeLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Text &before:</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>textAfterED</cstring>
+ </property>
+ </widget>
+ <widget row="3" column="0" rowspan="1" colspan="2" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>fulllistCB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Full author list</string>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>List all authors</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
</grid>
</widget>
<images>
<receiver>QCitationDialogBase</receiver>
<slot>changed_adaptor()</slot>
</connection>
+ <connection>
+ <sender>textBeforeED</sender>
+ <signal>textChanged(const QString&)</signal>
+ <receiver>QCitationDialogBase</receiver>
+ <slot>changed_adaptor()</slot>
+ </connection>
<connection>
<sender>textAfterED</sender>
<signal>textChanged(const QString&)</signal>
<tabstop>addPB</tabstop>
<tabstop>deletePB</tabstop>
<tabstop>citationStyleCO</tabstop>
+ <tabstop>textBeforeED</tabstop>
<tabstop>textAfterED</tabstop>
<tabstop>fulllistCB</tabstop>
<tabstop>forceuppercaseCB</tabstop>
+2004-03-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * FormCitation.C: Support second \cite option.
+
2004-03-05 Martin Vermeer <martin.vermeer@hut.fi>
* FormDocument.C: fix user interface to branch activation
controller().params().setCmdName(command);
controller().params().setContents(getStringFromVector(citekeys));
+ string const before = getString(dialog_->input_before);
+ controller().params().setSecOptions(before);
+
string const after = getString(dialog_->input_after);
controller().params().setOptions(after);
}
setEnabled(dialog_->check_full_author_list, natbib);
setEnabled(dialog_->check_force_uppercase, natbib);
setEnabled(dialog_->choice_style, natbib);
+ setEnabled(dialog_->input_before, natbib);
// No keys have been selected yet, so...
fl_clear_browser(dialog_->browser_info);
setCiteButtons(OFF);
// Natbib can have comments before and after the citation.
- // This is not yet supported. After only.
fl_set_input(dialog_->input_after,
controller().params().getOptions().c_str());
- fl_set_input(dialog_->input_before, _("Not yet supported").c_str());
- setEnabled(dialog_->input_before, false);
+ fl_set_input(dialog_->input_before,
+ controller().params().getSecOptions().c_str());
}
+2004-03-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * insetcite.C: Support second \cite option.
+
+ * insetcommand.[Ch]:
+ * insetcommandparams.[Ch]: add second optional argument.
+
2004-03-03 Alfredo Braunstein <abraunst@lyx.org>
* insetcollapsable.C (lfunMouseRelease): right mouse button only
string const InsetCitation::generateLabel(Buffer const & buffer) const
{
- string const before = string();
+ string const before = getSecOptions();
string const after = getOptions();
string label;
return cache.screen_label;
// The label has changed, so we have to re-create it.
- string const before = string();
+ string const before = getSecOptions();
string const after = getOptions();
string const glabel = generateLabel(buffer);
else
os << "cite";
-#warning What is this code supposed to do? (Lgb)
-// my guess is that this is just waiting for when we support before,
-// so it's a oneliner. But this is very silly ! - jbl
-
-#if 1
- // The current strange code
-
- string const before = string();
+ string const before = getSecOptions();
string const after = getOptions();
if (!before.empty() && buffer.params().use_natbib)
os << '[' << before << "][" << after << ']';
else if (!after.empty())
os << '[' << after << ']';
-#else
- // and the cleaned up equvalent, should it just be changed? (Lgb)
- string const after = getOptions();
- if (!after.empty())
- os << '[' << after << ']';
-#endif
+
string::const_iterator it = getContents().begin();
string::const_iterator end = getContents().end();
// Paranoia check: make sure that there is no whitespace in here
InsetCommand::InsetCommand(InsetCommandParams const & p,
string const & mailer_name)
- : p_(p.getCmdName(), p.getContents(), p.getOptions()),
+ : p_(p.getCmdName(), p.getContents(), p.getOptions(), p.getSecOptions()),
mailer_name_(mailer_name),
set_label_(false)
{}
///
std::string const & getOptions() const { return p_.getOptions(); }
///
+ std::string const & getSecOptions() const { return p_.getSecOptions(); }
+ ///
RenderButton & button() const { return button_; }
protected:
///
void setOptions(std::string const & o) { p_.setOptions(o); }
///
+ void setSecOptions(std::string const & s) { p_.setSecOptions(s); }
+ ///
void setParams(InsetCommandParams const &);
/// This should provide the text for the button
virtual std::string const getScreenLabel(Buffer const &) const = 0;
InsetCommandParams::InsetCommandParams(string const & n,
string const & c,
- string const & o)
- : cmdname(n), contents(c), options(o), preview_(false)
+ string const & o,
+ string const & s)
+ : cmdname(n), contents(c), options(o), sec_options(s),
+ preview_(false)
{}
void InsetCommandParams::scanCommand(string const & cmd)
{
- string tcmdname, toptions, tcontents;
+ string tcmdname, toptions, tsecoptions, tcontents;
if (cmd.empty()) return;
-
- enum { WS, CMDNAME, OPTION, CONTENT } state = WS;
+
+ enum { WS, CMDNAME, OPTION, SECOPTION, CONTENT } state = WS;
// Used to handle things like \command[foo[bar]]{foo{bar}}
int nestdepth = 0;
for (string::size_type i = 0; i < cmd.length(); ++i) {
char c = cmd[i];
+ char b = cmd[i-1];
if ((state == CMDNAME && c == ' ') ||
(state == CMDNAME && c == '[') ||
(state == CMDNAME && c == '{')) {
state = WS;
}
if ((state == OPTION && c == ']') ||
+ (state == SECOPTION && c == ']') ||
(state == CONTENT && c == '}')) {
if (nestdepth == 0) {
state = WS;
}
}
if ((state == OPTION && c == '[') ||
+ (state == SECOPTION && c == '[') ||
(state == CONTENT && c == '{')) {
++nestdepth;
}
switch (state) {
case CMDNAME: tcmdname += c; break;
case OPTION: toptions += c; break;
+ case SECOPTION: tsecoptions += c; break;
case CONTENT: tcontents += c; break;
case WS:
if (c == '\\') {
state = CMDNAME;
- } else if (c == '[') {
+ } else if (c == '[' && b != ']') {
state = OPTION;
nestdepth = 0; // Just to be sure
+ } else if (c == '[' && b == ']') {
+ state = SECOPTION;
+ nestdepth = 0; // Just to be sure
} else if (c == '{') {
state = CONTENT;
nestdepth = 0; // Just to be sure
// Don't mess with this.
if (!tcmdname.empty()) setCmdName(tcmdname);
if (!toptions.empty()) setOptions(toptions);
+ if (!tsecoptions.empty()) setSecOptions(tsecoptions);
if (!tcontents.empty()) setContents(tcontents);
if (lyxerr.debugging(Debug::PARSER))
<< "> == <" << getCommand()
<< "> == <" << getCmdName()
<< '|' << getContents()
- << '|' << getOptions() << '>' << endl;
+ << '|' << getOptions()
+ << '|' << getSecOptions() << '>' << endl;
}
string s;
if (!getCmdName().empty()) s += '\\' + getCmdName();
if (!getOptions().empty()) s += '[' + getOptions() + ']';
+ if (!getSecOptions().empty()) {
+ // for cases like \command[][sec_option]{arg}
+ if (getOptions().empty()) s += "[]";
+ s += '[' + getSecOptions() + ']';
+ }
s += '{' + getContents() + '}';
return s;
}
return o1.getCmdName() == o2.getCmdName()
&& o1.getContents() == o2.getContents()
&& o1.getOptions() == o2.getOptions()
+ && o1.getSecOptions() == o2.getSecOptions()
&& o1.preview() == o2.preview();
}
///
explicit InsetCommandParams(std::string const & n,
std::string const & c = std::string(),
- std::string const & o = std::string());
+ std::string const & o = std::string(),
+ std::string const & s = std::string());
///
void read(LyXLex &);
/// Parse the command
///
std::string const & getOptions() const { return options; }
///
+ std::string const & getSecOptions() const { return sec_options; }
+ ///
std::string const & getContents() const { return contents; }
///
void setCmdName(std::string const & n) { cmdname = n; }
///
void setOptions(std::string const & o) { options = o; }
///
+ void setSecOptions(std::string const & s) { sec_options = s; }
+ ///
void setContents(std::string const & c) { contents = c; }
///
bool preview() const { return preview_; }
///
std::string options;
///
+ std::string sec_options;
+ ///
bool preview_;
};