if (!lyxrc.show_banner)
return;
/// The text to be written on top of the pixmap
+ QString const htext = qt_("The Document\nProcessor[[welcome banner]]");
+ QString const htextsize = qt_("1.0[[possibly scale the welcome banner text size]]");
+ /// The text to be written on top of the pixmap
QString const text = lyx_version ?
qt_("version ") + lyx_version : qt_("unknown version");
#if QT_VERSION >= 0x050000
QPainter pain(&splash_);
pain.setPen(QColor(0, 0, 0));
qreal const fsize = fontSize();
- QPointF const position = textPosition();
+ bool ok;
+ int hfsize = 20;
+ qreal locscale = htextsize.toFloat(&ok);
+ if (!ok)
+ locscale = 1.0;
+ QPointF const position = textPosition(false);
+ QPointF const hposition = textPosition(true);
+ QRectF const hrect(hposition, splashSize());
LYXERR(Debug::GUI,
"widget pixel ratio: " << pixelRatio() <<
" splash pixel ratio: " << splashPixelRatio() <<
font.setPointSizeF(fsize);
pain.setFont(font);
pain.drawText(position, text);
+ // The font used to display the version info
+ font.setStyleHint(QFont::SansSerif);
+ font.setWeight(QFont::Normal);
+ font.setPointSizeF(hfsize);
+ // Check how long the logo gets with the current font
+ // and adapt if the font is running wider than what
+ // we assume
+ QFontMetrics fm(font);
+ // Split the title into lines to measure the longest line
+ // in the current l7n.
+ QStringList titlesegs = htext.split('\n');
+ int wline = 0;
+ int hline = fm.height();
+ QStringList::const_iterator sit;
+ for (sit = titlesegs.constBegin(); sit != titlesegs.constEnd(); ++sit) {
+ if (fm.width(*sit) > wline)
+ wline = fm.width(*sit);
+ }
+ // The longest line in the reference font (for English)
+ // is 180. Calculate scale factor from that.
+ double const wscale = wline > 0 ? (180.0 / wline) : 1;
+ // Now do the same for the height (necessary for condensed fonts)
+ double const hscale = (34.0 / hline);
+ // take the lower of the two scale factors.
+ double const scale = min(wscale, hscale);
+ // Now rescale. Also consider l7n's offset factor.
+ font.setPointSizeF(hfsize * scale * locscale);
+
+ pain.setFont(font);
+ pain.drawText(hrect, Qt::AlignLeft, htext);
setFocusPolicy(Qt::StrongFocus);
}
return toqstr(lyxrc.font_sizes[FONT_SIZE_NORMAL]).toDouble();
}
- QPointF textPosition() const {
- return QPointF(width_/2 - 18, height_/2 + 45);
+ QPointF textPosition(bool const heading) const {
+ return heading ? QPointF(width_/2 - 18, height_/2 - 45)
+ : QPointF(width_/2 - 18, height_/2 + 45);
}
QSize splashSize() const {
bool const error = (status != Buffer::ExportSuccess &&
status != Buffer::PreviewSuccess &&
status != Buffer::ExportCancel);
- if (error) {
+ if (error && bv) {
ErrorList & el = bv->buffer().errorList(d.last_export_format);
// at this point, we do not know if buffer-view or
// master-buffer-view was called. If there was an export error,
#if EXPORT_in_THREAD
if (allow_async) {
GuiViewPrivate::busyBuffers.insert(used_buffer);
- Buffer * cloned_buffer = used_buffer->cloneFromMaster();
+ Buffer * cloned_buffer = used_buffer->cloneWithChildren();
if (!cloned_buffer) {
Alert::error(_("Export Error"),
- _("Error cloning the Buffer."));
+ _("Error cloning the Buffer."));
return false;
}
QFuture<Buffer::ExportStatus> f = QtConcurrent::run(
string const name = cmd.getArg(0);
string sdata = trim(to_utf8(cmd.argument()).substr(name.size()));
- if (name == "character") {
- sdata = freefont2string();
- if (!sdata.empty())
- showDialog("character", sdata);
- } else if (name == "latexlog") {
+ if (name == "latexlog") {
// gettatus checks that
LATTEST(doc_buffer);
Buffer::LogType type;