static string const autostr = N_("automatically");
-} // namespace anon
+} // namespace
namespace lyx {
GuiGraphics::GuiGraphics(GuiView & lv)
- : GuiDialog(lv, "graphics", qt_("Graphics"))
+ : GuiDialog(lv, "graphics", qt_("Graphics")), bbChanged(false)
{
setupUi(this);
-
+
//main buttons
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
filename->setValidator(new PathValidator(true, filename));
setFocusProxy(filename);
- QDoubleValidator * scaleValidator =
+ QDoubleValidator * scaleValidator =
new DoubleAutoValidator(Scale, qt_(autostr));
scaleValidator->setBottom(0);
scaleValidator->setDecimals(256); //I guess that will do
//clipping pane
connect(clip, SIGNAL(stateChanged(int)),
this, SLOT(change_adaptor()));
- connect(lbY, SIGNAL(textChanged(const QString&)),
+ connect(lbY, SIGNAL(textChanged(const QString &)),
this, SLOT(changeBB()));
connect(lbYunit, SIGNAL(activated(int)),
this, SLOT(changeBB()));
- connect(rtY, SIGNAL(textChanged(const QString&)),
+ connect(rtY, SIGNAL(textChanged(const QString &)),
this, SLOT(changeBB()));
connect(rtYunit, SIGNAL(activated(int)),
this, SLOT(changeBB()));
- connect(lbX, SIGNAL(textChanged(const QString&)),
+ connect(lbX, SIGNAL(textChanged(const QString &)),
this, SLOT(changeBB()));
connect(lbXunit, SIGNAL(activated(int)),
this, SLOT(changeBB()));
- connect(rtX, SIGNAL(textChanged(const QString&)),
+ connect(rtX, SIGNAL(textChanged(const QString &)),
this, SLOT(changeBB()));
connect(rtXunit, SIGNAL(activated(int)),
this, SLOT(changeBB()));
rtY->setValidator(new QDoubleValidator(rtY));
//extra options pane
- connect(latexoptions, SIGNAL(textChanged(const QString&)),
+ connect(latexoptions, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
connect(draftCB, SIGNAL(stateChanged(int)),
this, SLOT(change_adaptor()));
- connect(unzipCB, SIGNAL(stateChanged(int)),
- this, SLOT(change_adaptor()));
// FIXME: we should connect to clicked() when we move to Qt 4.2 because
// the toggled(bool) signal is also trigged when we update the widgets
// (rgh-4/07) this isn't as much or a problem as it was, because we're now
// is clicked, even right clicked (I think), not just whenever it is
// toggled.
connect(displayGB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
- connect(displayscale, SIGNAL(textChanged(const QString&)),
+ connect(displayscale, SIGNAL(textChanged(const QString &)),
this, SLOT(change_adaptor()));
connect(groupCO, SIGNAL(currentIndexChanged(int)),
this, SLOT(changeGroup(int)));
bc().addReadOnly(filenameL);
bc().addReadOnly(filename);
bc().addReadOnly(browsePB);
- bc().addReadOnly(unzipCB);
bc().addReadOnly(bbFrame);
bc().addReadOnly(draftCB);
bc().addReadOnly(clip);
- bc().addReadOnly(unzipCB);
bc().addReadOnly(displayGB);
bc().addReadOnly(sizeGB);
bc().addReadOnly(rotationGB);
{
QString const new_group = groupCO->itemData(
groupCO->currentIndex()).toString();
-
+
// check if the old group consisted only of this member
if (current_group_ != fromqstr(new_group)
&& graphics::countGroupMembers(buffer(), current_group_) == 1) {
if (!new_group.isEmpty()) {
- if (Alert::prompt(_("Dissolve previous group?"),
+ if (Alert::prompt(_("Dissolve previous group?"),
bformat(_("If you assign this graphic to group '%2$s',\n"
"the previously assigned group '%1$s' will be dissolved,\n"
"because this graphic was its only member.\n"
return;
}
} else {
- if (Alert::prompt(_("Dissolve previous group?"),
+ if (Alert::prompt(_("Dissolve previous group?"),
bformat(_("If you sign off this graphic from group '%1$s',\n"
"the group will be dissolved,\n"
"because this graphic was its only member.\n"
return;
}
}
- }
+ }
if (new_group.isEmpty()) {
changed();
changed();
return;
}
-
+
// filename might have been changed
QString current_filename = filename->text();
InsetGraphics::string2params(grp, buffer(), params_);
paramsToDialog(params_);
groupCO->blockSignals(false);
-
+
// reset filename
filename->setText(current_filename);
if (newgroup.empty())
return;
if (groupCO->findData(toqstr(newgroup), Qt::MatchExactly) != -1) {
- Alert::warning(_("Group already defined!"),
+ Alert::warning(_("Group already defined!"),
bformat(_("A graphics group with the name '%1$s' already exists."),
newgroup));
return;
lbYunit->clear();
rtXunit->clear();
rtYunit->clear();
-
+
for (size_t i = 0; i < bb_size; i++) {
lbXunit->addItem(qt_(bb_units_gui[i]),
toqstr(bb_units[i]));
rtYunit->addItem(qt_(bb_units_gui[i]),
toqstr(bb_units[i]));
}
-
+
// set the right default unit
Length::UNIT const defaultUnit = Length::defaultUnit();
filename->setText(toqstr(name));
// set the bounding box values
- if (igp.bb.empty()) {
+ if (igp.bbox.empty()) {
string const bb = readBoundingBox(igp.filename.absFileName());
// the values from the file always have the bigpoint-unit bp
doubleToWidget(lbX, token(bb, ' ', 0));
bbChanged = false;
} else {
// get the values from the inset
- Length 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);
- if (isValidLength(xl, &anyLength)) {
- doubleToWidget(lbX, anyLength.value());
- string const unit = unit_name[anyLength.unit()];
- lbXunit->setCurrentIndex(lbXunit->findData(toqstr(unit)));
- } else {
- lbX->setText(toqstr(xl));
- }
- if (isValidLength(yl, &anyLength)) {
- doubleToWidget(lbY, anyLength.value());
- string const unit = unit_name[anyLength.unit()];
- lbYunit->setCurrentIndex(lbYunit->findData(toqstr(unit)));
- } else {
- lbY->setText(toqstr(xl));
- }
- if (isValidLength(xr, &anyLength)) {
- doubleToWidget(rtX, anyLength.value());
- string const unit = unit_name[anyLength.unit()];
- rtXunit->setCurrentIndex(rtXunit->findData(toqstr(unit)));
- } else {
- rtX->setText(toqstr(xl));
- }
- if (isValidLength(yr, &anyLength)) {
- doubleToWidget(rtY, anyLength.value());
- string const unit = unit_name[anyLength.unit()];
- rtYunit->setCurrentIndex(rtYunit->findData(toqstr(unit)));
- } else {
- rtY->setText(toqstr(xl));
- }
+ doubleToWidget(lbX, igp.bbox.xl.value());
+ string unit = unit_name[igp.bbox.xl.unit()];
+ lbXunit->setCurrentIndex(lbXunit->findData(toqstr(unit)));
+ doubleToWidget(lbY, igp.bbox.yb.value());
+ unit = unit_name[igp.bbox.yb.unit()];
+ lbYunit->setCurrentIndex(lbYunit->findData(toqstr(unit)));
+ doubleToWidget(rtX, igp.bbox.xr.value());
+ unit = unit_name[igp.bbox.xr.unit()];
+ rtXunit->setCurrentIndex(rtXunit->findData(toqstr(unit)));
+ doubleToWidget(rtY, igp.bbox.yt.value());
+ unit = unit_name[igp.bbox.yt.unit()];
+ rtYunit->setCurrentIndex(rtYunit->findData(toqstr(unit)));
bbChanged = true;
}
// Update the draft and clip mode
draftCB->setChecked(igp.draft);
clip->setChecked(igp.clip);
- unzipCB->setChecked(igp.noUnzip);
displayGB->setChecked(igp.display);
displayscale->setText(toqstr(convert<string>(igp.lyxscale)));
igp.filename.set(fromqstr(filename->text()), fromqstr(bufferFilePath()));
// the bb section
- igp.bb.erase();
+ igp.bbox = graphics::BoundingBox();
if (bbChanged) {
- string bb;
string lbXs = widgetToDoubleStr(lbX);
string lbYs = widgetToDoubleStr(lbY);
string rtXs = widgetToDoubleStr(rtX);
convert<int>(rtXs) + convert<int>(rtXs);
if (bb_sum) {
if (lbXs.empty())
- bb = "0 ";
- else
- bb = lbXs + fromqstr(lbXunit->currentText()) + ' ';
+ lbXs = "0";
+ igp.bbox.xl = Length(lbXs + fromqstr(lbXunit->currentText()));
if (lbYs.empty())
- bb += "0 ";
- else
- bb += (lbYs + fromqstr(lbYunit->currentText()) + ' ');
+ lbYs = "0";
+ igp.bbox.yb = Length(lbYs + fromqstr(lbYunit->currentText()));
if (rtXs.empty())
- bb += "0 ";
- else
- bb += (rtXs + fromqstr(rtXunit->currentText()) + ' ');
+ rtXs = "0";
+ igp.bbox.xr = Length(rtXs + fromqstr(rtXunit->currentText()));
if (rtYs.empty())
- bb += '0';
- else
- bb += (rtYs + fromqstr(rtYunit->currentText()));
- igp.bb = bb;
+ rtYs = "0";
+ igp.bbox.yt = Length(rtYs + fromqstr(rtYunit->currentText()));
}
}
igp.keepAspectRatio = aspectratio->isChecked();
}
- igp.noUnzip = unzipCB->isChecked();
igp.lyxscale = displayscale->text().toInt();
igp.rotateAngle = widgetToDoubleStr(angle);
clipdir = addName(package().system_support().absFileName(), "clipart");
return browseRelToParent(in_name, bufferFilePath(),
- title, fileFilters(QString()), false,
+ title, fileFilters(QString()), false,
qt_("Clipart|#C#c"), toqstr(clipdir),
qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
}