build fixes, fixes to thesaurus and bibtex.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2598 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2001-08-27 20:41:45 +00:00
parent af9ab9d8b6
commit dc575158c6
11 changed files with 234 additions and 172 deletions

View File

@ -43,6 +43,8 @@ void QBibtex::build_dialog()
bc().addReadOnly(dialog_->styleED);
bc().addReadOnly(dialog_->stylePB);
bc().addReadOnly(dialog_->bibtocCB);
bc().addReadOnly(dialog_->databasePB);
bc().addReadOnly(dialog_->deletePB);
}
@ -55,7 +57,9 @@ void QBibtex::update_contents()
while (!bibs.empty()) {
bibs = split(bibs, bib, ',');
dialog_->databaseLB->inSort(frontStrip(strip(bib)).c_str());
bib = frontStrip(strip(bib));
if (!bib.empty())
dialog_->databaseLB->inSort(bib.c_str());
}
string bibtotoc = "bibtotoc";
@ -73,10 +77,11 @@ void QBibtex::update_contents()
} else
dialog_->bibtocCB->setChecked(false);
dialog_->deletePB->setEnabled(false);
dialog_->styleED->setEnabled(false);
dialog_->stylePB->setEnabled(false);
if (bibstyle == "plain")
if (bibstyle == "plain" || bibstyle.empty())
dialog_->styleCO->setCurrentItem(0);
else if (bibstyle == "unsrt")
dialog_->styleCO->setCurrentItem(1);
@ -88,11 +93,9 @@ void QBibtex::update_contents()
dialog_->styleED->setEnabled(true);
dialog_->stylePB->setEnabled(true);
dialog_->styleED->setText(bibstyle.c_str());
if (bibstyle.empty())
dialog_->styleCO->setCurrentItem(0);
else
dialog_->styleCO->setCurrentItem(4);
dialog_->styleCO->setCurrentItem(4);
}
}
@ -103,7 +106,7 @@ void QBibtex::apply()
for (unsigned int i = 0; i < dialog_->databaseLB->count(); ++i) {
dbs += dialog_->databaseLB->text(i).latin1();
if (i != dialog_->databaseLB->count())
dbs += ", ";
dbs += ",";
}
controller().params().setContents(dbs);
@ -128,5 +131,6 @@ void QBibtex::apply()
bool QBibtex::isValid()
{
return dialog_->databaseLB->count() != 0;
return dialog_->databaseLB->count() != 0 &&
!(dialog_->styleCO->currentItem() == 4 && string(dialog_->styleED->text()).empty());
}

View File

@ -43,9 +43,7 @@ void QBibtexDialog::browsePressed()
{
QString file = QFileDialog::getOpenFileName(QString::null,
_("BibTeX style files (*.bst)"), this, 0, _("Select a BibTeX style"));
lyxerr << "HELLO" << std::endl;
if (!file.isNull()) {
lyxerr << "MONKEYS" << std::endl;
styleED->setText(ChangeExtension(OnlyFilename(file.latin1()), "").c_str());
form_->changed();
}
@ -54,19 +52,28 @@ void QBibtexDialog::browsePressed()
void QBibtexDialog::addPressed()
{
string file(QFileDialog::getOpenFileName(QString::null,
_("BibTeX database files (*.bib)"), this, 0, _("Select a BibTeX database to add")).latin1());
if (!file.empty()) {
QString file = QFileDialog::getOpenFileName(QString::null,
_("BibTeX database files (*.bib)"), this, 0, _("Select a BibTeX database to add"));
if (!file.isNull()) {
// FIXME: check duplicates
databaseLB->insertItem(ChangeExtension(file, "").c_str());
databaseLB->insertItem(ChangeExtension(file.latin1(), "").c_str());
form_->changed();
}
}
void QBibtexDialog::deletePressed()
{
databaseLB->removeItem(databaseLB->currentItem());
}
void QBibtexDialog::styleChanged(const QString & sel)
{
if (string(_("Other ...")) == sel.latin1() && !form_->readOnly()) {
if (form_->readOnly())
return;
if (string(_("Other ...")) == sel.latin1()) {
styleED->setEnabled(true);
stylePB->setEnabled(true);
} else {
@ -77,6 +84,12 @@ void QBibtexDialog::styleChanged(const QString & sel)
}
void QBibtexDialog::databaseChanged()
{
deletePB->setEnabled(!form_->readOnly() && databaseLB->currentItem() != -1);
}
void QBibtexDialog::closeEvent(QCloseEvent *e)
{
form_->slotWMHide();

View File

@ -25,7 +25,9 @@ protected slots:
virtual void change_adaptor();
virtual void browsePressed();
virtual void addPressed();
virtual void deletePressed();
virtual void styleChanged(const QString &);
virtual void databaseChanged();
protected:

View File

@ -68,10 +68,10 @@ void QExternalDialog::updateClicked()
void QExternalDialog::browseClicked()
{
string file(QFileDialog::getOpenFileName(QString::null,
_("External material (*)"), this, 0, _("Select external material")).latin1());
if (!file.empty()) {
fileED->setText(file.c_str());
QString file = QFileDialog::getOpenFileName(QString::null,
_("External material (*)"), this, 0, _("Select external material"));
if (!file.isNull()) {
fileED->setText(file.latin1());
form_->changed();
}
}

View File

@ -8,6 +8,10 @@
#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ControlThesaurus.h"
#include "QThesaurusDialog.h"
#include "QThesaurus.h"
@ -31,6 +35,7 @@ void QThesaurus::build_dialog()
dialog_.reset(new QThesaurusDialog(this));
bc().setCancel(dialog_->closePB);
bc().setApply(dialog_->replacePB);
bc().addReadOnly(dialog_->replaceED);
bc().addReadOnly(dialog_->replacePB);
}

View File

@ -10,22 +10,27 @@
#ifndef QTHESAURUS_H
#define QTHESAURUS_H
#ifdef __GNUG__
#pragma interface
#endif
#include "Qt2Base.h"
class ControlThesaurus;
class QThesaurusDialog;
class QThesaurus :
public Qt2CB<ControlThesaurus, Qt2DB<QThesaurusDialog> >
///
class QThesaurus
: public Qt2CB<ControlThesaurus, Qt2DB<QThesaurusDialog> >
{
public:
///
friend class QThesaurusDialog;
public:
///
QThesaurus(ControlThesaurus &);
private:
/// Apply changes
virtual void apply();
virtual void apply() {};
/// update
virtual void update_contents();
/// build the dialog

View File

@ -57,8 +57,20 @@ void QThesaurusDialog::replaceClicked()
void QThesaurusDialog::selectionChanged(const QString & str)
{
if (form_->readOnly())
return;
string const entry(str.latin1());
entryED->setText(entry.c_str());
replaceED->setText(entry.c_str());
replacePB->setEnabled(true);
form_->changed();
}
void QThesaurusDialog::selectionClicked(const QString & str)
{
selectionChanged(str);
entryED->setText(str);
updateLists();
}

View File

@ -28,6 +28,7 @@ protected slots:
virtual void entryChanged();
virtual void replaceClicked();
virtual void selectionChanged(const QString &);
virtual void selectionClicked(const QString &);
protected:
virtual void closeEvent(QCloseEvent * e);

View File

@ -5,20 +5,21 @@ BOOST_INCLUDES = -I$(top_srcdir)/boost
INCLUDES = -I${top_srcdir}/src/ \
-I${top_srcdir}/src/frontends/ \
-I${top_srcdir}/src/frontends/controllers \
-I${top_builddir}/src/frontends/qt2 \
${SIGC_CFLAGS} \
${FRONTEND_INCLUDES} \
$(BOOST_INCLUDES)
include ../Makefile.dialogs
libqt2moc_la_SOURCES := FileDialog_private_moc.C \
emptytable_moc.C \
Qt2Base_moc.C \
$(MOCDIALOGS)
DISTCLEANFILES = $(libqt2moc_la_SOURCES) *.orig *.rej *~ *.bak core
ETAGS_ARGS = --lang=c++
%_moc.C: ../%.h
$(MOC) -o $@ $<

View File

@ -13,13 +13,13 @@
<rect>
<x>0</x>
<y>0</y>
<width>302</width>
<width>296</width>
<height>407</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Index</string>
<string>Bibtex</string>
</property>
<vbox>
<property stdset="1">
@ -30,13 +30,39 @@
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>databaseLA</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Databases</string>
</property>
<property stdset="1">
<name>alignment</name>
<set>AlignTop|AlignLeft</set>
</property>
<property>
<name>buddy</name>
<cstring>databaseCO</cstring>
</property>
<property>
<name>toolTip</name>
<string>BibTeX database to use</string>
</property>
<property>
<name>vAlign</name>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout13</cstring>
<cstring>Layout10</cstring>
</property>
<vbox>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
@ -46,38 +72,33 @@
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<class>QListBox</class>
<item>
<property>
<name>text</name>
<string>New Item</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>databaseLA</cstring>
<cstring>databaseLB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Databases</string>
</property>
<property>
<name>buddy</name>
<cstring>databaseCO</cstring>
</property>
<property stdset="1">
<name>alignment</name>
<set>AlignTop|AlignLeft</set>
<name>enabled</name>
<bool>true</bool>
</property>
<property>
<name>toolTip</name>
<string>BibTeX database to use</string>
</property>
<property>
<name>vAlign</name>
<string>Available BibTeX databases</string>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout12</cstring>
<cstring>Layout9</cstring>
</property>
<hbox>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
@ -87,86 +108,63 @@
<number>6</number>
</property>
<widget>
<class>QListBox</class>
<item>
<property>
<name>text</name>
<string>New Item</string>
</property>
</item>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>databaseLB</cstring>
<cstring>databasePB</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
<name>text</name>
<string>&amp;Add ...</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
<property>
<name>toolTip</name>
<string>Available BibTeX databases</string>
<string>Add a BibTeX database file</string>
</property>
</widget>
<widget>
<class>QLayoutWidget</class>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>Layout11</cstring>
<cstring>deletePB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Delete</string>
</property>
<property>
<name>toolTip</name>
<string>Remove the selected database</string>
</property>
<vbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>databasePB</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>&amp;Add ...</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
<property>
<name>toolTip</name>
<string>Add a BibTeX database file</string>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</hbox>
<spacer>
<property>
<name>name</name>
<cstring>Spacer2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Vertical</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</vbox>
</hbox>
</widget>
<widget>
<class>QLayoutWidget</class>
@ -504,9 +502,23 @@
<receiver>QBibtexDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<connection>
<sender>deletePB</sender>
<signal>clicked()</signal>
<receiver>QBibtexDialogBase</receiver>
<slot>deletePressed()</slot>
</connection>
<connection>
<sender>databaseLB</sender>
<signal>selectionChanged()</signal>
<receiver>QBibtexDialogBase</receiver>
<slot>databaseChanged()</slot>
</connection>
<slot access="public">addPressed()</slot>
<slot access="public">browsePressed()</slot>
<slot access="public">change_adaptor()</slot>
<slot access="public">deletePressed()</slot>
<slot access="public">databaseChanged()</slot>
<slot access="public">styleChanged(const QString &amp;)</slot>
</connections>
</UI>

View File

@ -13,7 +13,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>490</width>
<width>482</width>
<height>442</height>
</rect>
</property>
@ -161,12 +161,6 @@
</property>
<widget>
<class>QListBox</class>
<item>
<property>
<name>text</name>
<string>New Item</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>verbsLB</cstring>
@ -199,12 +193,6 @@
</property>
<widget>
<class>QListBox</class>
<item>
<property>
<name>text</name>
<string>New Item</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>adjectivesLB</cstring>
@ -237,12 +225,6 @@
</property>
<widget>
<class>QListBox</class>
<item>
<property>
<name>text</name>
<string>New Item</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>adverbsLB</cstring>
@ -275,12 +257,6 @@
</property>
<widget>
<class>QListBox</class>
<item>
<property>
<name>text</name>
<string>New Item</string>
</property>
</item>
<property stdset="1">
<name>name</name>
<cstring>otherLB</cstring>
@ -320,7 +296,7 @@
</property>
<property>
<name>buddy</name>
<cstring>selectionED</cstring>
<cstring>replaceED</cstring>
</property>
<property>
<name>toolTip</name>
@ -419,36 +395,6 @@
<receiver>QThesaurusDialogBase</receiver>
<slot>change_adaptor()</slot>
</connection>
<connection>
<sender>nounsLB</sender>
<signal>selected(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionChanged(const QString &amp;)</slot>
</connection>
<connection>
<sender>verbsLB</sender>
<signal>selected(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionChanged(const QString &amp;)</slot>
</connection>
<connection>
<sender>adjectivesLB</sender>
<signal>selected(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionChanged(const QString &amp;)</slot>
</connection>
<connection>
<sender>adverbsLB</sender>
<signal>selected(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionChanged(const QString &amp;)</slot>
</connection>
<connection>
<sender>otherLB</sender>
<signal>selected(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionChanged(const QString &amp;)</slot>
</connection>
<connection>
<sender>entryED</sender>
<signal>returnPressed()</signal>
@ -461,8 +407,69 @@
<receiver>QThesaurusDialogBase</receiver>
<slot>replaceClicked()</slot>
</connection>
<connection>
<sender>nounsLB</sender>
<signal>highlighted(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionChanged(const QString &amp;)</slot>
</connection>
<connection>
<sender>nounsLB</sender>
<signal>selected(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionClicked(const QString &amp;)</slot>
</connection>
<connection>
<sender>verbsLB</sender>
<signal>selected(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionClicked(const QString &amp;)</slot>
</connection>
<connection>
<sender>verbsLB</sender>
<signal>highlighted(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionChanged(const QString &amp;)</slot>
</connection>
<connection>
<sender>adjectivesLB</sender>
<signal>selected(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionClicked(const QString &amp;)</slot>
</connection>
<connection>
<sender>adjectivesLB</sender>
<signal>highlighted(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionChanged(const QString &amp;)</slot>
</connection>
<connection>
<sender>adverbsLB</sender>
<signal>selected(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionClicked(const QString &amp;)</slot>
</connection>
<connection>
<sender>adverbsLB</sender>
<signal>highlighted(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionChanged(const QString &amp;)</slot>
</connection>
<connection>
<sender>otherLB</sender>
<signal>selected(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionClicked(const QString &amp;)</slot>
</connection>
<connection>
<sender>otherLB</sender>
<signal>highlighted(const QString&amp;)</signal>
<receiver>QThesaurusDialogBase</receiver>
<slot>selectionChanged(const QString &amp;)</slot>
</connection>
<slot access="public">change_adaptor()</slot>
<slot access="public">entryChanged()</slot>
<slot access="public">selectionClicked(const QString &amp;)</slot>
<slot access="public">replaceClicked()</slot>
<slot access="public">selectionChanged(const QString &amp;)</slot>
</connections>