2006-03-05 17:24:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file QGraphicsDialog.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Herbert Vo<EFBFBD>
|
|
|
|
|
* \author Abdelrazak Younes
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "QGraphicsDialog.h"
|
|
|
|
|
#include "QGraphics.h"
|
|
|
|
|
//Added by qt3to4:
|
|
|
|
|
#include <QCloseEvent>
|
|
|
|
|
|
|
|
|
|
#include "lengthcombo.h"
|
|
|
|
|
#include "validators.h"
|
|
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
|
|
#include "controllers/ControlGraphics.h"
|
|
|
|
|
|
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
|
#include <qlineedit.h>
|
|
|
|
|
#include <qvalidator.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGraphicsDialog::QGraphicsDialog(QGraphics * form)
|
|
|
|
|
: form_(form)
|
|
|
|
|
{
|
|
|
|
|
setupUi(this);
|
|
|
|
|
connect(okPB, SIGNAL(clicked()),
|
|
|
|
|
form, SLOT(slotOK()));
|
|
|
|
|
connect(applyPB, SIGNAL(clicked()),
|
|
|
|
|
form, SLOT(slotApply()));
|
|
|
|
|
connect(closePB, SIGNAL(clicked()),
|
|
|
|
|
form, SLOT(slotClose()));
|
|
|
|
|
connect(restorePB, SIGNAL(clicked()),
|
|
|
|
|
form, SLOT(slotRestore()));
|
|
|
|
|
connect(editPB, SIGNAL(clicked()),
|
|
|
|
|
this, SLOT(edit_clicked()));
|
|
|
|
|
|
2006-04-06 21:04:27 +00:00
|
|
|
|
connect( subfigure, SIGNAL( toggled(bool) ), subcaption, SLOT( setEnabled(bool) ) );
|
|
|
|
|
connect( browsePB, SIGNAL( clicked() ), this, SLOT( browse_clicked() ) );
|
|
|
|
|
connect( filename, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( filename, SIGNAL( textChanged(const QString&) ), this, SLOT( filenameChanged(const QString&) ) );
|
|
|
|
|
connect( subcaption, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( subfigure, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( latexoptions, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( clip, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( lbX, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) );
|
|
|
|
|
connect( showCB, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( displayscale, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( Width, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( widthUnit, SIGNAL( activated(int) ), this, SLOT( change_WUnit() ) );
|
|
|
|
|
connect( aspectratio, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( displayCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( draftCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( unzipCB, SIGNAL( stateChanged(int) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( displayCB, SIGNAL( toggled(bool) ), showCB, SLOT( setEnabled(bool) ) );
|
|
|
|
|
connect( displayCB, SIGNAL( toggled(bool) ), displayscale, SLOT( setEnabled(bool) ) );
|
|
|
|
|
connect( Height, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( heightUnit, SIGNAL( selectionChanged(LyXLength::UNIT) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( angle, SIGNAL( textChanged(const QString&) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( origin, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( getPB, SIGNAL( clicked() ), this, SLOT( getBB_clicked() ) );
|
|
|
|
|
connect( getPB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
|
|
|
|
|
connect( lbY, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) );
|
|
|
|
|
connect( rtX, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) );
|
|
|
|
|
connect( rtY, SIGNAL( textChanged(const QString&) ), this, SLOT( change_bb() ) );
|
|
|
|
|
connect( lbXunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) );
|
|
|
|
|
connect( lbYunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) );
|
|
|
|
|
connect( rtXunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) );
|
|
|
|
|
connect( rtYunit, SIGNAL( activated(int) ), this, SLOT( change_bb() ) );
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
|
angle->setValidator(new QDoubleValidator(-360, 360, 2, angle));
|
|
|
|
|
|
|
|
|
|
lbX->setValidator(new QIntValidator(lbX));
|
|
|
|
|
lbY->setValidator(new QIntValidator(lbY));
|
|
|
|
|
rtX->setValidator(new QIntValidator(rtX));
|
|
|
|
|
rtY->setValidator(new QIntValidator(rtY));
|
|
|
|
|
|
|
|
|
|
displayscale->setValidator(new QIntValidator(displayscale));
|
|
|
|
|
Height->setValidator(unsignedLengthValidator(Height));
|
|
|
|
|
Width->setValidator(unsignedLengthValidator(Width));
|
|
|
|
|
|
|
|
|
|
filename->setValidator(new PathValidator(true, filename));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QGraphicsDialog::show()
|
|
|
|
|
{
|
|
|
|
|
QDialog::show();
|
|
|
|
|
filename->setFocus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QGraphicsDialog::change_adaptor()
|
|
|
|
|
{
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QGraphicsDialog::change_bb()
|
|
|
|
|
{
|
|
|
|
|
form_->controller().bbChanged = true;
|
|
|
|
|
lyxerr[Debug::GRAPHICS]
|
|
|
|
|
<< "[controller().bb_Changed set to true]\n";
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QGraphicsDialog::change_WUnit()
|
|
|
|
|
{
|
2006-08-17 08:55:23 +00:00
|
|
|
|
bool useHeight = (widthUnit->currentIndex() > 0);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
Height->setEnabled(useHeight);
|
|
|
|
|
heightUnit->setEnabled(useHeight);
|
2006-04-06 21:04:27 +00:00
|
|
|
|
heightL->setEnabled(useHeight);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QGraphicsDialog::closeEvent(QCloseEvent * e)
|
|
|
|
|
{
|
|
|
|
|
form_->slotWMHide();
|
|
|
|
|
e->accept();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QGraphicsDialog::browse_clicked()
|
|
|
|
|
{
|
2006-10-09 16:33:20 +00:00
|
|
|
|
docstring const str =
|
|
|
|
|
form_->controller().browse(qstring_to_ucs4(filename->text()));
|
2006-03-05 17:24:44 +00:00
|
|
|
|
filename->setText(toqstr(str));
|
|
|
|
|
form_->changed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QGraphicsDialog::getBB_clicked()
|
|
|
|
|
{
|
|
|
|
|
form_->getBB();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void QGraphicsDialog::edit_clicked()
|
|
|
|
|
{
|
|
|
|
|
form_->controller().editGraphics();
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-06 21:04:27 +00:00
|
|
|
|
void QGraphicsDialog::filenameChanged(const QString & filename)
|
|
|
|
|
{
|
|
|
|
|
editPB->setDisabled(filename.isEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
|
} // namespace frontend
|
|
|
|
|
} // namespace lyx
|
2006-05-18 08:51:12 +00:00
|
|
|
|
|
|
|
|
|
#include "QGraphicsDialog_moc.cpp"
|