mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 22:41:09 +00:00
graphics fixes from herbert and me
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5660 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c671ab7924
commit
2e385ab589
@ -1,3 +1,7 @@
|
|||||||
|
2002-11-17 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
|
* QGraphics.C: some fixes from Herbert & me
|
||||||
|
|
||||||
2002-11-15 Juergen Spitzmueller <j.spitzmueller@gmx.de>
|
2002-11-15 Juergen Spitzmueller <j.spitzmueller@gmx.de>
|
||||||
|
|
||||||
* FileDialog.C: fix empty mask string
|
* FileDialog.C: fix empty mask string
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "Qt2BC.h"
|
#include "Qt2BC.h"
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
using std::endl;
|
||||||
|
|
||||||
typedef Qt2CB<ControlGraphics, Qt2DB<QGraphicsDialog> > base_class;
|
typedef Qt2CB<ControlGraphics, Qt2DB<QGraphicsDialog> > base_class;
|
||||||
|
|
||||||
@ -97,19 +98,34 @@ void QGraphics::build_dialog()
|
|||||||
bc().addReadOnly(dialog_->origin);
|
bc().addReadOnly(dialog_->origin);
|
||||||
bc().addReadOnly(dialog_->latexoptions);
|
bc().addReadOnly(dialog_->latexoptions);
|
||||||
bc().addReadOnly(dialog_->getPB);
|
bc().addReadOnly(dialog_->getPB);
|
||||||
|
}
|
||||||
|
|
||||||
using namespace frnt;
|
|
||||||
vector<RotationOriginPair> origindata = getRotationOriginData();
|
|
||||||
vector<string> const origin_lang = getFirst(origindata);
|
|
||||||
origin_ltx = getSecond(origindata);
|
|
||||||
// build the list
|
|
||||||
for (vector<string>::const_iterator it = origin_lang.begin();
|
|
||||||
it != origin_lang.end(); ++it) {
|
|
||||||
dialog_->origin->insertItem((*it).c_str(), -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// returns the number of the string s in the vector v
|
||||||
|
int getItemNo(vector<string> v, string const & s) {
|
||||||
|
vector<string>::const_iterator cit =
|
||||||
|
find(v.begin(), v.end(), s);
|
||||||
|
return (cit != v.end()) ? int(cit - v.begin()) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns the number of the unit in the array unit_name,
|
||||||
|
// which is defined in lengthcommon.C
|
||||||
|
int getUnitNo(char const * c[], string const & s) {
|
||||||
|
int i = 0;
|
||||||
|
while (i < num_units && s != c[i])
|
||||||
|
++i;
|
||||||
|
return (i < num_units) ? i : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void QGraphics::update_contents()
|
||||||
|
{
|
||||||
// clear and fill in the comboboxes
|
// clear and fill in the comboboxes
|
||||||
vector<string> const bb_units = getBBUnits();
|
vector<string> const bb_units = frnt::getBBUnits();
|
||||||
dialog_->lbXunit->clear();
|
dialog_->lbXunit->clear();
|
||||||
dialog_->lbYunit->clear();
|
dialog_->lbYunit->clear();
|
||||||
dialog_->rtXunit->clear();
|
dialog_->rtXunit->clear();
|
||||||
@ -122,53 +138,24 @@ void QGraphics::build_dialog()
|
|||||||
dialog_->rtYunit->insertItem((*it).c_str(), -1);
|
dialog_->rtYunit->insertItem((*it).c_str(), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
// returns the number of the string s in the vector v
|
|
||||||
int getItemNo(vector<string> v, string const & s) {
|
|
||||||
vector<string>::const_iterator cit =
|
|
||||||
find(v.begin(), v.end(), s);
|
|
||||||
if (cit != v.end())
|
|
||||||
return int(cit - v.begin());
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns the number of the unit in the array unit_name,
|
|
||||||
// which is defined in lengthcommon.C
|
|
||||||
int getUnitNo(string const & s) {
|
|
||||||
int i = 0;
|
|
||||||
while (i < num_units && s != unit_name[i])
|
|
||||||
++i;
|
|
||||||
return (i < num_units) ? i : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void QGraphics::update_contents()
|
|
||||||
{
|
|
||||||
InsetGraphicsParams & igp = controller().params();
|
InsetGraphicsParams & igp = controller().params();
|
||||||
|
|
||||||
// set the right default unit
|
// set the right default unit
|
||||||
string unitDefault("cm");
|
LyXLength::UNIT unitDefault = LyXLength::CM;
|
||||||
switch (lyxrc.default_papersize) {
|
switch (lyxrc.default_papersize) {
|
||||||
case BufferParams::PAPER_DEFAULT: break;
|
case BufferParams::PAPER_DEFAULT: break;
|
||||||
|
|
||||||
case BufferParams::PAPER_USLETTER:
|
case BufferParams::PAPER_USLETTER:
|
||||||
case BufferParams::PAPER_LEGALPAPER:
|
case BufferParams::PAPER_LEGALPAPER:
|
||||||
case BufferParams::PAPER_EXECUTIVEPAPER:
|
case BufferParams::PAPER_EXECUTIVEPAPER:
|
||||||
unitDefault = "in";
|
unitDefault = LyXLength::IN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BufferParams::PAPER_A3PAPER:
|
case BufferParams::PAPER_A3PAPER:
|
||||||
case BufferParams::PAPER_A4PAPER:
|
case BufferParams::PAPER_A4PAPER:
|
||||||
case BufferParams::PAPER_A5PAPER:
|
case BufferParams::PAPER_A5PAPER:
|
||||||
case BufferParams::PAPER_B5PAPER:
|
case BufferParams::PAPER_B5PAPER:
|
||||||
unitDefault = "cm";
|
unitDefault = LyXLength::CM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,17 +163,19 @@ void QGraphics::update_contents()
|
|||||||
|
|
||||||
// set the bounding box values
|
// set the bounding box values
|
||||||
if (igp.bb.empty()) {
|
if (igp.bb.empty()) {
|
||||||
controller().bbChanged = false;
|
|
||||||
string const bb = controller().readBB(igp.filename);
|
string const bb = controller().readBB(igp.filename);
|
||||||
// the values from the file always have the point-unit
|
// the values from the file always have the bigpoint-unit bp
|
||||||
dialog_->lbX->setText(token(bb, ' ', 0).c_str());
|
dialog_->lbX->setText(token(bb, ' ', 0).c_str());
|
||||||
dialog_->lbY->setText(token(bb, ' ', 1).c_str());
|
dialog_->lbY->setText(token(bb, ' ', 1).c_str());
|
||||||
dialog_->rtX->setText(token(bb, ' ', 2).c_str());
|
dialog_->rtX->setText(token(bb, ' ', 2).c_str());
|
||||||
dialog_->rtY->setText(token(bb, ' ', 3).c_str());
|
dialog_->rtY->setText(token(bb, ' ', 3).c_str());
|
||||||
|
dialog_->lbXunit->setCurrentItem(0);
|
||||||
|
dialog_->lbYunit->setCurrentItem(0);
|
||||||
|
dialog_->rtXunit->setCurrentItem(0);
|
||||||
|
dialog_->rtYunit->setCurrentItem(0);
|
||||||
|
controller().bbChanged = false;
|
||||||
} else {
|
} else {
|
||||||
// get the values from the inset
|
// get the values from the inset
|
||||||
controller().bbChanged = true;
|
|
||||||
vector<string> const bb_units = frnt::getBBUnits();
|
|
||||||
LyXLength anyLength;
|
LyXLength anyLength;
|
||||||
string const xl(token(igp.bb,' ',0));
|
string const xl(token(igp.bb,' ',0));
|
||||||
string const yl(token(igp.bb,' ',1));
|
string const yl(token(igp.bb,' ',1));
|
||||||
@ -220,6 +209,7 @@ void QGraphics::update_contents()
|
|||||||
} else {
|
} else {
|
||||||
dialog_->rtY->setText(xl.c_str());
|
dialog_->rtY->setText(xl.c_str());
|
||||||
}
|
}
|
||||||
|
controller().bbChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the draft and clip mode
|
// Update the draft and clip mode
|
||||||
@ -245,15 +235,16 @@ void QGraphics::update_contents()
|
|||||||
dialog_->displayscale->setEnabled(igp.display != grfx::NoDisplay && !readOnly());
|
dialog_->displayscale->setEnabled(igp.display != grfx::NoDisplay && !readOnly());
|
||||||
dialog_->displayscale->setText(tostr(igp.lyxscale).c_str());
|
dialog_->displayscale->setText(tostr(igp.lyxscale).c_str());
|
||||||
|
|
||||||
// the output section
|
//// the output section (width/height)
|
||||||
// set the length combo boxes
|
// set the length combo boxes
|
||||||
// only the width has the possibility for scale%. The original
|
// only the width has the possibility for scale%. The original
|
||||||
// units are defined in lengthcommon.C
|
// units are defined in lengthcommon.C
|
||||||
dialog_->widthUnit->insertItem("Scale%");
|
// 1. the width (a listttype)
|
||||||
for (int i = 0; i < num_units; i++) {
|
dialog_->widthUnit->clear();
|
||||||
dialog_->widthUnit->insertItem(unit_name[i], -1);
|
dialog_->widthUnit->insertItem(_("Scale%"));
|
||||||
dialog_->heightUnit->insertItem(unit_name[i], -1);
|
for (int i = 0; i < num_units; i++)
|
||||||
}
|
dialog_->widthUnit->insertItem(unit_name_gui[i], -1);
|
||||||
|
|
||||||
if (!lyx::float_equal(igp.scale, 0.0, 0.05)) {
|
if (!lyx::float_equal(igp.scale, 0.0, 0.05)) {
|
||||||
// there is a scale value > 0.05
|
// there is a scale value > 0.05
|
||||||
dialog_->width->setText(tostr(igp.scale).c_str());
|
dialog_->width->setText(tostr(igp.scale).c_str());
|
||||||
@ -261,15 +252,17 @@ void QGraphics::update_contents()
|
|||||||
} else {
|
} else {
|
||||||
// no scale means default width/height
|
// no scale means default width/height
|
||||||
dialog_->width->setText(tostr(igp.width.value()).c_str());
|
dialog_->width->setText(tostr(igp.width.value()).c_str());
|
||||||
string const widthUnit = (igp.width.value() > 0.0) ?
|
// the width cannot have a unitDefault, because
|
||||||
unit_name[igp.width.unit()] : unitDefault;
|
// it is a "Scale%" or another user defined unit!
|
||||||
// +1 instead of the "Scale%" option
|
// +1 instead of the "Scale%" option
|
||||||
dialog_->widthUnit->setCurrentItem(getUnitNo(widthUnit) + 1);
|
int unit_ = igp.width.unit();
|
||||||
|
dialog_->widthUnit->setCurrentItem(unit_ + 1);
|
||||||
}
|
}
|
||||||
|
// 2. the height (a lengthgcombo type)
|
||||||
dialog_->height->setText(tostr(igp.height.value()).c_str());
|
dialog_->height->setText(tostr(igp.height.value()).c_str());
|
||||||
string const heightUnit = (igp.height.value() > 0.0) ?
|
LyXLength::UNIT unit_ = (igp.height.value() > 0.0) ?
|
||||||
unit_name[igp.height.unit()] : unitDefault;
|
igp.height.unit() : unitDefault;
|
||||||
dialog_->heightUnit->setCurrentItem(getUnitNo(heightUnit));
|
dialog_->heightUnit->setCurrentItem(unit_);
|
||||||
|
|
||||||
// enable height input in case of non "Scale%" as width-unit
|
// enable height input in case of non "Scale%" as width-unit
|
||||||
bool use_height = (dialog_->widthUnit->currentItem() > 0);
|
bool use_height = (dialog_->widthUnit->currentItem() > 0);
|
||||||
@ -280,9 +273,22 @@ void QGraphics::update_contents()
|
|||||||
|
|
||||||
dialog_->angle->setText(tostr(igp.rotateAngle).c_str());
|
dialog_->angle->setText(tostr(igp.rotateAngle).c_str());
|
||||||
|
|
||||||
|
dialog_->origin->clear();
|
||||||
|
|
||||||
|
using namespace frnt;
|
||||||
|
vector<RotationOriginPair> origindata = getRotationOriginData();
|
||||||
|
vector<string> const origin_lang = getFirst(origindata);
|
||||||
|
QGraphics::origin_ltx = getSecond(origindata);
|
||||||
|
|
||||||
|
for (vector<string>::const_iterator it = origin_lang.begin();
|
||||||
|
it != origin_lang.end(); ++it)
|
||||||
|
dialog_->origin->insertItem((*it).c_str(), -1);
|
||||||
|
|
||||||
if (!igp.rotateOrigin.empty())
|
if (!igp.rotateOrigin.empty())
|
||||||
dialog_->origin->setCurrentItem(
|
dialog_->origin->setCurrentItem(
|
||||||
::getItemNo(origin_ltx, igp.rotateOrigin));
|
::getItemNo(origin_ltx, igp.rotateOrigin));
|
||||||
|
else
|
||||||
|
dialog_->origin->setCurrentItem(0);
|
||||||
|
|
||||||
//// latex section
|
//// latex section
|
||||||
dialog_->latexoptions->setText(igp.special.c_str());
|
dialog_->latexoptions->setText(igp.special.c_str());
|
||||||
@ -296,33 +302,35 @@ void QGraphics::apply()
|
|||||||
igp.filename = dialog_->filename->text();
|
igp.filename = dialog_->filename->text();
|
||||||
|
|
||||||
// the bb section
|
// the bb section
|
||||||
if (!controller().bbChanged) {
|
igp.bb.erase();
|
||||||
// don't write anything
|
if (controller().bbChanged) {
|
||||||
igp.bb.erase();
|
|
||||||
} else if (dialog_->clip->isChecked()) {
|
|
||||||
string bb;
|
string bb;
|
||||||
string lbX(dialog_->lbX->text());
|
string lbX(dialog_->lbX->text());
|
||||||
string lbY(dialog_->lbY->text());
|
string lbY(dialog_->lbY->text());
|
||||||
string rtX(dialog_->rtX->text());
|
string rtX(dialog_->rtX->text());
|
||||||
string rtY(dialog_->rtY->text());
|
string rtY(dialog_->rtY->text());
|
||||||
|
int bb_sum =
|
||||||
if (lbX.empty())
|
strToInt(lbX) + strToInt(lbY) +
|
||||||
bb = "0 ";
|
strToInt(rtX) + strToInt(rtX);
|
||||||
else
|
if (bb_sum) {
|
||||||
bb = lbX + dialog_->lbXunit->currentText().latin1() + ' ';
|
if (lbX.empty())
|
||||||
if (lbY.empty())
|
bb = "0 ";
|
||||||
bb += "0 ";
|
else
|
||||||
else
|
bb = lbX + dialog_->lbXunit->currentText().latin1() + ' ';
|
||||||
bb += (lbY + dialog_->lbYunit->currentText().latin1() + ' ');
|
if (lbY.empty())
|
||||||
if (rtX.empty())
|
bb += "0 ";
|
||||||
bb += "0 ";
|
else
|
||||||
else
|
bb += (lbY + dialog_->lbYunit->currentText().latin1() + ' ');
|
||||||
bb += (rtX + dialog_->rtXunit->currentText().latin1() + ' ');
|
if (rtX.empty())
|
||||||
if (rtY.empty())
|
bb += "0 ";
|
||||||
bb += "0";
|
else
|
||||||
else
|
bb += (rtX + dialog_->rtXunit->currentText().latin1() + ' ');
|
||||||
bb += (rtY + dialog_->rtYunit->currentText().latin1());
|
if (rtY.empty())
|
||||||
igp.bb = bb;
|
bb += "0";
|
||||||
|
else
|
||||||
|
bb += (rtY + dialog_->rtYunit->currentText().latin1());
|
||||||
|
igp.bb = bb;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
igp.draft = dialog_->draftCB->isChecked();
|
igp.draft = dialog_->draftCB->isChecked();
|
||||||
@ -344,8 +352,9 @@ void QGraphics::apply()
|
|||||||
string value(dialog_->width->text());
|
string value(dialog_->width->text());
|
||||||
if (dialog_->widthUnit->currentItem() > 0) {
|
if (dialog_->widthUnit->currentItem() > 0) {
|
||||||
// width/height combination
|
// width/height combination
|
||||||
string const unit(dialog_->widthUnit->currentText());
|
int const unitNo = getUnitNo(unit_name_gui,
|
||||||
igp.width = LyXLength(value + unit);
|
string(dialog_->widthUnit->currentText()));
|
||||||
|
igp.width = LyXLength(value + unit_name_ltx[unitNo]);
|
||||||
igp.scale = 0.0;
|
igp.scale = 0.0;
|
||||||
} else {
|
} else {
|
||||||
// scaling instead of a width
|
// scaling instead of a width
|
||||||
@ -353,8 +362,9 @@ void QGraphics::apply()
|
|||||||
igp.width = LyXLength();
|
igp.width = LyXLength();
|
||||||
}
|
}
|
||||||
value = string(dialog_->height->text());
|
value = string(dialog_->height->text());
|
||||||
string const unit = string(dialog_->heightUnit->currentText());
|
int const unitNo = getUnitNo(unit_name_gui,
|
||||||
igp.height = LyXLength(value + unit);
|
string(dialog_->heightUnit->currentText()));
|
||||||
|
igp.height = LyXLength(value + unit_name_ltx[unitNo]);
|
||||||
|
|
||||||
igp.keepAspectRatio = dialog_->aspectratio->isChecked();
|
igp.keepAspectRatio = dialog_->aspectratio->isChecked();
|
||||||
|
|
||||||
@ -370,7 +380,8 @@ void QGraphics::apply()
|
|||||||
|
|
||||||
// save the latex name for the origin. If it is the default
|
// save the latex name for the origin. If it is the default
|
||||||
// then origin_ltx returns ""
|
// then origin_ltx returns ""
|
||||||
igp.rotateOrigin = origin_ltx[dialog_->origin->currentItem()];
|
igp.rotateOrigin =
|
||||||
|
QGraphics::origin_ltx[dialog_->origin->currentItem()];
|
||||||
|
|
||||||
// more latex options
|
// more latex options
|
||||||
igp.special = dialog_->latexoptions->text();
|
igp.special = dialog_->latexoptions->text();
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include <qfiledialog.h>
|
#include <qfiledialog.h>
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
|
|
||||||
|
#include "lengthcombo.h"
|
||||||
|
|
||||||
#include "QGraphicsDialog.h"
|
#include "QGraphicsDialog.h"
|
||||||
#include "QGraphics.h"
|
#include "QGraphics.h"
|
||||||
|
|
||||||
@ -64,6 +66,8 @@ void QGraphicsDialog::change_adaptor()
|
|||||||
void QGraphicsDialog::change_bb()
|
void QGraphicsDialog::change_bb()
|
||||||
{
|
{
|
||||||
form_->controller().bbChanged = true;
|
form_->controller().bbChanged = true;
|
||||||
|
lyxerr[Debug::GRAPHICS]
|
||||||
|
<< "[controller().bb_Changed set to true]\n";
|
||||||
form_->changed();
|
form_->changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,6 +77,7 @@ void QGraphicsDialog::change_WUnit()
|
|||||||
bool useHeight = (widthUnit->currentItem() > 0);
|
bool useHeight = (widthUnit->currentItem() > 0);
|
||||||
height->setEnabled(useHeight);
|
height->setEnabled(useHeight);
|
||||||
heightUnit->setEnabled(useHeight);
|
heightUnit->setEnabled(useHeight);
|
||||||
|
form_->changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
* \author John Levon
|
* \author John Levon
|
||||||
|
* \author Herbert Voss
|
||||||
*
|
*
|
||||||
* Full author contact details are available in file CREDITS
|
* Full author contact details are available in file CREDITS
|
||||||
*/
|
*/
|
||||||
@ -14,64 +15,29 @@
|
|||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gettext.h"
|
|
||||||
|
|
||||||
#include "lengthcombo.h"
|
#include "lengthcombo.h"
|
||||||
|
|
||||||
#include <qwhatsthis.h>
|
#include <qwhatsthis.h>
|
||||||
|
|
||||||
|
#include "lengthcommon.h"
|
||||||
|
#include "gettext.h"
|
||||||
|
|
||||||
|
|
||||||
LengthCombo::LengthCombo(QWidget * parent, char * name)
|
LengthCombo::LengthCombo(QWidget * parent, char * name)
|
||||||
: QComboBox(parent, name)
|
: QComboBox(parent, name)
|
||||||
{
|
{
|
||||||
// FIXME: check these should all be here, I think not
|
for (int i=0; i < num_units; i++)
|
||||||
insertItem(_("cm"));
|
insertItem(unit_name_gui[i]);
|
||||||
insertItem(_("in"));
|
|
||||||
insertItem(_("pt"));
|
|
||||||
insertItem(_("mm"));
|
|
||||||
insertItem(_("pc"));
|
|
||||||
insertItem(_("ex"));
|
|
||||||
insertItem(_("em"));
|
|
||||||
insertItem(_("sp"));
|
|
||||||
insertItem(_("bp"));
|
|
||||||
insertItem(_("dd"));
|
|
||||||
insertItem(_("cc"));
|
|
||||||
insertItem(_("mu"));
|
|
||||||
insertItem(_("%p"));
|
|
||||||
insertItem(_("%c"));
|
|
||||||
insertItem(_("%l"));
|
|
||||||
|
|
||||||
connect(this, SIGNAL(activated(int)),
|
connect(this, SIGNAL(activated(int)),
|
||||||
this, SLOT(has_activated(int)));
|
this, SLOT(has_activated(int)));
|
||||||
|
|
||||||
QWhatsThis::add(this, _("FIXME - describe the units."));
|
QWhatsThis::add(this, _("Choose one of the units or relative lengths"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LyXLength::UNIT LengthCombo::currentLengthItem() const
|
LyXLength::UNIT LengthCombo::currentLengthItem() const
|
||||||
{
|
{
|
||||||
LyXLength::UNIT unit;
|
return static_cast<LyXLength::UNIT>(currentItem());
|
||||||
int i = currentItem();
|
|
||||||
switch (i) {
|
|
||||||
default:
|
|
||||||
case 0: unit = LyXLength::CM; break;
|
|
||||||
case 1: unit = LyXLength::IN; break;
|
|
||||||
case 2: unit = LyXLength::PT; break;
|
|
||||||
case 3: unit = LyXLength::MM; break;
|
|
||||||
case 4: unit = LyXLength::PC; break;
|
|
||||||
case 5: unit = LyXLength::EX; break;
|
|
||||||
case 6: unit = LyXLength::EM; break;
|
|
||||||
case 7: unit = LyXLength::SP; break;
|
|
||||||
case 8: unit = LyXLength::BP; break;
|
|
||||||
case 9: unit = LyXLength::DD; break;
|
|
||||||
case 10: unit = LyXLength::CC; break;
|
|
||||||
case 11: unit = LyXLength::MU; break;
|
|
||||||
case 12: unit = LyXLength::PPW; break;
|
|
||||||
case 13: unit = LyXLength::PCW; break;
|
|
||||||
case 14: unit = LyXLength::PLW; break;
|
|
||||||
// FIXME: LyXLength::PTW ?
|
|
||||||
};
|
|
||||||
return unit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -83,25 +49,12 @@ void LengthCombo::has_activated(int)
|
|||||||
|
|
||||||
void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
|
void LengthCombo::setCurrentItem(LyXLength::UNIT unit)
|
||||||
{
|
{
|
||||||
int i;
|
QComboBox::setCurrentItem(int(unit));
|
||||||
switch (unit) {
|
|
||||||
default:
|
|
||||||
case LyXLength::CM: i = 0; break;
|
|
||||||
case LyXLength::IN: i = 1; break;
|
|
||||||
case LyXLength::PT: i = 2; break;
|
|
||||||
case LyXLength::MM: i = 3; break;
|
|
||||||
case LyXLength::PC: i = 4; break;
|
|
||||||
case LyXLength::EX: i = 5; break;
|
|
||||||
case LyXLength::EM: i = 6; break;
|
|
||||||
case LyXLength::SP: i = 7; break;
|
|
||||||
case LyXLength::BP: i = 8; break;
|
|
||||||
case LyXLength::DD: i = 9; break;
|
|
||||||
case LyXLength::CC: i = 10; break;
|
|
||||||
case LyXLength::MU: i = 11; break;
|
|
||||||
case LyXLength::PPW: i = 12; break;
|
|
||||||
case LyXLength::PCW: i = 13; break;
|
|
||||||
case LyXLength::PLW: i = 14; break;
|
|
||||||
// FIXME: LyXLength::PTW ?
|
|
||||||
}
|
|
||||||
QComboBox::setCurrentItem(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LengthCombo::setEnabled(bool b)
|
||||||
|
{
|
||||||
|
QComboBox::setEnabled(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -30,9 +30,11 @@ public:
|
|||||||
|
|
||||||
/// set the current item
|
/// set the current item
|
||||||
virtual void setCurrentItem(LyXLength::UNIT unit);
|
virtual void setCurrentItem(LyXLength::UNIT unit);
|
||||||
|
|
||||||
/// get the current item
|
/// get the current item
|
||||||
LyXLength::UNIT currentLengthItem() const;
|
LyXLength::UNIT currentLengthItem() const;
|
||||||
|
/// enable the widget
|
||||||
|
virtual void setEnabled(bool b);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void has_activated(int index);
|
virtual void has_activated(int index);
|
||||||
signals:
|
signals:
|
||||||
|
@ -340,11 +340,33 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget>
|
<widget>
|
||||||
<class>QComboBox</class>
|
<class>LengthCombo</class>
|
||||||
<property stdset="1">
|
<property stdset="1">
|
||||||
<name>name</name>
|
<name>name</name>
|
||||||
<cstring>heightUnit</cstring>
|
<cstring>heightUnit</cstring>
|
||||||
</property>
|
</property>
|
||||||
|
<property stdset="1">
|
||||||
|
<name>sizePolicy</name>
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>3</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property stdset="1">
|
||||||
|
<name>minimumSize</name>
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>22</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property stdset="1">
|
||||||
|
<name>focusPolicy</name>
|
||||||
|
<enum>StrongFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>toolTip</name>
|
||||||
|
<string>Units of height value</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</hbox>
|
</hbox>
|
||||||
</widget>
|
</widget>
|
||||||
@ -601,7 +623,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>toolTip</name>
|
<name>toolTip</name>
|
||||||
<string>Clip to bounding box (FIXME: what ??)</string>
|
<string>Clip to bounding box values</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<spacer>
|
<spacer>
|
||||||
@ -1176,6 +1198,29 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</vbox>
|
</vbox>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>LengthCombo</class>
|
||||||
|
<header location="local">lengthcombo.h</header>
|
||||||
|
<sizehint>
|
||||||
|
<width>-1</width>
|
||||||
|
<height>-1</height>
|
||||||
|
</sizehint>
|
||||||
|
<container>0</container>
|
||||||
|
<sizepolicy>
|
||||||
|
<hordata>5</hordata>
|
||||||
|
<verdata>5</verdata>
|
||||||
|
</sizepolicy>
|
||||||
|
<pixmap>image0</pixmap>
|
||||||
|
<signal>selectionChanged(LyXLength::UNIT)</signal>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<images>
|
||||||
|
<image>
|
||||||
|
<name>image0</name>
|
||||||
|
<data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data>
|
||||||
|
</image>
|
||||||
|
</images>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>subfigure</sender>
|
<sender>subfigure</sender>
|
||||||
@ -1225,48 +1270,6 @@
|
|||||||
<receiver>QGraphicsDialogBase</receiver>
|
<receiver>QGraphicsDialogBase</receiver>
|
||||||
<slot>change_bb()</slot>
|
<slot>change_bb()</slot>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<sender>lbY</sender>
|
|
||||||
<signal>textChanged(const QString&)</signal>
|
|
||||||
<receiver>QGraphicsDialogBase</receiver>
|
|
||||||
<slot>change_bb()</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>rtX</sender>
|
|
||||||
<signal>textChanged(const QString&)</signal>
|
|
||||||
<receiver>QGraphicsDialogBase</receiver>
|
|
||||||
<slot>change_bb()</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>rtY</sender>
|
|
||||||
<signal>textChanged(const QString&)</signal>
|
|
||||||
<receiver>QGraphicsDialogBase</receiver>
|
|
||||||
<slot>change_bb()</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>lbXunit</sender>
|
|
||||||
<signal>activated(int)</signal>
|
|
||||||
<receiver>QGraphicsDialogBase</receiver>
|
|
||||||
<slot>change_bb()</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>lbYunit</sender>
|
|
||||||
<signal>activated(int)</signal>
|
|
||||||
<receiver>QGraphicsDialogBase</receiver>
|
|
||||||
<slot>change_bb()</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>rtXunit</sender>
|
|
||||||
<signal>activated(int)</signal>
|
|
||||||
<receiver>QGraphicsDialogBase</receiver>
|
|
||||||
<slot>change_bb()</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>rtYunit</sender>
|
|
||||||
<signal>activated(int)</signal>
|
|
||||||
<receiver>QGraphicsDialogBase</receiver>
|
|
||||||
<slot>change_bb()</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>showCB</sender>
|
<sender>showCB</sender>
|
||||||
<signal>activated(int)</signal>
|
<signal>activated(int)</signal>
|
||||||
@ -1333,12 +1336,6 @@
|
|||||||
<receiver>QGraphicsDialogBase</receiver>
|
<receiver>QGraphicsDialogBase</receiver>
|
||||||
<slot>change_adaptor()</slot>
|
<slot>change_adaptor()</slot>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<sender>heightUnit</sender>
|
|
||||||
<signal>activated(int)</signal>
|
|
||||||
<receiver>QGraphicsDialogBase</receiver>
|
|
||||||
<slot>change_adaptor()</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>angle</sender>
|
<sender>angle</sender>
|
||||||
<signal>textChanged(const QString&)</signal>
|
<signal>textChanged(const QString&)</signal>
|
||||||
@ -1351,24 +1348,6 @@
|
|||||||
<receiver>QGraphicsDialogBase</receiver>
|
<receiver>QGraphicsDialogBase</receiver>
|
||||||
<slot>change_adaptor()</slot>
|
<slot>change_adaptor()</slot>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<sender>rtX</sender>
|
|
||||||
<signal>textChanged(const QString&)</signal>
|
|
||||||
<receiver>QGraphicsDialogBase</receiver>
|
|
||||||
<slot>change_adaptor()</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>rtY</sender>
|
|
||||||
<signal>textChanged(const QString&)</signal>
|
|
||||||
<receiver>QGraphicsDialogBase</receiver>
|
|
||||||
<slot>change_adaptor()</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>lbY</sender>
|
|
||||||
<signal>textChanged(const QString&)</signal>
|
|
||||||
<receiver>QGraphicsDialogBase</receiver>
|
|
||||||
<slot>change_adaptor()</slot>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>getPB</sender>
|
<sender>getPB</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>clicked()</signal>
|
||||||
@ -1381,6 +1360,48 @@
|
|||||||
<receiver>QGraphicsDialogBase</receiver>
|
<receiver>QGraphicsDialogBase</receiver>
|
||||||
<slot>change_adaptor()</slot>
|
<slot>change_adaptor()</slot>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>lbY</sender>
|
||||||
|
<signal>textChanged(const QString&)</signal>
|
||||||
|
<receiver>QGraphicsDialogBase</receiver>
|
||||||
|
<slot>change_bb()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>rtX</sender>
|
||||||
|
<signal>textChanged(const QString&)</signal>
|
||||||
|
<receiver>QGraphicsDialogBase</receiver>
|
||||||
|
<slot>change_bb()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>rtY</sender>
|
||||||
|
<signal>textChanged(const QString&)</signal>
|
||||||
|
<receiver>QGraphicsDialogBase</receiver>
|
||||||
|
<slot>change_bb()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>lbXunit</sender>
|
||||||
|
<signal>activated(int)</signal>
|
||||||
|
<receiver>QGraphicsDialogBase</receiver>
|
||||||
|
<slot>change_bb()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>lbYunit</sender>
|
||||||
|
<signal>activated(int)</signal>
|
||||||
|
<receiver>QGraphicsDialogBase</receiver>
|
||||||
|
<slot>change_bb()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>rtXunit</sender>
|
||||||
|
<signal>activated(int)</signal>
|
||||||
|
<receiver>QGraphicsDialogBase</receiver>
|
||||||
|
<slot>change_bb()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>rtYunit</sender>
|
||||||
|
<signal>activated(int)</signal>
|
||||||
|
<receiver>QGraphicsDialogBase</receiver>
|
||||||
|
<slot>change_bb()</slot>
|
||||||
|
</connection>
|
||||||
<slot access="protected">browse_clicked()</slot>
|
<slot access="protected">browse_clicked()</slot>
|
||||||
<slot access="protected">getBB_clicked()</slot>
|
<slot access="protected">getBB_clicked()</slot>
|
||||||
<slot access="protected">change_adaptor()</slot>
|
<slot access="protected">change_adaptor()</slot>
|
||||||
|
@ -2,15 +2,48 @@
|
|||||||
|
|
||||||
#include "lengthcommon.h"
|
#include "lengthcommon.h"
|
||||||
|
|
||||||
|
#include "gettext.h"
|
||||||
|
|
||||||
|
|
||||||
int const num_units = LyXLength::UNIT_NONE;
|
int const num_units = LyXLength::UNIT_NONE;
|
||||||
|
|
||||||
// I am not sure if "mu" should be possible to select (Lgb)
|
// I am not sure if "mu" should be possible to select (Lgb)
|
||||||
|
|
||||||
|
// unit_name is for compatibility. Can be deleted when all works well.
|
||||||
|
// means, when we have full language support for the lengths
|
||||||
|
// in all gui's (Herbert 2002-11-01)
|
||||||
char const * unit_name[num_units] = {
|
char const * unit_name[num_units] = {
|
||||||
"sp", "pt", "bp", "dd", "mm", "pc", "cc", "cm",
|
"sp", "pt", "bp", "dd", "mm", "pc",
|
||||||
"in", "ex", "em", "mu",
|
"cc", "cm", "in", "ex", "em", "mu",
|
||||||
"text%", "col%", "page%", "line%",
|
"text%", "col%", "page%", "line%",
|
||||||
"theight%", "pheight%" };
|
"theight%", "pheight%" };
|
||||||
|
|
||||||
|
// the latex units
|
||||||
|
char const * unit_name_ltx[num_units] = {
|
||||||
|
"sp", "pt", "bp", "dd", "mm", "pc",
|
||||||
|
"cc", "cm", "in", "ex", "em", "mu",
|
||||||
|
// in 1.4 the following names should be used. then no
|
||||||
|
// translation into the latex ones are needed
|
||||||
|
// "textheight", "columnwidth", "pagewidth", "linewidth",
|
||||||
|
// "textheight", "pageheight" };
|
||||||
|
"text%", "col%", "page%", "line%",
|
||||||
|
"theight%", "pheight%" };
|
||||||
|
|
||||||
|
// the LyX gui units
|
||||||
|
char const * unit_name_gui[num_units] = {
|
||||||
|
N_("sp"), N_("pt"), N_("bp"), N_("dd"), N_("mm"), N_("pc"),
|
||||||
|
N_("cc"), N_("cm"), N_("in"), N_("ex"), N_("em"), N_("mu"),
|
||||||
|
N_("text%"), N_("col%"), N_("page%"), N_("line%"),
|
||||||
|
N_("theight%"), N_("pheight%") };
|
||||||
|
|
||||||
|
// this one maybe better ???? but there can be problems with
|
||||||
|
// xforms (Herbert)
|
||||||
|
// N_("textwidth%"), N_("columnwidth%"), N_("pagewidth%"), N_("linewidth%"),
|
||||||
|
// N_("textheight%"), N_("pageheight%") };
|
||||||
|
|
||||||
|
// or altenative this ones
|
||||||
|
// N_("twidth%"), N_("cwidth%"), N_("pwidth%"), N_("lwidth%"),
|
||||||
|
// N_("theight%"), N_("pheight%") };
|
||||||
|
|
||||||
LyXLength::UNIT unitFromString(string const & data)
|
LyXLength::UNIT unitFromString(string const & data)
|
||||||
{
|
{
|
||||||
@ -19,3 +52,4 @@ LyXLength::UNIT unitFromString(string const & data)
|
|||||||
++i;
|
++i;
|
||||||
return static_cast<LyXLength::UNIT>(i);
|
return static_cast<LyXLength::UNIT>(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,8 +15,11 @@ extern int const num_units;
|
|||||||
* FIXME: I am not sure if "mu" should be possible to select (Lgb)
|
* FIXME: I am not sure if "mu" should be possible to select (Lgb)
|
||||||
*/
|
*/
|
||||||
extern char const * unit_name[];
|
extern char const * unit_name[];
|
||||||
|
extern char const * unit_name_gui[];
|
||||||
|
extern char const * unit_name_ltx[];
|
||||||
|
|
||||||
/// return the unit given a string representation such as "cm"
|
/// return the unit given a string representation such as "cm"
|
||||||
LyXLength::UNIT unitFromString(string const & data);
|
LyXLength::UNIT unitFromString(string const & data);
|
||||||
|
|
||||||
|
|
||||||
#endif // LENGTH_COMMON_H
|
#endif // LENGTH_COMMON_H
|
||||||
|
Loading…
Reference in New Issue
Block a user