2002-01-19 13:48:05 +00:00
|
|
|
/**
|
|
|
|
* \file QTexinfoDialog.C
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-01-19 13:48:05 +00:00
|
|
|
*
|
2002-10-20 01:48:28 +00:00
|
|
|
* \author Edwin Leuven
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-01-19 13:48:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
2002-09-24 13:57:09 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
#include "LString.h"
|
|
|
|
|
|
|
|
#include "ControlTexinfo.h"
|
2002-01-19 13:48:05 +00:00
|
|
|
#include "QTexinfoDialog.h"
|
|
|
|
#include "QTexinfo.h"
|
|
|
|
|
|
|
|
#include <qlistbox.h>
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
#include <qcombobox.h>
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
2002-01-19 13:48:05 +00:00
|
|
|
QTexinfoDialog::QTexinfoDialog(QTexinfo * form)
|
|
|
|
: QTexinfoDialogBase(0, 0, false, 0),
|
|
|
|
form_(form)
|
|
|
|
{
|
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
form, SLOT(slotClose()));
|
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-01-19 13:48:05 +00:00
|
|
|
void QTexinfoDialog::change_adaptor()
|
|
|
|
{
|
|
|
|
form_->changed();
|
|
|
|
}
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-01-19 13:48:05 +00:00
|
|
|
void QTexinfoDialog::closeEvent(QCloseEvent * e)
|
|
|
|
{
|
|
|
|
form_->slotWMHide();
|
|
|
|
e->accept();
|
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-01-19 13:48:05 +00:00
|
|
|
void QTexinfoDialog::rescanClicked()
|
|
|
|
{
|
|
|
|
// build new *Files.lst
|
|
|
|
form_->controller().rescanStyles();
|
|
|
|
form_->updateStyles();
|
2002-07-23 13:12:55 +00:00
|
|
|
enableViewPB();
|
2002-01-19 13:48:05 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-01-19 13:48:05 +00:00
|
|
|
void QTexinfoDialog::viewClicked()
|
|
|
|
{
|
2002-07-23 13:12:55 +00:00
|
|
|
int const fitem = fileList->currentItem();
|
|
|
|
|
|
|
|
string sel;
|
|
|
|
switch (whatStyle->currentItem()) {
|
|
|
|
case 0:
|
|
|
|
sel = form_->cls_[fitem];
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sel = form_->sty_[fitem];
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sel = form_->bst_[fitem];
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-01-19 13:48:05 +00:00
|
|
|
// a valid entry?
|
|
|
|
if (!sel.empty()) {
|
|
|
|
form_->controller().viewFile(sel.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-01-19 13:48:05 +00:00
|
|
|
void QTexinfoDialog::update()
|
|
|
|
{
|
2002-07-23 13:12:55 +00:00
|
|
|
switch (whatStyle->currentItem()) {
|
2002-01-19 13:48:05 +00:00
|
|
|
case 0:
|
|
|
|
form_->updateStyles(ControlTexinfo::cls);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
form_->updateStyles(ControlTexinfo::sty);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
form_->updateStyles(ControlTexinfo::bst);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-07-23 13:12:55 +00:00
|
|
|
enableViewPB();
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2002-10-20 01:48:28 +00:00
|
|
|
|
2002-07-23 13:12:55 +00:00
|
|
|
void QTexinfoDialog::enableViewPB()
|
|
|
|
{
|
2002-10-20 01:48:28 +00:00
|
|
|
viewPB->setEnabled(fileList->currentItem() > -1);
|
2002-01-19 13:48:05 +00:00
|
|
|
}
|