2001-02-14 19:43:56 +00:00
|
|
|
/**
|
2001-08-19 13:25:15 +00:00
|
|
|
* \file QParagraphDialog.C
|
2001-02-14 19:43:56 +00:00
|
|
|
* Copyright 2001 LyX Team
|
|
|
|
* see the file COPYING
|
|
|
|
*
|
|
|
|
* \author John Levon, moz@compsoc.man.ac.uk
|
|
|
|
* \author Edwin Leuven, leuven@fee.uva.nl
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <gettext.h>
|
|
|
|
#include <string>
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
#include "QParagraphDialog.h"
|
|
|
|
#include "QParagraph.h"
|
2001-02-14 19:43:56 +00:00
|
|
|
#include "support/lstrings.h"
|
|
|
|
#include "debug.h"
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
#include <qlineedit.h>
|
|
|
|
#include <qcombobox.h>
|
|
|
|
#include <qcheckbox.h>
|
|
|
|
#include <qpushbutton.h>
|
|
|
|
#include <qtabwidget.h>
|
|
|
|
#include <qlabel.h>
|
|
|
|
#include <qgroupbox.h>
|
2001-02-14 19:43:56 +00:00
|
|
|
|
2001-03-05 12:04:43 +00:00
|
|
|
using std::endl;
|
2001-02-14 19:43:56 +00:00
|
|
|
|
2002-03-11 22:47:41 +00:00
|
|
|
QParagraphDialog::QParagraphDialog(QParagraph * form, QWidget * parent,
|
|
|
|
char const * name, bool modal, WFlags fl)
|
2001-08-19 13:25:15 +00:00
|
|
|
: QParagraphDialogBase(parent, name, modal, fl),
|
2002-03-11 22:47:41 +00:00
|
|
|
form_(form)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
setCaption(name);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
QParagraphDialog::~QParagraphDialog()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::setReadOnly(bool readonly)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
TabsParagraph->setEnabled(!readonly);
|
|
|
|
okPB->setEnabled(!readonly);
|
|
|
|
applyPB->setEnabled(!readonly);
|
|
|
|
defaultsPB->setEnabled(!readonly);
|
|
|
|
cancelPB->setText(readonly ? _("&Close") : _("&Cancel"));
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2002-03-11 22:47:41 +00:00
|
|
|
void QParagraphDialog::setLabelWidth(char const * text)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
// FIXME: should be cleverer here
|
|
|
|
if (!strcmp(_("Senseless with this layout!"),text)) {
|
|
|
|
listOptions->setEnabled(false);
|
|
|
|
labelWidth->setText("");
|
|
|
|
} else {
|
|
|
|
listOptions->setEnabled(true);
|
|
|
|
labelWidth->setText(text);
|
|
|
|
}
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::setAlign(int type)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2002-03-11 22:47:41 +00:00
|
|
|
int item = 0;
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (type) {
|
2002-03-11 22:47:41 +00:00
|
|
|
case LYX_ALIGN_BLOCK: item = 0; break;
|
|
|
|
case LYX_ALIGN_LEFT: item = 1; break;
|
|
|
|
case LYX_ALIGN_RIGHT: item = 2; break;
|
|
|
|
case LYX_ALIGN_CENTER: item = 3; break;
|
2001-06-05 17:05:51 +00:00
|
|
|
default:
|
2002-03-11 22:47:41 +00:00
|
|
|
item = 0;
|
|
|
|
break;
|
2001-06-05 17:05:51 +00:00
|
|
|
}
|
|
|
|
alignment->setCurrentItem(item);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2002-03-11 22:47:41 +00:00
|
|
|
void QParagraphDialog::setChecks(bool labove, bool lbelow, bool pabove,
|
|
|
|
bool pbelow, bool noindent)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
lineAbove->setChecked(labove);
|
|
|
|
lineBelow->setChecked(lbelow);
|
|
|
|
pagebreakAbove->setChecked(pabove);
|
|
|
|
pagebreakBelow->setChecked(pbelow);
|
|
|
|
noIndent->setChecked(noindent);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2002-03-11 22:47:41 +00:00
|
|
|
void QParagraphDialog::setSpace(VSpace::vspace_kind kindabove,
|
|
|
|
VSpace::vspace_kind kindbelow,
|
|
|
|
bool keepabove, bool keepbelow)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2002-03-11 22:47:41 +00:00
|
|
|
int item = 0;
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
switch (kindabove) {
|
|
|
|
case VSpace::NONE: item = 0; break;
|
|
|
|
case VSpace::DEFSKIP: item = 1; break;
|
|
|
|
case VSpace::SMALLSKIP: item = 2; break;
|
|
|
|
case VSpace::MEDSKIP: item = 3; break;
|
|
|
|
case VSpace::BIGSKIP: item = 4; break;
|
|
|
|
case VSpace::VFILL: item = 5; break;
|
|
|
|
case VSpace::LENGTH: item = 6; break;
|
|
|
|
}
|
|
|
|
spacingAbove->setCurrentItem(item);
|
|
|
|
|
|
|
|
switch (kindbelow) {
|
|
|
|
case VSpace::NONE: item = 0; break;
|
|
|
|
case VSpace::DEFSKIP: item = 1; break;
|
|
|
|
case VSpace::SMALLSKIP: item = 2; break;
|
|
|
|
case VSpace::MEDSKIP: item = 3; break;
|
|
|
|
case VSpace::BIGSKIP: item = 4; break;
|
|
|
|
case VSpace::VFILL: item = 5; break;
|
|
|
|
case VSpace::LENGTH: item = 6; break;
|
|
|
|
}
|
|
|
|
spacingBelow->setCurrentItem(item);
|
|
|
|
|
|
|
|
spacingAboveValue->setEnabled(kindabove == VSpace::LENGTH);
|
|
|
|
spacingAbovePlus->setEnabled(kindabove == VSpace::LENGTH);
|
|
|
|
spacingAboveMinus->setEnabled(kindabove == VSpace::LENGTH);
|
|
|
|
spacingBelowValue->setEnabled(kindbelow == VSpace::LENGTH);
|
|
|
|
spacingBelowPlus->setEnabled(kindbelow == VSpace::LENGTH);
|
|
|
|
spacingBelowMinus->setEnabled(kindbelow == VSpace::LENGTH);
|
|
|
|
|
|
|
|
spacingAboveKeep->setChecked(keepabove);
|
|
|
|
spacingBelowKeep->setChecked(keepbelow);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::setAboveLength(float val, float plus, float minus,
|
2002-03-11 22:47:41 +00:00
|
|
|
LyXLength::UNIT vunit,
|
|
|
|
LyXLength::UNIT punit,
|
|
|
|
LyXLength::UNIT munit)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2002-03-11 22:47:41 +00:00
|
|
|
if (vunit == LyXLength::UNIT_NONE) {
|
2001-06-05 17:05:51 +00:00
|
|
|
spacingAboveValue->setText("");
|
|
|
|
spacingAbovePlus->setText("");
|
|
|
|
spacingAboveMinus->setText("");
|
|
|
|
} else {
|
|
|
|
spacingAboveValue->setText(tostr(val).c_str());
|
|
|
|
spacingAbovePlus->setText(tostr(plus).c_str());
|
|
|
|
spacingAboveMinus->setText(tostr(minus).c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
spacingAboveValueUnit->setCurrentItem(getItem(vunit));
|
|
|
|
spacingAbovePlusUnit->setCurrentItem(getItem(punit));
|
|
|
|
spacingAboveMinusUnit->setCurrentItem(getItem(munit));
|
2001-02-14 19:43:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::setBelowLength(float val, float plus, float minus,
|
2002-03-11 22:47:41 +00:00
|
|
|
LyXLength::UNIT vunit,
|
|
|
|
LyXLength::UNIT punit,
|
|
|
|
LyXLength::UNIT munit)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2002-03-11 22:47:41 +00:00
|
|
|
if (vunit == LyXLength::UNIT_NONE) {
|
2001-06-05 17:05:51 +00:00
|
|
|
spacingBelowValue->setText("");
|
|
|
|
spacingBelowPlus->setText("");
|
|
|
|
spacingBelowMinus->setText("");
|
|
|
|
} else {
|
|
|
|
spacingBelowValue->setText(tostr(val).c_str());
|
|
|
|
spacingBelowPlus->setText(tostr(plus).c_str());
|
|
|
|
spacingBelowMinus->setText(tostr(minus).c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
spacingBelowValueUnit->setCurrentItem(getItem(vunit));
|
|
|
|
spacingBelowPlusUnit->setCurrentItem(getItem(punit));
|
|
|
|
spacingBelowMinusUnit->setCurrentItem(getItem(munit));
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-03-16 00:09:53 +00:00
|
|
|
|
2002-03-11 22:47:41 +00:00
|
|
|
void QParagraphDialog::setExtra(float widthval, LyXLength::UNIT units,
|
|
|
|
string const & percent, int align,
|
|
|
|
bool hfill, bool startminipage,
|
|
|
|
Paragraph::PEXTRA_TYPE type)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2002-03-11 22:47:41 +00:00
|
|
|
if (type != Paragraph::PEXTRA_NONE) {
|
|
|
|
lyxerr[Debug::GUI] << "percent : $" << percent << "$ widthval "
|
|
|
|
<< widthval << " unit " << long(units)
|
|
|
|
<< endl;
|
2001-06-05 17:05:51 +00:00
|
|
|
if (percent != "") {
|
|
|
|
extraWidth->setText(percent.c_str());
|
|
|
|
extraUnit->setCurrentItem(11);
|
|
|
|
} else {
|
|
|
|
extraWidth->setText(tostr(widthval).c_str());
|
|
|
|
extraUnit->setCurrentItem(getItem(units));
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
extraWidth->setText("");
|
|
|
|
|
|
|
|
switch (type) {
|
2001-06-25 00:06:33 +00:00
|
|
|
case Paragraph::PEXTRA_NONE:
|
2001-06-05 17:05:51 +00:00
|
|
|
extraType->setCurrentItem(0);
|
|
|
|
break;
|
2001-06-25 00:06:33 +00:00
|
|
|
case Paragraph::PEXTRA_MINIPAGE:
|
2001-06-05 17:05:51 +00:00
|
|
|
extraType->setCurrentItem(1);
|
|
|
|
enable_extraOptions(1);
|
|
|
|
enable_minipageOptions(1);
|
|
|
|
break;
|
2001-06-25 00:06:33 +00:00
|
|
|
case Paragraph::PEXTRA_FLOATFLT:
|
2001-06-05 17:05:51 +00:00
|
|
|
extraType->setCurrentItem(2);
|
|
|
|
enable_extraOptions(2);
|
|
|
|
break;
|
2001-06-25 00:06:33 +00:00
|
|
|
case Paragraph::PEXTRA_INDENT:
|
2001-06-05 17:05:51 +00:00
|
|
|
extraType->setCurrentItem(3);
|
|
|
|
enable_extraOptions(3);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (align) {
|
2001-06-25 00:06:33 +00:00
|
|
|
case Paragraph::MINIPAGE_ALIGN_TOP:
|
2001-06-05 17:05:51 +00:00
|
|
|
minipageValign->setCurrentItem(0);
|
|
|
|
break;
|
2001-06-25 00:06:33 +00:00
|
|
|
case Paragraph::MINIPAGE_ALIGN_MIDDLE:
|
2001-06-05 17:05:51 +00:00
|
|
|
minipageValign->setCurrentItem(1);
|
|
|
|
break;
|
2001-06-25 00:06:33 +00:00
|
|
|
case Paragraph::MINIPAGE_ALIGN_BOTTOM:
|
2001-06-05 17:05:51 +00:00
|
|
|
minipageValign->setCurrentItem(2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
minipageHfill->setChecked(hfill);
|
|
|
|
minipageStart->setChecked(startminipage);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-03-16 00:09:53 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
LyXGlueLength QParagraphDialog::getAboveLength() const
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
LyXGlueLength len(
|
2001-12-05 18:32:49 +00:00
|
|
|
LyXLength(spacingAboveValue->text().toFloat(),
|
|
|
|
getLyXLength(spacingAboveValueUnit->currentItem())),
|
|
|
|
LyXLength(spacingAbovePlus->text().toFloat(),
|
|
|
|
getLyXLength(spacingAbovePlusUnit->currentItem())),
|
|
|
|
LyXLength(spacingAboveMinus->text().toFloat(),
|
|
|
|
getLyXLength(spacingAboveMinusUnit->currentItem()))
|
2001-06-05 17:05:51 +00:00
|
|
|
);
|
|
|
|
return len;
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
LyXGlueLength QParagraphDialog::getBelowLength() const
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
LyXGlueLength len(
|
2001-12-05 18:32:49 +00:00
|
|
|
LyXLength(spacingBelowValue->text().toFloat(),
|
|
|
|
getLyXLength(spacingBelowValueUnit->currentItem())),
|
|
|
|
LyXLength(spacingBelowPlus->text().toFloat(),
|
|
|
|
getLyXLength(spacingBelowPlusUnit->currentItem())),
|
|
|
|
LyXLength(spacingBelowMinus->text().toFloat(),
|
|
|
|
getLyXLength(spacingBelowMinusUnit->currentItem()))
|
2001-02-14 19:43:56 +00:00
|
|
|
);
|
2001-06-05 17:05:51 +00:00
|
|
|
return len;
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
LyXLength QParagraphDialog::getExtraWidth() const
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2002-03-11 22:47:41 +00:00
|
|
|
if (extraUnit->currentItem() != 11) {
|
2001-06-05 17:05:51 +00:00
|
|
|
LyXLength len(
|
|
|
|
(extraWidth->text()).toDouble(),
|
|
|
|
getLyXLength(extraUnit->currentItem())
|
|
|
|
);
|
|
|
|
return len;
|
|
|
|
} else {
|
|
|
|
LyXLength len(0.0, LyXLength::UNIT_NONE);
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
string QParagraphDialog::getExtraWidthPercent() const
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
double val = (extraWidth->text()).toDouble();
|
|
|
|
if (val > 100.0)
|
|
|
|
val = 100.0;
|
|
|
|
if (val < 0.0)
|
|
|
|
val = 0.0;
|
|
|
|
return tostr(val);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-11 22:47:41 +00:00
|
|
|
char const * QParagraphDialog::getLabelWidth() const
|
2001-08-19 13:25:15 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return labelWidth->text();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
LyXAlignment QParagraphDialog::getAlign() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (alignment->currentItem()) {
|
|
|
|
case 0: return LYX_ALIGN_BLOCK;
|
|
|
|
case 1: return LYX_ALIGN_LEFT;
|
|
|
|
case 2: return LYX_ALIGN_RIGHT;
|
|
|
|
case 3: return LYX_ALIGN_CENTER;
|
|
|
|
default: return LYX_ALIGN_CENTER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
bool QParagraphDialog::getAboveKeep() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return spacingAboveKeep->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
bool QParagraphDialog::getBelowKeep() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return spacingBelowKeep->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
bool QParagraphDialog::getLineAbove() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return lineAbove->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
bool QParagraphDialog::getLineBelow() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return lineBelow->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
bool QParagraphDialog::getPagebreakAbove() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return pagebreakAbove->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
bool QParagraphDialog::getPagebreakBelow() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return pagebreakBelow->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
bool QParagraphDialog::getNoIndent() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return noIndent->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
VSpace::vspace_kind QParagraphDialog::getSpaceAboveKind() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return getSpaceKind(spacingAbove->currentItem());
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-06-05 17:05:51 +00:00
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
VSpace::vspace_kind QParagraphDialog::getSpaceBelowKind() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return getSpaceKind(spacingBelow->currentItem());
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
2001-03-16 00:09:53 +00:00
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
Paragraph::PEXTRA_TYPE QParagraphDialog::getExtraType() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (extraType->currentItem()) {
|
2001-06-25 00:06:33 +00:00
|
|
|
case 0: return Paragraph::PEXTRA_NONE;
|
|
|
|
case 1: return Paragraph::PEXTRA_MINIPAGE;
|
|
|
|
case 2: return Paragraph::PEXTRA_FLOATFLT;
|
|
|
|
case 3: return Paragraph::PEXTRA_INDENT;
|
2001-06-05 17:05:51 +00:00
|
|
|
}
|
2001-06-25 00:06:33 +00:00
|
|
|
return Paragraph::PEXTRA_NONE;
|
2001-06-05 17:05:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
Paragraph::MINIPAGE_ALIGNMENT QParagraphDialog::getExtraAlign() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (minipageValign->currentItem()) {
|
2001-06-25 00:06:33 +00:00
|
|
|
case 0: return Paragraph::MINIPAGE_ALIGN_TOP;
|
|
|
|
case 1: return Paragraph::MINIPAGE_ALIGN_MIDDLE;
|
|
|
|
case 2: return Paragraph::MINIPAGE_ALIGN_BOTTOM;
|
|
|
|
default: return Paragraph::MINIPAGE_ALIGN_BOTTOM;
|
2001-06-05 17:05:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
bool QParagraphDialog::getHfillBetween() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return minipageHfill->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
bool QParagraphDialog::getStartNewMinipage() const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
return minipageStart->isChecked();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-03-16 00:09:53 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
VSpace::vspace_kind QParagraphDialog::getSpaceKind(int val) const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (val) {
|
|
|
|
case 0: return VSpace::NONE;
|
|
|
|
case 1: return VSpace::DEFSKIP;
|
|
|
|
case 2: return VSpace::SMALLSKIP;
|
|
|
|
case 3: return VSpace::MEDSKIP;
|
|
|
|
case 4: return VSpace::BIGSKIP;
|
|
|
|
case 5: return VSpace::VFILL;
|
|
|
|
case 6: return VSpace::LENGTH;
|
|
|
|
default:
|
2002-03-11 22:47:41 +00:00
|
|
|
lyxerr[Debug::GUI] << "Unknown kind combo entry "
|
|
|
|
<< val << std::endl;
|
2001-06-05 17:05:51 +00:00
|
|
|
}
|
|
|
|
return VSpace::NONE;
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
LyXLength::UNIT QParagraphDialog::getLyXLength(int val) const
|
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (val) {
|
|
|
|
case 0: return LyXLength::CM;
|
|
|
|
case 1: return LyXLength::IN;
|
|
|
|
case 2: return LyXLength::PT;
|
|
|
|
case 3: return LyXLength::MM;
|
|
|
|
case 4: return LyXLength::PC;
|
|
|
|
case 5: return LyXLength::EX;
|
|
|
|
case 6: return LyXLength::EM;
|
|
|
|
case 7: return LyXLength::SP;
|
|
|
|
case 8: return LyXLength::BP;
|
|
|
|
case 9: return LyXLength::DD;
|
|
|
|
case 10: return LyXLength::CC;
|
|
|
|
default:
|
2002-03-11 22:47:41 +00:00
|
|
|
lyxerr[Debug::GUI] << "Unknown kind combo entry "
|
|
|
|
<< val << std::endl;
|
2001-06-05 17:05:51 +00:00
|
|
|
}
|
|
|
|
return LyXLength::UNIT_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
int QParagraphDialog::getItem(LyXLength::UNIT unit) const
|
|
|
|
{
|
2002-03-11 22:47:41 +00:00
|
|
|
int item = 0;
|
2001-06-05 17:05:51 +00:00
|
|
|
switch (unit) {
|
|
|
|
case LyXLength::CM: item = 0; break;
|
|
|
|
case LyXLength::IN: item = 1; break;
|
|
|
|
case LyXLength::PT: item = 2; break;
|
|
|
|
case LyXLength::MM: item = 3; break;
|
|
|
|
case LyXLength::PC: item = 4; break;
|
|
|
|
case LyXLength::EX: item = 5; break;
|
|
|
|
case LyXLength::EM: item = 6; break;
|
|
|
|
case LyXLength::SP: item = 7; break;
|
|
|
|
case LyXLength::BP: item = 8; break;
|
|
|
|
case LyXLength::DD: item = 9; break;
|
|
|
|
case LyXLength::CC: item = 10; break;
|
|
|
|
case LyXLength::MU: item = 0; break;
|
|
|
|
case LyXLength::UNIT_NONE: item = 0; break;
|
|
|
|
default:
|
2002-03-11 22:47:41 +00:00
|
|
|
lyxerr[Debug::GUI] << "Unknown unit " << long(unit)
|
|
|
|
<< endl;
|
2001-06-05 17:05:51 +00:00
|
|
|
}
|
|
|
|
return item;
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::enable_extraOptions(int item)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2002-03-11 22:47:41 +00:00
|
|
|
bool const enable = (item != 0);
|
2001-06-05 17:05:51 +00:00
|
|
|
extraWidth->setEnabled(enable);
|
|
|
|
extraWidthL->setEnabled(enable);
|
|
|
|
extraUnit->setEnabled(enable);
|
|
|
|
extraUnitL->setEnabled(enable);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::enable_minipageOptions(int item)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2002-03-11 22:47:41 +00:00
|
|
|
minipageOptions->setEnabled( item == 1 );
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::enable_spacingAbove(int item)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2002-03-11 22:47:41 +00:00
|
|
|
bool const enable = (item == 6);
|
2001-06-05 17:05:51 +00:00
|
|
|
spacingAboveValue->setEnabled(enable);
|
|
|
|
spacingAbovePlus->setEnabled(enable);
|
|
|
|
spacingAboveMinus->setEnabled(enable);
|
|
|
|
spacingAboveValueUnit->setEnabled(enable);
|
|
|
|
spacingAbovePlusUnit->setEnabled(enable);
|
|
|
|
spacingAboveMinusUnit->setEnabled(enable);
|
|
|
|
spacingAboveUnitsL->setEnabled(enable);
|
2002-03-11 22:47:41 +00:00
|
|
|
bool const enablel = ( (item == 6) || (item != 6 && spacingBelow->currentItem() == 6) );
|
2001-06-05 17:05:51 +00:00
|
|
|
spacingValueL->setEnabled(enablel);
|
|
|
|
spacingPlusL->setEnabled(enablel);
|
|
|
|
spacingMinusL->setEnabled(enablel);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::enable_spacingBelow(int item)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2002-03-11 22:47:41 +00:00
|
|
|
bool const enable = (item == 6);
|
2001-06-05 17:05:51 +00:00
|
|
|
spacingBelowValue->setEnabled(enable);
|
|
|
|
spacingBelowPlus->setEnabled(enable);
|
|
|
|
spacingBelowMinus->setEnabled(enable);
|
|
|
|
spacingBelowValueUnit->setEnabled(enable);
|
|
|
|
spacingBelowPlusUnit->setEnabled(enable);
|
|
|
|
spacingBelowMinusUnit->setEnabled(enable);
|
|
|
|
spacingBelowUnitsL->setEnabled(enable);
|
2002-03-11 22:47:41 +00:00
|
|
|
bool const enablel = ( (item == 6) || (item!=6 && spacingAbove->currentItem() == 6) );
|
2001-06-05 17:05:51 +00:00
|
|
|
spacingValueL->setEnabled(enablel);
|
|
|
|
spacingPlusL->setEnabled(enablel);
|
|
|
|
spacingMinusL->setEnabled(enablel);
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::closeEvent(QCloseEvent * e)
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
form_->close();
|
|
|
|
e->accept();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::apply_adaptor()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
form_->apply();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::cancel_adaptor()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
form_->close();
|
|
|
|
hide();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::ok_adaptor()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
apply_adaptor();
|
|
|
|
form_->close();
|
|
|
|
hide();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|
|
|
|
|
2001-06-05 17:05:51 +00:00
|
|
|
|
2001-08-19 13:25:15 +00:00
|
|
|
void QParagraphDialog::restore_adaptor()
|
2001-02-14 19:43:56 +00:00
|
|
|
{
|
2001-06-05 17:05:51 +00:00
|
|
|
form_->update();
|
2001-02-14 19:43:56 +00:00
|
|
|
}
|