mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Real fix for bug 1511 and bug 1512
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8445 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d3e1f5fc55
commit
c71c23dd78
@ -1,3 +1,8 @@
|
||||
2004-02-19 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* QRef.[Ch]: Real fix for bug 1511 (restore latest settings);
|
||||
fix for bug 1512 (restore ref format settings).
|
||||
|
||||
2004-02-18 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
|
||||
|
||||
* QCitation.[Ch]:
|
||||
|
@ -4,6 +4,7 @@
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
* \author Jürgen Spitzmüller
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
@ -54,26 +55,33 @@ void QRef::build_dialog()
|
||||
bcview().addReadOnly(dialog_->referenceED);
|
||||
bcview().addReadOnly(dialog_->typeCO);
|
||||
bcview().addReadOnly(dialog_->bufferCO);
|
||||
|
||||
restored_buffer_ = -1;
|
||||
}
|
||||
|
||||
|
||||
void QRef::update_contents()
|
||||
{
|
||||
InsetCommandParams const & params = controller().params();
|
||||
|
||||
|
||||
int orig_type = dialog_->typeCO->currentItem();
|
||||
|
||||
dialog_->referenceED->setText(toqstr(params.getContents()));
|
||||
|
||||
dialog_->nameED->setText(toqstr(params.getOptions()));
|
||||
dialog_->nameED->setReadOnly(!nameAllowed() && !readOnly());
|
||||
|
||||
dialog_->typeCO->setCurrentItem(InsetRef::getType(params.getCmdName()));
|
||||
|
||||
// restore type settings for new insets
|
||||
if (params.getContents().empty())
|
||||
dialog_->typeCO->setCurrentItem(orig_type);
|
||||
else
|
||||
dialog_->typeCO->setCurrentItem(InsetRef::getType(params.getCmdName()));
|
||||
dialog_->typeCO->setEnabled(typeAllowed() && !readOnly());
|
||||
if (!typeAllowed())
|
||||
dialog_->typeCO->setCurrentItem(0);
|
||||
|
||||
dialog_->sortCB->setChecked(sort_);
|
||||
|
||||
int const orig = dialog_->bufferCO->currentItem();
|
||||
// insert buffer list
|
||||
dialog_->bufferCO->clear();
|
||||
vector<string> const buffers = controller().getBufferList();
|
||||
@ -81,8 +89,10 @@ void QRef::update_contents()
|
||||
it != buffers.end(); ++it) {
|
||||
dialog_->bufferCO->insertItem(toqstr(*it));
|
||||
}
|
||||
if (orig != -1 && orig < dialog_->bufferCO->count())
|
||||
dialog_->bufferCO->setCurrentItem(orig);
|
||||
// restore the buffer combo setting for new insets
|
||||
if (params.getContents().empty() && restored_buffer_ != -1
|
||||
&& restored_buffer_ < dialog_->bufferCO->count())
|
||||
dialog_->bufferCO->setCurrentItem(restored_buffer_);
|
||||
else
|
||||
dialog_->bufferCO->setCurrentItem(controller().getBufferNum());
|
||||
|
||||
@ -97,6 +107,8 @@ void QRef::apply()
|
||||
params.setCmdName(InsetRef::getName(dialog_->typeCO->currentItem()));
|
||||
params.setContents(fromqstr(dialog_->referenceED->text()));
|
||||
params.setOptions(fromqstr(dialog_->nameED->text()));
|
||||
|
||||
restored_buffer_ = dialog_->bufferCO->currentItem();
|
||||
}
|
||||
|
||||
|
||||
@ -151,6 +163,8 @@ void QRef::gotoRef()
|
||||
|
||||
void QRef::redoRefs()
|
||||
{
|
||||
int lastref = dialog_->refsLB->currentItem();
|
||||
|
||||
dialog_->refsLB->setAutoUpdate(false);
|
||||
dialog_->refsLB->clear();
|
||||
|
||||
@ -167,11 +181,16 @@ void QRef::redoRefs()
|
||||
dialog_->refsLB->sort();
|
||||
|
||||
dialog_->referenceED->setText(tmp);
|
||||
|
||||
for (unsigned int i = 0; i < dialog_->refsLB->count(); ++i) {
|
||||
if (tmp == dialog_->refsLB->text(i))
|
||||
dialog_->refsLB->setCurrentItem(i);
|
||||
}
|
||||
|
||||
// restore the last selection for new insets
|
||||
if (tmp.isEmpty() && lastref != -1
|
||||
&& lastref < dialog_->refsLB->count())
|
||||
dialog_->refsLB->setCurrentItem(lastref);
|
||||
else
|
||||
for (unsigned int i = 0; i < dialog_->refsLB->count(); ++i) {
|
||||
if (tmp == dialog_->refsLB->text(i))
|
||||
dialog_->refsLB->setCurrentItem(i);
|
||||
}
|
||||
|
||||
dialog_->refsLB->setAutoUpdate(true);
|
||||
dialog_->refsLB->update();
|
||||
|
@ -62,6 +62,9 @@ private:
|
||||
|
||||
/// at a reference ?
|
||||
bool at_ref_;
|
||||
|
||||
/// store the buffer settings
|
||||
int restored_buffer_;
|
||||
|
||||
/// the references
|
||||
std::vector<std::string> refs_;
|
||||
|
Loading…
Reference in New Issue
Block a user