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) {
++i;
return (i < num_units) ? i : 0;
}
-
+
}
dialog_->rtXunit->insertItem((*it).c_str(), -1);
dialog_->rtYunit->insertItem((*it).c_str(), -1);
}
-
+
InsetGraphicsParams & igp = controller().params();
// set the right default unit
} else {
// get the values from the inset
LyXLength anyLength;
- string const xl(token(igp.bb,' ',0));
- string const yl(token(igp.bb,' ',1));
- string const xr(token(igp.bb,' ',2));
- string const yr(token(igp.bb,' ',3));
+ string const xl(token(igp.bb, ' ', 0));
+ string const yl(token(igp.bb, ' ', 1));
+ string const xr(token(igp.bb, ' ', 2));
+ string const yr(token(igp.bb, ' ', 3));
if (isValidLength(xl, &anyLength)) {
dialog_->lbX->setText(tostr(anyLength.value()).c_str());
string const unit(unit_name[anyLength.unit()]);
//// the output section (width/height)
// set the length combo boxes
// only the width has the possibility for scale%. The original
- // units are defined in lengthcommon.C
+ // units are defined in lengthcommon.C
// 1. the width (a listttype)
dialog_->widthUnit->clear();
dialog_->widthUnit->insertItem(_("Scale%"));
- for (int i = 0; i < num_units; i++)
+ 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)) {
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);
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())
dialog_->origin->setCurrentItem(
::getItemNo(origin_ltx, igp.rotateOrigin));
else
dialog_->origin->setCurrentItem(0);
- //// latex section
+ //// latex section
dialog_->latexoptions->setText(igp.special.c_str());
}
{
InsetGraphicsParams & igp = controller().params();
- igp.filename = dialog_->filename->text();
+ igp.filename = dialog_->filename->text().latin1();
// the bb section
igp.bb.erase();
if (controller().bbChanged) {
string bb;
- string lbX(dialog_->lbX->text());
- string lbY(dialog_->lbY->text());
- string rtX(dialog_->rtX->text());
- string rtY(dialog_->rtY->text());
- int bb_sum =
- strToInt(lbX) + strToInt(lbY) +
+ string lbX(dialog_->lbX->text().latin1());
+ string lbY(dialog_->lbY->text().latin1());
+ string rtX(dialog_->rtX->text().latin1());
+ string rtY(dialog_->rtY->text().latin1());
+ int bb_sum =
+ strToInt(lbX) + strToInt(lbY) +
strToInt(rtX) + strToInt(rtX);
if (bb_sum) {
if (lbX.empty())
bb = lbX + dialog_->lbXunit->currentText().latin1() + ' ';
if (lbY.empty())
bb += "0 ";
- else
+ else
bb += (lbY + dialog_->lbYunit->currentText().latin1() + ' ');
if (rtX.empty())
bb += "0 ";
- else
+ else
bb += (rtX + dialog_->rtXunit->currentText().latin1() + ' ');
if (rtY.empty())
- bb += "0";
- else
+ bb += '0';
+ else
bb += (rtY + dialog_->rtYunit->currentText().latin1());
igp.bb = bb;
}
igp.draft = dialog_->draftCB->isChecked();
igp.clip = dialog_->clip->isChecked();
igp.subcaption = dialog_->subfigure->isChecked();
- igp.subcaptionText = dialog_->subcaption->text();
+ igp.subcaptionText = dialog_->subcaption->text().latin1();
switch (dialog_->showCB->currentItem()) {
case 0: igp.display = grfx::DefaultDisplay; break;
if (!dialog_->displayCB->isChecked())
igp.display = grfx::NoDisplay;
- string value(dialog_->width->text());
+ string value(dialog_->width->text().latin1());
if (dialog_->widthUnit->currentItem() > 0) {
// width/height combination
- int const unitNo = getUnitNo(unit_name_gui,
- string(dialog_->widthUnit->currentText()));
+ int const unitNo = getUnitNo(unit_name_gui,
+ dialog_->widthUnit->currentText().latin1());
igp.width = LyXLength(value + unit_name_ltx[unitNo]);
- igp.scale = 0.0;
+ igp.scale = 0.0;
} else {
// scaling instead of a width
- igp.scale = strToDbl(value);
- igp.width = LyXLength();
+ igp.scale = strToDbl(value);
+ igp.width = LyXLength();
}
- value = string(dialog_->height->text());
- int const unitNo = getUnitNo(unit_name_gui,
- string(dialog_->heightUnit->currentText()));
+ value = dialog_->height->text().latin1();
+ int const unitNo = getUnitNo(unit_name_gui,
+ dialog_->heightUnit->currentText().latin1());
igp.height = LyXLength(value + unit_name_ltx[unitNo]);
igp.keepAspectRatio = dialog_->aspectratio->isChecked();
igp.noUnzip = dialog_->unzipCB->isChecked();
- igp.lyxscale = strToInt(string(dialog_->displayscale->text()));
+ igp.lyxscale = strToInt(dialog_->displayscale->text().latin1());
- igp.rotateAngle = strToDbl(string(dialog_->angle->text()));
+ igp.rotateAngle = strToDbl(dialog_->angle->text().latin1());
while (igp.rotateAngle < -360.0)
igp.rotateAngle += 360.0;
while (igp.rotateAngle > 360.0)
// save the latex name for the origin. If it is the default
// then origin_ltx returns ""
- igp.rotateOrigin =
+ igp.rotateOrigin =
QGraphics::origin_ltx[dialog_->origin->currentItem()];
// more latex options
- igp.special = dialog_->latexoptions->text();
+ igp.special = dialog_->latexoptions->text().latin1();
}
void QGraphics::getBB()
{
- string const filename(dialog_->filename->text());
+ string const filename(dialog_->filename->text().latin1());
if (!filename.empty()) {
string const bb(controller().readBB(filename));
if (!bb.empty()) {
bool QGraphics::isValid()
{
- // FIXME: we need more here.
- // why?? LaTeX needs a filename, the rest is user-specific (Herbert)
return !string(dialog_->filename->text().latin1()).empty();
}